1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0030687: Visualization - remove redundant interfaces SelectBasics_EntityOwner and SelectBasics_SensitiveEntity

SelectBasics_EntityOwner has been merged into SelectMgr_EntityOwner.
Unused property SelectMgr_EntityOwner::ResetLocation() has been removed.
SelectBasics package has been moved from TKService to TKV3d.

SelectBasics_SensitiveEntity has been merged into Select3D_SensitiveEntity.
This commit is contained in:
kgv
2019-05-21 19:42:15 +03:00
parent 547fcc76b2
commit 0ef04197f7
101 changed files with 429 additions and 812 deletions

View File

@@ -16,20 +16,15 @@
#include <SelectMgr_EntityOwner.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Type.hxx>
#include <TopLoc_Location.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_EntityOwner, Standard_Transient)
//==================================================
// Function: SelectMgr_EntityOwner
// Purpose :
//==================================================
SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Standard_Integer thePriority)
: SelectBasics_EntityOwner (thePriority),
mySelectable (NULL),
: mySelectable (NULL),
mypriority (thePriority),
myIsSelected (Standard_False),
myFromDecomposition (Standard_False)
{
@@ -42,8 +37,8 @@ SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Standard_Integer thePriority
//==================================================
SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_SelectableObject)& theSelObj,
const Standard_Integer thePriority)
: SelectBasics_EntityOwner (thePriority),
mySelectable (theSelObj.operator->()),
: mySelectable (theSelObj.get()),
mypriority (thePriority),
myIsSelected (Standard_False),
myFromDecomposition (Standard_False)
{
@@ -56,8 +51,8 @@ SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_SelectableO
//==================================================
SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const Standard_Integer thePriority)
: SelectBasics_EntityOwner (thePriority),
mySelectable (theOwner->mySelectable),
: mySelectable (theOwner->mySelectable),
mypriority (thePriority),
myIsSelected (Standard_False),
myFromDecomposition (Standard_False)
{
@@ -65,39 +60,14 @@ SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner
}
//=======================================================================
//function : SetSelectable
//function : HilightWithColor
//purpose :
//=======================================================================
void SelectMgr_EntityOwner::SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj)
{
mySelectable = theSelObj.operator->();
}
//=======================================================================
//function : Selectable
//purpose :
//=======================================================================
Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
{
return mySelectable;
}
//=======================================================================
//function : IsHilighted
//purpose :
//=======================================================================
Standard_Boolean SelectMgr_EntityOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) const
{
return mySelectable != NULL
&& thePrsMgr->IsHighlighted (mySelectable, theMode);
}
void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (!HasSelectable())
if (mySelectable == NULL)
{
return;
}
@@ -112,74 +82,3 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
}
}
void SelectMgr_EntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer )
{
if (HasSelectable())
{
thePrsMgr->Unhighlight (mySelectable);
}
}
void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
const Standard_Integer)
{
// nothing done on the selectable here...
}
//=======================================================================
//function : about Transformation
//purpose :
//=======================================================================
Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
{
return (HasSelectable() && mySelectable->HasTransformation());
}
void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
{
}
TopLoc_Location SelectMgr_EntityOwner::Location() const
{
return !HasLocation() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
}
void SelectMgr_EntityOwner::ResetLocation()
{
}
Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
{
return mySelectable == NULL
|| mySelectable->IsAutoHilight();
}
Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
{
return Standard_False;
}
//=======================================================================
//function : SetZLayer
//purpose :
//=======================================================================
void SelectMgr_EntityOwner::SetZLayer (const Standard_Integer )
{
//
}
//=======================================================================
//function : UpdateHighlightTrsf
//purpose :
//=======================================================================
void SelectMgr_EntityOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
const Handle(PrsMgr_PresentationManager3d)& theManager,
const Standard_Integer theDispMode)
{
if (mySelectable == NULL)
return;
theManager->UpdateHighlightTrsf (theViewer, mySelectable, theDispMode);
}

View File

