1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024394: Visualization - implement more general way for rendering of immediate objects

Move OpenGl_Structure::myZLayer to base class Graphic3d_CStructure.
Graphic3d_ZLayerId - introduce new pre-defined ZLayers.
Do not clear Depth buffer twice for default ZLayer.

AIS_InteractiveContext::Display() - add new argument AIS_DisplayStatus to specify displaying status.

Drop unused Graphic3d_CPick and related methods.
Drop OpenGl_Structure::myNamedStatus - use flags from parent class Graphic3d_CStructure directly.
OpenGl_LayerList ::ChangeLayer(), ::ChangePriority - fix structure remove from unexpected layer.
Merge class OpenGl_PriorityList into OpenGl_Layer.

PrsMgr_PresentationManager::mySelectionColor - store selection color as field of Presentation Manager.
PrsMgr_Presentation class - do not declare private methods as virtual.
PrsMgr_Presentation::Highlight() - extend method syntax and drop methods ::Color() and ::BoundBox().

PrsMgr_PresentableObject - store ZLayer in presentable object
to display object presentations in required layer directly
(without displaying it in wrong layer first).

test/mesh/end - force re-displaying the shape to compute mesh anew

Test-case for issue
This commit is contained in:
kgv
2015-01-22 17:29:37 +03:00
committed by bugmaster
parent 92e24f9d36
commit a195430212
72 changed files with 1590 additions and 1958 deletions

View File

