Salome HOME
Add group name attribute for export
authorspo <sergey.pokhodenko@opencascade.com>
Mon, 30 Nov 2015 13:21:49 +0000 (16:21 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Wed, 22 Jun 2016 11:06:01 +0000 (14:06 +0300)
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp
src/ExchangePlugin/ExchangePlugin_ExportFeature.h
src/ExchangePlugin/export_widget.xml

index 437bae8088533ed679350f69638f98ce71211e25..e0505cc9aff093519952c06241c9235b34d13ae2 100644 (file)
@@ -60,9 +60,11 @@ void ExchangePlugin_ExportFeature::initAttributes()
   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(), ModelAPI_AttributeString::typeId());
 
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ExchangePlugin_ExportFeature::XAO_AUTHOR_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID());
 }
 
 /*
@@ -183,6 +185,11 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
     return;
   }
 
+  // geometry name
+
+  std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
+  aXao.getGeometry()->setName(aGeometryName);
+
   // groups
 
   int aGroupCount = document()->size(ModelAPI_ResultGroup::group());
index 8b57ed612ee6720d0486a35a0bcd494fd7690959..4ffce6277496e0d34e95d5b6eb118bc56943b965 100644 (file)
@@ -59,6 +59,12 @@ public:
     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
index d00baf07b66282151363a1e99e82e0cf08a5715d..60f0454caf084f5e1aa1a46152a86c6460bde5aa 100644 (file)
                    label="Author"
                    placeholder="Please input the author">
       </stringvalue>
+      <stringvalue id="xao_geometry_name"
+                   label="Geometry name"
+                   placeholder="Please input the geometry name">
+      </stringvalue>
     </case>
   </switch>
 </source>