Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintCollinear.h
index 7ab635581472b64ca4dc746795bd168ff00f8696..b6e54c0877c5a368c67db72b6f483d14c75070ea 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:    SketchSolver_ConstraintCollinear.h
-// Created: 27 May 2014
-// Author:  Artem ZHIDKOV
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// 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 SketchSolver_ConstraintCollinear_H_
 #define SketchSolver_ConstraintCollinear_H_
@@ -17,13 +30,26 @@ class SketchSolver_ConstraintCollinear : public SketchSolver_Constraint
 {
 public:
   /// Constructor based on SketchPlugin constraint
-  SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint);
+  SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint)
+    : SketchSolver_Constraint(theConstraint),
+      myInSolver(false)
+  {
+    for (int i = 0; i < 4; ++i)
+      myIsConstraintApplied[i] = false;
+  }
+
+  /// \brief Notify this object about the feature is changed somewhere
+  virtual void notify(const FeaturePtr&      theFeature,
+                      PlaneGCSSolver_Update* theUpdater);
 
-  virtual ~SketchSolver_ConstraintCollinear() {}
+protected:
+  /// \brief Converts SketchPlugin constraint to a list of solver constraints
+  virtual void process();
 
-////  /// \brief Notify constraint, that coincidence appears or removed
-////  virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1,
-////                                        EntityWrapperPtr theCoincAttr2);
+private:
+  EntityWrapperPtr myPoints[4];  ///< extremities on collinear lines
+  bool myIsConstraintApplied[4]; ///< set \c true if point on opposite line
+  bool myInSolver; ///< the constraint is added to the solver
 };
 
 #endif