Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomData / GeomData_Point2D.h
index 8e3c124b3d45515ee57177707277c7035bf38d25..05d3b23a36fa4713274984d3f0afce65e0c0a491 100644 (file)
@@ -1,15 +1,32 @@
-// File:        GeomData_Point2D.h
-// Created:     24 Apr 2014
-// Author:      Mikhail PONIKAROV
+// Copyright (C) 2014-2023  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
-#ifndef GeomData_Point2D_HeaderFile
-#define GeomData_Point2D_HeaderFile
+#ifndef GeomData_Point2D_H_
+#define GeomData_Point2D_H_
 
 #include "GeomData.h"
 #include "GeomDataAPI_Point2D.h"
-#include <TDataStd_RealArray.hxx>
+
 #include <TDF_Label.hxx>
 
+class ModelAPI_ExpressionDouble;
+
 /**\class GeomData_Point2D
  * \ingroup DataModel
  * \brief Attribute that contains 2D point.
 
 class GeomData_Point2D : public GeomDataAPI_Point2D
 {
-  Handle_TDataStd_RealArray myCoords; ///< X and Y doubles as real array attribute [0; 1]
-public:
+  enum { NUM_COMPONENTS = 2 };
+  std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y
+ public:
   /// Defines the double value
   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
   /// Defines the point
-  GEOMDATA_EXPORT virtual void setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+  GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
 
   /// Returns the X double value
   GEOMDATA_EXPORT virtual double x() const;
   /// Returns the Y double value
   GEOMDATA_EXPORT virtual double y() const;
   /// Returns the 2D point
-  GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt();
+  GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt();
+
+  /// Defines the calculated double value
+  GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, const double theY);
+
+  /// Defines the text values
+  GEOMDATA_EXPORT virtual void setText(const std::wstring& theX,
+                                       const std::wstring& theY);
+
+  /// Returns the text values
+  GEOMDATA_EXPORT virtual std::wstring textX();
+  GEOMDATA_EXPORT virtual std::wstring textY();
+
+  /// Allows to set expression (text) as invalid (by the parameters listener)
+  GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
 
-protected:
+  /// Returns true if text is invalid
+  GEOMDATA_EXPORT virtual bool expressionInvalid(int);
+
+  /// Allows to set expression (text) error (by the parameters listener)
+  GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
+
+  /// Returns an expression error
+  GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
+
+  /// Defines the used parameters
+  GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
+    const std::set<std::wstring>& theUsedParameters);
+
+  /// Returns the used parameters
+  GEOMDATA_EXPORT virtual std::set<std::wstring> usedParameters(int theComponent) const;
+
+ protected:
   /// Initializes attributes
-  GEOMDATA_EXPORT GeomData_Point2D(TDF_Label& theLabel);
+  GEOMDATA_EXPORT GeomData_Point2D();
+  /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
+  virtual void reinit();
+
+  /// Resets attribute to deafult state.
+  virtual void reset();
 
   friend class Model_Data;
 };