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.
const Standard_Integer )
{
thePrs->SetInfiniteState (myInfiniteState);
- thePrs->SetDisplayPriority (5);
if (!myIsXYZAxis)
{
GeomAdaptor_Curve curv (myComponent);
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer )
{
- thePrs->SetDisplayPriority (5);
-
if (myCircleIsArc) { ComputeArc (thePrs); }
else { ComputeCircle (thePrs); }
}
//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);
: 0);
return myMainPM->DisplayPriority (theIObj, aDispMode);
}
- return 0;
+ return Graphic3d_DisplayPriority_INVALID;
}
//=======================================================================
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Integer thePriority)
+ const Graphic3d_DisplayPriority thePriority)
{
if (theIObj.IsNull())
{
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;
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer )
{
- thePrs->SetDisplayPriority (5);
-
if (!myLineIsSegment) { ComputeInfiniteLine (thePrs); }
else { ComputeSegmentLine (thePrs); }
}
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);
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())
case TopAbs_EDGE:
case TopAbs_WIRE:
{
- thePrs->SetDisplayPriority (4);
+ thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Below);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
return;
}
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())
Graphic3d_DataStructureManager.cxx
Graphic3d_DataStructureManager.hxx
Graphic3d_DiagnosticInfo.hxx
+Graphic3d_DisplayPriority.hxx
Graphic3d_FrameStats.cxx
Graphic3d_FrameStats.hxx
Graphic3d_FrameStatsCounter.hxx
Graphic3d_StereoMode.hxx
Graphic3d_Structure.cxx
Graphic3d_Structure.hxx
-Graphic3d_Structure.pxx
Graphic3d_StructureDefinitionError.hxx
Graphic3d_StructureManager.cxx
Graphic3d_StructureManager.hxx
#include <Graphic3d_CStructure.hxx>
-#include "Graphic3d_Structure.pxx"
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_GraphicDriver.hxx>
//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),
IsMutable (Standard_False),
Is2dText (Standard_False)
{
- Id = myGraphicDriver->NewIdentification();
+ myId = myGraphicDriver->NewIdentification();
}
//=======================================================================
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)
#define _Graphic3d_CStructure_HeaderFile
#include <Graphic3d_BndBox3d.hxx>
+#include <Graphic3d_DisplayPriority.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_PresentationAttributes.hxx>
#include <Graphic3d_SequenceOfGroup.hxx>
//! 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.
//! 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
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
- Standard_Integer Id;
- Standard_Integer Priority;
- Standard_Integer PreviousPriority;
-
protected:
//! Create empty structure.
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
// 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))
//! 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,
//! 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;
//! 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:
--- /dev/null
+// 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
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);
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);
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);
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);
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);
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;
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;
#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>
// 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),
// 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();
// 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)
{
}
}
--myNbStructures;
- thePriority = aPriorityIter;
+ thePriority = (Graphic3d_DisplayPriority )aPriorityIter;
return true;
}
- thePriority = -1;
+ thePriority = Graphic3d_DisplayPriority_INVALID;
return false;
}
// 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();
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();
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();
// =======================================================================
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);
}
}
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());
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();
#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;
//! Initializes associated priority list and layer properties
Standard_EXPORT Graphic3d_Layer (Graphic3d_ZLayerId theId,
- Standard_Integer theNbPriorities,
const Handle(Select3D_BVHBuilder3d)& theBuilder);
//! Destructor.
//! 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.
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
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.
//! 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();
#include <Graphic3d_StructureManager.hxx>
#include <Quantity_Color.hxx>
-#include "Graphic3d_Structure.pxx"
-
#include <Standard_Dump.hxx>
#include <stdio.h>
}
// 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();
//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());
}
}
}
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());
}
}
return;
}
- SetDisplayPriority (Structure_MAX_PRIORITY - 1);
-
+ SetDisplayPriority (Graphic3d_DisplayPriority_Highlight);
myCStructure->GraphicHighlight (theStyle);
-
if (!theToUpdateMgr)
{
return;
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(); }
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
}
//! 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>.
+++ /dev/null
-// 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
// 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())
{
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.
if ( IsNeedToRedisplay )
{
- aSelectionPrs->SetDisplayPriority(9);
+ aSelectionPrs->SetDisplayPriority (Graphic3d_DisplayPriority_Highlight);
aSelectionPrs->Display();
}
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;
}
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();
}
//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)
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;
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;
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,
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,
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
//=======================================================================
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;
// 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();
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)
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; }
//! 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
//! 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); }
//! 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
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
#include <OSD_Parallel.hxx>
#include <Standard_CLocaleSentry.hxx>
-#include "../Graphic3d/Graphic3d_Structure.pxx"
#include "../Textures/Textures_EnvLUT.pxx"
namespace
myCaps (theCaps),
myWasRedrawnGL (Standard_False),
myToShowGradTrihedron (false),
- myZLayers (Structure_MAX_PRIORITY - Structure_MIN_PRIORITY + 1),
myStateCounter (theCounter),
myCurrLightSourceState (theCounter->Increment()),
myLightsRevision (0),
//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();
//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());
//! 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;
//! 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:
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();
}
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)
// =======================================================================
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())
{
// 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;
}
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
return !aPrs.IsNull()
? aPrs->DisplayPriority()
- : 0;
+ : Graphic3d_DisplayPriority_INVALID;
}
// =======================================================================
}
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())
if (aView->IsComputed (aParentId, aViewDepParentPrs))
{
updatePrsTransformation (myViewDependentImmediateList,
- aViewDepParentPrs->CStructure()->Id,
+ aViewDepParentPrs->CStructure()->Identification(),
aTrsf);
}
}
//! 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);
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();
}
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();
void V3d_CircularGrid::Display ()
{
- myStructure->SetDisplayPriority (1);
+ myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
myStructure->Display();
UpdateDisplay();
}
aPrims->AddVertex ( aSize,-aSize, anOffset);
aGroup->AddPrimitiveArray(aPrims);
- myGraphicStructure->SetDisplayPriority (0);
+ myGraphicStructure->SetDisplayPriority (Graphic3d_DisplayPriority_Bottom);
myGraphicStructure->Display();
Update();
}
void V3d_RectangularGrid::Display ()
{
- myStructure->SetDisplayPriority (1);
+ myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
myStructure->Display();
UpdateDisplay();
}
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);
}
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;
}
}
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;
if (XCAFPrs::GetViewNameMode())
{
// Displaying Name attributes
- thePrs->SetDisplayPriority (10);
+ thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost);
DisplayText (myLabel, thePrs, Attributes()->DimensionAspect()->TextAspect(), TopLoc_Location());//no location
}
}