@@ -17,27 +17,18 @@
#ifndef _SelectMgr_EntityOwner_HeaderFile
#define _SelectMgr_EntityOwner_HeaderFile
#include <Graphic3d_ZLayerId.hxx>
#include <Prs3d_Drawer.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
#include <Quantity_NameOfColor.hxx>
#include <TopLoc_Location.hxx>
class V3d_Viewer;
//! A framework to define classes of owners of sensitive primitives.
//! The owner is the link between application and
//! selection data structures.
//! For the application to make its own objects selectable,
//! it must define owner classes inheriting this framework.
class SelectMgr_EntityOwner : public SelectBasics_EntityOwner
//! The owner is the link between application and selection data structures.
//! For the application to make its own objects selectable, it must define owner classes inheriting this framework.
class SelectMgr_EntityOwner : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner, Standard_Transient)
public:
//! Initializes the selection priority aPriority.
@@ -50,25 +41,37 @@ public:
//! Constructs a framework from existing one
//! anSO being attributed the selection priority aPriority.
Standard_EXPORT SelectMgr_EntityOwner(const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority = 0);
//! Return selection priority (within range [0-9]) for results with the same depth; 0 by default.
//! Example - selection of shapes:
//! the owners are selectable objects (presentations) a user can give vertex priority [3], edges [2] faces [1] shape [0],
//! so that if during selection one vertex one edge and one face are simultaneously detected, the vertex will only be hilighted.
Standard_Integer Priority() const { return mypriority; }
//! Sets the selectable priority of the owner within range [0-9].
void SetPriority (Standard_Integer thePriority) { mypriority = thePriority; }
//! Returns true if there is a selectable object to serve as an owner.
Standard_Boolean HasSelectable() const { return mySelectable != NULL; }
//! Returns a selectable object detected in the working context.
Standard_EXPORT virtual Handle(SelectMgr_SelectableObject) Selectable() const;
virtual Handle(SelectMgr_SelectableObject) Selectable() const { return mySelectable; }
//! Sets the selectable object.
Standard_EXPORT virtual void SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj);
virtual void SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj) { mySelectable = theSelObj.get(); }
//! Returns true if the presentation manager aPM
//! highlights selections corresponding to the selection mode aMode.
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const;
//! Returns true if the presentation manager highlights selections corresponding to the selection mode.
virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode = 0) const
{
return mySelectable != NULL
&& thePrsMgr->IsHighlighted (mySelectable, theMode);
}
//! Highlights selectable object's presentation with mode theMode in presentation manager
//! with given highlight style. Also a check for auto-highlight is performed - if
//! selectable object manages highlighting on its own, execution will be passed to
//! SelectMgr_SelectableObject::HilightOwnerWithColor method
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
//! Highlights selectable object's presentation with display mode in presentation manager with given highlight style.
//! Also a check for auto-highlight is performed - if selectable object manages highlighting on its own,
//! execution will be passed to SelectMgr_SelectableObject::HilightOwnerWithColor method.
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0);
@@ -76,49 +79,84 @@ public:
//! This object could be the owner of a sensitive primitive.
//! @param thePrsMgr presentation manager
//! @param theMode obsolete argument for compatibility, should be ignored by implementations
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode = 0);
virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode = 0)
{
(void )theMode;
if (mySelectable != NULL)
{
thePrsMgr->Unhighlight (mySelectable);
}
}
//! Clears the owners matching the value of the selection
//! mode aMode from the presentation manager object aPM.
Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
Standard_EXPORT virtual Standard_Boolean HasLocation() const Standard_OVERRIDE;
Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
Standard_EXPORT virtual void ResetLocation() Standard_OVERRIDE;
Standard_EXPORT virtual TopLoc_Location Location() const Standard_OVERRIDE;
//! Set the state of the owner.
//! @param theIsSelected [in] shows if owner is selected.
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
virtual void Clear (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode = 0) /// TODO
{
(void )thePrsMgr;
(void )theMode;
}
//! Returns TRUE if selectable has transformation.
virtual Standard_Boolean HasLocation() const { return mySelectable != NULL && mySelectable->HasTransformation(); }
//! Returns transformation of selectable.
virtual TopLoc_Location Location() const
{
return mySelectable != NULL && mySelectable->HasTransformation()
? TopLoc_Location(mySelectable->Transformation())
: TopLoc_Location();
}
//! Change owner location (callback for handling change of location of selectable object).
virtual void SetLocation (const TopLoc_Location& theLocation)
{
(void )theLocation;
}
//! @return Standard_True if the owner is selected.
Standard_Boolean IsSelected() const { return myIsSelected; }
//! Set the state of the owner.
//! @param theIsSelected [in] shows if owner is selected.
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
//! Returns selection state.
Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead")
Standard_Integer State() const { return myIsSelected ? 1 : 0; }
//! Set the state of the owner.
//! The method is deprecated. Use SetSelected() instead.
void State (const Standard_Integer theStatus) { myIsSelected = (theStatus == 1); }
Standard_Integer State() const { return myIsSelected ? 1 : 0; }
//! if owner is not auto hilighted, for group contains many such owners will be called one method HilightSelected of SelectableObject
virtual Standard_Boolean IsAutoHilight() const
{
return mySelectable == NULL
|| mySelectable->IsAutoHilight();
}
//! if owner is not auto hilighted, for group contains many such owners
//! will be called one method HilightSelected of SelectableObject
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const;
//! if this method returns TRUE the owner will allways call method
//! Hilight for SelectableObject when the owner is detected. By default
//! it always return FALSE.
Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const;
//! if this method returns TRUE the owner will always call method Hilight for SelectableObject when the owner is detected.
//! By default it always return FALSE.
virtual Standard_Boolean IsForcedHilight() const { return Standard_False; }
//! Set Z layer ID and update all presentations.
Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId);
virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId)
{
(void )theLayerId;
}
//! Implements immediate application of location transformation of parent object to dynamic highlight structure
Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
const Handle(PrsMgr_PresentationManager3d)& theManager,
const Standard_Integer theDispMode);
virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
const Handle(PrsMgr_PresentationManager)& theManager,
const Standard_Integer theDispMode)
{
if (mySelectable != NULL)
{
theManager->UpdateHighlightTrsf (theViewer, mySelectable, theDispMode);
}
}
//! Returns true if pointer to selectable object of this owner is equal to the given one
Standard_Boolean IsSameSelectable (const Handle(SelectMgr_SelectableObject)& theOther) const
@@ -135,16 +173,25 @@ public:
public:
//! Sets the selectable object.
Standard_DEPRECATED ("Deprecated method - SetSelectable() should be used instead")
void Set (const Handle(SelectMgr_SelectableObject)& theSelObj) { SetSelectable (theSelObj); }
//! sets the selectable priority of the owner
Standard_DEPRECATED ("Deprecated method - SetPriority() should be used instead")
void Set (const Standard_Integer thePriority) { SetPriority (thePriority); }
protected:
SelectMgr_SelectableObject* mySelectable; //!< raw pointer to selectable object
Standard_Integer mypriority; //!< selection priority (for result with the same depth)
Standard_Boolean myIsSelected; //!< flag indicating selected state
Standard_Boolean myFromDecomposition; //!< flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE)
};
DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, Standard_Transient)
// for porting old code
typedef SelectMgr_EntityOwner SelectBasics_EntityOwner;
#endif // _SelectMgr_EntityOwner_HeaderFile

