X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_SensitivePoint.cpp;h=6f1450c95ce9fa484e6388d84b82f0a9060a017b;hb=d2034a988bc73596aab1bb256ddb02ce9ad2bd5a;hp=26e5d6b5169265cde144a5c87caf8733e34728b3;hpb=17b61215b489751c07eef76110fb979f8dafa39f;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index 26e5d6b51..6f1450c95 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -1,26 +1,40 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: SketcherPrs_SensitivePoint.cpp -// Created: 24 March 2015 -// Author: Vitaly SMETANNIKOV - +// Copyright (C) 2014-2017 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 "SketcherPrs_SensitivePoint.h" #include #include "SketcherPrs_SymbolPrs.h" -IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); +#define DEBUG_SENSITIVE_TO_BE_CORRECTED + IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); -SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& anOwner, - int theId) +SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint( + const Handle(SelectBasics_EntityOwner)& anOwner, int theId) :Select3D_SensitiveEntity(anOwner), myId(theId) { - SetSensitivityFactor(12.); + SetSensitivityFactor(12); } -Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr, +Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) { Standard_Real aDepth = RealLast(); @@ -39,15 +53,11 @@ Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolu gp_Pnt SketcherPrs_SensitivePoint::Point() const { - gp_Pnt aPoint(0, 0, 0); const Handle(SelectMgr_EntityOwner)& anOwner = Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); - if (!anOwner.IsNull()) { - const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = - Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); - aPoint = aSymbPrs->pointsArray()->Vertice(myId); - } - return aPoint; + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + return aSymbPrs->pointsArray()->Vertice(myId); } Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() @@ -58,11 +68,27 @@ 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(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + if (aSymbPrs->pointsArray()->VertexNumber() < myId) + return gp_Pnt(); +#endif return Point(); } Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox() { +#ifdef DEBUG_SENSITIVE_TO_BE_CORRECTED + const Handle(SelectMgr_EntityOwner)& anOwner = + Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + if (aSymbPrs->pointsArray()->VertexNumber() < myId) + return Select3D_BndBox3d(); +#endif gp_Pnt aPnt = Point(); return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()), SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z())); @@ -72,3 +98,8 @@ Standard_Integer SketcherPrs_SensitivePoint::NbSubElements() { return 1; } + +void SketcherPrs_SensitivePoint::Clear() +{ + return; +}