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 #include "SketcherPrs_Radius.h"
17 #include "SketcherPrs_LengthDimension.h"
18
19 #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
20 AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
21                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane) \
22 { \
23   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
24   Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
25   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
26   return aAISObj; \
27 }
28
29 CONSTRAINT_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
30 CONSTRAINT_PRS_IMPL(parallelConstraint, SketcherPrs_Parallel);
31 CONSTRAINT_PRS_IMPL(perpendicularConstraint, SketcherPrs_Perpendicular);
32 CONSTRAINT_PRS_IMPL(rigidConstraint, SketcherPrs_Rigid);
33 CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal);
34 CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent);
35 CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
36 CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
37
38
39 AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint,
40                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
41
42   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
43   Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, true); 
44   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); 
45   return aAISObj; 
46 }
47
48 AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
49                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
50
51   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
52   Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, false); 
53   aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); 
54   return aAISObj; 
55 }