From: vsv Date: Mon, 25 Nov 2019 12:53:46 +0000 (+0300) Subject: Correction for colors of sketcher and for selection of trihedron X-Git-Tag: V9_5_0a1~165 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0f2446dc013b2a846faaebec81dfbe2c6e33eeb5;p=modules%2Fshaper.git Correction for colors of sketcher and for selection of trihedron --- diff --git a/src/Model/Model_AttributeIntArray.cpp b/src/Model/Model_AttributeIntArray.cpp index f933ad261..82ea6415e 100644 --- a/src/Model/Model_AttributeIntArray.cpp +++ b/src/Model/Model_AttributeIntArray.cpp @@ -75,6 +75,7 @@ void Model_AttributeIntArray::setValue(const int theIndex, bool sendUpdated) { if (myArray->Value(theIndex) != theValue) { + setInitialized(); myArray->SetValue(theIndex, theValue); if (sendUpdated) owner()->data()->sendAttributeUpdated(this); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index f0e4b1d43..9369a7362 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -2190,51 +2190,45 @@ bool isIncludeToResult(const ObjectPtr& theObject) return true; } - -void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject, - const AISObjectPtr& thePrs) const +//************************************************************************************** +std::vector PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject, + const FeaturePtr& theFeature, bool isConstruction) const { - FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); + static const QStringList& aConstrIds = constraintsIdList(); PartSet_OverconstraintListener* aOCListener = myModule->overconstraintListener(); + std::string aKind = theFeature->getKind(); - // Check constraints objects - const QStringList& aConstrIds = constraintsIdList(); - std::string aKind = aFeature->getKind(); - if (aConstrIds.contains(QString(aKind.c_str()))) { - std::vector aColor; + if (isDistanceKind(aKind)) { if (aOCListener->isConflictingObject(theObject)) - aColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color"); - else if (isDistanceKind(aKind)) - aColor = Config_PropManager::color("Visualization", "sketch_dimension_color"); + return Config_PropManager::color("Visualization", "sketch_overconstraint_color"); + return Config_PropManager::color("Visualization", "sketch_dimension_color"); + } + if (isExternal(theFeature)) + return Config_PropManager::color("Visualization", "sketch_external_color"); + if (isConstruction) + return Config_PropManager::color("Visualization", "sketch_auxiliary_color"); - if (!aColor.empty()) - thePrs->setColor(aColor[0], aColor[1], aColor[2]); - return; + if (aOCListener->isFullyConstrained()) { + return Config_PropManager::color("Visualization", "sketch_fully_constrained_color"); } - int aShapeType = thePrs->getShapeType(); - // a compound is processed like the edge because the - // arc feature uses the compound for presentable AIS - if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/) - return; + else if (aOCListener->isConflictingObject(theObject)) { + return Config_PropManager::color("Visualization", "sketch_overconstraint_color"); + } + return Config_PropManager::color("Visualization", "sketch_entity_color"); +} + +//************************************************************************************** +void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject, + const AISObjectPtr& thePrs) const +{ + FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); // set color from preferences std::shared_ptr anAuxiliaryAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); - std::vector aColor; - if (aOCListener->isFullyConstrained()) - aColor = Config_PropManager::color("Visualization", "sketch_fully_constrained_color"); - else if (aOCListener->isConflictingObject(theObject)) - aColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color"); - else { - if (isConstruction) - aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color"); - else if (isExternal(aFeature)) - aColor = Config_PropManager::color("Visualization", "sketch_external_color"); - else - aColor = Config_PropManager::color("Visualization", "sketch_entity_color"); - } + std::vector aColor = colorOfObject(theObject, aFeature, isConstruction); if (!aColor.empty()) { // The code below causes redisplay again if (ModelAPI_Session::get()->isOperation()) { @@ -2249,6 +2243,20 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject thePrs->setColor(aColor[0], aColor[1], aColor[2]); } + int aShapeType = thePrs->getShapeType(); + // a compound is processed like the edge because the + // arc feature uses the compound for presentable AIS + if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/) + return; + + if (isExternal(aFeature)) { + thePrs->setWidth(1); + return; + } + std::string aKind = aFeature->getKind(); + if (isDistanceKind(aKind)) + return; + if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound if (isConstruction) { // Set axilliary line diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 87e4a2865..092982f52 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -479,6 +479,9 @@ private: /// Returns operation manager XGUI_OperationMgr* operationMgr() const; + std::vector colorOfObject(const ObjectPtr& theObject, + const FeaturePtr& aFeature, bool isConstruction) const; + private: PartSet_Module* myModule; PartSet_PreviewSketchPlane* mySketchPlane; // display/erase sketch plane on start/stop sketch diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 68549f2b2..fd4fae9d7 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -665,6 +665,8 @@ void XGUI_Displayer::setSelectionColor(const std::vector& theColor) theColor[1] / 255., theColor[2] / 255., Quantity_TOC_RGB); aContext->SelectionStyle()->SetColor(aQColor); + aContext->SelectionStyle()->PointAspect()->SetColor(aQColor); + aContext->SelectionStyle()->LineAspect()->SetColor(aQColor); aContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor(aQColor); } }