Open CASCADE Technology: SelectMgr_ViewerSelector Class Reference

Open CASCADE Technology 6.8.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions | Protected Member Functions | Protected Attributes
SelectMgr_ViewerSelector Class Reference

A framework to define finding, sorting the sensitive primitives in a view. Services are also provided to define the return of the owners of those primitives selected. The primitives are sorted by criteria such as priority of the primitive or its depth in the view relative to that of other primitives. This framework is undefined for either 2D or 3D, and is consequently used by both StdSelect_ViewerSelector2d and StdSelect_ViewerSelector3d, which inherit it, and which in turn, return 2D and 3D owners of sensitive primitives respectively. Note that in 3D, the inheriting framework StdSelect_ViewerSelector3d is only to be used if you do not want to use the services provided by AIS. In 2D, you will, however, need the services provided by the StdSelect_ViewerSelector2d. Two tools are available to find and select objects found at a given position in the view. If you want to select the owners of all the objects detected at point x,y, you use the Init - More - Next - Picked loop. If, on the other hand, you want to select only one object detected at that point, you use the Init - More - OnePicked loop. In this iteration, More is used to see if an object was picked and OnePicked, to get the object closest to the pick position. Viewer selectors are driven by SelectMgr_SelectionManager, and manipulate the SelectMgr_Selection objects given to them by the selection manager. More...

`#include <SelectMgr_ViewerSelector.hxx>`

Inheritance diagram for SelectMgr_ViewerSelector:
[legend]

