Salome HOME
Update unit-tests for SketchPlugin (part III)
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintParallel.cpp
index 91e6c4ca52fa1e6500a538809e759e6fc01caf49..7a6f71af5650be85384f0ec15cb6d5111553cd37 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
 // File:    SketchPlugin_ConstraintParallel.cpp
 // Created: 26 May 2014
 // Author:  Artem ZHIDKOV
@@ -6,7 +8,20 @@
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
-#include <SketchPlugin_Point.h>
+#include <ModelAPI_ResultConstruction.h>
+
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Sketch.h>
+
+#include <SketcherPrs_Factory.h>
+
+#include <GeomDataAPI_Point2D.h>
+#include <GeomAPI_Pnt2d.h>
+#include <GeomAPI_Pnt.h>
+#include <GeomDataAPI_Dir.h>
+#include <GeomDataAPI_Point.h>
+
+#include <Config_PropManager.h>
 
 SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel()
 {
@@ -14,17 +29,23 @@ SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel()
 
 void SketchPlugin_ConstraintParallel::initAttributes()
 {
-  data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
-  data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+  data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId());
+  //data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId());
 }
 
 void SketchPlugin_ConstraintParallel::execute()
 {
 }
 
-const boost::shared_ptr<GeomAPI_Shape>&  SketchPlugin_ConstraintParallel::preview()
+AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevious)
 {
-  /// \todo Preview for parallel constraint
-  return getPreview();
+  if (!sketch())
+    return thePrevious;
+
+  AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch()->coordinatePlane(),
+                                                               thePrevious);
+  return anAIS;
 }
 
+