From aafd292f1e06254e9c6e75bf8724ce66c6c7ff99 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 10 Jun 2014 10:22:42 +0400 Subject: [PATCH] refs #80 - Sketch base GUI: create/draw point, circle and arc Remove dependency on edition only feature with the line kind. --- src/PartSet/PartSet_Module.cpp | 26 ++++++++++++++------------ src/PartSet/PartSet_Module.h | 4 +++- 2 files changed, 17 insertions(+), 13 deletions(-) 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 -- 2.39.2