]> OCCT Git - occt.git/commitdiff
0032725: Visualization - Graphic3d_Structure::SetDisplayPriority() should use public... IR-2021-12-10
authorkgv <kgv@opencascade.com>
Wed, 8 Dec 2021 12:55:11 +0000 (15:55 +0300)
committersmoskvin <smoskvin@opencascade.com>
Thu, 9 Dec 2021 22:24:40 +0000 (01:24 +0300)
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.

39 files changed:
src/AIS/AIS_Axis.cxx
src/AIS/AIS_Circle.cxx
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_Line.cxx
src/AIS/AIS_PlaneTrihedron.cxx
src/AIS/AIS_Shape.cxx
src/AIS/AIS_TexturedShape.cxx
src/Graphic3d/FILES
src/Graphic3d/Graphic3d_CStructure.cxx
src/Graphic3d/Graphic3d_CStructure.hxx
src/Graphic3d/Graphic3d_CView.cxx
src/Graphic3d/Graphic3d_CView.hxx
src/Graphic3d/Graphic3d_DisplayPriority.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_GraphicDriver.cxx
src/Graphic3d/Graphic3d_Group.cxx
src/Graphic3d/Graphic3d_Layer.cxx
src/Graphic3d/Graphic3d_Layer.hxx
src/Graphic3d/Graphic3d_Structure.cxx
src/Graphic3d/Graphic3d_Structure.hxx
src/Graphic3d/Graphic3d_Structure.pxx [deleted file]
src/Graphic3d/Graphic3d_StructureManager.cxx
src/Graphic3d/Graphic3d_StructureManager.hxx
src/MeshVS/MeshVS_Mesh.cxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_LayerList.cxx
src/OpenGl/OpenGl_LayerList.hxx
src/OpenGl/OpenGl_View.cxx
src/OpenGl/OpenGl_View.hxx
src/OpenGl/OpenGl_View_Raytrace.cxx
src/PrsMgr/PrsMgr_PresentationManager.cxx
src/PrsMgr/PrsMgr_PresentationManager.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/V3d/V3d_CircularGrid.cxx
src/V3d/V3d_Plane.cxx
src/V3d/V3d_RectangularGrid.cxx
src/V3d/V3d_Trihedron.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
src/XCAFPrs/XCAFPrs_AISObject.cxx

index 2be1c37c2036e35d4cd7689ad982a84aa550261c..e4864120f4e7c7df4acf8826a4623963bc5344ff 100644 (file)
@@ -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);
index 08160855aa4f699c0ecf7cb2230f21de1bc271b2..9a8371f70fe5dcc07d686bb446ef8c85363cc04a 100644 (file)
@@ -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); }
 }
index ae54206b1618a7003e17f6632f4aae54c2cbfc58..427dd5a08eaeb85a743de3303d54305288e030f4 100644 (file)
@@ -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())
   {
index 8faa035d4feea70927bc4653e6c1792a5a3fe31e..acbb8741ef1e2706682e81123ac5ebbc198b748d 100644 (file)
@@ -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;
index b3d92c5c33179dad1b37df067215a1e180f84630..db9bf36c5587379e7be9d46ed02dc8448680cfaf 100644 (file)
@@ -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); }
 }
index d7e84265107f1c4d2500fe37fc1ac03f54fb072d..bafe6a3c3a5ed2a422cb2dce47d317c61ad12c8f 100644 (file)
@@ -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);
index 5fcb6fa63105f5cfbb01b48235fd1461d2f2d171..41ed66f0dbb679246db4d982c477fe605c5bdca2 100644 (file)
@@ -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;
     }
index e42990c8d2af06d349b4f65624bfed2c344bfae2..80c20d7aedcbf547f35fb4c054fdc68439a3f252 100644 (file)
@@ -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())
index 6ab739fb89ca32718f9fb2d48f284eac6c6d6495..71ca2e7dff694d5e3aa5edce3fed2805685f3a7d 100755 (executable)
@@ -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
index bfde61d4b0cec7a2fd581fffae6c4b9d99e9d7f1..cf7b7c6b64dd903ee8c93047b589d2cbbe75b3ab 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <Graphic3d_CStructure.hxx>
 
