1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include "GEOMImpl_ExportDriver.hxx"
25 #include "GEOMImpl_IImportExport.hxx"
26 #include "GEOMImpl_IECallBack.hxx"
27 #include "GEOMImpl_Types.hxx"
30 #include <GEOM_Function.hxx>
33 #include <Standard_Stream.hxx>
34 #include <TopoDS_Shape.hxx>
37 //=======================================================================
40 //=======================================================================
41 const Standard_GUID& GEOMImpl_ExportDriver::GetID()
43 static Standard_GUID aExportDriver("FF1BBB58-5D14-4df2-980B-3A668264EA16");
48 //=======================================================================
49 //function : GEOMImpl_ExportDriver
51 //=======================================================================
52 GEOMImpl_ExportDriver::GEOMImpl_ExportDriver()
56 //=======================================================================
59 //=======================================================================
60 Standard_Integer GEOMImpl_ExportDriver::Execute(LOGBOOK& log) const
62 if (Label().IsNull()) return 0;
63 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
65 GEOMImpl_IImportExport aCI (aFunction);
67 // retrieve the being exported shape
69 Handle(GEOM_Function) aRefFunction = aCI.GetOriginal();
70 if (aRefFunction.IsNull()) return 0;
71 aShape = aRefFunction->GetValue();
72 if (aShape.IsNull()) return 0;
73 // !!! set the result of function to be used by next operations
74 aFunction->SetValue(aShape);
76 TDF_Label aLabel = aRefFunction->GetOwnerEntry();
77 if (aLabel.IsRoot()) return 0;
78 Handle(GEOM_Object) obj = GEOM_Object::GetObject( aLabel );
79 if ( obj.IsNull() ) return 0;
81 // retrieve the file and format names
82 TCollection_AsciiString aFileName = aCI.GetFileName();
83 TCollection_AsciiString aFormatName = aCI.GetFormatName();
84 TCollection_AsciiString aLibName = aCI.GetPluginName();
85 if (aFileName.IsEmpty() || aFormatName.IsEmpty() || aLibName.IsEmpty())
88 if( !GEOMImpl_IECallBack::GetCallBack( aFormatName )->Export( GetDocID(), obj, aFileName, aFormatName ) );
91 #if OCC_VERSION_MAJOR < 7
92 log.SetTouched(Label());
94 log->SetTouched(Label());
100 //================================================================================
102 * \brief Returns a name of creation operation and names and values of creation parameters
104 //================================================================================
106 bool GEOMImpl_ExportDriver::
107 GetCreationInformation(std::string& theOperationName,
108 std::vector<GEOM_Param>& theParams)
113 OCCT_IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ExportDriver,GEOM_BaseDriver);