Salome HOME
Rectangle correction to have coincidence with point/line selected for the first point...
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.cpp
index ab915408cac8c9834bd38101bd4ff8643f682d72..c164e44a40225855d89111b0ed14b17be1a45e2e 100644 (file)
@@ -21,28 +21,37 @@ ConstructionPlugin_Point::ConstructionPlugin_Point()
 {
 }
 
+const std::string& ConstructionPlugin_Point::getKind()
+{
+  static std::string MY_KIND = ConstructionPlugin_Point::ID();
+  return MY_KIND;
+}
+
 void ConstructionPlugin_Point::initAttributes()
 {
-  data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
-  data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
-  data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
+  data()->addAttribute(ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble::typeId());
 }
 
 void ConstructionPlugin_Point::execute()
 {
   std::shared_ptr<GeomAPI_Pnt> aPnt(
-      new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(),
-                      data()->real(POINT_ATTR_Z)->value()));
+      new GeomAPI_Pnt(data()->real(ConstructionPlugin_Point::X())->value(),
+                      data()->real(ConstructionPlugin_Point::Y())->value(),
+                      data()->real(ConstructionPlugin_Point::Z())->value()));
 
   std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
   aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
   setResult(aConstr);
 }
 
-void ConstructionPlugin_Point::customisePresentation(AISObjectPtr thePrs)
+bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult, 
+                                                     AISObjectPtr thePrs,
+                               std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
 {
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "construction_point_color",
-                                                    CONSTRUCTION_POINT_COLOR);
-  thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
-  thePrs->redisplay();
-}
\ No newline at end of file
+  bool isCustomized = theDefaultPrs.get() != NULL &&
+                      theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
+  //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
+  return true;
+}