X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_OverconstraintListener.cpp;h=52d84913e823221a05a3b20edcace7f9c4041780;hb=8634847ac05ce637193ec2f5234c3c8996762f94;hp=721c2d54ade20edebf7918ab7b94fbdf3c147711;hpb=97aee822b8dafeef375b8d11da7ab600cfd38db8;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index 721c2d54a..52d84913e 100755 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -21,7 +21,7 @@ #include -#define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER +//#define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER PartSet_OverconstraintListener::PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop) @@ -105,12 +105,14 @@ bool PartSet_OverconstraintListener::appendConflictingObjects( const std::set& theConflictingObjects) { std::set aModifiedObjects; + std::vector aColor; + getConflictingColor(aColor); + // set error state for new objects and append them in the internal map of objects std::set::const_iterator anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found - setConflictingObject(anObject, true); aModifiedObjects.insert(anObject); myConflictingObjects.insert(anObject); } @@ -131,7 +133,6 @@ bool PartSet_OverconstraintListener::repairConflictingObjects( for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end() ; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found - setConflictingObject(anObject, false); myConflictingObjects.erase(anObject); aModifiedObjects.insert(anObject); @@ -147,60 +148,16 @@ bool PartSet_OverconstraintListener::repairConflictingObjects( void PartSet_OverconstraintListener::redisplayObjects( const std::set& theObjects) { -/*static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_UPDATED); + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); std::set::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); - for (; anIt != aLast; anIt++) { + for (; anIt != aLast; anIt++) aECreator->sendUpdated(*anIt, EVENT_DISP); - //#ifdef DEBUG_FEATURE_OVERCONSTRAINT_LISTENER - // QString anInfoStr = ModuleBase_Tools::objectInfo(*anIt); - // qDebug(QString("PartSet_OverconstraintListener::SEND UPDATED: %1").arg(anInfoStr).toStdString().c_str()); - //#endif - } - aLoop->flush(EVENT_DISP);*/ - - XGUI_Displayer* aDisplayer = workshop()->displayer(); - bool aHidden; - std::set::const_iterator anIt = theObjects.begin(), aLast = theObjects.end(); - for (; anIt != aLast; anIt++) { - ObjectPtr anObject = *anIt; - aHidden = !anObject->data() || !anObject->data()->isValid() || - anObject->isDisabled() || (!anObject->isDisplayed()); - if (!aHidden) - aDisplayer->redisplay(anObject, false); - } - aDisplayer->updateViewer(); -} - -void PartSet_OverconstraintListener::setConflictingObject(const ObjectPtr& theObject, - const bool theConflicting) -{ - if (!theObject.get() || !theObject->data()->isValid()) - return; - - AISObjectPtr anAISObject; - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); - - if (aPrs.get() != NULL) { - XGUI_Workshop* aWorkshop = workshop(); - XGUI_Displayer* aDisplayer = aWorkshop->displayer(); - - anAISObject = aPrs->getAISObject(aDisplayer->getAISObject(theObject)); - if (anAISObject.get()) { - Handle(AIS_InteractiveObject) anAISIO = anAISObject->impl(); - if (!anAISIO.IsNull()) { - if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) { - Handle(SketcherPrs_SymbolPrs) aPrs = Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO); - if (!aPrs.IsNull()) - aPrs->SetConflictingConstraint(theConflicting); - } - } - } - } + aLoop->flush(EVENT_DISP); } XGUI_Workshop* PartSet_OverconstraintListener::workshop() const