mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0024394: Visualization - implement more general way for rendering of immediate objects
Move OpenGl_Structure::myZLayer to base class Graphic3d_CStructure. Graphic3d_ZLayerId - introduce new pre-defined ZLayers. Do not clear Depth buffer twice for default ZLayer. AIS_InteractiveContext::Display() - add new argument AIS_DisplayStatus to specify displaying status. Drop unused Graphic3d_CPick and related methods. Drop OpenGl_Structure::myNamedStatus - use flags from parent class Graphic3d_CStructure directly. OpenGl_LayerList ::ChangeLayer(), ::ChangePriority - fix structure remove from unexpected layer. Merge class OpenGl_PriorityList into OpenGl_Layer. PrsMgr_PresentationManager::mySelectionColor - store selection color as field of Presentation Manager. PrsMgr_Presentation class - do not declare private methods as virtual. PrsMgr_Presentation::Highlight() - extend method syntax and drop methods ::Color() and ::BoundBox(). PrsMgr_PresentableObject - store ZLayer in presentable object to display object presentations in required layer directly (without displaying it in wrong layer first). test/mesh/end - force re-displaying the shape to compute mesh anew Test-case for issue
This commit is contained in:
@@ -33,9 +33,12 @@ uses
|
||||
|
||||
MMgt,TCollection,
|
||||
TopLoc,
|
||||
Prs3d,Graphic3d,
|
||||
Aspect,
|
||||
Prs3d,
|
||||
Graphic3d,
|
||||
Quantity,Geom,
|
||||
V3d,
|
||||
Visual3d,
|
||||
V3d,
|
||||
TColStd,
|
||||
gp
|
||||
|
||||
|
@@ -63,12 +63,11 @@ uses
|
||||
Location from TopLoc,
|
||||
ClipPlane_Handle from Graphic3d,
|
||||
SequenceOfHClipPlane from Graphic3d,
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
TransModeFlags from Graphic3d,
|
||||
Pnt from gp,
|
||||
Trsf from gp,
|
||||
CTransPersStruct from Graphic3d
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
CTransPersStruct from Graphic3d,
|
||||
ZLayerId from Graphic3d
|
||||
|
||||
raises
|
||||
NotImplemented from Standard
|
||||
@@ -246,22 +245,16 @@ is
|
||||
UpdateTransformation(me:mutable) is virtual;
|
||||
|
||||
UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
|
||||
|
||||
|
||||
SetZLayer ( me : mutable;
|
||||
thePrsMgr : PresentationManager from PrsMgr;
|
||||
theLayerId : Integer from Standard )
|
||||
theLayerId : ZLayerId from Graphic3d )
|
||||
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.
|
||||
---Purpose: Set Z layer ID and update all presentations of the presentable object.
|
||||
-- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
|
||||
|
||||
ZLayer ( me )
|
||||
returns ZLayerId from Graphic3d is static;
|
||||
---Purpose: Get ID of Z layer.
|
||||
|
||||
AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
|
||||
---Purpose: Adds clip plane for graphical clipping for all display mode
|
||||
@@ -333,7 +326,7 @@ fields
|
||||
myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
|
||||
myTransformPersistence : CTransPersStruct from Graphic3d;
|
||||
myIsMutable : Boolean from Standard is protected;
|
||||
|
||||
myZLayer : ZLayerId from Graphic3d is protected;
|
||||
|
||||
myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
|
||||
: myTypeOfPresentation3d (theType),
|
||||
myIsMutable (Standard_False),
|
||||
myZLayer (Graphic3d_ZLayerId_Default),
|
||||
myHasOwnPresentations (Standard_True),
|
||||
myParent (NULL)
|
||||
{
|
||||
@@ -384,25 +385,34 @@ void PrsMgr_PresentableObject::RemoveChild (const Handle(PrsMgr_PresentableObjec
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::SetZLayer
|
||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Standard_Integer theLayerId)
|
||||
void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
|
||||
{
|
||||
if (!thePrsMgr.IsNull())
|
||||
thePrsMgr->SetZLayer (this, theLayerId);
|
||||
if (myZLayer == theLayerId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myZLayer = theLayerId;
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter);
|
||||
if (aModedPrs.Presentation().IsNull()
|
||||
|| aModedPrs.Presentation()->Presentation().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aModedPrs.Presentation()->Presentation()->SetZLayer (theLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetZLayer
|
||||
//function : ZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer PrsMgr_PresentableObject::GetZLayer
|
||||
(const Handle(PrsMgr_PresentationManager)& thePrsMgr) const
|
||||
Graphic3d_ZLayerId PrsMgr_PresentableObject::ZLayer() const
|
||||
{
|
||||
if (!thePrsMgr.IsNull())
|
||||
return thePrsMgr->GetZLayer (this);
|
||||
|
||||
return -1;
|
||||
return myZLayer;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -21,9 +21,11 @@ uses
|
||||
|
||||
PresentationManager from PrsMgr,
|
||||
NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
Transformation from Geom,
|
||||
Length from Quantity,
|
||||
ShadingAspect from Prs3d,
|
||||
TypeOfHighlightMethod from Aspect,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
DataStructureManager from Graphic3d,
|
||||
Structure from Graphic3d,
|
||||
@@ -45,57 +47,52 @@ is
|
||||
---C++: alias ~
|
||||
|
||||
Display (me : mutable)
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
Display (me : mutable;
|
||||
display (me : mutable;
|
||||
theIsHighlight : Boolean from Standard)
|
||||
is static private;
|
||||
---Purpose: Displays myStructure.
|
||||
|
||||
Erase (me : mutable)
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
SetVisible (me : mutable;
|
||||
theValue : Boolean from Standard)
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
Highlight (me : mutable) is virtual private;
|
||||
Highlight (me : mutable;
|
||||
theMethod : TypeOfHighlightMethod from Aspect;
|
||||
theColor : Color from Quantity) is private;
|
||||
|
||||
Unhighlight (me) is virtual private;
|
||||
Unhighlight (me) is private;
|
||||
|
||||
IsHighlighted (me) returns Boolean from Standard
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
IsDisplayed (me) returns Boolean from Standard
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
DisplayPriority(me) returns Integer from Standard
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is virtual private;
|
||||
is private;
|
||||
|
||||
SetZLayer (me : mutable;
|
||||
theLayerId : Integer from Standard)
|
||||
is virtual private;
|
||||
is private;
|
||||
---Purpose: Set Z layer ID for the presentation
|
||||
|
||||
GetZLayer (me) returns Integer from Standard
|
||||
is virtual private;
|
||||
is private;
|
||||
---Purpose: Get Z layer ID for the presentation
|
||||
|
||||
Clear (me : mutable)
|
||||
is virtual private;
|
||||
is private;
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
-- Does not remove the other connected presentations.
|
||||
|
||||
Color (me : mutable;
|
||||
theColor : NameOfColor from Quantity)
|
||||
is virtual private;
|
||||
|
||||
BoundBox (me)
|
||||
is static private;
|
||||
|
||||
---Category: references to other presentation.
|
||||
|
||||
Connect (me;
|
||||
|
@@ -30,7 +30,7 @@ namespace
|
||||
State_Visible
|
||||
};
|
||||
|
||||
static BeforeHighlightState StructureState(const Handle(PrsMgr_Prs) theStructure)
|
||||
static BeforeHighlightState StructureState(const Handle(PrsMgr_Prs)& theStructure)
|
||||
{
|
||||
return !theStructure->IsDisplayed() ?
|
||||
State_Empty : !theStructure->IsVisible() ?
|
||||
@@ -61,15 +61,15 @@ PrsMgr_Presentation::PrsMgr_Presentation (const Handle(PrsMgr_PresentationManage
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation::Display()
|
||||
{
|
||||
Display (Standard_False);
|
||||
display (Standard_False);
|
||||
myBeforeHighlightState = State_Visible;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Display
|
||||
//function : display
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation::Display (const Standard_Boolean theIsHighlight)
|
||||
void PrsMgr_Presentation::display (const Standard_Boolean theIsHighlight)
|
||||
{
|
||||
if (!myStructure->IsDisplayed())
|
||||
{
|
||||
@@ -116,15 +116,16 @@ void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue)
|
||||
//function : Highlight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation::Highlight()
|
||||
void PrsMgr_Presentation::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
|
||||
const Quantity_Color& theColor)
|
||||
{
|
||||
if (!IsHighlighted())
|
||||
{
|
||||
myBeforeHighlightState = StructureState (myStructure);
|
||||
}
|
||||
|
||||
Display (Standard_True);
|
||||
myStructure->Highlight();
|
||||
display (Standard_True);
|
||||
myStructure->Highlight (theMethod, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -169,30 +170,6 @@ void PrsMgr_Presentation::Clear()
|
||||
myStructure->RemoveAll();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Color
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation::Color (const Quantity_NameOfColor theColor)
|
||||
{
|
||||
if (!IsHighlighted())
|
||||
{
|
||||
myBeforeHighlightState = StructureState (myStructure);
|
||||
}
|
||||
|
||||
Display (Standard_True);
|
||||
myStructure->Color (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BoundBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation::BoundBox() const
|
||||
{
|
||||
myStructure->BoundBox();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDisplayed
|
||||
//purpose :
|
||||
|
@@ -28,10 +28,12 @@ uses
|
||||
PresentableObject from PrsMgr,
|
||||
ListOfPresentations from PrsMgr,
|
||||
Length,NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
Transformation from Geom,
|
||||
NameOfMaterial from Graphic3d,
|
||||
Presentation from PrsMgr,
|
||||
View from V3d,
|
||||
ViewManager from Visual3d,
|
||||
ShadingAspect from Prs3d,
|
||||
Presentation from Prs3d
|
||||
|
||||
@@ -41,7 +43,7 @@ raises
|
||||
|
||||
is
|
||||
|
||||
Create (theStructureManager : StructureManager from Graphic3d)
|
||||
Create (theStructureManager : ViewManager from Visual3d)
|
||||
returns PresentationManager from PrsMgr;
|
||||
---Purpose:
|
||||
-- Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
|
||||
@@ -232,30 +234,26 @@ is
|
||||
|
||||
Presentation (me;
|
||||
thePrsObject : PresentableObject from PrsMgr;
|
||||
theMode : Integer from Standard = 0)
|
||||
theMode : Integer from Standard = 0;
|
||||
theToCreate : Boolean from Standard = Standard_False)
|
||||
returns Presentation from PrsMgr
|
||||
raises NoSuchObject from Standard
|
||||
is static;
|
||||
---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework. thePrsObject has the display mode theMode.
|
||||
|
||||
AddPresentation (me : mutable;
|
||||
thePrsObject : PresentableObject from PrsMgr;
|
||||
theMode : Integer from Standard = 0)
|
||||
---Purpose: Adds a presentation of the presentable object thePrsObject to this framework.
|
||||
-- thePrsObject has the display mode theMode.
|
||||
is protected;
|
||||
---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework.
|
||||
-- When theToCreate is true - automatically creates presentation for specified mode when not exist.
|
||||
|
||||
RemovePresentation (me : mutable;
|
||||
thePrsObject : PresentableObject from PrsMgr;
|
||||
theMode : Integer from Standard = 0)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
|
||||
is protected;
|
||||
|
||||
fields
|
||||
|
||||
myStructureManager : StructureManager from Graphic3d is protected;
|
||||
myStructureManager : ViewManager from Visual3d is protected;
|
||||
myImmediateModeOn : Integer from Standard is protected;
|
||||
myImmediateList : ListOfPresentations from PrsMgr is protected;
|
||||
myImmediateView : View from V3d is protected;
|
||||
mySelectionColor : Color from Quantity is protected;
|
||||
|
||||
end PresentationManager from PrsMgr;
|
||||
|
@@ -29,9 +29,10 @@
|
||||
// function : PrsMgr_PresentationManager
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager)
|
||||
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Visual3d_ViewManager)& theStructureManager)
|
||||
: myStructureManager (theStructureManager),
|
||||
myImmediateModeOn (0)
|
||||
myImmediateModeOn (0),
|
||||
mySelectionColor (Quantity_NOC_GRAY99)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -45,15 +46,7 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)
|
||||
{
|
||||
if (thePrsObj->HasOwnPresentations())
|
||||
{
|
||||
if (!HasPresentation (thePrsObj, theMode))
|
||||
{
|
||||
AddPresentation (thePrsObj, theMode);
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
|
||||
if (aPrs.IsNull()) return;
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||
if (aPrs->MustBeUpdated())
|
||||
{
|
||||
Update (thePrsObj, theMode);
|
||||
@@ -91,10 +84,21 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)&
|
||||
Erase (anIter.Value(), theMode);
|
||||
}
|
||||
|
||||
if (HasPresentation (thePrsObj, theMode))
|
||||
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
Presentation (thePrsObj, theMode)->Erase();
|
||||
RemovePresentation (thePrsObj, theMode);
|
||||
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||
const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager();
|
||||
if (theMode == aPrsList (aPrsIter).Mode()
|
||||
&& this == aPrsMgr)
|
||||
{
|
||||
if (!aModedPrs.Presentation().IsNull())
|
||||
{
|
||||
aModedPrs.Presentation()->Erase();
|
||||
}
|
||||
aPrsList.Remove (aPrsIter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,9 +114,10 @@ void PrsMgr_PresentationManager::Clear (const Handle(PrsMgr_PresentableObject)&
|
||||
Clear (anIter.Value(), theMode);
|
||||
}
|
||||
|
||||
if (HasPresentation (thePrsObj, theMode))
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
Presentation (thePrsObj, theMode)->Clear();
|
||||
aPrs->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,14 +157,7 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HasPresentation (thePrsObj, theMode))
|
||||
{
|
||||
AddPresentation (thePrsObj, theMode);
|
||||
}
|
||||
|
||||
if (!HasPresentation (thePrsObj, theMode)) return;
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||
if (aPrs->MustBeUpdated())
|
||||
{
|
||||
Update (thePrsObj, theMode);
|
||||
@@ -168,12 +166,12 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
|
||||
if (myImmediateModeOn > 0)
|
||||
{
|
||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
||||
aShadow->Highlight();
|
||||
aShadow->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
||||
AddToImmediateList (aShadow);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPrs->Highlight();
|
||||
aPrs->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,9 +187,10 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj
|
||||
Unhighlight (anIter.Value(), theMode);
|
||||
}
|
||||
|
||||
if (HasPresentation (thePrsObj, theMode))
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
Presentation (thePrsObj, theMode)->Unhighlight();
|
||||
aPrs->Unhighlight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,9 +207,10 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
|
||||
SetDisplayPriority (anIter.Value(), theMode, theNewPrior);
|
||||
}
|
||||
|
||||
if (HasPresentation (thePrsObj, theMode))
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
Presentation (thePrsObj, theMode)->SetDisplayPriority (theNewPrior);
|
||||
aPrs->SetDisplayPriority (theNewPrior);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,9 +230,10 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg
|
||||
}
|
||||
}
|
||||
|
||||
return HasPresentation (thePrsObj, theMode)
|
||||
? Presentation (thePrsObj, theMode)->DisplayPriority()
|
||||
: 0;
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
return !aPrs.IsNull()
|
||||
? aPrs->DisplayPriority()
|
||||
: 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -250,8 +251,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_Pr
|
||||
}
|
||||
}
|
||||
|
||||
return HasPresentation (thePrsObj, theMode)
|
||||
&& Presentation (thePrsObj, theMode)->IsDisplayed();
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
return !aPrs.IsNull()
|
||||
&& aPrs->IsDisplayed();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -269,8 +271,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_
|
||||
}
|
||||
}
|
||||
|
||||
return HasPresentation (thePrsObj, theMode)
|
||||
&& Presentation (thePrsObj, theMode)->IsHighlighted();
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
return !aPrs.IsNull()
|
||||
&& aPrs->IsHighlighted();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -284,10 +287,6 @@ void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)&
|
||||
{
|
||||
Update (anIter.Value(), theMode);
|
||||
}
|
||||
if (!HasPresentation(thePrsObj, theMode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
if (!aPrs.IsNull())
|
||||
@@ -405,14 +404,10 @@ Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMg
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Standard_Integer theMode) const
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Boolean theToCreate) const
|
||||
{
|
||||
const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||
if (aPrsList.IsEmpty())
|
||||
{
|
||||
return Handle(PrsMgr_Presentation)();
|
||||
}
|
||||
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||
@@ -424,46 +419,41 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand
|
||||
}
|
||||
}
|
||||
|
||||
return Handle(PrsMgr_Presentation)();
|
||||
}
|
||||
if (!theToCreate)
|
||||
{
|
||||
return Handle(PrsMgr_Presentation)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddPresentation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj);
|
||||
aPrs->SetZLayer (thePrsObj->ZLayer());
|
||||
thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode));
|
||||
thePrsObj->Fill (this, aPrs, theMode);
|
||||
|
||||
// set layer index accordingly to object's presentations
|
||||
const Standard_Integer aZLayerId = GetZLayer (thePrsObj);
|
||||
if (aZLayerId >= 0)
|
||||
{
|
||||
aPrs->SetZLayer (aZLayerId);
|
||||
}
|
||||
aPrs->SetUpdateStatus (Standard_False);
|
||||
return aPrs;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RemovePresentation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Standard_Integer theMode)
|
||||
Standard_Boolean PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
if (theMode == aPrsList (aPrsIter).Mode())
|
||||
// && this == aPrsMgr) ??
|
||||
const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
|
||||
const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager();
|
||||
if (theMode == aPrsList (aPrsIter).Mode()
|
||||
&& this == aPrsMgr)
|
||||
{
|
||||
aPrsList.Remove (aPrsIter);
|
||||
break;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -481,15 +471,8 @@ void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObjec
|
||||
{
|
||||
return;
|
||||
}
|
||||
PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
Handle(PrsMgr_Presentation) aPrs = aPrsList.ChangeValue (aPrsIter).Presentation();
|
||||
if (aPrs->PresentationManager() == this)
|
||||
{
|
||||
aPrs->SetZLayer (theLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
thePrsObj->SetZLayer (theLayerId);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -498,28 +481,7 @@ void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObjec
|
||||
// =======================================================================
|
||||
Standard_Integer PrsMgr_PresentationManager::GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj) const
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Standard_Integer aLayer = GetZLayer (anIter.Value());
|
||||
if (aLayer != -1)
|
||||
{
|
||||
return aLayer;
|
||||
}
|
||||
}
|
||||
if (!thePrsObj->HasOwnPresentations())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
Handle(PrsMgr_Presentation) aPrs = aPrsList.Value (aPrsIter).Presentation();
|
||||
if (aPrs->PresentationManager() == this)
|
||||
{
|
||||
return aPrs->GetZLayer();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return thePrsObj->ZLayer();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -531,15 +493,9 @@ void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject)
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theOtherMode)
|
||||
{
|
||||
if (!HasPresentation (thePrsObject, theMode))
|
||||
{
|
||||
AddPresentation (thePrsObject, theMode);
|
||||
}
|
||||
if (!HasPresentation (theOtherObject, theOtherMode))
|
||||
{
|
||||
AddPresentation (theOtherObject, theOtherMode);
|
||||
}
|
||||
Presentation (thePrsObject, theMode)->Connect (Presentation (theOtherObject, theOtherMode));
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObject, theMode, Standard_True);
|
||||
Handle(PrsMgr_Presentation) aPrsOther = Presentation (theOtherObject, theOtherMode, Standard_True);
|
||||
aPrs->Connect (aPrsOther);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -571,14 +527,7 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HasPresentation (thePrsObj, theMode))
|
||||
{
|
||||
AddPresentation (thePrsObj, theMode);
|
||||
}
|
||||
|
||||
if (!HasPresentation (thePrsObj, theMode)) return;
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||
if (aPrs->MustBeUpdated())
|
||||
{
|
||||
Update (thePrsObj, theMode);
|
||||
@@ -587,12 +536,12 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
||||
if (myImmediateModeOn > 0)
|
||||
{
|
||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
||||
aShadow->Color (theColor);
|
||||
aShadow->Highlight (Aspect_TOHM_COLOR, theColor);
|
||||
AddToImmediateList (aShadow);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPrs->Color (theColor);
|
||||
aPrs->Highlight (Aspect_TOHM_COLOR, theColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,18 +549,15 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
||||
// function : BoundBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
||||
void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!HasPresentation (thePrsObject, theMode))
|
||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
||||
if (aPrs->MustBeUpdated())
|
||||
{
|
||||
AddPresentation (thePrsObject, theMode);
|
||||
Update (thePrsObj, theMode);
|
||||
}
|
||||
else if (Presentation (thePrsObject, theMode)->MustBeUpdated())
|
||||
{
|
||||
Update (thePrsObject, theMode);
|
||||
}
|
||||
Presentation (thePrsObject, theMode)->BoundBox();
|
||||
aPrs->Highlight (Aspect_TOHM_BOUNDBOX, mySelectionColor);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -633,12 +579,13 @@ void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_Presentab
|
||||
// function : SetShadingAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
||||
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||
const Handle(Prs3d_ShadingAspect)& theShadingAspect,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (HasPresentation (thePrsObject, theMode))
|
||||
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
Presentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect);
|
||||
aPrs->SetShadingAspect (theShadingAspect);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user