1
0
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:
kgv
2012-03-06 15:03:34 +04:00
committed by bugmaster
parent f8b2ed3650
commit 59f45b7cef
43 changed files with 1596 additions and 40 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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.

View File

@@ -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;
}

View File

@@ -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.

View File

@@ -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 ();
}

View File

@@ -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

View File

@@ -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;
}