## Public Member Functions
virtual void | Convert (const Handle< SelectMgr_Selection > &aSelection)
| to be redefined if conversion is necessary for SensitiveEntities... More...
void | Clear ()
| Empties all the tables, removes all selections... More...
void | UpdateConversion ()
| converts all the sensitive entities ; More...
void | SetSensitivity (const Standard_Real aTol)
| changes the Sensitivity of picking Input value is Real. More...
Standard_Real | Sensitivity () const
| returns the Sensitivity of picking More...
void | SetClipping (const Standard_Real Xc, const Standard_Real Yc, const Standard_Real Height, const Standard_Real Width)
| sets the clipping limits of dynamic picking input value are Real More...
void | SetClipping (const Bnd_Box2d &aRectangle)
| sets the clipping limits of dynamic picking input value are Real More...
void | InitSelect (const Standard_Real Xr, const Standard_Real Yr)
| Performs a pick action. Xr, Yr are the real 2D mouse coordinates in the view. The selector looks for areas and owners that are touched. More...
void | InitSelect (const Bnd_Box2d &aRect)
| Performs a pick action. aRect is a Box2d (real coordinates) for the selection. The selector looks for areas and owners that are touched. More...
void | InitSelect (const Standard_Real Xmin, const Standard_Real Ymin, const Standard_Real Xmax, const Standard_Real Ymax)
| Performs a pick action. More...
void | InitSelect (const TColgp_Array1OfPnt2d &Polyline)
| pick action - input values of a polyline selection for selection. More...
virtual void | SortResult ()
| Sorts the detected entites by priority and distance. to be redefined if other criterion are used... More...
void | Init ()
| Begins an iteration scanning for the owners detected at a position in the view. More...
Standard_Boolean | More ()
| Continues the interation scanning for the owners detected at a position in the view, or. More...
void | Next ()
| Returns the next owner found in the iteration. This is a scan for the owners detected at a position in the view. More...
Handle< SelectMgr_EntityOwner > | Picked () const
| Returns the current selected entity detected by the selector;. More...
Handle< SelectMgr_EntityOwner > | OnePicked ()
| Returns the picked element with the highest priority, and which is the closest to the last successful mouse position. More...
void | SetPickClosest (const Standard_Boolean preferClosest)
| Set preference of selecting one object for OnePicked() method: More...
Standard_Integer | NbPicked () const
| Returns the number of owners found at a position in the view by the Init - More - Next - Picked iteration. More...
Handle< SelectMgr_EntityOwner > | Picked (const Standard_Integer aRank) const
| Returns the entity which is at rank <aRank> in the list of stored ones. More...
Standard_Boolean | HasStored ()
| Returns True if a successful pick was stored, i.e. LastPosition method means something... More...
void | LastPosition (Standard_Real &Xr, Standard_Real &Yr) const
| Gives the last successful pick position; is useful to get objects really picked. More...
Standard_Boolean | Contains (const Handle< SelectMgr_SelectableObject > &aSelectableObject) const
Standard_Boolean | Modes (const Handle< SelectMgr_SelectableObject > &aSelectableObject, TColStd_ListOfInteger &ModeList, const SelectMgr_StateOfSelection WantedState=SelectMgr_SOS_Any) const
| Returns the list of selection modes ModeList found in this selector for the selectable object aSelectableObject. Returns true if aSelectableObject is referenced inside this selector; returns false if the object is not present in this selector. More...
Standard_Boolean | IsActive (const Handle< SelectMgr_SelectableObject > &aSelectableObject, const Standard_Integer aMode) const
| Returns true if the selectable object aSelectableObject having the selection mode aMode is active in this selector. More...
Standard_Boolean | IsInside (const Handle< SelectMgr_SelectableObject > &aSelectableObject, const Standard_Integer aMode) const
| Returns true if the selectable object aSelectableObject having the selection mode aMode is in this selector. More...
SelectMgr_StateOfSelection | Status (const Handle< SelectMgr_Selection > &aSelection) const
| Returns the selection status Status of the selection aSelection. More...
void | Dump (Standard_OStream &S) const
TCollection_AsciiString | Status (const Handle< SelectMgr_SelectableObject > &aSelectableObject) const
TCollection_AsciiString | Status () const
| gives general information about the Selector More...
void | UpdateSort ()
Handle < SelectBasics_SensitiveEntity > | Primitive (const Standard_Integer Rank) const
const SelectMgr_DataMapOfIntegerSensitive & | Primitives () const
void | SetUpdateSortPossible (const Standard_Boolean possible)
Standard_Boolean | IsUpdateSortPossible () const
const SelectBasics_PickArgs & | LastPickingArguments () const
Public Member Functions inherited from MMgt_TShared
virtual void | Delete () const
| Memory deallocator for transient classes. More...
Public Member Functions inherited from Standard_Transient
| Standard_Transient ()
| Empty constructor. More...
| Standard_Transient (const Standard_Transient &)
| Copy constructor – does nothing. More...
Standard_Transient & | operator= (const Standard_Transient &)
| Assignment operator, needed to avoid copying reference counter. More...
virtual | ~Standard_Transient ()
| Destructor must be virtual. More...
virtual const Handle_Standard_Type & | DynamicType () const
| Returns a type information object about this object. More...
Standard_Boolean | IsInstance (const Handle_Standard_Type &theType) const
| Returns a true value if this is an instance of Type. More...
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const
| Returns a true value if this is an instance of TypeName. More...
Standard_Boolean | IsKind (const Handle_Standard_Type &theType) const
| Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
Standard_Boolean | IsKind (const Standard_CString theTypeName) const
| Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
virtual Handle_Standard_Transient | This () const
| Returns a Handle which references this object. Must never be called to objects created in stack. More...
Standard_Integer | GetRefCount () const
| Get the reference counter of this object. More...

## Protected Member Functions
| SelectMgr_ViewerSelector ()
virtual void | LoadResult ()
virtual void | LoadResult (const Bnd_Box2d &aBox)
virtual void | LoadResult (const TColgp_Array1OfPnt2d &Polyline)
virtual gp_Lin | PickingLine (const Standard_Real theX, const Standard_Real theY) const
| Returns picking line along which the depth value should be computed. Override this method to compute picking line by the same which is used for projecting sensitive entities to selection space. More...
virtual void | DepthClipping (const Standard_Real theX, const Standard_Real theY, Standard_Real &theMin, Standard_Real &theMax) const
| Returns global depth clipping limits applied to every sensitive. Override this method to convert clippings defined by application into selection space for mouse picking detection. Default implementation returns infinite clip limits (no clipping). More...
virtual void | DepthClipping (const Standard_Real theX, const Standard_Real theY, const Handle< SelectMgr_EntityOwner > &theOwner, Standard_Real &theMin, Standard_Real &theMax) const
| Returns depth clipping limits applied to sensitives of entity owner. Override this method to convert clippings defined by application owners into selection space for mouse picking detection. Default implementation returns infinite clip limits (no clipping). More...
virtual Standard_Boolean | HasDepthClipping (const Handle< SelectMgr_EntityOwner > &theOwner) const
| Returns True if the owner provides clipping by depth for its sensitives. Override this method to tell the selector to use the DepthClipping method for the owner. Default implementation returns False for every owner. More...

