Salome HOME
Merge branch 'occ/shaper2smesh'
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Tools.cpp
index a285ea2431c1e7b8a2364b91047292a88f43e56e..df8e35cf60ccad6dddc455524dc1dda558dbfaac 100644 (file)
@@ -537,6 +537,43 @@ GeomPnt2dPtr flyoutPointCoordinates(const ConstraintPtr& theConstraint)
   return GeomPnt2dPtr(new GeomAPI_Pnt2d(X, Y));
 }
 
+
+void customizeFeaturePrs(const AISObjectPtr& thePrs, bool isAxiliary)
+{
+  std::vector<int> aColor;
+  int aWidth = 1;
+  if (isAxiliary) {
+    thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY());
+    aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color");
+    aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
+  }
+  else {
+    thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE());
+    aColor = Config_PropManager::color("Visualization", "sketch_entity_color");
+    aWidth = Config_PropManager::integer("Visualization", "sketch_line_width");
+  }
+  thePrs->setWidth(aWidth);
+  thePrs->setColor(aColor[0], aColor[1], aColor[2]);
+}
+
+void setDimensionColor(const AISObjectPtr& theDimPrs)
+{
+  std::vector<int> aColor = Config_PropManager::color("Visualization", "sketch_dimension_color");
+  if (aColor.size() == 3)
+    theDimPrs->setColor(aColor[0], aColor[1], aColor[2]);
+}
+
+void replaceInName(ObjectPtr theObject, const std::string& theSource, const std::string& theDest)
+{
+  std::string aName = theObject->data()->name();
+  size_t aPos = aName.find(theSource);
+  if (aPos != std::string::npos) {
+    std::string aNewName = aName.substr(0, aPos) + theDest
+                         + aName.substr(aPos + theSource.size());
+    theObject->data()->setName(aNewName);
+  }
+}
+
 } // namespace SketchPlugin_Tools