From: nds Date: Wed, 29 Mar 2017 08:28:56 +0000 (+0300) Subject: Issue #2027 Sketcher Trim Feature: clear PreviewObject reference as it is not necessa... X-Git-Tag: V_2.7.0~158 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=601d5f7bc5c56f69d114e49a35bf49d126035ba8;p=modules%2Fshaper.git Issue #2027 Sketcher Trim Feature: clear PreviewObject reference as it is not necessary during execute. Save conflicting color in symbol presentation. --- diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index eb8f27c90..46b01dee1 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -194,6 +194,13 @@ void SketchPlugin_Trim::execute() return; FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); + /// Remove reference of this feature to feature used in preview, it is not necessary anymore + /// as trim will be removed after execute + AttributeReferencePtr aPreviewObjectAttr = + std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); + aPreviewObjectAttr->setValue(ResultPtr()); + /// points of trim std::shared_ptr aStartShapePoint, aLastShapePoint; #ifdef DEBUG_TRIM @@ -272,12 +279,6 @@ void SketchPlugin_Trim::execute() // otherwise Trim feature will be removed with the circle before // this operation is finished aBaseObjectAttr->setObject(ResultPtr()); - - AttributeReferencePtr aPreviewObjectAttr = - std::dynamic_pointer_cast( - data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT())); - aPreviewObjectAttr->setObject(ResultPtr()); - } else if (aKind == SketchPlugin_Line::ID()) { trimLine(aStartShapePoint2d, aLastShapePoint2d, aBaseRefAttributes, @@ -378,6 +379,17 @@ void SketchPlugin_Trim::execute() Events_Loop::loop()->setFlushed(anUpdateEvent, false); // delete constraints +#ifdef DEBUG_TRIM + if (aFeaturesToDelete.size() > 0) { + std::cout << "after SPlit: removeFeaturesAndReferences: " << std::endl; + std::string aValue; + for (std::set::const_iterator anIt = aFeaturesToDelete.begin(); + anIt != aFeaturesToDelete.end(); anIt++) { + FeaturePtr aFeature = *anIt; + std::cout << aFeature->data()->name() << std::endl; + } + } +#endif ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToDelete); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); @@ -716,7 +728,18 @@ void SketchPlugin_Trim::removeReferencesToAttribute(const AttributePtr& theAttri } } +#ifdef DEBUG_TRIM // delete constraints + if (aFeaturesToDelete.size() > 0) { + std::cout << "removeReferencesToAttribute: " << std::endl; + std::string aValue; + for (std::set::const_iterator anIt = aFeaturesToDelete.begin(); + anIt != aFeaturesToDelete.end(); anIt++) { + FeaturePtr aFeature = *anIt; + std::cout << aFeature->data()->name() << std::endl; + } + } +#endif ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToDelete); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 1e7d5f6a8..48a0256e2 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -165,6 +165,8 @@ void SketcherPrs_SymbolPrs::prepareAspect() myAspect = new Graphic3d_AspectMarker3d(); else myAspect = new Graphic3d_AspectMarker3d(aIcon); + + myAspect->SetColor(myColor); } } @@ -297,16 +299,19 @@ void SketcherPrs_SymbolPrs::SetConflictingConstraint(const bool& theConflicting, { if (theConflicting) { - if (!myAspect.IsNull()) - myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., - theColor[2] / 255., Quantity_TOC_RGB)); - myIsConflicting = true; + myColor = Quantity_Color (theColor[0] / 255., theColor[1] / 255., + theColor[2] / 255., Quantity_TOC_RGB); + //if (!myAspect.IsNull()) + // myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., + // theColor[2] / 255., Quantity_TOC_RGB)); + //myIsConflicting = true; } else { - if (!myAspect.IsNull()) - myAspect->SetColor (Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB)); - myIsConflicting = false; + myColor = Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB); + //if (!myAspect.IsNull()) + // myAspect->SetColor (Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB)); + //myIsConflicting = false; } } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index affd9d074..4c852d5a4 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -149,6 +149,7 @@ private: Select3D_EntitySequence mySPoints; + Quantity_Color myColor; bool myIsConflicting; /// state if the presentation is visualized in error state Handle(Image_AlienPixMap) myErrorIcon; Handle(Graphic3d_MarkerImage) myErrorImage;