SHAPER  9.12.0
GeomData_Point2DArray.h
1 // Copyright (C) 2019-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef GeomData_Point2DArray_H_
21 #define GeomData_Point2DArray_H_
22 
23 #include "GeomData.h"
24 
25 #include <GeomDataAPI_Point2DArray.h>
26 
27 #include <TDataStd_RealArray.hxx>
28 #include <TDF_Label.hxx>
29 
35 {
36  TDF_Label myLab;
37  Handle_TDataStd_RealArray myArray;
38 
39 public:
42  GEOMDATA_EXPORT virtual bool assign(std::shared_ptr<GeomDataAPI_Point2DArray> theOther);
43 
45  GEOMDATA_EXPORT virtual int size();
46 
48  GEOMDATA_EXPORT virtual void setSize(const int theSize);
49 
51  GEOMDATA_EXPORT virtual void setPnt(const int theIndex,
52  const double theX, const double theY);
53 
55  GEOMDATA_EXPORT virtual void setPnt(const int theIndex,
56  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
57 
59  GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt(const int theIndex);
60 
61 protected:
63  GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label& theLabel);
65  virtual void reinit();
66 
67  friend class Model_Data;
68 };
69 
70 #endif
Attribute that contains array of 2D point coordinates.
Definition: GeomDataAPI_Point2DArray.h:34
Attribute that contains an array of 2D points.
Definition: GeomData_Point2DArray.h:35
virtual void reinit()
Reinitializes the internal state of the attribute (may be needed on undo/redo, abort,...
Definition: GeomData_Point2DArray.cpp:37
GeomData_Point2DArray(TDF_Label &theLabel)
Initializes attributes.
Definition: GeomData_Point2DArray.cpp:31
virtual bool assign(std::shared_ptr< GeomDataAPI_Point2DArray > theOther)
Copy values from another array.
Definition: GeomData_Point2DArray.cpp:43
virtual void setSize(const int theSize)
Sets the new size of the array. The previous data is erased.
Definition: GeomData_Point2DArray.cpp:69
virtual int size()
Returns the size of the array (zero means that it is empty)
Definition: GeomData_Point2DArray.cpp:57
virtual void setPnt(const int theIndex, const double theX, const double theY)
Defines the value of the array by index [0; size-1].
Definition: GeomData_Point2DArray.cpp:98
virtual std::shared_ptr< GeomAPI_Pnt2d > pnt(const int theIndex)
Returns the value by the index.
Definition: GeomData_Point2DArray.cpp:114
General object of the application that allows to get/set attributes from the document and compute res...
Definition: Model_Data.h:61