]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Export XAO with the shape in a seperated BREP file.
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Thu, 15 Dec 2016 15:36:42 +0000 (16:36 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Thu, 15 Dec 2016 15:36:42 +0000 (16:36 +0100)
This allows to avoid too big xml files.

23 files changed:
idl/GEOM_Superv.idl
idl/XAOPlugin.idl
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/XAOPluginBuilder.py
src/XAO/XAO_BrepGeometry.cxx
src/XAO/XAO_BrepGeometry.hxx
src/XAO/XAO_Geometry.hxx
src/XAO/XAO_Xao.cxx
src/XAO/XAO_Xao.hxx
src/XAO/XAO_XaoExporter.cxx
src/XAO/XAO_XaoExporter.hxx
src/XAO/tests/ImportExportTest.cxx
src/XAOPlugin/XAOPlugin_ExportDlg.cxx
src/XAOPlugin/XAOPlugin_ExportDlg.h
src/XAOPlugin/XAOPlugin_IECallBack.cxx
src/XAOPlugin/XAOPlugin_IECallBack.hxx
src/XAOPlugin/XAOPlugin_IOperations.cxx
src/XAOPlugin/XAOPlugin_IOperations.hxx
src/XAOPlugin/XAOPlugin_IOperations_i.cc
src/XAOPlugin/XAOPlugin_IOperations_i.hh
src/XAOPlugin/XAOPlugin_msg_en.ts
src/XAOPlugin/XAOPlugin_msg_fr.ts

index c12b0104caf198abac61fd3c85e2c8944f1c2c00..003c8210bbe23f5a204ea42710331cbcff0f23e0 100644 (file)
@@ -668,7 +668,8 @@ module GEOM
                            in ListOfGO groups, 
                            in ListOfFields fields,
                            in string author, 
-                           in string fileName );
+                           in string fileName,
+                           in string shapeFileName );
     boolean     ImportXAO( in string fileName, 
                            out GEOM_Object shape,
                            out ListOfGO subShapes, 
index 16a470802f836199eef6cb685d3c852efb2b10a4..d8e2ebb7f6cc69a8c67077f6dbadf2187512552c 100644 (file)
@@ -36,13 +36,15 @@ module GEOM
      *  \param fields The list of fields to export
      *  \param author The author of the export
      *  \param fileName The name of the file to export
+     *  \param shapeFileName The name of the file to export the shape in an external file
      *  \return boolean indicating if export was successful.
      */
     boolean ExportXAO( in GEOM::GEOM_Object shape,
                        in GEOM::ListOfGO groups, 
                        in GEOM::ListOfFields fields,
                        in string author, 
-                       in string fileName );
+                       in string fileName,
+                       in string shapeFileName );
     
     /*!
      *  Import a shape from XAO format
index 2984de3afce8e2d6ccfef6608c256ca07a4ace5c..1ba00706701b224ca09039e8260511457344e0b0 100644 (file)
@@ -3633,12 +3633,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportIGES( const char* theFileName,
 CORBA::Boolean GEOM_Superv_i::ExportXAO( GEOM::GEOM_Object_ptr shape,
                                          const GEOM::ListOfGO& groups,
                                          const GEOM::ListOfFields& fields,
-                                         const char* author, const char* fileName )
+                                         const char* author,
+                                         const char* fileName,
+                                         const char* shapeFileName )
 {
   beginService( " GEOM_Superv_i::ExportXAO" );
   MESSAGE("GEOM_Superv_i::ExportXAO");
   getXAOPluginOp();
-  CORBA::Boolean isGood = myXAOOp->ExportXAO( shape, groups, fields, author, fileName );
+  CORBA::Boolean isGood = myXAOOp->ExportXAO( shape, groups, fields, author, fileName, shapeFileName );
   endService( " GEOM_Superv_i::ExportXAO" );
   return isGood;
 }
index 594215cc4d3d4b6221e5313e5fd681cc42bf609b..8d712acdeb27ebf049dbeb8967b60d28b3670c9d 100644 (file)
@@ -744,7 +744,8 @@ public:
                             const GEOM::ListOfGO& groups,
                             const GEOM::ListOfFields& fields,
                             const char* author,
-                            const char* fileName);
+                            const char* fileName,
+                            const char* shapeFileName);
   CORBA::Boolean ImportXAO( const char* fileName,
                             GEOM::GEOM_Object_out shape,
                             GEOM::ListOfGO_out subShapes,
index aeffc075ed7c945552ae0f1cf7ea3b4d51ffac9e..84a0945d65e796e82ed787f78769e78b90874408 100644 (file)
@@ -33,10 +33,11 @@ def GetXAOPluginOperations(self):
 #  @param fields The list of fields to export
 #  @param author The author of the file
 #  @param fileName The name of the file to export
+#  @param shapeFileName The name of the BRep file to export
 #  @return True if operation is successful or False otherwise
 #
 #  @ingroup l2_import_export
-def ExportXAO(self, shape, groups, fields, author, fileName):
+def ExportXAO(self, shape, groups, fields, author, fileName, shapeFileName = ""):
     """
     Export a shape to XAO format
     
@@ -52,7 +53,7 @@ def ExportXAO(self, shape, groups, fields, author, fileName):
     """
     from salome.geom.geomBuilder import RaiseIfFailed
     anOp = GetXAOPluginOperations(self)
-    res = anOp.ExportXAO(shape, groups, fields, author, fileName)
+    res = anOp.ExportXAO(shape, groups, fields, author, fileName, shapeFileName)
     RaiseIfFailed("ExportXAO", anOp)
     return res
 
index fb59e2cd54e8e508cd0ac753310f0232cbdc5af1..db3c162b0f1bb44b2a960f6035f557ac0f4e3b09 100644 (file)
@@ -65,6 +65,25 @@ void BrepGeometry::setShapeString(const std::string& shape)
     initIds();
 }
 
+void BrepGeometry::writeShapeFile(const std::string& fileName)
+throw (XAO_Exception)
+{
+    bool res = BRepTools::Write(m_shape, fileName.c_str());
+    if (!res)
+        throw XAO_Exception(MsgBuilder() << "Cannot write BRep file: " << fileName);
+}
+
+void BrepGeometry::readShapeFile(const std::string& fileName)
+throw (XAO_Exception)
+ {
+    BRep_Builder builder;
+    bool res = BRepTools::Read(m_shape, fileName.c_str(), builder);
+    if (!res)
+        throw XAO_Exception(MsgBuilder() << "Cannot read BRep file: " << fileName);
+
+    initIds();
+}
+
 TopoDS_Shape BrepGeometry::getTopoDS_Shape()
 {
     return m_shape;
index 59d19ba5450a94b26e094c9d393acf2d1c3bc710..e5782338495b1da42bc87e177807d1ca8fd4d950 100644 (file)
@@ -75,6 +75,18 @@ namespace XAO
          */
         virtual void setShapeString(const std::string& shape);
 
