1
0
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:
vpa
2015-07-31 14:38:19 +03:00
parent a7cb665a6a
commit c3282ec170
48 changed files with 1397 additions and 1190 deletions

View File

@@ -90,7 +90,11 @@ void SelectMgr_EntityOwner::HilightWithColor(const Handle(PrsMgr_PresentationMan
{
if( HasSelectable() ) {
if( IsAutoHilight() )
PM->Color(mySelectable,aColor,aMode);
{
const Graphic3d_ZLayerId aLayerId = mySelectable->GlobalSelOwner().get() == this ?
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
PM->Color(mySelectable,aColor,aMode, NULL, aLayerId);
}
else
mySelectable->HilightOwnerWithColor( PM, aColor, this );
}

View File

@@ -55,12 +55,13 @@ static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq,
// Purpose :
//==================================================
SelectMgr_SelectableObject::SelectMgr_SelectableObject( const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
PrsMgr_PresentableObject (aTypeOfPresentation3d),
SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
: PrsMgr_PresentableObject (aTypeOfPresentation3d),
myDrawer (new Prs3d_Drawer()),
myHilightDrawer (new Prs3d_Drawer()),
myAssemblyOwner (NULL),
myAutoHilight (Standard_True)
myAutoHilight (Standard_True),
myGlobalSelMode (0)
{
InitDefaultHilightAttributes (myHilightDrawer);
myHilightDrawer->Link (myDrawer);
@@ -634,3 +635,25 @@ Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (Handle(SelectMgr_IndexedMa
return aBnd;
}
//=======================================================================
//function : GlobalSelOwner
//purpose : Returns entity owner corresponding to selection of the object as a whole
//=======================================================================
Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const
{
Handle(SelectMgr_EntityOwner) anOwner;
if (!HasSelection (myGlobalSelMode))
return anOwner;
const Handle(SelectMgr_Selection)& aGlobalSel = Selection (myGlobalSelMode);
if (aGlobalSel->IsEmpty())
return anOwner;
aGlobalSel->Init();
anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Sensitive()->BaseSensitive()->OwnerId());
return anOwner;
}

View File

@@ -189,6 +189,12 @@ public:
//! if they are a part of activated selection
Standard_EXPORT Bnd_Box BndBoxOfSelected (Handle(SelectMgr_IndexedMapOfOwner)& theOwners);
//! Returns the mode for selection of object as a whole
inline Standard_Integer GlobalSelectionMode() const;
//! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const;
friend class SelectMgr_SelectionManager;
@@ -200,6 +206,8 @@ protected:
Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
inline void setGlobalSelMode (const Standard_Integer theMode);
SelectMgr_SequenceOfSelection myselections;
Handle(Prs3d_Drawer) myDrawer;
Handle(Prs3d_Drawer) myHilightDrawer;
@@ -213,6 +221,7 @@ private:
Standard_Boolean myAutoHilight;
Handle(Prs3d_Presentation) mySelectionPrs;
Handle(Prs3d_Presentation) myHilightPrs;
Standard_Integer myGlobalSelMode;
};

View File

@@ -32,3 +32,21 @@ Attributes() const
inline const Handle(Prs3d_Drawer)& SelectMgr_SelectableObject::
HilightAttributes() const
{return myHilightDrawer;}
//=======================================================================
//function : GlobalSelectionMode
//purpose :
//=======================================================================
inline Standard_Integer SelectMgr_SelectableObject::GlobalSelectionMode() const
{
return myGlobalSelMode;
}
//=======================================================================
//function : setGlobalSelMode
//purpose :
//=======================================================================
inline void SelectMgr_SelectableObject::setGlobalSelMode (const Standard_Integer theMode)
{
myGlobalSelMode = theMode > 0 ? theMode : 0;
}