-#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_StructureManager.hxx>
 #include <Graphic3d_TransModeFlags.hxx>
 #include <Graphic3d_GraphicDriver.hxx>
@@ -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)
index b80d78ba44c212203ff47a65ea62fb6e7eb8bdd1..8c37f5172dd60d9c7f4056f49fd3b519d9942797 100644 (file)
@@ -16,6 +16,7 @@
 #define _Graphic3d_CStructure_HeaderFile
 
 #include <Graphic3d_BndBox3d.hxx>
+#include <Graphic3d_DisplayPriority.hxx>
 #include <Graphic3d_Group.hxx>
 #include <Graphic3d_PresentationAttributes.hxx>
 #include <Graphic3d_SequenceOfGroup.hxx>
@@ -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
index 6718b60ebf77b8f14bc9cd058878b812dafb83af..a97efe8692259193ad7fff85579f2de83e65a821 100644 (file)
@@ -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))
index 13cf37e1ebd6548dad6995e39f017b2d0c9b2d48..d10a127240a9d30e268e0c0695bb4187449f7b29 100644 (file)
@@ -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 (file)
index 0000000..8101550
--- /dev/null
@@ -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 <Standard_Integer.hxx>
+
+//! 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
index 4395ff576a36f8c3ac2439fc0f1e868c5f0617a9..3717f05d65f96d592c33e475bbc34bb23fec40cf 100644 (file)
@@ -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;
index 1a704ec9d7f2b6dbf8b362184c45f58fe60ee1fe..7b5cf7bf70820081d0a20857664f4c29c309f803 100644 (file)
@@ -27,7 +27,6 @@
 #include <Graphic3d_GroupDefinitionError.hxx>
 #include <Graphic3d_ShaderProgram.hxx>
 #include <Graphic3d_Structure.hxx>
-#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_StructureManager.hxx>
 #include <Graphic3d_Text.hxx>
 #include <Graphic3d_TextureMap.hxx>
index f5870fec8cba9dff0ef17793856a1bb666ec777c..b6e2d6279c232831677ea94afe99bfd08811a9e2 100644 (file)
@@ -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<double>::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<Graphic3d_CStructure* >(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();
index bd5c3dca8ad30d35cc552f0285de8d2b7782f49d..7a480075b7b5fa8c24807d6718cf499007fc9d9d 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <Graphic3d_BvhCStructureSet.hxx>
 #include <Graphic3d_BvhCStructureSetTrsfPers.hxx>
+#include <Graphic3d_DisplayPriority.hxx>
 #include <Graphic3d_Camera.hxx>
 #include <Graphic3d_ZLayerId.hxx>
 #include <Graphic3d_ZLayerSettings.hxx>
 #include <NCollection_IndexedMap.hxx>
 #include <NCollection_Sequence.hxx>
 
+#include <array>
+
 //! Defines index map of structures.
 typedef NCollection_IndexedMap<const Graphic3d_CStructure*> Graphic3d_IndexedMapOfStructure;
 
 //! Defines array of indexed maps of structures.
-typedef NCollection_Array1<Graphic3d_IndexedMapOfStructure> Graphic3d_ArrayOfIndexedMapOfStructure;
+typedef std::array<Graphic3d_IndexedMapOfStructure, Graphic3d_DisplayPriority_NB> 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();
index 062b264097b2ac31e9d6b9eb9b8d674775ce3c6a..92b56ada60ec4ae16b48e08ba692e8d071212449 100644 (file)
@@ -27,8 +27,6 @@
 #include <Graphic3d_StructureManager.hxx>
 #include <Quantity_Color.hxx>
 
-#include "Graphic3d_Structure.pxx"
-
 #include <Standard_Dump.hxx>
 
 #include <stdio.h>
@@ -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;
index 8b9e438173f18103d9b74f70e95c5582b7ee34c0..905628df504231ee671d9282cdc179905fb31c08 100644 (file)
@@ -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 <me> is displayed then the SetDisplayPriority
-  //! method erase <me> and display <me> with the
-  //! new priority.
-  //! Raises PriorityDefinitionError if <Priority> 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 <me> is displayed then the SetDisplayPriority
-  //! method erase <me> and display <me> 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 <AStructure>.
diff --git a/src/Graphic3d/Graphic3d_Structure.pxx b/src/Graphic3d/Graphic3d_Structure.pxx
deleted file mode 100644 (file)
index c841755..0000000
+++ /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
index e979b644f350c620dc42843460d16905ddbd2ffa..de8637203c33b823d17a701b1023333c33d7312e 100644 (file)
@@ -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())
   {
index 19c376fa229845073562bef3fa23a8f4a43c4f88..906abfef5bfc5f6b77f7d5b6a0565fa358545450 100644 (file)
@@ -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 <AStructure>.
-  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.
index 9d1df7055ab53750b950647f6423b2d17d313eb8..3f5524601517d3645025437ca024a5241e78fecc 100644 (file)
@@ -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();
   }
 