+        /**
+         * Writes shape to a file
+         * @param fileName the path to the file
+         */
+        virtual void writeShapeFile(const std::string& fileName) throw (XAO_Exception);
+
+        /**
+         * Reads shape from a file
+         * @param fileName the path to the file
+         */
+        virtual void readShapeFile(const std::string& fileName) throw (XAO_Exception);
+
 #ifdef SWIG
         %pythoncode %{
         def setShape(self, shape):
index 698843c9e981f7b8740a2be1a23d9767af865ad7..34760ca345bb0496646a8bca72379f22a8d4a0a7 100644 (file)
@@ -94,6 +94,8 @@ namespace XAO
 
         virtual const std::string getShapeString() = 0;
         virtual void setShapeString(const std::string& shape) = 0;
+        virtual void writeShapeFile(const std::string& fileName) = 0;
+        virtual void readShapeFile(const std::string& fileName) = 0;
 
         const int countElements(const XAO::Dimension& dim) const throw (XAO_Exception);
         const int countVertices() const { return m_vertices.getSize(); }
index 4e9652a26990daaf07653230252e66afee041887..1ec749b35829bbca38add6827f87f3f72dd4acba 100644 (file)
@@ -241,9 +241,9 @@ bool Xao::removeField(Field* field)
     return res;
 }
 
