From 8928995f6b515cbfbfb7750d541791648675634a Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 26 Jun 2014 16:33:27 +0400 Subject: [PATCH] Problem with invisible constraints when editing sketch was fixed --- src/PartSet/PartSet_Module.cpp | 28 ++++++++------------- src/PartSet/PartSet_OperationSketch.cpp | 20 +++------------ src/PartSet/PartSet_OperationSketch.h | 7 +++--- src/PartSet/PartSet_OperationSketchBase.cpp | 5 ++-- src/PartSet/PartSet_OperationSketchBase.h | 9 ++++--- 5 files changed, 25 insertions(+), 44 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 2ba50835c..d0ee20e79 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -308,16 +308,14 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode) FeaturePtr aSketch; PartSet_OperationSketchBase* aPrevOp = dynamic_cast(aCurOperation); if (aPrevOp) { - std::map > aList = aPrevOp->subPreview(); + std::list aList = aPrevOp->subFeatures(); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); std::list aModes = aPrevOp->getSelectionModes(aPrevOp->feature()); - std::map >::const_iterator - anIt = aList.begin(), aLast = aList.end(); - for (; anIt != aLast; anIt++) { - FeaturePtr aFeature = (*anIt).first; - visualizePreview(aFeature, false, false); - } + std::list::const_iterator anIt = aList.begin(), + aLast = aList.end(); + for (; anIt != aLast; anIt++) + visualizePreview(*anIt, false, false); aDisplayer->updateViewer(); } } @@ -468,23 +466,19 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId) if (!aFeature || aFeature->getKind() != theCmdId) return; - std::map > aList = aPreviewOp->subPreview(); + std::list aList = aPreviewOp->subFeatures(); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); std::list aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature()); - std::map >::const_iterator - anIt = aList.begin(), aLast = aList.end(); + std::list::const_iterator anIt = aList.begin(), + aLast = aList.end(); for (; anIt != aLast; anIt++) { - FeaturePtr aFeature = (*anIt).first; boost::shared_ptr aSPFeature = - boost::dynamic_pointer_cast((*anIt).first); + boost::dynamic_pointer_cast(*anIt); if (!aSPFeature) continue; - - Handle(AIS_InteractiveObject) anAIS = aSPFeature->getAISShape(aDisplayer->getAISObject(aFeature)); - if (!anAIS.IsNull()) - aDisplayer->redisplay(aFeature, anAIS, false); - aDisplayer->activateInLocalContext(aFeature, aModes, false); + visualizePreview(*anIt, true, false); + aDisplayer->activateInLocalContext(*anIt, aModes, false); } aDisplayer->updateViewer(); } diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index dfe2fe85c..916022978 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -137,29 +137,15 @@ void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) } } -std::map > - PartSet_OperationSketch::subPreview() const +std::list PartSet_OperationSketch::subFeatures() const { - std::map > aPreviewMap; - - boost::shared_ptr aFeature; - boost::shared_ptr aData = feature()->data(); if (!aData->isValid()) - return aPreviewMap; + return std::list(); boost::shared_ptr aRefList = boost::dynamic_pointer_cast(aData->attribute(SKETCH_ATTR_FEATURES)); - std::list aFeatures = aRefList->list(); - std::list::const_iterator anIt = aFeatures.begin(), - aLast = aFeatures.end(); - for (; anIt != aLast; anIt++) { - aFeature = boost::dynamic_pointer_cast(*anIt); - boost::shared_ptr aPreview = aFeature->preview(); - if (aPreview) - aPreviewMap[aFeature] = aPreview; - } - return aPreviewMap; + return aRefList->list(); } void PartSet_OperationSketch::stopOperation() diff --git a/src/PartSet/PartSet_OperationSketch.h b/src/PartSet/PartSet_OperationSketch.h index 27c0d8641..a5ec96c5d 100644 --- a/src/PartSet/PartSet_OperationSketch.h +++ b/src/PartSet/PartSet_OperationSketch.h @@ -72,10 +72,9 @@ public: /// \param theEvent the mouse event virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView); - /// Returns the map of the operation previews including the nested feature previews - /// \return the map of feature to the feature preview - virtual std::map > - subPreview() const; + /// Returns the list of the nested features + /// \return the list of subfeatures + virtual std::list subFeatures() const; /// Virtual method called when operation stopped - committed or aborted. /// Emits a signal to hide the preview of the operation diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 60396b814..117195468 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -38,10 +38,9 @@ boost::shared_ptr PartSet_OperationSketchBase::preview( return aFeature->preview(); } -std::map > - PartSet_OperationSketchBase::subPreview() const +std::list PartSet_OperationSketchBase::subFeatures() const { - return std::map >(); + return std::list(); } std::list PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const diff --git a/src/PartSet/PartSet_OperationSketchBase.h b/src/PartSet/PartSet_OperationSketchBase.h index 9e4a72cba..33aeeeea0 100644 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@ -15,9 +15,12 @@ #include #include +#include #include +#include + #include class Handle_V3d_View; @@ -48,9 +51,9 @@ public: /// \param theFeature the feature object to obtain the preview static boost::shared_ptr preview(FeaturePtr theFeature); - /// Returns the map of the operation previews including the nested feature previews - /// \return the map of feature to the feature preview - virtual std::map > subPreview() const; + /// Returns the list of the nested features + /// \return the list of subfeatures + virtual std::list subFeatures() const; /// Returns the operation local selection mode /// \param theFeature the feature object to get the selection mode -- 2.39.2