View File

@@ -17,12 +17,11 @@
#ifndef SelectMgr_IndexedDataMapOfOwnerCriterion_HeaderFile
#define SelectMgr_IndexedDataMapOfOwnerCriterion_HeaderFile
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SortCriterion.hxx>
#include <TColStd_MapTransientHasher.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<Handle(SelectBasics_EntityOwner),SelectMgr_SortCriterion,TColStd_MapTransientHasher> SelectMgr_IndexedDataMapOfOwnerCriterion;
typedef NCollection_IndexedDataMap<Handle(SelectMgr_EntityOwner), SelectMgr_SortCriterion, TColStd_MapTransientHasher> SelectMgr_IndexedDataMapOfOwnerCriterion;
#endif

View File

@@ -25,7 +25,6 @@
#include <Prs3d_Presentation.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_Selection.hxx>
@@ -270,12 +269,11 @@ void SelectMgr_SelectableObject::UpdateTransformations (const Handle(SelectMgr_S
const TopLoc_Location aSelfLocation (Transformation());
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
if (Handle(Select3D_SensitiveEntity) aSensEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
if (const Handle(Select3D_SensitiveEntity)& aSensEntity = aSelEntIter.Value()->BaseSensitive())
{
const Handle(SelectBasics_EntityOwner)& aEOwner = aSensEntity->OwnerId();
if (Handle(SelectMgr_EntityOwner) aMgrEO = Handle(SelectMgr_EntityOwner)::DownCast (aEOwner))
if (const Handle(SelectMgr_EntityOwner)& aEOwner = aSensEntity->OwnerId())
{
aMgrEO->SetLocation (aSelfLocation);
aEOwner->SetLocation (aSelfLocation);
}
}
}
@@ -405,9 +403,9 @@ void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
if (Handle(Select3D_SensitiveEntity) aEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
if (const Handle(Select3D_SensitiveEntity)& aEntity = aSelEntIter.Value()->BaseSensitive())
{
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId()))
if (const Handle(SelectMgr_EntityOwner)& aOwner = aEntity->OwnerId())
{
aOwner->SetZLayer (theLayerId);
}
@@ -514,7 +512,7 @@ Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (const Handle(SelectMgr_Ind
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
if (theOwners->Contains (anOwner))
{
Select3D_BndBox3d aBox = aSelEntIter.Value()->BaseSensitive()->BoundingBox();
@@ -537,7 +535,7 @@ Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const
if (!aGlobalSel.IsNull()
&& !aGlobalSel->IsEmpty())
{
return Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Entities().First()->BaseSensitive()->OwnerId());
return aGlobalSel->Entities().First()->BaseSensitive()->OwnerId();
}
return THE_NULL_ENTITYOWNER;
}

View File

@@ -14,9 +14,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_NullObject.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient)
@@ -57,7 +57,7 @@ void SelectMgr_Selection::Destroy()
// Function: ADD
// Purpose :
//==================================================
void SelectMgr_Selection::Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive)
void SelectMgr_Selection::Add (const Handle(Select3D_SensitiveEntity)& theSensitive)
{
// if input is null: in debug mode raise exception
Standard_NullObject_Raise_if (theSensitive.IsNull(), "Null sensitive entity is added to the selection");

View File

@@ -23,7 +23,7 @@
#include <SelectMgr_TypeOfBVHUpdate.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
class SelectBasics_SensitiveEntity;
class Select3D_SensitiveEntity;
//! Represents the state of a given selection mode for a
//! Selectable Object. Contains all the sensitive entities available for this mode.
@@ -75,7 +75,7 @@ public:
//! Adds the sensitive primitive to the list of stored entities in this object.
//! Raises NullObject if the primitive is a null handle.
Standard_EXPORT void Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive);
Standard_EXPORT void Add (const Handle(Select3D_SensitiveEntity)& theSensitive);
//! empties the selection from all the stored entities
Standard_EXPORT void Clear();

View File

@@ -23,7 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient)
// purpose : Creates new inactive for selection object with base entity
// theEntity
//=======================================================================
SelectMgr_SensitiveEntity::SelectMgr_SensitiveEntity (const Handle(SelectBasics_SensitiveEntity)& theEntity)
SelectMgr_SensitiveEntity::SelectMgr_SensitiveEntity (const Handle(Select3D_SensitiveEntity)& theEntity)
: mySensitive (theEntity),
myIsActiveForSelection (Standard_False)
{

View File

@@ -27,7 +27,7 @@ class SelectMgr_SensitiveEntity : public Standard_Transient
public:
//! Creates new inactive for selection object with base entity theEntity
Standard_EXPORT SelectMgr_SensitiveEntity (const Handle(SelectBasics_SensitiveEntity)& theEntity);
Standard_EXPORT SelectMgr_SensitiveEntity (const Handle(Select3D_SensitiveEntity)& theEntity);
~SelectMgr_SensitiveEntity() {}
@@ -35,7 +35,7 @@ public:
Standard_EXPORT void Clear();
//! Returns related instance of SelectBasics class
const Handle(SelectBasics_SensitiveEntity)& BaseSensitive() const { return mySensitive; }
const Handle(Select3D_SensitiveEntity)& BaseSensitive() const { return mySensitive; }
//! Returns true if this entity belongs to the active selection
//! mode of parent object
@@ -51,8 +51,8 @@ public:
private:
Handle(SelectBasics_SensitiveEntity) mySensitive; //!< Related SelectBasics entity
mutable Standard_Boolean myIsActiveForSelection; //!< Selection activity status
Handle(Select3D_SensitiveEntity) mySensitive; //!< Related SelectBasics entity
mutable Standard_Boolean myIsActiveForSelection; //!< Selection activity status
};
DEFINE_STANDARD_HANDLE(SelectMgr_SensitiveEntity, Standard_Transient)