-const bool Xao::exportXAO(const std::string& fileName)
+const bool Xao::exportXAO(const std::string& fileName, const std::string& shapeFileName)
 {
-    return XaoExporter::saveToFile(this, fileName);
+    return XaoExporter::saveToFile(this, fileName, shapeFileName);
 }
 
 const std::string Xao::getXML()
index 82c891b82ff32d2ceefe21a1592c932e3a8e2033..c7d839c3f50c819292e4698321b653d8299a93c9 100644 (file)
@@ -215,9 +215,10 @@ namespace XAO
         /**
          * Exports this XAO object to a file.
          * \param fileName the name of the file to create.
+         * \param shapeFileName if not empty, export the shape to this external file.
          * \return true is the export is successful.
          */
-        const bool exportXAO(const std::string& fileName);
+        const bool exportXAO(const std::string& fileName, const std::string& shapeFileName);
         /**
          * Gets the XML corresponding to this XAO.
          * \return the XML as a string.
index f0ca278fe9759567f20220f1d30511c004084c9c..fd13841b85f8625e28c25d2a5b7bdb974fc43570 100644 (file)
 #include "XAO_Step.hxx"
 #include "XAO_XaoUtils.hxx"
 
+#ifdef WIN32
+# define _separator_ '\\'
+#else
+# define _separator_ '/'
+#endif
+
 namespace XAO
 {
     const xmlChar* C_TAG_XAO = (xmlChar*)"XAO";
@@ -39,6 +45,7 @@ namespace XAO
 
     const xmlChar* C_TAG_SHAPE = (xmlChar*)"shape";
     const xmlChar* C_ATTR_SHAPE_FORMAT = (xmlChar*)"format";
+    const xmlChar* C_ATTR_SHAPE_FILE = (xmlChar*)"file";
 
     const xmlChar* C_TAG_TOPOLOGY = (xmlChar*)"topology";
     const xmlChar* C_TAG_VERTICES = (xmlChar*)"vertices";
@@ -83,8 +90,8 @@ namespace XAO
 using namespace XAO;
 
 namespace {
-    xmlDocPtr exportXMLDoc(Xao* xaoObject);
-    void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao);
+    xmlDocPtr exportXMLDoc(Xao* xaoObject, const std::string& shapeFileName);
+    void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, const std::string& shapeFileName);
     void exportGeometricElements(Geometry* xaoGeometry, xmlNodePtr topology,
                                  XAO::Dimension dim, const xmlChar* colTag, const xmlChar* eltTag);
     void exportGroups(Xao* xaoObject, xmlNodePtr xao);
@@ -109,13 +116,15 @@ namespace {
     void parseStepElementNode(xmlNodePtr eltNode, Step* step);
 
     std::string readStringProp(xmlNodePtr node, const xmlChar* attribute,
-                               const bool& required, const std::string& defaultValue, const std::string& exception = std::string(""));
+                               const bool& required, const std::string& defaultValue,
+                               const std::string& exception = std::string(""));
     int readIntegerProp(xmlNodePtr node, const xmlChar* attribute,
-                        const bool& required, const int& defaultValue, const std::string& exception = std::string(""));
+                        const bool& required, const int& defaultValue,
+                        const std::string& exception = std::string(""));
 
-  std::string readStringProp(xmlNodePtr node, const xmlChar* attribute,
-                             const bool& required, const std::string& defaultValue,
-                             const std::string& exception /*= std::string() */)
+    std::string readStringProp(xmlNodePtr node, const xmlChar* attribute,
+                               const bool& required, const std::string& defaultValue,
+                               const std::string& exception /*= std::string() */)
   {
     xmlChar* strAttr = xmlGetProp(node, attribute);
     if (strAttr == NULL)
@@ -161,7 +170,7 @@ namespace {
     return res;
   }
 
-  xmlDocPtr exportXMLDoc(Xao* xaoObject)
+  xmlDocPtr exportXMLDoc(Xao* xaoObject, const std::string& shapeFileName)
   {
     // Creating the Xml document
     xmlDocPtr masterDocument = xmlNewDoc(BAD_CAST "1.0");
@@ -173,7 +182,7 @@ namespace {
 
     if (xaoObject->getGeometry() != NULL)
     {
-        exportGeometry(xaoObject->getGeometry(), masterDocument, xao);
+        exportGeometry(xaoObject->getGeometry(), masterDocument, xao, shapeFileName);
     }
 
     exportGroups(xaoObject, xao);
@@ -199,7 +208,8 @@ namespace {
     }
   }
 
-  void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao)
+  void exportGeometry(Geometry* xaoGeometry, xmlDocPtr doc, xmlNodePtr xao,
+                      const std::string& shapeFileName)
   {
     // Geometric part
     xmlNodePtr geometry = xmlNewChild(xao, 0, C_TAG_GEOMETRY, 0);
@@ -207,9 +217,20 @@ namespace {
 
     xmlNodePtr shape = xmlNewChild(geometry, 0, C_TAG_SHAPE, 0);
     xmlNewProp(shape, C_ATTR_SHAPE_FORMAT, BAD_CAST XaoUtils::shapeFormatToString(xaoGeometry->getFormat()).c_str());
-    std::string txtShape = xaoGeometry->getShapeString();
-    xmlNodePtr cdata = xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), txtShape.size());
-    xmlAddChild(shape, cdata);
+
+    if (shapeFileName == "")
+    {
+        // export the shape in the XAO file
+        std::string txtShape = xaoGeometry->getShapeString();
+        xmlNodePtr cdata = xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), txtShape.size());
+        xmlAddChild(shape, cdata);
+    }
+    else
+    {
+        // export the shape in an external file
+        xmlNewProp(shape, C_ATTR_SHAPE_FILE, BAD_CAST shapeFileName.c_str());
+        xaoGeometry->writeShapeFile(shapeFileName);
+    }
 
     xmlNodePtr topology = xmlNewChild(geometry, 0, C_TAG_TOPOLOGY, 0);
 
