#include <NIS_InteractiveContext.hxx>
Public Types | |
enum | SelectionMode { Mode_NoSelection = 0, Mode_Normal, Mode_Additive, Mode_Exclusive } |
Public Member Functions | |
Standard_EXPORT | NIS_InteractiveContext () |
virtual Standard_EXPORT | ~NIS_InteractiveContext () |
const Handle_NIS_InteractiveObject & | GetObject (const Standard_Integer theID) const |
Standard_Integer | NbObjects () |
Standard_Integer | NbDrawers () |
const Handle_NCollection_IncAllocator & | Allocator () const |
Management of Views | |
Standard_EXPORT void | AttachView (const Handle_NIS_View &theView) |
Standard_EXPORT void | DetachView (const Handle_NIS_View &theView) |
Management of Objects | |
Standard_EXPORT void | Display (const Handle_NIS_InteractiveObject &theObj, const Handle_NIS_Drawer &theDrawer=NULL, const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | Erase (const Handle_NIS_InteractiveObject &theObj, const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | Remove (const Handle_NIS_InteractiveObject &theObj, const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | DisplayAll (const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | EraseAll (const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | RemoveAll (const Standard_Boolean isUpdateViews=Standard_True) |
Standard_EXPORT void | UpdateViews () |
Standard_EXPORT void | GetBox (Bnd_B3f &theBox, const NIS_View *theView) const |
Selection API | |
const Handle_NIS_SelectFilter & | GetFilter () const |
void | SetFilter (const Handle_NIS_SelectFilter &theFilter) |
SelectionMode | GetSelectionMode () const |
void | SetSelectionMode (const SelectionMode theMode) |
Standard_EXPORT Standard_Boolean | ProcessSelection (const Handle_NIS_InteractiveObject &O, const Standard_Boolean isMultiple=Standard_False) |
Standard_EXPORT void | ProcessSelection (const TColStd_PackedMapOfInteger &map, const Standard_Boolean isMultiple=Standard_False) |
Standard_EXPORT Standard_Boolean | SetSelected (const Handle_NIS_InteractiveObject &theObj, const Standard_Boolean isSelected=Standard_True) |
Standard_EXPORT void | SetSelected (const TColStd_PackedMapOfInteger &map, const Standard_Boolean isAdded=Standard_False) |
Standard_EXPORT Standard_Boolean | IsSelected (const Handle_NIS_InteractiveObject &theOb) |
Standard_EXPORT void | ClearSelected () |
const TColStd_PackedMapOfInteger & | GetSelected () |
Standard_EXPORT void | SetSelectable (const TColStd_PackedMapOfInteger &IDs, const Standard_Boolean isSelectable) |
Standard_Boolean | IsSelectable (const Standard_Integer objID) const |
Protected Member Functions | |
Standard_EXPORT void | redraw (const Handle_NIS_View &theView, const NIS_Drawer::DrawType theType) |
Standard_EXPORT Standard_Real | selectObject (Handle_NIS_InteractiveObject &theSel, const gp_Ax1 &theAxis, const Standard_Real theOver, const Standard_Boolean isOnlySelectable=Standard_True) const |
Standard_EXPORT Standard_Boolean | selectObjects (TColStd_PackedMapOfInteger &mapObj, const Bnd_B3f &theBox, const gp_Trsf &theTrf, const gp_Trsf &theTrfInv, const Standard_Boolean isFullyIn) const |
Private Attributes | |
NCollection_Vector< Handle_NIS_InteractiveObject > | myObjects |
NCollection_List< Handle_NIS_View > | myViews |
NCollection_Map< Handle_NIS_Drawer > | myDrawers |
TColStd_PackedMapOfInteger | myMapObjects [3] |
TColStd_PackedMapOfInteger | myMapNonSelectableObjects |
Handle_NIS_SelectFilter | mySelectFilter |
SelectionMode | mySelectionMode |
Handle_NCollection_IncAllocator | myAllocator |
The main purpose of class NIS_InteractiveContext is allocation and management of NIS_InteractiveObject instances.
An InteractiveObject should be added to the Context by a call to method Display(). After that (not before) it becomes possible to:
Typical scheme of usage:
const Handle(NIS_InteractiveContext) aContext = new NIS_InteractiveContext; const Handle(NIS_View) aView = new NIS_View(...); aContext->AttachView (aView); .... for (; ;) { const Handle(NIS_InteractiveObject) anObject = new ... aContext->Display (anObject, NULL, Standard_False); ... } aContext->UpdateViews();
Standard_Size aLen = strlen(theName)+1; char * aName = (char *) myContext->Allocator()->Allocate(aLen); memcpy (aName, theName, aLen); myObject->SetAttribute(aName);
|
|
|
Empty constructor. |
|
Destructor. |
|
Query the memory allocator associated with InteractiveContext instance. |
|
Associate this Context with the given View. |
|
Reset all previous selection. |
|
Stop the association of the Context with the given View. |
|
Make the given interactive object visible in the current context. If the object is not yet added to this context, it is added. Therefore this method should follow the creation of an InteractiveObject instance before it can be displayed.
|
|
Make all stored InteractiveObject instances visible, equivalent to calling method Display() for all contained objects.
|
|
Make the given object invisible in the current InteractiveContext.
|
|
Make all stored InteractiveObject instances invisible, equivalent to calling method Erase() for all contained objects.
|
|
Find the bounding box of all Objects displayed (visible) in the given View.
|
|
Query the current selection filter. Use the method SetFilter to install it. By default returns a NULL handle. |
|
Query the InteractiveObject instance by its ID. |
|
Query the set of selected objects.
|
|
Query the current selection mode. |
|
Return True if the object can be selected (processing by SetSelected methods), or False if can not be.
|
|
Query if the given object is selected. |
|
Query the total number of Drawers instances. |
|
Query the total number of InteractiveObject instances. This number can be smaller than the greatest object ID, therefore you should not iterate till this number using GetObject; use class NIS_ObjectsIterator instead. |
|
Process the selection of multiple objects. Equivalent to the other ProcessSelection method, on a set of objects. Particularly, the current selection mode is respected.
|
|
Set or unset the selected state of the object, also changing its hilight status.
|
|
|
|
Remove the given object from its Interactive context.
|
|
Clean the context of its contained objects. Drawers are not destroyed however all presentations should become empty.
|
|
Detect the object selected by the given ray.
|
|
Build a list of objects that are inside or touched by an oriented box.
|
|
Install a selection filter. |
|
Define objects that can be selected by no means (isSelectable = false), or make the objects selectable (isSelectable = true).
|
|
Set the selection. Previously selected objects are deselected if they are not included in the given map.
|
|
Set or unset the selected state of the object, also changing its hilight status.
|
|
Set the selection mode. |
|
This method signal that the presenation should be refreshed in all Drawers and in all Views. |
|
Allocator for arbitrary data associated with objects and drawers. |
|
Container of Drawers. There should be one or more Drawers for each type of contained InteractiveObject. |
|
Objects contained in this map are ignored by SetSelected methods, these objects are not selectable. |
|
Three maps indicating the state of contained objects:
|
|
Container of InteractiveObject instances. |
|
Instance of selection filter used for interactive selections. |
|
Current mode of selection. |
|
List of Views. |