From: dbv Date: Thu, 24 Dec 2015 14:34:23 +0000 (+0300) Subject: Improvement #1140: Display of replicated Sketch entities with thinner line X-Git-Tag: V_2.1.0~62 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c3de103829b47d56a96578fdb547460013a2bb30;p=modules%2Fshaper.git Improvement #1140: Display of replicated Sketch entities with thinner line Line thickness now restored after constraint delete --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp index bfcbf14e7..7539c18e3 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp @@ -195,6 +195,37 @@ AISObjectPtr SketchPlugin_ConstraintMirror::getAISObject(AISObjectPtr thePreviou return anAIS; } +void SketchPlugin_ConstraintMirror::erase() +{ + // Set copy attribute to false on all copied features. + AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_C())); + + if(aRefListOfMirrored.get()) { + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + + std::list aTargetList = aRefListOfMirrored->list(); + for(std::list::const_iterator aTargetIt = aTargetList.cbegin(); aTargetIt != aTargetList.cend(); aTargetIt++) { + if((*aTargetIt).get()) { + ResultPtr aRes = std::dynamic_pointer_cast(*aTargetIt); + if(aRes.get()) { + FeaturePtr aFeature = aRes->document()->feature(aRes); + if(aFeature.get()) { + AttributeBooleanPtr aBooleanAttr = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if(aBooleanAttr.get()) { + aBooleanAttr->setValue(false); + // Redisplay object as it is not copy anymore. + ModelAPI_EventCreator::get()->sendUpdated(aRes, aRedispEvent); + } + } + } + } + } + } + + SketchPlugin_ConstraintBase::erase(); +} void SketchPlugin_ConstraintMirror::attributeChanged(const std::string& theID) { diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h index 5ae07ac19..70bb78793 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h @@ -58,6 +58,9 @@ class SketchPlugin_ConstraintMirror : public SketchPlugin_ConstraintBase /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + /// removes all fields from this feature: results, data, etc + SKETCHPLUGIN_EXPORT virtual void erase(); + /// \brief Use plugin manager for features creation SketchPlugin_ConstraintMirror(); };