Salome HOME
Sub-features of sketcher support
[modules/shaper.git] / src / GeomData / GeomData_Dir.cpp
1 // File:        GeomData_Dir.cxx
2 // Created:     2 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include "GeomData_Dir.h"
6 #include "GeomAPI_Dir.h"
7 #include <gp_Dir.hxx>
8
9 using namespace std;
10
11 void GeomData_Dir::setValue(const double theX, const double theY, const double theZ)
12 {
13   myCoords->SetValue(0, theX);
14   myCoords->SetValue(1, theY);
15   myCoords->SetValue(2, theZ);
16 }
17
18 double GeomData_Dir::x() const
19 {
20   return myCoords->Value(0);
21 }
22
23 double GeomData_Dir::y() const
24 {
25   return myCoords->Value(1);
26 }
27
28 double GeomData_Dir::z() const
29 {
30   return myCoords->Value(2);
31 }
32
33 boost::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
34 {
35   return boost::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(
36     myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
37 }
38
39 GeomData_Dir::GeomData_Dir(TDF_Label& theLabel)
40 {
41   // check the attribute could be already presented in this doc (after load document)
42   if (!theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) {
43     // create attribute: not initialized by value yet, just zero
44     myCoords = TDataStd_RealArray::Set(theLabel, 0, 2);
45   }
46 }