Open CASCADE Technology  6.5.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Attributes
AIS2D_InteractiveContext Class Reference

The InteractiveContext class allows you to manage
graphic behavior and selection of Interactive Objects
in one or more viewers.

#include <AIS2D_InteractiveContext.hxx>

Inheritance diagram for AIS2D_InteractiveContext:
Inheritance graph
[legend]

Public Member Functions

 AIS2D_InteractiveContext (const Handle< V2d_Viewer > &MainViewer)
 Initiates <MainViewer>

 AIS2D_InteractiveContext (const Handle< V2d_Viewer > &MainViewer, const Handle< V2d_Viewer > &aCollector)
 Initiates the principal viewer and Collector(trash) viewer together

void Display (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Display when no local context is opened.
if <anIObj> has no proper display mode, the defaut
display mode of the session is used
Same for the selection Mode (by default =0)

void Display (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Integer aDispMode, const Standard_Integer aSelectMode, const Standard_Boolean UpdateVwr=Standard_True, const Standard_Boolean AllowDecomp=Standard_True)
 Use only if a local context is opened. Displays the
<aDispMode> the presentation of interactive object,
activates the selection mode <aSelectMode> if
<UpdateVwr> = Standard_False, the object is
displayed but no viewer will be updated; CONVENTION :
<aSelectMode> = -1 means no activation for <anIObj>
: it will be displayed but not selectable. (Option
only available for local context...)
<AllowDecomp> = true means that <anIObj> is
able to have subshapes detected by selection mechanisms.
2 conditions: <anIObj> must be able to give a shape
selection modes fit the AIS2D_Shape
selection modes ( 1->vertex, 2->edges, 3->wires...)

void Load (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Integer SelMode=-1, const Standard_Boolean AllowDecomp=Standard_False)
 Available when opened local contexts only;
option to load in the selector objects which will
be selectable but not displayed. Nevertheless, they
will be hilighted when detected by the selector.
ex : be able to select center of a line without
displaying all centers before selection process

void Erase (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True, const Standard_Boolean PutInCollector=Standard_True)
 Erases presentations in current local context,
or failing that, in other local contexts which allow erasing.
If <PutInCollector> is false, the object is erased but
not put in the Collector.

void EraseAll (const Standard_Boolean PutInCollector=Standard_True, const Standard_Boolean updateVwr=Standard_True)
 Every erased object goes into the Collector viewer

void DisplayAll (const Standard_Boolean OnlyFromCollector=Standard_True, const Standard_Boolean updateVwr=Standard_True)
 Displays all erased objects, in other words,
all objects in the Collector viewer.

void EraseSelected (const Standard_Boolean PutInCollector=Standard_True, const Standard_Boolean updateVwr=Standard_True)
 Erases selected objects if a local context is open.
Erases current objects if there is no active local context.
If a local context is open and if <updateVwr> equals
Standard_False, the presentation of the Interactive Object
activates the selection mode; the object is displayed but
no viewer will be updated.

void DisplaySelected (const Standard_Boolean updateVwr=Standard_True)
 Displays or erases selected objects if a local
context is open. If no active local context is found,
only current objects can be displayed or erased.

Standard_Boolean KeepTemporary (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Integer InWhichLocal=-1)
 Changes the status of a temporary object it will be --
kept at the neutral point, i.e. put in the list of
displayed objects, with its temporary attributes
(displaymode,selection mode) returns true if done --
inWhichLocal means that gives the local context in
which <anIObj> is displayed. By default, -1 means the
last opened one

void Redisplay (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean updateVwr=Standard_True, const Standard_Boolean allModes=Standard_False)
 Forces Recompute of the seen presentations of the object;
if <allModes>= True -> recomputes all the
presentations .

Standard_Boolean IsCurrent (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Finds the current selected entity <anIObj> in Neutral Point.

Standard_Boolean IsSelected (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Confirms selection. Returns true if <anIObj> is selected in the interactive context

void Highlight (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean updateVwr=Standard_True)
 Updates the display in the viewer to take dynamic detection
into account.
If a local context is open and if <updateVwr> equals Standard_False,
the presentation of the Interactive Object activates the selection
mode; the object is displayed but no viewer will be updated.

void HighlightWithColor (const Handle< AIS2D_InteractiveObject > &anIObj, const Quantity_NameOfColor aCol, const Standard_Boolean updateVwr=Standard_True)
 Changes the color of the object in view <anIObj>.
It paints this object the color passed as the argument <aCol>
If a local context is open and if <updateVwr> equals Standard_False,
the presentation of the Interactive Object activates the selection
mode; the object is displayed but no viewer will be updated.

void Unhighlight (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean updateVwr=Standard_True)
 Removes hilighting from the entity <anIObj>. Updates the viewer.
If a local context is open and if <updateVwr> equals Standard_False,
the presentation of the Interactive Object activates the selection
mode; the object is displayed but no viewer will be updated.

void SetPrecision (const Standard_Integer aPrec)
 Sets the precision of detection

Standard_Integer DetectPrecision () const
 Returns the precision of detection

void Place (const Standard_Integer XPix, const Standard_Integer YPix, const Handle< V2d_View > &aView, const Handle< AIS2D_InteractiveObject > &anIO, const Standard_Boolean isTemporary=Standard_False)
 Places object <anIO> to the pixel position (XPix, YPix)
in the view <aView> is using TransientManager.
It's possible to use without preliminary application of Display method.

void Drag (const Standard_Integer XPix, const Standard_Integer YPix, const Handle< V2d_View > &aView, const Standard_Boolean isTemporary=Standard_True)
 Places selected objects to the pixel position (XPix, YPix)
in the view <aView>. If <isTemporary> is True, is used TransientManager.

AIS2D_StatusOfDetection MoveTo (const Standard_Integer XPix, const Standard_Integer YPix, const Handle< V2d_View > &aView)
 Relays mouse position in pixels XPix and YPix to the
interactive context selectors. This is done by the view <aView>
passing this position to the main viewer and updating it.
Functions in both Neutral Point and local contexts.

AIS2D_StatusOfDetection MoveCircleTo (const Standard_Integer XPix, const Standard_Integer YPix, const Standard_Integer Radius, const Handle< V2d_View > &aView)
 Relays mouse position in circle <XPix, YPix> and <Radius> to the
interactive context selectors. This is done by the view <aView>
passing this position to the main viewer and updating it.
Functions in both Neutral Point and local contexts.

AIS2D_StatusOfDetection MoveTo (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax, const Handle< V2d_View > &aView)
 Relays mouse position in rectangle Xmin, Ymin, Xmax, Ymax to the
interactive context selectors. This is done by the view <aView>
passing this position to the main viewer and updating it.
Functions in both Neutral Point and local contexts.

AIS2D_StatusOfPick Select (const Standard_Boolean UpdateVwr=Standard_True)
 Stores and hilights the previous detected; Unhilights
the previous picked.

AIS2D_StatusOfPick ShiftSelect (const Standard_Boolean UpdateVwr=Standard_True)
 adds the last detected to the list of previous picked.
if the last detected was already declared as picked,
removes it from the Picked List.

AIS2D_StatusOfPick ShiftSelect (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle< V2d_View > &aView, const Standard_Boolean UpdateVwr=Standard_True)
 rectangle of selection ; adds new detected entities into the
picked list, removes the detected entities that were already stored...

void SetHighlightColor (const Quantity_NameOfColor aCol)
 Allows to set the color used to show highlighted entities,
that is, entities picked out by the mouse.

void SetSelectionColor (const Quantity_NameOfColor aCol)
 Sets the color used to show selected entities

void SetSubIntensityColor (const Quantity_NameOfColor aCol)
 Allows you to set the color used to show that an object
is not currently selected

Standard_Integer DisplayMode () const
 Returns the display mode setting

Quantity_NameOfColor HighlightColor () const
 Returns the name of the color used to show highlighted entities,
that is, entities picked out by the mouse

Quantity_NameOfColor SelectionColor () const
 Returns the name of the color used to show selected entities.

Quantity_NameOfColor SubIntensityColor () const
 Returns the name of the color used to show
that an object is not currently selected.

void SubIntensityOn (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Highlights, and removes highlights from, the displayed object
<anIObj> which is displayed at Neutral Point with subintensity
color; available only for active local context.
There is no effect if there is no local context.

void SubIntensityOff (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Removes the subintensity option for the entity <anIObj>.

Standard_Boolean IsCollectorClosed () const
void CloseCollector ()
 Allows to close Collector

void OpenCollector ()
 Allows to open Collector

Standard_Integer OpenLocalContext (const Standard_Boolean UseDispObj=Standard_True, const Standard_Boolean AllowDecomposit=Standard_True, const Standard_Boolean AcceptEraseOfObj=Standard_False)
 Opens a local context of display and selection
returns the index of new opened local context.
Must be stored and used to close the local context.

void CloseLocalContext (const Standard_Integer ind=-1, const Standard_Boolean updateVwr=Standard_True)
 close the current opened local context.
Use <ind> to be sure to close the local context you Opened !
if <ind> == -1 the current local context is closed
WITHOUT VERIFICATION.
if <ind> is greater than the current opened local context,
nothing is done.

Standard_Integer IndexOfCurrentLocal () const
 returns -1 if no opened local context.

void CloseAllContext (const Standard_Boolean updateVwr=Standard_True)
 Allows to close all local contexts at one go and return to
Neutral Point.

void SetCurrentObject (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Updates the view of the current object in open context.
Objects selected when there is no open local context
are called current objects; those selected in open local context,
selected objects.

void AddOrRemoveCurObject (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Allows to add a current object to the list of current objects
or remove it from that list.
Objects selected when there is no open local context are called
current objects; those selected in open local context,
selected objects.

void UpdateCurrent ()
 updates the list of current objects
i.e. hilights new current objects,
unhighlights old current objects


void SetOkCurrent ()
 Returns the first current object in the list of current objects.

void HighlightCurrent (const Standard_Boolean UpdateVwr=Standard_True)
 Highlights current objects.

void UnhighlightCurrent (const Standard_Boolean UpdateVwr=Standard_True)
 Unhighlights current objects.

void ClearCurrent (const Standard_Boolean UpdateVwr=Standard_True)
 Empties previous current objects in order to get the current
objects detected by the selector using UpdateCurrent.

void SetSelected (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Puts the selected <anIObj> in the current objects list.

void SetSelectedCurrent ()
 Puts the selected list in the current objects list.

void UpdateSelected (const Standard_Boolean UpdateVwr=Standard_True)
 Updates the list of selected objects, i.e. hilights
new selected objects, removes hilighting from former
selected objects.

void AddOrRemoveSelected (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Boolean UpdateVwr=Standard_True)
 Allows you to add a selected object <anIObj> to the list of selected
objects or remove it from that list.

void HighlightSelected (const Standard_Boolean UpdateVwr=Standard_True)
 Highlights selected objects.

void UnhighlightSelected (const Standard_Boolean UpdateVwr=Standard_True)
 UnHighlights selected objects.

void ClearSelected (const Standard_Boolean UpdateVwr=Standard_True)
 Empties previous selected objects in order to get
the selected objects detected by the selector using UpdateSelected.

Standard_Integer NbSelected () const
 Returns number of objects selected in
local context ( if opened ) or in neutral context

void InitSelected ()
 Iteration

Standard_Boolean MoreSelected () const
 Iteration

void NextSelected ()
 Iteration

Handle_MMgt_TShared SelectedObject () const
 Returns current selected object ( see InitSelected() .. )
The object type depends on highlight mode
( OBJECT, PRIMITIVE etc )

AIS2D_DisplayStatus DisplayStatus (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Returns the display status of the entity <anIObj>.

AIS2D_PToListOfInt DisplayedModes (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Returns the list of active display modes for the entity <anIObj>

Standard_Boolean IsDisplayed (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Returns true if <anIObj> is displayed in the interactive context

Standard_Boolean IsDisplayed (const Handle< AIS2D_InteractiveObject > &anIObj, const Standard_Integer aMode) const
 Returns true if <anIObj> is displayed in the interactive context with <aMode> display mode

Standard_Boolean IsHighlighted (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Returns true if the Interactive Object <anIObj>
is highlighted in the interactive context.

Standard_Boolean IsHighlighted (const Handle< AIS2D_InteractiveObject > &anIObj, Standard_Boolean &WithColor, Quantity_NameOfColor &theHiCol) const
 if <anIObj> is highlighted with a specific color
<WithColor> will be returned TRUE
<theHiCol> gives the name of the hilightcolor

Standard_Boolean IsInCollector (const Handle< AIS2D_InteractiveObject > &anIObj) const
 Returns true if the entity <anIObj> is in the Collector viewer.

void Status (const Handle< AIS2D_InteractiveObject > &anIObj, TCollection_ExtendedString &aStatus) const
 Modified the status of the entity <anIObj>

void UpdateCurrentViewer ()
 Updates the current viewer, the viewer in Neutral Point.

void UpdateCollector ()
 Updates the Collector viewer

Handle_V2d_Viewer CurrentViewer () const
 Returns the current viewer.

Standard_Boolean HasOpenedContext () const
 Returns true if there is an open context.

void DisplayedObjects (AIS2D_ListOfIO &aListOfIO, const Standard_Boolean OnlyFromNeutral=Standard_False) const
 gives the list of displayed objects in the main viewer.

void SetPickMode (const Graphic2d_PickMode aMode)
 Allows to provide settings for pick mode.

Graphic2d_PickMode GetPickMode () const
 Returns the pick mode

Standard_Integer HighestIndex () const
Standard_Integer InitializeColor (const Quantity_Color &aColor)
 Initialize <aColor> in the color map

Standard_Integer InitializeStyle (const Aspect_TypeOfLine aType)
 Initialize <aType> in the type map

Standard_Integer InitializeWidth (const Aspect_WidthOfLine aWidth)
 Initialize <aWidth> in the width map

Standard_Integer InitializeMarker (const Aspect_TypeOfMarker aMark)
 Initialize <aMark> in the mark map

Standard_Integer InitializeFont (const Aspect_FontStyle &aFont)
 Initialize <aFont> in the font map

void ResetOriginalState (const Standard_Boolean updateVwr=Standard_True)
 to be used only with no opened
local context.. displays and activates objects in their
original state before local contexts were opened...

void BeginImmediateDraw (const Handle< V2d_View > &aView)
 switches on immediate mode

void ImmediateDraw (const Handle< AIS2D_InteractiveObject > &anIObj, const Handle< V2d_View > &aView)
 draws object <anIObj> into immediate mode

void EndImmediateDraw (const Handle< V2d_View > &aView)
 switches of immediate mode

Standard_Boolean IsImmediateModeOn (const Handle< V2d_View > &aView) const
 returns true if immediate mode is on

void SetDetectionMode (const AIS2D_TypeOfDetection mode)

Protected Attributes

Handle_Aspect_GenericColorMap myColorMap
Handle_Aspect_TypeMap myTypeMap
Handle_Aspect_WidthMap myWidthMap
Handle_Aspect_MarkMap myMarkMap
Handle_Aspect_FontMap myFontMap

Constructor & Destructor Documentation


Member Function Documentation

Handle_V2d_Viewer AIS2D_InteractiveContext::CurrentViewer ( ) const
Handle_MMgt_TShared AIS2D_InteractiveContext::SelectedObject ( ) const

Field Documentation

Handle_Aspect_GenericColorMap AIS2D_InteractiveContext::myColorMap [protected]
Handle_Aspect_FontMap AIS2D_InteractiveContext::myFontMap [protected]
Handle_Aspect_MarkMap AIS2D_InteractiveContext::myMarkMap [protected]
Handle_Aspect_TypeMap AIS2D_InteractiveContext::myTypeMap [protected]
Handle_Aspect_WidthMap AIS2D_InteractiveContext::myWidthMap [protected]

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