From e463b2f685d8c815f8a7ab996c6843808e8b1430 Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 8 Dec 2021 15:55:11 +0300 Subject: [PATCH] 0032725: Visualization - Graphic3d_Structure::SetDisplayPriority() should use public enumeration Graphic3d_DisplayPriority Added new enumeration Graphic3d_DisplayPriority. Graphic3d_Layer now defines a fixed-length array of priorities. Properties Graphic3d_CStructure::Id, Priority, PreviousPriority have been wrapped into methods. --- src/AIS/AIS_Axis.cxx | 1 - src/AIS/AIS_Circle.cxx | 2 - src/AIS/AIS_InteractiveContext.cxx | 8 +-- src/AIS/AIS_InteractiveContext.hxx | 9 +++- src/AIS/AIS_Line.cxx | 2 - src/AIS/AIS_PlaneTrihedron.cxx | 1 - src/AIS/AIS_Shape.cxx | 19 ++++--- src/AIS/AIS_TexturedShape.cxx | 20 +++---- src/Graphic3d/FILES | 2 +- src/Graphic3d/Graphic3d_CStructure.cxx | 17 +++--- src/Graphic3d/Graphic3d_CStructure.hxx | 28 +++++++--- src/Graphic3d/Graphic3d_CView.cxx | 4 +- src/Graphic3d/Graphic3d_CView.hxx | 8 +-- src/Graphic3d/Graphic3d_DisplayPriority.hxx | 40 ++++++++++++++ src/Graphic3d/Graphic3d_GraphicDriver.cxx | 14 ++--- src/Graphic3d/Graphic3d_Group.cxx | 1 - src/Graphic3d/Graphic3d_Layer.cxx | 57 ++++++++------------ src/Graphic3d/Graphic3d_Layer.hxx | 19 ++++--- src/Graphic3d/Graphic3d_Structure.cxx | 34 ++++++------ src/Graphic3d/Graphic3d_Structure.hxx | 42 +++++++-------- src/Graphic3d/Graphic3d_Structure.pxx | 23 -------- src/Graphic3d/Graphic3d_StructureManager.cxx | 4 +- src/Graphic3d/Graphic3d_StructureManager.hxx | 4 +- src/MeshVS/MeshVS_Mesh.cxx | 2 +- src/OpenGl/OpenGl_GraphicDriver.cxx | 6 +-- src/OpenGl/OpenGl_LayerList.cxx | 23 ++++---- src/OpenGl/OpenGl_LayerList.hxx | 15 +++--- src/OpenGl/OpenGl_View.cxx | 6 +-- src/OpenGl/OpenGl_View.hxx | 4 +- src/OpenGl/OpenGl_View_Raytrace.cxx | 8 +-- src/PrsMgr/PrsMgr_PresentationManager.cxx | 16 +++--- src/PrsMgr/PrsMgr_PresentationManager.hxx | 7 +-- src/SelectMgr/SelectMgr_ViewerSelector.cxx | 4 +- src/V3d/V3d_CircularGrid.cxx | 2 +- src/V3d/V3d_Plane.cxx | 2 +- src/V3d/V3d_RectangularGrid.cxx | 2 +- src/V3d/V3d_Trihedron.cxx | 2 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 10 ++-- src/XCAFPrs/XCAFPrs_AISObject.cxx | 2 +- 39 files changed, 237 insertions(+), 233 deletions(-) create mode 100644 src/Graphic3d/Graphic3d_DisplayPriority.hxx delete mode 100644 src/Graphic3d/Graphic3d_Structure.pxx diff --git a/src/AIS/AIS_Axis.cxx b/src/AIS/AIS_Axis.cxx index 2be1c37c20..e4864120f4 100644 --- a/src/AIS/AIS_Axis.cxx +++ b/src/AIS/AIS_Axis.cxx @@ -188,7 +188,6 @@ void AIS_Axis::Compute (const Handle(PrsMgr_PresentationManager)& , const Standard_Integer ) { thePrs->SetInfiniteState (myInfiniteState); - thePrs->SetDisplayPriority (5); if (!myIsXYZAxis) { GeomAdaptor_Curve curv (myComponent); diff --git a/src/AIS/AIS_Circle.cxx b/src/AIS/AIS_Circle.cxx index 08160855aa..9a8371f70f 100644 --- a/src/AIS/AIS_Circle.cxx +++ b/src/AIS/AIS_Circle.cxx @@ -76,8 +76,6 @@ void AIS_Circle::Compute (const Handle(PrsMgr_PresentationManager)& , const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer ) { - thePrs->SetDisplayPriority (5); - if (myCircleIsArc) { ComputeArc (thePrs); } else { ComputeCircle (thePrs); } } diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index ae54206b16..427dd5a08e 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -882,11 +882,11 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_Interacti //function : DisplayPriority //purpose : //======================================================================= -Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const +Graphic3d_DisplayPriority AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const { if (theIObj.IsNull()) { - return -1; + return Graphic3d_DisplayPriority_INVALID; } const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj); @@ -901,7 +901,7 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter : 0); return myMainPM->DisplayPriority (theIObj, aDispMode); } - return 0; + return Graphic3d_DisplayPriority_INVALID; } //======================================================================= @@ -909,7 +909,7 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter //purpose : //======================================================================= void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer thePriority) + const Graphic3d_DisplayPriority thePriority) { if (theIObj.IsNull()) { diff --git a/src/AIS/AIS_InteractiveContext.hxx b/src/AIS/AIS_InteractiveContext.hxx index 8faa035d4f..acbb8741ef 100644 --- a/src/AIS/AIS_InteractiveContext.hxx +++ b/src/AIS/AIS_InteractiveContext.hxx @@ -276,10 +276,15 @@ public: //! @name highlighting management public: //! @name object presence management (View affinity, Layer, Priority) //! Returns the display priority of the Object. - Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const; + Standard_EXPORT Graphic3d_DisplayPriority DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const; //! Sets the display priority of the seen parts presentation of the Object. - Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer thePriority); + Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, + const Graphic3d_DisplayPriority thePriority); + + Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()") + void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, + const Standard_Integer thePriority) { SetDisplayPriority (theIObj, (Graphic3d_DisplayPriority )thePriority); } //! Get Z layer id set for displayed interactive object. Standard_EXPORT Graphic3d_ZLayerId GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const; diff --git a/src/AIS/AIS_Line.cxx b/src/AIS/AIS_Line.cxx index b3d92c5c33..db9bf36c55 100644 --- a/src/AIS/AIS_Line.cxx +++ b/src/AIS/AIS_Line.cxx @@ -69,8 +69,6 @@ void AIS_Line::Compute (const Handle(PrsMgr_PresentationManager)&, const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer ) { - thePrs->SetDisplayPriority (5); - if (!myLineIsSegment) { ComputeInfiniteLine (thePrs); } else { ComputeSegmentLine (thePrs); } } diff --git a/src/AIS/AIS_PlaneTrihedron.cxx b/src/AIS/AIS_PlaneTrihedron.cxx index d7e8426510..bafe6a3c3a 100644 --- a/src/AIS/AIS_PlaneTrihedron.cxx +++ b/src/AIS/AIS_PlaneTrihedron.cxx @@ -153,7 +153,6 @@ void AIS_PlaneTrihedron::Compute (const Handle(PrsMgr_PresentationManager)& , const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer ) { - thePrs->SetDisplayPriority (5); // drawing axis in X direction gp_Pnt first, last; Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 5fcb6fa631..41ed66f0db 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -121,22 +121,21 @@ void AIS_Shape::Compute (const Handle(PrsMgr_PresentationManager)& , const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode) { - if (myshape.IsNull()) + if (myshape.IsNull() + || (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)) { return; } // wire,edge,vertex -> pas de HLR + priorite display superieure - const Standard_Integer aShapeType = (Standard_Integer )myshape.ShapeType(); - if (aShapeType > 4 && aShapeType < 8) + if (myshape.ShapeType() >= TopAbs_WIRE + && myshape.ShapeType() <= TopAbs_VERTEX) { + // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) + const Standard_Integer aPrior = (Standard_Integer )Graphic3d_DisplayPriority_Above1 + + (Standard_Integer )myshape.ShapeType() - TopAbs_WIRE; thePrs->SetVisual (Graphic3d_TOS_ALL); - thePrs->SetDisplayPriority (aShapeType + 2); - } - // Shape vide -> Assemblage vide. - if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0) - { - return; + thePrs->SetDisplayPriority ((Graphic3d_DisplayPriority )aPrior); } if (IsInfinite()) @@ -238,7 +237,7 @@ void AIS_Shape::computeHlrPresentation (const Handle(Graphic3d_Camera)& theProje case TopAbs_EDGE: case TopAbs_WIRE: { - thePrs->SetDisplayPriority (4); + thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Below); StdPrs_WFShape::Add (thePrs, theShape, theDrawer); return; } diff --git a/src/AIS/AIS_TexturedShape.cxx b/src/AIS/AIS_TexturedShape.cxx index e42990c8d2..80c20d7aed 100644 --- a/src/AIS/AIS_TexturedShape.cxx +++ b/src/AIS/AIS_TexturedShape.cxx @@ -349,24 +349,20 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager)& , const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode) { - if (myshape.IsNull()) + if (myshape.IsNull() + || (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)) { return; } - if (myshape.ShapeType() > TopAbs_FACE && myshape.ShapeType() < TopAbs_SHAPE) + if (myshape.ShapeType() >= TopAbs_WIRE + && myshape.ShapeType() <= TopAbs_VERTEX) { + // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) + const Standard_Integer aPrior = (Standard_Integer )Graphic3d_DisplayPriority_Above1 + + (Standard_Integer )myshape.ShapeType() - TopAbs_WIRE; thePrs->SetVisual (Graphic3d_TOS_ALL); - thePrs->SetDisplayPriority (myshape.ShapeType() + 2); - } - - if (myshape.ShapeType() == TopAbs_COMPOUND) - { - TopExp_Explorer anExplor (myshape, TopAbs_VERTEX); - if (!anExplor.More()) - { - return; - } + thePrs->SetDisplayPriority ((Graphic3d_DisplayPriority )aPrior); } if (IsInfinite()) diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index 6ab739fb89..71ca2e7dff 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -64,6 +64,7 @@ Graphic3d_CView.hxx Graphic3d_DataStructureManager.cxx Graphic3d_DataStructureManager.hxx Graphic3d_DiagnosticInfo.hxx +Graphic3d_DisplayPriority.hxx Graphic3d_FrameStats.cxx Graphic3d_FrameStats.hxx Graphic3d_FrameStatsCounter.hxx @@ -139,7 +140,6 @@ Graphic3d_ShaderVariable.lxx Graphic3d_StereoMode.hxx Graphic3d_Structure.cxx Graphic3d_Structure.hxx -Graphic3d_Structure.pxx Graphic3d_StructureDefinitionError.hxx Graphic3d_StructureManager.cxx Graphic3d_StructureManager.hxx diff --git a/src/Graphic3d/Graphic3d_CStructure.cxx b/src/Graphic3d/Graphic3d_CStructure.cxx index bfde61d4b0..cf7b7c6b64 100644 --- a/src/Graphic3d/Graphic3d_CStructure.cxx +++ b/src/Graphic3d/Graphic3d_CStructure.cxx @@ -14,7 +14,6 @@ #include -#include "Graphic3d_Structure.pxx" #include #include #include @@ -27,11 +26,11 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) //purpose : //============================================================================= Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager) -: Priority (Structure_MAX_PRIORITY / 2), - PreviousPriority (Structure_MAX_PRIORITY / 2), - // - myGraphicDriver (theManager->GraphicDriver()), +: myGraphicDriver (theManager->GraphicDriver()), + myId (-1), myZLayer (Graphic3d_ZLayerId_Default), + myPriority (Graphic3d_DisplayPriority_Normal), + myPreviousPriority(Graphic3d_DisplayPriority_Normal), myIsCulled (Standard_True), myBndBoxClipCheck(Standard_True), myHasGroupTrsf (Standard_False), @@ -45,7 +44,7 @@ Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureMana IsMutable (Standard_False), Is2dText (Standard_False) { - Id = myGraphicDriver->NewIdentification(); + myId = myGraphicDriver->NewIdentification(); } //======================================================================= @@ -62,10 +61,10 @@ void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, Standard_Inte OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get()) } - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Id) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myId) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer) - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Priority) - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PreviousPriority) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPriority) + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousPriority) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick) diff --git a/src/Graphic3d/Graphic3d_CStructure.hxx b/src/Graphic3d/Graphic3d_CStructure.hxx index b80d78ba44..8c37f5172d 100644 --- a/src/Graphic3d/Graphic3d_CStructure.hxx +++ b/src/Graphic3d/Graphic3d_CStructure.hxx @@ -16,6 +16,7 @@ #define _Graphic3d_CStructure_HeaderFile #include +#include #include #include #include @@ -139,6 +140,21 @@ public: //! highlight flag is set to true const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; } + //! Return structure id (generated by Graphic3d_GraphicDriver::NewIdentification() during structure construction). + Standard_Integer Identification() const { return myId; } + + //! Return structure display priority. + Graphic3d_DisplayPriority Priority() const { return myPriority; } + + //! Set structure display priority. + void SetPriority (Graphic3d_DisplayPriority thePriority) { myPriority = thePriority; } + + //! Return previous structure display priority. + Graphic3d_DisplayPriority PreviousPriority() const { return myPreviousPriority; } + + //! Set previous structure display priority. + void SetPreviousPriority (Graphic3d_DisplayPriority thePriority) { myPreviousPriority = thePriority; } + public: //! Returns FALSE if the structure hits the current view volume, otherwise returns TRUE. @@ -184,8 +200,7 @@ public: //! Highlights structure with the given style virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle) = 0; - //! Unhighlights the structure and invalidates pointer to structure's highlight - //! style + //! Unhighlights the structure and invalidates pointer to structure's highlight style virtual void GraphicUnhighlight() = 0; //! Create shadow link to this structure @@ -207,10 +222,6 @@ public: Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask - Standard_Integer Id; - Standard_Integer Priority; - Standard_Integer PreviousPriority; - protected: //! Create empty structure. @@ -226,7 +237,10 @@ protected: Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; Handle(Graphic3d_PresentationAttributes) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true - Graphic3d_ZLayerId myZLayer; + Standard_Integer myId; + Graphic3d_ZLayerId myZLayer; + Graphic3d_DisplayPriority myPriority; + Graphic3d_DisplayPriority myPreviousPriority; mutable Standard_Boolean myIsCulled; //!< A status specifying is structure needs to be rendered after BVH tree traverse Standard_Boolean myBndBoxClipCheck; //!< Flag responsible for checking of bounding box clipping before drawing of object diff --git a/src/Graphic3d/Graphic3d_CView.cxx b/src/Graphic3d/Graphic3d_CView.cxx index 6718b60ebf..a97efe8692 100644 --- a/src/Graphic3d/Graphic3d_CView.cxx +++ b/src/Graphic3d/Graphic3d_CView.cxx @@ -959,8 +959,8 @@ Standard_Boolean Graphic3d_CView::IsDisplayed (const Handle(Graphic3d_Structure) // purpose : // ======================================================================= void Graphic3d_CView::ChangePriority (const Handle(Graphic3d_Structure)& theStructure, - const Standard_Integer /*theOldPriority*/, - const Standard_Integer theNewPriority) + const Graphic3d_DisplayPriority /*theOldPriority*/, + const Graphic3d_DisplayPriority theNewPriority) { if (!IsActive() || !IsDisplayed (theStructure)) diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index 13cf37e1eb..d10a127240 100644 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -212,8 +212,8 @@ private: //! Changes the display priority of the structure. Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure, - const Standard_Integer theOldPriority, - const Standard_Integer theNewPriority); + const Graphic3d_DisplayPriority theOldPriority, + const Graphic3d_DisplayPriority theNewPriority); //! Change Z layer of already displayed structure in the view. Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, @@ -551,7 +551,7 @@ private: //! Adds the structure to display lists of the view. virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure, - const Standard_Integer thePriority) = 0; + const Graphic3d_DisplayPriority thePriority) = 0; //! Erases the structure from display lists of the view. virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0; @@ -562,7 +562,7 @@ private: //! Changes the priority of a structure within its Z layer in the specified view. virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure, - const Standard_Integer theNewPriority) = 0; + const Graphic3d_DisplayPriority theNewPriority) = 0; protected: diff --git a/src/Graphic3d/Graphic3d_DisplayPriority.hxx b/src/Graphic3d/Graphic3d_DisplayPriority.hxx new file mode 100644 index 0000000000..81015503b8 --- /dev/null +++ b/src/Graphic3d/Graphic3d_DisplayPriority.hxx @@ -0,0 +1,40 @@ +// Copyright (c) 1995-1999 Matra Datavision +// 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. + +#ifndef _Graphic3d_DisplayPriority_HeaderFile +#define _Graphic3d_DisplayPriority_HeaderFile + +#include + +//! Structure priority - range (do not change this range!). +//! Values are between 0 and 10, with 5 used by default. +//! A structure of priority 10 is displayed the last and appears over the others (considering depth test). +enum Graphic3d_DisplayPriority +{ + Graphic3d_DisplayPriority_INVALID = -1, + Graphic3d_DisplayPriority_Bottom = 0, + Graphic3d_DisplayPriority_AlmostBottom = 1, + Graphic3d_DisplayPriority_Below3 = 2, + Graphic3d_DisplayPriority_Below2 = 3, + Graphic3d_DisplayPriority_Below = 4, + Graphic3d_DisplayPriority_Normal = 5, + Graphic3d_DisplayPriority_Above = 6, + Graphic3d_DisplayPriority_Above1 = 7, + Graphic3d_DisplayPriority_Above2 = 8, + Graphic3d_DisplayPriority_Highlight = 9, + Graphic3d_DisplayPriority_Topmost = 10, +}; +enum { Graphic3d_DisplayPriority_NB = Graphic3d_DisplayPriority_Topmost - Graphic3d_DisplayPriority_Bottom + 1 }; + +#endif // _Graphic3d_DisplayPriority_HeaderFile diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cxx b/src/Graphic3d/Graphic3d_GraphicDriver.cxx index 4395ff576a..3717f05d65 100644 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cxx +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cxx @@ -38,7 +38,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon aSettings.SetEnableDepthWrite (Standard_False); aSettings.SetClearDepth (Standard_False); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); - Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_BotOSD, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_BotOSD, Handle(Select3D_BVHBuilder3d)()); aLayer->SetLayerSettings (aSettings); myLayers.Append (aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer); @@ -54,7 +54,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetClearDepth (Standard_False); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); - Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Default, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Default, Handle(Select3D_BVHBuilder3d)()); aLayer->SetLayerSettings (aSettings); myLayers.Append (aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer); @@ -70,7 +70,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetClearDepth (Standard_False); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); - Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Top, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Top, Handle(Select3D_BVHBuilder3d)()); aLayer->SetLayerSettings (aSettings); myLayers.Append (aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer); @@ -86,7 +86,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetClearDepth (Standard_True); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); - Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Topmost, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Topmost, Handle(Select3D_BVHBuilder3d)()); aLayer->SetLayerSettings (aSettings); myLayers.Append (aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer); @@ -102,7 +102,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon aSettings.SetEnableDepthWrite (Standard_False); aSettings.SetClearDepth (Standard_False); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); - Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_TopOSD, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_TopOSD, Handle(Select3D_BVHBuilder3d)()); aLayer->SetLayerSettings (aSettings); myLayers.Append (aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer); @@ -192,7 +192,7 @@ void Graphic3d_GraphicDriver::InsertLayerBefore (const Graphic3d_ZLayerId theNew Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId), "Graphic3d_GraphicDriver::InsertLayerBefore, Layer with theLayerId already exists"); - Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, Handle(Select3D_BVHBuilder3d)()); aNewLayer->SetLayerSettings (theSettings); Handle(Graphic3d_Layer) anOtherLayer; @@ -228,7 +228,7 @@ void Graphic3d_GraphicDriver::InsertLayerAfter (const Graphic3d_ZLayerId theNewL Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId), "Graphic3d_GraphicDriver::InsertLayerAfter, Layer with theLayerId already exists"); - Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, 1, Handle(Select3D_BVHBuilder3d)()); + Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, Handle(Select3D_BVHBuilder3d)()); aNewLayer->SetLayerSettings (theSettings); Handle(Graphic3d_Layer) anOtherLayer; diff --git a/src/Graphic3d/Graphic3d_Group.cxx b/src/Graphic3d/Graphic3d_Group.cxx index 1a704ec9d7..7b5cf7bf70 100644 --- a/src/Graphic3d/Graphic3d_Group.cxx +++ b/src/Graphic3d/Graphic3d_Group.cxx @@ -27,7 +27,6 @@ #include #include #include -#include "Graphic3d_Structure.pxx" #include #include #include diff --git a/src/Graphic3d/Graphic3d_Layer.cxx b/src/Graphic3d/Graphic3d_Layer.cxx index f5870fec8c..b6e2d6279c 100644 --- a/src/Graphic3d/Graphic3d_Layer.cxx +++ b/src/Graphic3d/Graphic3d_Layer.cxx @@ -23,10 +23,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Layer, Standard_Transient) // purpose : // ======================================================================= Graphic3d_Layer::Graphic3d_Layer (Graphic3d_ZLayerId theId, - Standard_Integer theNbPriorities, const Handle(Select3D_BVHBuilder3d)& theBuilder) -: myArray (0, theNbPriorities - 1), - myNbStructures (0), +: myNbStructures (0), myNbStructuresNotCulled (0), myLayerId (theId), myBVHPrimitivesTrsfPers (theBuilder), @@ -50,16 +48,16 @@ Graphic3d_Layer::~Graphic3d_Layer() // purpose : // ======================================================================= void Graphic3d_Layer::Add (const Graphic3d_CStructure* theStruct, - Standard_Integer thePriority, + Graphic3d_DisplayPriority thePriority, Standard_Boolean isForChangePriority) { - const Standard_Integer anIndex = Min (Max (thePriority, 0), myArray.Length() - 1); + const Standard_Integer anIndex = Min (Max (thePriority, Graphic3d_DisplayPriority_Bottom), Graphic3d_DisplayPriority_Topmost); if (theStruct == NULL) { return; } - myArray (anIndex).Add (theStruct); + myArray[anIndex].Add (theStruct); if (theStruct->IsAlwaysRendered()) { theStruct->MarkAsNotCulled(); @@ -87,19 +85,18 @@ void Graphic3d_Layer::Add (const Graphic3d_CStructure* theStruct, // purpose : // ======================================================================= bool Graphic3d_Layer::Remove (const Graphic3d_CStructure* theStruct, - Standard_Integer& thePriority, + Graphic3d_DisplayPriority& thePriority, Standard_Boolean isForChangePriority) { if (theStruct == NULL) { - thePriority = -1; + thePriority = Graphic3d_DisplayPriority_INVALID; return false; } - const Standard_Integer aNbPriorities = myArray.Length(); - for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter) + for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter) { - Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter); + Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorityIter]; const Standard_Integer anIndex = aStructures.FindIndex (theStruct); if (anIndex == 0) { @@ -133,11 +130,11 @@ bool Graphic3d_Layer::Remove (const Graphic3d_CStructure* theStruct, } } --myNbStructures; - thePriority = aPriorityIter; + thePriority = (Graphic3d_DisplayPriority )aPriorityIter; return true; } - thePriority = -1; + thePriority = Graphic3d_DisplayPriority_INVALID; return false; } @@ -203,9 +200,9 @@ Bnd_Box Graphic3d_Layer::BoundingBox (Standard_Integer theViewId, // Recompute layer bounding box myBoundingBox[aBoxId].SetVoid(); - for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) + for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); + const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { const Graphic3d_CStructure* aStructure = aStructIter.Value(); @@ -344,9 +341,9 @@ Standard_Real Graphic3d_Layer::considerZoomPersistenceObjects (Standard_Integer const Graphic3d_Mat4d& aWorldViewMat = theCamera->OrientationMatrix(); Standard_Real aMaxCoef = -std::numeric_limits::max(); - for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) + for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); + const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { const Graphic3d_CStructure* aStructure = aStructIter.Value(); @@ -463,9 +460,9 @@ void Graphic3d_Layer::updateBVH() const myBVHPrimitivesTrsfPers.Clear(); myAlwaysRenderedMap.Clear(); myIsBVHPrimitivesNeedsReset = Standard_False; - for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) + for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); + const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { const Graphic3d_CStructure* aStruct = aStructIter.Value(); @@ -655,20 +652,13 @@ void Graphic3d_Layer::UpdateCulling (Standard_Integer theViewId, // ======================================================================= Standard_Boolean Graphic3d_Layer::Append (const Graphic3d_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 (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = theOther.myArray (aPriorityIter); + const Graphic3d_IndexedMapOfStructure& aStructures = theOther.myArray[aPriorityIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { - Add (aStructIter.Value(), aPriorityIter); + Add (aStructIter.Value(), (Graphic3d_DisplayPriority )aPriorityIter); } } @@ -688,9 +678,9 @@ void Graphic3d_Layer::SetLayerSettings (const Graphic3d_ZLayerSettings& theSetti return; } - for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) + for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter) { - Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.ChangeValue(); + Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { Graphic3d_CStructure* aStructure = const_cast(aStructIter.Value()); @@ -712,10 +702,9 @@ void Graphic3d_Layer::DumpJson (Standard_OStream& theOStream, Standard_Integer t OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled) - const Standard_Integer aNbPriorities = myArray.Length(); - for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter) + for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter); + const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorityIter]; for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { const Graphic3d_CStructure* aStructure = aStructIter.Value(); diff --git a/src/Graphic3d/Graphic3d_Layer.hxx b/src/Graphic3d/Graphic3d_Layer.hxx index bd5c3dca8a..7a480075b7 100644 --- a/src/Graphic3d/Graphic3d_Layer.hxx +++ b/src/Graphic3d/Graphic3d_Layer.hxx @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -24,11 +25,13 @@ #include #include +#include + //! Defines index map of structures. typedef NCollection_IndexedMap Graphic3d_IndexedMapOfStructure; //! Defines array of indexed maps of structures. -typedef NCollection_Array1 Graphic3d_ArrayOfIndexedMapOfStructure; +typedef std::array Graphic3d_ArrayOfIndexedMapOfStructure; class Graphic3d_CullingTool; @@ -40,7 +43,6 @@ public: //! Initializes associated priority list and layer properties Standard_EXPORT Graphic3d_Layer (Graphic3d_ZLayerId theId, - Standard_Integer theNbPriorities, const Handle(Select3D_BVHBuilder3d)& theBuilder); //! Destructor. @@ -49,10 +51,10 @@ public: //! Return layer id. Graphic3d_ZLayerId LayerId() const { return myLayerId; } - //! Returns BVH tree builder for frustom culling. + //! Returns BVH tree builder for frustum culling. const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHPrimitivesTrsfPers.Builder(); } - //! Assigns BVH tree builder for frustom culling. + //! Assigns BVH tree builder for frustum culling. void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder) { myBVHPrimitivesTrsfPers.SetBuilder (theBuilder); } //! Return true if layer was marked with immediate flag. @@ -65,12 +67,12 @@ public: Standard_EXPORT void SetLayerSettings (const Graphic3d_ZLayerSettings& theSettings); Standard_EXPORT void Add (const Graphic3d_CStructure* theStruct, - Standard_Integer thePriority, + Graphic3d_DisplayPriority thePriority, Standard_Boolean isForChangePriority = Standard_False); //! Remove structure and returns its priority, if the structure is not found, method returns negative value Standard_EXPORT bool Remove (const Graphic3d_CStructure* theStruct, - Standard_Integer& thePriority, + Graphic3d_DisplayPriority& thePriority, Standard_Boolean isForChangePriority = Standard_False); //! @return the number of structures @@ -80,7 +82,7 @@ public: Standard_Integer NbStructuresNotCulled() const { return myNbStructuresNotCulled; } //! Returns the number of available priority levels - Standard_Integer NbPriorities() const { return myArray.Length(); } + Standard_Integer NbPriorities() const { return Graphic3d_DisplayPriority_NB; } //! Append layer of acceptable type (with similar number of priorities or less). //! Returns Standard_False if the list can not be accepted. @@ -89,6 +91,9 @@ public: //! Returns array of structures. const Graphic3d_ArrayOfIndexedMapOfStructure& ArrayOfStructures() const { return myArray; } + //! Returns structures for specified priority. + const Graphic3d_IndexedMapOfStructure& Structures (Graphic3d_DisplayPriority thePriority) const { return myArray[thePriority]; } + //! Marks BVH tree for given priority list as dirty and //! marks primitive set for rebuild. Standard_EXPORT void InvalidateBVHData(); diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 062b264097..92b56ada60 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -27,8 +27,6 @@ #include #include -#include "Graphic3d_Structure.pxx" - #include #include @@ -133,7 +131,7 @@ void Graphic3d_Structure::Remove() } // Destruction of me in the graphic library - const Standard_Integer aStructId = myCStructure->Id; + const Standard_Integer aStructId = myCStructure->Identification(); myCStructure->GraphicDriver()->RemoveIdentification(aStructId); myCStructure->GraphicDriver()->RemoveStructure (myCStructure); myCStructure.Nullify(); @@ -164,25 +162,25 @@ void Graphic3d_Structure::Display() //function : SetDisplayPriority //purpose : //============================================================================= -void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer thePriority) +void Graphic3d_Structure::SetDisplayPriority (const Graphic3d_DisplayPriority thePriority) { if (IsDeleted() - || thePriority == myCStructure->Priority) + || thePriority == myCStructure->Priority()) { return; } - myCStructure->PreviousPriority = myCStructure->Priority; - myCStructure->Priority = thePriority; + Graphic3d_PriorityDefinitionError_Raise_if ((thePriority > Graphic3d_DisplayPriority_Topmost) + || (thePriority < Graphic3d_DisplayPriority_Bottom), + "Bad value for StructurePriority"); - if (myCStructure->Priority != myCStructure->PreviousPriority) + myCStructure->SetPreviousPriority (myCStructure->Priority()); + myCStructure->SetPriority (thePriority); + if (myCStructure->Priority() != myCStructure->PreviousPriority()) { - Graphic3d_PriorityDefinitionError_Raise_if ((myCStructure->Priority > Structure_MAX_PRIORITY) - || (myCStructure->Priority < Structure_MIN_PRIORITY), - "Bad value for StructurePriority"); if (myCStructure->stick) { - myStructureManager->ChangeDisplayPriority (this, myCStructure->PreviousPriority, myCStructure->Priority); + myStructureManager->ChangeDisplayPriority (this, myCStructure->PreviousPriority(), myCStructure->Priority()); } } } @@ -194,16 +192,16 @@ void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer thePriority void Graphic3d_Structure::ResetDisplayPriority() { if (IsDeleted() - || myCStructure->Priority == myCStructure->PreviousPriority) + || myCStructure->Priority() == myCStructure->PreviousPriority()) { return; } - const Standard_Integer aPriority = myCStructure->Priority; - myCStructure->Priority = myCStructure->PreviousPriority; + const Graphic3d_DisplayPriority aPriority = myCStructure->Priority(); + myCStructure->SetPriority (myCStructure->PreviousPriority()); if (myCStructure->stick) { - myStructureManager->ChangeDisplayPriority (this, aPriority, myCStructure->Priority); + myStructureManager->ChangeDisplayPriority (this, aPriority, myCStructure->Priority()); } } @@ -237,10 +235,8 @@ void Graphic3d_Structure::Highlight (const Handle(Graphic3d_PresentationAttribut return; } - SetDisplayPriority (Structure_MAX_PRIORITY - 1); - + SetDisplayPriority (Graphic3d_DisplayPriority_Highlight); myCStructure->GraphicHighlight (theStyle); - if (!theToUpdateMgr) { return; diff --git a/src/Graphic3d/Graphic3d_Structure.hxx b/src/Graphic3d/Graphic3d_Structure.hxx index 8b9e438173..905628df50 100644 --- a/src/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Graphic3d/Graphic3d_Structure.hxx @@ -76,7 +76,23 @@ public: Standard_EXPORT virtual void Display(); //! Returns the current display priority for this structure. - Standard_Integer DisplayPriority() const { return myCStructure->Priority; } + Graphic3d_DisplayPriority DisplayPriority() const { return myCStructure->Priority(); } + + //! Modifies the order of displaying the structure. + //! Values are between 0 and 10. + //! Structures are drawn according to their display priorities in ascending order. + //! A structure of priority 10 is displayed the last and appears over the others. + //! The default value is 5. + //! Warning: If structure is displayed then the SetDisplayPriority method erases it and displays with the new priority. + //! Raises Graphic3d_PriorityDefinitionError if Priority is greater than 10 or a negative value. + Standard_EXPORT void SetDisplayPriority (const Graphic3d_DisplayPriority thePriority); + + Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()") + void SetDisplayPriority (const Standard_Integer thePriority) { SetDisplayPriority ((Graphic3d_DisplayPriority )thePriority); } + + //! Reset the current priority of the structure to the previous priority. + //! Warning: If structure is displayed then the SetDisplayPriority() method erases it and displays with the previous priority. + Standard_EXPORT void ResetDisplayPriority(); //! Erases this structure in all the views of the visualiser. virtual void Erase() { erase(); } @@ -106,28 +122,6 @@ public: if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; } } - //! Modifies the order of displaying the structure. - //! Values are between 0 and 10. - //! Structures are drawn according to their display priorities - //! in ascending order. - //! A structure of priority 10 is displayed the last and appears over the others. - //! The default value is 5. - //! Category: Methods to modify the class definition - //! Warning: If is displayed then the SetDisplayPriority - //! method erase and display with the - //! new priority. - //! Raises PriorityDefinitionError if is - //! greater than 10 or a negative value. - Standard_EXPORT void SetDisplayPriority (const Standard_Integer Priority); - - //! Reset the current priority of the structure to the - //! previous priority. - //! Category: Methods to modify the class definition - //! Warning: If is displayed then the SetDisplayPriority - //! method erase and display with the - //! previous priority. - Standard_EXPORT void ResetDisplayPriority(); - //! Set Z layer ID for the structure. The Z layer mechanism //! allows to display structures presented in higher layers in overlay //! of structures in lower layers by switching off z buffer depth @@ -411,7 +405,7 @@ public: } //! Returns the identification number of this structure. - Standard_Integer Identification() const { return myCStructure->Id; } + Standard_Integer Identification() const { return myCStructure->Identification(); } //! Prints information about the network associated //! with the structure . diff --git a/src/Graphic3d/Graphic3d_Structure.pxx b/src/Graphic3d/Graphic3d_Structure.pxx deleted file mode 100644 index c841755f09..0000000000 --- a/src/Graphic3d/Graphic3d_Structure.pxx +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// 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. - -#ifndef STRUCTURE_PXX_INCLUDED -#define STRUCTURE_PXX_INCLUDED - -// structure priority : range (do not change this range !) -// call_togl_displaystructure, CALL_DEF_VIEW, MajView ... -#define Structure_MAX_PRIORITY 10 -#define Structure_MIN_PRIORITY 0 - -#endif diff --git a/src/Graphic3d/Graphic3d_StructureManager.cxx b/src/Graphic3d/Graphic3d_StructureManager.cxx index e979b644f3..de8637203c 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cxx +++ b/src/Graphic3d/Graphic3d_StructureManager.cxx @@ -420,8 +420,8 @@ void Graphic3d_StructureManager::SetTransform (const Handle(Graphic3d_Structure) // purpose : // ======================================================================== void Graphic3d_StructureManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, - const Standard_Integer theOldPriority, - const Standard_Integer theNewPriority) + const Graphic3d_DisplayPriority theOldPriority, + const Graphic3d_DisplayPriority theNewPriority) { for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next()) { diff --git a/src/Graphic3d/Graphic3d_StructureManager.hxx b/src/Graphic3d/Graphic3d_StructureManager.hxx index 19c376fa22..906abfef5b 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.hxx +++ b/src/Graphic3d/Graphic3d_StructureManager.hxx @@ -112,7 +112,9 @@ public: Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(TopLoc_Datum3D)& theTrsf); //! Changes the display priority of the structure . - Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer theOldPriority, const Standard_Integer theNewPriority); + Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, + const Graphic3d_DisplayPriority theOldPriority, + const Graphic3d_DisplayPriority theNewPriority); //! Change Z layer for structure. The Z layer mechanism allows to display structures in higher //! layers in overlay of structures in lower layers. diff --git a/src/MeshVS/MeshVS_Mesh.cxx b/src/MeshVS/MeshVS_Mesh.cxx index 9d1df7055a..3f55246015 100644 --- a/src/MeshVS/MeshVS_Mesh.cxx +++ b/src/MeshVS/MeshVS_Mesh.cxx @@ -1051,7 +1051,7 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager)& th if ( IsNeedToRedisplay ) { - aSelectionPrs->SetDisplayPriority(9); + aSelectionPrs->SetDisplayPriority (Graphic3d_DisplayPriority_Highlight); aSelectionPrs->Display(); } diff --git a/src/OpenGl/OpenGl_GraphicDriver.cxx b/src/OpenGl/OpenGl_GraphicDriver.cxx index 448f53642b..4ed778fd2f 100644 --- a/src/OpenGl/OpenGl_GraphicDriver.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver.cxx @@ -743,7 +743,7 @@ void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_ZLayerId theLayerI Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::CreateStructure (const Handle(Graphic3d_StructureManager)& theManager) { Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager); - myMapOfStructure.Bind (aStructure->Id, aStructure.operator->()); + myMapOfStructure.Bind (aStructure->Identification(), aStructure.operator->()); return aStructure; } @@ -754,12 +754,12 @@ Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::CreateStructure (const Handle void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) { OpenGl_Structure* aStructure = NULL; - if (!myMapOfStructure.Find (theCStructure->Id, aStructure)) + if (!myMapOfStructure.Find (theCStructure->Identification(), aStructure)) { return; } - myMapOfStructure.UnBind (theCStructure->Id); + myMapOfStructure.UnBind (theCStructure->Identification()); aStructure->Release (GetSharedContext()); theCStructure.Nullify(); } diff --git a/src/OpenGl/OpenGl_LayerList.cxx b/src/OpenGl/OpenGl_LayerList.cxx index efa7434541..4c30668c79 100644 --- a/src/OpenGl/OpenGl_LayerList.cxx +++ b/src/OpenGl/OpenGl_LayerList.cxx @@ -156,9 +156,8 @@ struct OpenGl_GlobalLayerSettings //purpose : Constructor //======================================================================= -OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities) +OpenGl_LayerList::OpenGl_LayerList() : myBVHBuilder (new BVH_LinearBuilder (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth)), - myNbPriorities (theNbPriorities), myNbStructures (0), myImmediateNbStructures (0), myModifStateOfRaytraceable (0) @@ -201,7 +200,7 @@ void OpenGl_LayerList::InsertLayerBefore (const Graphic3d_ZLayerId theNewLayerId return; } - Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myNbPriorities, myBVHBuilder); + Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myBVHBuilder); aNewLayer->SetLayerSettings (theSettings); Handle(Graphic3d_Layer) anOtherLayer; @@ -239,7 +238,7 @@ void OpenGl_LayerList::InsertLayerAfter (const Graphic3d_ZLayerId theNewLayerId, return; } - Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myNbPriorities, myBVHBuilder); + Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myBVHBuilder); aNewLayer->SetLayerSettings (theSettings); Handle(Graphic3d_Layer) anOtherLayer; @@ -294,7 +293,7 @@ void OpenGl_LayerList::RemoveLayer (const Graphic3d_ZLayerId theLayerId) void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct, const Graphic3d_ZLayerId theLayerId, - const Standard_Integer thePriority, + const Graphic3d_DisplayPriority thePriority, Standard_Boolean isForChangePriority) { // add structure to associated layer, @@ -324,7 +323,7 @@ void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure* theStructure) const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (aLayerId); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); - Standard_Integer aPriority = -1; + Graphic3d_DisplayPriority aPriority = Graphic3d_DisplayPriority_INVALID; // remove structure from associated list // if the structure is not found there, @@ -396,7 +395,7 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure, const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theOldLayerId); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); - Standard_Integer aPriority = -1; + Graphic3d_DisplayPriority aPriority = Graphic3d_DisplayPriority_INVALID; // take priority and remove structure from list found by // if the structure is not found there, scan through all other layers @@ -460,13 +459,12 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure, //======================================================================= void OpenGl_LayerList::ChangePriority (const OpenGl_Structure* theStructure, const Graphic3d_ZLayerId theLayerId, - const Standard_Integer theNewPriority) + const Graphic3d_DisplayPriority theNewPriority) { const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theLayerId); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); - Standard_Integer anOldPriority = -1; - + Graphic3d_DisplayPriority anOldPriority = Graphic3d_DisplayPriority_INVALID; if (aLayer->Remove (theStructure, anOldPriority, Standard_True)) { --myNbStructures; @@ -664,9 +662,9 @@ void OpenGl_LayerList::renderLayer (const Handle(OpenGl_Workspace)& theWorkspace // render priority list const Standard_Integer aViewId = theWorkspace->View()->Identification(); - for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (theLayer.ArrayOfStructures()); aMapIter.More(); aMapIter.Next()) + for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter) { - const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); + const Graphic3d_IndexedMapOfStructure& aStructures = theLayer.Structures ((Graphic3d_DisplayPriority )aPriorityIter); for (OpenGl_Structure::StructIterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) { const OpenGl_Structure* aStruct = aStructIter.Value(); @@ -1250,7 +1248,6 @@ void OpenGl_LayerList::DumpJson (Standard_OStream& theOStream, Standard_Integer OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLayerId.get()) } - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbPriorities) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myImmediateNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModifStateOfRaytraceable) diff --git a/src/OpenGl/OpenGl_LayerList.hxx b/src/OpenGl/OpenGl_LayerList.hxx index ad28b63526..a92304918d 100644 --- a/src/OpenGl/OpenGl_LayerList.hxx +++ b/src/OpenGl/OpenGl_LayerList.hxx @@ -36,13 +36,13 @@ class OpenGl_LayerList public: //! Constructor - Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities); + Standard_EXPORT OpenGl_LayerList(); //! Destructor Standard_EXPORT virtual ~OpenGl_LayerList(); //! Method returns the number of available priorities - Standard_Integer NbPriorities() const { return myNbPriorities; } + Standard_Integer NbPriorities() const { return Graphic3d_DisplayPriority_NB; } //! Number of displayed structures Standard_Integer NbStructures() const { return myNbStructures; } @@ -68,7 +68,7 @@ public: //! to default bottom-level layer. Standard_EXPORT void AddStructure (const OpenGl_Structure* theStruct, const Graphic3d_ZLayerId theLayerId, - const Standard_Integer thePriority, + const Graphic3d_DisplayPriority thePriority, Standard_Boolean isForChangePriority = Standard_False); //! Remove structure from structure list and return its previous priority @@ -84,7 +84,7 @@ public: //! Changes structure priority within its ZLayer Standard_EXPORT void ChangePriority (const OpenGl_Structure* theStructure, const Graphic3d_ZLayerId theLayerId, - const Standard_Integer theNewPriority); + const Graphic3d_DisplayPriority theNewPriority); //! Returns reference to the layer with given ID. OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) { return *myLayerIds.Find (theLayerId); } @@ -120,10 +120,10 @@ public: //! Returns structure modification state (for ray-tracing). Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; } - //! Returns BVH tree builder for frustom culling. + //! Returns BVH tree builder for frustum culling. const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHBuilder; } - //! Assigns BVH tree builder for frustom culling. + //! Assigns BVH tree builder for frustum culling. Standard_EXPORT void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder); //! Dumps the content of me into the stream @@ -203,9 +203,8 @@ protected: NCollection_List myLayers; NCollection_DataMap myLayerIds; - Handle(Select3D_BVHBuilder3d) myBVHBuilder; //!< BVH tree builder for frustom culling + Handle(Select3D_BVHBuilder3d) myBVHBuilder; //!< BVH tree builder for frustum culling - Standard_Integer myNbPriorities; Standard_Integer myNbStructures; Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers diff --git a/src/OpenGl/OpenGl_View.cxx b/src/OpenGl/OpenGl_View.cxx index ec410fc6f8..f352db0655 100644 --- a/src/OpenGl/OpenGl_View.cxx +++ b/src/OpenGl/OpenGl_View.cxx @@ -39,7 +39,6 @@ #include #include -#include "../Graphic3d/Graphic3d_Structure.pxx" #include "../Textures/Textures_EnvLUT.pxx" namespace @@ -109,7 +108,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr, myCaps (theCaps), myWasRedrawnGL (Standard_False), myToShowGradTrihedron (false), - myZLayers (Structure_MAX_PRIORITY - Structure_MIN_PRIORITY + 1), myStateCounter (theCounter), myCurrLightSourceState (theCounter->Increment()), myLightsRevision (0), @@ -880,7 +878,7 @@ void OpenGl_View::FBOChangeViewport (const Handle(Standard_Transient)& theFbo, //purpose : //======================================================================= void OpenGl_View::displayStructure (const Handle(Graphic3d_CStructure)& theStructure, - const Standard_Integer thePriority) + const Graphic3d_DisplayPriority thePriority) { const OpenGl_Structure* aStruct = static_cast (theStructure.get()); const Graphic3d_ZLayerId aZLayer = aStruct->ZLayer(); @@ -916,7 +914,7 @@ void OpenGl_View::changeZLayer (const Handle(Graphic3d_CStructure)& theStructure //purpose : //======================================================================= void OpenGl_View::changePriority (const Handle(Graphic3d_CStructure)& theStructure, - const Standard_Integer theNewPriority) + const Graphic3d_DisplayPriority theNewPriority) { const Graphic3d_ZLayerId aLayerId = theStructure->ZLayer(); const OpenGl_Structure* aStruct = static_cast (theStructure.get()); diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index 32b1f8043b..78367fa9aa 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -403,7 +403,7 @@ private: //! Adds the structure to display lists of the view. Standard_EXPORT virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure, - const Standard_Integer thePriority) Standard_OVERRIDE; + const Graphic3d_DisplayPriority thePriority) Standard_OVERRIDE; //! Erases the structure from display lists of the view. Standard_EXPORT virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) Standard_OVERRIDE; @@ -414,7 +414,7 @@ private: //! Changes the priority of a structure within its Z layer in the specified view. Standard_EXPORT virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure, - const Standard_Integer theNewPriority) Standard_OVERRIDE; + const Graphic3d_DisplayPriority theNewPriority) Standard_OVERRIDE; private: diff --git a/src/OpenGl/OpenGl_View_Raytrace.cxx b/src/OpenGl/OpenGl_View_Raytrace.cxx index 91894ef2ff..d36c0c5aba 100644 --- a/src/OpenGl/OpenGl_View_Raytrace.cxx +++ b/src/OpenGl/OpenGl_View_Raytrace.cxx @@ -121,10 +121,10 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry (const RaytraceUpdateMode continue; } - const Graphic3d_ArrayOfIndexedMapOfStructure& aStructArray = aLayer->ArrayOfStructures(); - for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex) + for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter) { - for (OpenGl_Structure::StructIterator aStructIt (aStructArray.Value (anIndex)); aStructIt.More(); aStructIt.Next()) + const Graphic3d_IndexedMapOfStructure& aStructures = aLayer->Structures ((Graphic3d_DisplayPriority )aPriorityIter); + for (OpenGl_Structure::StructIterator aStructIt (aStructures); aStructIt.More(); aStructIt.Next()) { const OpenGl_Structure* aStructure = aStructIt.Value(); @@ -136,7 +136,7 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry (const RaytraceUpdateMode } else if (aStructure->IsVisible() && myRaytraceParameters.GlobalIllumination) { - aNonRaytraceIDs.insert (aStructure->highlight ? aStructure->Id : -aStructure->Id); + aNonRaytraceIDs.insert (aStructure->highlight ? aStructure->Identification() : -aStructure->Identification()); } } else if (theMode == OpenGl_GUM_PREPARE) diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cxx b/src/PrsMgr/PrsMgr_PresentationManager.cxx index b0be613603..915e1b9fd7 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.cxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.cxx @@ -210,7 +210,7 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj // ======================================================================= void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, const Standard_Integer theMode, - const Standard_Integer theNewPrior) const + const Graphic3d_DisplayPriority theNewPrior) const { if (thePrsObj->ToPropagateVisualState()) { @@ -231,15 +231,15 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present // function : DisplayPriority // purpose : // ======================================================================= -Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, - const Standard_Integer theMode) const +Graphic3d_DisplayPriority PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, + const Standard_Integer theMode) const { if (thePrsObj->ToPropagateVisualState()) { for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next()) { - Standard_Integer aPriority = DisplayPriority(anIter.Value(), theMode); - if (aPriority != 0) + Graphic3d_DisplayPriority aPriority = DisplayPriority(anIter.Value(), theMode); + if (aPriority != Graphic3d_DisplayPriority_INVALID) { return aPriority; } @@ -249,7 +249,7 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); return !aPrs.IsNull() ? aPrs->DisplayPriority() - : 0; + : Graphic3d_DisplayPriority_INVALID; } // ======================================================================= @@ -697,7 +697,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)& } Handle(TopLoc_Datum3D) aTrsf = theObj->LocalTransformationGeom(); - const Standard_Integer aParentId = aPrs->CStructure()->Id; + const Standard_Integer aParentId = aPrs->CStructure()->Identification(); updatePrsTransformation (myImmediateList, aParentId, aTrsf); if (!myViewDependentImmediateList.IsEmpty()) @@ -709,7 +709,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)& if (aView->IsComputed (aParentId, aViewDepParentPrs)) { updatePrsTransformation (myViewDependentImmediateList, - aViewDepParentPrs->CStructure()->Id, + aViewDepParentPrs->CStructure()->Identification(), aTrsf); } } diff --git a/src/PrsMgr/PrsMgr_PresentationManager.hxx b/src/PrsMgr/PrsMgr_PresentationManager.hxx index 5160c520c6..a33b505410 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.hxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.hxx @@ -66,12 +66,13 @@ public: //! Sets the display priority theNewPrior of the //! presentable object thePrsObject in this framework with the display mode theMode. - Standard_EXPORT void SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Integer theNewPrior) const; - + Standard_EXPORT void SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, + const Standard_Integer theMode, + const Graphic3d_DisplayPriority theNewPrior) const; //! Returns the display priority of the presentable object //! thePrsObject in this framework with the display mode theMode. - Standard_EXPORT Standard_Integer DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) const; + Standard_EXPORT Graphic3d_DisplayPriority DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) const; //! Set Z layer ID for all presentations of the object. Standard_EXPORT void SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Graphic3d_ZLayerId theLayerId); diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 42c8028fba..8559eaed3a 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -1301,7 +1301,7 @@ void SelectMgr_ViewerSelector::DisplaySensitive (const Handle(V3d_View)& theView for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructs); aStructIter.More(); aStructIter.Next()) { Handle(Graphic3d_Structure)& aStruct = aStructIter.ChangeValue(); - aStruct->SetDisplayPriority (10); + aStruct->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost); aStruct->Display(); } @@ -1348,7 +1348,7 @@ void SelectMgr_ViewerSelector::DisplaySensitive (const Handle(SelectMgr_Selectio SelectMgr::ComputeSensitivePrs (aStruct, theSel, theTrsf, Handle(Graphic3d_TransformPers)()); myStructs.Append (aStruct); - myStructs.Last()->SetDisplayPriority (10); + myStructs.Last()->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost); myStructs.Last()->Display(); theView->Update(); diff --git a/src/V3d/V3d_CircularGrid.cxx b/src/V3d/V3d_CircularGrid.cxx index 99691c4552..c15eae14b7 100644 --- a/src/V3d/V3d_CircularGrid.cxx +++ b/src/V3d/V3d_CircularGrid.cxx @@ -103,7 +103,7 @@ void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_C void V3d_CircularGrid::Display () { - myStructure->SetDisplayPriority (1); + myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom); myStructure->Display(); UpdateDisplay(); } diff --git a/src/V3d/V3d_Plane.cxx b/src/V3d/V3d_Plane.cxx index 3a26015bd4..c40df8d197 100755 --- a/src/V3d/V3d_Plane.cxx +++ b/src/V3d/V3d_Plane.cxx @@ -86,7 +86,7 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView, aPrims->AddVertex ( aSize,-aSize, anOffset); aGroup->AddPrimitiveArray(aPrims); - myGraphicStructure->SetDisplayPriority (0); + myGraphicStructure->SetDisplayPriority (Graphic3d_DisplayPriority_Bottom); myGraphicStructure->Display(); Update(); } diff --git a/src/V3d/V3d_RectangularGrid.cxx b/src/V3d/V3d_RectangularGrid.cxx index cfa41e3dac..2eaa5b7ae2 100644 --- a/src/V3d/V3d_RectangularGrid.cxx +++ b/src/V3d/V3d_RectangularGrid.cxx @@ -104,7 +104,7 @@ void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantit void V3d_RectangularGrid::Display () { - myStructure->SetDisplayPriority (1); + myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom); myStructure->Display(); UpdateDisplay(); } diff --git a/src/V3d/V3d_Trihedron.cxx b/src/V3d/V3d_Trihedron.cxx index 61159f0921..6b3eac1540 100644 --- a/src/V3d/V3d_Trihedron.cxx +++ b/src/V3d/V3d_Trihedron.cxx @@ -255,7 +255,7 @@ void V3d_Trihedron::Display (const V3d_View& theView) myStructure = new TrihedronStructure (theView.Viewer()->StructureManager(), this); myStructure->SetTransformPersistence (myTransformPers); myStructure->SetZLayer (Graphic3d_ZLayerId_Topmost); - myStructure->SetDisplayPriority (9); + myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_Highlight); myStructure->SetInfiniteState (Standard_True); myStructure->CStructure()->ViewAffinity = new Graphic3d_ViewAffinity(); myStructure->CStructure()->ViewAffinity->SetVisible (Standard_False); diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index b4281b6f63..14aa3e64f8 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -6548,16 +6548,16 @@ static int VPriority (Draw_Interpretor& theDI, } TCollection_AsciiString aLastArg (theArgs[theArgNum - 1]); - Standard_Integer aPriority = -1; + Standard_Integer aPriority = Graphic3d_DisplayPriority_INVALID; Standard_Integer aNbArgs = theArgNum; if (aLastArg.IsIntegerValue()) { aPriority = aLastArg.IntegerValue(); --aNbArgs; - if (aPriority < 0 || aPriority > 10) + if (aPriority < Graphic3d_DisplayPriority_Bottom || aPriority > Graphic3d_DisplayPriority_Topmost) { Message::SendFail() << "Syntax error: the specified display priority value '" << aLastArg - << "' is outside the valid range [0..10]"; + << "' is outside the valid range [" << Graphic3d_DisplayPriority_Bottom << ".." << Graphic3d_DisplayPriority_Topmost << "]"; return 1; } } @@ -6589,13 +6589,13 @@ static int VPriority (Draw_Interpretor& theDI, return 1; } - if (aPriority < 1) + if (aPriority == Graphic3d_DisplayPriority_INVALID) { theDI << aContext->DisplayPriority (anIObj) << " "; } else { - aContext->SetDisplayPriority (anIObj, aPriority); + aContext->SetDisplayPriority (anIObj, (Graphic3d_DisplayPriority )aPriority); } } return 0; diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cxx b/src/XCAFPrs/XCAFPrs_AISObject.cxx index 2f182da0bb..5d01a9079f 100644 --- a/src/XCAFPrs/XCAFPrs_AISObject.cxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.cxx @@ -240,7 +240,7 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager)& thePr if (XCAFPrs::GetViewNameMode()) { // Displaying Name attributes - thePrs->SetDisplayPriority (10); + thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost); DisplayText (myLabel, thePrs, Attributes()->DimensionAspect()->TextAspect(), TopLoc_Location());//no location } }