From: vpa Date: Thu, 16 Jun 2016 11:38:19 +0000 (+0300) Subject: 0027611: Visualization - provide an interface to access selection frustum center... X-Git-Tag: V7_1_0_beta~292 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=21a8e27535f2f8f0a83fe5f9b255412dd520c37a;p=occt-copy.git 0027611: Visualization - provide an interface to access selection frustum center points from SelectBasics level - getters for rectangular frustum center points were added to SelectBasics_SelectingVolumeManager --- diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 4903457536..7b31fc9ec9 100644 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -4140,8 +4140,8 @@ static Standard_Integer OCC26195 (Draw_Interpretor& theDI, Standard_Integer theA aMgr->BuildSelectingVolume (aPxPnt1); } const gp_Pnt* aVerts = aMgr->GetVertices(); - gp_Pnt aNearPnt = aMgr->GetNearPnt(); - gp_Pnt aFarPnt = aMgr->GetFarPnt(); + gp_Pnt aNearPnt = aMgr->GetNearPickedPnt(); + gp_Pnt aFarPnt = aMgr->GetFarPickedPnt(); BRepBuilderAPI_MakePolygon aWireBldrs[4]; aWireBldrs[0].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z())); diff --git a/src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx b/src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx index d4d40ea982..fc2ef18e10 100644 --- a/src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx +++ b/src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx @@ -96,6 +96,18 @@ public: virtual Standard_Boolean IsOverlapAllowed() const = 0; + //! Valid only for point and rectangular selection. + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto near view frustum plane + virtual gp_Pnt GetNearPickedPnt() const = 0; + + //! Valid only for point and rectangular selection. + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto far view frustum plane + virtual gp_Pnt GetFarPickedPnt() const = 0; + protected: SelectionType myActiveSelectionType; //!< Active selection type: point, box or polyline }; diff --git a/src/SelectMgr/SelectMgr_RectangularFrustum.hxx b/src/SelectMgr/SelectMgr_RectangularFrustum.hxx index de30a13fa8..4f2a92ff74 100644 --- a/src/SelectMgr/SelectMgr_RectangularFrustum.hxx +++ b/src/SelectMgr/SelectMgr_RectangularFrustum.hxx @@ -114,9 +114,15 @@ public: //! A set of helper functions that return rectangular selecting frustum data inline const gp_Pnt* GetVertices() const { return myVertices; } - inline gp_Pnt GetNearPnt() const { return myNearPickedPnt; } - - inline gp_Pnt GetFarPnt() const { return myFarPickedPnt; } + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto near view frustum plane + inline const gp_Pnt& GetNearPnt() const { return myNearPickedPnt; } + + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto far view frustum plane + inline const gp_Pnt& GetFarPnt() const { return myFarPickedPnt; } protected: Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1, diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx index 8e975930d5..53406659e1 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx @@ -430,10 +430,10 @@ const gp_Pnt* SelectMgr_SelectingVolumeManager::GetVertices() const } //======================================================================= -// function : GetNearPnt +// function : GetNearPickedPnt // purpose : //======================================================================= -gp_Pnt SelectMgr_SelectingVolumeManager::GetNearPnt() const +gp_Pnt SelectMgr_SelectingVolumeManager::GetNearPickedPnt() const { if (myActiveSelectionType == Polyline) return gp_Pnt(); @@ -444,10 +444,10 @@ gp_Pnt SelectMgr_SelectingVolumeManager::GetNearPnt() const } //======================================================================= -// function : GetFarPnt +// function : GetFarPickedPnt // purpose : //======================================================================= -gp_Pnt SelectMgr_SelectingVolumeManager::GetFarPnt() const +gp_Pnt SelectMgr_SelectingVolumeManager::GetFarPickedPnt() const { if (myActiveSelectionType == Polyline) return gp_Pnt(); diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx index 2900186a5f..9321864a8c 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx @@ -171,9 +171,17 @@ public: //! A set of helper functions that return rectangular selecting frustum data Standard_EXPORT const gp_Pnt* GetVertices() const; - Standard_EXPORT gp_Pnt GetNearPnt() const; - - Standard_EXPORT gp_Pnt GetFarPnt() const; + //! Valid only for point and rectangular selection. + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto near view frustum plane + Standard_EXPORT virtual gp_Pnt GetNearPickedPnt() const Standard_OVERRIDE; + + //! Valid only for point and rectangular selection. + //! Returns projection of 2d mouse picked point or projection + //! of center of 2d rectangle (for point and rectangular selection + //! correspondingly) onto far view frustum plane + Standard_EXPORT virtual gp_Pnt GetFarPickedPnt() const Standard_OVERRIDE; private: enum { Frustum, FrustumSet, VolumeTypesNb }; //!< Defines the amount of available selecting volumes