From: vsv Date: Wed, 23 Jul 2014 15:12:10 +0000 (+0400) Subject: Edit sketch objects X-Git-Tag: V_0.4.4~156 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d4172daaba8a1aef3d87500056fe4d65496d43f8;p=modules%2Fshaper.git Edit sketch objects --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 6ddaeabe1..4cea1a7bf 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -172,8 +172,8 @@ void PartSet_Module::onOperationStarted() myWorkshop->operationMgr()->currentOperation()); if (aPreviewOp) { XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel(); - connect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)), - this, SLOT(onStorePoint2D(FeaturePtr, const std::string&)), Qt::UniqueConnection); + connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), + this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection); } } @@ -184,8 +184,8 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(theOperation); if (aPreviewOp) { XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel(); - //disconnect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)), - // this, SLOT(onStorePoint2D(FeaturePtr, const std::string&))); + //disconnect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), + // this, SLOT(onStorePoint2D(ObjectPtr, const std::string&))); } } @@ -273,15 +273,22 @@ void PartSet_Module::onFitAllView() myWorkshop->viewer()->fitAll(); } -void PartSet_Module::onLaunchOperation(std::string theName, ObjectPtr theFeature) +void PartSet_Module::onLaunchOperation(std::string theName, ObjectPtr theObject) { - FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); + FeaturePtr aFeature = boost::dynamic_pointer_cast(theObject); if (!aFeature) { - qDebug("Warning! Restart operation without feature!"); - return; + ResultPtr aResult = boost::dynamic_pointer_cast(theObject); + if (aResult) { + PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); + DocumentPtr aDoc = aMgr->rootDocument(); + aFeature = aDoc->feature(aResult); + } else { + qDebug("Warning! Restart operation without feature!"); + return; + } } ModuleBase_Operation* anOperation = createOperation(theName.c_str(), - theFeature ? aFeature->getKind() : ""); + aFeature ? aFeature->getKind() : ""); PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); if (aPreviewOp) { @@ -361,15 +368,6 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode) } } } -/* FeaturePtr aFeature = aPrevOp->feature(); - if (aFeature) { - std::list aResList = aFeature->results(); - std::list::iterator aIt; - for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt) { - aDisplayer->deactivate((*aIt), false); - } - } - }*/ ModelAPI_EventCreator::get()->sendUpdated(theFeature, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); // } @@ -575,17 +573,19 @@ void PartSet_Module::editFeature(FeaturePtr theFeature) // } } -void PartSet_Module::onStorePoint2D(FeaturePtr theFeature, const std::string& theAttribute) +void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute) { + FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); + PartSet_OperationSketchBase* aPreviewOp = dynamic_cast( myWorkshop->operationMgr()->currentOperation()); if (!aPreviewOp) return; boost::shared_ptr aPoint = - boost::dynamic_pointer_cast(theFeature->data()->attribute(theAttribute)); + boost::dynamic_pointer_cast(aFeature->data()->attribute(theAttribute)); - PartSet_Tools::setConstraints(aPreviewOp->sketch(), theFeature, theAttribute, + PartSet_Tools::setConstraints(aPreviewOp->sketch(), aFeature, theAttribute, aPoint->x(), aPoint->y()); } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index ac90ea98a..c32b3af07 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -140,7 +140,7 @@ public slots: /// Slot which reacts to the point 2d set to the feature. Creates a constraint /// \param the feature /// \param the attribute of the feature - void onStorePoint2D(FeaturePtr theFeature, const std::string& theAttribute); + void onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute); protected: /// Creates a new operation diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index adf7b2748..99f8b066d 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -94,8 +94,8 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast(*anIt); if (aPointWidget) - connect(aPointWidget, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)), - this, SIGNAL(storedPoint2D(FeaturePtr, const std::string&))); + connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), + this, SIGNAL(storedPoint2D(ObjectPtr, const std::string&))); } ModuleBase_ModelWidget* aLastWidget = theWidgets.last(); if (aLastWidget) { diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 74c3c5fba..228531053 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -52,7 +52,7 @@ signals: /// Signal about the point 2d set to the feature /// \param the feature /// \param the attribute of the feature - void storedPoint2D(FeaturePtr theFeature, const std::string& theAttribute); + void storedPoint2D(ObjectPtr theFeature, const std::string& theAttribute); private: QWidget* myCustomWidget; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 9505d9cf2..03a3bae5e 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -467,7 +467,8 @@ void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation) aCommand = aMenu->feature(theOperation->getDescription()->operationId()); } //Abort operation on uncheck the command - connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool))); + if (aCommand) + connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool))); } /* @@ -767,7 +768,7 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent) aObjDock->setWindowTitle(tr("Object browser")); aObjDock->setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock); - connect(myObjectBrowser, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(changeCurrentDocument(FeaturePtr))); + connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this, SLOT(changeCurrentDocument(ObjectPtr))); aObjDock->setWidget(myObjectBrowser); myContextMenuMgr->connectObjectBrowser();