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:
@@ -324,40 +324,108 @@ void PrsMgr_PresentationManager::BeginImmediateDraw()
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::ClearImmediateDraw()
|
||||
{
|
||||
if (myImmediateView.IsNull())
|
||||
{
|
||||
myImmediateList.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next())
|
||||
{
|
||||
myImmediateView->View()->EraseImmediate (anIter.Value());
|
||||
anIter.Value()->Erase();
|
||||
}
|
||||
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (myViewDependentImmediateList); anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value()->Erase();
|
||||
}
|
||||
|
||||
myImmediateList.Clear();
|
||||
myImmediateView.Nullify();
|
||||
myViewDependentImmediateList.Clear();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : displayImmediate
|
||||
// purpose : Handles the structures from myImmediateList and its visibility
|
||||
// in all views of the viewer given by setting proper affinity
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& theViewer)
|
||||
{
|
||||
for (theViewer->InitActiveViews(); theViewer->MoreActiveViews(); theViewer->NextActiveViews())
|
||||
{
|
||||
const Handle(Visual3d_View)& aView = theViewer->ActiveView()->View();
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Prs3d_Presentation)& aPrs = anIter.Value();
|
||||
if (aPrs.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(Prs3d_Presentation) aViewDepPrs;
|
||||
Handle(Prs3d_PresentationShadow) aShadowPrs = Handle(Prs3d_PresentationShadow)::DownCast (aPrs);
|
||||
if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs))
|
||||
{
|
||||
aShadowPrs.Nullify();
|
||||
aShadowPrs = new Prs3d_PresentationShadow (myStructureManager, aViewDepPrs);
|
||||
aShadowPrs->SetZLayer (aViewDepPrs->CStructure()->ZLayer());
|
||||
aShadowPrs->SetClipPlanes (aViewDepPrs->GetClipPlanes());
|
||||
aShadowPrs->CStructure()->IsForHighlight = 1;
|
||||
aShadowPrs->Highlight (Aspect_TOHM_COLOR, aPrs->HighlightColor());
|
||||
myViewDependentImmediateList.Append (aShadowPrs);
|
||||
}
|
||||
// handles custom highlight presentations which were defined in overriden
|
||||
// HilightOwnerWithColor method of a custom AIS objects and maintain its
|
||||
// visibility in different views on their own
|
||||
else if (aShadowPrs.IsNull())
|
||||
{
|
||||
aPrs->Display();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aShadowPrs->IsDisplayed())
|
||||
{
|
||||
aShadowPrs->CStructure()->ViewAffinity = new Graphic3d_ViewAffinity();
|
||||
aShadowPrs->CStructure()->ViewAffinity->SetVisible (Standard_False);
|
||||
aShadowPrs->Display();
|
||||
}
|
||||
|
||||
Standard_Integer aViewId = aView->Identification();
|
||||
bool isParentVisible = aShadowPrs->ParentAffinity().IsNull() ?
|
||||
Standard_True : aShadowPrs->ParentAffinity()->IsVisible (aViewId);
|
||||
aShadowPrs->CStructure()->ViewAffinity->SetVisible (aViewId, isParentVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : EndImmediateDraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
void PrsMgr_PresentationManager::EndImmediateDraw (const Handle(V3d_Viewer)& theViewer)
|
||||
{
|
||||
if (--myImmediateModeOn > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
displayImmediate (theViewer);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RedrawImmediate
|
||||
// purpose : Clears all immediate structures and redisplays with proper
|
||||
// affinity
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentationManager::RedrawImmediate (const Handle(V3d_Viewer)& theViewer)
|
||||
{
|
||||
if (myImmediateList.IsEmpty())
|
||||
return;
|
||||
|
||||
// Clear previously displayed structures
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next())
|
||||
{
|
||||
theView->View()->DisplayImmediate (anIter.Value(), Standard_True);
|
||||
anIter.Value()->Erase();
|
||||
}
|
||||
if (!myImmediateList.IsEmpty())
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (myViewDependentImmediateList); anIter.More(); anIter.Next())
|
||||
{
|
||||
myImmediateView = theView;
|
||||
anIter.Value()->Erase();
|
||||
}
|
||||
myViewDependentImmediateList.Clear();
|
||||
|
||||
displayImmediate (theViewer);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -526,11 +594,12 @@ void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObjec
|
||||
void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Standard_Integer theMode,
|
||||
const Handle(PrsMgr_PresentableObject)& theSelObj)
|
||||
const Handle(PrsMgr_PresentableObject)& theSelObj,
|
||||
const Standard_Integer theImmediateStructLayerId)
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Color (anIter.Value(), theColor, theMode);
|
||||
Color (anIter.Value(), theColor, theMode, NULL, theImmediateStructLayerId);
|
||||
}
|
||||
if (!thePrsObj->HasOwnPresentations())
|
||||
{
|
||||
@@ -546,6 +615,9 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
||||
if (myImmediateModeOn > 0)
|
||||
{
|
||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
||||
aShadow->SetZLayer (theImmediateStructLayerId);
|
||||
aShadow->SetClipPlanes (aPrs->Presentation()->GetClipPlanes());
|
||||
aShadow->CStructure()->IsForHighlight = 1;
|
||||
aShadow->Highlight (Aspect_TOHM_COLOR, theColor);
|
||||
AddToImmediateList (aShadow);
|
||||
}
|
||||
|
@@ -27,8 +27,9 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
class Visual3d_ViewManager;
|
||||
class V3d_View;
|
||||
class V3d_Viewer;
|
||||
class Standard_NoSuchObject;
|
||||
class PrsMgr_PresentableObject;
|
||||
class Prs3d_Presentation;
|
||||
@@ -116,18 +117,25 @@ public:
|
||||
//! Stores thePrs in the transient list of presentations to be displayed in immediate mode.
|
||||
//! Will be taken in account in EndImmediateDraw method.
|
||||
Standard_EXPORT void AddToImmediateList (const Handle(Prs3d_Presentation)& thePrs);
|
||||
|
||||
//! Allows rapid drawing of the view theView by avoiding an update of the whole background.
|
||||
Standard_EXPORT void EndImmediateDraw (const Handle(V3d_View)& theView);
|
||||
|
||||
|
||||
//! Allows rapid drawing of the each view in theViewer by avoiding an update of the whole background.
|
||||
Standard_EXPORT void EndImmediateDraw (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
//! Clears and redisplays immediate structures of the viewer taking into account its affinity.
|
||||
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
//! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
|
||||
Standard_Boolean IsImmediateModeOn() const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
|
||||
|
||||
//! Highlights the graphic object thePrsObject in the color theColor.
|
||||
//! thePrsObject has the display mode theMode;
|
||||
//! this has the default value of 0, that is, the wireframe display mode.
|
||||
Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Quantity_NameOfColor theColor = Quantity_NOC_YELLOW, const Standard_Integer theMode = 0, const Handle(PrsMgr_PresentableObject)& theSelObj = NULL);
|
||||
|
||||
Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
||||
const Quantity_NameOfColor theColor = Quantity_NOC_YELLOW,
|
||||
const Standard_Integer theMode = 0,
|
||||
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL,
|
||||
const Graphic3d_ZLayerId theImmediateStructLayerId = Graphic3d_ZLayerId_Topmost);
|
||||
|
||||
//! highlights the boundbox of the presentation
|
||||
Standard_EXPORT void BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
|
||||
|
||||
@@ -170,15 +178,15 @@ protected:
|
||||
Handle(Visual3d_ViewManager) myStructureManager;
|
||||
Standard_Integer myImmediateModeOn;
|
||||
PrsMgr_ListOfPresentations myImmediateList;
|
||||
Handle(V3d_View) myImmediateView;
|
||||
PrsMgr_ListOfPresentations myViewDependentImmediateList;
|
||||
Quantity_Color mySelectionColor;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
//! Handles the structures from <myImmediateList> and displays it separating view-dependent structures and taking into account
|
||||
//! structure visibility by setting proper affinity.
|
||||
void displayImmediate (const Handle(V3d_Viewer)& theViewer);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user