@@ -361,11 +382,20 @@ namespace {
   {
     if (geometry->getFormat() == XAO::BREP)
     {
-        xmlChar* data = xmlNodeGetContent(shapeNode->children);
-        if (data == NULL)
-            throw XAO_Exception("Missing BREP");
-        geometry->setShapeString((char*)data);
-        xmlFree(data);
+        std::string strFile = readStringProp(shapeNode, C_ATTR_SHAPE_FILE, false, "");
+        if (strFile != "")
+        {
+            geometry->readShapeFile(strFile);
+        }
+        else
+        {
+            // read brep from node content
+            xmlChar* data = xmlNodeGetContent(shapeNode->children);
+            if (data == NULL)
+                throw XAO_Exception("Missing BREP");
+            geometry->setShapeString((char*)data);
+            xmlFree(data);
+        }
     }
     else
     {
@@ -608,10 +638,10 @@ namespace {
   }
 }
 
-const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName)
+const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName)
 throw (XAO_Exception)
 {
-    xmlDocPtr doc = exportXMLDoc(xaoObject);
+    xmlDocPtr doc = exportXMLDoc(xaoObject, shapeFileName);
     xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", 1); // format = 1 for node indentation
     xmlFreeDoc(doc);
 
@@ -621,7 +651,7 @@ throw (XAO_Exception)
 const std::string XaoExporter::saveToXml(Xao* xaoObject)
 throw (XAO_Exception)
 {
-    xmlDocPtr doc = exportXMLDoc(xaoObject);
+    xmlDocPtr doc = exportXMLDoc(xaoObject, "");
 
     xmlChar *xmlbuff;
     int buffersize;
index 966e76386354db56d34e4b49b88d048090a23180..d633ecb0832e7061d97ed79bb1d5c11a104d334b 100644 (file)
@@ -44,9 +44,10 @@ namespace XAO
          * Saves the XAO object to a file.
          * @param xaoObject the object to export.
          * @param fileName the path of the file to create.
+         * @param shapeFileName if not empty save the shape in an this external file.
          * @return true if the export was successful, false otherwise.
          */
-        static const bool saveToFile(Xao* xaoObject, const std::string& fileName)
+        static const bool saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName)
         throw (XAO_Exception);
 
         /**
index 2c060200edd4669ce9509d9438690aaa8c8040f2..51ef590a2d7a283be50710e8f6b7935a26d2c3f4 100644 (file)
@@ -46,7 +46,7 @@ void ImportExportTest::testExportNoGeometry()
 {
     Xao xao("me", "1.0");
 
-    bool res = xao.exportXAO("empty.xao");
+    bool res = xao.exportXAO("empty.xao", "");
     CPPUNIT_ASSERT(res);
 }
 
@@ -103,7 +103,7 @@ void ImportExportTest::testExportGeometry()
         }
     }
 
-    bool res = xao.exportXAO("mygeom.xao");
+    bool res = xao.exportXAO("mygeom.xao", "");
     CPPUNIT_ASSERT(res);
 
     std::string xml = xao.getXML();
index d3b32ee68e0cf3e82c2ca7e793f3c4be2aaaeee4..c1a5e91da781c25c34c8c9fd9934ddc2d911e816 100644 (file)
@@ -54,6 +54,7 @@
 #include <QRadioButton>
 #include <QGridLayout>
 #include <QPushButton>
+#include <QCheckBox>
 #include <QMap>
 
 //=================================================================================
@@ -101,6 +102,7 @@ XAOPlugin_ExportDlg::XAOPlugin_ExportDlg(GeometryGUI* geometryGUI, QWidget* pare
   ledShape->setMinimumSize(QSize(100, 0));
 
   int line = 0, col = 0;
+  // adWidget(widget, fromRow, fromColumn, rowSpan, columnSpan)
   gridLayoutExport->addWidget(lblShape, line, col++, 1, 1);
   gridLayoutExport->addWidget(btnShapeSelect, line, col++, 1, 1);
   gridLayoutExport->addWidget(ledShape, line, col++, 1, 1);
@@ -121,10 +123,17 @@ XAOPlugin_ExportDlg::XAOPlugin_ExportDlg(GeometryGUI* geometryGUI, QWidget* pare
   ledAuthor = new QLineEdit(gbxExport);
 
   line++; col = 0;
-  gridLayoutExport->addWidget(lblAuthor, line, col++, 2, 1);
+  gridLayoutExport->addWidget(lblAuthor, line, col++, 1, 1);
   col++; // span
   gridLayoutExport->addWidget(ledAuthor, line, col++, 1, 1);
 
+  // Line 3
+  ckxUseSeparateFile = new QCheckBox(tr("XAOPLUGIN_EXPORT_SHAPEFILE"), gbxExport);
+
+  line++; col = 0;
+  gridLayoutExport->addWidget(ckxUseSeparateFile, line, col++, 1, 2);
+
+
   //****************************
   // Filter Group box
   QGroupBox* gbxFilter = new QGroupBox(parent);
@@ -410,6 +419,12 @@ bool XAOPlugin_ExportDlg::execute()
 
   QString author = ledAuthor->text();
   QString fileName = ledFileName->text();
+  QString shapeFileName = QString("");//ledShapeFile->text();
+  if (ckxUseSeparateFile->isChecked())
+  {
+    shapeFileName = fileName;
+    shapeFileName.append(".brep");
+  }
 
   // get selected groups
   QList<QListWidgetItem*> selGroups;
@@ -451,6 +466,7 @@ bool XAOPlugin_ExportDlg::execute()
   GEOM::IXAOOperations_var aXAOOp = GEOM::IXAOOperations::_narrow( getOperation() );
   res = aXAOOp->ExportXAO(m_mainObj, groups, fields,
                           author.toUtf8().constData(),
-                          fileName.toUtf8().constData());
+                          fileName.toUtf8().constData(),
+                          shapeFileName.toStdString().c_str());
   return res;
 }
index daf27e7fab1f35cc5ba1f78e9288eda780443e5b..bade0ff0a65bd13338c542ccb31773bc551adcde 100644 (file)
@@ -27,6 +27,7 @@ class QLineEdit;
 class QButtonGroup;
 class QListWidget;
 class QPushButton;
+class QCheckBox;
 
 //=================================================================================
 // class    : XAOPlugin_ExportDlg
@@ -58,6 +59,7 @@ private:
   QLineEdit* ledShape;
   QLineEdit* ledFileName;
   QLineEdit* ledAuthor;
+  QCheckBox* ckxUseSeparateFile;
   QListWidget* lstGroups;
   QListWidget* lstFields;
   QPushButton* btnShapeSelect;
index 7992926b79deb1749e9f25e3cb26b45ab4b53b88..4e4e6ed11bd6e671ba40713bbbb99704a6227af9 100644 (file)
@@ -48,9 +48,10 @@ XAOPlugin_IECallBack::~XAOPlugin_IECallBack()
 //=============================================================================
 bool
 XAOPlugin_IECallBack::Export( int                            theDocId,
-                             const Handle(GEOM_Object)      theOriginal,
-                             const TCollection_AsciiString& theFileName,
-                             const TCollection_AsciiString& theFormatName )
+                              const Handle(GEOM_Object)      theOriginal,
+                              const TCollection_AsciiString& theFileName,
+                              const TCollection_AsciiString& theFormatName,
+                              const TCollection_AsciiString& theShapeFileName )
 {
   XAOPlugin_IOperations* aPluginOperations = XAOPlugin_OperationsCreator::get( GetEngine(), theDocId );
   GEOMImpl_IShapesOperations* aShapesOperations = GetEngine()->GetIShapesOperations( theDocId );
@@ -63,7 +64,7 @@ XAOPlugin_IECallBack::Export( int                            theDocId,
     lgroups.push_back( Handle(GEOM_Object)::DownCast( groups->Value(i) ) );
   for (int i = 1; i <= fields->Length(); i++)
     lfields.push_back( Handle(GEOM_Field)::DownCast( fields->Value(i) ) );
-  aPluginOperations->ExportXAO( theOriginal, lgroups, lfields, "SIMAN Author", theFileName.ToCString() );
+  aPluginOperations->ExportXAO( theOriginal, lgroups, lfields, "SIMAN Author", theFileName.ToCString(), theShapeFileName.ToCString() );
   return true;
 }
 
index d1f04cec5467cbb757f4191f2fa9117d0596ef0f..8bd1b688b95578b61d27a5dca0b5d781f1723353 100644 (file)
@@ -37,9 +37,10 @@ public:
   ~XAOPlugin_IECallBack();
   
   virtual bool Export( int                            theDocId,
-                      const Handle(GEOM_Object)      theOriginal,
-                      const TCollection_AsciiString& theFileName,
-                      const TCollection_AsciiString& theFormatName );
+                       const Handle(GEOM_Object)      theOriginal,
+                       const TCollection_AsciiString& theFileName,
+                       const TCollection_AsciiString& theFormatName,
+                       const TCollection_AsciiString& theshapeFileName );
 
   virtual
   Handle(TColStd_HSequenceOfTransient) Import( int                            theDocId,
index d33a5deaf69d0675c2e1e164270ffa1d350ecb8d..33e74ae6d0a5d510dbb8afac86b2ebef1e143d25 100644 (file)
@@ -311,7 +311,8 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
                                        std::list<Handle(GEOM_Object)> groupList,
                                        std::list<Handle(GEOM_Field)> fieldList,
                                        const char* author,
-                                       const char* fileName )
+                                       const char* fileName,
+                                       const char* shapeFileName )
 {
   SetErrorCode(KO);
 
@@ -348,7 +349,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
   exportFields(fieldList, xaoObject, geometry);
 
   // export the XAO to the file
-  xaoObject->exportXAO(fileName);
+  xaoObject->exportXAO(fileName, shapeFileName);
 
   // make a Python command
   GEOM::TPythonDump pd(exportFunction);
@@ -378,7 +379,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
     }
   }
   pd << "], ";
-  pd << "\"" << author << "\", \"" << fileName << "\")";
+  pd << "\"" << author << "\", \"" << fileName << "\", \"" << shapeFileName << "\")";
 
   SetErrorCode(OK);
   delete xaoObject;
index 65e42d42c80fcbc81caf8371b2e04476d2bc1e07..7bf885f7c5769e3dd0e2cd9927d4423836d219eb 100644 (file)
@@ -47,7 +47,8 @@ public:
                   std::list<Handle(GEOM_Object)> groupList,
                   std::list<Handle(GEOM_Field)> fieldList,
                   const char* author,
-                  const char* fileName );
+                  const char* fileName,
+                  const char* shapeFileName );
   
   bool ImportXAO( const char* fileName,
                   Handle(GEOM_Object)& shape,
index fa26fe5f0205fc73bdbe3ba21a018623177c03a9..20581c9b95be4439b166dd7f11a376e0837a2b18 100644 (file)
@@ -55,14 +55,16 @@ XAOPlugin_IOperations_i::~XAOPlugin_IOperations_i()
  *  \param fields The list of fields to export
  *  \param author The author of the export
  *  \param fileName The name of the exported file
+ *  \param shapeFileName If not empty, save to shape to this external file
  *  \return boolean indicating if export was succeful.
  */
 //=============================================================================
 CORBA::Boolean XAOPlugin_IOperations_i::ExportXAO( GEOM::GEOM_Object_ptr shape,
-                                                  const GEOM::ListOfGO& groups,
-                                                  const GEOM::ListOfFields& fields,
-                                                  const char* author,
-                                                  const char* fileName)
+                                                   const GEOM::ListOfGO& groups,
+                                                   const GEOM::ListOfFields& fields,
+                                                   const char* author,
+                                                   const char* fileName,
+                                                   const char* shapeFileName)
 {
   bool isGood = false;
   // Set a not done flag
@@ -94,7 +96,7 @@ CORBA::Boolean XAOPlugin_IOperations_i::ExportXAO( GEOM::GEOM_Object_ptr shape,
   if( !reference.IsNull() )
   {
     // Export XAO
-    isGood = GetOperations()->ExportXAO( reference, groupsObj, fieldsObj, author, fileName );
+    isGood = GetOperations()->ExportXAO( reference, groupsObj, fieldsObj, author, fileName, shapeFileName );
   }
 
   return isGood;
index 3b849c79e4b456ae163f2d959265862f0dd1a0d8..c3dbe49176323b3ba219fd587d7aff78fb4a82c8 100644 (file)
@@ -47,7 +47,8 @@ public:
                             const GEOM::ListOfGO& groups,
                             const GEOM::ListOfFields& fields,
                             const char* author,
-                            const char* fileName );
+                            const char* fileName,
+                            const char* shapeFileName );
 
   CORBA::Boolean ImportXAO( const char* fileName,
                             GEOM::GEOM_Object_out shape,
index c37ffd620e023dcbd1631659a157f98097bbf118..740b0232cb2d9ebb0920ff2fea4eafc98a9adcf9 100644 (file)
         <source>XAOPLUGIN_EXPORT_AUTHOR</source>
         <translation>Author</translation>
     </message>
+    <message>
+        <source>XAOPLUGIN_EXPORT_SHAPEFILE</source>
+        <translation>Export shape in a separate file</translation>
+    </message>
     <message>
         <source>XAOPLUGIN_EXPORT_LGROUPS</source>
         <translation>Groups</translation>
index 7d3a6deecc54957e91bdc370b5df47b15a5cdb8e..a28228679a751c11d50e465c24186a095058940e 100644 (file)
         <source>XAOPLUGIN_EXPORT_AUTHOR</source>
         <translation>Auteur</translation>
     </message>
+    <message>
+        <source>XAOPLUGIN_EXPORT_SHAPEFILE</source>
+        <translation>Exporter la forme dans un fichier séparé</translation>
+    </message>
     <message>
         <source>XAOPLUGIN_EXPORT_LGROUPS</source>
         <translation>Groupes</translation>