]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction for colors of sketcher and for selection of trihedron
authorvsv <vsv@opencascade.com>
Mon, 25 Nov 2019 12:53:46 +0000 (15:53 +0300)
committervsv <vsv@opencascade.com>
Mon, 25 Nov 2019 12:53:46 +0000 (15:53 +0300)
src/Model/Model_AttributeIntArray.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/XGUI/XGUI_Displayer.cpp

index f933ad261408582eeb7b93f71b5267056377737a..82ea6415e2003115384dea46c61c212013771160 100644 (file)
@@ -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);
index f0e4b1d43290943724342ae998bcd58cbf74b32e..9369a736221796580f5e91c594c0cbaf24f5e9d0 100644 (file)
@@ -2190,51 +2190,45 @@ bool isIncludeToResult(const ObjectPtr& theObject)
   return true;
 }
 
-
-void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject,
-  const AISObjectPtr& thePrs) const
+//**************************************************************************************
+std::vector<int> 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<int> 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<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
     aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
   bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
 
-  std::vector<int> 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<int> 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
index 87e4a2865883d07c653bab75177e0554c9d724ac..092982f52ec35255f1525b3f35ac0384ab442df7 100644 (file)
@@ -479,6 +479,9 @@ private:
   /// Returns operation manager
   XGUI_OperationMgr* operationMgr() const;
 
+  std::vector<int> 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
index 68549f2b2674fabf33d7421c29081dc9fd89e618..fd4fae9d704fb2c1ff00116a3f0ea9642a3c995d 100644 (file)
@@ -665,6 +665,8 @@ void XGUI_Displayer::setSelectionColor(const std::vector<int>& 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);
   }
 }