Salome HOME
Empty AIS in the viewer: throw c++ exception (to be finalized, currently do nothing)
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintHorizontal.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintHorizontal.cpp
4 // Created: 16 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #include "SketchPlugin_ConstraintHorizontal.h"
8
9 #include <ModelAPI_AttributeDouble.h>
10 #include <ModelAPI_Data.h>
11 #include <ModelAPI_ResultConstruction.h>
12
13 #include <SketchPlugin_Line.h>
14 #include <SketchPlugin_Sketch.h>
15
16 #include <SketcherPrs_Factory.h>
17 //#include <SketcherPrs_Tools.h>
18
19 #include <Config_PropManager.h>
20
21 SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal()
22 {
23 }
24
25 void SketchPlugin_ConstraintHorizontal::initAttributes()
26 {
27   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
28 }
29
30 void SketchPlugin_ConstraintHorizontal::execute()
31 {
32 }
33
34 AISObjectPtr SketchPlugin_ConstraintHorizontal::getAISObject(AISObjectPtr thePrevious)
35 {
36   if (!sketch())
37     return thePrevious;
38
39   AISObjectPtr anAIS = thePrevious;
40
41   if (!anAIS) {
42     anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch()->coordinatePlane());
43     /*
44     ObjectPtr aObj = SketcherPrs_Tools::getResult(this, SketchPlugin_Constraint::ENTITY_A());
45     if (SketcherPrs_Tools::getShape(aObj).get() != NULL) {
46       anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch()->coordinatePlane());
47     }*/
48   }
49   /*else {
50     ObjectPtr aObj = SketcherPrs_Tools::getResult(this, SketchPlugin_Constraint::ENTITY_A());
51     if (SketcherPrs_Tools::getShape(aObj).get() == NULL) {
52       anAIS = AISObjectPtr();
53     }
54   }*/
55   return anAIS;
56 }
57
58