## Protected Attributes
SelectMgr_DataMapOfIntegerSensitive | myentities
SelectMgr_DataMapOfSelectionActivation | myselections
Standard_Boolean | toupdate
Standard_Boolean | tosort
Standard_Boolean | preferclosest
Standard_Real | mytolerance
SelectBasics_SortAlgo | myselector
Bnd_Box2d | myclip
SelectMgr_IndexedDataMapOfOwnerCriterion | mystored

## Detailed Description

A framework to define finding, sorting the sensitive primitives in a view. Services are also provided to define the return of the owners of those primitives selected. The primitives are sorted by criteria such as priority of the primitive or its depth in the view relative to that of other primitives. This framework is undefined for either 2D or 3D, and is consequently used by both StdSelect_ViewerSelector2d and StdSelect_ViewerSelector3d, which inherit it, and which in turn, return 2D and 3D owners of sensitive primitives respectively. Note that in 3D, the inheriting framework StdSelect_ViewerSelector3d is only to be used if you do not want to use the services provided by AIS. In 2D, you will, however, need the services provided by the StdSelect_ViewerSelector2d. Two tools are available to find and select objects found at a given position in the view. If you want to select the owners of all the objects detected at point x,y, you use the Init - More - Next - Picked loop. If, on the other hand, you want to select only one object detected at that point, you use the Init - More - OnePicked loop. In this iteration, More is used to see if an object was picked and OnePicked, to get the object closest to the pick position. Viewer selectors are driven by SelectMgr_SelectionManager, and manipulate the SelectMgr_Selection objects given to them by the selection manager.

## Constructor & Destructor Documentation

SelectMgr_ViewerSelector::SelectMgr_ViewerSelector | ( |  | ) |
| protected

## Member Function Documentation

void SelectMgr_ViewerSelector::Clear | ( |  | ) |

Empties all the tables, removes all selections...

Standard_Boolean SelectMgr_ViewerSelector::Contains | ( | const Handle< SelectMgr_SelectableObject > & | aSelectableObject | ) | const

virtual void SelectMgr_ViewerSelector::Convert | ( | const Handle< SelectMgr_Selection > & | aSelection | ) |
| virtual

to be redefined if conversion is necessary for SensitiveEntities...

Reimplemented in StdSelect_ViewerSelector3d.

virtual void SelectMgr_ViewerSelector::DepthClipping | ( | const Standard_Real | theX,
|  | const Standard_Real | theY,
|  | Standard_Real & | theMin,
|  | Standard_Real & | theMax
| ) |  | const
| protectedvirtual

Returns global depth clipping limits applied to every sensitive. Override this method to convert clippings defined by application into selection space for mouse picking detection. Default implementation returns infinite clip limits (no clipping).

Parameters

  theX | [in] the x picking coordinate.
  theY | [in] the y picking coordinate.
  theMin | [out] the minimum depth. Default is RealFirst()
  theMax | [out] the maximum depth. Default is RealLast()

Reimplemented in StdSelect_ViewerSelector3d.

virtual void SelectMgr_ViewerSelector::DepthClipping | ( | const Standard_Real | theX,
|  | const Standard_Real | theY,
|  | const Handle< SelectMgr_EntityOwner > & | theOwner,
|  | Standard_Real & | theMin,
|  | Standard_Real & | theMax
| ) |  | const
| protectedvirtual

Returns depth clipping limits applied to sensitives of entity owner. Override this method to convert clippings defined by application owners into selection space for mouse picking detection. Default implementation returns infinite clip limits (no clipping).

Parameters

  theX | [in] the x picking coordinate.
  theY | [in] the y picking coordinate.
  theOwner | [in] the sensitive owner.
  theMin | [out] the minimum depth. Default is RealFirst()
  theMax | [out] the maximum depth. Default is RealLast()

Reimplemented in StdSelect_ViewerSelector3d.

void SelectMgr_ViewerSelector::Dump | ( | Standard_OStream & | S | ) | const

virtual Standard_Boolean SelectMgr_ViewerSelector::HasDepthClipping | ( | const Handle< SelectMgr_EntityOwner > & | theOwner | ) | const
| protectedvirtual

