Salome HOME
Union of validator and filter functionalities.
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintCoincidence.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintCoincidence.cpp
4 // Created: 08 May 2014
5 // Author:  Artem ZHIDKOV
6
7 #include "SketchPlugin_ConstraintCoincidence.h"
8
9 #include <SketcherPrs_Factory.h>
10
11 #include <ModelAPI_AttributeDouble.h>
12 #include <ModelAPI_Data.h>
13 #include <SketchPlugin_Point.h>
14 #include <GeomDataAPI_Dir.h>
15 #include <GeomDataAPI_Point.h>
16
17 SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence()
18 {
19 }
20
21 void SketchPlugin_ConstraintCoincidence::initAttributes()
22 {
23   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
24   data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::type());
25 }
26
27 void SketchPlugin_ConstraintCoincidence::execute()
28 {
29 }
30
31 AISObjectPtr SketchPlugin_ConstraintCoincidence::getAISObject(AISObjectPtr thePrevious)
32 {
33   if (!sketch())
34     return thePrevious;
35
36   AISObjectPtr anAIS = thePrevious;
37   if (!anAIS) {
38     anAIS = SketcherPrs_Factory::coincidentConstraint(this, sketch()->coordinatePlane());
39     anAIS->setColor(0, 0, 255);
40   }
41   return anAIS;
42 }