mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0026272: Visualization - provide a possibility to activate selection modes without opening local context
- picked or selected objects are now highlighted via owners instead of interactive objects; - support methods for owners were added to AIS_InteractiveContext; - dynamically highlighted owners are now displayed in immediate mode; - selection without opening of local context is enabled by default; - added "-local" key to vselmode command to enable selection in local context; - selection filters are now completely supported in AIS_InteractiveContext; - the idea of differencing of selected items onto current (in interactive context) and selected (local selection) was eliminated; - all calls to "current" were replaced by calls to "selected" in terms of future local context removal; - AIS_InteractiveObject::mySelectionMode was removed; - now each selectable object can define own selection mode for "global" selection of the whole object; - whole object selection mode is 0 by default for all standard interactive objects; - immediate structures are now added to topmost and top layer lists; - added support of drawing immediate structures in different layers; - unused code for immediate mode was removed; - vfeedback and vexport commands now produce correct output for raytrace mode.
This commit is contained in:
@@ -143,6 +143,10 @@ void AIS_InteractiveContext::Delete() const
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
|
||||
anObj->SetContext (aNullContext);
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
||||
}
|
||||
}
|
||||
MMgt_TShared::Delete();
|
||||
}
|
||||
@@ -1069,7 +1073,44 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_Interactiv
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose : Returns true if the objects global status is set to highlighted.
|
||||
// theIsCustomColor flag defines if highlight color is not equal to OCCT's
|
||||
// default Quantity_NOC_WHITE color. If theIsCustomColor is true,
|
||||
// custom highlight color name will be stored to theCustomColorName
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
Standard_Boolean& theIsCustomColor,
|
||||
Quantity_NameOfColor& theCustomColorName) const
|
||||
{
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||
return Standard_False;
|
||||
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
|
||||
if (!myObjects.IsBound (anObj))
|
||||
return Standard_False;
|
||||
|
||||
const Handle(AIS_GlobalStatus)& anObjStatus = myObjects (anObj);
|
||||
if (anObjStatus->IsHilighted())
|
||||
{
|
||||
if (anObjStatus->HilightColor() != Quantity_NOC_WHITE)
|
||||
{
|
||||
theIsCustomColor = Standard_True;
|
||||
theCustomColorName = anObjStatus->HilightColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
theIsCustomColor = Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDisplayed
|
||||
@@ -1541,6 +1582,12 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
|
||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
{
|
||||
myMainPM->Display (anObj, theMode);
|
||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == anObj)
|
||||
{
|
||||
myMainPM->BeginImmediateDraw();
|
||||
myMainPM->Unhighlight (anObj, myDisplayMode);
|
||||
myMainPM->EndImmediateDraw (myMainVwr);
|
||||
}
|
||||
if (aStatus->IsSubIntensityOn())
|
||||
{
|
||||
myMainPM->Color (anObj, mySubIntensity, theMode);
|
||||
@@ -2074,6 +2121,19 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
|
||||
theIObj->SetWidth (theWidth);
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
||||
{
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
{
|
||||
const Standard_Integer aHiMode =
|
||||
theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
myLastinMain->HilightWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, aHiMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
theIObj->HilightOwnerWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, myLastinMain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2290,7 +2350,6 @@ void AIS_InteractiveContext::Status (const Handle(AIS_InteractiveObject)& theIOb
|
||||
theStatus += TCollection_AsciiString (aDispModeIter.Value());
|
||||
theStatus += "\n";
|
||||
}
|
||||
if (IsCurrent (theIObj)) theStatus +="\t| Current\n";
|
||||
if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
|
||||
|
||||
theStatus += "\t| Active Selection Modes in the MainViewer :\n";
|
||||
@@ -2323,7 +2382,7 @@ void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& t
|
||||
? myDisplayMode
|
||||
: 0);
|
||||
theHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
||||
theSelMode = theIObj->HasSelectionMode() ? theIObj->SelectionMode() : -1;
|
||||
theSelMode = theIObj->GlobalSelectionMode();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2365,7 +2424,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
|
||||
}
|
||||
|
||||
if (IsCurrent (theIObj)
|
||||
if (IsSelected (theIObj)
|
||||
&& !aStatus->IsDModeIn (aDispMode))
|
||||
{
|
||||
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
|
||||
@@ -2375,6 +2434,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
|
||||
}
|
||||
aStatus->ClearSelectionModes();
|
||||
aStatus->SetGraphicStatus (AIS_DS_Erased);
|
||||
|
||||
if (theToUpdateviewer)
|
||||
@@ -2383,6 +2443,31 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : unhighlightOwners
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
aSel->Init();
|
||||
while (aSel->More())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
|
||||
if (anOwner->Selectable() == theObject)
|
||||
{
|
||||
if (anOwner->IsSelected())
|
||||
{
|
||||
AddOrRemoveSelected (anOwner, Standard_False);
|
||||
aSel->Init();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
aSel->Next();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearGlobal
|
||||
//purpose :
|
||||
@@ -2401,27 +2486,11 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
unhighlightOwners (theIObj);
|
||||
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
|
||||
{
|
||||
if (aStatus->IsHilighted())
|
||||
{
|
||||
if (IsCurrent (theIObj))
|
||||
{
|
||||
AddOrRemoveCurrentObject (theIObj, theToUpdateviewer);
|
||||
}
|
||||
else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
|
||||
{
|
||||
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
|
||||
}
|
||||
}
|
||||
myMainPM->Erase (theIObj, aDispModeIter.Value());
|
||||
myMainPM->Clear (theIObj, aDispModeIter.Value());
|
||||
if (theIObj->HasHilightMode())
|
||||
{
|
||||
Standard_Integer im = theIObj->HilightMode();
|
||||
myMainPM->Unhighlight (theIObj, im);
|
||||
myMainPM->Erase (theIObj, im);
|
||||
}
|
||||
}
|
||||
|
||||
// Object removes from Detected sequence
|
||||
@@ -2435,15 +2504,6 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
}
|
||||
|
||||
if (myLastinMain == theIObj)
|
||||
{
|
||||
myLastinMain.Nullify();
|
||||
}
|
||||
if (myLastPicked == theIObj)
|
||||
{
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
|
||||
// remove IO from the selection manager to avoid memory leaks
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
||||
mgrSelector->Remove (anObj);
|
||||
@@ -2455,8 +2515,13 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
|
||||
if (theToUpdateviewer
|
||||
&& aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
||||
myLastinMain.Nullify();
|
||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
|
||||
myLastPicked.Nullify();
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
if (theToUpdateviewer && aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
@@ -2599,25 +2664,6 @@ Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
|
||||
return myDefaultDrawer->IsoOnPlane();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSelectionMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::SetSelectionMode (const Handle(AIS_InteractiveObject)& ,
|
||||
const Standard_Integer )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetSelectionMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObject)& )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPixelTolerance
|
||||
//purpose : Disables the mechanism of adaptive tolerance calculation in
|
||||
|
@@ -94,7 +94,7 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
||||
//! - working on only a few objects,
|
||||
//! - working on a single object.
|
||||
//! 1. When you want ot work on one type of entity, you
|
||||
//! should open a local context with the option
|
||||
//! may open a local context with the option
|
||||
//! UseDisplayedObjects set to false. DisplayedObjects
|
||||
//! allows you to recover the visualized Interactive
|
||||
//! Objects which have a given Type and
|
||||
@@ -124,6 +124,14 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
||||
//! of setting up the different contexts of
|
||||
//! selection/presentation according to the operation
|
||||
//! which you want to perform.
|
||||
|
||||
//! Selection of parts of the objects can also be done without opening a local context.
|
||||
//! Interactive context itself supports decomposed object selection with selection filters
|
||||
//! support. Note that each selectable object must specify the selection mode that is
|
||||
//! responsible for selection of object as a whole (global selection mode). By default, global
|
||||
//! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
|
||||
//! of the objects without using local context provides a possibility to activate part
|
||||
//! selection modes along with global selection mode.
|
||||
class AIS_InteractiveContext : public MMgt_TShared
|
||||
{
|
||||
|
||||
@@ -353,17 +361,7 @@ public:
|
||||
//! Object returns to the default selection mode; the
|
||||
//! object is displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Sets the selection mode of Interactive Objects.
|
||||
//! aMode provides the selection mode index of the entity aniobj.
|
||||
Standard_EXPORT void SetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode);
|
||||
|
||||
|
||||
//! Removes selection mode from Interactive Objects.
|
||||
//! aMode provides the selection mode index of the entity aniobj.
|
||||
Standard_EXPORT void UnsetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj);
|
||||
|
||||
//! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
|
||||
//! sets the given tolerance for ALL sensitive entities activated. For more information, see
|
||||
//! SelectMgr_ViewerSelector documentation
|
||||
@@ -564,7 +562,12 @@ public:
|
||||
//! <WithColor> will be returned TRUE
|
||||
//! <theHiCol> gives the name of the hilightcolor
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anIobj, Standard_Boolean& WithColor, Quantity_NameOfColor& theHiCol) const;
|
||||
|
||||
|
||||
//! if <theOwner> is hilighted with a specific color, than <theIsCustomColor> will be set
|
||||
//! to true and <theCustomColorName> will have the name of the color stored
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
Standard_Boolean& theIsCustomColor,
|
||||
Quantity_NameOfColor& theCustomColorName) const;
|
||||
|
||||
//! Returns the display priority of the entity anIobj. This
|
||||
//! will be display mode of anIobj if it is in the main
|
||||
@@ -894,7 +897,9 @@ public:
|
||||
//! Return value specified whether selected object must be hilighted
|
||||
//! when mouse cursor is moved above it
|
||||
Standard_Boolean ToHilightSelected() const;
|
||||
|
||||
|
||||
|
||||
//! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
|
||||
|
||||
//! Updates the view of the current object in open context.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -907,16 +912,12 @@ public:
|
||||
Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Allows you 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.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
//! Allows to add or remove the object given to the list of current and highlight/unhighlight it
|
||||
//! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
|
||||
//! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
|
||||
//! of the object is empty this method simply does nothing.
|
||||
Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Standard_Boolean theIsToUpdateViewer = Standard_True);
|
||||
|
||||
//! Updates the list of current objects, i.e. hilights new
|
||||
//! current objects, removes hilighting from former current objects.
|
||||
@@ -936,10 +937,9 @@ public:
|
||||
|
||||
|
||||
//! Returns true if there is a non-null interactive object in Neutral Point.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& aniobj) const;
|
||||
//! Objects selected when there is no open local context are called current objects;
|
||||
//! those selected in open local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
|
||||
|
||||
|
||||
//! Initializes a scan of the current selected objects in
|
||||
@@ -973,14 +973,6 @@ public:
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbCurrents();
|
||||
|
||||
|
||||
//! Returns the first current object in the list of current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) FirstCurrentObject();
|
||||
|
||||
|
||||
//! Highlights current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -990,8 +982,7 @@ public:
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void HilightCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Removes highlighting from current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -1002,7 +993,6 @@ public:
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Empties previous current objects in order to get the
|
||||
//! current objects detected by the selector using
|
||||
@@ -1014,118 +1004,97 @@ public:
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void ClearCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
|
||||
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
|
||||
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
|
||||
|
||||
//! @return current mouse-detected interactive object or null object, if there is no
|
||||
//! currently detected interactives
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
|
||||
|
||||
//! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
|
||||
|
||||
//! Unhighlights previously selected owners and marks them as not selected.
|
||||
//! Marks owner given as selected and highlights it.
|
||||
Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Puts the interactive object aniObj in the list of
|
||||
//! selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& aniObj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! puts the selected list in the current objects List.
|
||||
Standard_EXPORT void SetSelectedCurrent();
|
||||
|
||||
//! updates the list of selected objects
|
||||
//! i.e. hilights the new selected
|
||||
//! unhilights old selected objects
|
||||
Standard_EXPORT void UpdateSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! Allows you to add a selected object to the list of
|
||||
//! selected objects or remove it from that list. This entity
|
||||
//! can be an Interactive Object aniobj or its owner
|
||||
//! aShape as can be seen in the two syntaxes above.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Updates the list of selected objects:
|
||||
//! i.e. highlights the newely selected ones and unhighlights previously selected objects.
|
||||
Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Allows to highlight or unhighlight the owner given depending on its selection status
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Highlights selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Removes highlighting from selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnhilightSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Empties previous selected objects in order to get the
|
||||
//! selected objects detected by the selector using
|
||||
//! UpdateSelected.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void ClearSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! No right to Add a selected Shape (Internal Management
|
||||
//! of shape Selection).
|
||||
//! A Previous selected shape may only be removed.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! allows to add/remove in the selected list the entities
|
||||
//! represented by <anOwner> in the selection process.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& anOwner, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Finds the selected object aniobj in local context and
|
||||
//! returns its name.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& aniobj) const;
|
||||
|
||||
//! Allows to highlight or unhighlight the owner given depending on its selection status
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Initializes a scan of the selected objects in local context.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! Returns true is the owner given is selected
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
|
||||
//! Returns true is the object given is selected
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
|
||||
|
||||
//! Returns the first selected object in the list of current selected.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
|
||||
|
||||
//! Initializes a scan of the selected objects.
|
||||
Standard_EXPORT void InitSelected();
|
||||
|
||||
|
||||
//! Returns true if there is another object found by the
|
||||
//! scan of the list of selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean MoreSelected() const;
|
||||
|
||||
|
||||
//! Continues the scan to the next object in the list of
|
||||
//! selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT void NextSelected();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer NbSelected();
|
||||
|
||||
|
||||
//! Returns true if the interactive context has a shape
|
||||
//! selected in it which results from the decomposition of
|
||||
//! another entity in local context.
|
||||
//! another entity.
|
||||
//! If HasSelectedShape returns true, SelectedShape
|
||||
//! returns the shape which has been shown to be
|
||||
//! selected. Interactive returns the Interactive Object
|
||||
@@ -1133,30 +1102,23 @@ public:
|
||||
//! If HasSelectedShape returns false, Interactive
|
||||
//! returns the interactive entity selected by the click of the mouse.
|
||||
Standard_EXPORT Standard_Boolean HasSelectedShape() const;
|
||||
|
||||
|
||||
//! Returns the selected shape in the open local context.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! Returns the selected shape.
|
||||
Standard_EXPORT TopoDS_Shape SelectedShape() const;
|
||||
|
||||
|
||||
//! Returns the owner of the selected entity resulting
|
||||
//! from the decomposition of another entity in local context.
|
||||
//! from the decomposition of another entity.
|
||||
Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
|
||||
|
||||
|
||||
//! Returns a collection containing all entity owners
|
||||
//! created for the interactive object <theIObj> in
|
||||
//! the selection mode theMode (in all active modes
|
||||
//! if the Mode == -1)
|
||||
Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners, const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theMode = -1) const;
|
||||
|
||||
//! Returns the location of the selected Interactive Object.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Interactive() const;
|
||||
|
||||
Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
|
||||
const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Integer theMode = -1) const;
|
||||
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
|
||||
|
||||
|
||||
//! Returns true if the applicative object has an owner
|
||||
//! from Interactive attributed to it.
|
||||
@@ -1222,14 +1184,6 @@ public:
|
||||
//! Gets next current object during iteration through mouse-detected
|
||||
//! interactive objects.
|
||||
Standard_EXPORT void NextDetected();
|
||||
|
||||
|
||||
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
|
||||
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
|
||||
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
|
||||
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
|
||||
|
||||
|
||||
//! Opens local contexts and specifies how this is to be
|
||||
//! done. The options listed above function in the following manner:
|
||||
@@ -1303,7 +1257,7 @@ public:
|
||||
Standard_EXPORT void NotUseDisplayedObjects();
|
||||
|
||||
//! initializes the list of presentations to be displayed
|
||||
//! returns False if No Local COnte
|
||||
//! returns False if no local context is opened.
|
||||
Standard_EXPORT Standard_Boolean BeginImmediateDraw();
|
||||
|
||||
//! returns True if <anIObj> has been stored in the list.
|
||||
@@ -1582,6 +1536,9 @@ public:
|
||||
//! Query objects visible or hidden in specified view due to affinity mask.
|
||||
Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
|
||||
|
||||
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
|
||||
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
|
||||
friend class AIS_LocalContext;
|
||||
|
||||
@@ -1614,6 +1571,24 @@ private:
|
||||
//! UNKNOWN
|
||||
Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||
void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Helper function that highlights the owner given with <theColor> without
|
||||
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
|
||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, highlight will be synchronized
|
||||
//! automatically in all views of the viewer.
|
||||
void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Handle(V3d_Viewer)& theViewer = NULL);
|
||||
|
||||
//! Helper function that highlights the owner given with <theColor> with check
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, selection color will be synchronized
|
||||
//! automatically in all views of the viewer.
|
||||
void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Quantity_NameOfColor theSelColor);
|
||||
|
||||
AIS_DataMapOfIOStatus myObjects;
|
||||
Handle(SelectMgr_SelectionManager) mgrSelector;
|
||||
Handle(PrsMgr_PresentationManager3d) myMainPM;
|
||||
@@ -1621,8 +1596,8 @@ private:
|
||||
Handle(StdSelect_ViewerSelector3d) myMainSel;
|
||||
TCollection_AsciiString mySelectionName;
|
||||
TCollection_AsciiString myCurrentName;
|
||||
Handle(AIS_InteractiveObject) myLastPicked;
|
||||
Handle(AIS_InteractiveObject) myLastinMain;
|
||||
Handle(SelectMgr_EntityOwner) myLastPicked;
|
||||
Handle(SelectMgr_EntityOwner) myLastinMain;
|
||||
Standard_Boolean myWasLastMain;
|
||||
Standard_Boolean myCurrentTouched;
|
||||
Standard_Boolean mySelectedTouched;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -55,10 +55,12 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
|
||||
{
|
||||
|
||||
// the entities eventually detected just before the context was opened are unhighlighted...
|
||||
if(!IsCurrent(myLastPicked)){
|
||||
if(!IsSelected(myLastPicked)){
|
||||
if(!myLastPicked.IsNull()){
|
||||
Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
|
||||
myMainPM->Unhighlight(myLastPicked,HiMod);
|
||||
const Handle(AIS_InteractiveObject) aLastPickedAIS =
|
||||
Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
|
||||
Standard_Integer HiMod = aLastPickedAIS->HasHilightMode()?aLastPickedAIS->HilightMode():0;
|
||||
myMainPM->Unhighlight (aLastPickedAIS, HiMod);
|
||||
}}
|
||||
|
||||
if(!mylastmoveview.IsNull()){
|
||||
@@ -750,7 +752,7 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
{
|
||||
return HasOpenedContext()
|
||||
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView);
|
||||
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -772,7 +774,7 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
|
||||
}
|
||||
|
||||
Handle(V3d_View) aView = myMainVwr->ActiveView();
|
||||
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView);
|
||||
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView->Viewer());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -64,7 +64,6 @@ myRecomputeEveryPrs(Standard_True),
|
||||
myCTXPtr(NULL),
|
||||
mySelPriority(-1),
|
||||
myDisplayMode (-1),
|
||||
mySelectionMode(0),
|
||||
mystate(0)
|
||||
{
|
||||
Handle (AIS_InteractiveContext) Bid;
|
||||
@@ -197,18 +196,6 @@ void AIS_InteractiveObject::SetDisplayMode(const Standard_Integer aMode)
|
||||
if( AcceptDisplayMode(aMode) )
|
||||
myDisplayMode = aMode;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetSelectionMode(const Standard_Integer aMode)
|
||||
{
|
||||
mySelectionMode = aMode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
|
@@ -263,41 +263,7 @@ public:
|
||||
//! This range can, however, be extended through the
|
||||
//! creation of new display modes.
|
||||
Standard_Integer DisplayMode() const;
|
||||
|
||||
//! Allows you to change the selection mode of an
|
||||
//! Interactive Object.
|
||||
//! The default selection mode setting is 0.
|
||||
//! For shapes, for example, the selection modes are as follows:
|
||||
//! - mode 0 - selection of the shape itself
|
||||
//! - mode 1 - selection of vertices
|
||||
//! - mode 2 - selection of edges
|
||||
//! - mode 3 - selection of wires
|
||||
//! - mode 4 - selection of faces
|
||||
//! - mode 5 - selection of shells
|
||||
//! - mode 6 - selection of solids
|
||||
//! - mode 7 - selection of compounds
|
||||
//! For trihedra, on the other hand, the selection modes are the following four:
|
||||
//! - mode 0 - selection of a trihedron
|
||||
//! - mode 1 - selection of its origin
|
||||
//! - mode 2 - selection of its axes
|
||||
//! - mode 3 - selection of its planes
|
||||
Standard_EXPORT Standard_Boolean HasSelectionMode() const;
|
||||
|
||||
//! Returns the selection mode of the interactive object.
|
||||
Standard_EXPORT Standard_Integer SelectionMode() const;
|
||||
|
||||
//! You can change the default selection mode index
|
||||
//! aMode of an Interactive Object.
|
||||
//! This is only of interest if you decide that mode 0
|
||||
//! adopted by convention will not do.
|
||||
Standard_EXPORT void SetSelectionMode (const Standard_Integer aMode);
|
||||
|
||||
//! You can change the default selection mode index of
|
||||
//! an Interactive Object.
|
||||
//! This is only of interest if you decide that the 0 mode
|
||||
//! adopted by convention will not do.
|
||||
void UnsetSelectionMode();
|
||||
|
||||
|
||||
//! Returns the selection priority setting. -1 indicates that there is none.
|
||||
//! You can modify the selection priority of an owner to
|
||||
//! make one entity more selectionable than another one.
|
||||
@@ -498,7 +464,7 @@ protected:
|
||||
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
//! may have a presentation dependant of the view of Display
|
||||
//! may have a presentation dependant of the view of Display.
|
||||
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
|
||||
|
||||
Standard_Real myTransparency;
|
||||
@@ -530,7 +496,6 @@ private:
|
||||
TColStd_ListOfTransient myUsers;
|
||||
Standard_Integer mySelPriority;
|
||||
Standard_Integer myDisplayMode;
|
||||
Standard_Integer mySelectionMode;
|
||||
Standard_Integer mystate;
|
||||
|
||||
|
||||
|
@@ -44,17 +44,6 @@ inline void AIS_InteractiveObject::UnsetDisplayMode()
|
||||
inline Standard_Integer AIS_InteractiveObject::DisplayMode() const
|
||||
{return myDisplayMode;}
|
||||
|
||||
inline Standard_Boolean AIS_InteractiveObject::HasSelectionMode() const
|
||||
{return mySelectionMode!=-1;}
|
||||
|
||||
inline void AIS_InteractiveObject::UnsetSelectionMode()
|
||||
{mySelectionMode =-1;}
|
||||
|
||||
inline Standard_Integer AIS_InteractiveObject::SelectionMode() const
|
||||
{return mySelectionMode;}
|
||||
|
||||
|
||||
|
||||
inline Quantity_NameOfColor AIS_InteractiveObject::Color() const
|
||||
{
|
||||
return myOwnColor.Name();
|
||||
|
@@ -319,10 +319,10 @@ Erase(const Handle(AIS_InteractiveObject)& anInteractive)
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = anInteractive; // to avoid ambiguity
|
||||
if (mySM->Contains (anObj))
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger aModeIter (STAT->SelectionModes());
|
||||
for (; aModeIter.More(); aModeIter.Next())
|
||||
while (!STAT->SelectionModes().IsEmpty())
|
||||
{
|
||||
mySM->Deactivate (anInteractive, aModeIter.Value(), myMainVS);
|
||||
mySM->Deactivate (anInteractive, STAT->SelectionModes().Last(), myMainVS);
|
||||
STAT->RemoveSelectionMode (STAT->SelectionModes().Last());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,13 +637,6 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
||||
AIS_Selection::Select();
|
||||
AIS_Selection::Remove(mySelName.ToCString());
|
||||
|
||||
Handle(V3d_Viewer) aViewer = myCTX->CurrentViewer();
|
||||
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
{
|
||||
Handle(V3d_View) aView = aViewer->ActiveView();
|
||||
aView->View()->ClearImmediate();
|
||||
}
|
||||
|
||||
Handle(V3d_View) aDummyView;
|
||||
myMainVS->ClearSensitive (aDummyView);
|
||||
|
||||
@@ -1122,14 +1115,14 @@ Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObj
|
||||
//function : EndImmediateDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_Viewer)& theViewer)
|
||||
{
|
||||
if (!myMainPM->IsImmediateModeOn())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theViewer);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,7 @@ class SelectMgr_Filter;
|
||||
class TCollection_AsciiString;
|
||||
class AIS_InteractiveObject;
|
||||
class V3d_View;
|
||||
class V3d_Viewer;
|
||||
class TopoDS_Shape;
|
||||
class SelectMgr_EntityOwner;
|
||||
class Standard_Transient;
|
||||
@@ -329,7 +330,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
|
||||
|
||||
//! Allows rapid drawing of the view theView by avoiding an update of the whole background.
|
||||
Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
|
||||
Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
//! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
|
||||
Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
|
||||
|
@@ -482,7 +482,7 @@ void AIS_LocalContext::Hilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
||||
myMainPM->BeginImmediateDraw();
|
||||
theOwner->HilightWithColor (myMainPM, myCTX->HilightColor(), aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theView->Viewer());
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -1397,7 +1397,7 @@ Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)
|
||||
: 0;
|
||||
|
||||
myMapOfOwner->FindKey (mylastindex)->Unhilight (myMainPM, aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theView->Viewer());
|
||||
mylastindex = 0;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -391,3 +391,12 @@ void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalSelOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_EntityOwner) AIS_MultipleConnectedInteractive::GlobalSelOwner() const
|
||||
{
|
||||
return myAssemblyOwner;
|
||||
}
|
||||
|
@@ -96,7 +96,8 @@ public:
|
||||
//! may be decomposed into sub-shapes for dynamic selection.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_MultipleConnectedInteractive,AIS_InteractiveObject)
|
||||
|
Reference in New Issue
Block a user