View File

@@ -107,9 +107,7 @@ Select3D_BndBox3d SelectMgr_SensitiveEntitySet::Box (const Standard_Integer theI
Standard_Real SelectMgr_SensitiveEntitySet::Center (const Standard_Integer theIndex,
const Standard_Integer theAxis) const
{
const Handle(SelectBasics_SensitiveEntity)& aBasicEntity =
GetSensitiveById (theIndex)->BaseSensitive();
Handle(Select3D_SensitiveEntity) aSensitive (Handle(Select3D_SensitiveEntity)::DownCast (aBasicEntity));
const Handle(Select3D_SensitiveEntity)& aSensitive = GetSensitiveById (theIndex)->BaseSensitive();
const gp_Pnt aCenter = aSensitive->CenterOfGeometry();
Standard_Real aCenterCoord = 0.0;
aCenterCoord = theAxis == 0 ? aCenter.X() :

View File

@@ -19,7 +19,7 @@
#include <Graphic3d_ZLayerId.hxx>
#include <Precision.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <Select3D_SensitiveEntity.hxx>
//! This class provides data and criterion for sorting candidate
//! entities in the process of interactive selection by mouse click
@@ -27,7 +27,7 @@ class SelectMgr_SortCriterion
{
public:
Handle(SelectBasics_SensitiveEntity) Entity; //!< detected entity
Handle(Select3D_SensitiveEntity) Entity; //!< detected entity
gp_Pnt Point; //!< 3D point
Standard_Real Depth; //!< distance from the view plane to the entity
Standard_Real MinDist; //!< distance from the clicked point to the entity on the view plane

View File

@@ -21,8 +21,7 @@
#include <gp_Pnt.hxx>
#include <OSD_Environment.hxx>
#include <Precision.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectBasics_PickResult.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SortCriterion.hxx>
@@ -68,7 +67,7 @@ namespace {
//=======================================================================
void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriterion,
const SelectBasics_PickResult& thePickResult,
const Handle(SelectBasics_SensitiveEntity)& theEntity,
const Handle(Select3D_SensitiveEntity)& theEntity,
const gp_GTrsf& theInversedTrsf,
const SelectMgr_SelectingVolumeManager& theMgr) const
{
@@ -184,7 +183,7 @@ void SelectMgr_ViewerSelector::Clear()
// function: isToScaleFrustum
// purpose : Checks if the entity given requires to scale current selecting frustum
//=======================================================================
Standard_Boolean SelectMgr_ViewerSelector::isToScaleFrustum (const Handle(SelectBasics_SensitiveEntity)& theEntity)
Standard_Boolean SelectMgr_ViewerSelector::isToScaleFrustum (const Handle(Select3D_SensitiveEntity)& theEntity)
{
return mySelectingVolumeMgr.GetActiveSelectionType() == SelectMgr_SelectingVolumeManager::Point
&& sensitivity (theEntity) < myTolerances.Tolerance();
@@ -195,7 +194,7 @@ Standard_Boolean SelectMgr_ViewerSelector::isToScaleFrustum (const Handle(Select
// purpose : In case if custom tolerance is set, this method will return sum of entity
// sensitivity and custom tolerance.
//=======================================================================
Standard_Integer SelectMgr_ViewerSelector::sensitivity (const Handle(SelectBasics_SensitiveEntity)& theEntity) const
Standard_Integer SelectMgr_ViewerSelector::sensitivity (const Handle(Select3D_SensitiveEntity)& theEntity) const
{
return myTolerances.IsCustomTolSet() ?
theEntity->SensitivityFactor() + myTolerances.CustomTolerance() : theEntity->SensitivityFactor();
@@ -206,11 +205,11 @@ Standard_Integer SelectMgr_ViewerSelector::sensitivity (const Handle(SelectBasic
// purpose : Internal function that checks if a particular sensitive
// entity theEntity overlaps current selecting volume precisely
//=======================================================================
void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_SensitiveEntity)& theEntity,
void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEntity)& theEntity,
const gp_GTrsf& theInversedTrsf,
SelectMgr_SelectingVolumeManager& theMgr)
{
Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId()));
const Handle(SelectMgr_EntityOwner)& anOwner = theEntity->OwnerId();
Handle(SelectMgr_SelectableObject) aSelectable;
Standard_Boolean toRestoresViewClipEnabled = Standard_False;
if (!anOwner.IsNull())
@@ -316,7 +315,7 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
// needs to be scaled and transformed for the entity and performs
// necessary calculations
//=======================================================================
void SelectMgr_ViewerSelector::computeFrustum (const Handle(SelectBasics_SensitiveEntity)& theEnt,
void SelectMgr_ViewerSelector::computeFrustum (const Handle(Select3D_SensitiveEntity)& theEnt,
const SelectMgr_SelectingVolumeManager& theMgr,
const gp_GTrsf& theInvTrsf,
SelectMgr_FrustumCache& theCachedMgrs,
@@ -451,7 +450,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
const Handle(SelectMgr_SensitiveEntity)& aSensitive = anEntitySet->GetSensitiveById (anIdx);
if (aSensitive->IsActiveForSelection())
{
const Handle(SelectBasics_SensitiveEntity)& anEnt = aSensitive->BaseSensitive();
const Handle(Select3D_SensitiveEntity)& anEnt = aSensitive->BaseSensitive();
SelectMgr_SelectingVolumeManager aTmpMgr = aMgr;
computeFrustum (anEnt, theMgr, aInversedTrsf, aScaledTrnsfFrustums, aTmpMgr);
checkOverlap (anEnt, aInversedTrsf, aTmpMgr);
@@ -478,7 +477,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
for (Standard_Integer aStoredIter = mystored.Extent(); aStoredIter >= aFirstStored; --aStoredIter)
{
const SelectMgr_SortCriterion& aCriterion = mystored.FindFromIndex (aStoredIter);
const Handle(SelectBasics_EntityOwner)& anOwner = aCriterion.Entity->OwnerId();
const Handle(SelectMgr_EntityOwner)& anOwner = aCriterion.Entity->OwnerId();
Standard_Integer aNbOwnerEntities = 0;
for (SelectMgr_IndexedMapOfHSensitive::Iterator aSensIter (anEntitySet->Sensitives()); aSensIter.More(); aSensIter.Next())
{
@@ -655,13 +654,11 @@ void SelectMgr_ViewerSelector::ClearPicked()
// Function: Picked
// Purpose :
//==================================================
Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector
::Picked() const
Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector::Picked() const
{
Standard_Integer RankInMap = myIndexes->Value (myCurRank);
const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap);
Handle(SelectMgr_EntityOwner) Ownr = Handle(SelectMgr_EntityOwner)::DownCast (toto);
return Ownr;
const Standard_Integer aRankInMap = myIndexes->Value (myCurRank);
const Handle(SelectMgr_EntityOwner)& anOwner = mystored.FindKey (aRankInMap);
return anOwner;
}
//=======================================================================
@@ -670,16 +667,14 @@ Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector
//=======================================================================
Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector::Picked (const Standard_Integer theRank) const
{
Handle(SelectMgr_EntityOwner) anOwner;
if (theRank < 1 || theRank > NbPicked())
{
return anOwner;
return Handle(SelectMgr_EntityOwner)();
}
const Standard_Integer anOwnerIdx = myIndexes->Value (theRank);
const Handle(SelectBasics_EntityOwner)& aStoredOwner = mystored.FindKey (anOwnerIdx);
anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aStoredOwner);
return anOwner;
const Handle(SelectMgr_EntityOwner)& aStoredOwner = mystored.FindKey (anOwnerIdx);
return aStoredOwner;
}
//=======================================================================
@@ -982,7 +977,7 @@ void SelectMgr_ViewerSelector::ResetSelectionActivationStatus()
// purpose : Returns sensitive entity that was detected during the
// previous run of selection algorithm
//=======================================================================
const Handle(SelectBasics_SensitiveEntity)& SelectMgr_ViewerSelector::DetectedEntity() const
const Handle(Select3D_SensitiveEntity)& SelectMgr_ViewerSelector::DetectedEntity() const
{
const Standard_Integer aRankInMap = myIndexes->Value(myCurRank);
return mystored.FindFromIndex (aRankInMap).Entity;
@@ -992,7 +987,7 @@ const Handle(SelectBasics_SensitiveEntity)& SelectMgr_ViewerSelector::DetectedEn
// function : ActiveOwners
// purpose : Returns the list of active entity owners
//=======================================================================
void SelectMgr_ViewerSelector::ActiveOwners (NCollection_List<Handle(SelectBasics_EntityOwner)>& theOwners) const
void SelectMgr_ViewerSelector::ActiveOwners (NCollection_List<Handle(SelectMgr_EntityOwner)>& theOwners) const
{
for (SelectMgr_MapOfObjectSensitivesIterator anIter (myMapOfObjectSensitives); anIter.More(); anIter.Next())
{

View File

@@ -35,7 +35,7 @@
class SelectMgr_SelectionManager;
class SelectMgr_SensitiveEntitySet;
class SelectMgr_EntityOwner;
class SelectBasics_SensitiveEntity;
class Select3D_SensitiveEntity;
// resolve name collisions with X11 headers
#ifdef Status
@@ -125,7 +125,7 @@ public:
//! Returns the Entity for the object picked at specified position.
//! @param theRank rank of detected object within range 1...NbPicked()
const Handle(SelectBasics_SensitiveEntity)& PickedEntity (const Standard_Integer theRank) const { return PickedData (theRank).Entity; }
const Handle(Select3D_SensitiveEntity)& PickedEntity (const Standard_Integer theRank) const { return PickedData (theRank).Entity; }
//! Returns the 3D point (intersection of picking axis with the object nearest to eye)
//! for the object picked at specified position.
@@ -168,7 +168,7 @@ public:
Standard_EXPORT TCollection_AsciiString Status (const Handle(SelectMgr_SelectableObject)& theSelectableObject) const;
//! Returns the list of active entity owners
Standard_EXPORT void ActiveOwners (NCollection_List<Handle(SelectBasics_EntityOwner)>& theOwners) const;
Standard_EXPORT void ActiveOwners (NCollection_List<Handle(SelectMgr_EntityOwner)>& theOwners) const;
//! Adds new object to the map of selectable objects
Standard_EXPORT void AddSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject);
@@ -243,7 +243,7 @@ public:
//! Returns sensitive entity that was detected during the previous run of selection algorithm
Standard_DEPRECATED("Deprecated method DetectedEntity() should be replaced by DetectedEntity(int)")
Standard_EXPORT const Handle(SelectBasics_SensitiveEntity)& DetectedEntity() const;
Standard_EXPORT const Handle(Select3D_SensitiveEntity)& DetectedEntity() const;
protected:
@@ -278,18 +278,18 @@ protected:
//! Internal function that checks if a particular sensitive
//! entity theEntity overlaps current selecting volume precisely
Standard_EXPORT void checkOverlap (const Handle(SelectBasics_SensitiveEntity)& theEntity,
Standard_EXPORT void checkOverlap (const Handle(Select3D_SensitiveEntity)& theEntity,
const gp_GTrsf& theInversedTrsf,
SelectMgr_SelectingVolumeManager& theMgr);
private:
//! Checks if the entity given requires to scale current selecting frustum
Standard_Boolean isToScaleFrustum (const Handle(SelectBasics_SensitiveEntity)& theEntity);
Standard_Boolean isToScaleFrustum (const Handle(Select3D_SensitiveEntity)& theEntity);
//! In case if custom tolerance is set, this method will return sum of entity sensitivity and
//! custom tolerance. Otherwise, pure entity sensitivity factor will be returned.
Standard_Integer sensitivity (const Handle(SelectBasics_SensitiveEntity)& theEntity) const;
Standard_Integer sensitivity (const Handle(Select3D_SensitiveEntity)& theEntity) const;
void Activate (const Handle(SelectMgr_Selection)& theSelection);
@@ -301,7 +301,7 @@ private:
//! Internal function that checks if a current selecting frustum
//! needs to be scaled and transformed for the entity and performs
//! necessary calculations
void computeFrustum (const Handle(SelectBasics_SensitiveEntity)& theEnt,
void computeFrustum (const Handle(Select3D_SensitiveEntity)& theEnt,
const SelectMgr_SelectingVolumeManager& theMgr,
const gp_GTrsf& theInvTrsf,
SelectMgr_FrustumCache& theCachedMgrs,
@@ -327,7 +327,7 @@ private: // implementation of deprecated methods
//! Compute 3d position for detected entity.
void updatePoint3d (SelectMgr_SortCriterion& theCriterion,
const SelectBasics_PickResult& thePickResult,
const Handle(SelectBasics_SensitiveEntity)& theEntity,
const Handle(Select3D_SensitiveEntity)& theEntity,
const gp_GTrsf& theInversedTrsf,
const SelectMgr_SelectingVolumeManager& theMgr) const;