X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomData%2FGeomData_Dir.cpp;h=b1378d1710ac1a5839ffe32fc38dc45567151dcd;hb=f3fe84b84646ce3ece6e0fd1511cacdae29c7765;hp=3800c938ce04ee810e1bca6d6ff858bd83114f28;hpb=8ef37902d880bc2e74f2ae46880aaee1b4c19307;p=modules%2Fshaper.git diff --git a/src/GeomData/GeomData_Dir.cpp b/src/GeomData/GeomData_Dir.cpp index 3800c938c..b1378d171 100644 --- a/src/GeomData/GeomData_Dir.cpp +++ b/src/GeomData/GeomData_Dir.cpp @@ -1,19 +1,20 @@ +// 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 +#include #include #include #include -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 || - myCoords->Value(2) != theZ) { + if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY + || myCoords->Value(2) != theZ) { myCoords->SetValue(0, theX); myCoords->SetValue(1, theY); myCoords->SetValue(2, theZ); @@ -21,10 +22,9 @@ void GeomData_Dir::setValue(const double theX, const double theY, const double t } } -void GeomData_Dir::setValue(const boost::shared_ptr& theDir) +void GeomData_Dir::setValue(const std::shared_ptr& theDir) { setValue(theDir->x(), theDir->y(), theDir->z()); - owner()->data()->sendAttributeUpdated(this); } double GeomData_Dir::x() const @@ -42,17 +42,29 @@ double GeomData_Dir::z() const return myCoords->Value(2); } -boost::shared_ptr GeomData_Dir::dir() +std::shared_ptr GeomData_Dir::dir() +{ + return std::shared_ptr( + new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); +} + +std::shared_ptr GeomData_Dir::xyz() { - return boost::shared_ptr(new GeomAPI_Dir( - myCoords->Value(0), myCoords->Value(1), myCoords->Value(2))); + return std::shared_ptr( + 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); } }