@@ -172,30 +172,31 @@ is
-- local context without selection, use the syntax below,
-- setting aSelectionMode to -1.
Display(me : mutable;
anIobj : InteractiveObject from AIS;
amode : Integer from Standard ;
aSelectionMode : Integer from Standard ;
updateviewer : Boolean from Standard = Standard_True;
allowdecomposition : Boolean from Standard = Standard_True);
Display (me : mutable;
theIObj : InteractiveObject from AIS;
theDispMode : Integer from Standard;
theSelectionMode : Integer from Standard;
theToUpdateViewer : Boolean from Standard = Standard_True;
theToAllowDecomposition : Boolean from Standard = Standard_True;
theDispStatus : DisplayStatus from AIS = AIS_DS_None);
---Purpose: Controls the choice between the using the display
-- and selection modes of open local context which you
-- have defined and activating those available by default.
-- If no Local Context is opened. and the Interactive
-- Object aniobj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if aniobj
-- Object theIObj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if theIObj
-- has no selection mode of its own, the default one, 0, is used.
-- If a local context is open and if updateviewer equals
-- If a local context is open and if theToUpdateViewer equals
-- Standard_False, the presentation of the Interactive
-- Object activates the selection mode; the object is
-- displayed but no viewer will be updated.
-- If aSelectionMode equals -1, anIobj will not be
-- If theSelectionMode equals -1, theIObj will not be
-- activated: it will be displayed but will not be selectable.
-- Use this if you want to view the object in open local
-- context without selection. Note: This option is only
-- available in Local Context.
-- If allowDecomposition equals true, anIObj can have
-- subshapes detected by selection mechanisms. anIObj
-- If theToAllowDecomposition equals true, theIObj can have
-- subshapes detected by selection mechanisms. theIObj
-- must be able to give a shape selection modes which
-- fit the AIS_Shape selection modes:
-- - vertices: 1
@@ -345,22 +346,14 @@ is
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
---Purpose: Set Z layer id for interactive object.
-- The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
-- The ids for Z layers are generated by V3d_Viewer.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
Redisplay(me : mutable;
aniobj : InteractiveObject from AIS;

View File

@@ -33,6 +33,7 @@
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <Visual3d_ViewManager.hxx>
#include <Visual3d_View.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <AIS_Shape.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
@@ -270,8 +271,12 @@ void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive
{
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() != theStatus
|| anObjIter.Key()->Type() != theKind)
if (theStatus != AIS_DS_None
&& anObjIter.Value()->GraphicStatus() != theStatus)
{
continue;
}
else if (anObjIter.Key()->Type() != theKind)
{
continue;
}
@@ -344,27 +349,44 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition)
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
{
if (theIObj.IsNull())
{
return;
}
if (theDispStatus == AIS_DS_Erased)
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
return;
}
if (!theIObj->HasInteractiveContext())
{
theIObj->SetContext (this);
}
if (HasOpenedContext())
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
else if (HasOpenedContext())
{
if (theDispStatus == AIS_DS_None
|| theDispStatus == AIS_DS_Temporary)
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
}
if (!myObjects.IsBound (theIObj))
{
@@ -383,8 +405,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
else
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() != AIS_DS_Displayed
&& aStatus->GraphicStatus() != AIS_DS_Erased)
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
{
return;
}
@@ -418,10 +439,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
}
myMainPM->Display (theIObj, theDispMode);
if (aStatus->GraphicStatus() == AIS_DS_Erased)
{
aStatus->SetGraphicStatus (AIS_DS_Displayed);
}
aStatus->SetGraphicStatus (AIS_DS_Displayed);
if (aStatus->IsHilighted())
{
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
@@ -874,14 +892,14 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_True);
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_True);
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Color (anIObj, aCol, aHilightMode);
STATUS->SetHilightColor (aCol);
aStatus->SetHilightColor (aCol);
}
}
else
@@ -904,11 +922,11 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_False);
STATUS->SetHilightColor(Quantity_NOC_WHITE);
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightColor(Quantity_NOC_WHITE);
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Unhighlight (anIObj, aHilightMode);
@@ -1444,12 +1462,12 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
aStatus->AddDisplayMode (theMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
myMainPM->Display (anObj, theMode);
if (aStatus->IsSubIntensityOn())
{
myMainPM->Color (anObj, mySubIntensity, theMode);
}
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
}
}
@@ -2241,35 +2259,39 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Temporary
|| aStatus->GraphicStatus() == AIS_DS_Erased)
{
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
return;
}
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
{
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
{
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
if (theToUpdateviewer)
{
myMainVwr->Update();
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
}
aStatus->SetGraphicStatus (AIS_DS_Erased);
if (theToUpdateviewer)
{
myMainVwr->Update();
}
}
//=======================================================================
@@ -2736,17 +2758,7 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
if (theIObj.IsNull())
return;
if (myObjects.IsBound (theIObj))
{
if (myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed || myObjects (theIObj)->GraphicStatus() == AIS_DS_Erased)
{
theIObj->SetZLayer (myMainPM, theLayerId);
}
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetZLayer (theIObj, theLayerId);
}
theIObj->SetZLayer (theLayerId);
}
//=======================================================================
@@ -2755,17 +2767,7 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
//=======================================================================
Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
if (theIObj.IsNull())
return -1;
if (myObjects.IsBound (theIObj))
{
return theIObj->GetZLayer (myMainPM);
}
else if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
}
return -1;
return !theIObj.IsNull()
? theIObj->ZLayer()
: Graphic3d_ZLayerId_UNKNOWN;
}

View File

@@ -416,26 +416,6 @@ is
anObject: InteractiveObject from AIS;
Prior : Integer from Standard);
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
returns Integer from Standard;

View File

@@ -1219,34 +1219,3 @@ Standard_Integer AIS_LocalContext::PixelTolerance() const {
return myMainVS->PixelTolerance();
}
//=======================================================================
//function : SetZLayer
//purpose :
//=======================================================================
void AIS_LocalContext::SetZLayer (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theLayerId)
{
if (!myActiveObjects.IsBound (theIObj))
return;
const Handle(AIS_LocalStatus)& aStatus = myActiveObjects (theIObj);
if (aStatus->DisplayMode () == -1)
return;
theIObj->SetZLayer (myMainPM, theLayerId);
}
//=======================================================================
//function : GetZLayer
//purpose :
//=======================================================================
Standard_Integer AIS_LocalContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
if (!myActiveObjects.IsBound (theIObj))
return -1;
return theIObj->GetZLayer (myMainPM);
}