1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetPoint2dAngle.h
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 const Config_WidgetAPI* theData,
28 const std::string& theParentId)
29 : PartSet_WidgetPoint2dDistance(theParent, theData, theParentId)
33 PartSet_WidgetPoint2dAngle::~PartSet_WidgetPoint2dAngle()
37 double PartSet_WidgetPoint2dAngle::computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
38 const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
40 std::shared_ptr<GeomAPI_Dir2d> aHorizontalDir(new GeomAPI_Dir2d(1, 0));
41 std::shared_ptr<GeomAPI_XY> aStartPnt = theFirstPnt->xy();
42 std::shared_ptr<GeomAPI_XY> aEndPnt = theCurrentPnt->xy();
44 std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
46 double aValue = aHorizontalDir->angle(aLineDir);