X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomData%2FGeomData_Dir.cpp;h=d5272dda21f432786c2ca04ff8e983b99a7a5108;hb=530f5aff42069e844c4a4ef164088ea23ba0e2dd;hp=22dac3fe4df1cb7c186986feeb655bfda658bd1a;hpb=f05a54dabb8f9aff6b52df72a88160a9be792aee;p=modules%2Fshaper.git diff --git a/src/GeomData/GeomData_Dir.cpp b/src/GeomData/GeomData_Dir.cpp index 22dac3fe4..d5272dda2 100644 --- a/src/GeomData/GeomData_Dir.cpp +++ b/src/GeomData/GeomData_Dir.cpp @@ -1,18 +1,32 @@ +// 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) { - myCoords->SetValue(0, theX); - myCoords->SetValue(1, theY); - myCoords->SetValue(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); + owner()->data()->sendAttributeUpdated(this); + } +} + +void GeomData_Dir::setValue(const std::shared_ptr& theDir) +{ + setValue(theDir->x(), theDir->y(), theDir->z()); } double GeomData_Dir::x() const @@ -30,16 +44,22 @@ 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) { - // check the attribute could be already presented in this doc (after load document) - if (!theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) { + myIsInitialized = theLabel.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); }