<source>ICON_OBJBROWSER_ADVANCED_203</source>
<translation>dividedcylinder.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS</source>
+ <translation>exportxao_exportingshape_filename_lgroups_lfields.png</translation>
+ </message>
+ <message>
+ <source>ICO_EXPORTXAO</source>
+ <translation>exportxao.png</translation>
+ </message>
+ <message>
+ <source>ICON_OBJBROWSER_IMPORTEXPORT_200</source>
+ <translation>tree_exportxao.png</translation>
+ </message>
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
</context>
</TS>
<translation>P&ublish And Close</translation>
</message>
</context>
+<context>
+ <name>ImportExportGUI_ExportXAODlg</name>
+ <message>
+ <source>GEOM_EXPORTXAO_TITLE</source>
+ <translation>Export XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO</source>
+ <translation>ExportXAO</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
+ <translation>Exporting Shape</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_FILENAME</source>
+ <translation>File Name</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_LGROUPS</source>
+ <translation>List of groups</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_LFIELDS</source>
+ <translation>List of fields</translation>
+ </message>
+</context>
+<context>
+ <name>@default</name>
+ <message>
+ <source>TOP_EXPORTXAO</source>
+ <translation>ExportXAO</translation>
+ </message>
+ <message>
+ <source>MEN_EXPORTXAO</source>
+ <translation>ExportXAO</translation>
+ </message>
+ <message>
+ <source>STB_EXPORTXAO</source>
+ <translation>ExportXAO</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTEXPORT_204</source>
+ <translation>ExportXAO</translation>
+ </message>
+</context>
</TS>
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
libName = "AdvancedGUI";
break;
+ case GEOMOp::OpExportXAO: // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO
+ libName = "ImportExportGUI";
+ break;
default:
break;
}
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
+ createGeomAction( GEOMOp::OpExportXAO, "EXPORTXAO" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus --------------------------
createMenu( GEOMOp::OpPipePath, genId, -1 );
#endif
-// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
+ int impexpId = createMenu( tr( "MEN_IMPORTEXPORT" ), newEntId, -1 );
+ createMenu( GEOMOp::OpExportXAO, impexpId, -1 );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
createTool( GEOMOp::OpFeatureDetect, picturesTbId );
#endif
-// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
+ int impexpTbId = createTool( tr( "TOOL_IMPORTEXPORT" ) );
+ createTool( GEOMOp::OpExportXAO, impexpTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
//OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
+ // ImportExport ----------------//--------------------------------
+ OpExportXAO = 10005, // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO
//@@ insert new functions before this line @@ do not remove this line @@//
};
}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include <Standard_Stream.hxx>
+
+#include <GEOMImpl_ExportXAODriver.hxx>
+#include <GEOMImpl_IExportXAO.hxx>
+#include <GEOMImpl_Types.hxx>
+#include <GEOM_Function.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+//@@ include required header files here @@//
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_ExportXAODriver::GetID()
+{
+ static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16");
+ return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_ExportXAODriver
+//purpose :
+//=======================================================================
+GEOMImpl_ExportXAODriver::GEOMImpl_ExportXAODriver()
+{
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_ExportXAODriver::Execute(TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IExportXAO aData (aFunction);
+ Standard_Integer aType = aFunction->GetType();
+
+ TopoDS_Shape aShape;
+
+ if (aType == EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS) {
+ //@@ add implementation of the operation driver here to initialize aShape variable @@//
+ //aShape = @...@
+ }
+ else {
+ // other construction modes here
+ }
+
+ if (aShape.IsNull()) return 0;
+
+ aFunction->SetValue(aShape);
+
+ log.SetTouched(Label());
+
+ return 1;
+}
+
+//=======================================================================
+//function : GEOMImpl_ExportXAODriver_Type_
+//purpose :
+//=======================================================================
+Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_()
+{
+ static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
+ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
+ static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+ if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+ static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+ static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportXAODriver",
+ sizeof(GEOMImpl_ExportXAODriver),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
+ return _aType;
+}
+
+//=======================================================================
+//function : DownCast
+//purpose :
+//=======================================================================
+const Handle(GEOMImpl_ExportXAODriver) Handle(GEOMImpl_ExportXAODriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+{
+ Handle(GEOMImpl_ExportXAODriver) _anOtherObject;
+
+ if (!AnObject.IsNull()) {
+ if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ExportXAODriver))) {
+ _anOtherObject = Handle(GEOMImpl_ExportXAODriver)((Handle(GEOMImpl_ExportXAODriver)&)AnObject);
+ }
+ }
+
+ return _anOtherObject;
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOMImpl_ExportXAODriver_HXX
+#define _GEOMImpl_ExportXAODriver_HXX
+
+#include <TFunction_Driver.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_ExportXAODriver;
+
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ExportXAODriver);
+
+class Handle(GEOMImpl_ExportXAODriver) : public Handle(TFunction_Driver) {
+public:
+ inline void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+
+ Handle(GEOMImpl_ExportXAODriver)():Handle(TFunction_Driver)() {}
+ Handle(GEOMImpl_ExportXAODriver)(const Handle(GEOMImpl_ExportXAODriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
+ {}
+
+ Handle(GEOMImpl_ExportXAODriver)(const GEOMImpl_ExportXAODriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
+ {}
+
+ Handle(GEOMImpl_ExportXAODriver)& operator=(const Handle(GEOMImpl_ExportXAODriver)& aHandle)
+ {
+ Assign(aHandle.Access());
+ return *this;
+ }
+
+ Handle(GEOMImpl_ExportXAODriver)& operator=(const GEOMImpl_ExportXAODriver* anItem)
+ {
+ Assign((Standard_Transient *)anItem);
+ return *this;
+ }
+
+ GEOMImpl_ExportXAODriver* operator->()
+ {
+ return (GEOMImpl_ExportXAODriver *)ControlAccess();
+ }
+
+ GEOMImpl_ExportXAODriver* operator->() const
+ {
+ return (GEOMImpl_ExportXAODriver *)ControlAccess();
+ }
+
+ Standard_EXPORT ~Handle(GEOMImpl_ExportXAODriver)() {};
+
+ Standard_EXPORT static const Handle(GEOMImpl_ExportXAODriver) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+
+class GEOMImpl_ExportXAODriver : public TFunction_Driver {
+public:
+ inline void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+
+ // Methods PUBLIC
+ //
+ Standard_EXPORT GEOMImpl_ExportXAODriver();
+ Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+ Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
+ {
+ return Standard_True;
+ }
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT ~GEOMImpl_ExportXAODriver() {};
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
+ {
+ return STANDARD_TYPE(GEOMImpl_ExportXAODriver);
+ }
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
+ {
+ return (STANDARD_TYPE(GEOMImpl_ExportXAODriver) == AType || TFunction_Driver::IsKind(AType));
+ }
+};
+
+#endif // _GEOMImpl_ExportXAODriver_HXX
#include <GEOMImpl_PipeTShapeDriver.hxx>
#include <GEOMImpl_DividedDiskDriver.hxx>
// #include <GEOMImpl_DividedCylinderDriver.hxx>
+#include <GEOMImpl_ExportXAODriver.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
//=============================================================================
// TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver());
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+ // ImportExport operations
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportXAODriver::GetID(), new GEOMImpl_ExportXAODriver());
+ /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+
SetEngine(this);
}
return _mapOfAdvancedOperations[theDocID];
}
+//=============================================================================
+/*!
+ * GetIImportExportOperations
+ */
+//=============================================================================
+GEOMImpl_IImportExportOperations* GEOMImpl_Gen::GetIImportExportOperations(int theDocID)
+{
+ if(_mapOfImportExportOperations.find(theDocID) == _mapOfImportExportOperations.end()) {
+ _mapOfImportExportOperations[theDocID] = new GEOMImpl_IImportExportOperations(this, theDocID);
+ }
+
+ return _mapOfImportExportOperations[theDocID];
+}
+
#include "GEOMImpl_IMeasureOperations.hxx"
#include "GEOMImpl_IGroupOperations.hxx"
#include "GEOMImpl_IAdvancedOperations.hxx"
+#include "GEOMImpl_IImportExportOperations.hxx"
#include "GEOM_Engine.hxx"
class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
GEOMImpl_IAdvancedOperations* GetIAdvancedOperations(int theDocID);
+ GEOMImpl_IImportExportOperations* GetIImportExportOperations(int theDocID);
+
private:
std::map <int, GEOMImpl_IBasicOperations*> _mapOfBasicOperations;
std::map <int, GEOMImpl_IMeasureOperations*> _mapOfMeasureOperations;
std::map <int, GEOMImpl_IGroupOperations*> _mapOfGroupOperations;
std::map <int, GEOMImpl_IAdvancedOperations*> _mapOfAdvancedOperations;
+ std::map <int, GEOMImpl_IImportExportOperations*> _mapOfImportExportOperations;
};
#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOMImpl_IExportXAO_HXX_
+#define _GEOMImpl_IExportXAO_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define EXPORTXAO_ARG_EXPORTINGSHAPE 1
+#define EXPORTXAO_ARG_FILENAME 2
+#define EXPORTXAO_ARG_LGROUPS 3
+#define EXPORTXAO_ARG_LFIELDS 4
+
+class GEOMImpl_IExportXAO
+{
+public:
+ GEOMImpl_IExportXAO(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetExportingShape(Handle(GEOM_Function) theExportingShape) { _func->SetReference(EXPORTXAO_ARG_EXPORTINGSHAPE, theExportingShape); }
+ Handle(GEOM_Function) GetExportingShape() { return _func->GetReference(EXPORTXAO_ARG_EXPORTINGSHAPE); }
+
+ void SetFileName(const TCollection_AsciiString& theFileName) { _func->SetString(EXPORTXAO_ARG_FILENAME, theFileName); }
+ const TCollection_AsciiString GetFileName() { return _func->GetString(EXPORTXAO_ARG_FILENAME); }
+
+ void SetGroup(int theId, Handle(GEOM_Function) theGroup) { _func->SetReference(EXPORTXAO_ARG_LGROUPS+theId, theGroup); }
+ Handle(GEOM_Function) GetGroup(int theId) { return _func->GetReference(EXPORTXAO_ARG_LGROUPS+theId); }
+
+ void SetField(int theId, Handle(GEOM_Function) theField) { _func->SetReference(EXPORTXAO_ARG_LFIELDS+theId, theField); }
+ Handle(GEOM_Function) GetField(int theId) { return _func->GetReference(EXPORTXAO_ARG_LFIELDS+theId); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_IExportXAO_HXX_
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMImpl_IImportExportOperations.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include <Standard_Stream.hxx>
+
+#include "GEOMImpl_Types.hxx"
+#include "GEOMImpl_IImportExportOperations.hxx"
+#include "GEOMImpl_IBasicOperations.hxx"
+#include "GEOMImpl_IBooleanOperations.hxx"
+#include "GEOMImpl_IShapesOperations.hxx"
+#include "GEOMImpl_ITransformOperations.hxx"
+#include "GEOMImpl_IBlocksOperations.hxx"
+#include "GEOMImpl_I3DPrimOperations.hxx"
+#include "GEOMImpl_ILocalOperations.hxx"
+#include "GEOMImpl_IHealingOperations.hxx"
+
+#include "GEOMImpl_Gen.hxx"
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
+
+#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
+#include <GEOMImpl_ExportXAODriver.hxx>
+#include <GEOMImpl_IExportXAO.hxx>
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Ax3.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRep_Tool.hxx>
+#include <cmath>
+
+#include <TFunction_DriverTable.hxx>
+#include <TFunction_Driver.hxx>
+#include <TFunction_Logbook.hxx>
+#include <TDF_Tool.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations(GEOM_Engine* theEngine, int theDocID) :
+ GEOM_IOperations(theEngine, theDocID)
+{
+ MESSAGE("GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations");
+ myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+ myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+ myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+ myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+ myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+ my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+ myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+ myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations()
+{
+ MESSAGE("GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations");
+ delete myBasicOperations;
+ delete myBooleanOperations;
+ delete myShapesOperations;
+ delete myTransformOperations;
+ delete myBlocksOperations;
+ delete my3DPrimOperations;
+ delete myLocalOperations;
+ delete myHealingOperations;
+}
+
+//=============================================================================
+/*!
+ * Export a shape to XAO Format
+ * \param theExportingShape Shape to export
+ * \param theFileName The name of the exported file
+ * \param thelGroups List of groups to export
+ * \param thelFields List of fields to export
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+bool GEOMImpl_IImportExportOperations::ExportXAO (Handle(GEOM_Object) theExportingShape, const std::string theFileName, std::list<Handle(GEOM_Object)> thelGroups, std::list<Handle(GEOM_Object)> thelFields)
+{
+ SetErrorCode(KO);
+ bool isGood = false;
+
+ //Add a new shape function with parameters
+ Handle(GEOM_Function) aRefFunction = theExportingShape->GetLastFunction();
+ if (aRefFunction.IsNull()) return false;
+
+ //Add a new result object
+ Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
+
+ //Add an Export function
+ Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_ExportXAODriver::GetID(), EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS);
+ if (aFunction.IsNull()) return false;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ExportXAODriver::GetID()) return false;
+
+ GEOMImpl_IExportXAO aData (aRefFunction);
+
+ TCollection_AsciiString FileName = theFileName.c_str();
+ aData.SetExportingShape(aRefFunction);
+ aData.SetFileName(FileName);
+ /* A MODIFIER aData.SetlGroups(thelGroups);
+ aData.SetlFields(thelFields);*/
+
+ //Compute the resulting value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("ExportXAO driver failed : Not enough space on disk, or you haven't permissions to write this directory");
+ return false;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return false;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ std::list<Handle(GEOM_Object)>::iterator itG = thelGroups.begin();
+ std::list<Handle(GEOM_Object)>::iterator itF = thelFields.begin();
+ pd << /*isGood <<*/ " = geompy.ExportXAO(" << theExportingShape << ", " << FileName.ToCString() << ", [";
+ //itG = thePoints.begin();
+ pd << (*itG++);
+ while (itG != thelGroups.end()) {
+ pd << ", " << (*itG++);
+ }
+ pd << "], [";
+ pd << (*itF++);
+ while (itF != thelFields.end()) {
+ pd << ", " << (*itF++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+
+ return isGood;
+}
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMImpl_IImportExportOperations.hxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef _GEOMImpl_IImportExportOperations_HXX_
+#define _GEOMImpl_IImportExportOperations_HXX_
+
+#include <Utils_SALOME_Exception.hxx>
+#include "GEOM_IOperations.hxx"
+#include "GEOM_Engine.hxx"
+#include "GEOM_Object.hxx"
+
+#include <list>
+
+class GEOMImpl_IBasicOperations;
+class GEOMImpl_IBooleanOperations;
+class GEOMImpl_IShapesOperations;
+class GEOMImpl_ITransformOperations;
+class GEOMImpl_IBlocksOperations;
+class GEOMImpl_I3DPrimOperations;
+class GEOMImpl_ILocalOperations;
+class GEOMImpl_IHealingOperations;
+
+class GEOMImpl_IImportExportOperations: public GEOM_IOperations {
+
+private:
+ GEOMImpl_IBasicOperations* myBasicOperations;
+ GEOMImpl_IBooleanOperations* myBooleanOperations;
+ GEOMImpl_IShapesOperations* myShapesOperations;
+ GEOMImpl_ITransformOperations* myTransformOperations;
+ GEOMImpl_IBlocksOperations* myBlocksOperations;
+ GEOMImpl_I3DPrimOperations* my3DPrimOperations;
+ GEOMImpl_ILocalOperations* myLocalOperations;
+ GEOMImpl_IHealingOperations* myHealingOperations;
+
+public:
+ Standard_EXPORT GEOMImpl_IImportExportOperations(GEOM_Engine* theEngine, int theDocID);
+ Standard_EXPORT ~GEOMImpl_IImportExportOperations();
+
+ Standard_EXPORT bool ExportXAO (Handle(GEOM_Object) theExportingShape, const std::string theFileName, std::list<Handle(GEOM_Object)> thelGroups, std::list<Handle(GEOM_Object)> thelFields);
+ /*@@ insert new functions before this line @@ do not remove this line @@*/
+};
+#endif
#define GEOM_TSHAPE 201
#define GEOM_DIVIDEDDISK 202
#define GEOM_DIVIDEDCYLINDER 203
+#define GEOM_EXPORTXAO 204
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
// Advanced functions sub-operations codes
#define TSHAPE_BASIC 1
#define DIVIDEDDISK_R_RATIO 1
#define DIVIDEDDISK_R_VECTOR_PNT 2
#define DIVIDEDCYLINDER_R_H 1
+#define EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS 1
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
FF1BBB70-5D14-4df2-980B-3A668264EA16 // Projection
1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape
+
+FF1BBB71-5D14-4df2-980B-3A668264EA16 // Export XAO
GEOMImpl_IMeasureOperations.hxx \
GEOMImpl_IGroupOperations.hxx \
GEOMImpl_IAdvancedOperations.hxx \
+ GEOMImpl_IImportExportOperations.hxx \
GEOMImpl_IGlue.hxx \
GEOMImpl_PointDriver.hxx \
GEOMImpl_IPoint.hxx \
ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx
+IMPORTEXPORT_INCLUDES =
+IMPORTEXPORT_INCLUDES += GEOMImpl_IExportXAO.hxx GEOMImpl_ExportXAODriver.hxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
+salomeinclude_HEADERS += $(IMPORTEXPORT_INCLUDES)
dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_IBasicOperations.cxx \
GEOMImpl_IMeasureOperations.cxx \
GEOMImpl_IGroupOperations.cxx \
GEOMImpl_IAdvancedOperations.cxx \
+ GEOMImpl_IImportExportOperations.cxx \
GEOMImpl_Gen.cxx \
GEOMImpl_PointDriver.cxx \
GEOMImpl_VectorDriver.cxx \
ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
+IMPORTEXPORT_SOURCES =
+IMPORTEXPORT_SOURCES += GEOMImpl_ExportXAODriver.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)
+dist_libGEOMimpl_la_SOURCES += $(IMPORTEXPORT_SOURCES)
# additional information to compile and link file
return operations._retn();
}
+//============================================================================
+// function : GetIImportExportOperations
+// purpose :
+//============================================================================
+GEOM::GEOM_IImportExportOperations_ptr GEOM_Gen_i::GetIImportExportOperations(CORBA::Long theStudyID)
+ throw ( SALOME::SALOME_Exception )
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" );
+
+ GEOM::GEOM_Gen_ptr engine = _this();
+
+ GEOM_IImportExportOperations_i* aServant =
+ new GEOM_IImportExportOperations_i(_poa, engine, _impl->GetIImportExportOperations(theStudyID));
+
+ // activate the CORBA servant
+ GEOM::GEOM_IImportExportOperations_var operations = aServant->_this();
+ return operations._retn();
+}
+
//=============================================================================
/*!
* AddSubShape
#include "GEOM_IMeasureOperations_i.hh"
#include "GEOM_IGroupOperations_i.hh"
#include "GEOM_IAdvancedOperations_i.hh"
+#include "GEOM_IImportExportOperations_i.hh"
#include <TopTools_IndexedMapOfShape.hxx>
virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception);
+ //Returns a pointer to ImportExportOperations interface
+ virtual GEOM::GEOM_IImportExportOperations_ptr GetIImportExportOperations (CORBA::Long theStudyID)
+ throw (SALOME::SALOME_Exception);
+
//Adds a new sub-shape
virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfLong& theIndices);
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GEOM_IImportExportOperations.cc
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+#include <Standard_Stream.hxx>
+
+#include "GEOM_IImportExportOperations_i.hh"
+
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
+
+#include "GEOM_Engine.hxx"
+#include "GEOM_Object.hxx"
+
+//=============================================================================
+/*!
+ * constructor:
+ */
+//=============================================================================
+GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IImportExportOperations* theImpl)
+:GEOM_IOperations_i(thePOA, theEngine, theImpl)
+{
+ MESSAGE("GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i");
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i()
+{
+ MESSAGE("GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i");
+}
+
+//=============================================================================
+/*!
+ * Export a shape to XAO Format
+ * \param theExportingShape Shape to export
+ * \param theFileName The name of the exported file
+ * \param thelGroups List of groups to export
+ * \param thelFields List of fields to export
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields)
+{
+ bool isGood = false;
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Get the reference shape
+ Handle(GEOM_Object) aReference = GetObjectImpl(theExportingShape);
+
+ //Get the reference groups
+ int ind = 0;
+ int aLenGroup = thelGroups.length();
+ std::list<Handle(GEOM_Object)> aGroups;
+ for (; ind < aLenGroup; ind++) {
+ Handle(GEOM_Object) aGroup = GetObjectImpl(thelGroups[ind]);
+ if (aGroup.IsNull()) return false;
+ aGroups.push_back(aGroup);
+ }
+
+ //Get the reference point
+ ind = 0;
+ int aLenField = thelFields.length();
+ std::list<Handle(GEOM_Object)> aFields;
+ for (; ind < aLenField; ind++) {
+ Handle(GEOM_Object) aField = GetObjectImpl(thelFields[ind]);
+ if (aField.IsNull()) return false;
+ aFields.push_back(aField);
+ }
+
+ if (!aReference.IsNull())
+ {
+ // Export XAO
+ isGood = GetOperations()->ExportXAO(aReference, theFileName, aGroups, aFields);
+ }
+
+ return isGood;
+}
+
+/*@@ insert new functions before this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GEOM_IImportExportOperations.hh
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+#ifndef _GEOM_IImportExportOperations_i_HeaderFile
+#define _GEOM_IImportExportOperations_i_HeaderFile
+
+#include "GEOMImpl_Gen.hxx"
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include "GEOM_IOperations_i.hh"
+#include "GEOM_Object_i.hh"
+
+#include "GEOMImpl_IImportExportOperations.hxx"
+
+class GEOM_I_EXPORT GEOM_IImportExportOperations_i :
+ public virtual POA_GEOM::GEOM_IImportExportOperations,
+ public virtual GEOM_IOperations_i
+{
+ public:
+ GEOM_IImportExportOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_IImportExportOperations* theImpl);
+ ~GEOM_IImportExportOperations_i();
+
+ CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields);
+ /*@@ insert new functions before this line @@ do not remove this line @@*/
+
+ ::GEOMImpl_IImportExportOperations* GetOperations()
+ { return (::GEOMImpl_IImportExportOperations*)GetImpl(); }
+};
+
+#endif
GEOM_IMeasureOperations_i.hh \
GEOM_IGroupOperations_i.hh \
GEOM_IAdvancedOperations_i.hh \
+ GEOM_IImportExportOperations_i.hh \
GEOM_Gen_i.hh \
GEOM_GEOM_I.hxx
GEOM_IMeasureOperations_i.cc \
GEOM_IGroupOperations_i.cc \
GEOM_IAdvancedOperations_i.cc \
+ GEOM_IImportExportOperations_i.cc \
GEOM_Gen_i.cc \
GEOM_DumpPython.cc
}
}
+//=============================================================================
+// getImportExportOp:
+//=============================================================================
+void GEOM_Superv_i::getImportExportOp()
+{
+ if (CORBA::is_nil(myGeomEngine))
+ setGeomEngine();
+ // get GEOM_IImportExportOperations interface
+ if (CORBA::is_nil(myImportExportOp) || isNewStudy(myLastStudyID,myStudyID)) {
+ //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS"
+ // Try to get id of the study from the SALOME Session
+ if(myStudyID < 0 ) SetStudyID(-1);
+ myImportExportOp = myGeomEngine->GetIImportExportOperations(myStudyID);
+ }
+}
+
//=============================================================================
// GetServant:
//=============================================================================
return anObj;
}
+//=============================================================================
+// ExportXAO
+//=============================================================================
+CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields)
+{
+ beginService( " GEOM_Superv_i::ExportXAO" );
+ MESSAGE("GEOM_Superv_i::ExportXAO");
+ getImportExportOp();
+ if (GEOM_List_i<GEOM::ListOfGO>* aListImplG =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelGroups, myPOA).in()))
+ {
+ if (GEOM_List_i<GEOM::ListOfGO>* aListImplF =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelFields, myPOA).in()))
+ {
+ CORBA::Boolean isGood = myImportExportOp->ExportXAO(theExportingShape, theFileName, aListImplG->GetList(), aListImplF->GetList());
+ endService( " GEOM_Superv_i::ExportXAO" );
+ return isGood;
+ }
+ }
+ endService( " GEOM_Superv_i::ExportXAO" );
+ return false;
+}
/*@@ insert new functions before this line @@ do not remove this line @@*/
//=====================================================================================
void getLocalOp();
void getGroupOp();
void getAdvancedOp();
+ void getImportExportOp();
PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject,
PortableServer::POA_ptr thePOA);
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
CORBA::Double theH,
GEOM::pattern thePattern);
+ //-----------------------------------------------------------//
+ // ImportExport Operations //
+ //-----------------------------------------------------------//
+ CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
private:
self.BlocksOp = None
self.GroupOp = None
self.AdvOp = None
+ self.ImpExpOp = None
pass
## @addtogroup l1_geompy_auxiliary
self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
self.GroupOp = self.GetIGroupOperations (self.myStudyId)
self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
+ self.ImpExpOp = self.GetIImportExportOperations (self.myStudyId)
pass
## Dump component to the Python script
if Parameters: anObj.SetParameters(Parameters)
return anObj
+ ## Export a shape to XAO Format
+ # @param theExportingShape Shape to export
+ # @param theFileName The name of the exported file
+ # @param thelGroups List of groups to export
+ # @param thelFields List of fields to export
+ # @return New GEOM_Object, containing the created shape.
+ #
+ # @ref tui_creation_exportxao "Example"
+ def ExportXAO(self, theExportingShape, theFileName, thelGroups, thelFields):
+ theExportingShape, theFileName, thelGroups, thelFields, Parameters = ParseParameters(theExportingShape, theFileName, thelGroups, thelFields)
+ isGood = self.ImpExpOp.ExportXAO(theExportingShape, theFileName, thelGroups, thelFields)
+ RaiseIfFailed("ExportXAO", self.ImpExpOp)
+ #if Parameters: anObj.SetParameters(Parameters)
+ return isGood
+
#@@ insert new functions before this line @@ do not remove this line @@#
# end of l4_advanced