index 448f53642b129bcdea45f10277885fd11ff7e93e..4ed778fd2f70f0fc1d33eb31301267f0df96d39a 100644 (file)
@@ -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();
 }
index efa7434541c140b548cec1314533ca2fa8ad48dd..4c30668c797dd83c3d7d00f0e14e77afa484fb03 100644 (file)
@@ -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<Standard_Real, 3> (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 <theOldLayerId>
   // 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)
index ad28b63526c3a272c2040840e18c6f64b4bd224b..a92304918d6429cb448c017220657ee7e41d24d0 100644 (file)
@@ -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<Handle(Graphic3d_Layer)> myLayers;
   NCollection_DataMap<Graphic3d_ZLayerId, Handle(Graphic3d_Layer)> 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
 
index ec410fc6f8d870a82e37f1448ec9ddc4319cf256..f352db0655b7bdf1e0597f8ec32445d942a43154 100644 (file)
@@ -39,7 +39,6 @@
 #include <OSD_Parallel.hxx>
 #include <Standard_CLocaleSentry.hxx>
 
-#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<const OpenGl_Structure*> (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<const OpenGl_Structure*> (theStructure.get());
index 32b1f8043bf3cef45c9bb7f45119fefe917c0089..78367fa9aa8cb7a76b1d6ea8929339e71403fcaf 100644 (file)
@@ -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:
 
index 91894ef2ff7bfbfe2b328f5154aa372d7630f66a..d36c0c5aba057ea418cc772202a4a23a0af0f9a0 100644 (file)
@@ -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)
index b0be613603bc43919bd283a8ddcf54dd4c69e93f..915e1b9fd7032ee945a4553d81cb94bd4a9cdae9 100644 (file)
@@ -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);
       }
     }
index 5160c520c65a148e0f2c448d741a07fb41e090a8..a33b505410d93377343b9158dc7e45833d9186f3 100644 (file)
@@ -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);
index 42c8028fba9c5f76db22e656366e3fbf740b4fd3..8559eaed3accaf8634c3eae9346ced936693fb2c 100644 (file)
@@ -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();
index 99691c455271621b7ec4fb712a432e091782beb0..c15eae14b724162d3aeb4bced5483f5670a60859 100644 (file)
@@ -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();
 }
index 3a26015bd4b17b29fcb45ac0aeafab5ee1f348ba..c40df8d19761134e21dc2273a2c70c0ed6e68353 100755 (executable)
@@ -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();
 }
index cfa41e3dacda91ff549db4ea636785c149a38c3a..2eaa5b7ae275487e31f991e621ebc8d456144602 100644 (file)
@@ -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();
 }
index 61159f0921b2056614ba56078bd299748a7a62d8..6b3eac15405860a7e271f437225b69db858f7f1b 100644 (file)
@@ -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);
index b4281b6f63686e94172f0506f839978e52de6146..14aa3e64f8fb844e326349aeb622fc3c821d6ed2 100644 (file)
@@ -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;
index 2f182da0bb1591fba2a3899e3b99d94cae98a9c3..5d01a9079f2b0fbb1b3cf7b842adf6c28e5dae9d 100644 (file)
@@ -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
   }
 }