1 // File: GeomData_Point2D.cxx
2 // Created: 24 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #include "GeomData_Point2D.h"
6 #include "Model_Events.h"
7 #include <Events_Loop.h>
8 #include <GeomAPI_Pnt2d.h>
12 void GeomData_Point2D::setValue(const double theX, const double theY)
14 if (myCoords->Value(0) != theX || myCoords->Value(1) != theY) {
15 myCoords->SetValue(0, theX);
16 myCoords->SetValue(1, theY);
17 static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
18 Model_FeatureUpdatedMessage aMsg(owner(), anEvent);
19 Events_Loop::loop()->send(aMsg);
23 void GeomData_Point2D::setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
25 setValue(thePoint->x(), thePoint->y());
28 double GeomData_Point2D::x() const
30 return myCoords->Value(0);
33 double GeomData_Point2D::y() const
35 return myCoords->Value(1);
38 boost::shared_ptr<GeomAPI_Pnt2d> GeomData_Point2D::pnt()
40 boost::shared_ptr<GeomAPI_Pnt2d> aResult(
41 new GeomAPI_Pnt2d(myCoords->Value(0), myCoords->Value(1)));
45 GeomData_Point2D::GeomData_Point2D(TDF_Label& theLabel)
47 // check the attribute could be already presented in this doc (after load document)
48 if (!theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) {
49 // create attribute: not initialized by value yet, just zero
50 myCoords = TDataStd_RealArray::Set(theLabel, 0, 1);