Salome HOME
Updated copyright comment
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_SensitivePoint.cpp
index 2edfea572a854fa59d30a71e8ff92b1223362aa2..c399d0d6254a6d1af8f56850128e8d77f487f23a 100644 (file)
@@ -1,14 +1,27 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        SketcherPrs_SensitivePoint.cpp
-// Created:     24 March 2015
-// Author:      Vitaly SMETANNIKOV
-
+// Copyright (C) 2014-2024  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
+//
 
 #include "SketcherPrs_SensitivePoint.h"
+#include "SketcherPrs_SymbolPrs.h"
 
 #include <Graphic3d_ArrayOfPoints.hxx>
-#include "SketcherPrs_SymbolPrs.h"
+#include <Standard_Version.hxx>
 
 #define DEBUG_SENSITIVE_TO_BE_CORRECTED
 
@@ -24,24 +37,30 @@ SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(
 Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr,
                                                    SelectBasics_PickResult& thePickResult)
 {
-  Standard_Real aDepth      = RealLast();
-  Standard_Real aDistToCOG  = RealLast();
-  gp_Pnt aPnt = Point();
-  if (!theMgr.Overlaps (aPnt, aDepth))
-  {
-    thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
-    return Standard_False;
-  }
+#if OCC_VERSION_HEX < 0x070400
+       Standard_Real aDepth = RealLast();
+       Standard_Real aDistToCOG = RealLast();
+       gp_Pnt aPnt = Point();
+       if (!theMgr.Overlaps(aPnt, aDepth))
+       {
+               thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG);
+               return Standard_False;
+       }
 
-  aDistToCOG = aDepth;
-  thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
-  return Standard_True;
+       aDistToCOG = aDepth;
+       thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG);
+       return Standard_True;
+#else
+  gp_Pnt aPnt = Point();
+  if (theMgr.Overlaps (aPnt, thePickResult))
+         return Standard_True;
+  return Standard_False;
+#endif
 }
 
 gp_Pnt SketcherPrs_SensitivePoint::Point() const
 {
-  const Handle(SelectMgr_EntityOwner)& anOwner =
-    Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
+  const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId();
   const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
     Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
   return aSymbPrs->pointsArray()->Vertice(myId);
@@ -56,8 +75,7 @@ Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected()
 gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const
 {
 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
-  const Handle(SelectMgr_EntityOwner)& anOwner =
-    Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
+  const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId();
   const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
     Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
   if (aSymbPrs->pointsArray()->VertexNumber() < myId)
@@ -69,8 +87,7 @@ gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const
 Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox()
 {
 #ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED
-  const Handle(SelectMgr_EntityOwner)& anOwner =
-    Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
+  const Handle(SelectMgr_EntityOwner)& anOwner = OwnerId();
   const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
     Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
   if (aSymbPrs->pointsArray()->VertexNumber() < myId)
@@ -81,7 +98,11 @@ Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox()
                             SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()));
 }
 
+#if OCC_VERSION_HEX > 0x070400
+Standard_Integer SketcherPrs_SensitivePoint::NbSubElements() const
+#else
 Standard_Integer SketcherPrs_SensitivePoint::NbSubElements()
+#endif
 {
   return 1;
 }