1 // Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <Standard_Stream.hxx>
22 #include <GEOMImpl_XAODriver.hxx>
23 #include <GEOMImpl_IImportExportXAO.hxx>
24 #include <GEOMImpl_Types.hxx>
25 #include <GEOM_Function.hxx>
27 #include <TFunction_Logbook.hxx>
28 #include <StdFail_NotDone.hxx>
30 #include "XAO_Xao.hxx"
31 #include "XAO_Geometry.hxx"
32 #include "XAO_Group.hxx"
33 #include "XAO_XaoUtils.hxx"
34 //@@ include required header files here @@//
36 //=======================================================================
39 //=======================================================================
40 const Standard_GUID& GEOMImpl_XAODriver::GetID()
42 static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16");
46 //=======================================================================
47 //function : GEOMImpl_XAODriver
49 //=======================================================================
50 GEOMImpl_XAODriver::GEOMImpl_XAODriver()
54 //=======================================================================
57 //=======================================================================
58 Standard_Integer GEOMImpl_XAODriver::Execute(TFunction_Logbook& log) const
60 if (Label().IsNull()) return 0;
61 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
63 GEOMImpl_IImportExportXAO iexao(function);
64 TCollection_AsciiString xao = iexao.GetData();
68 Standard_Integer functionType = function->GetType();
69 if (functionType == IMPORTEXPORT_EXPORTXAO)
72 else if (functionType == IMPORTEXPORT_IMPORTXAO)
77 // other construction modes here
80 if (shape.IsNull()) return 0;
82 function->SetValue(shape);
84 log.SetTouched(Label());
89 //=======================================================================
90 //function : GEOMImpl_XAODriver_Type_
92 //=======================================================================
93 Standard_EXPORT Handle_Standard_Type& GEOMImpl_XAODriver_Type_()
95 static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
96 if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
97 static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
98 if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
99 static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
100 if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
102 static Handle_Standard_Transient _Ancestors[] = { aType1, aType2, aType3, NULL };
103 static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_XAODriver",
104 sizeof(GEOMImpl_XAODriver),
106 (Standard_Address) _Ancestors,
107 (Standard_Address) NULL);
111 //=======================================================================
112 //function : DownCast
114 //=======================================================================
115 const Handle(GEOMImpl_XAODriver) Handle(GEOMImpl_XAODriver)::DownCast(
116 const Handle(Standard_Transient)& AnObject)
118 Handle(GEOMImpl_XAODriver) _anOtherObject;
120 if (!AnObject.IsNull())
122 if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_XAODriver)))
124 _anOtherObject = Handle(GEOMImpl_XAODriver)((Handle(GEOMImpl_XAODriver)&) AnObject);
128 return _anOtherObject;