1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetPoint2dAngle.cpp
4 // Created: 23 June 2014
5 // Author: Vitaly Smetannikov
7 #include "PartSet_WidgetPoint2dAngle.h"
9 #include <ModuleBase_ParamSpinBox.h>
11 #include <ModuleBase_Tools.h>
13 #include <GeomAPI_Pnt2d.h>
14 #include <GeomDataAPI_Point2D.h>
16 #include <ModelAPI_Data.h>
17 #include <ModelAPI_AttributeDouble.h>
19 #include <QMouseEvent>
21 #include <GeomAPI_Dir2d.h>
22 #include <GeomAPI_XY.h>
24 #define PI 3.1415926535897932
26 PartSet_WidgetPoint2dAngle::PartSet_WidgetPoint2dAngle(QWidget* theParent,
27 ModuleBase_IWorkshop* theWorkshop,
28 const Config_WidgetAPI* theData,
29 const std::string& theParentId)
30 : PartSet_WidgetPoint2dDistance(theParent, theWorkshop, theData, theParentId)
34 PartSet_WidgetPoint2dAngle::~PartSet_WidgetPoint2dAngle()
38 double PartSet_WidgetPoint2dAngle::computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
39 const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
41 std::shared_ptr<GeomAPI_Dir2d> aHorizontalDir(new GeomAPI_Dir2d(1, 0));
42 std::shared_ptr<GeomAPI_XY> aStartPnt = theFirstPnt->xy();
43 std::shared_ptr<GeomAPI_XY> aEndPnt = theCurrentPnt->xy();
45 std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
47 double aValue = aHorizontalDir->angle(aLineDir);