From: vsv Date: Wed, 17 Jun 2015 10:08:30 +0000 (+0300) Subject: Fix for selection point of transformation constraint presentation X-Git-Tag: V_1.3.0~230 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c217fb2d4f19174ecd30f170fc3206fba98a9d8;p=modules%2Fshaper.git Fix for selection point of transformation constraint presentation --- diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index f9a49e9d1..fa091f9a7 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -7,18 +7,15 @@ #include "SketcherPrs_SensitivePoint.h" -#include -#include -#include -#include +#include +#include "SketcherPrs_SymbolPrs.h" IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& anOwner, - const Handle(Graphic3d_ArrayOfPoints)& thePntArray, - int theId) -:Select3D_SensitiveEntity(anOwner), myId(theId), myPntArray(thePntArray) + int theId) +:Select3D_SensitiveEntity(anOwner), myId(theId) { SetSensitivityFactor(12.); } @@ -28,7 +25,7 @@ Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolu { Standard_Real aDepth = RealLast(); Standard_Real aDistToCOG = RealLast(); - gp_Pnt aPnt = myPntArray->Vertice(myId); + gp_Pnt aPnt = Point(); if (!theMgr.Overlaps (aPnt, aDepth)) { thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); @@ -42,12 +39,16 @@ Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolu gp_Pnt SketcherPrs_SensitivePoint::Point() const { - return myPntArray->Vertice(myId); + const Handle(SelectMgr_EntityOwner)& anOwner = + Handle(SelectMgr_EntityOwner)::DownCast(OwnerId()); + const Handle(SketcherPrs_SymbolPrs)& aSymbPrs = + Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable()); + return aSymbPrs->pointsArray()->Vertice(myId); } Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() { - Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myPntArray, myId); + Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId); return aNewEntity; } @@ -58,7 +59,7 @@ gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox() { - gp_Pnt aPnt = myPntArray->Vertice(myId); + gp_Pnt aPnt = Point(); return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()), SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z())); } diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.h b/src/SketcherPrs/SketcherPrs_SensitivePoint.h index 31cad7bb2..408bec8e4 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.h +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.h @@ -8,7 +8,6 @@ #define SketcherPrs_SensitivePoint_H #include -#include #include @@ -24,8 +23,7 @@ class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity public: //! Constructs a sensitive point object defined by the //! owner OwnerId and the point Point. - Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId, - const Handle(Graphic3d_ArrayOfPoints)& thePntArray, int theId); + Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId, int theId); Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; @@ -53,7 +51,6 @@ public: private: int myId; - Handle(Graphic3d_ArrayOfPoints) myPntArray; }; diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 33a363a1b..adc71b67b 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -352,7 +352,7 @@ void SketcherPrs_SymbolPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& mySPoints.Clear(); for (int i = 1; i <= aNbVertex; i++) { - Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, myPntArray, i); + Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i); mySPoints.Append(aSP); } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index 31fb15e5e..1f8894f17 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -65,7 +65,7 @@ public: Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; } /// Return array of points where symbols will be placed - Handle(Graphic3d_ArrayOfPoints) pointsArray() const { return myPntArray; } + const Handle(Graphic3d_ArrayOfPoints)& pointsArray() const { return myPntArray; } /// Render of the presentation /// \param theWorkspace is OpenGl workspace diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 02a326bfe..47f32f7b5 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -9,9 +9,6 @@ #include "SketcherPrs_PositionMgr.h" #include -#include -#include -#include #include #include @@ -29,14 +26,6 @@ SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theCons bool isTranslation) : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation) { - int aPointsNb = 0; - if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { - aPointsNb = theConstraint->integer(SketchPlugin_MultiTranslation::NUMBER_OF_COPIES_ID())->value(); - } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { - aPointsNb = theConstraint->integer(SketchPlugin_MultiRotation::NUMBER_OF_COPIES_ID())->value(); - } - aPointsNb == 0 ? aPointsNb = 2 : aPointsNb++; // by default we have 2 points for symbols - myPntArray = new Graphic3d_ArrayOfPoints(aPointsNb); } bool SketcherPrs_Transformation::updatePoints(double theStep) const @@ -51,6 +40,7 @@ bool SketcherPrs_Transformation::updatePoints(double theStep) const return false; SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); + myPntArray = new Graphic3d_ArrayOfPoints(aNbB); int i; ObjectPtr aObj;