Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / PartSet / PartSet_OperationSketch.cpp
1 // File:        PartSet_OperationSketch.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #include <PartSet_OperationSketch.h>
6
7 #include <SketchPlugin_Feature.h>
8 #include <ModelAPI_Data.h>
9 #include <ModelAPI_AttributeDocRef.h>
10
11 #include <AIS_Shape.hxx>
12 #include <AIS_ListOfInteractive.hxx>
13
14 #ifdef _DEBUG
15 #include <QDebug>
16 #endif
17
18 using namespace std;
19
20 PartSet_OperationSketch::PartSet_OperationSketch(const QString& theId,
21                                                      QObject* theParent)
22 : PartSet_OperationSketchBase(theId, theParent)
23 {
24 }
25
26 PartSet_OperationSketch::~PartSet_OperationSketch()
27 {
28 }
29
30 bool PartSet_OperationSketch::isPerformedImmediately() const
31 {
32   return false;
33 }
34
35 int PartSet_OperationSketch::getSelectionMode() const
36 {
37   return TopAbs_FACE;
38 }
39
40 void PartSet_OperationSketch::setSelectedObjects(const AIS_ListOfInteractive& theList)
41 {
42   if (theList.IsEmpty())
43     return;
44
45   // 1. get selected fase
46   Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(theList.First());
47   if (anAISShape.IsNull())
48     return;
49
50   const TopoDS_Shape& aShape = anAISShape->Shape();
51   boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
52   aRes->setImpl(new TopoDS_Shape(aShape));
53
54   // get plane parameters
55   double anX = 1, anY = 0, aZ = 0, anOrigin = 0;
56
57   // set plane parameters to feature
58   //boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
59   //boost::shared_ptr<ModelAPI_AttributeDocRef> anAttr = aData->docRef(SKETCH_ATTR_X);
60   //anAttr->setValue(anX);
61
62   commit();
63 }