From: nds Date: Tue, 10 Jun 2014 06:22:42 +0000 (+0400) Subject: refs #80 - Sketch base GUI: create/draw point, circle and arc X-Git-Tag: V_0.4.4~298 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aafd292f1e06254e9c6e75bf8724ce66c6c7ff99;p=modules%2Fshaper.git refs #80 - Sketch base GUI: create/draw point, circle and arc Remove dependency on edition only feature with the line kind. --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 7d5751707..d754eaf14 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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(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)); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index f906f939a..31e410816 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -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