From: vsv Date: Thu, 24 Jul 2014 13:16:09 +0000 (+0400) Subject: Merge branch 'master' of newgeom:newgeom X-Git-Tag: V_0.4.4~153 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7210ed3a44c73d261bb5abb28fae1489c5a35b30;p=modules%2Fshaper.git Merge branch 'master' of newgeom:newgeom Conflicts: src/ModuleBase/ModuleBase_Tools.cpp --- 7210ed3a44c73d261bb5abb28fae1489c5a35b30 diff --cc src/ModuleBase/ModuleBase_Tools.cpp index 8c0471d95,dfd282ea3..d3dd6f7ee --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@@ -24,19 -19,4 +20,19 @@@ boost::shared_ptr shape( return boost::shared_ptr(); } +//****************************************************************** +FeaturePtr feature(ObjectPtr theObject) +{ + FeaturePtr aFeature = boost::dynamic_pointer_cast(theObject); + if (!aFeature) { + ResultPtr aResult = boost::dynamic_pointer_cast(theObject); + if (aResult) { + PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); + DocumentPtr aDoc = aMgr->rootDocument(); + return aDoc->feature(aResult); + } + } + return aFeature; +} + - } + } diff --cc src/PartSet/PartSet_Module.cpp index 74debe864,4cea1a7bf..e3f4117e6 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@@ -344,7 -349,7 +344,7 @@@ void PartSet_Module::onCloseLocalContex aDisplayer->closeLocalContexts(); } --void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode) ++void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode) { // bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide; // if (isDisplay) { @@@ -442,8 -447,8 +442,8 @@@ ModuleBase_Operation* PartSet_Module::c // connect the operation PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); if (aPreviewOp) { -- connect(aPreviewOp, SIGNAL(featureConstructed(FeaturePtr, int)), -- this, SLOT(onFeatureConstructed(FeaturePtr, int))); ++ connect(aPreviewOp, SIGNAL(featureConstructed(ObjectPtr, int)), ++ this, SLOT(onFeatureConstructed(ObjectPtr, int))); connect(aPreviewOp, SIGNAL(launchOperation(std::string, ObjectPtr)), this, SLOT(onLaunchOperation(std::string, ObjectPtr))); connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), diff --cc src/PartSet/PartSet_Module.h index c32b3af07,c32b3af07..58e099579 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@@ -134,8 -134,8 +134,7 @@@ public slots /// SLOT, to visualize the feature in another local context mode /// \param theFeature the feature to be put in another local context mode /// \param theMode the mode appeared on the feature -- void onFeatureConstructed(FeaturePtr theFeature, -- int theMode); ++ void onFeatureConstructed(ObjectPtr theFeature, int theMode); /// Slot which reacts to the point 2d set to the feature. Creates a constraint /// \param the feature diff --cc src/PartSet/PartSet_OperationFeatureEdit.cpp index 409adcd75,7975baa65..3c74e6478 --- a/src/PartSet/PartSet_OperationFeatureEdit.cpp +++ b/src/PartSet/PartSet_OperationFeatureEdit.cpp @@@ -88,8 -85,8 +88,15 @@@ void PartSet_OperationFeatureEdit::mous bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); if(aHasShift && !theHighlighted.empty()) { QList aSelected; -- aSelected.push_back(feature()); -- aSelected.push_back(theHighlighted.front().object()); ++ std::list::const_iterator aIt; ++ for (aIt = theSelected.cbegin(); aIt != theSelected.cend(); ++aIt) ++ aSelected.append((*aIt).object()); ++ /*for (aIt = theHighlighted.cbegin(); aIt != theHighlighted.cend(); ++aIt) { ++ if (!aSelected.contains((*aIt).object())) ++ aSelected.append((*aIt).object()); ++ }*/ ++ //aSelected.push_back(feature()); ++ //aSelected.push_back(theHighlighted.front().object()); emit setSelection(aSelected); } else if (aFeature) { diff --cc src/PartSet/PartSet_OperationFeatureEditMulti.cpp index b08818ec7,b08818ec7..1768f0c94 --- a/src/PartSet/PartSet_OperationFeatureEditMulti.cpp +++ b/src/PartSet/PartSet_OperationFeatureEditMulti.cpp @@@ -8,6 -8,6 +8,7 @@@ #include #include ++#include #include @@@ -58,10 -58,10 +59,9 @@@ void PartSet_OperationFeatureEditMulti: // deselected in the viewer by blockSelection signal in the startOperation method. bool isSelected = false; std::list::const_iterator anIt = theSelected.begin(), aLast = theSelected.end(); -- // TODO -- /*for (; anIt != aLast && !isSelected; anIt++) { -- isSelected = (*anIt).feature() == feature(); -- }*/ ++ for (; anIt != aLast && !isSelected; anIt++) { ++ isSelected = ModuleBase_Tools::feature((*anIt).object()) == feature(); ++ } if (!isSelected) myFeatures = theHighlighted; else @@@ -110,14 -110,14 +110,17 @@@ void PartSet_OperationFeatureEditMulti: aSketchFeature->move(aDeltaX, aDeltaY); std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); -- // TODO -- /*for (; anIt != aLast; anIt++) { -- FeaturePtr aFeature = (*anIt).feature(); -- if (!aFeature || aFeature == feature()) ++ for (; anIt != aLast; anIt++) { ++ ObjectPtr aObject = (*anIt).object(); ++ if (!aObject || aObject == feature()) continue; -- aSketchFeature = boost::dynamic_pointer_cast(aFeature); -- aSketchFeature->move(aDeltaX, aDeltaY); -- }*/ ++ FeaturePtr aFeature = ModuleBase_Tools::feature(aObject); ++ if (aFeature) { ++ aSketchFeature = boost::dynamic_pointer_cast(aFeature); ++ if (aSketchFeature) ++ aSketchFeature->move(aDeltaX, aDeltaY); ++ } ++ } } sendFeatures(); @@@ -131,13 -131,13 +134,12 @@@ void PartSet_OperationFeatureEditMulti: std::list aFeatures = myFeatures; commit(); std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); -- // TODO -- /*for (; anIt != aLast; anIt++) { -- FeaturePtr aFeature = (*anIt).feature(); ++ for (; anIt != aLast; anIt++) { ++ ObjectPtr aFeature = (*anIt).object(); if (aFeature) { emit featureConstructed(aFeature, FM_Deactivation); -- } -- }*/ ++ } ++ } } void PartSet_OperationFeatureEditMulti::startOperation() @@@ -188,14 -188,14 +190,13 @@@ void PartSet_OperationFeatureEditMulti: std::list aFeatures; std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); -- // TODO -- /*for (; anIt != aLast; anIt++) { -- FeaturePtr aFeature = (*anIt).feature(); ++ for (; anIt != aLast; anIt++) { ++ ObjectPtr aFeature = (*anIt).object(); if (!aFeature) continue; ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent); -- }*/ ++ } Events_Loop::loop()->flush(anEvent); flushUpdated(); } diff --cc src/PartSet/PartSet_OperationSketchBase.h index 7916815d0,7916815d0..caae337a7 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@@ -123,14 -123,14 +123,16 @@@ signals /// theName the operation name /// theFeature the operation argument void launchOperation(std::string theName, ObjectPtr theFeature); ++ /// Signal about the feature construing is finished /// \param theFeature the result feature /// \param theMode the mode of the feature modification -- void featureConstructed(FeaturePtr theFeature, -- int theMode); ++ void featureConstructed(ObjectPtr theFeature, int theMode); ++ /// Signal about the features should be selected /// \param theSelected the list of selected presentations void featureSelected(const std::list& theSelected); ++ /// signal to enable/disable multi selection in the viewer /// \param theEnabled the boolean state void multiSelectionEnabled(bool theEnabled); @@@ -139,6 -139,6 +141,7 @@@ /// \param theFeatures a list of features to be disabled /// \param theToStop the boolean state whether it it stopped or non stopped void stopSelection(const QList& theFeatures, const bool theToStop); ++ /// signal to set selection in the viewer /// \param theFeatures a list of features to be disabled void setSelection(const QList& theFeatures);