]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Tue, 10 Jun 2014 06:22:42 +0000 (10:22 +0400)
committernds <natalia.donis@opencascade.com>
Tue, 10 Jun 2014 06:22:42 +0000 (10:22 +0400)
Remove dependency on edition only feature with the line kind.

src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h

index 7d5751707a40a97f613130f259a244ecddf58538..d754eaf14d180eda34bc5970db8c6c27cf83a867 100644 (file)
@@ -225,7 +225,8 @@ void PartSet_Module::onFitAllView()
 
 void PartSet_Module::onLaunchOperation(std::string theName, FeaturePtr theFeature)
 {
-  ModuleBase_Operation* anOperation = createOperation(theName.c_str());
+  ModuleBase_Operation* anOperation = createOperation(theName.c_str(),
+                                                      theFeature ? theFeature->getKind() : "");
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp)
   {
@@ -306,18 +307,9 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
     activateFeature(theFeature, true);
 }
 
-ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdId)
+ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdId,
+                                                      const std::string& theFeatureKind)
 {
-  // get operation xml description
-  std::string aStdCmdId = theCmdId;
-  if (aStdCmdId == PartSet_OperationEditLine::Type())
-    aStdCmdId = SKETCH_LINE_KIND;
-  std::string aPluginFileName = featureFile(aStdCmdId);
-  Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName);
-  aWdgReader.readAll();
-  std::string aXmlCfg = aWdgReader.featureWidgetCfg(aStdCmdId);
-  std::string aDescription = aWdgReader.featureDescription(aStdCmdId);
-
   // create the operation
   ModuleBase_Operation* anOperation = 0;
   if (theCmdId == PartSet_OperationSketch::Type()) {
@@ -340,6 +332,16 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   if (!anOperation) {
     anOperation = new ModuleBase_Operation(theCmdId.c_str(), this);
   }
+
+  // set operation xml description
+  std::string aFeatureKind = theFeatureKind.empty() ? theCmdId : theFeatureKind;
+
+  std::string aPluginFileName = featureFile(aFeatureKind);
+  Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName);
+  aWdgReader.readAll();
+  std::string aXmlCfg = aWdgReader.featureWidgetCfg(aFeatureKind);
+  std::string aDescription = aWdgReader.featureDescription(aFeatureKind);
+
   anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
   anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
 
index f906f939ae34615add931df859534cde4850b74d..31e41081696c6543dc4f0899dfed61395495562b 100644 (file)
@@ -118,7 +118,9 @@ public slots:
 protected:
   /// Creates a new operation
   /// \param theCmdId the operation name
-  ModuleBase_Operation* createOperation(const std::string& theCmdId);
+  /// \param theFeatureKind a kind of feature to get the feature xml description
+  ModuleBase_Operation* createOperation(const std::string& theCmdId,
+                                        const std::string& theFeatureKind = "");
 
   /// Sends the operation
   /// \param theOperation the operation