const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
//! Setup highlight style settings.
+ //! It is preferred modifying existing style returned by method HighlightStyle()
+ //! instead of creating a new drawer.
+ //!
+ //! If a new highlight style is created, its presentation Zlayer should be checked,
+ //! otherwise highlighting might not work as expected.
+ //! Default values are:
+ //! - Prs3d_TypeOfHighlight_Dynamic: Graphic3d_ZLayerId_Top,
+ //! object highlighting is drawn on top of main scene within Immediate Layers,
+ //! so that V3d_View::RedrawImmediate() will be enough to see update;
+ //! - Prs3d_TypeOfHighlight_LocalDynamic: Graphic3d_ZLayerId_Topmost,
+ //! object parts highlighting is drawn on top of main scene within Immediate Layers
+ //! with depth cleared (even overlapped geometry will be revealed);
+ //! - Prs3d_TypeOfHighlight_Selected: Graphic3d_ZLayerId_UNKNOWN,
+ //! object highlighting is drawn on top of main scene within the same layer
+ //! as object itself (e.g. Graphic3d_ZLayerId_Default by default) and increased priority.
void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
}
//! Setup the style of dynamic highlighting.
+ //! It is preferred modifying existing style returned by method HighlightStyle()
+ //! instead of creating a new drawer.
+ //!
+ //! If a new highlight style is created, its presentation Zlayer should be checked,
+ //! otherwise highlighting might not work as expected.
+ //! Default value is Graphic3d_ZLayerId_Top,
+ //! object highlighting is drawn on top of main scene within Immediate Layers,
+ //! so that V3d_View::RedrawImmediate() will be enough to see update;
void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
//! Returns current selection style settings.
const Standard_Integer theMode,
const Standard_Integer theNewSensitivity);
+ //! Returns last active View (argument of MoveTo()/Select() methods).
+ Standard_EXPORT Handle(V3d_View) LastActiveView() const;
+
//! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
//! This is done by the view theView passing this position to the main viewer and updating it.
//! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
public: //! @name Selection management
//! Sets the graphic basic aspect to the current presentation of ALL selected objects.
+ Standard_DEPRECATED ("Deprecated method - presentation attributes should be assigned directly to object")
Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
const Standard_Boolean theToUpdateViewer);
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer);
+ //! Returns bounding box of selected objects.
+ Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
+
//! Fits the view correspondingly to the bounds of selected objects.
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
+ //! Return value specified whether selected object must be hilighted when mouse cursor is moved above it
+ //! @sa MoveTo()
+ Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
+
//! Specify whether selected object must be hilighted when mouse cursor is moved above it (in MoveTo method).
//! By default this value is false and selected object is not hilighted in this case.
+ //! @sa MoveTo()
void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
- //! Return value specified whether selected object must be hilighted when mouse cursor is moved above it
- Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
+ //! Returns true if the automatic highlight mode is active; TRUE by default.
+ //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
+ Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
+
+ //! Sets the highlighting status of detected and selected entities.
+ //! This function allows you to disconnect the automatic mode.
+ //!
+ //! MoveTo() will fill the list of detected entities
+ //! and Select() will set selected state to detected objects regardless of this flag,
+ //! but with disabled AutomaticHiligh() their highlighting state will be left unaffected,
+ //! so that application will be able performing custom highlighting in a different way, if needed.
+ //!
+ //! This API should be distinguished from SelectMgr_SelectableObject::SetAutoHilight()
+ //! that is used to implement custom highlighting logic for a specific interactive object class.
+ //!
+ //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
+ void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
//! Unhighlights previously selected owners and marks them as not selected.
//! Marks owner given as selected and highlights it.
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Boolean theToUpdateViewer);
+ //! Updates Selected state of specified owner without calling HilightSelected().
+ //! Has no effect if Selected state is not changed, and redirects to AddOrRemoveSelected() otherwise.
+ //! @param theOwner owner object to set selected state
+ //! @param theIsSelected new selected state
+ //! @return TRUE if Selected state has been changed
+ Standard_EXPORT Standard_Boolean SetSelectedState (const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Standard_Boolean theIsSelected);
+
//! Highlights selected objects.
Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
//! returns the number of removed structures from the viewers.
Standard_EXPORT Standard_Integer PurgeDisplay();
+ //! Return rotation gravity point.
+ Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(V3d_View)& theView) const;
+
public: //! @name debug visualization
//! Visualization of sensitives - for debugging purposes!
//! Returns true if drawing isolines on triangulation algorithm is enabled.
Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
-public: //! @name Local Context management (deprecated)
-
- //! Sets the highlighting status of detected and selected entities.
- //! This function allows you to disconnect the automatic mode.
- void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
-
- //! Returns true if the automatic highlight mode is active.
- Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
-
+//! @name obsolete methods
public:
//! Updates the view of the current object in open context.
Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
+ //! Returns selection instance
+ const Handle(AIS_Selection)& Selection() const { return mySelection; }
+
+ //! Sets selection instance to manipulate a container of selected owners
+ //! @param theSelection an instance of the selection
+ void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
+
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
+
protected: //! @name internal methods
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
Standard_EXPORT void InitAttributes();
Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
-
- //! UNKNOWN
- Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer);
-
- //! UNKNOWN
- Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer);
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
- Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
+ Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
//! Helper function that highlights the owner given with <theStyle> without
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
+ //! Helper function that highlights the owners with check
+ //! for AutoHighlight, e.g. is used for selection.
+ Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners);
+
//! Helper function that highlights global owner of the object given with <theStyle> with check
//! for AutoHighlight, e.g. is used for selection.
//! If global owner is null, it simply highlights the whole object
Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
- const Standard_Integer theDispMode) const;
+ const Standard_Integer theDispMode);
//! Helper function that unhighlights all owners that are stored in current AIS_Selection.
//! The function updates global status and selection state of owner and interactive object.
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
+ //! Helper function that unhighlights the owners with check
+ //! for AutoHighlight, e.g. is used for selection.
+ Standard_EXPORT void unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
+ const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
+
//! Helper function that unhighlights global selection owner of given interactive.
//! The function does not perform any updates of global or owner status
- Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
+ Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj);
//! Helper function that turns on sub-intensity in global status and highlights
//! given objects with sub-intensity color
return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
}
+ //! Return TRUE if highlight style of owner requires full viewer redraw.
+ Standard_EXPORT Standard_Boolean isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Handle(V3d_Viewer)& theViewer) const;
+
//! Helper function that returns correct selection style for the object:
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
//! selection style of interactive context will be returned.
//! Removes dynamic highlight draw
void clearDynamicHighlight() const
{
- if (myLastinMain.IsNull())
+ if (myLastPicked.IsNull())
return;
- if (myLastinMain->IsAutoHilight())
+ if (myLastPicked->IsAutoHilight())
{
myMainPM->ClearImmediateDraw();
}
else
{
- myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
+ myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
}
}
+ //! Bind/Unbind status to object and its children
+ //! @param theObj [in] the object to change status
+ //! @param theStatus status, if NULL, unbind object
+ Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
+ const AIS_DisplayStatus theStatus,
+ const Standard_Integer theDispyMode,
+ const Standard_Integer theSelectionMode);
+
protected: //! @name internal fields
AIS_DataMapOfIOStatus myObjects;
Handle(PrsMgr_PresentationManager3d) myMainPM;
Handle(V3d_Viewer) myMainVwr;
Handle(StdSelect_ViewerSelector3d) myMainSel;
+ V3d_View* myLastActiveView;
Handle(SelectMgr_EntityOwner) myLastPicked;
- Handle(SelectMgr_EntityOwner) myLastinMain;
- Standard_Boolean myWasLastMain;
Standard_Boolean myToHilightSelected;
Handle(AIS_Selection) mySelection;
Handle(SelectMgr_OrFilter) myFilters;