Salome HOME
Synchronize adm files
[modules/geom.git] / src / GEOMImpl / GEOMImpl_XAODriver.cxx
1 // Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <Standard_Stream.hxx>
21
22 #include <GEOMImpl_XAODriver.hxx>
23 #include <GEOMImpl_IImportExportXAO.hxx>
24 #include <GEOMImpl_Types.hxx>
25 #include <GEOM_Function.hxx>
26
27 #include <TFunction_Logbook.hxx>
28 #include <StdFail_NotDone.hxx>
29
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 @@//
35
36 //=======================================================================
37 //function : GetID
38 //purpose  :
39 //=======================================================================
40 const Standard_GUID& GEOMImpl_XAODriver::GetID()
41 {
42     static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16");
43     return aGUID;
44 }
45
46 //=======================================================================
47 //function : GEOMImpl_XAODriver
48 //purpose  :
49 //=======================================================================
50 GEOMImpl_XAODriver::GEOMImpl_XAODriver()
51 {
52 }
53
54 //=======================================================================
55 //function : Execute
56 //purpose  :
57 //=======================================================================
58 Standard_Integer GEOMImpl_XAODriver::Execute(TFunction_Logbook& log) const
59 {
60     if (Label().IsNull()) return 0;
61     Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
62
63     GEOMImpl_IImportExportXAO iexao(function);
64     TCollection_AsciiString xao   = iexao.GetData();
65
66     TopoDS_Shape shape;
67
68     Standard_Integer functionType = function->GetType();
69     if (functionType == IMPORTEXPORT_EXPORTXAO)
70     {
71     }
72     else if (functionType == IMPORTEXPORT_IMPORTXAO)
73     {
74     }
75     else
76     {
77         // other construction modes here
78     }
79
80     if (shape.IsNull()) return 0;
81
82     function->SetValue(shape);
83
84     log.SetTouched(Label());
85
86     return 1;
87 }
88
89 //=======================================================================
90 //function :  GEOMImpl_XAODriver_Type_
91 //purpose  :
92 //=======================================================================
93 Standard_EXPORT Handle_Standard_Type& GEOMImpl_XAODriver_Type_()
94 {
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);
101
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),
105             1,
106             (Standard_Address) _Ancestors,
107             (Standard_Address) NULL);
108     return _aType;
109 }
110
111 //=======================================================================
112 //function : DownCast
113 //purpose  :
114 //=======================================================================
115 const Handle(GEOMImpl_XAODriver) Handle(GEOMImpl_XAODriver)::DownCast(
116         const Handle(Standard_Transient)& AnObject)
117 {
118     Handle(GEOMImpl_XAODriver) _anOtherObject;
119
120     if (!AnObject.IsNull())
121     {
122         if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_XAODriver)))
123         {
124             _anOtherObject = Handle(GEOMImpl_XAODriver)((Handle(GEOMImpl_XAODriver)&) AnObject);
125         }
126     }
127
128     return _anOtherObject;
129 }