mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0022795: Make possible to display some presentable objects in overlay of others, groupped by display priority
This commit is contained in:
@@ -234,8 +234,22 @@ is
|
||||
|
||||
UpdateLocation(me:mutable;P : mutable Presentation from Prs3d) is virtual;
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
thePrsMgr : PresentationManager from PrsMgr;
|
||||
theLayerId : Integer from Standard )
|
||||
is virtual;
|
||||
---Purpose: Set Z layer ID and update all presentations of
|
||||
-- the presentable object. The layer can be set only for displayed object.
|
||||
-- If all object presentations are removed, the layer ID will be set to
|
||||
-- default value when computing presentation. The layers mechanism allows
|
||||
-- drawing objects in higher layers in overlay of objects in lower layers.
|
||||
|
||||
|
||||
GetZLayer ( me;
|
||||
thePrsMgr : PresentationManager from PrsMgr )
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Get ID of Z layer. If no presentations of object is displayed,
|
||||
-- and layer ID is unavailable, the -1 value is returned.
|
||||
|
||||
fields
|
||||
myPresentations: Presentations from PrsMgr is protected;
|
||||
myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
|
||||
|
@@ -335,3 +335,28 @@ gp_Pnt PrsMgr_PresentableObject::GetTransformPersistencePoint() const
|
||||
{
|
||||
return gp_Pnt( myTransformPersistence.Point.x, myTransformPersistence.Point.y, myTransformPersistence.Point.z );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::SetZLayer
|
||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Standard_Integer theLayerId)
|
||||
{
|
||||
if (!thePrsMgr.IsNull())
|
||||
thePrsMgr->SetZLayer (this, theLayerId);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer PrsMgr_PresentableObject::GetZLayer
|
||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr) const
|
||||
{
|
||||
if (!thePrsMgr.IsNull())
|
||||
return thePrsMgr->GetZLayer (this);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@@ -48,6 +48,15 @@ is
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is deferred private;
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
theLayerId : Integer from Standard )
|
||||
is deferred private;
|
||||
---Purpose: Set Z layer ID for the presentation
|
||||
|
||||
GetZLayer ( me )
|
||||
returns Integer from Standard is deferred private;
|
||||
---Purpose: Get Z layer ID for the presentation
|
||||
|
||||
Clear(me: mutable)
|
||||
is deferred private;
|
||||
|
||||
|
@@ -51,6 +51,14 @@ is
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is redefined static private;
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
theLayerId : Integer from Standard )
|
||||
is redefined static private;
|
||||
---Purpose: Set Z layer ID for the presentation
|
||||
|
||||
GetZLayer ( me )
|
||||
returns Integer from Standard is redefined static private;
|
||||
---Purpose: Get Z layer ID for the presentation
|
||||
|
||||
Clear(me:mutable)
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
|
@@ -78,3 +78,22 @@ Standard_Integer PrsMgr_Presentation2d::Offset () const {
|
||||
|
||||
void PrsMgr_Presentation2d::Destroy () {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_Presentation2d::SetZLayer (Standard_Integer theLayer)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer PrsMgr_Presentation2d::GetZLayer () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -58,6 +58,15 @@ is
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is redefined static private;
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
theLayerId : Integer from Standard )
|
||||
is redefined static private;
|
||||
---Purpose: Set Z layer ID for the presentation
|
||||
|
||||
GetZLayer ( me )
|
||||
returns Integer from Standard is redefined static private;
|
||||
---Purpose: Get Z layer ID for the presentation
|
||||
|
||||
Clear(me:mutable)
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
-- Does not remove the other connected presentations.
|
||||
|
@@ -308,3 +308,23 @@ void PrsMgr_Presentation3d::Destroy () {
|
||||
myStructure->Clear();
|
||||
myStructure.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_Presentation3d::SetZLayer (Standard_Integer theLayerId)
|
||||
{
|
||||
myStructure->SetZLayer (theLayerId);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer PrsMgr_Presentation3d::GetZLayer () const
|
||||
{
|
||||
return myStructure->GetZLayer ();
|
||||
}
|
||||
|
@@ -79,6 +79,19 @@ is
|
||||
-- aPresentableObject in this framework with the
|
||||
-- display mode aMode.
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
thePresentableObject : PresentableObject from PrsMgr;
|
||||
theLayerId : Integer from Standard )
|
||||
is static;
|
||||
---Purpose: Set Z layer ID for all presentations of the object.
|
||||
|
||||
GetZLayer ( me;
|
||||
thePresentableObject : PresentableObject from PrsMgr )
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Get Z layer ID assigned to all presentations of the object.
|
||||
-- Method returns -1 value if object has no presentations and is
|
||||
-- impossible to get layer index.
|
||||
|
||||
IsDisplayed(me;aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Returns true if the presentation of the presentable
|
||||
|
@@ -204,6 +204,12 @@ void PrsMgr_PresentationManager::AddPresentation
|
||||
Handle(PrsMgr_Presentation) P = newPresentation(aPresentableObject);
|
||||
aPresentableObject->Presentations().Append(PrsMgr_ModedPresentation(P,aMode));
|
||||
aPresentableObject->Fill(this,P,aMode);
|
||||
|
||||
// set layer index accordingly to object's presentations
|
||||
Standard_Integer aZLayerId = GetZLayer (aPresentableObject);
|
||||
if (aZLayerId >= 0)
|
||||
P->SetZLayer (aZLayerId);
|
||||
|
||||
P->SetUpdateStatus(Standard_False);
|
||||
}
|
||||
|
||||
@@ -222,3 +228,39 @@ void PrsMgr_PresentationManager::RemovePresentation(const Handle(PrsMgr_Presenta
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager::SetZLayer
|
||||
(const Handle(PrsMgr_PresentableObject)& thePresentableObject,
|
||||
const Standard_Integer theLayerId)
|
||||
{
|
||||
PrsMgr_Presentations& aPresentations = thePresentableObject->Presentations();
|
||||
for (Standard_Integer aIdx = 1; aIdx <= aPresentations.Length (); aIdx++)
|
||||
{
|
||||
Handle(PrsMgr_Presentation) aPrs = aPresentations (aIdx).Presentation ();
|
||||
if (aPrs->PresentationManager () == this)
|
||||
aPrs->SetZLayer (theLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer PrsMgr_PresentationManager::GetZLayer
|
||||
(const Handle(PrsMgr_PresentableObject)& thePresentableObject) const
|
||||
{
|
||||
PrsMgr_Presentations& aPresentations = thePresentableObject->Presentations();
|
||||
for (Standard_Integer aIdx = 1; aIdx <= aPresentations.Length (); aIdx++)
|
||||
{
|
||||
Handle(PrsMgr_Presentation) aPrs = aPresentations (aIdx).Presentation ();
|
||||
if (aPrs->PresentationManager () == this)
|
||||
return aPrs->GetZLayer ();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user