1 // Copyright (C) 2019-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomData_Point2DArray_H_
21 #define GeomData_Point2DArray_H_
25 #include <GeomDataAPI_Point2DArray.h>
27 #include <TDataStd_RealArray.hxx>
28 #include <TDF_Label.hxx>
30 /** \class GeomData_Point2DArray
32 * \brief Attribute that contains an array of 2D points.
34 class GeomData_Point2DArray : public GeomDataAPI_Point2DArray
36 TDF_Label myLab; ///< the main label of the attribute
37 Handle_TDataStd_RealArray myArray; ///< array that keeps all coordinates of the points
40 /// Copy values from another array
41 /// \return \c true if the copy was successful
42 GEOMDATA_EXPORT virtual bool assign(std::shared_ptr<GeomDataAPI_Point2DArray> theOther);
44 /// Returns the size of the array (zero means that it is empty)
45 GEOMDATA_EXPORT virtual int size();
47 /// Sets the new size of the array. The previous data is erased.
48 GEOMDATA_EXPORT virtual void setSize(const int theSize);
50 /// Defines the value of the array by index [0; size-1]
51 GEOMDATA_EXPORT virtual void setPnt(const int theIndex,
52 const double theX, const double theY);
54 /// Defines the value of the array by index [0; size-1]
55 GEOMDATA_EXPORT virtual void setPnt(const int theIndex,
56 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
58 /// Returns the value by the index
59 GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt(const int theIndex);
62 /// Initializes attributes
63 GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label& theLabel);
64 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
65 virtual void reinit();
67 friend class Model_Data;