1 // File: GeomData_Point2D.cxx
2 // Created: 24 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #include "GeomData_Point2D.h"
6 #include <GeomAPI_Pnt2d.h>
7 #include <ModelAPI_Feature.h>
8 #include <ModelAPI_Data.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 owner()->data()->sendAttributeUpdated(this);
21 void GeomData_Point2D::setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
23 setValue(thePoint->x(), thePoint->y());
24 owner()->data()->sendAttributeUpdated(this);
27 double GeomData_Point2D::x() const
29 return myCoords->Value(0);
32 double GeomData_Point2D::y() const
34 return myCoords->Value(1);
37 boost::shared_ptr<GeomAPI_Pnt2d> GeomData_Point2D::pnt()
39 boost::shared_ptr<GeomAPI_Pnt2d> aResult(
40 new GeomAPI_Pnt2d(myCoords->Value(0), myCoords->Value(1)));
44 GeomData_Point2D::GeomData_Point2D(TDF_Label& theLabel)
46 myIsInitialized = theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True;
47 if (!myIsInitialized) {
48 // create attribute: not initialized by value yet, just zero
49 myCoords = TDataStd_RealArray::Set(theLabel, 0, 1);