Salome HOME
Avoid regressions after fix issue #3049.
[modules/shaper.git] / src / SketchAPI / SketchAPI_MacroArc.cpp
index a82f44a709028c85b128a4e012f2076b38b67bd7..d8f9cb6f5d950fbe501871133b502d3835736987 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        SketchAPI_MacroArc.cpp
-// Created:     09 June 2016
-// Author:      Dmitry Bobylev
+// Copyright (C) 2014-2019  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
+//
 
 #include "SketchAPI_MacroArc.h"
 
@@ -16,9 +29,6 @@
 #include <SketchPlugin_ConstraintCoincidence.h>
 #include <SketchPlugin_ConstraintTangent.h>
 
-/// Obtain constraints prepared by tangent arc
-static std::list<FeaturePtr> tangentArcConstraints(const FeaturePtr& theArc);
-
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
 : SketchAPI_SketchEntity(theFeature)
@@ -28,10 +38,10 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature> &
 
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       double theCenterX, double theCenterY,
-                                       double theStartX, double theStartY,
-                                       double theEndX, double theEndY,
-                                       bool theInversed)
+                             double theCenterX, double theCenterY,
+                             double theStartX, double theStartY,
+                             double theEndX, double theEndY,
+                             bool theInversed)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
@@ -42,10 +52,10 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>&
 
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                       bool theInversed)
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             bool theInversed)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
@@ -55,9 +65,9 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>&
 
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       double theStartX, double theStartY,
-                                       double theEndX, double theEndY,
-                                       double thePassedX, double thePassedY)
+                             double theStartX, double theStartY,
+                             double theEndX, double theEndY,
+                             double thePassedX, double thePassedY)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -67,9 +77,9 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>&
 
 //===============================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -79,9 +89,9 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>&
 
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       const ModelHighAPI_RefAttr& theTangentPoint,
-                                       double theEndX, double theEndY,
-                                       bool theInversed)
+                             const ModelHighAPI_RefAttr& theTangentPoint,
+                             double theEndX, double theEndY,
+                             bool theInversed)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -91,9 +101,9 @@ SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>&
 
 //================================================================================================
 SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       const ModelHighAPI_RefAttr& theTangentPoint,
-                                       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                       bool theInversed)
+                             const ModelHighAPI_RefAttr& theTangentPoint,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             bool theInversed)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -109,14 +119,14 @@ SketchAPI_MacroArc::~SketchAPI_MacroArc()
 
 //================================================================================================
 void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, double theCenterY,
-                                             double theStartX, double theStartY,
-                                             double theEndX, double theEndY,
-                                             bool theInversed)
+                                        double theStartX, double theStartY,
+                                        double theEndX, double theEndY,
+                                        bool theInversed)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType);
   fillAttribute(center(), theCenterX, theCenterY);
-  fillAttribute(startPoint(), theStartX, theStartY);
-  fillAttribute(endPoint(), theEndX, theEndY);
+  fillAttribute(startPoint1(), theStartX, theStartY);
+  fillAttribute(endPoint1(), theEndX, theEndY);
   fillAttribute(theInversed, myreversed);
 
   execute();
@@ -124,14 +134,14 @@ void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, double theCenter
 
 //================================================================================================
 void SketchAPI_MacroArc::setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                             bool theInversed)
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                        bool theInversed)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType);
   fillAttribute(theCenter, mycenter);
-  fillAttribute(theStart, mystartPoint);
-  fillAttribute(theEnd, myendPoint);
+  fillAttribute(theStart, mystartPoint1);
+  fillAttribute(theEnd, myendPoint1);
   fillAttribute(theInversed, myreversed);
 
   execute();
@@ -139,12 +149,12 @@ void SketchAPI_MacroArc::setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d
 
 //================================================================================================
 void SketchAPI_MacroArc::setByStartEndPassed(double theStartX, double theStartY,
-                                             double theEndX, double theEndY,
-                                             double thePassedX, double thePassedY)
+                                        double theEndX, double theEndY,
+                                        double thePassedX, double thePassedY)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_THREE_POINTS(), myarcType);
-  fillAttribute(startPoint(), theStartX, theStartY);
-  fillAttribute(endPoint(), theEndX, theEndY);
+  fillAttribute(startPoint2(), theStartX, theStartY);
+  fillAttribute(endPoint2(), theEndX, theEndY);
   fillAttribute(passedPoint(), thePassedX, thePassedY);
 
   execute();
@@ -152,12 +162,12 @@ void SketchAPI_MacroArc::setByStartEndPassed(double theStartX, double theStartY,
 
 //================================================================================================
 void SketchAPI_MacroArc::setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_THREE_POINTS(), myarcType);
-  fillAttribute(theStart, mystartPoint);
-  fillAttribute(theEnd, myendPoint);
+  fillAttribute(theStart, mystartPoint2);
+  fillAttribute(theEnd, myendPoint2);
   fillAttribute(thePassed, mypassedPoint);
 
   execute();
@@ -165,12 +175,12 @@ void SketchAPI_MacroArc::setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d
 
 //================================================================================================
 void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                                      double theEndX, double theEndY,
-                                      bool theInversed)
+                                 double theEndX, double theEndY,
+                                 bool theInversed)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType);
   fillAttribute(theTangentPoint, mytangentPoint);
-  fillAttribute(endPoint(), theEndX, theEndY);
+  fillAttribute(endPoint3(), theEndX, theEndY);
   fillAttribute(theInversed, myreversed);
 
   execute();
@@ -178,12 +188,38 @@ void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoin
 
 //================================================================================================
 void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                                      const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                      bool theInversed)
+                                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                 bool theInversed)
 {
   fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType);
   fillAttribute(theTangentPoint, mytangentPoint);
-  fillAttribute(theEnd, myendPoint);
+  fillAttribute(theEnd, myendPoint3);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint,
+                                          double theEndX, double theEndY,
+                                          bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType);
+  fillAttribute(theTransversalPoint, mytransversalPoint);
+  fillAttribute(endPoint4(), theEndX, theEndY);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByTransversal(const ModelHighAPI_RefAttr& theTransversalPoint,
+                                          const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                          bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType);
+  fillAttribute(theTransversalPoint, mytransversalPoint);
+  fillAttribute(theEnd, myendPoint4);
   fillAttribute(theInversed, myreversed);
 
   execute();