Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Factory.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_Factory.cpp
4 // Created:     13 February 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #include "SketcherPrs_Factory.h"
8
9 #include "SketcherPrs_Coincident.h"
10 #include "SketcherPrs_Parallel.h"
11 #include "SketcherPrs_Perpendicular.h"
12 #include "SketcherPrs_Rigid.h"
13 #include "SketcherPrs_HVDirection.h"
14 #include "SketcherPrs_Equal.h"
15 #include "SketcherPrs_Tangent.h"
16
17 #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
18 AISObjectPtr SketcherPrs_Factory::NAME(SketchPlugin_Constraint* theConstraint, \
19                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane) \
20 { \
21   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
22   Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
23   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
24   return aAISObj; \
25 }
26
27 CONSTRAINT_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
28 CONSTRAINT_PRS_IMPL(parallelConstraint, SketcherPrs_Parallel);
29 CONSTRAINT_PRS_IMPL(perpendicularConstraint, SketcherPrs_Perpendicular);
30 CONSTRAINT_PRS_IMPL(rigidConstraint, SketcherPrs_Rigid);
31 CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal);
32 CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent);
33
34
35 AISObjectPtr SketcherPrs_Factory::horisontalConstraint(SketchPlugin_Constraint* theConstraint,
36                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
37
38   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
39   Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, true); 
40   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); 
41   return aAISObj; 
42 }
43
44 AISObjectPtr SketcherPrs_Factory::verticalConstraint(SketchPlugin_Constraint* theConstraint,
45                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
46
47   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
48   Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, false); 
49   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); 
50   return aAISObj; 
51 }