1 // File: GeomData_Dir.cxx
3 // Author: Mikhail PONIKAROV
5 #include "GeomData_Dir.h"
6 #include "GeomAPI_Dir.h"
8 #include <ModelAPI_Feature.h>
9 #include <ModelAPI_Data.h>
13 void GeomData_Dir::setValue(const double theX, const double theY, const double theZ)
15 if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY
16 || myCoords->Value(2) != theZ) {
17 myCoords->SetValue(0, theX);
18 myCoords->SetValue(1, theY);
19 myCoords->SetValue(2, theZ);
20 owner()->data()->sendAttributeUpdated(this);
24 void GeomData_Dir::setValue(const boost::shared_ptr<GeomAPI_Dir>& theDir)
26 setValue(theDir->x(), theDir->y(), theDir->z());
27 owner()->data()->sendAttributeUpdated(this);
30 double GeomData_Dir::x() const
32 return myCoords->Value(0);
35 double GeomData_Dir::y() const
37 return myCoords->Value(1);
40 double GeomData_Dir::z() const
42 return myCoords->Value(2);
45 boost::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
47 return boost::shared_ptr<GeomAPI_Dir>(
48 new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
51 GeomData_Dir::GeomData_Dir(TDF_Label& theLabel)
53 myIsInitialized = theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True;
54 if (!myIsInitialized) {
55 // create attribute: not initialized by value yet, just zero
56 myCoords = TDataStd_RealArray::Set(theLabel, 0, 2);