Returns True if the owner provides clipping by depth for its sensitives. Override this method to tell the selector to use the DepthClipping method for the owner. Default implementation returns False for every owner.

Parameters

  theOwner | [in] the onwer to check.

Returns
  True if owner provides depth limits for sensitive clipping.

Reimplemented in StdSelect_ViewerSelector3d.

Standard_Boolean SelectMgr_ViewerSelector::HasStored | ( |  | ) |

Returns True if a successful pick was stored, i.e. LastPosition method means something...

void SelectMgr_ViewerSelector::Init | ( |  | ) |

Begins an iteration scanning for the owners detected at a position in the view.

void SelectMgr_ViewerSelector::InitSelect | ( | const Standard_Real | Xr,
|  | const Standard_Real | Yr
| ) |  |

Performs a pick action. Xr, Yr are the real 2D mouse coordinates in the view. The selector looks for areas and owners that are touched.

void SelectMgr_ViewerSelector::InitSelect | ( | const Bnd_Box2d & | aRect | ) |

Performs a pick action. aRect is a Box2d (real coordinates) for the selection. The selector looks for areas and owners that are touched.

void SelectMgr_ViewerSelector::InitSelect | ( | const Standard_Real | Xmin,
|  | const Standard_Real | Ymin,
|  | const Standard_Real | Xmax,
|  | const Standard_Real | Ymax
| ) |  |

Performs a pick action.

- Xmin, Ymin define the coordinates of the minimum point in the lower left hand corner of the selection box, and XMax, YMax define the coordinates of the maximum point in the upper right hand corner of the selection box. The selector looks for areas and owners that are touched.

void SelectMgr_ViewerSelector::InitSelect | ( | const TColgp_Array1OfPnt2d & | Polyline | ) |

pick action - input values of a polyline selection for selection.

Standard_Boolean SelectMgr_ViewerSelector::IsActive | ( | const Handle< SelectMgr_SelectableObject > & | aSelectableObject,
|  | const Standard_Integer | aMode
| ) |  | const

Returns true if the selectable object aSelectableObject having the selection mode aMode is active in this selector.

Standard_Boolean SelectMgr_ViewerSelector::IsInside | ( | const Handle< SelectMgr_SelectableObject > & | aSelectableObject,
|  | const Standard_Integer | aMode
| ) |  | const

Returns true if the selectable object aSelectableObject having the selection mode aMode is in this selector.

Standard_Boolean SelectMgr_ViewerSelector::IsUpdateSortPossible | ( |  | ) | const

const SelectBasics_PickArgs& SelectMgr_ViewerSelector::LastPickingArguments | ( |  | ) | const

void SelectMgr_ViewerSelector::LastPosition | ( | Standard_Real & | Xr,
|  | Standard_Real & | Yr
| ) |  | const

Gives the last successful pick position; is useful to get objects really picked.

virtual void SelectMgr_ViewerSelector::LoadResult | ( |  | ) |
| protectedvirtual

virtual void SelectMgr_ViewerSelector::LoadResult | ( | const Bnd_Box2d & | aBox | ) |
| protectedvirtual

virtual void SelectMgr_ViewerSelector::LoadResult | ( | const TColgp_Array1OfPnt2d & | Polyline | ) |
| protectedvirtual

Standard_Boolean SelectMgr_ViewerSelector::Modes | ( | const Handle< SelectMgr_SelectableObject > & | aSelectableObject,
|  | TColStd_ListOfInteger & | ModeList,
|  | const SelectMgr_StateOfSelection | WantedState = `SelectMgr_SOS_Any`
| ) |  | const

Returns the list of selection modes ModeList found in this selector for the selectable object aSelectableObject. Returns true if aSelectableObject is referenced inside this selector; returns false if the object is not present in this selector.

Standard_Boolean SelectMgr_ViewerSelector::More | ( |  | ) |

Continues the interation scanning for the owners detected at a position in the view, or.

- continues the iteration scanning for the owner closest to the position in the view.

Standard_Integer SelectMgr_ViewerSelector::NbPicked | ( |  | ) | const

Returns the number of owners found at a position in the view by the Init - More - Next - Picked iteration.

void SelectMgr_ViewerSelector::Next | ( |  | ) |

Returns the next owner found in the iteration. This is a scan for the owners detected at a position in the view.

Handle< SelectMgr_EntityOwner > SelectMgr_ViewerSelector::OnePicked | ( |  | ) |

