Salome HOME
Merge remote-tracking branch 'remotes/origin/Dev_2.8.0' into Dev_2.8.0
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.h
index 94160a860721c53c5285dcd609ebac803e524970..754198869b2ad4dec31224c4b724968bd8bb7315 100644 (file)
@@ -1,4 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// 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, or (at your option) any later version.
+//
+// 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<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_
 #define EXCHANGEPLUGIN_EXPORTFEATURE_H_
 
 #include <map>
 
-/**\class ExchangePlugin_ExportFeature
+/**
+ * \class ExchangePlugin_ExportFeature
  * \ingroup Plugins
  * \brief Feature for export shapes to the external files in CAD formats.
  *
- * The set of supported formats is defined in the configuration file.
+ * The list of supported formats is defined in the configuration file.
  */
 class ExchangePlugin_ExportFeature : public ModelAPI_Feature
 {
- public:
-  /// Extrusion kind
+public:
+  /// Feature kind
   inline static const std::string& ID()
   {
     static const std::string MY_EXPORT_ID("Export");
     return MY_EXPORT_ID;
   }
-  /// attribute name of referenced face
+  /// attribute name for file format
+  inline static const std::string& EXPORT_TYPE_ID()
+  {
+    static const std::string MY_EXPORT_TYPE_ID("ExportType");
+    return MY_EXPORT_TYPE_ID;
+  }
+  /// attribute name of file path
   inline static const std::string& FILE_PATH_ID()
   {
-    static const std::string MY_FILE_PATH_ID("export_file_selector");
+    static const std::string MY_FILE_PATH_ID("file_path");
     return MY_FILE_PATH_ID;
   }
-  /// default constructor
+  /// attribute name of xao file path
+  inline static const std::string& XAO_FILE_PATH_ID()
+  {
+    static const std::string MY_XAO_FILE_PATH_ID("xao_file_path");
+    return MY_XAO_FILE_PATH_ID;
+  }
+  /// attribute name of file format
+  inline static const std::string& FILE_FORMAT_ID()
+  {
+    static const std::string MY_FILE_FORMAT_ID("file_format");
+    return MY_FILE_FORMAT_ID;
+  }
+  /// attribute name of selection list
+  inline static const std::string& SELECTION_LIST_ID()
+  {
+    static const std::string MY_SELECTION_LIST_ID("selection_list");
+    return MY_SELECTION_LIST_ID;
+  }
+  /// attribute name of author for XAO format
+  inline static const std::string& XAO_AUTHOR_ID()
+  {
+    static const std::string MY_XAO_AUTHOR_ID("xao_author");
+    return MY_XAO_AUTHOR_ID;
+  }
+  /// attribute name of geometry name for XAO format
+  inline static const std::string& XAO_GEOMETRY_NAME_ID()
+  {
+    static const std::string MY_XAO_GEOMETRY_NAME_ID("xao_geometry_name");
+    return MY_XAO_GEOMETRY_NAME_ID;
+  }
+  /// Default constructor
   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
-  /// default destructor
+  /// Default destructor
   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature();
 
+  /// Returns the unique kind of a feature
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    return ExchangePlugin_ExportFeature::ID();
+  }
+
   /// Request for initialization of data model of the feature: adding all attributes
   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
 
-  /// Returns the unique kind of a feature
-  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
+  /// Reimplemented from ModelAPI_Feature::attributeChanged()
+  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
   /// Computes or recomputes the results
   EXCHANGEPLUGIN_EXPORT virtual void execute();
 
   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+
   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
-  MODELAPI_EXPORT virtual bool isPreviewNeeded() const { return false; }
+  EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
 
- protected:
-  /// Performs the export of the file
-  EXCHANGEPLUGIN_EXPORT bool exportFile(const std::string& theFileName);
+protected:
+  /// Performs export of the file
+  EXCHANGEPLUGIN_EXPORT void exportFile(const std::string& theFileName,
+                                        const std::string& theFormat);
 
-private:
-  /// Loads Naming data structure to the document
-  void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
-                    std::shared_ptr<ModelAPI_ResultBody> theResultBody);
+  /// Performs export to XAO file
+  EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName);
 };
 
 #endif /* EXPORT_EXPORTFEATURE_H_ */