Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintRigid.cpp
index c9763327e2b6f23f97452473eef478a45c902b2a..6695a8813dd8f0b0b7b1be6929734e6e05d8be75 100644 (file)
@@ -1,10 +1,19 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
 // File:    SketchPlugin_ConstraintRigid.cpp
 // Created: 13 Oct 2014
 // Author:  Artem ZHIDKOV
 
 #include "SketchPlugin_ConstraintRigid.h"
+#include "SketchPlugin_ConstraintParallel.h"
+
+#include <SketcherPrs_Factory.h>
 
 #include <ModelAPI_ResultConstruction.h>
+#include <Config_PropManager.h>
+
+#include <GeomDataAPI_Point2D.h>
+#include <GeomAlgoAPI_PointBuilder.h>
 
 SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid()
 {
@@ -24,31 +33,10 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious
   if (!sketch())
     return thePrevious;
 
-  boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
-      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
-  if (!anAttr || !anAttr->isObject())
-    return thePrevious;
-
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConst = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr->object());
-  if (!aConst) 
-    return thePrevious;
-
-  boost::shared_ptr<GeomAPI_Shape> aShape;
-  aShape = aConst->shape();
-
   AISObjectPtr anAIS = thePrevious;
-  if (!anAIS)
-    anAIS = AISObjectPtr(new GeomAPI_AISObject);
-
-  boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
-  anAIS->createFixed(aShape, aPlane);
-
-  // Set color from preferences
-  //std::vector<int> aRGB = Config_PropManager::color("Visualization", "perpendicular_color",
-  //                                                  PERPENDICULAR_COLOR);
-  //anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
+  if (!anAIS) {
+    anAIS = SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane());
+  }
 
   return anAIS;
 }
\ No newline at end of file