X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomData%2FGeomData_Dir.cpp;h=bfb86c89f6cd75b85c181734f054234762ae23a1;hb=4cb94080355bcda617d6560b14bb39619ba90a4a;hp=8c90cf752ff15b548aa8ddafddb991e393bd3570;hpb=2532fb2df83ee1ddd9ff3e8b381d3788eaa15b69;p=modules%2Fshaper.git diff --git a/src/GeomData/GeomData_Dir.cpp b/src/GeomData/GeomData_Dir.cpp index 8c90cf752..bfb86c89f 100644 --- a/src/GeomData/GeomData_Dir.cpp +++ b/src/GeomData/GeomData_Dir.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,9 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "GeomData_Dir.h" @@ -79,5 +79,32 @@ void GeomData_Dir::reinit() if (!myIsInitialized) { // create attribute: not initialized by value yet, just zero myCoords = TDataStd_RealArray::Set(myLab, 0, 2); + myIsInitialized = true; } } + +void GeomData_Dir::reset() +{ + if (myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) { + // invalidate values of the direction + myCoords->SetValue(0, 0.0); + myCoords->SetValue(1, 0.0); + myCoords->SetValue(2, 0.0); + } + GeomDataAPI_Dir::reset(); +} + +bool GeomData_Dir::isInitialized() +{ + // Check once again the direction is initialized. + // Use case (bos #18905): draw a sketch, click "Change sketch plane", then abort it. + // myIsInitialized value is dropped to false, thus recheck. + // Additionally verify the values are valid. + // Use case (bos #24206): start a sketch, highlight a coordinate plane, then click anywhere + // in empty space. Sketch features in menu appears and can be selected. + if (!myIsInitialized) { + myIsInitialized = myLab.FindAttribute(TDataStd_RealArray::GetID(), myCoords) == Standard_True + && myCoords->Value(0) != 0.0 && myCoords->Value(1) != 0.0 && myCoords->Value(2) != 0.0; + } + return ModelAPI_Attribute::isInitialized(); +}