Salome HOME
Fix the problem of not previewed results of constraints applied. Flash Delete (for...
[modules/shaper.git] / src / GeomData / GeomData_Dir.cpp
index ddf20ebbd1ae25609a5e1033326e81fab10c2a6e..b1378d1710ac1a5839ffe32fc38dc45567151dcd 100644 (file)
@@ -1,15 +1,16 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        GeomData_Dir.cxx
 // Created:     2 Apr 2014
 // Author:      Mikhail PONIKAROV
 
 #include "GeomData_Dir.h"
-#include "GeomAPI_Dir.h"
+#include <GeomAPI_Dir.h>
+#include <GeomAPI_XYZ.h>
 #include <gp_Dir.hxx>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
 
-using namespace std;
-
 void GeomData_Dir::setValue(const double theX, const double theY, const double theZ)
 {
   if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY
@@ -21,7 +22,7 @@ void GeomData_Dir::setValue(const double theX, const double theY, const double t
   }
 }
 
-void GeomData_Dir::setValue(const boost::shared_ptr<GeomAPI_Dir>& theDir)
+void GeomData_Dir::setValue(const std::shared_ptr<GeomAPI_Dir>& theDir)
 {
   setValue(theDir->x(), theDir->y(), theDir->z());
 }
@@ -41,17 +42,29 @@ double GeomData_Dir::z() const
   return myCoords->Value(2);
 }
 
-boost::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
+std::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
 {
-  return boost::shared_ptr<GeomAPI_Dir>(
+  return std::shared_ptr<GeomAPI_Dir>(
       new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
 }
 
+std::shared_ptr<GeomAPI_XYZ> GeomData_Dir::xyz()
+{
+  return std::shared_ptr<GeomAPI_XYZ>(
+      new GeomAPI_XYZ(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
+}
+
 GeomData_Dir::GeomData_Dir(TDF_Label& theLabel)
 {
-  myIsInitialized = theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True;
+  myLab = theLabel;
+  reinit();
+}
+
+void GeomData_Dir::reinit()
+{
+  myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True;
   if (!myIsInitialized) {
     // create attribute: not initialized by value yet, just zero
-    myCoords = TDataStd_RealArray::Set(theLabel, 0, 2);
+    myCoords = TDataStd_RealArray::Set(myLab, 0, 2);
   }
 }