Salome HOME
Merge branch 'master' into ngo/Lot5
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Perpendicular.cpp
index 14cef6b266af7a1c93305663db2914bd06e8da1d..314c74cb283f94240d26868b9fb39ffceb17e4c2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// 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
 //
 // 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "SketcherPrs_Perpendicular.h"
@@ -37,9 +36,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
-                                                     ModelAPI_CompositeFeature* theSketcher,
-                                                     const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
+  SketchPlugin_Sketch* theSketcher)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher)
 {
 }
 
@@ -60,7 +58,7 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint
 
 bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool withColor) const
 {
-  if (!IsReadyToDisplay(myConstraint, myPlane))
+  if (!IsReadyToDisplay(myConstraint, plane()))
     return false;
 
   ObjectPtr aObj1 =
@@ -83,10 +81,10 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool with
 
   GeomAPI_Curve aCurve1(aShp1);
   GeomAPI_Curve aCurve2(aShp2);
-  bool isInside1 = ((aParam1 - aCurve1.startParam()) >= -Precision::Confusion()) &&
-    ((aCurve1.endParam() - aParam1) >= Precision::Confusion());
-  bool isInside2 = ((aParam2 - aCurve2.startParam()) >= -Precision::Confusion()) &&
-    ((aCurve2.endParam() - aParam2) >= Precision::Confusion());
+  bool isInside1 = (aParam1 >= (aCurve1.startParam() - Precision::Confusion())) &&
+    (aParam1 <= (aCurve1.endParam() + Precision::Confusion()));
+  bool isInside2 = (aParam2 >= (aCurve2.startParam() - Precision::Confusion())) &&
+    (aParam2 <= (aCurve2.endParam() + Precision::Confusion()));
 
   if (!(isInside1 && isInside2))
     aPnt = std::shared_ptr<GeomAPI_Pnt>();