1 // Copyright (C) 2013 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.
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
19 #include <Standard_Stream.hxx>
21 #include <GEOMImpl_XAODriver.hxx>
22 #include <GEOMImpl_IImportExportXAO.hxx>
23 #include <GEOMImpl_Types.hxx>
24 #include <GEOM_Function.hxx>
26 #include <TFunction_Logbook.hxx>
27 #include <StdFail_NotDone.hxx>
29 #include "XAO_Xao.hxx"
30 #include "XAO_Geometry.hxx"
31 #include "XAO_Group.hxx"
32 #include "XAO_XaoUtils.hxx"
33 //@@ include required header files here @@//
35 //=======================================================================
38 //=======================================================================
39 const Standard_GUID& GEOMImpl_XAODriver::GetID()
41 static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16");
45 //=======================================================================
46 //function : GEOMImpl_XAODriver
48 //=======================================================================
49 GEOMImpl_XAODriver::GEOMImpl_XAODriver()
53 //=======================================================================
56 //=======================================================================
57 Standard_Integer GEOMImpl_XAODriver::Execute(TFunction_Logbook& log) const
59 if (Label().IsNull()) return 0;
60 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
62 GEOMImpl_IImportExportXAO iexao(function);
63 TCollection_AsciiString xao = iexao.GetData();
67 Standard_Integer functionType = function->GetType();
68 if (functionType == IMPORTEXPORT_EXPORTXAO)
71 else if (functionType == IMPORTEXPORT_IMPORTXAO)
76 // other construction modes here
79 if (shape.IsNull()) return 0;
81 function->SetValue(shape);
83 log.SetTouched(Label());
88 //=======================================================================
89 //function : GEOMImpl_XAODriver_Type_
91 //=======================================================================
92 Standard_EXPORT Handle_Standard_Type& GEOMImpl_XAODriver_Type_()
94 static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
95 if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
96 static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
97 if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
98 static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
99 if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
101 static Handle_Standard_Transient _Ancestors[] = { aType1, aType2, aType3, NULL };
102 static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_XAODriver",
103 sizeof(GEOMImpl_XAODriver),
105 (Standard_Address) _Ancestors,
106 (Standard_Address) NULL);
110 //=======================================================================
111 //function : DownCast
113 //=======================================================================
114 const Handle(GEOMImpl_XAODriver) Handle(GEOMImpl_XAODriver)::DownCast(
115 const Handle(Standard_Transient)& AnObject)
117 Handle(GEOMImpl_XAODriver) _anOtherObject;
119 if (!AnObject.IsNull())
121 if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_XAODriver)))
123 _anOtherObject = Handle(GEOMImpl_XAODriver)((Handle(GEOMImpl_XAODriver)&) AnObject);
127 return _anOtherObject;