mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +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:
parent
92e24f9d36
commit
a195430212
@ -172,30 +172,31 @@ is
|
|||||||
-- local context without selection, use the syntax below,
|
-- local context without selection, use the syntax below,
|
||||||
-- setting aSelectionMode to -1.
|
-- setting aSelectionMode to -1.
|
||||||
|
|
||||||
Display(me : mutable;
|
Display (me : mutable;
|
||||||
anIobj : InteractiveObject from AIS;
|
theIObj : InteractiveObject from AIS;
|
||||||
amode : Integer from Standard ;
|
theDispMode : Integer from Standard;
|
||||||
aSelectionMode : Integer from Standard ;
|
theSelectionMode : Integer from Standard;
|
||||||
updateviewer : Boolean from Standard = Standard_True;
|
theToUpdateViewer : Boolean from Standard = Standard_True;
|
||||||
allowdecomposition : 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
|
---Purpose: Controls the choice between the using the display
|
||||||
-- and selection modes of open local context which you
|
-- and selection modes of open local context which you
|
||||||
-- have defined and activating those available by default.
|
-- have defined and activating those available by default.
|
||||||
-- If no Local Context is opened. and the Interactive
|
-- If no Local Context is opened. and the Interactive
|
||||||
-- Object aniobj has no display mode of its own, the
|
-- Object theIObj has no display mode of its own, the
|
||||||
-- default display mode, 0, is used. Likewise, if aniobj
|
-- default display mode, 0, is used. Likewise, if theIObj
|
||||||
-- has no selection mode of its own, the default one, 0, is used.
|
-- 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
|
-- Standard_False, the presentation of the Interactive
|
||||||
-- Object activates the selection mode; the object is
|
-- Object activates the selection mode; the object is
|
||||||
-- displayed but no viewer will be updated.
|
-- 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.
|
-- activated: it will be displayed but will not be selectable.
|
||||||
-- Use this if you want to view the object in open local
|
-- Use this if you want to view the object in open local
|
||||||
-- context without selection. Note: This option is only
|
-- context without selection. Note: This option is only
|
||||||
-- available in Local Context.
|
-- available in Local Context.
|
||||||
-- If allowDecomposition equals true, anIObj can have
|
-- If theToAllowDecomposition equals true, theIObj can have
|
||||||
-- subshapes detected by selection mechanisms. anIObj
|
-- subshapes detected by selection mechanisms. theIObj
|
||||||
-- must be able to give a shape selection modes which
|
-- must be able to give a shape selection modes which
|
||||||
-- fit the AIS_Shape selection modes:
|
-- fit the AIS_Shape selection modes:
|
||||||
-- - vertices: 1
|
-- - vertices: 1
|
||||||
@ -345,22 +346,14 @@ is
|
|||||||
SetZLayer( me : mutable;
|
SetZLayer( me : mutable;
|
||||||
theIObj : InteractiveObject from AIS;
|
theIObj : InteractiveObject from AIS;
|
||||||
theLayerId : Integer from Standard );
|
theLayerId : Integer from Standard );
|
||||||
---Purpose: Set Z layer id for interactive object. The layer can be
|
---Purpose: Set Z layer id for interactive object.
|
||||||
-- specified for displayed object only. The Z layers can be used to display
|
-- The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
|
||||||
-- temporarily presentations of some object in front of the other objects
|
-- The ids for Z layers are generated by V3d_Viewer.
|
||||||
-- 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;
|
GetZLayer( me;
|
||||||
theIObj : InteractiveObject from AIS )
|
theIObj : InteractiveObject from AIS )
|
||||||
returns Integer from Standard;
|
returns Integer from Standard;
|
||||||
---Purpose: Get Z layer id set for displayed interactive object.
|
---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;
|
Redisplay(me : mutable;
|
||||||
aniobj : InteractiveObject from AIS;
|
aniobj : InteractiveObject from AIS;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
|
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
|
||||||
#include <PrsMgr_ModedPresentation.hxx>
|
#include <PrsMgr_ModedPresentation.hxx>
|
||||||
#include <Visual3d_ViewManager.hxx>
|
#include <Visual3d_ViewManager.hxx>
|
||||||
|
#include <Visual3d_View.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
#include <AIS_Shape.hxx>
|
#include <AIS_Shape.hxx>
|
||||||
#include <Graphic3d_AspectFillArea3d.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())
|
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
|
||||||
{
|
{
|
||||||
if (anObjIter.Value()->GraphicStatus() != theStatus
|
if (theStatus != AIS_DS_None
|
||||||
|| anObjIter.Key()->Type() != theKind)
|
&& anObjIter.Value()->GraphicStatus() != theStatus)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (anObjIter.Key()->Type() != theKind)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -344,27 +349,44 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
const Standard_Integer theDispMode,
|
const Standard_Integer theDispMode,
|
||||||
const Standard_Integer theSelectionMode,
|
const Standard_Integer theSelectionMode,
|
||||||
const Standard_Boolean theToUpdateViewer,
|
const Standard_Boolean theToUpdateViewer,
|
||||||
const Standard_Boolean theToAllowDecomposition)
|
const Standard_Boolean theToAllowDecomposition,
|
||||||
|
const AIS_DisplayStatus theDispStatus)
|
||||||
{
|
{
|
||||||
if (theIObj.IsNull())
|
if (theIObj.IsNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theDispStatus == AIS_DS_Erased)
|
||||||
|
{
|
||||||
|
Erase (theIObj, theToUpdateViewer);
|
||||||
|
Load (theIObj, theSelectionMode, theToAllowDecomposition);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
if (!theIObj->HasInteractiveContext())
|
||||||
{
|
{
|
||||||
theIObj->SetContext (this);
|
theIObj->SetContext (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasOpenedContext())
|
if (theDispStatus == AIS_DS_Temporary
|
||||||
|
&& !HasOpenedContext())
|
||||||
{
|
{
|
||||||
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
|
|
||||||
if (theToUpdateViewer)
|
|
||||||
{
|
|
||||||
myMainVwr->Update();
|
|
||||||
}
|
|
||||||
return;
|
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))
|
if (!myObjects.IsBound (theIObj))
|
||||||
{
|
{
|
||||||
@ -383,8 +405,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||||
if (aStatus->GraphicStatus() != AIS_DS_Displayed
|
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
|
||||||
&& aStatus->GraphicStatus() != AIS_DS_Erased)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -418,10 +439,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
}
|
}
|
||||||
|
|
||||||
myMainPM->Display (theIObj, theDispMode);
|
myMainPM->Display (theIObj, theDispMode);
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Erased)
|
aStatus->SetGraphicStatus (AIS_DS_Displayed);
|
||||||
{
|
|
||||||
aStatus->SetGraphicStatus (AIS_DS_Displayed);
|
|
||||||
}
|
|
||||||
if (aStatus->IsHilighted())
|
if (aStatus->IsHilighted())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
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;
|
if(!myObjects.IsBound(anIObj)) return;
|
||||||
|
|
||||||
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
|
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
|
||||||
STATUS->SetHilightStatus (Standard_True);
|
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);
|
myMainPM->Color (anIObj, aCol, aHilightMode);
|
||||||
STATUS->SetHilightColor (aCol);
|
aStatus->SetHilightColor (aCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -904,11 +922,11 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
|
|||||||
{
|
{
|
||||||
if(!myObjects.IsBound(anIObj)) return;
|
if(!myObjects.IsBound(anIObj)) return;
|
||||||
|
|
||||||
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
|
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
|
||||||
STATUS->SetHilightStatus (Standard_False);
|
aStatus->SetHilightStatus (Standard_False);
|
||||||
STATUS->SetHilightColor(Quantity_NOC_WHITE);
|
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;
|
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
|
||||||
myMainPM->Unhighlight (anIObj, aHilightMode);
|
myMainPM->Unhighlight (anIObj, aHilightMode);
|
||||||
@ -1444,12 +1462,12 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
|
|||||||
aStatus->AddDisplayMode (theMode);
|
aStatus->AddDisplayMode (theMode);
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||||
{
|
{
|
||||||
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
|
|
||||||
myMainPM->Display (anObj, theMode);
|
myMainPM->Display (anObj, theMode);
|
||||||
if (aStatus->IsSubIntensityOn())
|
if (aStatus->IsSubIntensityOn())
|
||||||
{
|
{
|
||||||
myMainPM->Color (anObj, mySubIntensity, theMode);
|
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);
|
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||||
|
|
||||||
Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
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->Unhighlight (theIObj, aDispModeIter.Value());
|
|
||||||
}
|
|
||||||
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCurrent (theIObj)
|
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
|
||||||
&& !aStatus->IsDModeIn (aDispMode))
|
}
|
||||||
{
|
|
||||||
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
|
if (IsCurrent (theIObj)
|
||||||
{
|
&& !aStatus->IsDModeIn (aDispMode))
|
||||||
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
|
{
|
||||||
}
|
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
|
||||||
|
}
|
||||||
|
|
||||||
if (theToUpdateviewer)
|
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
|
||||||
{
|
{
|
||||||
myMainVwr->Update();
|
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
aStatus->SetGraphicStatus (AIS_DS_Erased);
|
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())
|
if (theIObj.IsNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (myObjects.IsBound (theIObj))
|
theIObj->SetZLayer (theLayerId);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -2755,17 +2767,7 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
|
Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
|
||||||
{
|
{
|
||||||
if (theIObj.IsNull())
|
return !theIObj.IsNull()
|
||||||
return -1;
|
? theIObj->ZLayer()
|
||||||
|
: Graphic3d_ZLayerId_UNKNOWN;
|
||||||
if (myObjects.IsBound (theIObj))
|
|
||||||
{
|
|
||||||
return theIObj->GetZLayer (myMainPM);
|
|
||||||
}
|
|
||||||
else if (HasOpenedContext())
|
|
||||||
{
|
|
||||||
return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
@ -416,26 +416,6 @@ is
|
|||||||
anObject: InteractiveObject from AIS;
|
anObject: InteractiveObject from AIS;
|
||||||
Prior : Integer from Standard);
|
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)
|
DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
|
||||||
returns Integer from Standard;
|
returns Integer from Standard;
|
||||||
|
|
||||||
|
@ -1219,34 +1219,3 @@ Standard_Integer AIS_LocalContext::PixelTolerance() const {
|
|||||||
|
|
||||||
return myMainVS->PixelTolerance();
|
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);
|
|
||||||
}
|
|
||||||
|
@ -19,7 +19,6 @@ Graphic3d_CBitFields8.hxx
|
|||||||
Graphic3d_CBitFields4.hxx
|
Graphic3d_CBitFields4.hxx
|
||||||
Graphic3d_CTexture.hxx
|
Graphic3d_CTexture.hxx
|
||||||
Graphic3d_CLight.hxx
|
Graphic3d_CLight.hxx
|
||||||
Graphic3d_CPick.hxx
|
|
||||||
Graphic3d_CUserDraw.hxx
|
Graphic3d_CUserDraw.hxx
|
||||||
Graphic3d_CView.hxx
|
Graphic3d_CView.hxx
|
||||||
Graphic3d_CGraduatedTrihedron.hxx
|
Graphic3d_CGraduatedTrihedron.hxx
|
||||||
@ -35,6 +34,8 @@ Graphic3d_ShaderVariable.lxx
|
|||||||
Graphic3d_ShaderObject_Handle.hxx
|
Graphic3d_ShaderObject_Handle.hxx
|
||||||
Graphic3d_ShaderProgram_Handle.hxx
|
Graphic3d_ShaderProgram_Handle.hxx
|
||||||
Graphic3d_ShaderVariable_Handle.hxx
|
Graphic3d_ShaderVariable_Handle.hxx
|
||||||
|
Graphic3d_MapOfStructure.hxx
|
||||||
|
Graphic3d_MapIteratorOfMapOfStructure.hxx
|
||||||
Graphic3d_TypeOfShaderObject.hxx
|
Graphic3d_TypeOfShaderObject.hxx
|
||||||
Graphic3d_DataStructure.pxx
|
Graphic3d_DataStructure.pxx
|
||||||
Graphic3d_StructureManager.pxx
|
Graphic3d_StructureManager.pxx
|
||||||
@ -53,6 +54,7 @@ Graphic3d_Vec3.hxx
|
|||||||
Graphic3d_Vec4.hxx
|
Graphic3d_Vec4.hxx
|
||||||
Graphic3d_Mat4.hxx
|
Graphic3d_Mat4.hxx
|
||||||
Graphic3d_Mat4d.hxx
|
Graphic3d_Mat4d.hxx
|
||||||
|
Graphic3d_ZLayerId.hxx
|
||||||
Graphic3d_ZLayerSettings.hxx
|
Graphic3d_ZLayerSettings.hxx
|
||||||
Graphic3d_Vertex.hxx
|
Graphic3d_Vertex.hxx
|
||||||
Graphic3d_Vertex.cxx
|
Graphic3d_Vertex.cxx
|
||||||
|
@ -388,9 +388,6 @@ is
|
|||||||
imported CLight;
|
imported CLight;
|
||||||
---Category: Imported types
|
---Category: Imported types
|
||||||
|
|
||||||
imported CPick;
|
|
||||||
---Category: Imported types
|
|
||||||
|
|
||||||
imported CPlane;
|
imported CPlane;
|
||||||
---Category: Imported types
|
---Category: Imported types
|
||||||
|
|
||||||
@ -428,7 +425,8 @@ is
|
|||||||
imported Mat4;
|
imported Mat4;
|
||||||
imported Mat4d;
|
imported Mat4d;
|
||||||
|
|
||||||
imported ZLayerSettings;
|
imported ZLayerSettings;
|
||||||
|
primitive ZLayerId;
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
-- Category: Classes
|
-- Category: Classes
|
||||||
@ -493,20 +491,15 @@ is
|
|||||||
imported Vertex;
|
imported Vertex;
|
||||||
---Category: Classes
|
---Category: Classes
|
||||||
|
|
||||||
|
imported MapOfStructure;
|
||||||
|
imported SequenceOfDisplayedStructures;
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
-- Category: Instantiated classes
|
-- Category: Instantiated classes
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
imported SequenceOfGroup;
|
imported SequenceOfGroup;
|
||||||
|
|
||||||
---Category: Instantiated classes
|
|
||||||
|
|
||||||
class MapOfStructure instantiates
|
|
||||||
Map from TCollection (Structure from Graphic3d,MapTransientHasher from TColStd);
|
|
||||||
|
|
||||||
|
|
||||||
---Category: Instantiated classes
|
|
||||||
|
|
||||||
class SequenceOfStructure instantiates
|
class SequenceOfStructure instantiates
|
||||||
Sequence from TCollection
|
Sequence from TCollection
|
||||||
(Structure from Graphic3d);
|
(Structure from Graphic3d);
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
/*============================================================================*/
|
|
||||||
/*==== Titre: Graphic3d_CPick.hxx */
|
|
||||||
/*==== Role : The header file of primitive type "CPick" from Graphic3d */
|
|
||||||
/*==== */
|
|
||||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
|
||||||
/*============================================================================*/
|
|
||||||
|
|
||||||
#ifndef _Graphic3d_CPick_HeaderFile
|
|
||||||
#define _Graphic3d_CPick_HeaderFile
|
|
||||||
|
|
||||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
|
||||||
#include <InterfaceGraphic_Visual3d.hxx>
|
|
||||||
typedef CALL_DEF_PICK Graphic3d_CPick;
|
|
||||||
|
|
||||||
#endif /*Graphic3d_CPick_HeaderFile*/
|
|
@ -27,6 +27,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure, Standard_Transient)
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
|
Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
|
||||||
: Id (theManager->NewIdentification()),
|
: Id (theManager->NewIdentification()),
|
||||||
|
myZLayer (Graphic3d_ZLayerId_Default),
|
||||||
Priority (Structure_MAX_PRIORITY / 2),
|
Priority (Structure_MAX_PRIORITY / 2),
|
||||||
PreviousPriority (Structure_MAX_PRIORITY / 2),
|
PreviousPriority (Structure_MAX_PRIORITY / 2),
|
||||||
Composition (Graphic3d_TOC_REPLACE),
|
Composition (Graphic3d_TOC_REPLACE),
|
||||||
@ -35,7 +36,6 @@ Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureMana
|
|||||||
stick (0),
|
stick (0),
|
||||||
highlight (0),
|
highlight (0),
|
||||||
visible (1),
|
visible (1),
|
||||||
pick (1),
|
|
||||||
HLRValidation (0),
|
HLRValidation (0),
|
||||||
IsForHighlight (Standard_False),
|
IsForHighlight (Standard_False),
|
||||||
IsMutable (Standard_False),
|
IsMutable (Standard_False),
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
||||||
#include <Graphic3d_TypeOfComposition.hxx>
|
#include <Graphic3d_TypeOfComposition.hxx>
|
||||||
#include <Graphic3d_Vec3.hxx>
|
#include <Graphic3d_Vec3.hxx>
|
||||||
|
#include <Graphic3d_ZLayerId.hxx>
|
||||||
#include <Standard_Transient.hxx>
|
#include <Standard_Transient.hxx>
|
||||||
#include <Handle_Graphic3d_GraphicDriver.hxx>
|
#include <Handle_Graphic3d_GraphicDriver.hxx>
|
||||||
|
|
||||||
@ -67,10 +68,19 @@ public:
|
|||||||
return myBndBox;
|
return myBndBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Return structure visibility flag
|
||||||
|
bool IsVisible() const { return visible != 0; }
|
||||||
|
|
||||||
|
//! Set z layer ID to display the structure in specified layer
|
||||||
|
void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
|
||||||
|
|
||||||
|
//! Get z layer ID
|
||||||
|
Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Update structure visibility state
|
//! Update structure visibility state
|
||||||
virtual void UpdateNamedStatus() = 0;
|
virtual void OnVisibilityChanged() = 0;
|
||||||
|
|
||||||
//! Clear graphic data
|
//! Clear graphic data
|
||||||
virtual void Clear() = 0;
|
virtual void Clear() = 0;
|
||||||
@ -106,9 +116,10 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int Id;
|
int Id;
|
||||||
int Priority;
|
Graphic3d_ZLayerId myZLayer;
|
||||||
int PreviousPriority;
|
int Priority;
|
||||||
|
int PreviousPriority;
|
||||||
|
|
||||||
CALL_DEF_CONTEXTLINE ContextLine;
|
CALL_DEF_CONTEXTLINE ContextLine;
|
||||||
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
|
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
|
||||||
@ -123,10 +134,9 @@ public:
|
|||||||
int ContainsFacet;
|
int ContainsFacet;
|
||||||
|
|
||||||
unsigned IsInfinite : 1;
|
unsigned IsInfinite : 1;
|
||||||
unsigned stick : 1;
|
unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
|
||||||
unsigned highlight : 1;
|
unsigned highlight : 1;
|
||||||
unsigned visible : 1;
|
unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph
|
||||||
unsigned pick : 1;
|
|
||||||
unsigned HLRValidation : 1;
|
unsigned HLRValidation : 1;
|
||||||
unsigned IsForHighlight : 1;
|
unsigned IsForHighlight : 1;
|
||||||
unsigned IsMutable : 1;
|
unsigned IsMutable : 1;
|
||||||
|
@ -50,6 +50,7 @@ uses
|
|||||||
PrintAlgo from Aspect,
|
PrintAlgo from Aspect,
|
||||||
DisplayConnection_Handle from Aspect,
|
DisplayConnection_Handle from Aspect,
|
||||||
|
|
||||||
|
ZLayerId from Graphic3d,
|
||||||
ZLayerSettings from Graphic3d,
|
ZLayerSettings from Graphic3d,
|
||||||
|
|
||||||
AspectLine3d from Graphic3d,
|
AspectLine3d from Graphic3d,
|
||||||
@ -60,7 +61,6 @@ uses
|
|||||||
CBitFields20 from Graphic3d,
|
CBitFields20 from Graphic3d,
|
||||||
Group from Graphic3d,
|
Group from Graphic3d,
|
||||||
CLight from Graphic3d,
|
CLight from Graphic3d,
|
||||||
CPick from Graphic3d,
|
|
||||||
CPlane from Graphic3d,
|
CPlane from Graphic3d,
|
||||||
CStructure from Graphic3d,
|
CStructure from Graphic3d,
|
||||||
CStructure_Handle from Graphic3d,
|
CStructure_Handle from Graphic3d,
|
||||||
@ -123,16 +123,16 @@ is
|
|||||||
-- Category: Structure management methods
|
-- Category: Structure management methods
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
DisplayStructure ( me : mutable;
|
DisplayStructure ( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theCStructure : in out CStructure from Graphic3d;
|
theStructure : Structure from Graphic3d;
|
||||||
thePriority : Integer from Standard )
|
thePriority : Integer from Standard )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: call_togl_displaystructure
|
---Purpose: call_togl_displaystructure
|
||||||
|
|
||||||
EraseStructure ( me : mutable;
|
EraseStructure ( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theCStructure : in out CStructure from Graphic3d )
|
theStructure : Structure from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: call_togl_erasestructure
|
---Purpose: call_togl_erasestructure
|
||||||
|
|
||||||
@ -369,9 +369,9 @@ is
|
|||||||
-- But it works in any case and is especially useful for view dump because the dump image is read from the back buffer.
|
-- But it works in any case and is especially useful for view dump because the dump image is read from the back buffer.
|
||||||
-- @return previous mode.
|
-- @return previous mode.
|
||||||
|
|
||||||
DisplayImmediateStructure ( me : mutable;
|
DisplayImmediateStructure ( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theCStructure : CStructure from Graphic3d )
|
theStructure : Structure from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Display structure in immediate mode on top of general presentation
|
---Purpose: Display structure in immediate mode on top of general presentation
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ is
|
|||||||
|
|
||||||
AddZLayer( me : mutable;
|
AddZLayer( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Add a new top-level z layer with ID <theLayerId> for
|
---Purpose: Add a new top-level z layer with ID <theLayerId> for
|
||||||
-- the view. Z layers allow drawing structures in higher layers
|
-- the view. Z layers allow drawing structures in higher layers
|
||||||
@ -639,7 +639,7 @@ is
|
|||||||
|
|
||||||
RemoveZLayer( me : mutable;
|
RemoveZLayer( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Remove Z layer from the specified view. All structures
|
---Purpose: Remove Z layer from the specified view. All structures
|
||||||
-- displayed at the moment in layer will be displayed in default layer
|
-- displayed at the moment in layer will be displayed in default layer
|
||||||
@ -647,35 +647,22 @@ is
|
|||||||
-- structures use method UnsetZLayer (...).
|
-- structures use method UnsetZLayer (...).
|
||||||
|
|
||||||
UnsetZLayer( me : mutable;
|
UnsetZLayer( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Unset Z layer ID for all structures. The structure
|
---Purpose: Unset Z layer ID for all structures. The structure
|
||||||
-- indexes will be set to default layer ( the bottom-level z layer
|
-- indexes will be set to default layer ( the bottom-level z layer
|
||||||
-- with ID = 0 ).
|
-- with ID = 0 ).
|
||||||
|
|
||||||
ChangeZLayer( me : mutable;
|
|
||||||
theCStructure : CStructure from Graphic3d;
|
|
||||||
theLayerId : Integer from Standard )
|
|
||||||
is deferred;
|
|
||||||
---Purpose: Change Z layer of a structure. The new z layer ID will
|
|
||||||
-- be used to define the associated layer for structure on display.
|
|
||||||
|
|
||||||
ChangeZLayer( me : mutable;
|
ChangeZLayer( me : mutable;
|
||||||
theCStructure : CStructure from Graphic3d;
|
theCStructure : CStructure from Graphic3d;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theNewLayerId : Integer from Standard )
|
theNewLayerId : ZLayerId from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Change Z layer of a structure already presented in view.
|
---Purpose: Change Z layer of a structure already presented in view.
|
||||||
|
|
||||||
GetZLayer( me;
|
|
||||||
theCStructure : CStructure from Graphic3d )
|
|
||||||
returns Integer from Standard is deferred;
|
|
||||||
---Purpose: Get Z layer ID of structure. If the structure doesn't
|
|
||||||
-- exists in graphic driver, the method returns -1.
|
|
||||||
|
|
||||||
SetZLayerSettings( me : mutable;
|
SetZLayerSettings( me : mutable;
|
||||||
theCView : CView from Graphic3d;
|
theCView : CView from Graphic3d;
|
||||||
theLayerId : Integer from Standard;
|
theLayerId : ZLayerId from Graphic3d;
|
||||||
theSettings : ZLayerSettings from Graphic3d)
|
theSettings : ZLayerSettings from Graphic3d)
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Sets the settings for a single Z layer of specified view.
|
---Purpose: Sets the settings for a single Z layer of specified view.
|
||||||
@ -700,10 +687,6 @@ is
|
|||||||
ACLight : CLight from Graphic3d;
|
ACLight : CLight from Graphic3d;
|
||||||
AField : Integer from Standard );
|
AField : Integer from Standard );
|
||||||
|
|
||||||
PrintCPick ( me;
|
|
||||||
ACPick : CPick from Graphic3d;
|
|
||||||
AField : Integer from Standard );
|
|
||||||
|
|
||||||
PrintCStructure ( me;
|
PrintCStructure ( me;
|
||||||
ACStructure : CStructure from Graphic3d;
|
ACStructure : CStructure from Graphic3d;
|
||||||
AField : Integer from Standard );
|
AField : Integer from Standard );
|
||||||
|
@ -60,18 +60,6 @@ void Graphic3d_GraphicDriver::PrintCLight (const Graphic3d_CLight& theCLight,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphic3d_GraphicDriver::PrintCPick (const Graphic3d_CPick& ACPick, const Standard_Integer AField) const {
|
|
||||||
|
|
||||||
if (AField) {
|
|
||||||
cout << "\tws id " << ACPick.WsId
|
|
||||||
<< " view id " << ACPick.ViewId << "\n";
|
|
||||||
cout << "\twindow id " << ACPick.DefWindow.XWindow << "\n";
|
|
||||||
cout << "\tposition " << ACPick.x << " , " << ACPick.y << "\n";
|
|
||||||
cout << flush;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphic3d_GraphicDriver::PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const {
|
void Graphic3d_GraphicDriver::PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const {
|
||||||
|
|
||||||
if (AField) {
|
if (AField) {
|
||||||
|
23
src/Graphic3d/Graphic3d_MapIteratorOfMapOfStructure.hxx
Normal file
23
src/Graphic3d/Graphic3d_MapIteratorOfMapOfStructure.hxx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Created on: 2014-12-18
|
||||||
|
// Created by: Kirill Gavrilov
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Graphic3d_MapIteratorOfMapOfStructure
|
||||||
|
#define _Graphic3d_MapIteratorOfMapOfStructure
|
||||||
|
|
||||||
|
#include <Graphic3d_MapOfStructure.hxx>
|
||||||
|
|
||||||
|
typedef Graphic3d_MapOfStructure::Iterator Graphic3d_MapIteratorOfMapOfStructure;
|
||||||
|
|
||||||
|
#endif // _Graphic3d_MapIteratorOfMapOfStructure
|
24
src/Graphic3d/Graphic3d_MapOfStructure.hxx
Normal file
24
src/Graphic3d/Graphic3d_MapOfStructure.hxx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Created on: 2014-12-18
|
||||||
|
// Created by: Kirill Gavrilov
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Graphic3d_MapOfStructure
|
||||||
|
#define _Graphic3d_MapOfStructure
|
||||||
|
|
||||||
|
#include <Handle_Graphic3d_Structure.hxx>
|
||||||
|
#include <NCollection_Map.hxx>
|
||||||
|
|
||||||
|
typedef NCollection_Map<Handle(Graphic3d_Structure)> Graphic3d_MapOfStructure;
|
||||||
|
|
||||||
|
#endif // _Graphic3d_MapOfStructure
|
@ -70,6 +70,7 @@ uses
|
|||||||
Vector from Graphic3d,
|
Vector from Graphic3d,
|
||||||
Vertex from Graphic3d,
|
Vertex from Graphic3d,
|
||||||
TransModeFlags from Graphic3d,
|
TransModeFlags from Graphic3d,
|
||||||
|
ZLayerId from Graphic3d,
|
||||||
Pnt from gp,
|
Pnt from gp,
|
||||||
SequenceOfHClipPlane from Graphic3d,
|
SequenceOfHClipPlane from Graphic3d,
|
||||||
BndBox4f from Graphic3d,
|
BndBox4f from Graphic3d,
|
||||||
@ -149,31 +150,10 @@ is
|
|||||||
---Category: Methods to modify the class definition
|
---Category: Methods to modify the class definition
|
||||||
---C++: alias ~
|
---C++: alias ~
|
||||||
|
|
||||||
Display ( me : mutable )
|
Display ( me : mutable )
|
||||||
is virtual;
|
is virtual;
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: Displays the structure <me> in all the views of
|
---Purpose: Displays the structure <me> in all the views of the visualiser.
|
||||||
-- the visualiser.
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
Display ( me : mutable;
|
|
||||||
Priority : Integer from Standard )
|
|
||||||
---Level: Public
|
|
||||||
---Purpose: Displays the structure <me> in all the views of
|
|
||||||
-- the visualiser, while modifying its current priority.
|
|
||||||
-- Note: Display Priorities
|
|
||||||
-- Structure display priorities control the order in which
|
|
||||||
-- structures are redrawn. When you display a
|
|
||||||
-- structure, you specify its priority. The lower the value,
|
|
||||||
-- the lower the display priority. When the display is
|
|
||||||
-- regenerated, the structures with the lowest priority
|
|
||||||
-- are drawn first. For structures with the same display
|
|
||||||
-- priority, the order in which they were displayed
|
|
||||||
-- determines the drawing order. Open CASCADE
|
|
||||||
-- supports 11 structure display priorities, 0 to 10.
|
|
||||||
-- Warning: Raises PriorityDefinitionError if <Priority> is
|
|
||||||
-- greater than 10 or a negative value.
|
|
||||||
raises PriorityDefinitionError from Graphic3d is static;
|
|
||||||
|
|
||||||
DisplayPriority ( me )
|
DisplayPriority ( me )
|
||||||
returns Integer from Standard
|
returns Integer from Standard
|
||||||
@ -190,20 +170,15 @@ is
|
|||||||
-- of the visualiser.
|
-- of the visualiser.
|
||||||
---Category: Methods to modify the class definition
|
---Category: Methods to modify the class definition
|
||||||
|
|
||||||
Highlight ( me : mutable;
|
Highlight ( me : mutable;
|
||||||
Method : TypeOfHighlightMethod from Aspect )
|
theMethod : TypeOfHighlightMethod from Aspect;
|
||||||
|
theColor : Color from Quantity;
|
||||||
|
theToUpdateMgr : Boolean from Standard = Standard_True)
|
||||||
is static;
|
is static;
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: Highlights the structure <me> in all the
|
---Purpose: Highlights the structure <me> in all the views of the visualiser, using the following methods:
|
||||||
-- views of the visualiser, using the following methods:
|
-- TOHM_COLOR = drawn in the highlight color
|
||||||
--
|
-- TOHM_BOUNDBOX = enclosed by the boundary box
|
||||||
-- TOHM_COLOR = drawn in the highlight color
|
|
||||||
-- (default white)
|
|
||||||
-- TOHM_BLINK = blinking
|
|
||||||
-- TOHM_BOUNDBOX = enclosed by the boundary box
|
|
||||||
-- (default white)
|
|
||||||
--
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
Remove ( me : mutable )
|
Remove ( me : mutable )
|
||||||
is static;
|
is static;
|
||||||
@ -219,14 +194,6 @@ is
|
|||||||
---Purpose: Computes axis-aligned bounding box of a structure.
|
---Purpose: Computes axis-aligned bounding box of a structure.
|
||||||
-- Category: Methods to modify the class definition
|
-- Category: Methods to modify the class definition
|
||||||
|
|
||||||
SetHighlightColor ( me : mutable;
|
|
||||||
AColor : Color from Quantity )
|
|
||||||
is static;
|
|
||||||
---Level: Public
|
|
||||||
---Purpose: Modifies the highlight color for the Highlight method
|
|
||||||
-- with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
SetInfiniteState (me : mutable; theToSet : Boolean from Standard) is static;
|
SetInfiniteState (me : mutable; theToSet : Boolean from Standard) is static;
|
||||||
---Level: Internal
|
---Level: Internal
|
||||||
---Purpose: If <theToSet> is Standard_True then <me> is infinite and
|
---Purpose: If <theToSet> is Standard_True then <me> is infinite and
|
||||||
@ -264,7 +231,7 @@ is
|
|||||||
-- previous priority.
|
-- previous priority.
|
||||||
|
|
||||||
SetZLayer ( me : mutable;
|
SetZLayer ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is static;
|
is static;
|
||||||
---Purpose: Set Z layer ID for the structure. The Z layer mechanism
|
---Purpose: Set Z layer ID for the structure. The Z layer mechanism
|
||||||
-- allows to display structures presented in higher layers in overlay
|
-- allows to display structures presented in higher layers in overlay
|
||||||
@ -272,7 +239,7 @@ is
|
|||||||
-- test between layers
|
-- test between layers
|
||||||
|
|
||||||
GetZLayer ( me )
|
GetZLayer ( me )
|
||||||
returns Integer from Standard is static;
|
returns ZLayerId from Graphic3d is static;
|
||||||
---Purpose: Get Z layer ID of displayed structure. The method
|
---Purpose: Get Z layer ID of displayed structure. The method
|
||||||
-- returns -1 if the structure has no ID (deleted from graphic driver).
|
-- returns -1 if the structure has no ID (deleted from graphic driver).
|
||||||
|
|
||||||
@ -285,16 +252,6 @@ is
|
|||||||
---Purpose: Get clip planes slicing the structure on rendering.
|
---Purpose: Get clip planes slicing the structure on rendering.
|
||||||
-- @return set of clip planes.
|
-- @return set of clip planes.
|
||||||
|
|
||||||
SetPick ( me : mutable;
|
|
||||||
AValue : Boolean from Standard )
|
|
||||||
is static;
|
|
||||||
---Level: Public
|
|
||||||
---Purpose: Modifies the detectability indicator to Standard_True
|
|
||||||
-- or Standard_False for the structure <me>.
|
|
||||||
-- The default value at the definition of <me> is
|
|
||||||
-- Standard_True.
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
SetPrimitivesAspect ( me : mutable;
|
SetPrimitivesAspect ( me : mutable;
|
||||||
CTX : AspectLine3d from Graphic3d )
|
CTX : AspectLine3d from Graphic3d )
|
||||||
is static;
|
is static;
|
||||||
@ -532,13 +489,6 @@ is
|
|||||||
---Purpose: Returns the highlight indicator for the structure <me>.
|
---Purpose: Returns the highlight indicator for the structure <me>.
|
||||||
---Category: Inquire methods
|
---Category: Inquire methods
|
||||||
|
|
||||||
IsSelectable ( me )
|
|
||||||
returns Boolean from Standard
|
|
||||||
is static;
|
|
||||||
---Level: Public
|
|
||||||
---Purpose: Returns the detectability indicator for the structure <me>.
|
|
||||||
---Category: Inquire methods
|
|
||||||
|
|
||||||
IsRotated ( me )
|
IsRotated ( me )
|
||||||
returns Boolean from Standard
|
returns Boolean from Standard
|
||||||
is static;
|
is static;
|
||||||
|
@ -203,7 +203,11 @@ void Graphic3d_Structure::Display()
|
|||||||
myStructureManager->Display (this);
|
myStructureManager->Display (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
myCStructure->visible = 1;
|
if (myCStructure->visible != 1)
|
||||||
|
{
|
||||||
|
myCStructure->visible = 1;
|
||||||
|
myCStructure->OnVisibilityChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -215,25 +219,6 @@ void Graphic3d_Structure::SetIsForHighlight (const Standard_Boolean isForHighlig
|
|||||||
myCStructure->IsForHighlight = isForHighlight;
|
myCStructure->IsForHighlight = isForHighlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : Display
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void Graphic3d_Structure::Display (const Standard_Integer thePriority)
|
|
||||||
{
|
|
||||||
if (IsDeleted()) return;
|
|
||||||
|
|
||||||
SetDisplayPriority (thePriority);
|
|
||||||
|
|
||||||
if (!myCStructure->stick)
|
|
||||||
{
|
|
||||||
myCStructure->stick = 1;
|
|
||||||
myStructureManager->Display (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
myCStructure->visible = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : SetDisplayPriority
|
//function : SetDisplayPriority
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -312,13 +297,17 @@ void Graphic3d_Structure::Erase()
|
|||||||
//function : Highlight
|
//function : Highlight
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod)
|
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
|
||||||
|
const Quantity_Color& theColor,
|
||||||
|
const Standard_Boolean theToUpdateMgr)
|
||||||
{
|
{
|
||||||
if (IsDeleted())
|
if (IsDeleted())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myHighlightColor = theColor;
|
||||||
|
|
||||||
// Highlight on already Highlighted structure.
|
// Highlight on already Highlighted structure.
|
||||||
if (myCStructure->highlight)
|
if (myCStructure->highlight)
|
||||||
{
|
{
|
||||||
@ -340,6 +329,12 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
|
|||||||
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
|
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
|
||||||
|
|
||||||
GraphicHighlight (theMethod);
|
GraphicHighlight (theMethod);
|
||||||
|
|
||||||
|
if (!theToUpdateMgr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (myCStructure->stick)
|
if (myCStructure->stick)
|
||||||
{
|
{
|
||||||
myStructureManager->Highlight (this, theMethod);
|
myStructureManager->Highlight (this, theMethod);
|
||||||
@ -348,41 +343,6 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : SetHighlightColor
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void Graphic3d_Structure::SetHighlightColor (const Quantity_Color& theColor)
|
|
||||||
{
|
|
||||||
if (IsDeleted())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myCStructure->highlight)
|
|
||||||
{
|
|
||||||
myHighlightColor = theColor;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change highlight color on already Highlighted structure.
|
|
||||||
Aspect_TypeOfUpdate anUpdateMode = myStructureManager->UpdateMode();
|
|
||||||
if (anUpdateMode == Aspect_TOU_WAIT)
|
|
||||||
{
|
|
||||||
UnHighlight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// To avoid call of method : Update()
|
|
||||||
// Not useful and can be costly.
|
|
||||||
myStructureManager->SetUpdateMode (Aspect_TOU_WAIT);
|
|
||||||
UnHighlight();
|
|
||||||
myStructureManager->SetUpdateMode (anUpdateMode);
|
|
||||||
}
|
|
||||||
myHighlightColor = theColor;
|
|
||||||
Highlight (myHighlightMethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : SetVisible
|
//function : SetVisible
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -391,30 +351,14 @@ void Graphic3d_Structure::SetVisible (const Standard_Boolean theValue)
|
|||||||
{
|
{
|
||||||
if (IsDeleted()) return;
|
if (IsDeleted()) return;
|
||||||
|
|
||||||
myCStructure->visible = theValue ? 1 : 0;
|
const unsigned isVisible = theValue ? 1 : 0;
|
||||||
myCStructure->UpdateNamedStatus();
|
if (myCStructure->visible == isVisible)
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : SetPick
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void Graphic3d_Structure::SetPick (const Standard_Boolean theValue)
|
|
||||||
{
|
|
||||||
if (IsDeleted ()) return;
|
|
||||||
|
|
||||||
myCStructure->pick = theValue ? 1 : 0;
|
|
||||||
myCStructure->UpdateNamedStatus();
|
|
||||||
|
|
||||||
if (theValue)
|
|
||||||
{
|
{
|
||||||
myStructureManager->Detectable (this);
|
return;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myStructureManager->Undetectable (this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myCStructure->visible = isVisible;
|
||||||
|
myCStructure->OnVisibilityChanged();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,15 +418,6 @@ Standard_Boolean Graphic3d_Structure::IsHighlighted() const
|
|||||||
return myCStructure->highlight ? Standard_True : Standard_False;
|
return myCStructure->highlight ? Standard_True : Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : IsSelectable
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
Standard_Boolean Graphic3d_Structure::IsSelectable() const
|
|
||||||
{
|
|
||||||
return myCStructure->pick ? Standard_True : Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : IsVisible
|
//function : IsVisible
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -2281,7 +2216,6 @@ void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod t
|
|||||||
{
|
{
|
||||||
myHighlightColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
myHighlightColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
||||||
myCStructure->HighlightWithColor (Graphic3d_Vec3 (float (anRGB[0]), float (anRGB[1]), float (anRGB[2])), Standard_True);
|
myCStructure->HighlightWithColor (Graphic3d_Vec3 (float (anRGB[0]), float (anRGB[1]), float (anRGB[2])), Standard_True);
|
||||||
myCStructure->UpdateNamedStatus();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Aspect_TOHM_BOUNDBOX:
|
case Aspect_TOHM_BOUNDBOX:
|
||||||
@ -2323,11 +2257,9 @@ void Graphic3d_Structure::GraphicUnHighlight()
|
|||||||
{
|
{
|
||||||
case Aspect_TOHM_COLOR:
|
case Aspect_TOHM_COLOR:
|
||||||
myCStructure->HighlightWithColor (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f), Standard_False);
|
myCStructure->HighlightWithColor (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f), Standard_False);
|
||||||
myCStructure->UpdateNamedStatus();
|
|
||||||
break;
|
break;
|
||||||
case Aspect_TOHM_BOUNDBOX:
|
case Aspect_TOHM_BOUNDBOX:
|
||||||
myCStructure->HighlightWithBndBox (this, Standard_False);
|
myCStructure->HighlightWithBndBox (this, Standard_False);
|
||||||
myCStructure->UpdateNamedStatus();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2381,22 +2313,23 @@ Standard_Boolean Graphic3d_Structure::HLRValidation() const
|
|||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void Graphic3d_Structure::SetZLayer (const Standard_Integer theLayerId)
|
void Graphic3d_Structure::SetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
// if the structure is not displayed, unable to change its display layer
|
// if the structure is not displayed, unable to change its display layer
|
||||||
if (IsDeleted ())
|
if (IsDeleted ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myStructureManager->ChangeZLayer (this, theLayerId);
|
myStructureManager->ChangeZLayer (this, theLayerId);
|
||||||
|
myCStructure->SetZLayer (theLayerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetZLayer
|
//function : GetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer Graphic3d_Structure::GetZLayer () const
|
Graphic3d_ZLayerId Graphic3d_Structure::GetZLayer() const
|
||||||
{
|
{
|
||||||
return myStructureManager->GetZLayer (this);
|
return myCStructure->ZLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -26,7 +26,7 @@ deferred class StructureManager from Graphic3d inherits TShared
|
|||||||
-- It allows them to be globally manipulated.
|
-- It allows them to be globally manipulated.
|
||||||
-- It defines the global attributes.
|
-- It defines the global attributes.
|
||||||
-- Keywords: Structure, Structure Manager, Update Mode,
|
-- Keywords: Structure, Structure Manager, Update Mode,
|
||||||
-- Destroy, Highlight, Visible, Detectable
|
-- Destroy, Highlight, Visible
|
||||||
|
|
||||||
---Warning:
|
---Warning:
|
||||||
---References:
|
---References:
|
||||||
@ -40,6 +40,7 @@ uses
|
|||||||
TypeOfHighlightMethod from Aspect,
|
TypeOfHighlightMethod from Aspect,
|
||||||
TypeOfUpdate from Aspect,
|
TypeOfUpdate from Aspect,
|
||||||
|
|
||||||
|
ZLayerId from Graphic3d,
|
||||||
ZLayerSettings from Graphic3d,
|
ZLayerSettings from Graphic3d,
|
||||||
|
|
||||||
DataStructureManager from Graphic3d,
|
DataStructureManager from Graphic3d,
|
||||||
@ -193,13 +194,6 @@ is
|
|||||||
-- in a visualiser <me>.
|
-- in a visualiser <me>.
|
||||||
---Category: Inquire methods, MapOfStructure
|
---Category: Inquire methods, MapOfStructure
|
||||||
|
|
||||||
PickStructures ( me; SG: in out MapOfStructure from Graphic3d )
|
|
||||||
is static;
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: Returns the set of detectable structures
|
|
||||||
-- in a visualiser <me>.
|
|
||||||
---Category: Inquire methods, MapOfStructure
|
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
-- Category: Inquire methods
|
-- Category: Inquire methods
|
||||||
----------------------------
|
----------------------------
|
||||||
@ -274,31 +268,25 @@ is
|
|||||||
|
|
||||||
ChangeZLayer ( me : mutable;
|
ChangeZLayer ( me : mutable;
|
||||||
theStructure : Structure from Graphic3d;
|
theStructure : Structure from Graphic3d;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Change Z layer for structure. The z layer mechanism allows
|
---Purpose: Change Z layer for structure. The z layer mechanism allows
|
||||||
-- to display structures in higher layers in overlay of structures in
|
-- to display structures in higher layers in overlay of structures in
|
||||||
-- lower layers.
|
-- lower layers.
|
||||||
|
|
||||||
GetZLayer ( me;
|
|
||||||
theStructure : Structure from Graphic3d )
|
|
||||||
returns Integer from Standard is deferred;
|
|
||||||
---Purpose: Get Z layer ID assigned to structure. If the structure
|
|
||||||
-- has no layer ID (deleted from graphic driver), the method returns -1.
|
|
||||||
|
|
||||||
SetZLayerSettings ( me : mutable;
|
SetZLayerSettings ( me : mutable;
|
||||||
theLayerId : Integer from Standard;
|
theLayerId : ZLayerId from Graphic3d;
|
||||||
theSettings : ZLayerSettings from Graphic3d )
|
theSettings : ZLayerSettings from Graphic3d )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Purpose: Sets the settings for a single Z layer for all managed views.
|
---Purpose: Sets the settings for a single Z layer for all managed views.
|
||||||
|
|
||||||
ZLayerSettings ( me : mutable;
|
ZLayerSettings ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
returns ZLayerSettings from Graphic3d is deferred;
|
returns ZLayerSettings from Graphic3d is deferred;
|
||||||
---Purpose: Returns the settings of a single Z layer.
|
---Purpose: Returns the settings of a single Z layer.
|
||||||
|
|
||||||
AddZLayer ( me : mutable;
|
AddZLayer ( me : mutable;
|
||||||
theLayerId : in out Integer from Standard )
|
theLayerId : out ZLayerId from Graphic3d )
|
||||||
returns Boolean from Standard is deferred;
|
returns Boolean from Standard is deferred;
|
||||||
---Purpose: Add a new top-level Z layer and get its ID as
|
---Purpose: Add a new top-level Z layer and get its ID as
|
||||||
-- <theLayerId> value. The method returns Standard_False if the layer
|
-- <theLayerId> value. The method returns Standard_False if the layer
|
||||||
@ -306,7 +294,7 @@ is
|
|||||||
-- structures in higher layers in overlay of structures in lower layers.
|
-- structures in higher layers in overlay of structures in lower layers.
|
||||||
|
|
||||||
RemoveZLayer ( me : mutable;
|
RemoveZLayer ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
returns Boolean from Standard is deferred;
|
returns Boolean from Standard is deferred;
|
||||||
---Purpose: Remove Z layer with ID <theLayerId>. Method returns
|
---Purpose: Remove Z layer with ID <theLayerId>. Method returns
|
||||||
-- Standard_False if the layer can not be removed or doesn't exists.
|
-- Standard_False if the layer can not be removed or doesn't exists.
|
||||||
@ -343,13 +331,6 @@ is
|
|||||||
-- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
|
-- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
|
||||||
---Category: Private methods
|
---Category: Private methods
|
||||||
|
|
||||||
Detectable ( me : mutable;
|
|
||||||
AStructure : Structure from Graphic3d )
|
|
||||||
is static private;
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: Sets detectable the structure <AStructure>.
|
|
||||||
---Category: Private methods
|
|
||||||
|
|
||||||
Clear ( me : mutable;
|
Clear ( me : mutable;
|
||||||
AStructure : Structure from Graphic3d;
|
AStructure : Structure from Graphic3d;
|
||||||
WithDestruction : Boolean from Standard )
|
WithDestruction : Boolean from Standard )
|
||||||
@ -441,13 +422,6 @@ is
|
|||||||
---Purpose: Frees the identifieur <AnId>.
|
---Purpose: Frees the identifieur <AnId>.
|
||||||
---Category: Private methods
|
---Category: Private methods
|
||||||
|
|
||||||
Undetectable ( me : mutable;
|
|
||||||
AStructure : Structure from Graphic3d )
|
|
||||||
is static private;
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: Sets no detectable the structure <AStructure>.
|
|
||||||
---Category: Private methods
|
|
||||||
|
|
||||||
UnHighlight ( me : mutable )
|
UnHighlight ( me : mutable )
|
||||||
is deferred;
|
is deferred;
|
||||||
---Level: Internal
|
---Level: Internal
|
||||||
@ -504,10 +478,6 @@ fields
|
|||||||
MyHighlightedStructure : MapOfStructure from Graphic3d
|
MyHighlightedStructure : MapOfStructure from Graphic3d
|
||||||
is protected;
|
is protected;
|
||||||
|
|
||||||
-- the pickable structures
|
|
||||||
MyPickStructure : MapOfStructure from Graphic3d
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
-- the structure identifier generator
|
-- the structure identifier generator
|
||||||
MyStructGenId : GenId from Aspect is protected;
|
MyStructGenId : GenId from Aspect is protected;
|
||||||
|
|
||||||
|
@ -39,40 +39,8 @@ static Standard_Integer StructureManager_CurrentId = 0;
|
|||||||
#include <Graphic3d_Structure.pxx>
|
#include <Graphic3d_Structure.pxx>
|
||||||
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
|
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
|
||||||
|
|
||||||
//-Aliases
|
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
|
||||||
|
{
|
||||||
//-Global data definitions
|
|
||||||
|
|
||||||
// -- l'identifieur du manager
|
|
||||||
// MyId : Standard_Integer;
|
|
||||||
|
|
||||||
// -- le mode de mise a jour de l'affichage
|
|
||||||
// MyUpdateMode : TypeOfUpdate;
|
|
||||||
|
|
||||||
// -- les differents contextes de primitives
|
|
||||||
// MyAspectLine3d : AspectLine3d;
|
|
||||||
// MyAspectText3d : AspectText3d;
|
|
||||||
// MyAspectMarker3d : AspectMarker3d;
|
|
||||||
// MyAspectFillArea3d : AspectFillArea3d;
|
|
||||||
|
|
||||||
// -- les structures affichees
|
|
||||||
// MyDisplayedStructure : SequenceOfStructure;
|
|
||||||
|
|
||||||
// -- les structures mises en evidence
|
|
||||||
// MyHighlightedStructure : SequenceOfStructure;
|
|
||||||
|
|
||||||
// -- les structures detectables
|
|
||||||
// MyPickStructure : SequenceOfStructure;
|
|
||||||
|
|
||||||
// -- le generateur d'identificateurs de structures
|
|
||||||
// MyStructGenId : GenId;
|
|
||||||
|
|
||||||
//-Constructors
|
|
||||||
|
|
||||||
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver):
|
|
||||||
MyDisplayedStructure (),
|
|
||||||
MyHighlightedStructure (),
|
|
||||||
MyPickStructure () {
|
|
||||||
|
|
||||||
Standard_Real Coef;
|
Standard_Real Coef;
|
||||||
Standard_Integer i;
|
Standard_Integer i;
|
||||||
@ -136,7 +104,6 @@ void Graphic3d_StructureManager::Destroy () {
|
|||||||
|
|
||||||
MyDisplayedStructure.Clear ();
|
MyDisplayedStructure.Clear ();
|
||||||
MyHighlightedStructure.Clear ();
|
MyHighlightedStructure.Clear ();
|
||||||
MyPickStructure.Clear ();
|
|
||||||
StructureManager_ArrayId[MyId] = 0;
|
StructureManager_ArrayId[MyId] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -222,18 +189,6 @@ void Graphic3d_StructureManager::Remove (const Standard_Integer AnId) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphic3d_StructureManager::Detectable (const Handle(Graphic3d_Structure)& AStructure) {
|
|
||||||
|
|
||||||
MyPickStructure.Add(AStructure);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphic3d_StructureManager::Undetectable (const Handle(Graphic3d_Structure)& AStructure) {
|
|
||||||
|
|
||||||
MyPickStructure.Remove(AStructure);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphic3d_StructureManager::DisplayedStructures (Graphic3d_MapOfStructure& SG) const {
|
void Graphic3d_StructureManager::DisplayedStructures (Graphic3d_MapOfStructure& SG) const {
|
||||||
|
|
||||||
SG.Assign(MyDisplayedStructure);
|
SG.Assign(MyDisplayedStructure);
|
||||||
@ -265,12 +220,6 @@ void Graphic3d_StructureManager::HighlightedStructures (Graphic3d_MapOfStructure
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphic3d_StructureManager::PickStructures (Graphic3d_MapOfStructure& SG) const {
|
|
||||||
|
|
||||||
SG.Assign(MyPickStructure);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer Graphic3d_StructureManager::NewIdentification () {
|
Standard_Integer Graphic3d_StructureManager::NewIdentification () {
|
||||||
|
|
||||||
Standard_Integer Id = MyStructGenId.Next ();
|
Standard_Integer Id = MyStructGenId.Next ();
|
||||||
|
33
src/Graphic3d/Graphic3d_ZLayerId.hxx
Normal file
33
src/Graphic3d/Graphic3d_ZLayerId.hxx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Created on: 2014-12-30
|
||||||
|
// Created by: Kirill Gavrilov
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Graphic3d_ZLayerId_HeaderFile
|
||||||
|
#define _Graphic3d_ZLayerId_HeaderFile
|
||||||
|
|
||||||
|
typedef Standard_Integer Graphic3d_ZLayerId;
|
||||||
|
|
||||||
|
//! This enumeration defines the list of predefined layers, which can not be removed (but settings can be overridden).
|
||||||
|
//! Custom layers might be added with positive index (>= 1) if standard list is insufficient for application needs;
|
||||||
|
//! these layers will be displayed on top of predefined ones.
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
Graphic3d_ZLayerId_UNKNOWN = -1, //!< identifier for invalid ZLayer
|
||||||
|
Graphic3d_ZLayerId_Default = 0, //!< default Z-layer for main presentations
|
||||||
|
Graphic3d_ZLayerId_Top = -2, //!< overlay for 3D presentations which inherits Depth from previous ZLayer
|
||||||
|
Graphic3d_ZLayerId_Topmost = -3, //!< overlay for 3D presentations with independent Depth
|
||||||
|
Graphic3d_ZLayerId_TopOSD = -4 //!< overlay for 2D presentations (On-Screen-Display)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Graphic3d_ZLayerId_HeaderFile
|
@ -24,14 +24,18 @@ enum Graphic3d_ZLayerSetting
|
|||||||
Graphic3d_ZLayerDepthOffset = 8
|
Graphic3d_ZLayerDepthOffset = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Structure defines list of ZLayer properties.
|
||||||
struct Graphic3d_ZLayerSettings
|
struct Graphic3d_ZLayerSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//! Default settings.
|
||||||
Graphic3d_ZLayerSettings()
|
Graphic3d_ZLayerSettings()
|
||||||
: DepthOffsetFactor (1.0f),
|
: DepthOffsetFactor (1.0f),
|
||||||
DepthOffsetUnits (1.0f),
|
DepthOffsetUnits (1.0f),
|
||||||
Flags (Graphic3d_ZLayerDepthTest
|
Flags (Graphic3d_ZLayerDepthTest
|
||||||
| Graphic3d_ZLayerDepthWrite
|
| Graphic3d_ZLayerDepthWrite
|
||||||
| Graphic3d_ZLayerDepthClear)
|
| Graphic3d_ZLayerDepthClear),
|
||||||
|
IsImmediate (false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! Returns true if theSetting is enabled.
|
//! Returns true if theSetting is enabled.
|
||||||
@ -70,10 +74,13 @@ struct Graphic3d_ZLayerSettings
|
|||||||
EnableSetting (Graphic3d_ZLayerDepthOffset);
|
EnableSetting (Graphic3d_ZLayerDepthOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_ShortReal DepthOffsetFactor; //!< Factor argument value for OpenGl glPolygonOffset function.
|
public:
|
||||||
Standard_ShortReal DepthOffsetUnits; //!< Units argument value for OpenGl glPolygonOffset function.
|
|
||||||
|
Standard_ShortReal DepthOffsetFactor; //!< factor argument value for OpenGl glPolygonOffset function
|
||||||
|
Standard_ShortReal DepthOffsetUnits; //!< units argument value for OpenGl glPolygonOffset function
|
||||||
|
Standard_Integer Flags; //!< storage field for settings
|
||||||
|
bool IsImmediate; //!< immediate layer will be drawn after all normal layers
|
||||||
|
|
||||||
Standard_Integer Flags; //!< Storage field for settings.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _Graphic3d_ZLayerSettings_HeaderFile
|
#endif // _Graphic3d_ZLayerSettings_HeaderFile
|
||||||
|
@ -71,30 +71,4 @@ typedef struct {
|
|||||||
|
|
||||||
} CALL_DEF_VIEWMAPPING;
|
} CALL_DEF_VIEWMAPPING;
|
||||||
|
|
||||||
/* REPERAGE */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
|
|
||||||
int WsId;
|
|
||||||
int ViewId;
|
|
||||||
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
CALL_DEF_WINDOW DefWindow;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
float aperture;
|
|
||||||
int order;
|
|
||||||
int depth;
|
|
||||||
} Context;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
int depth;
|
|
||||||
int *listid;
|
|
||||||
int *listpickid;
|
|
||||||
int *listelem;
|
|
||||||
} Pick;
|
|
||||||
|
|
||||||
} CALL_DEF_PICK;
|
|
||||||
|
|
||||||
#endif /* InterfaceGraphic_Visual3dHeader */
|
#endif /* InterfaceGraphic_Visual3dHeader */
|
||||||
|
@ -60,8 +60,6 @@ Handle_OpenGl_Window.hxx
|
|||||||
OpenGl_Window.hxx
|
OpenGl_Window.hxx
|
||||||
OpenGl_Window.cxx
|
OpenGl_Window.cxx
|
||||||
OpenGl_Window_1.mm
|
OpenGl_Window_1.mm
|
||||||
OpenGl_PriorityList.hxx
|
|
||||||
OpenGl_PriorityList.cxx
|
|
||||||
OpenGl_AVIWriter.hxx
|
OpenGl_AVIWriter.hxx
|
||||||
OpenGl_AVIWriter.cxx
|
OpenGl_AVIWriter.cxx
|
||||||
OpenGl_FrameBuffer.hxx
|
OpenGl_FrameBuffer.hxx
|
||||||
@ -141,6 +139,7 @@ OpenGl_ShaderManager.hxx
|
|||||||
OpenGl_ShaderManager.cxx
|
OpenGl_ShaderManager.cxx
|
||||||
OpenGl_ShaderStates.hxx
|
OpenGl_ShaderStates.hxx
|
||||||
OpenGl_ShaderStates.cxx
|
OpenGl_ShaderStates.cxx
|
||||||
|
OpenGl_SequenceOfStructure.hxx
|
||||||
Handle_OpenGl_ShaderObject.hxx
|
Handle_OpenGl_ShaderObject.hxx
|
||||||
Handle_OpenGl_ShaderProgram.hxx
|
Handle_OpenGl_ShaderProgram.hxx
|
||||||
Handle_OpenGl_ShaderManager.hxx
|
Handle_OpenGl_ShaderManager.hxx
|
||||||
|
@ -81,11 +81,9 @@ void OpenGl_BVHClipPrimitiveSet::Assign (const OpenGl_ArrayOfStructure& theStruc
|
|||||||
myStructs.Clear();
|
myStructs.Clear();
|
||||||
|
|
||||||
const Standard_Integer aNbPriorities = theStructs.Length();
|
const Standard_Integer aNbPriorities = theStructs.Length();
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIter;
|
|
||||||
for (Standard_Integer aPriorityIdx = 0; aPriorityIdx < aNbPriorities; ++aPriorityIdx)
|
for (Standard_Integer aPriorityIdx = 0; aPriorityIdx < aNbPriorities; ++aPriorityIdx)
|
||||||
{
|
{
|
||||||
const OpenGl_SequenceOfStructure& aSeq = theStructs (aPriorityIdx);
|
for (OpenGl_SequenceOfStructure::Iterator aStructIter (theStructs (aPriorityIdx)); aStructIter.More(); aStructIter.Next())
|
||||||
for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
|
|
||||||
{
|
{
|
||||||
const OpenGl_Structure* aStruct = aStructIter.Value();
|
const OpenGl_Structure* aStruct = aStructIter.Value();
|
||||||
if (!aStruct->IsAlwaysRendered())
|
if (!aStruct->IsAlwaysRendered())
|
||||||
|
@ -17,14 +17,12 @@
|
|||||||
#define _OpenGl_BVHClipPrimitiveSet_HeaderFile
|
#define _OpenGl_BVHClipPrimitiveSet_HeaderFile
|
||||||
|
|
||||||
#include <BVH_PrimitiveSet.hxx>
|
#include <BVH_PrimitiveSet.hxx>
|
||||||
|
|
||||||
#include <NCollection_Array1.hxx>
|
#include <NCollection_Array1.hxx>
|
||||||
#include <NCollection_Sequence.hxx>
|
|
||||||
|
|
||||||
#include <OpenGl_Vec.hxx>
|
#include <OpenGl_Vec.hxx>
|
||||||
#include <OpenGl_Structure.hxx>
|
#include <OpenGl_Structure.hxx>
|
||||||
|
#include <OpenGl_SequenceOfStructure.hxx>
|
||||||
|
|
||||||
typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
|
|
||||||
typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
|
typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
|
||||||
|
|
||||||
//! Set of OpenGl_Structures for building BVH tree.
|
//! Set of OpenGl_Structures for building BVH tree.
|
||||||
|
@ -419,17 +419,16 @@ Standard_Boolean OpenGl_GraphicDriver::SetImmediateModeDrawToFront (const Graphi
|
|||||||
// function : DisplayImmediateStructure
|
// function : DisplayImmediateStructure
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView& theCView,
|
void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView& theCView,
|
||||||
const Graphic3d_CStructure& theCStructure)
|
const Handle(Graphic3d_Structure)& theStructure)
|
||||||
{
|
{
|
||||||
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
|
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
|
||||||
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
|
|
||||||
if (aCView == NULL)
|
if (aCView == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aCView->View->DisplayImmediateStructure (aStructure);
|
aCView->View->DisplayImmediateStructure (theStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include <gp_Ax2.hxx>
|
#include <gp_Ax2.hxx>
|
||||||
#include <Graphic3d_CView.hxx>
|
#include <Graphic3d_CView.hxx>
|
||||||
#include <Graphic3d_CStructure.hxx>
|
#include <Graphic3d_CStructure.hxx>
|
||||||
#include <Graphic3d_CPick.hxx>
|
|
||||||
#include <Graphic3d_TextPath.hxx>
|
#include <Graphic3d_TextPath.hxx>
|
||||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||||
@ -122,18 +121,18 @@ public:
|
|||||||
|
|
||||||
public: // Methods for graphical structures
|
public: // Methods for graphical structures
|
||||||
|
|
||||||
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
|
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
|
||||||
Graphic3d_CStructure& theCStructure,
|
const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer thePriority);
|
const Standard_Integer thePriority);
|
||||||
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
|
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
|
||||||
Graphic3d_CStructure& theCStructure);
|
const Handle(Graphic3d_Structure)& theStructure);
|
||||||
Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
|
Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
|
||||||
Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView,
|
Standard_EXPORT Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView,
|
||||||
const Standard_Boolean theDrawToFrontBuffer);
|
const Standard_Boolean theDrawToFrontBuffer);
|
||||||
Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView& theCView,
|
Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView& theCView,
|
||||||
const Graphic3d_CStructure& theCStructure);
|
const Handle(Graphic3d_Structure)& theStructure);
|
||||||
Standard_EXPORT void EraseImmediateStructure (const Graphic3d_CView& theCView,
|
Standard_EXPORT void EraseImmediateStructure (const Graphic3d_CView& theCView,
|
||||||
const Graphic3d_CStructure& theCStructure);
|
const Graphic3d_CStructure& theCStructure);
|
||||||
|
|
||||||
@ -259,39 +258,29 @@ public:
|
|||||||
|
|
||||||
//! Add a new top-level z layer with ID theLayerId for the view. Z layers allow drawing structures in higher layers in foreground of structures in lower layers.
|
//! Add a new top-level z layer with ID theLayerId for the view. Z layers allow drawing structures in higher layers in foreground of structures in lower layers.
|
||||||
//! To add a structure to desired layer on display it is necessary to set the layer index for the structure.
|
//! To add a structure to desired layer on display it is necessary to set the layer index for the structure.
|
||||||
Standard_EXPORT void AddZLayer (const Graphic3d_CView& theCView,
|
Standard_EXPORT void AddZLayer (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId);
|
const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Remove Z layer from the specified view.
|
//! Remove Z layer from the specified view.
|
||||||
//! All structures displayed at the moment in layer will be displayed in default layer (the bottom-level z layer).
|
//! All structures displayed at the moment in layer will be displayed in default layer (the bottom-level z layer).
|
||||||
//! To unset layer index from associated structures use method UnsetZLayer (...).
|
//! To unset layer index from associated structures use method UnsetZLayer (...).
|
||||||
Standard_EXPORT void RemoveZLayer (const Graphic3d_CView& theCView,
|
Standard_EXPORT void RemoveZLayer (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId);
|
const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Unset Z layer ID for all structures.
|
//! Unset Z layer ID for all structures.
|
||||||
//! The structure indexes will be set to default layer (the bottom-level z layer with ID = 0).
|
//! The structure indexes will be set to default layer (the bottom-level z layer with ID = 0).
|
||||||
Standard_EXPORT void UnsetZLayer (const Standard_Integer theLayerId);
|
Standard_EXPORT void UnsetZLayer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Change Z layer of a structure.
|
|
||||||
//! The new z layer ID will be used to define the associated layer for structure on display.
|
|
||||||
//! It is recommended to take care of redisplaying the structures already presented in view with previously set layer index.
|
|
||||||
//! This is usually done by viewer manager. Z layers allow drawing structures in higher layers in foreground of structures in lower layers.
|
|
||||||
Standard_EXPORT void ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
|
||||||
const Standard_Integer theLayerId);
|
|
||||||
|
|
||||||
//! Change Z layer of a structure already presented in view.
|
//! Change Z layer of a structure already presented in view.
|
||||||
//! It is recommended to update z layer of already displayed structures with this method before setting new z layer index to the structure.
|
//! It is recommended to update z layer of already displayed structures with this method before setting new z layer index to the structure.
|
||||||
//! This is usually done by viewer manager.
|
//! This is usually done by viewer manager.
|
||||||
Standard_EXPORT void ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
Standard_EXPORT void ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
||||||
const Graphic3d_CView& theCView,
|
const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theNewLayerId);
|
const Graphic3d_ZLayerId theNewLayerId);
|
||||||
|
|
||||||
//! Get Z layer ID of the structure. If the structure doesn't exists in graphic driver, the method returns -1.
|
|
||||||
Standard_EXPORT Standard_Integer GetZLayer (const Graphic3d_CStructure& theCStructure) const;
|
|
||||||
|
|
||||||
//! Sets the settings for a single Z layer of specified view.
|
//! Sets the settings for a single Z layer of specified view.
|
||||||
Standard_EXPORT void SetZLayerSettings (const Graphic3d_CView& theCView,
|
Standard_EXPORT void SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings& theSettings);
|
const Graphic3d_ZLayerSettings& theSettings);
|
||||||
|
|
||||||
//! Changes priority of a structure within its Z layer for the specified view.
|
//! Changes priority of a structure within its Z layer for the specified view.
|
||||||
|
@ -19,27 +19,25 @@
|
|||||||
#include <OpenGl_Structure.hxx>
|
#include <OpenGl_Structure.hxx>
|
||||||
#include <OpenGl_CView.hxx>
|
#include <OpenGl_CView.hxx>
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
|
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
|
||||||
Graphic3d_CStructure& theCStructure,
|
const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer thePriority)
|
const Standard_Integer thePriority)
|
||||||
{
|
{
|
||||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||||
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
|
|
||||||
if (aCView == NULL)
|
if (aCView == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aCView->View->DisplayStructure (aStructure, thePriority);
|
aCView->View->DisplayStructure (theStructure, thePriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
|
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
|
||||||
Graphic3d_CStructure& theCStructure)
|
const Handle(Graphic3d_Structure)& theStructure)
|
||||||
{
|
{
|
||||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||||
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
|
if (aCView == NULL)
|
||||||
if (aCView == NULL || aStructure == NULL)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aCView->View->EraseStructure (aStructure);
|
aCView->View->EraseStructure (theStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
|
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
|
||||||
@ -68,24 +66,8 @@ Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::Structure (const Handle(Graph
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
void OpenGl_GraphicDriver::ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
||||||
const Standard_Integer theLayer)
|
const Graphic3d_CView& theCView,
|
||||||
{
|
const Graphic3d_ZLayerId theNewLayerId)
|
||||||
if (!myMapOfStructure.IsBound (theCStructure.Id))
|
|
||||||
return;
|
|
||||||
|
|
||||||
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id);
|
|
||||||
|
|
||||||
aStructure->SetZLayer (theLayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ChangeZLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
|
||||||
const Graphic3d_CView& theCView,
|
|
||||||
const Standard_Integer theNewLayerId)
|
|
||||||
{
|
{
|
||||||
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
||||||
|
|
||||||
@ -97,34 +79,19 @@ void OpenGl_GraphicDriver::ChangeZLayer (const Graphic3d_CStructure& theCStructu
|
|||||||
aCView->View->ChangeZLayer (aStructure, theNewLayerId);
|
aCView->View->ChangeZLayer (aStructure, theNewLayerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetZLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer OpenGl_GraphicDriver::GetZLayer (const Graphic3d_CStructure& theCStructure) const
|
|
||||||
{
|
|
||||||
if (!myMapOfStructure.IsBound (theCStructure.Id))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id);
|
|
||||||
|
|
||||||
return aStructure->GetZLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : UnsetZLayer
|
//function : UnsetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::UnsetZLayer (const Standard_Integer theLayerId)
|
void OpenGl_GraphicDriver::UnsetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
NCollection_DataMap<Standard_Integer, OpenGl_Structure*>::Iterator aStructIt (myMapOfStructure);
|
NCollection_DataMap<Standard_Integer, OpenGl_Structure*>::Iterator aStructIt (myMapOfStructure);
|
||||||
for( ; aStructIt.More (); aStructIt.Next ())
|
for( ; aStructIt.More (); aStructIt.Next ())
|
||||||
{
|
{
|
||||||
OpenGl_Structure* aStruct = aStructIt.ChangeValue ();
|
OpenGl_Structure* aStruct = aStructIt.ChangeValue ();
|
||||||
if (aStruct->GetZLayer () == theLayerId)
|
if (aStruct->ZLayer() == theLayerId)
|
||||||
aStruct->SetZLayer (0);
|
aStruct->SetZLayer (Graphic3d_ZLayerId_Default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,8 +100,8 @@ void OpenGl_GraphicDriver::UnsetZLayer (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_GraphicDriver::ChangePriority (const Graphic3d_CStructure& theCStructure,
|
void OpenGl_GraphicDriver::ChangePriority (const Graphic3d_CStructure& theCStructure,
|
||||||
const Graphic3d_CView& theCView,
|
const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theNewPriority)
|
const Standard_Integer theNewPriority)
|
||||||
{
|
{
|
||||||
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
||||||
|
|
||||||
|
@ -543,8 +543,8 @@ void OpenGl_GraphicDriver::SetBackFacingModel (const Graphic3d_CView& ACView)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_GraphicDriver::AddZLayer (const Graphic3d_CView& theCView,
|
void OpenGl_GraphicDriver::AddZLayer (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId)
|
const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
||||||
if (aCView)
|
if (aCView)
|
||||||
@ -555,8 +555,8 @@ void OpenGl_GraphicDriver::AddZLayer (const Graphic3d_CView& theCView,
|
|||||||
//function : RemoveZLayer
|
//function : RemoveZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
|
void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId)
|
const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
const OpenGl_CView* aCView = (const OpenGl_CView *)theCView.ptrView;
|
const OpenGl_CView* aCView = (const OpenGl_CView *)theCView.ptrView;
|
||||||
if (aCView)
|
if (aCView)
|
||||||
@ -567,8 +567,8 @@ void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
|
|||||||
//function : SetZLayerSettings
|
//function : SetZLayerSettings
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
|
Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings& theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||||
|
@ -14,24 +14,269 @@
|
|||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
#include <OpenGl_Layer.hxx>
|
#include <OpenGl_Layer.hxx>
|
||||||
#include <OpenGl_Workspace.hxx>
|
|
||||||
#include <OpenGl_GlCore11.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
#include <OpenGl_BVHTreeSelector.hxx>
|
||||||
//function : OpenGl_Layer
|
#include <OpenGl_Structure.hxx>
|
||||||
//purpose :
|
#include <OpenGl_View.hxx>
|
||||||
//=======================================================================
|
#include <OpenGl_Workspace.hxx>
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : OpenGl_PriorityList
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
OpenGl_Layer::OpenGl_Layer (const Standard_Integer theNbPriorities)
|
OpenGl_Layer::OpenGl_Layer (const Standard_Integer theNbPriorities)
|
||||||
: myPriorityList (theNbPriorities)
|
: myArray (0, theNbPriorities - 1),
|
||||||
|
myNbStructures (0),
|
||||||
|
myBVHIsLeftChildQueuedFirst (Standard_True),
|
||||||
|
myIsBVHPrimitivesNeedsReset (Standard_False)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~OpenGl_Layer
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
OpenGl_Layer::~OpenGl_Layer()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : Add
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Layer::Add (const OpenGl_Structure* theStruct,
|
||||||
|
const Standard_Integer thePriority,
|
||||||
|
Standard_Boolean isForChangePriority)
|
||||||
|
{
|
||||||
|
const Standard_Integer anIndex = Min (Max (thePriority, 0), myArray.Length() - 1);
|
||||||
|
if (theStruct == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myArray (anIndex).Append (theStruct);
|
||||||
|
if (theStruct->IsAlwaysRendered())
|
||||||
|
{
|
||||||
|
theStruct->MarkAsNotCulled();
|
||||||
|
}
|
||||||
|
else if (!isForChangePriority)
|
||||||
|
{
|
||||||
|
myBVHPrimitives.Add (theStruct);
|
||||||
|
}
|
||||||
|
++myNbStructures;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : Remove
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
bool OpenGl_Layer::Remove (const OpenGl_Structure* theStruct,
|
||||||
|
Standard_Integer& thePriority,
|
||||||
|
Standard_Boolean isForChangePriority)
|
||||||
|
{
|
||||||
|
if (theStruct == NULL)
|
||||||
|
{
|
||||||
|
thePriority = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Integer aNbPriorities = myArray.Length();
|
||||||
|
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
||||||
|
{
|
||||||
|
OpenGl_SequenceOfStructure& aSeq = myArray (aPriorityIter);
|
||||||
|
for (OpenGl_SequenceOfStructure::Iterator aStructIter (aSeq); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
if (aStructIter.Value() == theStruct)
|
||||||
|
{
|
||||||
|
aSeq.Remove (aStructIter);
|
||||||
|
if (!theStruct->IsAlwaysRendered()
|
||||||
|
&& !isForChangePriority)
|
||||||
|
{
|
||||||
|
myBVHPrimitives.Remove (theStruct);
|
||||||
|
}
|
||||||
|
--myNbStructures;
|
||||||
|
thePriority = aPriorityIter;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
thePriority = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : InvalidateBVHData
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Layer::InvalidateBVHData()
|
||||||
|
{
|
||||||
|
myIsBVHPrimitivesNeedsReset = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : renderAll
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Layer::renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||||
|
{
|
||||||
|
const Standard_Integer aNbPriorities = myArray.Length();
|
||||||
|
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
||||||
|
{
|
||||||
|
for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
const OpenGl_Structure* aStruct = aStructIter.Value();
|
||||||
|
if (!aStruct->IsVisible())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
aStruct->Render (theWorkspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : renderTraverse
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Layer::renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||||
|
{
|
||||||
|
if (myIsBVHPrimitivesNeedsReset)
|
||||||
|
{
|
||||||
|
myBVHPrimitives.Assign (myArray);
|
||||||
|
myIsBVHPrimitivesNeedsReset = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenGl_BVHTreeSelector& aSelector = theWorkspace->ActiveView()->BVHTreeSelector();
|
||||||
|
traverse (aSelector);
|
||||||
|
|
||||||
|
const Standard_Integer aNbPriorities = myArray.Length();
|
||||||
|
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
||||||
|
{
|
||||||
|
for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
const OpenGl_Structure* aStruct = aStructIter.Value();
|
||||||
|
if (!aStruct->IsVisible()
|
||||||
|
|| aStruct->IsCulled())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
aStruct->Render (theWorkspace);
|
||||||
|
aStruct->ResetCullingStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : traverse
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Layer::traverse (OpenGl_BVHTreeSelector& theSelector) const
|
||||||
|
{
|
||||||
|
// handle a case when all objects are infinite
|
||||||
|
if (myBVHPrimitives.Size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >& aBVHTree = myBVHPrimitives.BVH();
|
||||||
|
|
||||||
|
Standard_Integer aNode = 0; // a root node
|
||||||
|
theSelector.CacheClipPtsProjections();
|
||||||
|
if (!theSelector.Intersect (aBVHTree->MinPoint (0),
|
||||||
|
aBVHTree->MaxPoint (0)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer aStack[32];
|
||||||
|
Standard_Integer aHead = -1;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (!aBVHTree->IsOuter (aNode))
|
||||||
|
{
|
||||||
|
const Standard_Integer aLeftChildIdx = aBVHTree->LeftChild (aNode);
|
||||||
|
const Standard_Integer aRightChildIdx = aBVHTree->RightChild (aNode);
|
||||||
|
const Standard_Boolean isLeftChildIn = theSelector.Intersect (aBVHTree->MinPoint (aLeftChildIdx),
|
||||||
|
aBVHTree->MaxPoint (aLeftChildIdx));
|
||||||
|
const Standard_Boolean isRightChildIn = theSelector.Intersect (aBVHTree->MinPoint (aRightChildIdx),
|
||||||
|
aBVHTree->MaxPoint (aRightChildIdx));
|
||||||
|
if (isLeftChildIn
|
||||||
|
&& isRightChildIn)
|
||||||
|
{
|
||||||
|
aNode = myBVHIsLeftChildQueuedFirst ? aLeftChildIdx : aRightChildIdx;
|
||||||
|
++aHead;
|
||||||
|
aStack[aHead] = myBVHIsLeftChildQueuedFirst ? aRightChildIdx : aLeftChildIdx;
|
||||||
|
myBVHIsLeftChildQueuedFirst = !myBVHIsLeftChildQueuedFirst;
|
||||||
|
}
|
||||||
|
else if (isLeftChildIn
|
||||||
|
|| isRightChildIn)
|
||||||
|
{
|
||||||
|
aNode = isLeftChildIn ? aLeftChildIdx : aRightChildIdx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (aHead < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
aNode = aStack[aHead];
|
||||||
|
--aHead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (theSelector.Intersect (aBVHTree->MinPoint (aNode),
|
||||||
|
aBVHTree->MaxPoint (aNode)))
|
||||||
|
{
|
||||||
|
Standard_Integer aIdx = aBVHTree->BegPrimitive (aNode);
|
||||||
|
myBVHPrimitives.GetStructureById (aIdx)->MarkAsNotCulled();
|
||||||
|
if (aHead < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
aNode = aStack[aHead];
|
||||||
|
--aHead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : Append
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Standard_Boolean OpenGl_Layer::Append (const OpenGl_Layer& theOther)
|
||||||
|
{
|
||||||
|
// the source priority list shouldn't have more priorities
|
||||||
|
const Standard_Integer aNbPriorities = theOther.NbPriorities();
|
||||||
|
if (aNbPriorities > NbPriorities())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add all structures to destination priority list
|
||||||
|
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
||||||
|
{
|
||||||
|
for (OpenGl_SequenceOfStructure::Iterator aStructIter (theOther.myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
Add (aStructIter.Value(), aPriorityIter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Render
|
//function : Render
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &theWorkspace, const OpenGl_GlobalLayerSettings& theDefaultSettings) const
|
void OpenGl_Layer::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const OpenGl_GlobalLayerSettings& theDefaultSettings) const
|
||||||
{
|
{
|
||||||
TEL_POFFSET_PARAM anAppliedOffsetParams = theWorkspace->AppliedPolygonOffset();
|
TEL_POFFSET_PARAM anAppliedOffsetParams = theWorkspace->AppliedPolygonOffset();
|
||||||
|
|
||||||
@ -67,17 +312,10 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &theWorkspace, const O
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle depth write
|
// handle depth write
|
||||||
if (IsSettingEnabled (Graphic3d_ZLayerDepthWrite))
|
glDepthMask (IsSettingEnabled (Graphic3d_ZLayerDepthWrite) ? GL_TRUE : GL_FALSE);
|
||||||
{
|
|
||||||
glDepthMask (GL_TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glDepthMask (GL_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// render priority list
|
// render priority list
|
||||||
myPriorityList.Render (theWorkspace);
|
theWorkspace->IsCullingEnabled() ? renderTraverse (theWorkspace) : renderAll (theWorkspace);
|
||||||
|
|
||||||
// always restore polygon offset between layers rendering
|
// always restore polygon offset between layers rendering
|
||||||
theWorkspace->SetPolygonOffset (anAppliedOffsetParams.mode,
|
theWorkspace->SetPolygonOffset (anAppliedOffsetParams.mode,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Created on: 2014-03-31
|
// Created on: 2011-11-02
|
||||||
// Created by: Danila ULYANOV
|
// Created by: Sergey ZERCHANINOV
|
||||||
// Copyright (c) 2014 OPEN CASCADE SAS
|
// Copyright (c) 2011-2015 OPEN CASCADE SAS
|
||||||
//
|
//
|
||||||
// This file is part of Open CASCADE Technology software library.
|
// This file is part of Open CASCADE Technology software library.
|
||||||
//
|
//
|
||||||
@ -16,7 +16,15 @@
|
|||||||
#ifndef _OpenGl_Layer_Header
|
#ifndef _OpenGl_Layer_Header
|
||||||
#define _OpenGl_Layer_Header
|
#define _OpenGl_Layer_Header
|
||||||
|
|
||||||
#include <OpenGl_PriorityList.hxx>
|
#include <NCollection_Sequence.hxx>
|
||||||
|
#include <NCollection_Array1.hxx>
|
||||||
|
|
||||||
|
#include <InterfaceGraphic_telem.hxx>
|
||||||
|
|
||||||
|
#include <Handle_OpenGl_Workspace.hxx>
|
||||||
|
#include <OpenGl_BVHClipPrimitiveSet.hxx>
|
||||||
|
#include <OpenGl_BVHTreeSelector.hxx>
|
||||||
|
|
||||||
#include <Graphic3d_ZLayerSettings.hxx>
|
#include <Graphic3d_ZLayerSettings.hxx>
|
||||||
#include <OpenGl_GlCore11.hxx>
|
#include <OpenGl_GlCore11.hxx>
|
||||||
|
|
||||||
@ -28,6 +36,7 @@ struct OpenGl_GlobalLayerSettings
|
|||||||
GLboolean DepthMask;
|
GLboolean DepthMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Presentations list sorted within priorities.
|
||||||
class OpenGl_Layer
|
class OpenGl_Layer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -35,11 +44,14 @@ public:
|
|||||||
//! Initializes associated priority list and layer properties
|
//! Initializes associated priority list and layer properties
|
||||||
OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
|
OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
virtual ~OpenGl_Layer();
|
||||||
|
|
||||||
//! Returns settings of the layer object.
|
//! Returns settings of the layer object.
|
||||||
const Graphic3d_ZLayerSettings LayerSettings() const { return myLayerSettings; };
|
const Graphic3d_ZLayerSettings& LayerSettings() const { return myLayerSettings; };
|
||||||
|
|
||||||
//! Sets settings of the layer object.
|
//! Sets settings of the layer object.
|
||||||
void SetLayerSettings (Graphic3d_ZLayerSettings theSettings)
|
void SetLayerSettings (const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
myLayerSettings = theSettings;
|
myLayerSettings = theSettings;
|
||||||
}
|
}
|
||||||
@ -50,18 +62,60 @@ public:
|
|||||||
return myLayerSettings.IsSettingEnabled (theSetting);
|
return myLayerSettings.IsSettingEnabled (theSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns reference to associated priority list.
|
void Add (const OpenGl_Structure* theStruct,
|
||||||
OpenGl_PriorityList& PriorityList() { return myPriorityList; }
|
const Standard_Integer thePriority,
|
||||||
|
Standard_Boolean isForChangePriority = Standard_False);
|
||||||
|
|
||||||
//! Returns const reference to associated priority list.
|
//! Remove structure and returns its priority, if the structure is not found, method returns negative value
|
||||||
const OpenGl_PriorityList& PriorityList() const { return myPriorityList; }
|
bool Remove (const OpenGl_Structure* theStruct,
|
||||||
|
Standard_Integer& thePriority,
|
||||||
|
Standard_Boolean isForChangePriority = Standard_False);
|
||||||
|
|
||||||
void Render (const Handle(OpenGl_Workspace) &AWorkspace, const OpenGl_GlobalLayerSettings& theDefaultSettings) const;
|
//! @return the number of structures
|
||||||
|
Standard_Integer NbStructures() const { return myNbStructures; }
|
||||||
|
|
||||||
|
//! Returns the number of available priority levels
|
||||||
|
Standard_Integer NbPriorities() const { return myArray.Length(); }
|
||||||
|
|
||||||
|
//! Append layer of acceptable type (with similar number of priorities or less).
|
||||||
|
//! Returns Standard_False if the list can not be accepted.
|
||||||
|
Standard_Boolean Append (const OpenGl_Layer& theOther);
|
||||||
|
|
||||||
|
//! Returns array of OpenGL structures.
|
||||||
|
const OpenGl_ArrayOfStructure& ArrayOfStructures() const { return myArray; }
|
||||||
|
|
||||||
|
//! Marks BVH tree for given priority list as dirty and
|
||||||
|
//! marks primitive set for rebuild.
|
||||||
|
void InvalidateBVHData();
|
||||||
|
|
||||||
|
// Render all structures.
|
||||||
|
void Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const OpenGl_GlobalLayerSettings& theDefaultSettings) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Traverses through BVH tree to determine which structures are in view volume.
|
||||||
|
void traverse (OpenGl_BVHTreeSelector& theSelector) const;
|
||||||
|
|
||||||
|
//! Iterates through the hierarchical list of existing structures and renders them all.
|
||||||
|
void renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
|
|
||||||
|
//! Iterates through the hierarchical list of existing structures and renders only overlapping ones.
|
||||||
|
void renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
OpenGl_PriorityList myPriorityList; //!< Associated priority list object.
|
OpenGl_ArrayOfStructure myArray;
|
||||||
|
Standard_Integer myNbStructures;
|
||||||
|
Graphic3d_ZLayerSettings myLayerSettings; //!< Layer setting flags
|
||||||
|
mutable OpenGl_BVHClipPrimitiveSet myBVHPrimitives; //<! Set of OpenGl_Structures for building BVH tree
|
||||||
|
mutable Standard_Boolean myBVHIsLeftChildQueuedFirst; //<! Is needed for implementation of stochastic order of BVH traverse
|
||||||
|
mutable Standard_Boolean myIsBVHPrimitivesNeedsReset; //<! Defines if the primitive set for BVH is outdated
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
Graphic3d_ZLayerSettings myLayerSettings; //!< Layer setting flags.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_OpenGl_Layer_Header
|
#endif //_OpenGl_Layer_Header
|
||||||
|
@ -28,12 +28,22 @@
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
||||||
: myNbPriorities (theNbPriorities),
|
: myNbPriorities (theNbPriorities),
|
||||||
myNbStructures (0)
|
myNbStructures (0),
|
||||||
|
myImmediateNbStructures (0)
|
||||||
{
|
{
|
||||||
// insert default priority layer
|
// insert default priority layers
|
||||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||||
myLayerIds.Bind (0, myLayers.Length());
|
myLayerIds.Bind (Graphic3d_ZLayerId_Default, myLayers.Upper());
|
||||||
|
|
||||||
|
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||||
|
myLayerIds.Bind (Graphic3d_ZLayerId_Top, myLayers.Upper());
|
||||||
|
|
||||||
|
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||||
|
myLayerIds.Bind (Graphic3d_ZLayerId_Topmost, myLayers.Upper());
|
||||||
|
|
||||||
|
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||||
|
myLayerIds.Bind (Graphic3d_ZLayerId_TopOSD, myLayers.Upper());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -41,71 +51,32 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
|||||||
//purpose : Destructor
|
//purpose : Destructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
OpenGl_LayerList::~OpenGl_LayerList ()
|
OpenGl_LayerList::~OpenGl_LayerList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : defaultLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
OpenGl_Layer& OpenGl_LayerList::defaultLayer()
|
|
||||||
{
|
|
||||||
return myLayers.ChangeValue (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbPriorities
|
|
||||||
//purpose : Method returns the number of available priorities
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer OpenGl_LayerList::NbPriorities () const
|
|
||||||
{
|
|
||||||
return myNbPriorities;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbStructures
|
|
||||||
//purpose : Method returns the number of available structures
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer OpenGl_LayerList::NbStructures () const
|
|
||||||
{
|
|
||||||
return myNbStructures;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AddLayer
|
//function : AddLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_LayerList::AddLayer (const Standard_Integer theLayerId)
|
void OpenGl_LayerList::AddLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
if (HasLayer (theLayerId))
|
if (myLayerIds.IsBound (theLayerId))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// add the new layer
|
// add the new layer
|
||||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||||
myLayerIds.Bind (theLayerId, myLayers.Length());
|
myLayerIds.Bind (theLayerId, myLayers.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : HasLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean OpenGl_LayerList::HasLayer
|
|
||||||
(const Standard_Integer theLayerId) const
|
|
||||||
{
|
|
||||||
return myLayerIds.IsBound (theLayerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Layer
|
//function : Layer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
OpenGl_Layer& OpenGl_LayerList::Layer (const Standard_Integer theLayerId)
|
OpenGl_Layer& OpenGl_LayerList::Layer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
return myLayers.ChangeValue (myLayerIds.Find (theLayerId));
|
return myLayers.ChangeValue (myLayerIds.Find (theLayerId));
|
||||||
}
|
}
|
||||||
@ -114,7 +85,7 @@ OpenGl_Layer& OpenGl_LayerList::Layer (const Standard_Integer theLayerId)
|
|||||||
//function : Layer
|
//function : Layer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
const OpenGl_Layer& OpenGl_LayerList::Layer (const Standard_Integer theLayerId) const
|
const OpenGl_Layer& OpenGl_LayerList::Layer (const Graphic3d_ZLayerId theLayerId) const
|
||||||
{
|
{
|
||||||
return myLayers.Value (myLayerIds.Find (theLayerId));
|
return myLayers.Value (myLayerIds.Find (theLayerId));
|
||||||
}
|
}
|
||||||
@ -124,16 +95,19 @@ const OpenGl_Layer& OpenGl_LayerList::Layer (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_LayerList::RemoveLayer (const Standard_Integer theLayerId)
|
void OpenGl_LayerList::RemoveLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
if (!HasLayer (theLayerId) || theLayerId == 0)
|
if (!myLayerIds.IsBound (theLayerId)
|
||||||
|
|| theLayerId <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Integer aRemovePos = myLayerIds.Find (theLayerId);
|
const Standard_Integer aRemovePos = myLayerIds.Find (theLayerId);
|
||||||
|
|
||||||
// move all displayed structures to first layer
|
// move all displayed structures to first layer
|
||||||
const OpenGl_PriorityList& aList = myLayers.Value (aRemovePos).PriorityList();
|
const OpenGl_Layer& aLayerToMove = myLayers.Value (aRemovePos);
|
||||||
defaultLayer ().PriorityList().Append (aList);
|
myLayers.ChangeFirst().Append (aLayerToMove);
|
||||||
|
|
||||||
// remove layer
|
// remove layer
|
||||||
myLayers.Remove (aRemovePos);
|
myLayers.Remove (aRemovePos);
|
||||||
@ -154,18 +128,23 @@ void OpenGl_LayerList::RemoveLayer (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_LayerList::AddStructure (const OpenGl_Structure *theStructure,
|
void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Standard_Integer thePriority,
|
const Standard_Integer thePriority,
|
||||||
Standard_Boolean isForChangePriority)
|
Standard_Boolean isForChangePriority)
|
||||||
{
|
{
|
||||||
// add structure to associated layer,
|
// add structure to associated layer,
|
||||||
// if layer doesn't exists, display structure in default layer
|
// if layer doesn't exists, display structure in default layer
|
||||||
OpenGl_PriorityList& aList = !HasLayer (theLayerId) ? defaultLayer ().PriorityList() :
|
Standard_Integer aSeqPos = myLayers.Lower();
|
||||||
myLayers.ChangeValue (myLayerIds.Find (theLayerId)).PriorityList();
|
myLayerIds.Find (theLayerId, aSeqPos);
|
||||||
|
|
||||||
aList.Add (theStructure, thePriority, isForChangePriority);
|
OpenGl_Layer& aLayer = myLayers.ChangeValue (aSeqPos);
|
||||||
myNbStructures++;
|
aLayer.Add (theStruct, thePriority, isForChangePriority);
|
||||||
|
++myNbStructures;
|
||||||
|
if (aLayer.LayerSettings().IsImmediate)
|
||||||
|
{
|
||||||
|
++myImmediateNbStructures;
|
||||||
|
}
|
||||||
|
|
||||||
// Note: In ray-tracing mode we don't modify modification
|
// Note: In ray-tracing mode we don't modify modification
|
||||||
// state here. It is redundant, because the possible changes
|
// state here. It is redundant, because the possible changes
|
||||||
@ -174,50 +153,61 @@ void OpenGl_LayerList::AddStructure (const OpenGl_Structure *theStructure,
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : RemoveStructure
|
//function : RemoveStructure
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure *theStructure,
|
void OpenGl_LayerList::RemoveStructure (const Handle(Graphic3d_Structure)& theStructure)
|
||||||
const Standard_Integer theLayerId)
|
|
||||||
{
|
{
|
||||||
Standard_Integer aSeqPos = !HasLayer (theLayerId) ?
|
const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure* > (theStructure->CStructure().operator->());
|
||||||
1 : myLayerIds.Find (theLayerId);
|
const Graphic3d_ZLayerId aLayerId = aStruct->ZLayer();
|
||||||
|
|
||||||
OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
|
Standard_Integer aSeqPos = myLayers.Lower();
|
||||||
|
myLayerIds.Find (aLayerId, aSeqPos);
|
||||||
|
|
||||||
|
OpenGl_Layer& aLayer = myLayers.ChangeValue (aSeqPos);
|
||||||
|
Standard_Integer aPriority = -1;
|
||||||
|
|
||||||
// remove structure from associated list
|
// remove structure from associated list
|
||||||
// if the structure is not found there,
|
// if the structure is not found there,
|
||||||
// scan through layers and remove it
|
// scan through layers and remove it
|
||||||
if (aList.Remove (theStructure) >= 0)
|
if (aLayer.Remove (aStruct, aPriority))
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
--myNbStructures;
|
||||||
|
if (aLayer.LayerSettings().IsImmediate)
|
||||||
if (theStructure->IsRaytracable())
|
|
||||||
{
|
{
|
||||||
myModificationState++;
|
--myImmediateNbStructures;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aStruct->IsRaytracable())
|
||||||
|
{
|
||||||
|
++myModificationState;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// scan through layers and remove it
|
// scan through layers and remove it
|
||||||
Standard_Integer aSeqId = 1;
|
Standard_Integer aSeqId = 1;
|
||||||
OpenGl_SequenceOfLayers::Iterator anIts;
|
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
|
||||||
for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
|
|
||||||
{
|
{
|
||||||
OpenGl_PriorityList& aScanList = anIts.ChangeValue ().PriorityList();
|
OpenGl_Layer& aLayerEx = anIts.ChangeValue();
|
||||||
if (aSeqPos == aSeqId)
|
if (aSeqPos == aSeqId)
|
||||||
continue;
|
|
||||||
|
|
||||||
if (aScanList.Remove (theStructure) >= 0)
|
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (theStructure->IsRaytracable())
|
if (aLayerEx.Remove (aStruct, aPriority))
|
||||||
|
{
|
||||||
|
--myNbStructures;
|
||||||
|
if (aLayerEx.LayerSettings().IsImmediate)
|
||||||
{
|
{
|
||||||
myModificationState++;
|
--myImmediateNbStructures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aStruct->IsRaytracable())
|
||||||
|
{
|
||||||
|
++myModificationState;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,14 +217,12 @@ void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure *theStructure,
|
|||||||
//function : InvalidateBVHData
|
//function : InvalidateBVHData
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_LayerList::InvalidateBVHData (const Standard_Integer theLayerId)
|
void OpenGl_LayerList::InvalidateBVHData (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
Standard_Integer aSeqPos = !HasLayer (theLayerId) ?
|
Standard_Integer aSeqPos = myLayers.Lower();
|
||||||
1 : myLayerIds.Find (theLayerId);
|
myLayerIds.Find (theLayerId, aSeqPos);
|
||||||
|
OpenGl_Layer& aLayer = myLayers.ChangeValue (aSeqPos);
|
||||||
OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
|
aLayer.InvalidateBVHData();
|
||||||
|
|
||||||
aList.InvalidateBVHData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -242,44 +230,54 @@ void OpenGl_LayerList::InvalidateBVHData (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
|
void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theOldLayerId,
|
const Graphic3d_ZLayerId theOldLayerId,
|
||||||
const Standard_Integer theNewLayerId)
|
const Graphic3d_ZLayerId theNewLayerId)
|
||||||
{
|
{
|
||||||
Standard_Integer aSeqPos = !HasLayer (theOldLayerId) ?
|
Standard_Integer aSeqPos = myLayers.Lower();
|
||||||
1 : myLayerIds.Find (theOldLayerId);
|
myLayerIds.Find (theOldLayerId, aSeqPos);
|
||||||
|
OpenGl_Layer& aLayer = myLayers.ChangeValue (aSeqPos);
|
||||||
OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
|
Standard_Integer aPriority = -1;
|
||||||
Standard_Integer aPriority;
|
|
||||||
|
|
||||||
// take priority and remove structure from list found by <theOldLayerId>
|
// take priority and remove structure from list found by <theOldLayerId>
|
||||||
// if the structure is not found there, scan through all other layers
|
// if the structure is not found there, scan through all other layers
|
||||||
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
if (aLayer.Remove (theStructure, aPriority, Standard_True))
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
--myNbStructures;
|
||||||
|
if (aLayer.LayerSettings().IsImmediate)
|
||||||
|
{
|
||||||
|
--myImmediateNbStructures;
|
||||||
|
}
|
||||||
|
|
||||||
// isForChangePriority should be Standard_False below, because we want
|
// isForChangePriority should be Standard_False below, because we want
|
||||||
// the BVH tree in the target layer to be updated with theStructure
|
// the BVH tree in the target layer to be updated with theStructure
|
||||||
AddStructure (theStructure, theNewLayerId, aPriority);
|
AddStructure (theStructure, theNewLayerId, aPriority);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// scan through layers and remove it
|
||||||
|
Standard_Integer aSeqId = 1;
|
||||||
|
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
|
||||||
{
|
{
|
||||||
// scan through layers and remove it
|
if (aSeqPos == aSeqId)
|
||||||
Standard_Integer aSeqId = 1;
|
|
||||||
OpenGl_SequenceOfLayers::Iterator anIts;
|
|
||||||
for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
|
|
||||||
{
|
{
|
||||||
if (aSeqPos == aSeqId)
|
continue;
|
||||||
continue;
|
}
|
||||||
|
|
||||||
// try to remove structure and get priority value from this layer
|
// try to remove structure and get priority value from this layer
|
||||||
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
OpenGl_Layer& aLayerEx = anIts.ChangeValue();
|
||||||
|
if (aLayerEx.Remove (theStructure, aPriority, Standard_True))
|
||||||
|
{
|
||||||
|
--myNbStructures;
|
||||||
|
if (aLayerEx.LayerSettings().IsImmediate)
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
--myImmediateNbStructures;
|
||||||
// isForChangePriority should be Standard_False below, because we want
|
|
||||||
// the BVH tree in the target layer to be updated with theStructure
|
|
||||||
AddStructure (theStructure, theNewLayerId, aPriority);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isForChangePriority should be Standard_False below, because we want
|
||||||
|
// the BVH tree in the target layer to be updated with theStructure
|
||||||
|
AddStructure (theStructure, theNewLayerId, aPriority);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,62 +286,112 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
|
|||||||
//function : ChangePriority
|
//function : ChangePriority
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_LayerList::ChangePriority (const OpenGl_Structure *theStructure,
|
void OpenGl_LayerList::ChangePriority (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Standard_Integer theNewPriority)
|
const Standard_Integer theNewPriority)
|
||||||
{
|
{
|
||||||
Standard_Integer aSeqPos = !HasLayer (theLayerId) ?
|
Standard_Integer aSeqPos = myLayers.Lower();
|
||||||
1 : myLayerIds.Find (theLayerId);
|
myLayerIds.Find (theLayerId, aSeqPos);
|
||||||
|
OpenGl_Layer& aLayer = myLayers.ChangeValue (aSeqPos);
|
||||||
|
Standard_Integer anOldPriority = -1;
|
||||||
|
|
||||||
OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
|
if (aLayer.Remove (theStructure, anOldPriority, Standard_True))
|
||||||
|
|
||||||
if (aList.Remove (theStructure, Standard_True) >= 0)
|
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
--myNbStructures;
|
||||||
AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
|
if (aLayer.LayerSettings().IsImmediate)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Standard_Integer aSeqId = 1;
|
|
||||||
OpenGl_SequenceOfLayers::Iterator anIts;
|
|
||||||
for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
|
|
||||||
{
|
{
|
||||||
if (aSeqPos == aSeqId)
|
--myImmediateNbStructures;
|
||||||
continue;
|
}
|
||||||
|
|
||||||
if (aList.Remove (theStructure, Standard_True) >= 0)
|
AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer aSeqId = 1;
|
||||||
|
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
|
||||||
|
{
|
||||||
|
if (aSeqPos == aSeqId)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenGl_Layer& aLayerEx = anIts.ChangeValue();
|
||||||
|
if (aLayerEx.Remove (theStructure, anOldPriority, Standard_True))
|
||||||
|
{
|
||||||
|
--myNbStructures;
|
||||||
|
if (aLayerEx.LayerSettings().IsImmediate)
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
--myImmediateNbStructures;
|
||||||
AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetLayerSettings
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void OpenGl_LayerList::SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
|
{
|
||||||
|
OpenGl_Layer& aLayer = Layer (theLayerId);
|
||||||
|
if (aLayer.LayerSettings().IsImmediate != theSettings.IsImmediate)
|
||||||
|
{
|
||||||
|
if (theSettings.IsImmediate)
|
||||||
|
{
|
||||||
|
myImmediateNbStructures += aLayer.NbStructures();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myImmediateNbStructures -= aLayer.NbStructures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aLayer.SetLayerSettings (theSettings);
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Render
|
//function : Render
|
||||||
//purpose : Render this element
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace) &theWorkspace) const
|
const Standard_Boolean theToDrawImmediate) const
|
||||||
{
|
{
|
||||||
OpenGl_GlobalLayerSettings aDefaultSettings;
|
OpenGl_GlobalLayerSettings aDefaultSettings;
|
||||||
|
|
||||||
glGetIntegerv (GL_DEPTH_FUNC, &aDefaultSettings.DepthFunc);
|
|
||||||
glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
|
|
||||||
|
|
||||||
OpenGl_SequenceOfLayers::Iterator anIts;
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
for (anIts.Init (myLayers); anIts.More(); anIts.Next())
|
aCtx->core11fwd->glGetIntegerv (GL_DEPTH_FUNC, &aDefaultSettings.DepthFunc);
|
||||||
|
aCtx->core11fwd->glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
|
||||||
|
|
||||||
|
Standard_Integer aSeqId = myLayers.Lower();
|
||||||
|
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
|
||||||
{
|
{
|
||||||
const OpenGl_Layer& aLayer = anIts.Value ();
|
const OpenGl_Layer& aLayer = anIts.Value();
|
||||||
if (aLayer.PriorityList().NbStructures () > 0)
|
if (aLayer.NbStructures() < 1)
|
||||||
{
|
{
|
||||||
// render layer
|
continue;
|
||||||
aLayer.Render (theWorkspace, aDefaultSettings);
|
|
||||||
}
|
}
|
||||||
|
else if (theToDrawImmediate)
|
||||||
|
{
|
||||||
|
if (!aLayer.LayerSettings().IsImmediate)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (aLayer.LayerSettings().IsImmediate)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// render layer
|
||||||
|
aLayer.Render (theWorkspace, aDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDepthMask (aDefaultSettings.DepthMask);
|
aCtx->core11fwd->glDepthMask (aDefaultSettings.DepthMask);
|
||||||
glDepthFunc (aDefaultSettings.DepthFunc);
|
aCtx->core11fwd->glDepthFunc (aDefaultSettings.DepthFunc);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#ifndef _OpenGl_LayerList_Header
|
#ifndef _OpenGl_LayerList_Header
|
||||||
#define _OpenGl_LayerList_Header
|
#define _OpenGl_LayerList_Header
|
||||||
|
|
||||||
#include <OpenGl_PriorityList.hxx>
|
|
||||||
#include <OpenGl_Layer.hxx>
|
#include <OpenGl_Layer.hxx>
|
||||||
|
|
||||||
#include <InterfaceGraphic_telem.hxx>
|
#include <InterfaceGraphic_telem.hxx>
|
||||||
@ -32,89 +31,92 @@ typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
|
|||||||
|
|
||||||
class OpenGl_LayerList
|
class OpenGl_LayerList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
|
OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~OpenGl_LayerList ();
|
virtual ~OpenGl_LayerList();
|
||||||
|
|
||||||
//! Method returns the number of available priorities
|
//! Method returns the number of available priorities
|
||||||
Standard_Integer NbPriorities () const;
|
Standard_Integer NbPriorities() const { return myNbPriorities; }
|
||||||
|
|
||||||
//! Number of displayed structures
|
//! Number of displayed structures
|
||||||
Standard_Integer NbStructures () const;
|
Standard_Integer NbStructures() const { return myNbStructures; }
|
||||||
|
|
||||||
|
//! Return number of structures within immediate layers
|
||||||
|
Standard_Integer NbImmediateStructures() const { return myImmediateNbStructures; }
|
||||||
|
|
||||||
//! Insert a new layer with id.
|
//! Insert a new layer with id.
|
||||||
void AddLayer (const Standard_Integer theLayerId);
|
void AddLayer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Check whether the layer with given id is already created.
|
|
||||||
Standard_Boolean HasLayer (const Standard_Integer theLayerId) const;
|
|
||||||
|
|
||||||
//! Remove layer by its id.
|
//! Remove layer by its id.
|
||||||
void RemoveLayer (const Standard_Integer theLayerId);
|
void RemoveLayer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Add structure to list with given priority. The structure will be inserted
|
//! Add structure to list with given priority. The structure will be inserted
|
||||||
//! to specified layer. If the layer isn't found, the structure will be put
|
//! to specified layer. If the layer isn't found, the structure will be put
|
||||||
//! to default bottom-level layer.
|
//! to default bottom-level layer.
|
||||||
void AddStructure (const OpenGl_Structure *theStructure,
|
void AddStructure (const OpenGl_Structure* theStruct,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Standard_Integer thePriority,
|
const Standard_Integer thePriority,
|
||||||
Standard_Boolean isForChangePriority = Standard_False);
|
Standard_Boolean isForChangePriority = Standard_False);
|
||||||
|
|
||||||
//! Remove structure from structure list and return its previous priority
|
//! Remove structure from structure list and return its previous priority
|
||||||
void RemoveStructure (const OpenGl_Structure *theStructure,
|
void RemoveStructure (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
const Standard_Integer theZLayerId);
|
|
||||||
|
|
||||||
//! Change structure z layer
|
//! Change structure z layer
|
||||||
//! If the new layer is not presented, the structure will be displayed
|
//! If the new layer is not presented, the structure will be displayed
|
||||||
//! in default z layer
|
//! in default z layer
|
||||||
void ChangeLayer (const OpenGl_Structure *theStructure,
|
void ChangeLayer (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theOldLayerId,
|
const Graphic3d_ZLayerId theOldLayerId,
|
||||||
const Standard_Integer theNewLayerId);
|
const Graphic3d_ZLayerId theNewLayerId);
|
||||||
|
|
||||||
//! Changes structure priority within its ZLayer
|
//! Changes structure priority within its ZLayer
|
||||||
void ChangePriority (const OpenGl_Structure *theStructure,
|
void ChangePriority (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theLayerId,
|
const Graphic3d_ZLayerId theLayerId,
|
||||||
const Standard_Integer theNewPriority);
|
const Standard_Integer theNewPriority);
|
||||||
|
|
||||||
//! Returns reference to the layer with given ID.
|
//! Returns reference to the layer with given ID.
|
||||||
OpenGl_Layer& Layer (const Standard_Integer theLayerId);
|
OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Returns reference to the layer with given ID.
|
//! Returns reference to the layer with given ID.
|
||||||
const OpenGl_Layer& Layer (const Standard_Integer theLayerId) const;
|
const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const;
|
||||||
|
|
||||||
|
//! Assign new settings to the layer.
|
||||||
|
void SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
|
const Graphic3d_ZLayerSettings& theSettings);
|
||||||
|
|
||||||
//! Render this element
|
//! Render this element
|
||||||
void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
|
void Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const Standard_Boolean theToDrawImmediate) const;
|
||||||
|
|
||||||
//! Returns the set of OpenGL Z-layers.
|
//! Returns the set of OpenGL Z-layers.
|
||||||
const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
|
const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
|
||||||
|
|
||||||
//! Marks BVH tree for given priority list as dirty and
|
//! Marks BVH tree for given priority list as dirty and
|
||||||
//! marks primitive set for rebuild.
|
//! marks primitive set for rebuild.
|
||||||
void InvalidateBVHData (const Standard_Integer theLayerId);
|
void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Returns structure modification state (for ray-tracing).
|
//! Returns structure modification state (for ray-tracing).
|
||||||
Standard_Size ModificationState() const { return myModificationState; }
|
Standard_Size ModificationState() const { return myModificationState; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
//! Get default layer
|
|
||||||
OpenGl_Layer& defaultLayer ();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// number of structures temporary put to default layer
|
// number of structures temporary put to default layer
|
||||||
OpenGl_SequenceOfLayers myLayers;
|
OpenGl_SequenceOfLayers myLayers;
|
||||||
OpenGl_LayerSeqIds myLayerIds;
|
OpenGl_LayerSeqIds myLayerIds;
|
||||||
|
|
||||||
Standard_Integer myNbPriorities;
|
Standard_Integer myNbPriorities;
|
||||||
Standard_Integer myNbStructures;
|
Standard_Integer myNbStructures;
|
||||||
|
Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers
|
||||||
|
|
||||||
mutable Standard_Size myModificationState;
|
mutable Standard_Size myModificationState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_OpenGl_LayerList_Header
|
#endif //_OpenGl_LayerList_Header
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
#define _OpenGl_NamedStatus_Header
|
#define _OpenGl_NamedStatus_Header
|
||||||
|
|
||||||
// Dynamic fields
|
// Dynamic fields
|
||||||
#define OPENGL_NS_HIDE (1<<0)
|
|
||||||
#define OPENGL_NS_HIGHLIGHT (1<<1)
|
#define OPENGL_NS_HIGHLIGHT (1<<1)
|
||||||
#define OPENGL_NS_RESMAT (1<<2)
|
#define OPENGL_NS_RESMAT (1<<2)
|
||||||
#define OPENGL_NS_IMMEDIATE (1<<3)
|
|
||||||
#define OPENGL_NS_TEXTURE (1<<4)
|
#define OPENGL_NS_TEXTURE (1<<4)
|
||||||
#define OPENGL_NS_ANTIALIASING (1<<5)
|
#define OPENGL_NS_ANTIALIASING (1<<5)
|
||||||
#define OPENGL_NS_2NDPASSNEED (1<<6)
|
#define OPENGL_NS_2NDPASSNEED (1<<6)
|
||||||
|
@ -1,271 +0,0 @@
|
|||||||
// Created on: 2011-11-02
|
|
||||||
// Created by: Sergey ZERCHANINOV
|
|
||||||
// Copyright (c) 2011-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <OpenGl_PriorityList.hxx>
|
|
||||||
|
|
||||||
#include <OpenGl_BVHTreeSelector.hxx>
|
|
||||||
#include <OpenGl_Structure.hxx>
|
|
||||||
#include <OpenGl_View.hxx>
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : OpenGl_PriorityList
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
OpenGl_PriorityList::OpenGl_PriorityList (const Standard_Integer theNbPriorities)
|
|
||||||
: myArray (0, theNbPriorities - 1),
|
|
||||||
myNbStructures (0),
|
|
||||||
myBVHIsLeftChildQueuedFirst (Standard_True),
|
|
||||||
myIsBVHPrimitivesNeedsReset (Standard_False)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : ~OpenGl_PriorityList
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
OpenGl_PriorityList::~OpenGl_PriorityList()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Add
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::Add (const OpenGl_Structure* theStructure,
|
|
||||||
const Standard_Integer thePriority,
|
|
||||||
Standard_Boolean isForChangePriority)
|
|
||||||
{
|
|
||||||
const Standard_Integer anIndex = Min (Max (thePriority, 0), myArray.Length() - 1);
|
|
||||||
|
|
||||||
myArray (anIndex).Append (theStructure);
|
|
||||||
if (theStructure->IsAlwaysRendered())
|
|
||||||
{
|
|
||||||
theStructure->MarkAsNotCulled();
|
|
||||||
}
|
|
||||||
else if (!isForChangePriority)
|
|
||||||
{
|
|
||||||
myBVHPrimitives.Add (theStructure);
|
|
||||||
}
|
|
||||||
++myNbStructures;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Remove
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Integer OpenGl_PriorityList::Remove (const OpenGl_Structure* theStructure,
|
|
||||||
Standard_Boolean isForChangePriority)
|
|
||||||
{
|
|
||||||
const Standard_Integer aNbPriorities = myArray.Length();
|
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIter;
|
|
||||||
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
|
||||||
{
|
|
||||||
OpenGl_SequenceOfStructure& aSeq = myArray (aPriorityIter);
|
|
||||||
for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
|
|
||||||
{
|
|
||||||
if (aStructIter.Value() == theStructure)
|
|
||||||
{
|
|
||||||
aSeq.Remove (aStructIter);
|
|
||||||
if (!theStructure->IsAlwaysRendered()
|
|
||||||
&& !isForChangePriority)
|
|
||||||
{
|
|
||||||
myBVHPrimitives.Remove (theStructure);
|
|
||||||
}
|
|
||||||
--myNbStructures;
|
|
||||||
return aPriorityIter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : InvalidateBVHData
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::InvalidateBVHData()
|
|
||||||
{
|
|
||||||
myIsBVHPrimitivesNeedsReset = Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Render
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|
||||||
{
|
|
||||||
theWorkspace->IsCullingEnabled() ? renderTraverse (theWorkspace) : renderAll (theWorkspace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : renderAll
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|
||||||
{
|
|
||||||
const Standard_Integer aNbPriorities = myArray.Length();
|
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIter;
|
|
||||||
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
|
||||||
{
|
|
||||||
for (aStructIter.Init (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
|
|
||||||
{
|
|
||||||
aStructIter.Value()->Render (theWorkspace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : renderTraverse
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|
||||||
{
|
|
||||||
if (myIsBVHPrimitivesNeedsReset)
|
|
||||||
{
|
|
||||||
myBVHPrimitives.Assign (myArray);
|
|
||||||
myIsBVHPrimitivesNeedsReset = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenGl_BVHTreeSelector& aSelector = theWorkspace->ActiveView()->BVHTreeSelector();
|
|
||||||
traverse (aSelector);
|
|
||||||
|
|
||||||
const Standard_Integer aNbPriorities = myArray.Length();
|
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIter;
|
|
||||||
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
|
||||||
{
|
|
||||||
for (aStructIter.Init (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
|
|
||||||
{
|
|
||||||
if (!aStructIter.Value()->IsCulled())
|
|
||||||
{
|
|
||||||
aStructIter.Value()->Render (theWorkspace);
|
|
||||||
aStructIter.Value()->ResetCullingStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : traverse
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_PriorityList::traverse (OpenGl_BVHTreeSelector& theSelector) const
|
|
||||||
{
|
|
||||||
// handle a case when all objects are infinite
|
|
||||||
if (myBVHPrimitives.Size() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >& aBVHTree = myBVHPrimitives.BVH();
|
|
||||||
|
|
||||||
Standard_Integer aNode = 0; // a root node
|
|
||||||
theSelector.CacheClipPtsProjections();
|
|
||||||
if (!theSelector.Intersect (aBVHTree->MinPoint (0),
|
|
||||||
aBVHTree->MaxPoint (0)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aStack[32];
|
|
||||||
Standard_Integer aHead = -1;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
if (!aBVHTree->IsOuter (aNode))
|
|
||||||
{
|
|
||||||
const Standard_Integer aLeftChildIdx = aBVHTree->LeftChild (aNode);
|
|
||||||
const Standard_Integer aRightChildIdx = aBVHTree->RightChild (aNode);
|
|
||||||
const Standard_Boolean isLeftChildIn = theSelector.Intersect (aBVHTree->MinPoint (aLeftChildIdx),
|
|
||||||
aBVHTree->MaxPoint (aLeftChildIdx));
|
|
||||||
const Standard_Boolean isRightChildIn = theSelector.Intersect (aBVHTree->MinPoint (aRightChildIdx),
|
|
||||||
aBVHTree->MaxPoint (aRightChildIdx));
|
|
||||||
if (isLeftChildIn
|
|
||||||
&& isRightChildIn)
|
|
||||||
{
|
|
||||||
aNode = myBVHIsLeftChildQueuedFirst ? aLeftChildIdx : aRightChildIdx;
|
|
||||||
++aHead;
|
|
||||||
aStack[aHead] = myBVHIsLeftChildQueuedFirst ? aRightChildIdx : aLeftChildIdx;
|
|
||||||
myBVHIsLeftChildQueuedFirst = !myBVHIsLeftChildQueuedFirst;
|
|
||||||
}
|
|
||||||
else if (isLeftChildIn
|
|
||||||
|| isRightChildIn)
|
|
||||||
{
|
|
||||||
aNode = isLeftChildIn ? aLeftChildIdx : aRightChildIdx;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (aHead < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aNode = aStack[aHead];
|
|
||||||
--aHead;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (theSelector.Intersect (aBVHTree->MinPoint (aNode),
|
|
||||||
aBVHTree->MaxPoint (aNode)))
|
|
||||||
{
|
|
||||||
Standard_Integer aIdx = aBVHTree->BegPrimitive (aNode);
|
|
||||||
myBVHPrimitives.GetStructureById (aIdx)->MarkAsNotCulled();
|
|
||||||
if (aHead < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aNode = aStack[aHead];
|
|
||||||
--aHead;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Append
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Boolean OpenGl_PriorityList::Append (const OpenGl_PriorityList& theOther)
|
|
||||||
{
|
|
||||||
// the source priority list shouldn't have more priorities
|
|
||||||
const Standard_Integer aNbPriorities = theOther.NbPriorities ();
|
|
||||||
if (aNbPriorities > NbPriorities())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add all structures to destination priority list
|
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIter;
|
|
||||||
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
|
|
||||||
{
|
|
||||||
const OpenGl_SequenceOfStructure& aSeq = theOther.myArray (aPriorityIter);
|
|
||||||
for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
|
|
||||||
{
|
|
||||||
Add (aStructIter.Value(), aPriorityIter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : NbPriorities
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Integer OpenGl_PriorityList::NbPriorities() const
|
|
||||||
{
|
|
||||||
return myArray.Length();
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
// Created on: 2011-11-02
|
|
||||||
// Created by: Sergey ZERCHANINOV
|
|
||||||
// Copyright (c) 2011-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#ifndef _OpenGl_PriorityList_Header
|
|
||||||
#define _OpenGl_PriorityList_Header
|
|
||||||
|
|
||||||
#include <NCollection_Sequence.hxx>
|
|
||||||
#include <NCollection_Array1.hxx>
|
|
||||||
|
|
||||||
#include <InterfaceGraphic_telem.hxx>
|
|
||||||
|
|
||||||
#include <Handle_OpenGl_Workspace.hxx>
|
|
||||||
#include <OpenGl_BVHClipPrimitiveSet.hxx>
|
|
||||||
#include <OpenGl_BVHTreeSelector.hxx>
|
|
||||||
|
|
||||||
class OpenGl_Structure;
|
|
||||||
|
|
||||||
typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
|
|
||||||
typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
|
|
||||||
|
|
||||||
class OpenGl_PriorityList
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Empty constructor.
|
|
||||||
OpenGl_PriorityList (const Standard_Integer theNbPriorities = 11);
|
|
||||||
|
|
||||||
//! Destructor.
|
|
||||||
virtual ~OpenGl_PriorityList();
|
|
||||||
|
|
||||||
void Add (const OpenGl_Structure* theStructure,
|
|
||||||
const Standard_Integer thePriority,
|
|
||||||
Standard_Boolean isForChangePriority = Standard_False);
|
|
||||||
|
|
||||||
//! Remove structure and returns its priority, if the structure is not found, method returns negative value
|
|
||||||
Standard_Integer Remove (const OpenGl_Structure* theStructure,
|
|
||||||
Standard_Boolean isForChangePriority = Standard_False);
|
|
||||||
|
|
||||||
//! @return the number of structures
|
|
||||||
Standard_Integer NbStructures() const { return myNbStructures; }
|
|
||||||
|
|
||||||
// Render all structures.
|
|
||||||
void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
|
||||||
|
|
||||||
//! Returns the number of available priority levels
|
|
||||||
Standard_Integer NbPriorities() const;
|
|
||||||
|
|
||||||
//! Append priority list of acceptable type (with similar number of priorities
|
|
||||||
//! or less). Returns Standard_False if the list can not be accepted.
|
|
||||||
Standard_Boolean Append (const OpenGl_PriorityList& theOther);
|
|
||||||
|
|
||||||
//! Returns array of OpenGL structures.
|
|
||||||
const OpenGl_ArrayOfStructure& ArrayOfStructures() const { return myArray; }
|
|
||||||
|
|
||||||
//! Marks BVH tree for given priority list as dirty and
|
|
||||||
//! marks primitive set for rebuild.
|
|
||||||
void InvalidateBVHData();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//! Traverses through BVH tree to determine which structures are in view volume.
|
|
||||||
void traverse (OpenGl_BVHTreeSelector& theSelector) const;
|
|
||||||
|
|
||||||
//! Iterates through the hierarchical list of existing structures and renders them all.
|
|
||||||
void renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
|
||||||
|
|
||||||
//! Iterates through the hierarchical list of existing structures and renders only overlapping ones.
|
|
||||||
void renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
OpenGl_ArrayOfStructure myArray;
|
|
||||||
Standard_Integer myNbStructures;
|
|
||||||
mutable OpenGl_BVHClipPrimitiveSet myBVHPrimitives; //<! Set of OpenGl_Structures for building BVH tree
|
|
||||||
mutable Standard_Boolean myBVHIsLeftChildQueuedFirst; //<! Is needed for implementation of stochastic order of BVH traverse
|
|
||||||
mutable Standard_Boolean myIsBVHPrimitivesNeedsReset; //<! Defines if the primitive set for BVH is outdated
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _OpenGl_PriorityList_Header
|
|
24
src/OpenGl/OpenGl_SequenceOfStructure.hxx
Normal file
24
src/OpenGl/OpenGl_SequenceOfStructure.hxx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Created on: 2014-12-18
|
||||||
|
// Created by: Kirill Gavrilov
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _OpenGl_SequenceOfStructure
|
||||||
|
#define _OpenGl_SequenceOfStructure
|
||||||
|
|
||||||
|
#include <NCollection_Sequence.hxx>
|
||||||
|
|
||||||
|
class OpenGl_Structure;
|
||||||
|
typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
|
||||||
|
|
||||||
|
#endif // _OpenGl_SequenceOfStructure
|
@ -73,10 +73,6 @@ public:
|
|||||||
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
|
const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
|
||||||
|
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
if ((theWorkspace->NamedStatus & OPENGL_NS_IMMEDIATE) != 0)
|
|
||||||
{
|
|
||||||
glDepthMask (GL_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use highlight colors
|
// Use highlight colors
|
||||||
theWorkspace->GetGlContext()->core11->glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
|
theWorkspace->GetGlContext()->core11->glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
|
||||||
@ -130,14 +126,12 @@ OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& th
|
|||||||
myAspectMarker(NULL),
|
myAspectMarker(NULL),
|
||||||
myAspectText(NULL),
|
myAspectText(NULL),
|
||||||
myHighlightColor(NULL),
|
myHighlightColor(NULL),
|
||||||
myNamedStatus(0),
|
|
||||||
myZLayer(0),
|
|
||||||
myIsRaytracable (Standard_False),
|
myIsRaytracable (Standard_False),
|
||||||
myModificationState (0),
|
myModificationState (0),
|
||||||
myIsCulled (Standard_True),
|
myIsCulled (Standard_True),
|
||||||
myIsMirrored (Standard_False)
|
myIsMirrored (Standard_False)
|
||||||
{
|
{
|
||||||
UpdateNamedStatus();
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -366,15 +360,11 @@ void OpenGl_Structure::clearHighlightColor (const Handle(OpenGl_Context)& theGlC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : UpdateNamedStatus
|
// function : OnVisibilityChanged
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Structure::UpdateNamedStatus()
|
void OpenGl_Structure::OnVisibilityChanged()
|
||||||
{
|
{
|
||||||
myNamedStatus = 0;
|
|
||||||
if (highlight) myNamedStatus |= OPENGL_NS_HIGHLIGHT;
|
|
||||||
if (!visible) myNamedStatus |= OPENGL_NS_HIDE;
|
|
||||||
|
|
||||||
if (myIsRaytracable)
|
if (myIsRaytracable)
|
||||||
{
|
{
|
||||||
UpdateStateWithAncestorStructures();
|
UpdateStateWithAncestorStructures();
|
||||||
@ -627,7 +617,7 @@ void OpenGl_Structure::RenderGeometry (const Handle(OpenGl_Workspace) &theWorksp
|
|||||||
void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) const
|
void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) const
|
||||||
{
|
{
|
||||||
// Process the structure only if visible
|
// Process the structure only if visible
|
||||||
if (myNamedStatus & OPENGL_NS_HIDE)
|
if (!visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -636,7 +626,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
|
|
||||||
// Render named status
|
// Render named status
|
||||||
const Standard_Integer aNamedStatus = theWorkspace->NamedStatus;
|
const Standard_Integer aNamedStatus = theWorkspace->NamedStatus;
|
||||||
theWorkspace->NamedStatus |= myNamedStatus;
|
if (highlight)
|
||||||
|
{
|
||||||
|
theWorkspace->NamedStatus |= OPENGL_NS_HIGHLIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// Do we need to restore GL_NORMALIZE?
|
// Do we need to restore GL_NORMALIZE?
|
||||||
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
|
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
|
||||||
@ -860,24 +853,6 @@ void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetZLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void OpenGl_Structure::SetZLayer (const Standard_Integer theLayerIndex)
|
|
||||||
{
|
|
||||||
myZLayer = theLayerIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetZLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer OpenGl_Structure::GetZLayer () const
|
|
||||||
{
|
|
||||||
return myZLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ShadowLink
|
//function : ShadowLink
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include <OpenGl_Group.hxx>
|
#include <OpenGl_Group.hxx>
|
||||||
#include <OpenGl_Matrix.hxx>
|
#include <OpenGl_Matrix.hxx>
|
||||||
#include <OpenGl_NamedStatus.hxx>
|
|
||||||
#include <OpenGl_Vec.hxx>
|
#include <OpenGl_Vec.hxx>
|
||||||
#include <OpenGl_Workspace.hxx>
|
#include <OpenGl_Workspace.hxx>
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ public:
|
|||||||
Standard_EXPORT OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
Standard_EXPORT OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
||||||
|
|
||||||
//! Setup structure graphic state
|
//! Setup structure graphic state
|
||||||
Standard_EXPORT virtual void UpdateNamedStatus();
|
Standard_EXPORT virtual void OnVisibilityChanged() Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Clear graphic data
|
//! Clear graphic data
|
||||||
Standard_EXPORT virtual void Clear();
|
Standard_EXPORT virtual void Clear();
|
||||||
@ -129,16 +128,8 @@ public:
|
|||||||
|
|
||||||
void clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
|
void clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
|
||||||
Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); }
|
|
||||||
|
|
||||||
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
|
||||||
//! Set z layer ID to display the structure in specified layer
|
|
||||||
Standard_EXPORT void SetZLayer (const Standard_Integer theLayerIndex);
|
|
||||||
|
|
||||||
//! Get z layer ID
|
|
||||||
Standard_EXPORT Standard_Integer GetZLayer() const;
|
|
||||||
|
|
||||||
//! Renders groups of structure without applying any attributes (i.e. transform, material etc).
|
//! Renders groups of structure without applying any attributes (i.e. transform, material etc).
|
||||||
virtual void RenderGeometry (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
virtual void RenderGeometry (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
|
|
||||||
@ -239,9 +230,6 @@ protected:
|
|||||||
Handle(OpenGl_Group) myHighlightBox;
|
Handle(OpenGl_Group) myHighlightBox;
|
||||||
TEL_COLOUR* myHighlightColor;
|
TEL_COLOUR* myHighlightColor;
|
||||||
|
|
||||||
int myNamedStatus;
|
|
||||||
int myZLayer;
|
|
||||||
|
|
||||||
OpenGl_ListOfStructure myConnected;
|
OpenGl_ListOfStructure myConnected;
|
||||||
|
|
||||||
mutable OpenGl_ListOfStructure myAncestorStructures;
|
mutable OpenGl_ListOfStructure myAncestorStructures;
|
||||||
|
@ -139,37 +139,37 @@ class OpenGl_View : public MMgt_TShared
|
|||||||
//! The structure will be added to associated with it z layer.
|
//! The structure will be added to associated with it z layer.
|
||||||
//! If the z layer is not presented in the view, the structure will
|
//! If the z layer is not presented in the view, the structure will
|
||||||
//! be displayed in default bottom-level z layer.
|
//! be displayed in default bottom-level z layer.
|
||||||
void DisplayStructure (const OpenGl_Structure* theStructure,
|
void DisplayStructure (const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer thePriority);
|
const Standard_Integer thePriority);
|
||||||
|
|
||||||
//! Erase structure from display list.
|
//! Erase structure from display list.
|
||||||
void EraseStructure (const OpenGl_Structure* theStructure);
|
void EraseStructure (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
|
|
||||||
//! Add structure to the list of immediate structures.
|
//! Add structure to the list of immediate structures.
|
||||||
void DisplayImmediateStructure (const OpenGl_Structure* theStructure);
|
void DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
|
|
||||||
//! Erase structure from display list.
|
//! Erase structure from display list.
|
||||||
void EraseImmediateStructure (const OpenGl_Structure* theStructure);
|
void EraseImmediateStructure (const OpenGl_Structure* theStructure);
|
||||||
|
|
||||||
//! Insert a new top-level z layer with ID <theLayerId>
|
//! Insert a new top-level z layer with ID <theLayerId>
|
||||||
void AddZLayer (const Standard_Integer theLayerId);
|
void AddZLayer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Remove a z layer with ID <theLayerId>
|
//! Remove a z layer with ID <theLayerId>
|
||||||
void RemoveZLayer (const Standard_Integer theLayerId);
|
void RemoveZLayer (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
//! Display structure in z layer with ID <theNewLayerId>
|
//! Display structure in z layer with ID <theNewLayerId>
|
||||||
//! If the layer with ID <theNewLayerId> is not presented in the view,
|
//! If the layer with ID <theNewLayerId> is not presented in the view,
|
||||||
//! the structure will be displayed in default bottom-level layer.
|
//! the structure will be displayed in default bottom-level layer.
|
||||||
void ChangeZLayer (const OpenGl_Structure *theStructure,
|
void ChangeZLayer (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theNewLayerId);
|
const Graphic3d_ZLayerId theNewLayerId);
|
||||||
|
|
||||||
//! Sets the settings for a single Z layer of specified view.
|
//! Sets the settings for a single Z layer of specified view.
|
||||||
void SetZLayerSettings (const Standard_Integer theLayerId,
|
void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings);
|
const Graphic3d_ZLayerSettings& theSettings);
|
||||||
|
|
||||||
//! Changes the priority of a structure within its ZLayer
|
//! Changes the priority of a structure within its ZLayer
|
||||||
void ChangePriority (const OpenGl_Structure *theStructure,
|
void ChangePriority (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theNewPriority);
|
const Standard_Integer theNewPriority);
|
||||||
|
|
||||||
void CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle);
|
void CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle);
|
||||||
void SetBackgroundTextureStyle (const Aspect_FillMethod FillStyle);
|
void SetBackgroundTextureStyle (const Aspect_FillMethod FillStyle);
|
||||||
@ -180,7 +180,8 @@ class OpenGl_View : public MMgt_TShared
|
|||||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
const Graphic3d_CView& theCView,
|
const Graphic3d_CView& theCView,
|
||||||
const Aspect_CLayer2d& theCUnderLayer,
|
const Aspect_CLayer2d& theCUnderLayer,
|
||||||
const Aspect_CLayer2d& theCOverLayer);
|
const Aspect_CLayer2d& theCOverLayer,
|
||||||
|
const Standard_Boolean theToDrawImmediate);
|
||||||
|
|
||||||
|
|
||||||
void DrawBackground (OpenGl_Workspace& theWorkspace);
|
void DrawBackground (OpenGl_Workspace& theWorkspace);
|
||||||
@ -215,12 +216,20 @@ class OpenGl_View : public MMgt_TShared
|
|||||||
return myImmediateList;
|
return myImmediateList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Returns true if there are immediate structures to display
|
||||||
|
bool HasImmediateStructures() const
|
||||||
|
{
|
||||||
|
return !myImmediateList.IsEmpty()
|
||||||
|
|| myZLayers.NbImmediateStructures() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns modification state for ray-tracing.
|
//! Returns modification state for ray-tracing.
|
||||||
Standard_Size ModificationState() const { return myModificationState; }
|
Standard_Size ModificationState() const { return myModificationState; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace);
|
void RenderStructs (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const Standard_Boolean theToDrawImmediate);
|
||||||
void RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
void RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||||
const Handle(OpenGl_Workspace) &theWorkspace,
|
const Handle(OpenGl_Workspace) &theWorkspace,
|
||||||
const Graphic3d_CView& theCView,
|
const Graphic3d_CView& theCView,
|
||||||
@ -231,13 +240,9 @@ protected:
|
|||||||
//! lights, structures. The peculiar properties of "scene" is that
|
//! lights, structures. The peculiar properties of "scene" is that
|
||||||
//! it requires empty Z-Buffer and uses projection and orientation
|
//! it requires empty Z-Buffer and uses projection and orientation
|
||||||
//! matrices supplied by 3d view.
|
//! matrices supplied by 3d view.
|
||||||
//! @param thePrintCtx [in] printer context which facilitates tiled printing.
|
|
||||||
//! @param theWorkspace [in] rendering workspace.
|
|
||||||
//! @param theCView [in] view data.
|
|
||||||
//! @param theProjection [in] view projection matrix.
|
|
||||||
//! @param theOrientation [in] view orientation matrix.
|
|
||||||
void RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
void RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||||
const Handle(OpenGl_Workspace)& theWorkspace);
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const Standard_Boolean theToDrawImmediate);
|
||||||
|
|
||||||
Handle(OpenGl_LineAttributes) myLineAttribs;
|
Handle(OpenGl_LineAttributes) myLineAttribs;
|
||||||
Handle(OpenGl_Texture) myTextureEnv;
|
Handle(OpenGl_Texture) myTextureEnv;
|
||||||
|
@ -360,10 +360,11 @@ void OpenGl_View::DrawBackground (OpenGl_Workspace& theWorkspace)
|
|||||||
|
|
||||||
//call_func_redraw_all_structs_proc
|
//call_func_redraw_all_structs_proc
|
||||||
void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||||
const Handle(OpenGl_Workspace) &theWorkspace,
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
const Graphic3d_CView& theCView,
|
const Graphic3d_CView& theCView,
|
||||||
const Aspect_CLayer2d& theCUnderLayer,
|
const Aspect_CLayer2d& theCUnderLayer,
|
||||||
const Aspect_CLayer2d& theCOverLayer)
|
const Aspect_CLayer2d& theCOverLayer,
|
||||||
|
const Standard_Boolean theToDrawImmediate)
|
||||||
{
|
{
|
||||||
// ==================================
|
// ==================================
|
||||||
// Step 1: Prepare for redraw
|
// Step 1: Prepare for redraw
|
||||||
@ -448,7 +449,8 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
// ====================================
|
// ====================================
|
||||||
|
|
||||||
// Render background
|
// Render background
|
||||||
if (theWorkspace->ToRedrawGL())
|
if (theWorkspace->ToRedrawGL()
|
||||||
|
&& !theToDrawImmediate)
|
||||||
{
|
{
|
||||||
DrawBackground (*theWorkspace);
|
DrawBackground (*theWorkspace);
|
||||||
}
|
}
|
||||||
@ -461,8 +463,10 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
// =================================
|
// =================================
|
||||||
// Step 3: Draw underlayer
|
// Step 3: Draw underlayer
|
||||||
// =================================
|
// =================================
|
||||||
|
if (!theToDrawImmediate)
|
||||||
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCUnderLayer);
|
{
|
||||||
|
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCUnderLayer);
|
||||||
|
}
|
||||||
|
|
||||||
// =================================
|
// =================================
|
||||||
// Step 4: Redraw main plane
|
// Step 4: Redraw main plane
|
||||||
@ -552,7 +556,7 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
{
|
{
|
||||||
// single-pass monographic rendering
|
// single-pass monographic rendering
|
||||||
// redraw scene with normal orientation and projection
|
// redraw scene with normal orientation and projection
|
||||||
RedrawScene (thePrintContext, theWorkspace);
|
RedrawScene (thePrintContext, theWorkspace, theToDrawImmediate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -565,7 +569,7 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
aContext->ApplyProjectionMatrix();
|
aContext->ApplyProjectionMatrix();
|
||||||
|
|
||||||
// redraw left Eye
|
// redraw left Eye
|
||||||
RedrawScene (thePrintContext, theWorkspace);
|
RedrawScene (thePrintContext, theWorkspace, theToDrawImmediate);
|
||||||
|
|
||||||
// reset depth buffer of first rendering pass
|
// reset depth buffer of first rendering pass
|
||||||
if (theWorkspace->UseDepthTest())
|
if (theWorkspace->UseDepthTest())
|
||||||
@ -579,7 +583,7 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
aContext->ApplyProjectionMatrix();
|
aContext->ApplyProjectionMatrix();
|
||||||
|
|
||||||
// redraw right Eye
|
// redraw right Eye
|
||||||
RedrawScene (thePrintContext, theWorkspace);
|
RedrawScene (thePrintContext, theWorkspace, theToDrawImmediate);
|
||||||
|
|
||||||
// switch back to monographic rendering
|
// switch back to monographic rendering
|
||||||
aContext->SetDrawBufferMono();
|
aContext->SetDrawBufferMono();
|
||||||
@ -609,7 +613,8 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render trihedron
|
// Render trihedron
|
||||||
if (theWorkspace->ToRedrawGL())
|
if (theWorkspace->ToRedrawGL()
|
||||||
|
&& !theToDrawImmediate)
|
||||||
{
|
{
|
||||||
RedrawTrihedron (theWorkspace);
|
RedrawTrihedron (theWorkspace);
|
||||||
|
|
||||||
@ -629,13 +634,15 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
// ===============================
|
// ===============================
|
||||||
// Step 6: Redraw overlay
|
// Step 6: Redraw overlay
|
||||||
// ===============================
|
// ===============================
|
||||||
|
if (!theToDrawImmediate)
|
||||||
|
{
|
||||||
|
const int aMode = 0;
|
||||||
|
theWorkspace->DisplayCallback (theCView, (aMode | OCC_PRE_OVERLAY));
|
||||||
|
|
||||||
const int aMode = 0;
|
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCOverLayer);
|
||||||
theWorkspace->DisplayCallback (theCView, (aMode | OCC_PRE_OVERLAY));
|
|
||||||
|
|
||||||
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCOverLayer);
|
theWorkspace->DisplayCallback (theCView, aMode);
|
||||||
|
}
|
||||||
theWorkspace->DisplayCallback (theCView, aMode);
|
|
||||||
|
|
||||||
// ===============================
|
// ===============================
|
||||||
// Step 7: Finalize
|
// Step 7: Finalize
|
||||||
@ -671,7 +678,7 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
|||||||
// function : InvalidateBVHData
|
// function : InvalidateBVHData
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_View::InvalidateBVHData (const Standard_Integer theLayerId)
|
void OpenGl_View::InvalidateBVHData (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myZLayers.InvalidateBVHData (theLayerId);
|
myZLayers.InvalidateBVHData (theLayerId);
|
||||||
}
|
}
|
||||||
@ -679,7 +686,8 @@ void OpenGl_View::InvalidateBVHData (const Standard_Integer theLayerId)
|
|||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
//ExecuteViewDisplay
|
//ExecuteViewDisplay
|
||||||
void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace)
|
void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace)& AWorkspace,
|
||||||
|
const Standard_Boolean theToDrawImmediate)
|
||||||
{
|
{
|
||||||
if ( myZLayers.NbStructures() <= 0 )
|
if ( myZLayers.NbStructures() <= 0 )
|
||||||
return;
|
return;
|
||||||
@ -718,7 +726,7 @@ void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myZLayers.Render (AWorkspace);
|
myZLayers.Render (AWorkspace, theToDrawImmediate);
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
//TsmPopAttri(); /* restore previous graphics context; before update lights */
|
//TsmPopAttri(); /* restore previous graphics context; before update lights */
|
||||||
@ -1004,7 +1012,7 @@ void OpenGl_View::SetBackgroundGradientType (const Aspect_GradientFillMethod ATy
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::AddZLayer (const Standard_Integer theLayerId)
|
void OpenGl_View::AddZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myZLayers.AddLayer (theLayerId);
|
myZLayers.AddLayer (theLayerId);
|
||||||
}
|
}
|
||||||
@ -1014,7 +1022,7 @@ void OpenGl_View::AddZLayer (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::RemoveZLayer (const Standard_Integer theLayerId)
|
void OpenGl_View::RemoveZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myZLayers.RemoveLayer (theLayerId);
|
myZLayers.RemoveLayer (theLayerId);
|
||||||
}
|
}
|
||||||
@ -1024,11 +1032,12 @@ void OpenGl_View::RemoveZLayer (const Standard_Integer theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::DisplayStructure (const OpenGl_Structure *theStructure,
|
void OpenGl_View::DisplayStructure (const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer thePriority)
|
const Standard_Integer thePriority)
|
||||||
{
|
{
|
||||||
Standard_Integer aZLayer = theStructure->GetZLayer ();
|
const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure*> (theStructure->CStructure().operator->());
|
||||||
myZLayers.AddStructure (theStructure, aZLayer, thePriority);
|
const Graphic3d_ZLayerId aZLayer = aStruct->ZLayer();
|
||||||
|
myZLayers.AddStructure (aStruct, aZLayer, thePriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1036,18 +1045,19 @@ void OpenGl_View::DisplayStructure (const OpenGl_Structure *theStructure,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::DisplayImmediateStructure (const OpenGl_Structure* theStructure)
|
void OpenGl_View::DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure)
|
||||||
{
|
{
|
||||||
|
const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure*> (theStructure->CStructure().operator->());
|
||||||
for (OpenGl_SequenceOfStructure::Iterator anIter (myImmediateList);
|
for (OpenGl_SequenceOfStructure::Iterator anIter (myImmediateList);
|
||||||
anIter.More(); anIter.Next())
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value() == theStructure)
|
if (anIter.Value() == aStruct)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myImmediateList.Append (theStructure);
|
myImmediateList.Append (aStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1055,10 +1065,9 @@ void OpenGl_View::DisplayImmediateStructure (const OpenGl_Structure* theStructur
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::EraseStructure (const OpenGl_Structure *theStructure)
|
void OpenGl_View::EraseStructure (const Handle(Graphic3d_Structure)& theStructure)
|
||||||
{
|
{
|
||||||
Standard_Integer aZLayer = theStructure->GetZLayer ();
|
myZLayers.RemoveStructure (theStructure);
|
||||||
myZLayers.RemoveStructure (theStructure, aZLayer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1084,10 +1093,10 @@ void OpenGl_View::EraseImmediateStructure (const OpenGl_Structure* theStructure)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::ChangeZLayer (const OpenGl_Structure *theStructure,
|
void OpenGl_View::ChangeZLayer (const OpenGl_Structure* theStructure,
|
||||||
const Standard_Integer theNewLayerId)
|
const Graphic3d_ZLayerId theNewLayerId)
|
||||||
{
|
{
|
||||||
Standard_Integer anOldLayer = theStructure->GetZLayer ();
|
const Graphic3d_ZLayerId anOldLayer = theStructure->ZLayer();
|
||||||
myZLayers.ChangeLayer (theStructure, anOldLayer, theNewLayerId);
|
myZLayers.ChangeLayer (theStructure, anOldLayer, theNewLayerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,10 +1104,10 @@ void OpenGl_View::ChangeZLayer (const OpenGl_Structure *theStructure,
|
|||||||
//function : SetZLayerSettings
|
//function : SetZLayerSettings
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
void OpenGl_View::SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
myZLayers.Layer (theLayerId).SetLayerSettings (theSettings);
|
myZLayers.SetLayerSettings (theLayerId, theSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1108,7 +1117,7 @@ void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
|||||||
void OpenGl_View::ChangePriority (const OpenGl_Structure *theStructure,
|
void OpenGl_View::ChangePriority (const OpenGl_Structure *theStructure,
|
||||||
const Standard_Integer theNewPriority)
|
const Standard_Integer theNewPriority)
|
||||||
{
|
{
|
||||||
Standard_Integer aLayerId = theStructure->GetZLayer();
|
const Graphic3d_ZLayerId aLayerId = theStructure->ZLayer();
|
||||||
myZLayers.ChangePriority (theStructure, aLayerId, theNewPriority);
|
myZLayers.ChangePriority (theStructure, aLayerId, theNewPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,7 +1127,8 @@ void OpenGl_View::ChangePriority (const OpenGl_Structure *theStructure,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||||
const Handle(OpenGl_Workspace)& theWorkspace)
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
|
const Standard_Boolean theToDrawImmediate)
|
||||||
{
|
{
|
||||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||||
|
|
||||||
@ -1246,14 +1256,14 @@ void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintCont
|
|||||||
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
||||||
theWorkspace->DisableTexture();
|
theWorkspace->DisableTexture();
|
||||||
// Render the view
|
// Render the view
|
||||||
RenderStructs (theWorkspace);
|
RenderStructs (theWorkspace, theToDrawImmediate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Visual3d_TOD_ENVIRONMENT:
|
case Visual3d_TOD_ENVIRONMENT:
|
||||||
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
||||||
theWorkspace->EnableTexture (myTextureEnv);
|
theWorkspace->EnableTexture (myTextureEnv);
|
||||||
// Render the view
|
// Render the view
|
||||||
RenderStructs (theWorkspace);
|
RenderStructs (theWorkspace, theToDrawImmediate);
|
||||||
theWorkspace->DisableTexture();
|
theWorkspace->DisableTexture();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1261,7 +1271,7 @@ void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintCont
|
|||||||
// First pass
|
// First pass
|
||||||
theWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX;
|
theWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX;
|
||||||
// Render the view
|
// Render the view
|
||||||
RenderStructs (theWorkspace);
|
RenderStructs (theWorkspace, theToDrawImmediate);
|
||||||
theWorkspace->DisableTexture();
|
theWorkspace->DisableTexture();
|
||||||
|
|
||||||
// Second pass
|
// Second pass
|
||||||
@ -1294,7 +1304,7 @@ void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintCont
|
|||||||
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
||||||
|
|
||||||
// Render the view
|
// Render the view
|
||||||
RenderStructs (theWorkspace);
|
RenderStructs (theWorkspace, theToDrawImmediate);
|
||||||
theWorkspace->DisableTexture();
|
theWorkspace->DisableTexture();
|
||||||
|
|
||||||
// Restore properties back
|
// Restore properties back
|
||||||
|
@ -684,7 +684,7 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
|||||||
redraw1 (theCView, anEmptyCLayer, anEmptyCLayer, 0);
|
redraw1 (theCView, anEmptyCLayer, anEmptyCLayer, 0);
|
||||||
myOpenGlFBO->UnbindBuffer (aGlCtx);
|
myOpenGlFBO->UnbindBuffer (aGlCtx);
|
||||||
|
|
||||||
const Standard_Boolean isImmediate = !myView->ImmediateStructures().IsEmpty();
|
const Standard_Boolean isImmediate = myView->HasImmediateStructures();
|
||||||
Raytrace (theCView, aSizeX, aSizeY, isImmediate ? 0 : toSwap,
|
Raytrace (theCView, aSizeX, aSizeY, isImmediate ? 0 : toSwap,
|
||||||
theCOverLayer, theCUnderLayer, aFrameBuffer);
|
theCOverLayer, theCUnderLayer, aFrameBuffer);
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
|||||||
aFrameBuffer->BindBuffer (aGlCtx);
|
aFrameBuffer->BindBuffer (aGlCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Standard_Boolean isImmediate = !myView->ImmediateStructures().IsEmpty();
|
const Standard_Boolean isImmediate = myView->HasImmediateStructures();
|
||||||
redraw1 (theCView, theCUnderLayer, theCOverLayer, isImmediate ? 0 : toSwap);
|
redraw1 (theCView, theCUnderLayer, theCOverLayer, isImmediate ? 0 : toSwap);
|
||||||
if (isImmediate)
|
if (isImmediate)
|
||||||
{
|
{
|
||||||
@ -811,7 +811,7 @@ void OpenGl_Workspace::redraw1 (const Graphic3d_CView& theCView,
|
|||||||
glClear (toClear);
|
glClear (toClear);
|
||||||
|
|
||||||
Handle(OpenGl_Workspace) aWS (this);
|
Handle(OpenGl_Workspace) aWS (this);
|
||||||
myView->Render (myPrintContext, aWS, theCView, theCUnderLayer, theCOverLayer);
|
myView->Render (myPrintContext, aWS, theCView, theCUnderLayer, theCOverLayer, Standard_False);
|
||||||
|
|
||||||
// swap the buffers
|
// swap the buffers
|
||||||
if (theToSwap)
|
if (theToSwap)
|
||||||
@ -856,6 +856,7 @@ void OpenGl_Workspace::copyBackToFront()
|
|||||||
|
|
||||||
glRasterPos2i (0, 0);
|
glRasterPos2i (0, 0);
|
||||||
glCopyPixels (0, 0, myWidth + 1, myHeight + 1, GL_COLOR);
|
glCopyPixels (0, 0, myWidth + 1, myHeight + 1, GL_COLOR);
|
||||||
|
//glCopyPixels (0, 0, myWidth + 1, myHeight + 1, GL_DEPTH);
|
||||||
|
|
||||||
EnableFeatures();
|
EnableFeatures();
|
||||||
|
|
||||||
@ -906,7 +907,7 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
|||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
glGetBooleanv (GL_DOUBLEBUFFER, &isDoubleBuffer);
|
glGetBooleanv (GL_DOUBLEBUFFER, &isDoubleBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (myView->ImmediateStructures().IsEmpty())
|
if (!myView->HasImmediateStructures())
|
||||||
{
|
{
|
||||||
if (theToForce
|
if (theToForce
|
||||||
|| !myIsImmediateDrawn)
|
|| !myIsImmediateDrawn)
|
||||||
@ -944,20 +945,49 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
|||||||
}
|
}
|
||||||
myIsImmediateDrawn = Standard_True;
|
myIsImmediateDrawn = Standard_True;
|
||||||
|
|
||||||
NamedStatus |= OPENGL_NS_IMMEDIATE;
|
|
||||||
///glDisable (GL_LIGHTING);
|
|
||||||
glDisable (GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
Handle(OpenGl_Workspace) aWS (this);
|
Handle(OpenGl_Workspace) aWS (this);
|
||||||
|
|
||||||
|
if (myUseZBuffer)
|
||||||
|
{
|
||||||
|
glDepthFunc (GL_LEQUAL);
|
||||||
|
glDepthMask (GL_TRUE);
|
||||||
|
if (myUseDepthTest)
|
||||||
|
{
|
||||||
|
glEnable (GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glDisable (GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
|
glClearDepth (1.0);
|
||||||
|
#else
|
||||||
|
glClearDepthf (1.0f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glDisable (GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
myView->Render (myPrintContext, aWS, theCView, theCUnderLayer, theCOverLayer, Standard_True);
|
||||||
|
if (!myView->ImmediateStructures().IsEmpty())
|
||||||
|
{
|
||||||
|
glDisable (GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
for (OpenGl_SequenceOfStructure::Iterator anIter (myView->ImmediateStructures());
|
for (OpenGl_SequenceOfStructure::Iterator anIter (myView->ImmediateStructures());
|
||||||
anIter.More(); anIter.Next())
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
const OpenGl_Structure* aStructure = anIter.Value();
|
const OpenGl_Structure* aStructure = anIter.Value();
|
||||||
|
if (!aStructure->IsVisible())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aStructure->Render (aWS);
|
aStructure->Render (aWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedStatus &= ~OPENGL_NS_IMMEDIATE;
|
|
||||||
|
|
||||||
if (isDoubleBuffer && myTransientDrawToFront)
|
if (isDoubleBuffer && myTransientDrawToFront)
|
||||||
{
|
{
|
||||||
glFlush();
|
glFlush();
|
||||||
|
@ -71,18 +71,14 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
|
|||||||
|
|
||||||
for (OpenGl_SequenceOfLayers::Iterator anLayerIt (aList.Layers()); anLayerIt.More(); anLayerIt.Next())
|
for (OpenGl_SequenceOfLayers::Iterator anLayerIt (aList.Layers()); anLayerIt.More(); anLayerIt.Next())
|
||||||
{
|
{
|
||||||
const OpenGl_PriorityList& aPriorityList = anLayerIt.Value().PriorityList();
|
const OpenGl_Layer& aLayer = anLayerIt.Value();
|
||||||
|
if (aLayer.NbStructures() == 0)
|
||||||
if (aPriorityList.NbStructures() == 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const OpenGl_ArrayOfStructure& aStructArray = aPriorityList.ArrayOfStructures();
|
const OpenGl_ArrayOfStructure& aStructArray = aLayer.ArrayOfStructures();
|
||||||
|
|
||||||
for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex)
|
for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex)
|
||||||
{
|
{
|
||||||
OpenGl_SequenceOfStructure::Iterator aStructIt;
|
for (OpenGl_SequenceOfStructure::Iterator aStructIt (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
|
||||||
|
|
||||||
for (aStructIt.Init (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
|
|
||||||
{
|
{
|
||||||
const OpenGl_Structure* aStructure = aStructIt.Value();
|
const OpenGl_Structure* aStructure = aStructIt.Value();
|
||||||
|
|
||||||
@ -97,7 +93,9 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
|
|||||||
{
|
{
|
||||||
if (!aStructure->IsRaytracable()
|
if (!aStructure->IsRaytracable()
|
||||||
|| !aStructure->IsVisible())
|
|| !aStructure->IsVisible())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
|
for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
|
||||||
{
|
{
|
||||||
|
@ -82,27 +82,9 @@ is
|
|||||||
---Purpose: Returns the new Structure defined for the new visualization
|
---Purpose: Returns the new Structure defined for the new visualization
|
||||||
---Category: Methods to modify the class definition
|
---Category: Methods to modify the class definition
|
||||||
|
|
||||||
|
|
||||||
---Category: Highlighting methods.
|
|
||||||
--
|
|
||||||
Highlight(me: mutable) is static;
|
|
||||||
---Purpose: displays the whole content of the presentation in white.
|
|
||||||
Color(me: mutable; aColor: NameOfColor from Quantity) is static;
|
|
||||||
---Purpose: displays the whole content of the presentation in the specified color.
|
|
||||||
BoundBox(me: mutable) is static;
|
|
||||||
|
|
||||||
SetIsForHighlight (me : mutable;
|
|
||||||
isForHighlight : Boolean from Standard)
|
|
||||||
is virtual;
|
|
||||||
---Purpose: marks the structure <me> representing wired structure needed for
|
|
||||||
-- highlight only so it won't be added to BVH tree.
|
|
||||||
|
|
||||||
---Category: Global modification methods.
|
---Category: Global modification methods.
|
||||||
SetShadingAspect(me: mutable; aShadingAspect: ShadingAspect from Prs3d);
|
SetShadingAspect(me: mutable; aShadingAspect: ShadingAspect from Prs3d);
|
||||||
|
|
||||||
---Category: Inquire methods.
|
|
||||||
IsPickable(me) returns Boolean from Standard;
|
|
||||||
|
|
||||||
---Category: Transformation methods.
|
---Category: Transformation methods.
|
||||||
Transform (me: mutable; aTransformation: Transformation from Geom);
|
Transform (me: mutable; aTransformation: Transformation from Geom);
|
||||||
Place (me: mutable; X,Y,Z: Length from Quantity);
|
Place (me: mutable; X,Y,Z: Length from Quantity);
|
||||||
@ -116,9 +98,6 @@ is
|
|||||||
Remove (me: mutable; aPresentation: Presentation from Prs3d);
|
Remove (me: mutable; aPresentation: Presentation from Prs3d);
|
||||||
RemoveAll (me: mutable);
|
RemoveAll (me: mutable);
|
||||||
|
|
||||||
SetPickable(me: mutable) is static;
|
|
||||||
SetUnPickable(me: mutable) is static;
|
|
||||||
|
|
||||||
CurrentGroup(me) returns Group from Graphic3d is static private;
|
CurrentGroup(me) returns Group from Graphic3d is static private;
|
||||||
|
|
||||||
friends
|
friends
|
||||||
|
@ -99,38 +99,6 @@ Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)
|
|||||||
SetPrimitivesAspect (aDefAspect);
|
SetPrimitivesAspect (aDefAspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Highlight
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_Presentation::Highlight()
|
|
||||||
{
|
|
||||||
SetHighlightColor(Quantity_Color(Quantity_NOC_GRAY99));
|
|
||||||
Aspect_TypeOfHighlightMethod Method = Aspect_TOHM_COLOR;
|
|
||||||
Graphic3d_Structure::Highlight(Method);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Color
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_Presentation::Color(const Quantity_NameOfColor aColor)
|
|
||||||
{
|
|
||||||
SetHighlightColor(Quantity_Color(aColor));
|
|
||||||
Graphic3d_Structure::Highlight(Aspect_TOHM_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BoundBox
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_Presentation::BoundBox()
|
|
||||||
{
|
|
||||||
SetHighlightColor(Quantity_Color(Quantity_NOC_GRAY99));
|
|
||||||
Graphic3d_Structure::Highlight(Aspect_TOHM_BOUNDBOX);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetShadingAspect
|
//function : SetShadingAspect
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -140,34 +108,6 @@ void Prs3d_Presentation::SetShadingAspect(const Handle(Prs3d_ShadingAspect)& aSh
|
|||||||
SetPrimitivesAspect(aShadingAspect->Aspect());
|
SetPrimitivesAspect(aShadingAspect->Aspect());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsPickable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean Prs3d_Presentation::IsPickable () const
|
|
||||||
{
|
|
||||||
return Graphic3d_Structure::IsSelectable();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetPickable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Prs3d_Presentation::SetPickable()
|
|
||||||
{
|
|
||||||
SetPick(Standard_True);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetUnPickable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_Presentation::SetUnPickable()
|
|
||||||
{
|
|
||||||
SetPick(Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Transform
|
//function : Transform
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -287,15 +227,6 @@ Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//=======================================================================
|
|
||||||
//function : SetIsForHighlight
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_Presentation::SetIsForHighlight (const Standard_Boolean isForHighlight)
|
|
||||||
{
|
|
||||||
Graphic3d_Structure::SetIsForHighlight (isForHighlight);
|
|
||||||
}
|
|
||||||
|
|
||||||
//function : Compute
|
//function : Compute
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -33,9 +33,12 @@ uses
|
|||||||
|
|
||||||
MMgt,TCollection,
|
MMgt,TCollection,
|
||||||
TopLoc,
|
TopLoc,
|
||||||
Prs3d,Graphic3d,
|
Aspect,
|
||||||
|
Prs3d,
|
||||||
|
Graphic3d,
|
||||||
Quantity,Geom,
|
Quantity,Geom,
|
||||||
V3d,
|
Visual3d,
|
||||||
|
V3d,
|
||||||
TColStd,
|
TColStd,
|
||||||
gp
|
gp
|
||||||
|
|
||||||
|
@ -63,12 +63,11 @@ uses
|
|||||||
Location from TopLoc,
|
Location from TopLoc,
|
||||||
ClipPlane_Handle from Graphic3d,
|
ClipPlane_Handle from Graphic3d,
|
||||||
SequenceOfHClipPlane from Graphic3d,
|
SequenceOfHClipPlane from Graphic3d,
|
||||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
|
||||||
TransModeFlags from Graphic3d,
|
TransModeFlags from Graphic3d,
|
||||||
Pnt from gp,
|
Pnt from gp,
|
||||||
Trsf from gp,
|
Trsf from gp,
|
||||||
CTransPersStruct from Graphic3d
|
CTransPersStruct from Graphic3d,
|
||||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
ZLayerId from Graphic3d
|
||||||
|
|
||||||
raises
|
raises
|
||||||
NotImplemented from Standard
|
NotImplemented from Standard
|
||||||
@ -246,22 +245,16 @@ is
|
|||||||
UpdateTransformation(me:mutable) is virtual;
|
UpdateTransformation(me:mutable) is virtual;
|
||||||
|
|
||||||
UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
|
UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
|
||||||
|
|
||||||
SetZLayer ( me : mutable;
|
SetZLayer ( me : mutable;
|
||||||
thePrsMgr : PresentationManager from PrsMgr;
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
theLayerId : Integer from Standard )
|
|
||||||
is virtual;
|
is virtual;
|
||||||
---Purpose: Set Z layer ID and update all presentations of
|
---Purpose: Set Z layer ID and update all presentations of the presentable object.
|
||||||
-- the presentable object. The layer can be set only for displayed object.
|
-- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
|
||||||
-- If all object presentations are removed, the layer ID will be set to
|
|
||||||
-- default value when computing presentation. The layers mechanism allows
|
ZLayer ( me )
|
||||||
-- drawing objects in higher layers in overlay of objects in lower layers.
|
returns ZLayerId from Graphic3d is static;
|
||||||
|
---Purpose: Get ID of Z layer.
|
||||||
GetZLayer ( me;
|
|
||||||
thePrsMgr : PresentationManager from PrsMgr )
|
|
||||||
returns Integer from Standard is static;
|
|
||||||
---Purpose: Get ID of Z layer. If no presentations of object is displayed,
|
|
||||||
-- and layer ID is unavailable, the -1 value is returned.
|
|
||||||
|
|
||||||
AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
|
AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
|
||||||
---Purpose: Adds clip plane for graphical clipping for all display mode
|
---Purpose: Adds clip plane for graphical clipping for all display mode
|
||||||
@ -333,7 +326,7 @@ fields
|
|||||||
myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
|
myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
|
||||||
myTransformPersistence : CTransPersStruct from Graphic3d;
|
myTransformPersistence : CTransPersStruct from Graphic3d;
|
||||||
myIsMutable : Boolean from Standard is protected;
|
myIsMutable : Boolean from Standard is protected;
|
||||||
|
myZLayer : ZLayerId from Graphic3d is protected;
|
||||||
|
|
||||||
myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
|
myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
|
PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
|
||||||
: myTypeOfPresentation3d (theType),
|
: myTypeOfPresentation3d (theType),
|
||||||
myIsMutable (Standard_False),
|
myIsMutable (Standard_False),
|
||||||
|
myZLayer (Graphic3d_ZLayerId_Default),
|
||||||
myHasOwnPresentations (Standard_True),
|
myHasOwnPresentations (Standard_True),
|
||||||
myParent (NULL)
|
myParent (NULL)
|
||||||
{
|
{
|
||||||
@ -384,25 +385,34 @@ void PrsMgr_PresentableObject::RemoveChild (const Handle(PrsMgr_PresentableObjec
|
|||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void PrsMgr_PresentableObject::SetZLayer
|
void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
|
||||||
const Standard_Integer theLayerId)
|
|
||||||
{
|
{
|
||||||
if (!thePrsMgr.IsNull())
|
if (myZLayer == theLayerId)
|
||||||
thePrsMgr->SetZLayer (this, theLayerId);
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myZLayer = theLayerId;
|
||||||
|
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
|
||||||
|
{
|
||||||
|
const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter);
|
||||||
|
if (aModedPrs.Presentation().IsNull()
|
||||||
|
|| aModedPrs.Presentation()->Presentation().IsNull())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
aModedPrs.Presentation()->Presentation()->SetZLayer (theLayerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetZLayer
|
//function : ZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer PrsMgr_PresentableObject::GetZLayer
|
Graphic3d_ZLayerId PrsMgr_PresentableObject::ZLayer() const
|
||||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr) const
|
|
||||||
{
|
{
|
||||||
if (!thePrsMgr.IsNull())
|
return myZLayer;
|
||||||
return thePrsMgr->GetZLayer (this);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -21,9 +21,11 @@ uses
|
|||||||
|
|
||||||
PresentationManager from PrsMgr,
|
PresentationManager from PrsMgr,
|
||||||
NameOfColor from Quantity,
|
NameOfColor from Quantity,
|
||||||
|
Color from Quantity,
|
||||||
Transformation from Geom,
|
Transformation from Geom,
|
||||||
Length from Quantity,
|
Length from Quantity,
|
||||||
ShadingAspect from Prs3d,
|
ShadingAspect from Prs3d,
|
||||||
|
TypeOfHighlightMethod from Aspect,
|
||||||
TypeOfPresentation3d from PrsMgr,
|
TypeOfPresentation3d from PrsMgr,
|
||||||
DataStructureManager from Graphic3d,
|
DataStructureManager from Graphic3d,
|
||||||
Structure from Graphic3d,
|
Structure from Graphic3d,
|
||||||
@ -45,57 +47,52 @@ is
|
|||||||
---C++: alias ~
|
---C++: alias ~
|
||||||
|
|
||||||
Display (me : mutable)
|
Display (me : mutable)
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
Display (me : mutable;
|
display (me : mutable;
|
||||||
theIsHighlight : Boolean from Standard)
|
theIsHighlight : Boolean from Standard)
|
||||||
is static private;
|
is static private;
|
||||||
---Purpose: Displays myStructure.
|
---Purpose: Displays myStructure.
|
||||||
|
|
||||||
Erase (me : mutable)
|
Erase (me : mutable)
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
SetVisible (me : mutable;
|
SetVisible (me : mutable;
|
||||||
theValue : Boolean from Standard)
|
theValue : Boolean from Standard)
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
Highlight (me : mutable) is virtual private;
|
Highlight (me : mutable;
|
||||||
|
theMethod : TypeOfHighlightMethod from Aspect;
|
||||||
|
theColor : Color from Quantity) is private;
|
||||||
|
|
||||||
Unhighlight (me) is virtual private;
|
Unhighlight (me) is private;
|
||||||
|
|
||||||
IsHighlighted (me) returns Boolean from Standard
|
IsHighlighted (me) returns Boolean from Standard
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
IsDisplayed (me) returns Boolean from Standard
|
IsDisplayed (me) returns Boolean from Standard
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
DisplayPriority(me) returns Integer from Standard
|
DisplayPriority(me) returns Integer from Standard
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||||
is virtual private;
|
is private;
|
||||||
|
|
||||||
SetZLayer (me : mutable;
|
SetZLayer (me : mutable;
|
||||||
theLayerId : Integer from Standard)
|
theLayerId : Integer from Standard)
|
||||||
is virtual private;
|
is private;
|
||||||
---Purpose: Set Z layer ID for the presentation
|
---Purpose: Set Z layer ID for the presentation
|
||||||
|
|
||||||
GetZLayer (me) returns Integer from Standard
|
GetZLayer (me) returns Integer from Standard
|
||||||
is virtual private;
|
is private;
|
||||||
---Purpose: Get Z layer ID for the presentation
|
---Purpose: Get Z layer ID for the presentation
|
||||||
|
|
||||||
Clear (me : mutable)
|
Clear (me : mutable)
|
||||||
is virtual private;
|
is private;
|
||||||
---Purpose: removes the whole content of the presentation.
|
---Purpose: removes the whole content of the presentation.
|
||||||
-- Does not remove the other connected presentations.
|
-- Does not remove the other connected presentations.
|
||||||
|
|
||||||
Color (me : mutable;
|
|
||||||
theColor : NameOfColor from Quantity)
|
|
||||||
is virtual private;
|
|
||||||
|
|
||||||
BoundBox (me)
|
|
||||||
is static private;
|
|
||||||
|
|
||||||
---Category: references to other presentation.
|
---Category: references to other presentation.
|
||||||
|
|
||||||
Connect (me;
|
Connect (me;
|
||||||
|
@ -30,7 +30,7 @@ namespace
|
|||||||
State_Visible
|
State_Visible
|
||||||
};
|
};
|
||||||
|
|
||||||
static BeforeHighlightState StructureState(const Handle(PrsMgr_Prs) theStructure)
|
static BeforeHighlightState StructureState(const Handle(PrsMgr_Prs)& theStructure)
|
||||||
{
|
{
|
||||||
return !theStructure->IsDisplayed() ?
|
return !theStructure->IsDisplayed() ?
|
||||||
State_Empty : !theStructure->IsVisible() ?
|
State_Empty : !theStructure->IsVisible() ?
|
||||||
@ -61,15 +61,15 @@ PrsMgr_Presentation::PrsMgr_Presentation (const Handle(PrsMgr_PresentationManage
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void PrsMgr_Presentation::Display()
|
void PrsMgr_Presentation::Display()
|
||||||
{
|
{
|
||||||
Display (Standard_False);
|
display (Standard_False);
|
||||||
myBeforeHighlightState = State_Visible;
|
myBeforeHighlightState = State_Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Display
|
//function : display
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void PrsMgr_Presentation::Display (const Standard_Boolean theIsHighlight)
|
void PrsMgr_Presentation::display (const Standard_Boolean theIsHighlight)
|
||||||
{
|
{
|
||||||
if (!myStructure->IsDisplayed())
|
if (!myStructure->IsDisplayed())
|
||||||
{
|
{
|
||||||
@ -116,15 +116,16 @@ void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue)
|
|||||||
//function : Highlight
|
//function : Highlight
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void PrsMgr_Presentation::Highlight()
|
void PrsMgr_Presentation::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
|
||||||
|
const Quantity_Color& theColor)
|
||||||
{
|
{
|
||||||
if (!IsHighlighted())
|
if (!IsHighlighted())
|
||||||
{
|
{
|
||||||
myBeforeHighlightState = StructureState (myStructure);
|
myBeforeHighlightState = StructureState (myStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
Display (Standard_True);
|
display (Standard_True);
|
||||||
myStructure->Highlight();
|
myStructure->Highlight (theMethod, theColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -169,30 +170,6 @@ void PrsMgr_Presentation::Clear()
|
|||||||
myStructure->RemoveAll();
|
myStructure->RemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Color
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void PrsMgr_Presentation::Color (const Quantity_NameOfColor theColor)
|
|
||||||
{
|
|
||||||
if (!IsHighlighted())
|
|
||||||
{
|
|
||||||
myBeforeHighlightState = StructureState (myStructure);
|
|
||||||
}
|
|
||||||
|
|
||||||
Display (Standard_True);
|
|
||||||
myStructure->Color (theColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BoundBox
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void PrsMgr_Presentation::BoundBox() const
|
|
||||||
{
|
|
||||||
myStructure->BoundBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsDisplayed
|
//function : IsDisplayed
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -28,10 +28,12 @@ uses
|
|||||||
PresentableObject from PrsMgr,
|
PresentableObject from PrsMgr,
|
||||||
ListOfPresentations from PrsMgr,
|
ListOfPresentations from PrsMgr,
|
||||||
Length,NameOfColor from Quantity,
|
Length,NameOfColor from Quantity,
|
||||||
|
Color from Quantity,
|
||||||
Transformation from Geom,
|
Transformation from Geom,
|
||||||
NameOfMaterial from Graphic3d,
|
NameOfMaterial from Graphic3d,
|
||||||
Presentation from PrsMgr,
|
Presentation from PrsMgr,
|
||||||
View from V3d,
|
View from V3d,
|
||||||
|
ViewManager from Visual3d,
|
||||||
ShadingAspect from Prs3d,
|
ShadingAspect from Prs3d,
|
||||||
Presentation from Prs3d
|
Presentation from Prs3d
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ raises
|
|||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
Create (theStructureManager : StructureManager from Graphic3d)
|
Create (theStructureManager : ViewManager from Visual3d)
|
||||||
returns PresentationManager from PrsMgr;
|
returns PresentationManager from PrsMgr;
|
||||||
---Purpose:
|
---Purpose:
|
||||||
-- Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
|
-- Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
|
||||||
@ -232,30 +234,26 @@ is
|
|||||||
|
|
||||||
Presentation (me;
|
Presentation (me;
|
||||||
thePrsObject : PresentableObject from PrsMgr;
|
thePrsObject : PresentableObject from PrsMgr;
|
||||||
theMode : Integer from Standard = 0)
|
theMode : Integer from Standard = 0;
|
||||||
|
theToCreate : Boolean from Standard = Standard_False)
|
||||||
returns Presentation from PrsMgr
|
returns Presentation from PrsMgr
|
||||||
raises NoSuchObject from Standard
|
|
||||||
is static;
|
is static;
|
||||||
---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework. thePrsObject has the display mode theMode.
|
---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework.
|
||||||
|
-- When theToCreate is true - automatically creates presentation for specified mode when not exist.
|
||||||
AddPresentation (me : mutable;
|
|
||||||
thePrsObject : PresentableObject from PrsMgr;
|
|
||||||
theMode : Integer from Standard = 0)
|
|
||||||
---Purpose: Adds a presentation of the presentable object thePrsObject to this framework.
|
|
||||||
-- thePrsObject has the display mode theMode.
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
RemovePresentation (me : mutable;
|
RemovePresentation (me : mutable;
|
||||||
thePrsObject : PresentableObject from PrsMgr;
|
thePrsObject : PresentableObject from PrsMgr;
|
||||||
theMode : Integer from Standard = 0)
|
theMode : Integer from Standard = 0)
|
||||||
|
returns Boolean from Standard
|
||||||
---Purpose: Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
|
---Purpose: Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
|
||||||
is protected;
|
is protected;
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
myStructureManager : StructureManager from Graphic3d is protected;
|
myStructureManager : ViewManager from Visual3d is protected;
|
||||||
myImmediateModeOn : Integer from Standard is protected;
|
myImmediateModeOn : Integer from Standard is protected;
|
||||||
myImmediateList : ListOfPresentations from PrsMgr is protected;
|
myImmediateList : ListOfPresentations from PrsMgr is protected;
|
||||||
myImmediateView : View from V3d is protected;
|
myImmediateView : View from V3d is protected;
|
||||||
|
mySelectionColor : Color from Quantity is protected;
|
||||||
|
|
||||||
end PresentationManager from PrsMgr;
|
end PresentationManager from PrsMgr;
|
||||||
|
@ -29,9 +29,10 @@
|
|||||||
// function : PrsMgr_PresentationManager
|
// function : PrsMgr_PresentationManager
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager)
|
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Visual3d_ViewManager)& theStructureManager)
|
||||||
: myStructureManager (theStructureManager),
|
: myStructureManager (theStructureManager),
|
||||||
myImmediateModeOn (0)
|
myImmediateModeOn (0),
|
||||||
|
mySelectionColor (Quantity_NOC_GRAY99)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -45,15 +46,7 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)
|
|||||||
{
|
{
|
||||||
if (thePrsObj->HasOwnPresentations())
|
if (thePrsObj->HasOwnPresentations())
|
||||||
{
|
{
|
||||||
if (!HasPresentation (thePrsObj, theMode))
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||||
{
|
|
||||||
AddPresentation (thePrsObj, theMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
|
||||||
|
|
||||||
if (aPrs.IsNull()) return;
|
|
||||||
|
|
||||||
if (aPrs->MustBeUpdated())
|
if (aPrs->MustBeUpdated())
|
||||||
{
|
{
|
||||||
Update (thePrsObj, theMode);
|
Update (thePrsObj, theMode);
|
||||||
@ -91,10 +84,21 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)&
|
|||||||
Erase (anIter.Value(), theMode);
|
Erase (anIter.Value(), theMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasPresentation (thePrsObj, theMode))
|
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||||
|
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||||
{
|
{
|
||||||
Presentation (thePrsObj, theMode)->Erase();
|
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||||
RemovePresentation (thePrsObj, theMode);
|
const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager();
|
||||||
|
if (theMode == aPrsList (aPrsIter).Mode()
|
||||||
|
&& this == aPrsMgr)
|
||||||
|
{
|
||||||
|
if (!aModedPrs.Presentation().IsNull())
|
||||||
|
{
|
||||||
|
aModedPrs.Presentation()->Erase();
|
||||||
|
}
|
||||||
|
aPrsList.Remove (aPrsIter);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,9 +114,10 @@ void PrsMgr_PresentationManager::Clear (const Handle(PrsMgr_PresentableObject)&
|
|||||||
Clear (anIter.Value(), theMode);
|
Clear (anIter.Value(), theMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasPresentation (thePrsObj, theMode))
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
|
if (!aPrs.IsNull())
|
||||||
{
|
{
|
||||||
Presentation (thePrsObj, theMode)->Clear();
|
aPrs->Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,14 +157,7 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasPresentation (thePrsObj, theMode))
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||||
{
|
|
||||||
AddPresentation (thePrsObj, theMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HasPresentation (thePrsObj, theMode)) return;
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
|
||||||
if (aPrs->MustBeUpdated())
|
if (aPrs->MustBeUpdated())
|
||||||
{
|
{
|
||||||
Update (thePrsObj, theMode);
|
Update (thePrsObj, theMode);
|
||||||
@ -168,12 +166,12 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
|
|||||||
if (myImmediateModeOn > 0)
|
if (myImmediateModeOn > 0)
|
||||||
{
|
{
|
||||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
||||||
aShadow->Highlight();
|
aShadow->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
||||||
AddToImmediateList (aShadow);
|
AddToImmediateList (aShadow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPrs->Highlight();
|
aPrs->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,9 +187,10 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj
|
|||||||
Unhighlight (anIter.Value(), theMode);
|
Unhighlight (anIter.Value(), theMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasPresentation (thePrsObj, theMode))
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
|
if (!aPrs.IsNull())
|
||||||
{
|
{
|
||||||
Presentation (thePrsObj, theMode)->Unhighlight();
|
aPrs->Unhighlight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,9 +207,10 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
|
|||||||
SetDisplayPriority (anIter.Value(), theMode, theNewPrior);
|
SetDisplayPriority (anIter.Value(), theMode, theNewPrior);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasPresentation (thePrsObj, theMode))
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
|
if (!aPrs.IsNull())
|
||||||
{
|
{
|
||||||
Presentation (thePrsObj, theMode)->SetDisplayPriority (theNewPrior);
|
aPrs->SetDisplayPriority (theNewPrior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +230,10 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasPresentation (thePrsObj, theMode)
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
? Presentation (thePrsObj, theMode)->DisplayPriority()
|
return !aPrs.IsNull()
|
||||||
: 0;
|
? aPrs->DisplayPriority()
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -250,8 +251,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasPresentation (thePrsObj, theMode)
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
&& Presentation (thePrsObj, theMode)->IsDisplayed();
|
return !aPrs.IsNull()
|
||||||
|
&& aPrs->IsDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -269,8 +271,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasPresentation (thePrsObj, theMode)
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
&& Presentation (thePrsObj, theMode)->IsHighlighted();
|
return !aPrs.IsNull()
|
||||||
|
&& aPrs->IsHighlighted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -284,10 +287,6 @@ void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)&
|
|||||||
{
|
{
|
||||||
Update (anIter.Value(), theMode);
|
Update (anIter.Value(), theMode);
|
||||||
}
|
}
|
||||||
if (!HasPresentation(thePrsObj, theMode))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
if (!aPrs.IsNull())
|
if (!aPrs.IsNull())
|
||||||
@ -405,14 +404,10 @@ Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMg
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||||
const Standard_Integer theMode) const
|
const Standard_Integer theMode,
|
||||||
|
const Standard_Boolean theToCreate) const
|
||||||
{
|
{
|
||||||
const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||||
if (aPrsList.IsEmpty())
|
|
||||||
{
|
|
||||||
return Handle(PrsMgr_Presentation)();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||||
{
|
{
|
||||||
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||||
@ -424,46 +419,41 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Handle(PrsMgr_Presentation)();
|
if (!theToCreate)
|
||||||
}
|
{
|
||||||
|
return Handle(PrsMgr_Presentation)();
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : AddPresentation
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
|
||||||
const Standard_Integer theMode)
|
|
||||||
{
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj);
|
Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj);
|
||||||
|
aPrs->SetZLayer (thePrsObj->ZLayer());
|
||||||
thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode));
|
thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode));
|
||||||
thePrsObj->Fill (this, aPrs, theMode);
|
thePrsObj->Fill (this, aPrs, theMode);
|
||||||
|
|
||||||
// set layer index accordingly to object's presentations
|
// set layer index accordingly to object's presentations
|
||||||
const Standard_Integer aZLayerId = GetZLayer (thePrsObj);
|
|
||||||
if (aZLayerId >= 0)
|
|
||||||
{
|
|
||||||
aPrs->SetZLayer (aZLayerId);
|
|
||||||
}
|
|
||||||
aPrs->SetUpdateStatus (Standard_False);
|
aPrs->SetUpdateStatus (Standard_False);
|
||||||
|
return aPrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : RemovePresentation
|
// function : RemovePresentation
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
Standard_Boolean PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||||
{
|
{
|
||||||
if (theMode == aPrsList (aPrsIter).Mode())
|
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||||
// && this == aPrsMgr) ??
|
const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager();
|
||||||
|
if (theMode == aPrsList (aPrsIter).Mode()
|
||||||
|
&& this == aPrsMgr)
|
||||||
{
|
{
|
||||||
aPrsList.Remove (aPrsIter);
|
aPrsList.Remove (aPrsIter);
|
||||||
break;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -481,15 +471,8 @@ void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObjec
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
|
||||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
thePrsObj->SetZLayer (theLayerId);
|
||||||
{
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = aPrsList.ChangeValue (aPrsIter).Presentation();
|
|
||||||
if (aPrs->PresentationManager() == this)
|
|
||||||
{
|
|
||||||
aPrs->SetZLayer (theLayerId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -498,28 +481,7 @@ void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObjec
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Integer PrsMgr_PresentationManager::GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj) const
|
Standard_Integer PrsMgr_PresentationManager::GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj) const
|
||||||
{
|
{
|
||||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
return thePrsObj->ZLayer();
|
||||||
{
|
|
||||||
Standard_Integer aLayer = GetZLayer (anIter.Value());
|
|
||||||
if (aLayer != -1)
|
|
||||||
{
|
|
||||||
return aLayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!thePrsObj->HasOwnPresentations())
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
|
||||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
|
||||||
{
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = aPrsList.Value (aPrsIter).Presentation();
|
|
||||||
if (aPrs->PresentationManager() == this)
|
|
||||||
{
|
|
||||||
return aPrs->GetZLayer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -531,15 +493,9 @@ void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject)
|
|||||||
const Standard_Integer theMode,
|
const Standard_Integer theMode,
|
||||||
const Standard_Integer theOtherMode)
|
const Standard_Integer theOtherMode)
|
||||||
{
|
{
|
||||||
if (!HasPresentation (thePrsObject, theMode))
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObject, theMode, Standard_True);
|
||||||
{
|
Handle(PrsMgr_Presentation) aPrsOther = Presentation (theOtherObject, theOtherMode, Standard_True);
|
||||||
AddPresentation (thePrsObject, theMode);
|
aPrs->Connect (aPrsOther);
|
||||||
}
|
|
||||||
if (!HasPresentation (theOtherObject, theOtherMode))
|
|
||||||
{
|
|
||||||
AddPresentation (theOtherObject, theOtherMode);
|
|
||||||
}
|
|
||||||
Presentation (thePrsObject, theMode)->Connect (Presentation (theOtherObject, theOtherMode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -571,14 +527,7 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasPresentation (thePrsObj, theMode))
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||||
{
|
|
||||||
AddPresentation (thePrsObj, theMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HasPresentation (thePrsObj, theMode)) return;
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
|
||||||
if (aPrs->MustBeUpdated())
|
if (aPrs->MustBeUpdated())
|
||||||
{
|
{
|
||||||
Update (thePrsObj, theMode);
|
Update (thePrsObj, theMode);
|
||||||
@ -587,12 +536,12 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
|||||||
if (myImmediateModeOn > 0)
|
if (myImmediateModeOn > 0)
|
||||||
{
|
{
|
||||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
||||||
aShadow->Color (theColor);
|
aShadow->Highlight (Aspect_TOHM_COLOR, theColor);
|
||||||
AddToImmediateList (aShadow);
|
AddToImmediateList (aShadow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPrs->Color (theColor);
|
aPrs->Highlight (Aspect_TOHM_COLOR, theColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,18 +549,15 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
|||||||
// function : BoundBox
|
// function : BoundBox
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (!HasPresentation (thePrsObject, theMode))
|
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||||
|
if (aPrs->MustBeUpdated())
|
||||||
{
|
{
|
||||||
AddPresentation (thePrsObject, theMode);
|
Update (thePrsObj, theMode);
|
||||||
}
|
}
|
||||||
else if (Presentation (thePrsObject, theMode)->MustBeUpdated())
|
aPrs->Highlight (Aspect_TOHM_BOUNDBOX, mySelectionColor);
|
||||||
{
|
|
||||||
Update (thePrsObject, theMode);
|
|
||||||
}
|
|
||||||
Presentation (thePrsObject, theMode)->BoundBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -633,12 +579,13 @@ void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_Presentab
|
|||||||
// function : SetShadingAspect
|
// function : SetShadingAspect
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||||
const Handle(Prs3d_ShadingAspect)& theShadingAspect,
|
const Handle(Prs3d_ShadingAspect)& theShadingAspect,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (HasPresentation (thePrsObject, theMode))
|
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||||
|
if (!aPrs.IsNull())
|
||||||
{
|
{
|
||||||
Presentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect);
|
aPrs->SetShadingAspect (theShadingAspect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,8 @@ uses
|
|||||||
NameOfColor from Quantity,
|
NameOfColor from Quantity,
|
||||||
Location from TopLoc,
|
Location from TopLoc,
|
||||||
PresentationManager from PrsMgr,
|
PresentationManager from PrsMgr,
|
||||||
PresentationManager3d from PrsMgr
|
PresentationManager3d from PrsMgr,
|
||||||
|
ZLayerId from Graphic3d
|
||||||
|
|
||||||
raises
|
raises
|
||||||
NoSuchObject from Standard
|
NoSuchObject from Standard
|
||||||
@ -161,8 +162,7 @@ is
|
|||||||
-- it always return FALSE.
|
-- it always return FALSE.
|
||||||
|
|
||||||
SetZLayer ( me : mutable;
|
SetZLayer ( me : mutable;
|
||||||
thePrsMgr : PresentationManager from PrsMgr;
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
theLayerId : Integer from Standard )
|
|
||||||
is virtual;
|
is virtual;
|
||||||
---Purpose: Set Z layer ID and update all presentations.
|
---Purpose: Set Z layer ID and update all presentations.
|
||||||
|
|
||||||
|
@ -153,8 +153,7 @@ Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
|
|||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_EntityOwner::SetZLayer
|
void SelectMgr_EntityOwner::SetZLayer (const Standard_Integer )
|
||||||
(const Handle(PrsMgr_PresentationManager)&,
|
|
||||||
const Standard_Integer)
|
|
||||||
{
|
{
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ uses
|
|||||||
SequenceOfOwner from SelectMgr,
|
SequenceOfOwner from SelectMgr,
|
||||||
NameOfColor from Quantity,
|
NameOfColor from Quantity,
|
||||||
EntityOwner from SelectMgr,
|
EntityOwner from SelectMgr,
|
||||||
TransModeFlags from Graphic3d
|
TransModeFlags from Graphic3d,
|
||||||
|
ZLayerId from Graphic3d
|
||||||
|
|
||||||
raises
|
raises
|
||||||
NotImplemented from Standard
|
NotImplemented from Standard
|
||||||
@ -178,16 +179,12 @@ is
|
|||||||
|
|
||||||
GetSelectPresentation( me: mutable;
|
GetSelectPresentation( me: mutable;
|
||||||
TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static;
|
TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static;
|
||||||
|
|
||||||
SetZLayer ( me : mutable;
|
SetZLayer ( me : mutable;
|
||||||
thePrsMgr : PresentationManager from PrsMgr;
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
theLayerId : Integer from Standard )
|
|
||||||
is redefined virtual;
|
is redefined virtual;
|
||||||
---Purpose: Set Z layer ID and update all presentations of
|
---Purpose: Set Z layer ID and update all presentations of the selectable object.
|
||||||
-- the selectable object. The layer can be set only for displayed object.
|
-- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
|
||||||
-- If all object presentations are removed, the layer ID will be set to
|
|
||||||
-- default value when computing presentation. The layers mechanism allows
|
|
||||||
-- drawing objects in higher layers in overlay of objects in lower layers.
|
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
@ -199,6 +196,3 @@ fields
|
|||||||
myHilightPrs : Presentation from Prs3d;
|
myHilightPrs : Presentation from Prs3d;
|
||||||
|
|
||||||
end SelectableObject;
|
end SelectableObject;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,15 +322,10 @@ Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation( co
|
|||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_SelectableObject::SetZLayer
|
void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
|
||||||
const Standard_Integer theLayerId)
|
|
||||||
{
|
{
|
||||||
if (thePrsMgr.IsNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// update own presentations
|
// update own presentations
|
||||||
PrsMgr_PresentableObject::SetZLayer (thePrsMgr, theLayerId);
|
PrsMgr_PresentableObject::SetZLayer (theLayerId);
|
||||||
|
|
||||||
// update selection presentations
|
// update selection presentations
|
||||||
if (!mySelectionPrs.IsNull())
|
if (!mySelectionPrs.IsNull())
|
||||||
@ -352,7 +347,7 @@ void SelectMgr_SelectableObject::SetZLayer
|
|||||||
Handle(SelectMgr_EntityOwner) aOwner =
|
Handle(SelectMgr_EntityOwner) aOwner =
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId());
|
Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId());
|
||||||
if (!aOwner.IsNull())
|
if (!aOwner.IsNull())
|
||||||
aOwner->SetZLayer (thePrsMgr, theLayerId);
|
aOwner->SetZLayer (theLayerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,8 @@ uses
|
|||||||
PresentationManager3d from PrsMgr,
|
PresentationManager3d from PrsMgr,
|
||||||
NameOfColor from Quantity,
|
NameOfColor from Quantity,
|
||||||
Drawer from Prs3d,
|
Drawer from Prs3d,
|
||||||
Shape from StdSelect
|
Shape from StdSelect,
|
||||||
|
ZLayerId from Graphic3d
|
||||||
is
|
is
|
||||||
|
|
||||||
|
|
||||||
@ -145,8 +146,7 @@ is
|
|||||||
ResetLocation(me:mutable) is redefined;
|
ResetLocation(me:mutable) is redefined;
|
||||||
|
|
||||||
SetZLayer ( me : mutable;
|
SetZLayer ( me : mutable;
|
||||||
thePrsMgr : PresentationManager from PrsMgr;
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
theLayerId : Integer from Standard )
|
|
||||||
is redefined virtual;
|
is redefined virtual;
|
||||||
---Purpose: Set Z layer ID and update all presentations.
|
---Purpose: Set Z layer ID and update all presentations.
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ void StdSelect_BRepOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
|
|||||||
#else
|
#else
|
||||||
Standard_Integer M = (myCurMode==-1) ? aMode:myCurMode;
|
Standard_Integer M = (myCurMode==-1) ? aMode:myCurMode;
|
||||||
#endif
|
#endif
|
||||||
|
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
||||||
if (myFromDecomposition)
|
if (myFromDecomposition)
|
||||||
{
|
{
|
||||||
// do the update flag check
|
// do the update flag check
|
||||||
@ -99,23 +100,23 @@ void StdSelect_BRepOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generate new presentable shape
|
// generate new presentable shape
|
||||||
if(myPrsSh.IsNull())
|
if (myPrsSh.IsNull())
|
||||||
|
{
|
||||||
myPrsSh = new StdSelect_Shape (myShape);
|
myPrsSh = new StdSelect_Shape (myShape);
|
||||||
|
}
|
||||||
|
if (!aSel.IsNull())
|
||||||
|
{
|
||||||
|
myPrsSh->SetZLayer (aSel->ZLayer());
|
||||||
|
}
|
||||||
|
|
||||||
// highlight and set layer
|
// highlight and set layer
|
||||||
PM->Highlight (myPrsSh, M);
|
PM->Highlight (myPrsSh, M);
|
||||||
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
|
||||||
if (!aSel.IsNull())
|
|
||||||
{
|
|
||||||
Standard_Integer aLayer = aSel->GetZLayer (PM);
|
|
||||||
if (aLayer >= 0)
|
|
||||||
PM->SetZLayer (myPrsSh, aLayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myPrsSh.IsNull())
|
if(myPrsSh.IsNull())
|
||||||
PM->Highlight(Selectable(),M);
|
PM->Highlight(aSel,M);
|
||||||
else
|
else
|
||||||
PM->Highlight(myPrsSh,M);
|
PM->Highlight(myPrsSh,M);
|
||||||
}
|
}
|
||||||
@ -133,6 +134,7 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
|
|||||||
#else
|
#else
|
||||||
Standard_Integer M = (myCurMode==-1) ? aMode:myCurMode;
|
Standard_Integer M = (myCurMode==-1) ? aMode:myCurMode;
|
||||||
#endif
|
#endif
|
||||||
|
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
||||||
if (myFromDecomposition)
|
if (myFromDecomposition)
|
||||||
{
|
{
|
||||||
// do the update flag check
|
// do the update flag check
|
||||||
@ -156,21 +158,18 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
|
|||||||
else
|
else
|
||||||
myPrsSh = new StdSelect_Shape(myShape);
|
myPrsSh = new StdSelect_Shape(myShape);
|
||||||
}
|
}
|
||||||
|
if (!aSel.IsNull())
|
||||||
|
{
|
||||||
|
myPrsSh->SetZLayer (aSel->ZLayer());
|
||||||
|
}
|
||||||
|
|
||||||
// highlight with color and set layer
|
// highlight with color and set layer
|
||||||
PM->Color (myPrsSh, aCol, M);
|
PM->Color (myPrsSh, aCol, M);
|
||||||
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
|
||||||
if (!aSel.IsNull())
|
|
||||||
{
|
|
||||||
Standard_Integer aLayer = aSel->GetZLayer (PM);
|
|
||||||
if (aLayer >= 0)
|
|
||||||
PM->SetZLayer (myPrsSh, aLayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myPrsSh.IsNull())
|
if(myPrsSh.IsNull())
|
||||||
PM->Color(Selectable(),aCol,M);
|
PM->Color(aSel, aCol, M);
|
||||||
else
|
else
|
||||||
PM->Color(myPrsSh,aCol,M);
|
PM->Color(myPrsSh,aCol,M);
|
||||||
}
|
}
|
||||||
@ -227,10 +226,10 @@ void StdSelect_BRepOwner::ResetLocation()
|
|||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void StdSelect_BRepOwner::SetZLayer
|
void StdSelect_BRepOwner::SetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
|
||||||
const Standard_Integer theLayerId)
|
|
||||||
{
|
{
|
||||||
if (!myPrsSh.IsNull())
|
if (!myPrsSh.IsNull())
|
||||||
thePrsMgr->SetZLayer (myPrsSh, theLayerId);
|
{
|
||||||
|
myPrsSh->SetZLayer (theLayerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,8 @@ void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_C
|
|||||||
|
|
||||||
void V3d_CircularGrid::Display ()
|
void V3d_CircularGrid::Display ()
|
||||||
{
|
{
|
||||||
myStructure->Display (1);
|
myStructure->SetDisplayPriority (1);
|
||||||
|
myStructure->Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::Erase () const
|
void V3d_CircularGrid::Erase () const
|
||||||
|
@ -236,7 +236,6 @@ void V3d_DirectionalLight::Display( const Handle(V3d_View)& aView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||||
MyGraphicStructure1->SetPick(Standard_False);
|
|
||||||
|
|
||||||
X0 = MyTarget.X();
|
X0 = MyTarget.X();
|
||||||
Y0 = MyTarget.Y();
|
Y0 = MyTarget.Y();
|
||||||
|
@ -85,7 +85,8 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView,
|
|||||||
aPrims->AddVertex ( aSize,-aSize, anOffset);
|
aPrims->AddVertex ( aSize,-aSize, anOffset);
|
||||||
aGroup->AddPrimitiveArray(aPrims);
|
aGroup->AddPrimitiveArray(aPrims);
|
||||||
|
|
||||||
myGraphicStructure->Display(0);
|
myGraphicStructure->SetDisplayPriority (0);
|
||||||
|
myGraphicStructure->Display();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,6 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||||
MyGraphicStructure1->SetPick(Standard_False);
|
|
||||||
|
|
||||||
X0 = MyTarget.X();
|
X0 = MyTarget.X();
|
||||||
Y0 = MyTarget.Y();
|
Y0 = MyTarget.Y();
|
||||||
|
@ -228,7 +228,6 @@ void V3d_PositionalLight::Display( const Handle(V3d_View)& aView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||||
MyGraphicStructure1->SetPick(Standard_False);
|
|
||||||
|
|
||||||
X0 = MyTarget.X();
|
X0 = MyTarget.X();
|
||||||
Y0 = MyTarget.Y();
|
Y0 = MyTarget.Y();
|
||||||
|
@ -96,7 +96,8 @@ void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantit
|
|||||||
|
|
||||||
void V3d_RectangularGrid::Display ()
|
void V3d_RectangularGrid::Display ()
|
||||||
{
|
{
|
||||||
myStructure->Display (1);
|
myStructure->SetDisplayPriority (1);
|
||||||
|
myStructure->Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::Erase () const
|
void V3d_RectangularGrid::Erase () const
|
||||||
|
@ -246,7 +246,6 @@ void V3d_SpotLight::Display( const Handle(V3d_View)& aView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||||
MyGraphicStructure1->SetPick(Standard_False);
|
|
||||||
|
|
||||||
X0 = MyTarget.X();
|
X0 = MyTarget.X();
|
||||||
Y0 = MyTarget.Y();
|
Y0 = MyTarget.Y();
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include <Aspect_Window.hxx>
|
#include <Aspect_Window.hxx>
|
||||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||||
#include <Graphic3d_AspectLine3d.hxx>
|
#include <Graphic3d_AspectLine3d.hxx>
|
||||||
|
#include <Graphic3d_CStructure.hxx>
|
||||||
#include <Graphic3d_TextureRoot.hxx>
|
#include <Graphic3d_TextureRoot.hxx>
|
||||||
#include <Image_AlienPixMap.hxx>
|
#include <Image_AlienPixMap.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
@ -2223,8 +2224,9 @@ int VErase (Draw_Interpretor& theDI,
|
|||||||
Standard_Integer theArgNb,
|
Standard_Integer theArgNb,
|
||||||
const char** theArgVec)
|
const char** theArgVec)
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||||
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
|
const Handle(V3d_View)& aView = ViewerTest::CurrentView();
|
||||||
|
ViewerTest_AutoUpdater anUpdateTool (aCtx, aView);
|
||||||
if (aCtx.IsNull())
|
if (aCtx.IsNull())
|
||||||
{
|
{
|
||||||
std::cerr << "Error: no active view!\n";
|
std::cerr << "Error: no active view!\n";
|
||||||
@ -2473,7 +2475,11 @@ inline void bndPresentation (Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
case BndAction_Show:
|
case BndAction_Show:
|
||||||
{
|
{
|
||||||
thePrs->Presentation()->BoundBox();
|
Handle(Graphic3d_Structure) aPrs = thePrs->Presentation();
|
||||||
|
aPrs->CStructure()->HighlightColor.r = 0.988235f;
|
||||||
|
aPrs->CStructure()->HighlightColor.g = 0.988235f;
|
||||||
|
aPrs->CStructure()->HighlightColor.b = 0.988235f;
|
||||||
|
aPrs->CStructure()->HighlightWithBndBox (aPrs, Standard_True);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BndAction_Print:
|
case BndAction_Print:
|
||||||
@ -2905,9 +2911,12 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
|||||||
|
|
||||||
// Parse input arguments
|
// Parse input arguments
|
||||||
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
|
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
|
||||||
Standard_Integer isMutable = -1;
|
Standard_Integer isMutable = -1;
|
||||||
Standard_Boolean toDisplayLocal = Standard_False;
|
Graphic3d_ZLayerId aZLayer = Graphic3d_ZLayerId_UNKNOWN;
|
||||||
|
Standard_Boolean toDisplayLocal = Standard_False;
|
||||||
|
Standard_Boolean toReDisplay = Standard_False;
|
||||||
TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
|
TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
|
||||||
|
AIS_DisplayStatus aDispStatus = AIS_DS_None;
|
||||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
|
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
|
||||||
{
|
{
|
||||||
const TCollection_AsciiString aName = theArgVec[anArgIter];
|
const TCollection_AsciiString aName = theArgVec[anArgIter];
|
||||||
@ -2921,10 +2930,50 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
isMutable = 1;
|
isMutable = 1;
|
||||||
}
|
}
|
||||||
|
else if (aNameCase == "-neutral")
|
||||||
|
{
|
||||||
|
aDispStatus = AIS_DS_Displayed;
|
||||||
|
}
|
||||||
|
else if (aNameCase == "-immediate"
|
||||||
|
|| aNameCase == "-top")
|
||||||
|
{
|
||||||
|
aZLayer = Graphic3d_ZLayerId_Top;
|
||||||
|
}
|
||||||
|
else if (aNameCase == "-topmost")
|
||||||
|
{
|
||||||
|
aZLayer = Graphic3d_ZLayerId_Topmost;
|
||||||
|
}
|
||||||
|
else if (aNameCase == "-osd"
|
||||||
|
|| aNameCase == "-toposd")
|
||||||
|
{
|
||||||
|
aZLayer = Graphic3d_ZLayerId_TopOSD;
|
||||||
|
}
|
||||||
|
else if (aNameCase == "-layer")
|
||||||
|
{
|
||||||
|
if (++anArgIter >= theArgNb)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aValue (theArgVec[anArgIter]);
|
||||||
|
if (!aValue.IsIntegerValue())
|
||||||
|
{
|
||||||
|
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
aZLayer = aValue.IntegerValue();
|
||||||
|
}
|
||||||
else if (aNameCase == "-local")
|
else if (aNameCase == "-local")
|
||||||
{
|
{
|
||||||
|
aDispStatus = AIS_DS_Temporary;
|
||||||
toDisplayLocal = Standard_True;
|
toDisplayLocal = Standard_True;
|
||||||
}
|
}
|
||||||
|
else if (aNameCase == "-redisplay")
|
||||||
|
{
|
||||||
|
toReDisplay = Standard_True;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aNamesOfDisplayIO.Append (aName);
|
aNamesOfDisplayIO.Append (aName);
|
||||||
@ -2962,8 +3011,23 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aShape->SetMutable (isMutable == 1);
|
aShape->SetMutable (isMutable == 1);
|
||||||
}
|
}
|
||||||
|
if (aZLayer != Graphic3d_ZLayerId_UNKNOWN)
|
||||||
|
{
|
||||||
|
aShape->SetZLayer (aZLayer);
|
||||||
|
}
|
||||||
GetMapOfAIS().Bind (aShape, aName);
|
GetMapOfAIS().Bind (aShape, aName);
|
||||||
aCtx->Display (aShape, Standard_False);
|
|
||||||
|
Standard_Integer aDispMode = aShape->HasDisplayMode()
|
||||||
|
? aShape->DisplayMode()
|
||||||
|
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
|
||||||
|
? aCtx->DisplayMode()
|
||||||
|
: 0);
|
||||||
|
Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
|
||||||
|
? aShape->SelectionMode() : -1;
|
||||||
|
|
||||||
|
aCtx->Display (aShape, aDispMode, aSelMode,
|
||||||
|
Standard_False, aShape->AcceptShapeDecomposition(),
|
||||||
|
aDispStatus);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2976,6 +3040,18 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aShape->SetMutable (isMutable == 1);
|
aShape->SetMutable (isMutable == 1);
|
||||||
}
|
}
|
||||||
|
if (aZLayer != Graphic3d_ZLayerId_UNKNOWN)
|
||||||
|
{
|
||||||
|
aShape->SetZLayer (aZLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer aDispMode = aShape->HasDisplayMode()
|
||||||
|
? aShape->DisplayMode()
|
||||||
|
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
|
||||||
|
? aCtx->DisplayMode()
|
||||||
|
: 0);
|
||||||
|
Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
|
||||||
|
? aShape->SelectionMode() : -1;
|
||||||
|
|
||||||
if (aShape->Type() == AIS_KOI_Datum)
|
if (aShape->Type() == AIS_KOI_Datum)
|
||||||
{
|
{
|
||||||
@ -2984,17 +3060,26 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
theDI << "Display " << aName.ToCString() << "\n";
|
theDI << "Display " << aName.ToCString() << "\n";
|
||||||
// get the Shape from a name
|
|
||||||
TopoDS_Shape aNewShape = GetShapeFromName (aName.ToCString());
|
|
||||||
|
|
||||||
// update the Shape in the AIS_Shape
|
// update the Shape in the AIS_Shape
|
||||||
|
TopoDS_Shape aNewShape = GetShapeFromName (aName.ToCString());
|
||||||
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aShape);
|
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aShape);
|
||||||
if (!aShapePrs.IsNull())
|
if (!aShapePrs.IsNull())
|
||||||
{
|
{
|
||||||
|
if (!aShapePrs->Shape().IsEqual (aNewShape))
|
||||||
|
{
|
||||||
|
toReDisplay = Standard_True;
|
||||||
|
}
|
||||||
aShapePrs->Set (aNewShape);
|
aShapePrs->Set (aNewShape);
|
||||||
}
|
}
|
||||||
aCtx->Redisplay (aShape, Standard_False);
|
if (toReDisplay)
|
||||||
aCtx->Display (aShape, Standard_False);
|
{
|
||||||
|
aCtx->Redisplay (aShape, Standard_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
aCtx->Display (aShape, aDispMode, aSelMode,
|
||||||
|
Standard_False, aShape->AcceptShapeDecomposition(),
|
||||||
|
aDispStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (anObj->IsKind (STANDARD_TYPE (NIS_InteractiveObject)))
|
else if (anObj->IsKind (STANDARD_TYPE (NIS_InteractiveObject)))
|
||||||
|
@ -3517,6 +3517,18 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS());
|
||||||
|
anObjIter.More(); anObjIter.Next())
|
||||||
|
{
|
||||||
|
Handle(PrsMgr_PresentableObject) aPrs = Handle(PrsMgr_PresentableObject)::DownCast (anObjIter.Key1());
|
||||||
|
if (aPrs.IsNull()
|
||||||
|
|| aPrs->ZLayer() != aDelId)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
aPrs->SetZLayer (Graphic3d_ZLayerId_Default);
|
||||||
|
}
|
||||||
|
|
||||||
di << "Z layer " << aDelId << " has been removed\n";
|
di << "Z layer " << aDelId << " has been removed\n";
|
||||||
}
|
}
|
||||||
else if (anOp == "get")
|
else if (anOp == "get")
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
#include <Standard_TypeDef.hxx>
|
#include <Standard_TypeDef.hxx>
|
||||||
#include <NCollection_Map.hxx>
|
#include <NCollection_Map.hxx>
|
||||||
|
#include <Graphic3d_ZLayerId.hxx>
|
||||||
#include <Graphic3d_ZLayerSettings.hxx>
|
#include <Graphic3d_ZLayerSettings.hxx>
|
||||||
|
|
||||||
typedef NCollection_DataMap<Standard_Integer, Graphic3d_ZLayerSettings> Visual3d_MapOfZLayerSettings;
|
typedef NCollection_DataMap<Graphic3d_ZLayerId, Graphic3d_ZLayerSettings> Visual3d_MapOfZLayerSettings;
|
||||||
|
|
||||||
#endif // _Visual3d_MapOfZLayerSettings_HeaderFile
|
#endif // _Visual3d_MapOfZLayerSettings_HeaderFile
|
||||||
|
@ -85,6 +85,7 @@ uses
|
|||||||
MapOfStructure from Graphic3d,
|
MapOfStructure from Graphic3d,
|
||||||
Camera_Handle from Graphic3d,
|
Camera_Handle from Graphic3d,
|
||||||
|
|
||||||
|
ZLayerId from Graphic3d,
|
||||||
ZLayerSettings from Graphic3d,
|
ZLayerSettings from Graphic3d,
|
||||||
|
|
||||||
ContextView from Visual3d,
|
ContextView from Visual3d,
|
||||||
@ -107,6 +108,7 @@ uses
|
|||||||
AsciiString from TCollection,
|
AsciiString from TCollection,
|
||||||
ExtendedString from TCollection,
|
ExtendedString from TCollection,
|
||||||
CGraduatedTrihedron from Graphic3d,
|
CGraduatedTrihedron from Graphic3d,
|
||||||
|
TypeOfStructure from Graphic3d,
|
||||||
|
|
||||||
PixMap from Image,
|
PixMap from Image,
|
||||||
Box from Bnd
|
Box from Bnd
|
||||||
@ -752,14 +754,12 @@ is
|
|||||||
-- Category: Private methods
|
-- Category: Private methods
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
AcceptDisplay ( me;
|
acceptDisplay ( me;
|
||||||
AStructure : Structure from Graphic3d )
|
theStructType : TypeOfStructure from Graphic3d )
|
||||||
returns TypeOfAnswer from Visual3d
|
returns TypeOfAnswer from Visual3d
|
||||||
is static private;
|
is static private;
|
||||||
---Level: Internal
|
---Level: Internal
|
||||||
---Purpose: Is it possible to display the structure
|
---Purpose: Is it possible to display the structure in the view?
|
||||||
-- <AStructure> in the view <me> ?
|
|
||||||
---Category: Private methods
|
|
||||||
|
|
||||||
ReCompute ( me : mutable;
|
ReCompute ( me : mutable;
|
||||||
AStructure : Structure from Graphic3d );
|
AStructure : Structure from Graphic3d );
|
||||||
@ -787,13 +787,13 @@ is
|
|||||||
|
|
||||||
|
|
||||||
SetZLayerSettings ( me : mutable;
|
SetZLayerSettings ( me : mutable;
|
||||||
theLayerId : Integer from Standard;
|
theLayerId : ZLayerId from Graphic3d;
|
||||||
theSettings : ZLayerSettings from Graphic3d )
|
theSettings : ZLayerSettings from Graphic3d )
|
||||||
is static private;
|
is static private;
|
||||||
---Purpose: Sets the settings for a single Z layer of specified view.
|
---Purpose: Sets the settings for a single Z layer of specified view.
|
||||||
|
|
||||||
AddZLayer ( me : mutable;
|
AddZLayer ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is static private;
|
is static private;
|
||||||
---Purpose: Add a new top-level Z layer to the view with ID
|
---Purpose: Add a new top-level Z layer to the view with ID
|
||||||
-- <theLayerId>. The z layer mechanism allows to display
|
-- <theLayerId>. The z layer mechanism allows to display
|
||||||
@ -803,13 +803,13 @@ is
|
|||||||
-- display of graphics in all views.
|
-- display of graphics in all views.
|
||||||
|
|
||||||
RemoveZLayer ( me : mutable;
|
RemoveZLayer ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is static private;
|
is static private;
|
||||||
---Purpose: Remove z layer from the view by its ID.
|
---Purpose: Remove z layer from the view by its ID.
|
||||||
|
|
||||||
ChangeZLayer ( me : mutable;
|
ChangeZLayer ( me : mutable;
|
||||||
theStructure : Structure from Graphic3d;
|
theStructure : Structure from Graphic3d;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is static private;
|
is static private;
|
||||||
---Purpose: Change Z layer of already displayed structure in the view.
|
---Purpose: Change Z layer of already displayed structure in the view.
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <Graphic3d_Vertex.hxx>
|
#include <Graphic3d_Vertex.hxx>
|
||||||
#include <Visual3d_DepthCueingDefinitionError.hxx>
|
#include <Visual3d_DepthCueingDefinitionError.hxx>
|
||||||
#include <Visual3d_Light.hxx>
|
#include <Visual3d_Light.hxx>
|
||||||
#include <Visual3d_HSequenceOfView.hxx>
|
|
||||||
#include <Visual3d_ZClippingDefinitionError.hxx>
|
#include <Visual3d_ZClippingDefinitionError.hxx>
|
||||||
#include <OSD.hxx>
|
#include <OSD.hxx>
|
||||||
#include <TColStd_HArray2OfReal.hxx>
|
#include <TColStd_HArray2OfReal.hxx>
|
||||||
@ -712,10 +711,10 @@ void Visual3d_View::SetContext (const Visual3d_ContextView& theViewCtx)
|
|||||||
// It is not necessary to warn ViewManager as this structure should not disappear from
|
// It is not necessary to warn ViewManager as this structure should not disappear from
|
||||||
// the list of structures displayed in it.
|
// the list of structures displayed in it.
|
||||||
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructs;
|
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructs;
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_NO
|
if (anAnswer == Visual3d_TOA_NO
|
||||||
|| anAnswer == Visual3d_TOA_COMPUTE)
|
|| anAnswer == Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
@ -743,7 +742,7 @@ void Visual3d_View::SetContext (const Visual3d_ContextView& theViewCtx)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_YES
|
if (anAnswer == Visual3d_TOA_YES
|
||||||
|| anAnswer == Visual3d_TOA_COMPUTE)
|
|| anAnswer == Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
@ -780,7 +779,7 @@ void Visual3d_View::DisplayedStructures (Graphic3d_MapOfStructure& theStructures
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
theStructures.Add (aStructIter.Key());
|
theStructures.Add (aStructIter.Key());
|
||||||
}
|
}
|
||||||
@ -825,7 +824,7 @@ void Visual3d_View::Activate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the structure can be displayed in the new context of the view, it is displayed.
|
// If the structure can be displayed in the new context of the view, it is displayed.
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_YES
|
if (anAnswer == Visual3d_TOA_YES
|
||||||
|| anAnswer == Visual3d_TOA_COMPUTE)
|
|| anAnswer == Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
@ -898,7 +897,7 @@ void Visual3d_View::Deactivate()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_YES
|
if (anAnswer == Visual3d_TOA_YES
|
||||||
|| anAnswer == Visual3d_TOA_COMPUTE)
|
|| anAnswer == Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
@ -1131,13 +1130,13 @@ void Visual3d_View::ZFitAll (const Standard_Real theScaleFactor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// function : AcceptDisplay
|
// function : acceptDisplay
|
||||||
// purpose :
|
// purpose :
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
Visual3d_TypeOfAnswer Visual3d_View::AcceptDisplay (const Handle(Graphic3d_Structure)& theStruct) const
|
Visual3d_TypeOfAnswer Visual3d_View::acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const
|
||||||
{
|
{
|
||||||
const Visual3d_TypeOfVisualization ViewType = MyContext.Visualization();
|
const Visual3d_TypeOfVisualization aViewType = MyContext.Visualization();
|
||||||
switch (theStruct->Visual())
|
switch (theStructType)
|
||||||
{
|
{
|
||||||
case Graphic3d_TOS_ALL:
|
case Graphic3d_TOS_ALL:
|
||||||
{
|
{
|
||||||
@ -1145,19 +1144,19 @@ Visual3d_TypeOfAnswer Visual3d_View::AcceptDisplay (const Handle(Graphic3d_Struc
|
|||||||
}
|
}
|
||||||
case Graphic3d_TOS_SHADING:
|
case Graphic3d_TOS_SHADING:
|
||||||
{
|
{
|
||||||
return ViewType == Visual3d_TOV_SHADING
|
return aViewType == Visual3d_TOV_SHADING
|
||||||
? Visual3d_TOA_YES
|
? Visual3d_TOA_YES
|
||||||
: Visual3d_TOA_NO;
|
: Visual3d_TOA_NO;
|
||||||
}
|
}
|
||||||
case Graphic3d_TOS_WIREFRAME:
|
case Graphic3d_TOS_WIREFRAME:
|
||||||
{
|
{
|
||||||
return ViewType == Visual3d_TOV_WIREFRAME
|
return aViewType == Visual3d_TOV_WIREFRAME
|
||||||
? Visual3d_TOA_YES
|
? Visual3d_TOA_YES
|
||||||
: Visual3d_TOA_NO;
|
: Visual3d_TOA_NO;
|
||||||
}
|
}
|
||||||
case Graphic3d_TOS_COMPUTED:
|
case Graphic3d_TOS_COMPUTED:
|
||||||
{
|
{
|
||||||
return (ViewType == Visual3d_TOV_SHADING || ViewType == Visual3d_TOV_WIREFRAME)
|
return (aViewType == Visual3d_TOV_SHADING || aViewType == Visual3d_TOV_WIREFRAME)
|
||||||
? Visual3d_TOA_COMPUTE
|
? Visual3d_TOA_COMPUTE
|
||||||
: Visual3d_TOA_NO;
|
: Visual3d_TOA_NO;
|
||||||
}
|
}
|
||||||
@ -1260,18 +1259,18 @@ Standard_Boolean Visual3d_View::DisplayImmediate (const Handle(Graphic3d_Structu
|
|||||||
|
|
||||||
if (theIsSingleView)
|
if (theIsSingleView)
|
||||||
{
|
{
|
||||||
Handle(Visual3d_HSequenceOfView) aViews = myViewManager->DefinedView();
|
const Visual3d_SequenceOfView& aViews = myViewManager->DefinedViews();
|
||||||
|
for (Standard_Integer aViewIter = 1; aViewIter <= aViews.Length(); ++aViewIter)
|
||||||
for (int i=1;i<=aViews->Length();i++)
|
|
||||||
{
|
{
|
||||||
if (aViews->Value(i).Access() != this)
|
const Handle(Visual3d_View)& aView = aViews.Value (aViewIter);
|
||||||
|
if (aView.Access() != this)
|
||||||
{
|
{
|
||||||
aViews->Value(i)->EraseImmediate (theStructure);
|
aView->EraseImmediate (theStructure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myGraphicDriver->DisplayImmediateStructure (MyCView, *theStructure->CStructure());
|
myGraphicDriver->DisplayImmediateStructure (MyCView, theStructure);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,9 +1300,9 @@ Standard_Boolean Visual3d_View::ClearImmediate()
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure anIter (myImmediateStructures); anIter.More(); anIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myImmediateStructures); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
myGraphicDriver->EraseImmediateStructure (MyCView, *anIter.Key()->CStructure());
|
myGraphicDriver->EraseImmediateStructure (MyCView, *aStructIter.Key()->CStructure());
|
||||||
}
|
}
|
||||||
myImmediateStructures.Clear();
|
myImmediateStructures.Clear();
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
@ -1345,7 +1344,7 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
anIndex = 0;
|
anIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
|
Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_NO)
|
if (anAnswer == Visual3d_TOA_NO)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1358,14 +1357,13 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
|
|
||||||
if (anAnswer == Visual3d_TOA_YES)
|
if (anAnswer == Visual3d_TOA_YES)
|
||||||
{
|
{
|
||||||
if (IsDisplayed (theStruct))
|
if (!myStructsDisplayed.Add (theStruct))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theStruct->CalculateBoundBox();
|
theStruct->CalculateBoundBox();
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *theStruct->CStructure(), theStruct->DisplayPriority());
|
myGraphicDriver->DisplayStructure (MyCView, theStruct, theStruct->DisplayPriority());
|
||||||
myStructsDisplayed.Add (theStruct);
|
|
||||||
Update (theUpdateMode);
|
Update (theUpdateMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1380,14 +1378,14 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
const Handle(Graphic3d_Structure)& anOldStruct = myStructsComputed.Value (anIndex);
|
const Handle(Graphic3d_Structure)& anOldStruct = myStructsComputed.Value (anIndex);
|
||||||
if (anOldStruct->HLRValidation())
|
if (anOldStruct->HLRValidation())
|
||||||
{
|
{
|
||||||
// Case COMPUTED valid
|
// Case COMPUTED valid, to be displayed
|
||||||
// to be displayed
|
if (!myStructsDisplayed.Add (theStruct))
|
||||||
if (!IsDisplayed (theStruct))
|
|
||||||
{
|
{
|
||||||
myStructsDisplayed.Add (theStruct);
|
return;
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *anOldStruct->CStructure(), theStruct->DisplayPriority());
|
|
||||||
Update (theUpdateMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myGraphicDriver->DisplayStructure (MyCView, anOldStruct, theStruct->DisplayPriority());
|
||||||
|
Update (theUpdateMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1401,25 +1399,25 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
const Standard_Integer aNewIndex = HaveTheSameOwner (theStruct);
|
const Standard_Integer aNewIndex = HaveTheSameOwner (theStruct);
|
||||||
if (aNewIndex != 0)
|
if (aNewIndex != 0)
|
||||||
{
|
{
|
||||||
// Case of COMPUTED invalid, WITH a valid of replacement
|
// Case of COMPUTED invalid, WITH a valid of replacement; to be displayed
|
||||||
// to be displayed
|
if (!myStructsDisplayed.Add (theStruct))
|
||||||
if (!IsDisplayed (theStruct))
|
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
|
return;
|
||||||
myStructsComputed.SetValue (anIndex, aNewStruct);
|
|
||||||
myStructsDisplayed.Add (theStruct);
|
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *aNewStruct->CStructure(), theStruct->DisplayPriority());
|
|
||||||
Update (theUpdateMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
|
||||||
|
myStructsComputed.SetValue (anIndex, aNewStruct);
|
||||||
|
myGraphicDriver->DisplayStructure (MyCView, aNewStruct, theStruct->DisplayPriority());
|
||||||
|
Update (theUpdateMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Case COMPUTED invalid, WITHOUT a valid of replacement
|
// Case COMPUTED invalid, WITHOUT a valid of replacement
|
||||||
// COMPUTED is removed if displayed
|
// COMPUTED is removed if displayed
|
||||||
if (IsDisplayed (theStruct))
|
if (myStructsDisplayed.Contains (theStruct))
|
||||||
{
|
{
|
||||||
myGraphicDriver->EraseStructure (MyCView, *anOldStruct->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, anOldStruct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1484,26 +1482,25 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aStruct->SetVisual (toComputeWireframe ? Graphic3d_TOS_WIREFRAME : Graphic3d_TOS_SHADING);
|
aStruct->SetVisual (toComputeWireframe ? Graphic3d_TOS_WIREFRAME : Graphic3d_TOS_SHADING);
|
||||||
anAnswer = AcceptDisplay (aStruct);
|
anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theStruct->IsHighlighted())
|
if (theStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aStruct->SetHighlightColor (theStruct->HighlightColor());
|
aStruct->Highlight (Aspect_TOHM_COLOR, theStruct->HighlightColor(), Standard_False);
|
||||||
aStruct->GraphicHighlight (Aspect_TOHM_COLOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is displayed only if the calculated structure
|
// It is displayed only if the calculated structure
|
||||||
// has a proper type corresponding to the one of the view.
|
// has a proper type corresponding to the one of the view.
|
||||||
if (anAnswer != Visual3d_TOA_NO)
|
if (anAnswer == Visual3d_TOA_NO)
|
||||||
{
|
{
|
||||||
if (!IsDisplayed (theStruct))
|
return;
|
||||||
{
|
|
||||||
myStructsDisplayed.Add (theStruct);
|
|
||||||
}
|
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *aStruct->CStructure(), theStruct->DisplayPriority());
|
|
||||||
Update (theUpdateMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myStructsDisplayed.Add (theStruct);
|
||||||
|
myGraphicDriver->DisplayStructure (MyCView, aStruct, theStruct->DisplayPriority());
|
||||||
|
|
||||||
|
Update (theUpdateMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
@ -1525,13 +1522,14 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct)
|
|||||||
void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
|
void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
|
||||||
const Aspect_TypeOfUpdate theUpdateMode)
|
const Aspect_TypeOfUpdate theUpdateMode)
|
||||||
{
|
{
|
||||||
if (IsDeleted()
|
if ( IsDeleted()
|
||||||
|| !IsDisplayed (theStruct))
|
|| EraseImmediate (theStruct)
|
||||||
|
|| !IsDisplayed (theStruct))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
|
Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
|
||||||
if (!ComputedMode())
|
if (!ComputedMode())
|
||||||
{
|
{
|
||||||
anAnswer = Visual3d_TOA_YES;
|
anAnswer = Visual3d_TOA_YES;
|
||||||
@ -1539,7 +1537,7 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
|
|
||||||
if (anAnswer != Visual3d_TOA_COMPUTE)
|
if (anAnswer != Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
myGraphicDriver->EraseStructure (MyCView, *theStruct->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, theStruct);
|
||||||
}
|
}
|
||||||
else if (anAnswer == Visual3d_TOA_COMPUTE
|
else if (anAnswer == Visual3d_TOA_COMPUTE
|
||||||
&& myIsInComputedMode)
|
&& myIsInComputedMode)
|
||||||
@ -1548,7 +1546,7 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||||
myGraphicDriver->EraseStructure (MyCView, *aCompStruct->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, aCompStruct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myStructsDisplayed.Remove (theStruct);
|
myStructsDisplayed.Remove (theStruct);
|
||||||
@ -1566,8 +1564,7 @@ void Visual3d_View::Highlight (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||||
aCompStruct->SetHighlightColor (theStruct->HighlightColor());
|
aCompStruct->Highlight (theMethod, theStruct->HighlightColor(), Standard_False);
|
||||||
aCompStruct->GraphicHighlight (theMethod);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1603,7 +1600,7 @@ void Visual3d_View::SetTransform (const Handle(Graphic3d_Structure)& theStruct,
|
|||||||
&& !theStruct->CStructure()->IsForHighlight
|
&& !theStruct->CStructure()->IsForHighlight
|
||||||
&& !theStruct->CStructure()->IsInfinite)
|
&& !theStruct->CStructure()->IsInfinite)
|
||||||
{
|
{
|
||||||
const Standard_Integer aLayerId = theStruct->GetZLayer();
|
const Graphic3d_ZLayerId aLayerId = theStruct->GetZLayer();
|
||||||
myGraphicDriver->InvalidateBVHData (MyCView, aLayerId);
|
myGraphicDriver->InvalidateBVHData (MyCView, aLayerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1657,7 +1654,14 @@ Standard_Boolean Visual3d_View::IsDisplayed (const Handle(Graphic3d_Structure)&
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
Standard_Boolean Visual3d_View::ContainsFacet() const
|
Standard_Boolean Visual3d_View::ContainsFacet() const
|
||||||
{
|
{
|
||||||
return ContainsFacet (myStructsDisplayed);
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
if (aStructIter.Key()->ContainsFacet())
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
@ -1676,14 +1680,51 @@ Standard_Boolean Visual3d_View::ContainsFacet (const Graphic3d_MapOfStructure& t
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Auxiliary method for MinMaxValues() method
|
||||||
|
inline void addStructureBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
||||||
|
const Standard_Boolean theToIgnoreInfiniteFlag,
|
||||||
|
Bnd_Box& theBndBox)
|
||||||
|
{
|
||||||
|
if (!theStruct->IsVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (theStruct->IsInfinite()
|
||||||
|
&& !theToIgnoreInfiniteFlag)
|
||||||
|
{
|
||||||
|
// XMin, YMin .... ZMax are initialized by means of infinite line data
|
||||||
|
const Bnd_Box aBox = theStruct->MinMaxValues (Standard_False);
|
||||||
|
if (!aBox.IsWhole()
|
||||||
|
&& !aBox.IsVoid())
|
||||||
|
{
|
||||||
|
theBndBox.Add (aBox);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only non-empty and non-infinite structures
|
||||||
|
// are taken into account for calculation of MinMax
|
||||||
|
if (theStruct->IsEmpty()
|
||||||
|
|| theStruct->TransformPersistenceMode() != Graphic3d_TMF_None)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "FitAll" operation ignores object with transform persistence parameter
|
||||||
|
const Bnd_Box aBox = theStruct->MinMaxValues (theToIgnoreInfiniteFlag);
|
||||||
|
theBndBox.Add (aBox);
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// function : MinMaxValues
|
// function : MinMaxValues
|
||||||
// purpose :
|
// purpose :
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
Bnd_Box Visual3d_View::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
|
Bnd_Box Visual3d_View::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
|
||||||
{
|
{
|
||||||
return MinMaxValues (myStructsDisplayed,
|
Bnd_Box aResult = MinMaxValues (myStructsDisplayed, theToIgnoreInfiniteFlag);
|
||||||
theToIgnoreInfiniteFlag);
|
Bnd_Box anImmediate = MinMaxValues (myImmediateStructures, theToIgnoreInfiniteFlag);
|
||||||
|
aResult.Add (anImmediate);
|
||||||
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
@ -1691,45 +1732,18 @@ Bnd_Box Visual3d_View::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteF
|
|||||||
// purpose :
|
// purpose :
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
Bnd_Box Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
|
Bnd_Box Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
|
||||||
const Standard_Boolean theToIgnoreInfiniteFlag) const
|
const Standard_Boolean theToIgnoreInfiniteFlag) const
|
||||||
{
|
{
|
||||||
Bnd_Box aResult;
|
Bnd_Box aResult;
|
||||||
if (theSet.IsEmpty ())
|
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (theSet); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
// Return an empty box.
|
const Handle(Graphic3d_Structure)& aStructure = aStructIter.Key();
|
||||||
return aResult;
|
if (!aStructIter.Value()->IsVisible())
|
||||||
}
|
{
|
||||||
Graphic3d_MapIteratorOfMapOfStructure anIterator (theSet);
|
|
||||||
for (anIterator.Initialize (theSet); anIterator.More(); anIterator.Next())
|
|
||||||
{
|
|
||||||
const Handle(Graphic3d_Structure)& aStructure = anIterator.Key();
|
|
||||||
|
|
||||||
if (!aStructure->IsVisible())
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (aStructure->IsInfinite() && !theToIgnoreInfiniteFlag)
|
|
||||||
{
|
|
||||||
//XMin, YMin .... ZMax are initialized by means of infinite line data
|
|
||||||
Bnd_Box aBox = aStructure->MinMaxValues (Standard_False);
|
|
||||||
if (!aBox.IsWhole() && !aBox.IsVoid())
|
|
||||||
{
|
|
||||||
aResult.Add (aBox);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only non-empty and non-infinite structures
|
addStructureBndBox (aStructure, theToIgnoreInfiniteFlag, aResult);
|
||||||
// are taken into account for calculation of MinMax
|
|
||||||
if ((!aStructure->IsInfinite() || theToIgnoreInfiniteFlag) && !aStructure->IsEmpty())
|
|
||||||
{
|
|
||||||
Bnd_Box aBox = aStructure->MinMaxValues (theToIgnoreInfiniteFlag);
|
|
||||||
|
|
||||||
/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
|
|
||||||
//"FitAll" operation ignores object with transform persitence parameter
|
|
||||||
if(aStructure->TransformPersistenceMode() == Graphic3d_TMF_None )
|
|
||||||
{
|
|
||||||
aResult.Add (aBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
@ -1862,9 +1876,9 @@ void Visual3d_View::Compute()
|
|||||||
// Remove structures that were calculated for the previous orientation.
|
// Remove structures that were calculated for the previous orientation.
|
||||||
// Recalculation of new structures.
|
// Recalculation of new structures.
|
||||||
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructsSeq;
|
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructsSeq;
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStructIter.Key());
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStructIter.Key()->Visual());
|
||||||
if (anAnswer == Visual3d_TOA_COMPUTE)
|
if (anAnswer == Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
aStructsSeq.Append (aStructIter.Key()); // if the structure was calculated, it is recalculated
|
aStructsSeq.Append (aStructIter.Key()); // if the structure was calculated, it is recalculated
|
||||||
@ -1902,7 +1916,7 @@ void Visual3d_View::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
|
||||||
if (anAnswer != Visual3d_TOA_COMPUTE)
|
if (anAnswer != Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1950,13 +1964,12 @@ void Visual3d_View::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
|||||||
|
|
||||||
if (theStruct->IsHighlighted())
|
if (theStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->SetHighlightColor (theStruct->HighlightColor());
|
aCompStruct->Highlight (Aspect_TOHM_COLOR, theStruct->HighlightColor(), Standard_False);
|
||||||
aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The previous calculation is removed and the new one is dislayed
|
// The previous calculation is removed and the new one is displayed
|
||||||
myGraphicDriver->EraseStructure (MyCView, *aCompStructOld->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, aCompStructOld);
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *aCompStruct->CStructure(), theStruct->DisplayPriority());
|
myGraphicDriver->DisplayStructure (MyCView, aCompStruct, theStruct->DisplayPriority());
|
||||||
|
|
||||||
// why not just replace existing items?
|
// why not just replace existing items?
|
||||||
//myStructsToCompute.ChangeValue (anIndex) = theStruct;
|
//myStructsToCompute.ChangeValue (anIndex) = theStruct;
|
||||||
@ -2324,10 +2337,10 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
myIsInComputedMode = theMode;
|
myIsInComputedMode = theMode;
|
||||||
if (!myIsInComputedMode)
|
if (!myIsInComputedMode)
|
||||||
{
|
{
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer != Visual3d_TOA_COMPUTE)
|
if (anAnswer != Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -2337,17 +2350,17 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex);
|
const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex);
|
||||||
myGraphicDriver->EraseStructure (MyCView, *aStructComp->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, aStructComp);
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *aStruct->CStructure(), aStruct->DisplayPriority());
|
myGraphicDriver->DisplayStructure (MyCView, aStruct, aStruct->DisplayPriority());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
|
for (Graphic3d_MapOfStructure::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
|
||||||
{
|
{
|
||||||
Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
|
Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
|
||||||
const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
|
const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||||
if (anAnswer != Visual3d_TOA_COMPUTE)
|
if (anAnswer != Visual3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -2356,8 +2369,8 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
const Standard_Integer anIndex = IsComputed (aStruct);
|
const Standard_Integer anIndex = IsComputed (aStruct);
|
||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
myGraphicDriver->EraseStructure (MyCView, *aStruct->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, aStruct);
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *(myStructsComputed.Value (anIndex)->CStructure()), aStruct->DisplayPriority());
|
myGraphicDriver->DisplayStructure (MyCView, myStructsComputed.Value (anIndex), aStruct->DisplayPriority());
|
||||||
|
|
||||||
Display (aStruct, Aspect_TOU_WAIT);
|
Display (aStruct, Aspect_TOU_WAIT);
|
||||||
if (aStruct->IsHighlighted())
|
if (aStruct->IsHighlighted())
|
||||||
@ -2365,8 +2378,7 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
||||||
if (!aCompStruct->IsHighlighted())
|
if (!aCompStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->SetHighlightColor (aStruct->HighlightColor());
|
aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
|
||||||
aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2387,8 +2399,7 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
|
|
||||||
if (aStruct->IsHighlighted())
|
if (aStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->SetHighlightColor (aStruct->HighlightColor());
|
aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
|
||||||
aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean hasResult = Standard_False;
|
Standard_Boolean hasResult = Standard_False;
|
||||||
@ -2410,8 +2421,8 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
myStructsComputed .Append (aCompStruct);
|
myStructsComputed .Append (aCompStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGraphicDriver->EraseStructure (MyCView, *aStruct->CStructure());
|
myGraphicDriver->EraseStructure (MyCView, aStruct);
|
||||||
myGraphicDriver->DisplayStructure (MyCView, *aCompStruct->CStructure(), aStruct->DisplayPriority());
|
myGraphicDriver->DisplayStructure (MyCView, aCompStruct, aStruct->DisplayPriority());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update (myViewManager->UpdateMode());
|
Update (myViewManager->UpdateMode());
|
||||||
@ -2599,7 +2610,7 @@ Standard_Boolean Visual3d_View::Export (const Standard_CString theFileName
|
|||||||
// function : SetZLayerSettings
|
// function : SetZLayerSettings
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Visual3d_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
void Visual3d_View::SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings& theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
myGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
|
myGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
|
||||||
@ -2609,7 +2620,7 @@ void Visual3d_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
|||||||
// function : AddZLayer
|
// function : AddZLayer
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Visual3d_View::AddZLayer (const Standard_Integer theLayerId)
|
void Visual3d_View::AddZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myGraphicDriver->AddZLayer (MyCView, theLayerId);
|
myGraphicDriver->AddZLayer (MyCView, theLayerId);
|
||||||
}
|
}
|
||||||
@ -2618,7 +2629,7 @@ void Visual3d_View::AddZLayer (const Standard_Integer theLayerId)
|
|||||||
// function : RemoveZLayer
|
// function : RemoveZLayer
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Visual3d_View::RemoveZLayer (const Standard_Integer theLayerId)
|
void Visual3d_View::RemoveZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myGraphicDriver->RemoveZLayer (MyCView, theLayerId);
|
myGraphicDriver->RemoveZLayer (MyCView, theLayerId);
|
||||||
}
|
}
|
||||||
@ -2628,7 +2639,7 @@ void Visual3d_View::RemoveZLayer (const Standard_Integer theLayerId)
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Visual3d_View::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
|
void Visual3d_View::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer theLayerId)
|
const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
myGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), MyCView, theLayerId);
|
myGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), MyCView, theLayerId);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ class ViewManager from Visual3d inherits StructureManager from Graphic3d
|
|||||||
---Purpose: This class allows the definition of a manager to
|
---Purpose: This class allows the definition of a manager to
|
||||||
-- which the views are associated.
|
-- which the views are associated.
|
||||||
-- It allows them to be globally manipulated.
|
-- It allows them to be globally manipulated.
|
||||||
-- It activates the pick.
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
|
||||||
@ -41,10 +40,10 @@ uses
|
|||||||
CView from Graphic3d,
|
CView from Graphic3d,
|
||||||
Vector from Graphic3d,
|
Vector from Graphic3d,
|
||||||
|
|
||||||
|
ZLayerId from Graphic3d,
|
||||||
ZLayerSettings from Graphic3d,
|
ZLayerSettings from Graphic3d,
|
||||||
MapOfZLayerSettings from Visual3d,
|
MapOfZLayerSettings from Visual3d,
|
||||||
|
|
||||||
ContextPick from Visual3d,
|
|
||||||
Layer from Visual3d,
|
Layer from Visual3d,
|
||||||
SequenceOfView from Visual3d,
|
SequenceOfView from Visual3d,
|
||||||
HSequenceOfView from Visual3d,
|
HSequenceOfView from Visual3d,
|
||||||
@ -129,9 +128,10 @@ is
|
|||||||
---Purpose: Returns the group of views activated in the visualiser <me>.
|
---Purpose: Returns the group of views activated in the visualiser <me>.
|
||||||
---Category: Inquire methods
|
---Category: Inquire methods
|
||||||
|
|
||||||
DefinedView ( me )
|
DefinedViews (me)
|
||||||
returns HSequenceOfView from Visual3d
|
returns SequenceOfView from Visual3d
|
||||||
is static;
|
is static;
|
||||||
|
---C++: return const &
|
||||||
---Level: Internal
|
---Level: Internal
|
||||||
---Purpose: Returns the group of views defined in the visualiser <me>.
|
---Purpose: Returns the group of views defined in the visualiser <me>.
|
||||||
---Category: Inquire methods
|
---Category: Inquire methods
|
||||||
@ -163,29 +163,6 @@ is
|
|||||||
---Purpose: Release a unique ID of the view reserved for the view on its creation.
|
---Purpose: Release a unique ID of the view reserved for the view on its creation.
|
||||||
is static;
|
is static;
|
||||||
|
|
||||||
-------------------------------------------------
|
|
||||||
-- Summary of Pick Input --
|
|
||||||
-- --
|
|
||||||
-- Picking returns information about an --
|
|
||||||
-- object pointed to on the display. --
|
|
||||||
-- --
|
|
||||||
-- To be picked, a structure must be : --
|
|
||||||
-- --
|
|
||||||
-- Visible --
|
|
||||||
-- Within the pick aperture --
|
|
||||||
-- Pickable as determined by the method --
|
|
||||||
-- Graphic3d_Structure::SetPick --
|
|
||||||
-- --
|
|
||||||
-- To insert a Pick Identification use the --
|
|
||||||
-- method Graphic3d_Group::SetPickId --
|
|
||||||
-- --
|
|
||||||
-- The pick search order tends to select the --
|
|
||||||
-- "top" object : --
|
|
||||||
-- High to low structure display priority --
|
|
||||||
-- Most recently displayed to least --
|
|
||||||
-- recently displayed. --
|
|
||||||
-------------------------------------------------
|
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
-- Category: Redefined methods
|
-- Category: Redefined methods
|
||||||
------------------------------
|
------------------------------
|
||||||
@ -232,30 +209,25 @@ is
|
|||||||
|
|
||||||
ChangeZLayer ( me : mutable;
|
ChangeZLayer ( me : mutable;
|
||||||
theStructure : Structure from Graphic3d;
|
theStructure : Structure from Graphic3d;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
is redefined static;
|
is redefined static;
|
||||||
---Purpose: Change Z layer for structure. The layer mechanism allows
|
---Purpose: Change Z layer for structure. The layer mechanism allows
|
||||||
-- to display structures in higher layers in overlay of structures in
|
-- to display structures in higher layers in overlay of structures in
|
||||||
-- lower layers.
|
-- lower layers.
|
||||||
|
|
||||||
GetZLayer ( me;
|
|
||||||
theStructure : Structure from Graphic3d )
|
|
||||||
returns Integer from Standard is redefined static;
|
|
||||||
---Purpose: Get Z layer ID assigned for the structure.
|
|
||||||
|
|
||||||
SetZLayerSettings ( me : mutable;
|
SetZLayerSettings ( me : mutable;
|
||||||
theLayerId : Integer from Standard;
|
theLayerId : ZLayerId from Graphic3d;
|
||||||
theSettings : ZLayerSettings from Graphic3d )
|
theSettings : ZLayerSettings from Graphic3d )
|
||||||
is redefined static;
|
is redefined static;
|
||||||
---Purpose: Sets the settings for a single Z layer for all managed views.
|
---Purpose: Sets the settings for a single Z layer for all managed views.
|
||||||
|
|
||||||
ZLayerSettings ( me : mutable;
|
ZLayerSettings ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
returns ZLayerSettings from Graphic3d is redefined static;
|
returns ZLayerSettings from Graphic3d is redefined static;
|
||||||
---Purpose: Returns the settings of a single Z layer.
|
---Purpose: Returns the settings of a single Z layer.
|
||||||
|
|
||||||
AddZLayer ( me : mutable;
|
AddZLayer ( me : mutable;
|
||||||
theLayerId : in out Integer from Standard )
|
theLayerId : out ZLayerId from Graphic3d )
|
||||||
returns Boolean from Standard is redefined static;
|
returns Boolean from Standard is redefined static;
|
||||||
---Purpose: Add a new top-level Z layer and get its ID as
|
---Purpose: Add a new top-level Z layer and get its ID as
|
||||||
-- <theLayerId> value. The method returns Standard_False if the layer
|
-- <theLayerId> value. The method returns Standard_False if the layer
|
||||||
@ -263,7 +235,7 @@ is
|
|||||||
-- structures in higher layers in overlay of structures in lower layers.
|
-- structures in higher layers in overlay of structures in lower layers.
|
||||||
|
|
||||||
RemoveZLayer ( me : mutable;
|
RemoveZLayer ( me : mutable;
|
||||||
theLayerId : Integer from Standard )
|
theLayerId : ZLayerId from Graphic3d )
|
||||||
returns Boolean from Standard is redefined static;
|
returns Boolean from Standard is redefined static;
|
||||||
---Purpose: Remove Z layer with ID <theLayerId>. Method returns
|
---Purpose: Remove Z layer with ID <theLayerId>. Method returns
|
||||||
-- Standard_False if the layer can not be removed or doesn't exists.
|
-- Standard_False if the layer can not be removed or doesn't exists.
|
||||||
@ -284,12 +256,6 @@ is
|
|||||||
-- controlled view. This method used on the view initialization to
|
-- controlled view. This method used on the view initialization to
|
||||||
-- make the layer lists consistent.
|
-- make the layer lists consistent.
|
||||||
|
|
||||||
getZLayerGenId ( myclass )
|
|
||||||
---Purpose: Returns global instance of z layer ids generator.
|
|
||||||
---C++: return &
|
|
||||||
returns GenId from Aspect is protected;
|
|
||||||
|
|
||||||
|
|
||||||
Clear ( me : mutable;
|
Clear ( me : mutable;
|
||||||
AStructure : Structure from Graphic3d;
|
AStructure : Structure from Graphic3d;
|
||||||
WithDestruction : Boolean from Standard )
|
WithDestruction : Boolean from Standard )
|
||||||
@ -457,8 +423,9 @@ fields
|
|||||||
MyZBufferAuto : Boolean from Standard;
|
MyZBufferAuto : Boolean from Standard;
|
||||||
|
|
||||||
-- Z layer indexes
|
-- Z layer indexes
|
||||||
myLayerIds : MapOfInteger from TColStd;
|
myZLayerGenId : GenId from Aspect;
|
||||||
myLayerSeq : SequenceOfInteger from TColStd;
|
myLayerIds : MapOfInteger from TColStd;
|
||||||
|
myLayerSeq : SequenceOfInteger from TColStd;
|
||||||
|
|
||||||
myMapOfZLayerSettings : MapOfZLayerSettings from Visual3d;
|
myMapOfZLayerSettings : MapOfZLayerSettings from Visual3d;
|
||||||
|
|
||||||
|
@ -82,15 +82,43 @@ Visual3d_ViewManager::Visual3d_ViewManager (const Handle(Graphic3d_GraphicDriver
|
|||||||
Graphic3d_StructureManager (theDriver),
|
Graphic3d_StructureManager (theDriver),
|
||||||
MyDefinedView (),
|
MyDefinedView (),
|
||||||
MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
|
MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
|
||||||
MyZBufferAuto (Standard_False)
|
MyZBufferAuto (Standard_False),
|
||||||
|
myZLayerGenId (1, IntegerLast())
|
||||||
{
|
{
|
||||||
// default layer is always presented in display layer sequence
|
|
||||||
// it can not be removed
|
|
||||||
myLayerIds.Add (0);
|
|
||||||
myLayerSeq.Append (0);
|
|
||||||
|
|
||||||
MyGraphicDriver = theDriver;
|
MyGraphicDriver = theDriver;
|
||||||
myMapOfZLayerSettings.Bind (0, Graphic3d_ZLayerSettings());
|
|
||||||
|
// default layers are always presented in display layer sequence it can not be removed
|
||||||
|
Graphic3d_ZLayerSettings aDefSettings;
|
||||||
|
aDefSettings.Flags = Graphic3d_ZLayerDepthTest
|
||||||
|
| Graphic3d_ZLayerDepthWrite;
|
||||||
|
aDefSettings.IsImmediate = false;
|
||||||
|
myLayerIds.Add (Graphic3d_ZLayerId_Default);
|
||||||
|
myLayerSeq.Append (Graphic3d_ZLayerId_Default);
|
||||||
|
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_Default, aDefSettings);
|
||||||
|
|
||||||
|
Graphic3d_ZLayerSettings aTopSettings;
|
||||||
|
aTopSettings.Flags = Graphic3d_ZLayerDepthTest
|
||||||
|
| Graphic3d_ZLayerDepthWrite;
|
||||||
|
aTopSettings.IsImmediate = true;
|
||||||
|
myLayerIds.Add (Graphic3d_ZLayerId_Top);
|
||||||
|
myLayerSeq.Append (Graphic3d_ZLayerId_Top);
|
||||||
|
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_Top, aTopSettings);
|
||||||
|
|
||||||
|
Graphic3d_ZLayerSettings aTopmostSettings;
|
||||||
|
aTopmostSettings.Flags = Graphic3d_ZLayerDepthTest
|
||||||
|
| Graphic3d_ZLayerDepthWrite
|
||||||
|
| Graphic3d_ZLayerDepthClear;
|
||||||
|
aTopmostSettings.IsImmediate = true;
|
||||||
|
myLayerIds.Add (Graphic3d_ZLayerId_Topmost);
|
||||||
|
myLayerSeq.Append (Graphic3d_ZLayerId_Topmost);
|
||||||
|
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_Topmost, aTopmostSettings);
|
||||||
|
|
||||||
|
Graphic3d_ZLayerSettings anOsdSettings;
|
||||||
|
anOsdSettings.Flags = 0;
|
||||||
|
anOsdSettings.IsImmediate = true;
|
||||||
|
myLayerIds.Add (Graphic3d_ZLayerId_TopOSD);
|
||||||
|
myLayerSeq.Append (Graphic3d_ZLayerId_TopOSD);
|
||||||
|
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_TopOSD, anOsdSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-Destructors
|
//-Destructors
|
||||||
@ -124,7 +152,6 @@ void Visual3d_ViewManager::Remove () {
|
|||||||
// clear all structures whilst views are alive for correct GPU memory management
|
// clear all structures whilst views are alive for correct GPU memory management
|
||||||
MyDisplayedStructure.Clear();
|
MyDisplayedStructure.Clear();
|
||||||
MyHighlightedStructure.Clear();
|
MyHighlightedStructure.Clear();
|
||||||
MyPickStructure.Clear();
|
|
||||||
|
|
||||||
// clear list of managed views
|
// clear list of managed views
|
||||||
MyDefinedView.Clear();
|
MyDefinedView.Clear();
|
||||||
@ -255,7 +282,6 @@ void Visual3d_ViewManager::Erase (const Handle(Graphic3d_Structure)& AStructure)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MyHighlightedStructure.Remove (AStructure);
|
MyHighlightedStructure.Remove (AStructure);
|
||||||
MyPickStructure.Remove (AStructure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Visual3d_ViewManager::Erase () {
|
void Visual3d_ViewManager::Erase () {
|
||||||
@ -423,16 +449,9 @@ Standard_Boolean Visual3d_ViewManager::ContainsComputedStructure () const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Handle(Visual3d_HSequenceOfView) Visual3d_ViewManager::DefinedView () const
|
const Visual3d_SequenceOfView& Visual3d_ViewManager::DefinedViews() const
|
||||||
{
|
{
|
||||||
Handle (Visual3d_HSequenceOfView) SG = new Visual3d_HSequenceOfView();
|
return MyDefinedView;
|
||||||
|
|
||||||
for(int i=1; i<=MyDefinedView.Length(); i++)
|
|
||||||
{
|
|
||||||
SG->Append(MyDefinedView.Value(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (SG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const
|
Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const
|
||||||
@ -629,39 +648,26 @@ const Handle(Visual3d_Layer)& Visual3d_ViewManager::OverLayer () const {
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
|
void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
|
||||||
const Standard_Integer theLayerId)
|
const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
if (!myLayerIds.Contains (theLayerId))
|
if (!myLayerIds.Contains (theLayerId)
|
||||||
return;
|
|| !MyDisplayedStructure.Contains (theStructure))
|
||||||
|
|
||||||
// change display layer for structure in all views
|
|
||||||
if (MyDisplayedStructure.Contains (theStructure))
|
|
||||||
{
|
{
|
||||||
for(int i=1; i<=MyDefinedView.Length(); i++)
|
return;
|
||||||
{
|
|
||||||
(MyDefinedView.Value(i))->ChangeZLayer(theStructure, theLayerId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell graphic driver to update the structure's display layer
|
// change display layer for structure in all views
|
||||||
MyGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), theLayerId);
|
for (int aViewIter = 1; aViewIter <= MyDefinedView.Length(); ++aViewIter)
|
||||||
}
|
{
|
||||||
|
MyDefinedView.Value (aViewIter)->ChangeZLayer (theStructure, theLayerId);
|
||||||
//=======================================================================
|
}
|
||||||
//function : GetZLayer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structure)& theStructure) const
|
|
||||||
{
|
|
||||||
return MyGraphicDriver->GetZLayer (*theStructure->CStructure ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetZLayerSettings
|
//function : SetZLayerSettings
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
|
void Visual3d_ViewManager::SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||||
const Graphic3d_ZLayerSettings& theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
// tell all managed views to set zlayer settings
|
// tell all managed views to set zlayer settings
|
||||||
@ -685,7 +691,7 @@ void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
|
|||||||
//function : ZLayerSettings
|
//function : ZLayerSettings
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Standard_Integer theLayerId)
|
Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
if (!myLayerIds.Contains (theLayerId))
|
if (!myLayerIds.Contains (theLayerId))
|
||||||
{
|
{
|
||||||
@ -700,13 +706,13 @@ Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Standard_In
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean Visual3d_ViewManager::AddZLayer (Standard_Integer& theLayerId)
|
Standard_Boolean Visual3d_ViewManager::AddZLayer (Graphic3d_ZLayerId& theLayerId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
theLayerId = getZLayerGenId ().Next ();
|
theLayerId = myZLayerGenId.Next();
|
||||||
myLayerIds.Add (theLayerId);
|
myLayerIds.Add (theLayerId);
|
||||||
myLayerSeq.Append (theLayerId);
|
myLayerSeq.Append (theLayerId);
|
||||||
}
|
}
|
||||||
catch (Aspect_IdentDefinitionError)
|
catch (Aspect_IdentDefinitionError)
|
||||||
@ -732,10 +738,14 @@ Standard_Boolean Visual3d_ViewManager::AddZLayer (Standard_Integer& theLayerId)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean Visual3d_ViewManager::RemoveZLayer (const Standard_Integer theLayerId)
|
Standard_Boolean Visual3d_ViewManager::RemoveZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||||
{
|
{
|
||||||
if (!myLayerIds.Contains (theLayerId) || theLayerId == 0)
|
if (!myLayerIds.Contains (theLayerId)
|
||||||
|
|| theLayerId < myZLayerGenId.Lower()
|
||||||
|
|| theLayerId > myZLayerGenId.Upper())
|
||||||
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
// tell all managed views to remove display layers
|
// tell all managed views to remove display layers
|
||||||
for(int i=1; i<=MyDefinedView.Length(); i++)
|
for(int i=1; i<=MyDefinedView.Length(); i++)
|
||||||
@ -757,8 +767,8 @@ Standard_Boolean Visual3d_ViewManager::RemoveZLayer (const Standard_Integer theL
|
|||||||
|
|
||||||
myMapOfZLayerSettings.UnBind (theLayerId);
|
myMapOfZLayerSettings.UnBind (theLayerId);
|
||||||
|
|
||||||
myLayerIds.Remove (theLayerId);
|
myLayerIds.Remove (theLayerId);
|
||||||
getZLayerGenId ().Free (theLayerId);
|
myZLayerGenId.Free (theLayerId);
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@ -773,17 +783,6 @@ void Visual3d_ViewManager::GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq
|
|||||||
theLayerSeq.Assign (myLayerSeq);
|
theLayerSeq.Assign (myLayerSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : getZLayerGenId
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Aspect_GenId& Visual3d_ViewManager::getZLayerGenId ()
|
|
||||||
{
|
|
||||||
static Aspect_GenId aGenId (1, IntegerLast());
|
|
||||||
return aGenId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : InstallZLayers
|
//function : InstallZLayers
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -808,10 +807,19 @@ void Visual3d_ViewManager::InstallZLayers(const Handle(Visual3d_View)& theView)
|
|||||||
// order: the new layers are always appended to the end of the list
|
// order: the new layers are always appended to the end of the list
|
||||||
// inside of view, while layer remove operation doesn't affect the order.
|
// inside of view, while layer remove operation doesn't affect the order.
|
||||||
// Starting from second layer : no need to change the default z layer.
|
// Starting from second layer : no need to change the default z layer.
|
||||||
for (Standard_Integer aSeqIdx = 2; aSeqIdx <= myLayerSeq.Length (); aSeqIdx++)
|
for (Standard_Integer aSeqIdx = 1; aSeqIdx <= myLayerSeq.Length(); ++aSeqIdx)
|
||||||
{
|
{
|
||||||
Standard_Integer aLayerID = myLayerSeq.Value (aSeqIdx);
|
const Graphic3d_ZLayerId aLayerID = myLayerSeq.Value (aSeqIdx);
|
||||||
theView->RemoveZLayer (aLayerID);
|
const Graphic3d_ZLayerSettings& aSettings = myMapOfZLayerSettings.Find (aLayerID);
|
||||||
theView->AddZLayer (aLayerID);
|
if (aLayerID < myZLayerGenId.Lower()
|
||||||
|
|| aLayerID > myZLayerGenId.Upper())
|
||||||
|
{
|
||||||
|
theView->SetZLayerSettings (aLayerID, aSettings);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
theView->RemoveZLayer (aLayerID);
|
||||||
|
theView->AddZLayer (aLayerID);
|
||||||
|
theView->SetZLayerSettings (aLayerID, aSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
tests/bugs/vis/bug24394
Normal file
19
tests/bugs/vis/bug24394
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC24394"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#################################################################################
|
||||||
|
# Visualization - implement more general way for rendering of immediate objects
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
box b1 0 0 0 1 2 3
|
||||||
|
box b2 3 0 0 2 3 1
|
||||||
|
vinit View1
|
||||||
|
vclear
|
||||||
|
vaxo
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay b1
|
||||||
|
vdisplay -top b1
|
||||||
|
vfit
|
||||||
|
|
||||||
|
set only_screen 1
|
@ -22,8 +22,8 @@ puts [checkshape res]
|
|||||||
tclean res
|
tclean res
|
||||||
|
|
||||||
if { [string compare $command "shading"] == 0 } {
|
if { [string compare $command "shading"] == 0 } {
|
||||||
vinit
|
vinit View1
|
||||||
vdisplay res
|
vdisplay -noupdate -redisplay res
|
||||||
vsetdispmode res 1
|
vsetdispmode res 1
|
||||||
vfit
|
vfit
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user