Returns the picked element with the highest priority, and which is the closest to the last successful mouse position.

Handle< SelectMgr_EntityOwner > SelectMgr_ViewerSelector::Picked | ( |  | ) | const

Returns the current selected entity detected by the selector;.

Handle< SelectMgr_EntityOwner > SelectMgr_ViewerSelector::Picked | ( | const Standard_Integer | aRank | ) | const

Returns the entity which is at rank <aRank> in the list of stored ones.

virtual gp_Lin SelectMgr_ViewerSelector::PickingLine | ( | const Standard_Real | theX,
|  | const Standard_Real | theY
| ) |  | const
| protectedvirtual

Returns picking line along which the depth value should be computed. Override this method to compute picking line by the same which is used for projecting sensitive entities to selection space.

Parameters

  theX | [in] the x picking coordinate.
  theY | [in] the y picking coordinate.

Returns
  picking line.

Reimplemented in StdSelect_ViewerSelector3d.

Handle< SelectBasics_SensitiveEntity > SelectMgr_ViewerSelector::Primitive | ( | const Standard_Integer | Rank | ) | const

const SelectMgr_DataMapOfIntegerSensitive& SelectMgr_ViewerSelector::Primitives | ( |  | ) | const

Standard_Real SelectMgr_ViewerSelector::Sensitivity | ( |  | ) | const

returns the Sensitivity of picking

void SelectMgr_ViewerSelector::SetClipping | ( | const Standard_Real | Xc,
|  | const Standard_Real | Yc,
|  | const Standard_Real | Height,
|  | const Standard_Real | Width
| ) |  |

sets the clipping limits of dynamic picking input value are Real

void SelectMgr_ViewerSelector::SetClipping | ( | const Bnd_Box2d & | aRectangle | ) |

sets the clipping limits of dynamic picking input value are Real

void SelectMgr_ViewerSelector::SetPickClosest | ( | const Standard_Boolean | preferClosest | ) |

Set preference of selecting one object for OnePicked() method:

- If True, objects with less depth (distance fron the view plane) are preferred regardless of priority (priority is used then to choose among objects with similar depth),
- If False, objects with higher priority are preferred regardless of the depth which is used to choose among objects of the same priority.

void SelectMgr_ViewerSelector::SetSensitivity | ( | const Standard_Real | aTol | ) |

changes the Sensitivity of picking Input value is Real.

void SelectMgr_ViewerSelector::SetUpdateSortPossible | ( | const Standard_Boolean | possible | ) |

virtual void SelectMgr_ViewerSelector::SortResult | ( |  | ) |
| virtual

Sorts the detected entites by priority and distance. to be redefined if other criterion are used...

SelectMgr_StateOfSelection SelectMgr_ViewerSelector::Status | ( | const Handle< SelectMgr_Selection > & | aSelection | ) | const

Returns the selection status Status of the selection aSelection.

TCollection_AsciiString SelectMgr_ViewerSelector::Status | ( | const Handle< SelectMgr_SelectableObject > & | aSelectableObject | ) | const

TCollection_AsciiString SelectMgr_ViewerSelector::Status | ( |  | ) | const

gives general information about the Selector

void SelectMgr_ViewerSelector::UpdateConversion | ( |  | ) |

converts all the sensitive entities ;

void SelectMgr_ViewerSelector::UpdateSort | ( |  | ) |

## Field Documentation

Bnd_Box2d SelectMgr_ViewerSelector::myclip
| protected

SelectMgr_DataMapOfIntegerSensitive SelectMgr_ViewerSelector::myentities
| protected

SelectMgr_DataMapOfSelectionActivation SelectMgr_ViewerSelector::myselections
| protected

SelectBasics_SortAlgo SelectMgr_ViewerSelector::myselector
| protected

SelectMgr_IndexedDataMapOfOwnerCriterion SelectMgr_ViewerSelector::mystored
| protected

Standard_Real SelectMgr_ViewerSelector::mytolerance
| protected

Standard_Boolean SelectMgr_ViewerSelector::preferclosest
| protected

Standard_Boolean SelectMgr_ViewerSelector::tosort
| protected

Standard_Boolean SelectMgr_ViewerSelector::toupdate
| protected

The documentation for this class was generated from the following file:

- SelectMgr_ViewerSelector.hxx