From af324faa806a17df6929e29b32e1d6f9df7a3ef6 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 3 Apr 2014 15:33:26 +0400 Subject: [PATCH] 0023710: Simplification of presentation managment classes Merge PrsMgr_Presentation3d into PrsMgr_Presentation Cosmetics --- src/AIS/AIS_ConnectedInteractive.cxx | 15 +- src/AIS/AIS_InteractiveObject.cxx | 124 +++--- src/AIS/AIS_LocalContext.cxx | 2 +- src/AIS/AIS_MultipleConnectedInteractive.cxx | 11 +- src/AIS/AIS_Shape.cxx | 21 +- src/PrsMgr/PrsMgr.cdl | 9 +- src/PrsMgr/PrsMgr_ModedPresentation.cdl | 33 +- src/PrsMgr/PrsMgr_ModedPresentation.cxx | 18 +- src/PrsMgr/PrsMgr_PresentableObject.cdl | 18 +- src/PrsMgr/PrsMgr_PresentableObject.cxx | 138 +++---- src/PrsMgr/PrsMgr_Presentation.cdl | 234 +++++++---- src/PrsMgr/PrsMgr_Presentation.cxx | 385 +++++++++++++++++- src/PrsMgr/PrsMgr_Presentation.lxx | 21 +- src/PrsMgr/PrsMgr_Presentation3d.cdl | 173 -------- src/PrsMgr/PrsMgr_Presentation3d.cxx | 401 ------------------- src/PrsMgr/PrsMgr_PresentationManager.cdl | 7 - src/PrsMgr/PrsMgr_PresentationManager.cxx | 32 +- src/PrsMgr/PrsMgr_Prs.cdl | 10 +- src/PrsMgr/PrsMgr_Prs.cxx | 14 +- src/TPrsStd/TPrsStd_NamedShapeDriver.cxx | 3 +- 20 files changed, 758 insertions(+), 911 deletions(-) delete mode 100644 src/PrsMgr/PrsMgr_Presentation3d.cdl delete mode 100644 src/PrsMgr/PrsMgr_Presentation3d.cxx diff --git a/src/AIS/AIS_ConnectedInteractive.cxx b/src/AIS/AIS_ConnectedInteractive.cxx index 19b40aabd8..d268a06413 100644 --- a/src/AIS/AIS_ConnectedInteractive.cxx +++ b/src/AIS/AIS_ConnectedInteractive.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -84,18 +84,19 @@ Connect(const Handle(AIS_InteractiveObject)& anotherIobj, //======================================================================= //function : Disconnect -//purpose : +//purpose : //======================================================================= void AIS_ConnectedInteractive::Disconnect() { - for(Standard_Integer i =1;i<=myPresentations.Length();i++) + for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + { + const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation(); + if (!aPrs.IsNull()) { - Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation()); - if(!P.IsNull()) { - P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT); - } + aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT); } + } } //======================================================================= //function : Compute diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index c834f453a5..3ab0ccae1e 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -23,16 +23,9 @@ // instead a restricted object NameOfColor. // Add SetCurrentFacingModel() method -#define IMP020200 //GG Add SetTransformation() method - -#define IMP140200 //GG Add HasPresentation() and Presentation() methods -// Add SetAspect() method. - #define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode() // method, compute only authorized presentation. -#define IMP220501 //GG CADPAK_V2 Update selection properly - #define OCC708 //SAV unsetting transformation correctly #include @@ -550,33 +543,31 @@ void AIS_InteractiveObject::SetInfiniteState(const Standard_Boolean aFlag) P->SetInfiniteState(myInfiniteState);} } -#ifdef IMP020200 //======================================================================= //function : SetTransformation -//purpose : +//purpose : //======================================================================= -void AIS_InteractiveObject::SetTransformation(const Handle(Geom_Transformation)& aTrsf, const Standard_Boolean postConcatenate, const Standard_Boolean updateSelection) { - - if(!GetContext().IsNull()){ - const PrsMgr_Presentations& prs = Presentations(); - Handle(Prs3d_Presentation) P; - Standard_Integer mode; - myHasTransformation = Standard_True; - for( Standard_Integer i=1 ; i<=prs.Length() ; i++ ) { - mode = prs(i).Mode(); - P = GetContext()->MainPrsMgr()->CastPresentation(this,mode)->Presentation(); - if( postConcatenate ) P->Multiply(aTrsf); - else P->Transform(aTrsf); - if( updateSelection ) { -#ifdef IMP220501 - myCTXPtr->ClearSelected(Standard_True); - myCTXPtr->RecomputeSelectionOnly(this); -#else - if( HasSelection(mode) ) { - UpdateSelection(mode); - } -#endif - } +void AIS_InteractiveObject::SetTransformation (const Handle(Geom_Transformation)& theTrsf, + const Standard_Boolean theToPostConcatenate, + const Standard_Boolean theToUpdateSelection) +{ + if (GetContext().IsNull()) + { + return; + } + + const PrsMgr_Presentations& aPrsList = Presentations(); + myHasTransformation = Standard_True; + for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) + { + const Standard_Integer aMode = aPrsList (aPrsIter).Mode(); + Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, aMode)->Presentation(); + theToPostConcatenate ? aPrs->Multiply (theTrsf) + : aPrs->Transform (theTrsf); + if (theToUpdateSelection) + { + myCTXPtr->ClearSelected (Standard_True); + myCTXPtr->RecomputeSelectionOnly (this); } } } @@ -598,21 +589,22 @@ Handle(Geom_Transformation) trsf; //======================================================================= //function : Transformation -//purpose : +//purpose : //======================================================================= -Handle(Geom_Transformation) AIS_InteractiveObject::Transformation() { -Handle(Geom_Transformation) trsf; - - if(!GetContext().IsNull() ) { - const PrsMgr_Presentations& prs = Presentations(); - if( prs.Length() > 0 ) { - Handle(Prs3d_Presentation) P = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); - trsf = P->Transformation(); - } +Handle(Geom_Transformation) AIS_InteractiveObject::Transformation() +{ + if (GetContext().IsNull()) + { + return Handle(Geom_Transformation)(); } - return trsf; + const PrsMgr_Presentations& aPrsList = Presentations(); + if (aPrsList.Length() > 0) + { + Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); + return aPrs->Transformation(); + } + return Handle(Geom_Transformation)(); } //======================================================================= @@ -623,36 +615,26 @@ Standard_Boolean AIS_InteractiveObject::HasTransformation() const { return myHasTransformation; } -#endif -#ifdef IMP140200 //======================================================================= //function : HasPresentation -//purpose : +//purpose : //======================================================================= -Standard_Boolean AIS_InteractiveObject::HasPresentation() const { - - if( !GetContext().IsNull() && - GetContext()->MainPrsMgr()->HasPresentation(this,myDisplayMode) ) { - return Standard_True; - } - - return Standard_False; +Standard_Boolean AIS_InteractiveObject::HasPresentation() const +{ + return !GetContext().IsNull() + && GetContext()->MainPrsMgr()->HasPresentation (this, myDisplayMode); } //======================================================================= //function : Presentation -//purpose : +//purpose : //======================================================================= -Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const { -Handle(Prs3d_Presentation) prs; - - if( HasPresentation() ) { - prs = GetContext()->MainPrsMgr()-> - CastPresentation(this,myDisplayMode)->Presentation(); - } - - return prs; +Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const +{ + return HasPresentation() + ? GetContext()->MainPrsMgr()->Presentation (this, myDisplayMode)->Presentation() + : Handle(Prs3d_Presentation)(); } //======================================================================= @@ -698,9 +680,6 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect, } } } -#endif - -// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets //======================================================================= //function : SetPolygonOffsets @@ -716,12 +695,11 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode, myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits ); // Modify existing presentations - Handle(Graphic3d_Structure) aStruct; - for( Standard_Integer i = 1, n = myPresentations.Length(); i <= n; i++ ) { - Handle(PrsMgr_Presentation3d) aPrs3d = - Handle(PrsMgr_Presentation3d)::DownCast( myPresentations(i).Presentation() ); + for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter) + { + const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation(); if ( !aPrs3d.IsNull() ) { - aStruct = Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() ); + const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation(); if( !aStruct.IsNull() ) { aStruct->SetPrimitivesAspect( myDrawer->ShadingAspect()->Aspect() ); // Workaround for issue 23115: Need to update also groups, because their @@ -750,7 +728,6 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode, } } - //======================================================================= //function : HasPolygonOffsets //purpose : @@ -773,4 +750,3 @@ void AIS_InteractiveObject::PolygonOffsets(Standard_Integer& aMode, if( HasPolygonOffsets() ) myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits ); } -// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets diff --git a/src/AIS/AIS_LocalContext.cxx b/src/AIS/AIS_LocalContext.cxx index 78c0186ae4..ae6f8684ea 100644 --- a/src/AIS/AIS_LocalContext.cxx +++ b/src/AIS/AIS_LocalContext.cxx @@ -1195,7 +1195,7 @@ Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObj return Standard_False; } - myMainPM->AddToImmediateList (myMainPM->CastPresentation (theObj, theMode)->Presentation()); + myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation()); return Standard_True; } diff --git a/src/AIS/AIS_MultipleConnectedInteractive.cxx b/src/AIS/AIS_MultipleConnectedInteractive.cxx index d90394ef46..0b195ffc46 100644 --- a/src/AIS/AIS_MultipleConnectedInteractive.cxx +++ b/src/AIS/AIS_MultipleConnectedInteractive.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq, const Handle(AIS_InteractiveObject)& theItem) @@ -113,11 +113,12 @@ void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveOb void AIS_MultipleConnectedInteractive::DisconnectAll () { -/* for(Standard_Integer i =1;i<=myPresentations.Length();i++) +/* for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) { - Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation()); - if(!P.IsNull()) { - P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT); + const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation(); + if (!aPrs.IsNull()) + { + aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT); } }*/ myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!! diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index d1e016debc..a569bfe116 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -523,8 +523,7 @@ void AIS_Shape::SetColor(const Quantity_Color &aCol) // fast shading modification... if(!GetContext().IsNull()){ if( GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aCurGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect(); Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect(); @@ -602,8 +601,7 @@ void AIS_Shape::UnsetColor() if(!GetContext().IsNull()){ if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect(); @@ -717,9 +715,9 @@ void AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat) myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel); if(!GetContext().IsNull()){ - if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + if(GetContext()->MainPrsMgr()->HasPresentation(this,1)) + { + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect(); @@ -761,8 +759,7 @@ void AIS_Shape::UnsetMaterial() hasOwnMaterial = Standard_False; if(!GetContext().IsNull()){ if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect(); aPresentation->SetPrimitivesAspect(anAreaAsp); @@ -792,8 +789,7 @@ void AIS_Shape::SetTransparency(const Standard_Real AValue) if(!GetContext().IsNull()){ if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect(); aPresentation->SetPrimitivesAspect(anAreaAsp); @@ -828,8 +824,7 @@ void AIS_Shape::UnsetTransparency() if(!GetContext().IsNull()){ if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){ - Handle(Prs3d_Presentation) aPresentation = - GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation(); + Handle(Prs3d_Presentation) aPresentation = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect(); aPresentation->SetPrimitivesAspect(anAreaAsp); diff --git a/src/PrsMgr/PrsMgr.cdl b/src/PrsMgr/PrsMgr.cdl index b42186f291..e6f817ec66 100644 --- a/src/PrsMgr/PrsMgr.cdl +++ b/src/PrsMgr/PrsMgr.cdl @@ -41,9 +41,6 @@ uses is - enumeration KindOfPrs is KOP_2D,KOP_3D - end KindOfPrs; - enumeration TypeOfPresentation3d is TOP_AllView, TOP_ProjectorDependant end TypeOfPresentation3d; ---Purpose: To declare the type of presentation as follows @@ -55,17 +52,17 @@ is class PresentationManager; alias PresentationManager3d is PresentationManager; - deferred class Presentation; + class Presentation; + alias Presentation3d is Presentation; deferred class PresentableObject; imported ListOfPresentations; class Prs; - class Presentation3d; class ModedPresentation; class Presentations instantiates Sequence from TCollection (ModedPresentation from PrsMgr); - pointer Presentation3dPointer to Presentation3d from PrsMgr; + pointer PresentationPointer to Presentation from PrsMgr; pointer PresentableObjectPointer to PresentableObject from PrsMgr; end PrsMgr; diff --git a/src/PrsMgr/PrsMgr_ModedPresentation.cdl b/src/PrsMgr/PrsMgr_ModedPresentation.cdl index 36395a48e6..4c6e7cc982 100644 --- a/src/PrsMgr/PrsMgr_ModedPresentation.cdl +++ b/src/PrsMgr/PrsMgr_ModedPresentation.cdl @@ -17,26 +17,27 @@ class ModedPresentation from PrsMgr uses - Presentation from PrsMgr + + Presentation from PrsMgr is - Create - returns ModedPresentation from PrsMgr; - - Create(aPresentation:Presentation from PrsMgr; - aMode: Integer from Standard) - returns ModedPresentation from PrsMgr; - - Presentation(me) returns Presentation from PrsMgr - is static; - - Mode(me) returns Integer from Standard; - - + + Create + returns ModedPresentation from PrsMgr; + + Create (thePrs : Presentation from PrsMgr; + theMode : Integer from Standard) + returns ModedPresentation from PrsMgr; + + Presentation (me) returns Presentation from PrsMgr + is static; + ---C++: return const& + + Mode (me) returns Integer from Standard; + fields myPresentation: Presentation from PrsMgr; myMode: Integer from Standard; - + end ModedPresentation from PrsMgr; - diff --git a/src/PrsMgr/PrsMgr_ModedPresentation.cxx b/src/PrsMgr/PrsMgr_ModedPresentation.cxx index d312591fc7..715eb61692 100644 --- a/src/PrsMgr/PrsMgr_ModedPresentation.cxx +++ b/src/PrsMgr/PrsMgr_ModedPresentation.cxx @@ -14,17 +14,23 @@ #include -PrsMgr_ModedPresentation::PrsMgr_ModedPresentation() {} +PrsMgr_ModedPresentation::PrsMgr_ModedPresentation() +: myMode (0) {} -PrsMgr_ModedPresentation::PrsMgr_ModedPresentation(const Handle(PrsMgr_Presentation)& aPresentation, const Standard_Integer aMode): myPresentation(aPresentation), myMode(aMode) { +PrsMgr_ModedPresentation::PrsMgr_ModedPresentation (const Handle(PrsMgr_Presentation)& thePrs, + const Standard_Integer theMode) +: myPresentation (thePrs), + myMode (theMode) +{ + // } -Handle(PrsMgr_Presentation) PrsMgr_ModedPresentation::Presentation () const { - +const Handle(PrsMgr_Presentation)& PrsMgr_ModedPresentation::Presentation() const +{ return myPresentation; - } -Standard_Integer PrsMgr_ModedPresentation::Mode () const { +Standard_Integer PrsMgr_ModedPresentation::Mode() const +{ return myMode; } diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cdl b/src/PrsMgr/PrsMgr_PresentableObject.cdl index 99901ad812..e6c4019098 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cdl +++ b/src/PrsMgr/PrsMgr_PresentableObject.cdl @@ -291,14 +291,14 @@ fields myTransformPersistence : CTransPersStruct from Graphic3d; friends - class Presentation3d from PrsMgr, + class Presentation from PrsMgr, class PresentationManager from PrsMgr, - Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d), - Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; - aGivenStruct : Structure from Graphic3d), - Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; - TheTrsf : Transformation from Geom), - Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; - TheTrsf : Transformation from Geom; - aGivenStruct : Structure from Graphic3d) + Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d), + Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; + aGivenStruct : Structure from Graphic3d), + Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; + TheTrsf : Transformation from Geom), + Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; + TheTrsf : Transformation from Geom; + aGivenStruct : Structure from Graphic3d) end PresentableObject from PrsMgr; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index 443b79d428..a392bc5709 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -14,13 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -// Modified by Rob -// 16-dec-1997 : Update Flag for Presentations. - - #include #include -#include #include #include #include @@ -45,32 +40,24 @@ PrsMgr_PresentableObject::PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentati //function : Fill //purpose : //======================================================================= -void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& aPresentationManager, - const Handle(PrsMgr_Presentation)& aPresentation, - const Standard_Integer aMode) +void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& thePrsMgr, + const Handle(PrsMgr_Presentation)& thePrs, + const Standard_Integer theMode) { - if (aPresentation->DynamicType() == STANDARD_TYPE (PrsMgr_Presentation3d)) - { - Handle(PrsMgr_PresentationManager3d) aPrsMgr3d = - (Handle(PrsMgr_PresentationManager3d)&)aPresentationManager; - Handle(PrsMgr_Presentation3d) aPrs3d = - (Handle(PrsMgr_Presentation3d)&)aPresentation; - Handle(Prs3d_Presentation) aStruct3d = aPrs3d->Presentation(); - - Compute (aPrsMgr3d, aStruct3d, aMode); - UpdateLocation (aStruct3d); - aStruct3d->SetClipPlanes (myClipPlanes); - aStruct3d->SetTransformPersistence (GetTransformPersistenceMode(), GetTransformPersistencePoint()); - } + Handle(Prs3d_Presentation) aStruct3d = thePrs->Presentation(); + Compute (thePrsMgr, aStruct3d, theMode); + UpdateLocation (aStruct3d); + aStruct3d->SetClipPlanes (myClipPlanes); + aStruct3d->SetTransformPersistence (GetTransformPersistenceMode(), GetTransformPersistencePoint()); } //======================================================================= //function : Compute -//purpose : +//purpose : //======================================================================= -void PrsMgr_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/, - const Handle(Prs3d_Presentation)& /*aPresentation*/, - const Standard_Integer /*aMode*/) +void PrsMgr_PresentableObject::Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/, + const Handle(Prs3d_Presentation)& /*aPresentation*/, + const Standard_Integer /*aMode*/) { Standard_NotImplemented::Raise("cannot compute in a 3d visualizer"); } @@ -214,20 +201,17 @@ void PrsMgr_PresentableObject::ToBeUpdated(TColStd_ListOfInteger& OutList) const //======================================================================= //function : SetTypeOfPresentation -//purpose : +//purpose : //======================================================================= -void PrsMgr_PresentableObject::SetTypeOfPresentation(const PrsMgr_TypeOfPresentation3d aType) +void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType) { - myTypeOfPresentation3d = aType; - - for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){ - const Handle(PrsMgr_Presentation)& P = myPresentations(IP).Presentation(); - if(P->KindOfPresentation()==PrsMgr_KOP_3D){ - Graphic3d_TypeOfStructure Typ = - (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant)? - Graphic3d_TOS_COMPUTED : Graphic3d_TOS_ALL; - (*(Handle(PrsMgr_Presentation3d)*)&P)->Presentation()->SetVisual(Typ); - } + myTypeOfPresentation3d = theType; + for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + { + const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation(); + aPrs->Presentation()->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant + ? Graphic3d_TOS_COMPUTED + : Graphic3d_TOS_ALL); } } @@ -249,13 +233,10 @@ void PrsMgr_PresentableObject::SetLocation(const TopLoc_Location& aLoc) void PrsMgr_PresentableObject::ResetLocation() { TopLoc_Location aLoc; - Handle(Geom_Transformation) G = new Geom_Transformation(aLoc.Transformation()); - - for(Standard_Integer i=1;i<=myPresentations.Length();i++){ - const Handle(PrsMgr_Presentation)& P = myPresentations(i).Presentation(); - if(P->KindOfPresentation()==PrsMgr_KOP_3D){ - (*((Handle(PrsMgr_Presentation3d)*)&P))->Transform(G); - } + Handle(Geom_Transformation) aTrsf = new Geom_Transformation (aLoc.Transformation()); + for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + { + myPresentations (aPrsIter).Presentation()->Transform (aTrsf); } myLocation = aLoc; } @@ -266,14 +247,20 @@ void PrsMgr_PresentableObject::ResetLocation() //======================================================================= void PrsMgr_PresentableObject::UpdateLocation() { - if(!HasLocation()) return; - Handle(Geom_Transformation) G = new Geom_Transformation(Location().Transformation()); - if(G->Trsf().Form()==gp_Identity) return; - for (Standard_Integer i=1;i<=myPresentations.Length();i++){ - const Handle(PrsMgr_Presentation)& P = myPresentations(i).Presentation(); - if(P->KindOfPresentation()==PrsMgr_KOP_3D){ - (*((Handle(PrsMgr_Presentation3d)*)&P))->Transform(G); - } + if (!HasLocation()) + { + return; + } + + Handle(Geom_Transformation) aTrsf = new Geom_Transformation (Location().Transformation()); + if (aTrsf->Trsf().Form() == gp_Identity) + { + return; + } + + for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + { + myPresentations (aPrsIter).Presentation()->Transform (aTrsf); } } @@ -291,28 +278,24 @@ void PrsMgr_PresentableObject::UpdateLocation(const Handle(Prs3d_Presentation)& //======================================================================= //function : SetTransformPersistence -//purpose : +//purpose : //======================================================================= -void PrsMgr_PresentableObject::SetTransformPersistence( const Graphic3d_TransModeFlags& TheFlag, - const gp_Pnt& ThePoint ) +void PrsMgr_PresentableObject::SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag, + const gp_Pnt& thePoint) { - myTransformPersistence.Flag = TheFlag; - myTransformPersistence.Point.x = (Standard_ShortReal)ThePoint.X(); - myTransformPersistence.Point.y = (Standard_ShortReal)ThePoint.Y(); - myTransformPersistence.Point.z = (Standard_ShortReal)ThePoint.Z(); - - Handle(Graphic3d_Structure) aStruct; - for( Standard_Integer i = 1, n = myPresentations.Length(); i <= n; i++ ) + myTransformPersistence.Flag = theFlag; + myTransformPersistence.Point.x = (Standard_ShortReal )thePoint.X(); + myTransformPersistence.Point.y = (Standard_ShortReal )thePoint.Y(); + myTransformPersistence.Point.z = (Standard_ShortReal )thePoint.Z(); + for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + { + const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation(); + if (!aPrs3d.IsNull() + && !aPrs3d->Presentation().IsNull()) { - Handle(PrsMgr_Presentation3d) aPrs3d = - Handle(PrsMgr_Presentation3d)::DownCast( myPresentations(i).Presentation() ); - if ( !aPrs3d.IsNull() ) - { - aStruct = Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() ); - if( !aStruct.IsNull() ) - aStruct->SetTransformPersistence( TheFlag, ThePoint ); - } + aPrs3d->Presentation()->SetTransformPersistence (theFlag, thePoint); } + } } //======================================================================= @@ -422,17 +405,12 @@ void PrsMgr_PresentableObject::UpdateClipping() // pass over presentation manager 3d mechanism right to the structures - // we do not interested in display mode collections. const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIt); - - Handle(PrsMgr_Presentation3d) aPrs = - Handle(PrsMgr_Presentation3d)::DownCast (aModedPrs.Presentation()); - - if (aPrs.IsNull()) - continue; - - Handle(Prs3d_Presentation) aStruct3d = aPrs->Presentation(); - if (aStruct3d.IsNull()) + if (aModedPrs.Presentation().IsNull() + || aModedPrs.Presentation()->Presentation().IsNull()) + { continue; + } - aStruct3d->SetClipPlanes (myClipPlanes); + aModedPrs.Presentation()->Presentation()->SetClipPlanes (myClipPlanes); } } diff --git a/src/PrsMgr/PrsMgr_Presentation.cdl b/src/PrsMgr/PrsMgr_Presentation.cdl index 30d6918896..988dc27a75 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cdl +++ b/src/PrsMgr/PrsMgr_Presentation.cdl @@ -14,90 +14,186 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. --- Modified by Rob : 20-feb-1997 --- Modified by Rob : 16-dec-1997 : kind of presentation - -deferred class Presentation from PrsMgr -inherits TShared from MMgt +class Presentation from PrsMgr +inherits TShared from MMgt uses - PresentationManager from PrsMgr, - KindOfPrs from PrsMgr + PresentationManager from PrsMgr, + NameOfColor from Quantity, + Transformation from Geom, + Length from Quantity, + ShadingAspect from Prs3d, + TypeOfPresentation3d from PrsMgr, + DataStructureManager from Graphic3d, + Structure from Graphic3d, + PresentableObjectPointer from PrsMgr,PresentableObject from PrsMgr, + Prs from PrsMgr, + Projector from Prs3d, + Presentation from Prs3d is - Initialize(aPresentationManager: PresentationManager from PrsMgr) - is protected; - - KindOfPresentation(me) returns KindOfPrs from PrsMgr is deferred; - ---Purpose: 2D or 3D - - Display(me: mutable) is deferred private; - - Erase(me: mutable) is deferred private; - - SetVisible (me: mutable; theValue: Boolean from Standard) is deferred private; - - Highlight(me: mutable) is deferred private; - - Unhighlight (me) is deferred private; - - IsHighlighted(me) returns Boolean from Standard - is deferred private; - - IsDisplayed(me) returns Boolean from Standard - is deferred private; - - Destroy ( me : mutable ) - is virtual; - ---Level: Public - ---Purpose: Destructor - ---C++: alias ~ - - DisplayPriority(me) returns Integer from Standard - is deferred private; - - 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; - + Create (thePresentationManager : PresentationManager from PrsMgr; + thePresentableObject : PresentableObject from PrsMgr) + returns mutable Presentation from PrsMgr + is private; + + Destroy (me : mutable) is virtual; + ---Level: Public + ---Purpose: Destructor + ---C++: alias ~ + + Display (me : mutable) + is virtual private; + + Display (me : mutable; + theIsHighlight : Boolean from Standard) + is static private; + ---Purpose: Displays myStructure and sets myDisplayReason to theIsHighlight value if + -- myStructure was not displayed or was invisible + + Erase (me : mutable) + is virtual private; + + SetVisible (me : mutable; + theValue : Boolean from Standard) + is virtual private; + + Highlight (me : mutable) is virtual private; + + Unhighlight (me) is virtual private; + + IsHighlighted (me) returns Boolean from Standard + is virtual private; + + IsDisplayed (me) returns Boolean from Standard + is virtual private; + + DisplayPriority(me) returns Integer from Standard + is virtual private; + + SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard) + is virtual private; + + SetZLayer (me : mutable; + theLayerId : Integer from Standard) + is virtual private; + ---Purpose: Set Z layer ID for the presentation + + GetZLayer (me) returns Integer from Standard + is virtual private; + ---Purpose: Get Z layer ID for the presentation + + Clear (me : mutable) + is virtual private; + ---Purpose: removes the whole content of the presentation. + -- Does not remove the other connected presentations. + + Color (me : mutable; + theColor : NameOfColor from Quantity) + is static private; + + BoundBox (me) + is static private; + +---Category: references to other presentation. + + Connect (me; + theOther : Presentation from PrsMgr) + is static private; + +---Category: Transformation methods. + + Transform (me; + theTrsf : Transformation from Geom) + is static private; + + Place (me; + theX, theY, theZ : Length from Quantity) + is static private; + + Multiply (me; + theTrsf : Transformation from Geom) + is static private; + + Move (me; + theX, theY, theZ : Length from Quantity) + is static private; + +---Category: Global Aspect methods + + SetShadingAspect (me; + theShadingAspect : ShadingAspect from Prs3d) + is static private; + + Presentation (me) returns mutable Presentation from Prs3d + is static; + ---C++: inline + ---C++: return const& + +---Category: Computed Structures + + Compute (me : mutable; + theStructure : Structure from Graphic3d) + is static private; + + Compute (me : mutable; + theProjector : DataStructureManager from Graphic3d) + returns Structure from Graphic3d + is static private; + + Compute (me : mutable; + theProjector : DataStructureManager from Graphic3d; + theTrsf : Transformation from Geom) + returns Structure from Graphic3d + is static private; + + Compute (me : mutable; + theProjector : DataStructureManager from Graphic3d; + theGivenStruct : Structure from Graphic3d) + is static private; + + Compute (me : mutable; + theProjector : DataStructureManager from Graphic3d; + theTrsf : Transformation from Geom; + theGivenStruct : Structure from Graphic3d) + is static private; + ---Category: Inquire Methods --- - PresentationManager(me) returns mutable PresentationManager - ---Purpose: returns the PresentationManager in which the - -- presentation has been created. - is static; - ---C++: inline - ---C++: return const& + PresentationManager (me) returns mutable PresentationManager + ---Purpose: returns the PresentationManager in which the presentation has been created. + is static; + ---C++: inline + ---C++: return const& + + Projector (myclass; + theProjector : DataStructureManager from Graphic3d) + returns Projector from Prs3d + is private; ---Category: Internal Methods - SetUpdateStatus(me:mutable; aStat : Boolean from Standard); - ---C++: inline - - MustBeUpdated(me) returns Boolean from Standard; - ---C++: inline + SetUpdateStatus (me : mutable; + theStat : Boolean from Standard); + ---C++: inline + MustBeUpdated (me) returns Boolean from Standard; + ---C++: inline fields - myPresentationManager: PresentationManager from PrsMgr is protected; - myMustBeUpdated : Boolean from Standard is protected; + myPresentationManager : PresentationManager from PrsMgr; + myStructure : Prs from PrsMgr; + myPresentableObject : PresentableObjectPointer from PrsMgr; + myMustBeUpdated : Boolean from Standard; + myDisplayReason : Boolean from Standard; friends - class PresentationManager from PrsMgr - + + class PresentationManager from PrsMgr, + class PresentableObject from PrsMgr, + class Prs from PrsMgr + end Presentation from PrsMgr; diff --git a/src/PrsMgr/PrsMgr_Presentation.cxx b/src/PrsMgr/PrsMgr_Presentation.cxx index be668fb7a2..dbd311d0a0 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cxx +++ b/src/PrsMgr/PrsMgr_Presentation.cxx @@ -13,10 +13,387 @@ // commercial license or contractual agreement. #include +#include +#include +#include -PrsMgr_Presentation::PrsMgr_Presentation -(const Handle(PrsMgr_PresentationManager)& aPresentationManager) -:myPresentationManager(aPresentationManager),myMustBeUpdated(Standard_False) {} +#include +#include +#include -void PrsMgr_Presentation::Destroy () { +//======================================================================= +//function : PrsMgr_Presentation +//purpose : +//======================================================================= +PrsMgr_Presentation::PrsMgr_Presentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, + const Handle(PrsMgr_PresentableObject)& thePrsObject) +: myPresentationManager (thePrsMgr), + myPresentableObject (thePrsObject.operator->()), + myMustBeUpdated (Standard_False), + myDisplayReason (Standard_False) +{ + myStructure = new PrsMgr_Prs (thePrsMgr->StructureManager(), + this, thePrsObject->TypeOfPresentation3d()); + myStructure->SetOwner (myPresentableObject); +} + +//======================================================================= +//function : Display +//purpose : +//======================================================================= +void PrsMgr_Presentation::Display() +{ + Display (Standard_False); + myDisplayReason = Standard_False; +} + +//======================================================================= +//function : Display +//purpose : +//======================================================================= +void PrsMgr_Presentation::Display (const Standard_Boolean theIsHighlight) +{ + if (!myStructure->IsDisplayed()) + { + myStructure->Display(); + myDisplayReason = theIsHighlight; + } + else if (!myStructure->IsVisible()) + { + myStructure->SetVisible (Standard_True); + myDisplayReason = theIsHighlight; + } +} + +//======================================================================= +//function : Erase +//purpose : +//======================================================================= +void PrsMgr_Presentation::Erase() +{ + if (myStructure.IsNull()) + { + return; + } + + // Erase structure from structure manager + myStructure->Erase(); + myStructure->Clear(); + // Disconnect other structures + myStructure->DisconnectAll (Graphic3d_TOC_DESCENDANT); + // Clear groups and remove graphic structure + myStructure.Nullify(); +} + +//======================================================================= +//function : SetVisible +//purpose : +//======================================================================= +void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue) +{ + myStructure->SetVisible (theValue); +} + +//======================================================================= +//function : Highlight +//purpose : +//======================================================================= +void PrsMgr_Presentation::Highlight() +{ + Display (Standard_True); + myStructure->Highlight(); +} + +//======================================================================= +//function : Unhighlight +//purpose : +//======================================================================= +void PrsMgr_Presentation::Unhighlight() const +{ + myStructure->UnHighlight(); + if (myDisplayReason) + { + myStructure->SetVisible (Standard_False); + } +} + +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void PrsMgr_Presentation::Clear() +{ + // This modification remove the contain of the structure: + // Consequence: + // 1. The memory zone of the group is reused + // 2. The speed for animation is constant + //myPresentableObject = NULL; + SetUpdateStatus (Standard_True); + if (myStructure.IsNull()) + { + return; + } + + myStructure->Clear (Standard_True); + // myStructure->Clear(Standard_False); + myStructure->RemoveAll(); +} + +//======================================================================= +//function : Color +//purpose : +//======================================================================= +void PrsMgr_Presentation::Color (const Quantity_NameOfColor theColor) +{ + Display (Standard_True); + myStructure->Color (theColor); +} + +//======================================================================= +//function : BoundBox +//purpose : +//======================================================================= +void PrsMgr_Presentation::BoundBox() const +{ + myStructure->BoundBox(); +} + +//======================================================================= +//function : IsDisplayed +//purpose : +//======================================================================= +Standard_Boolean PrsMgr_Presentation::IsDisplayed() const +{ + return myStructure->IsDisplayed() + && myStructure->IsVisible() + && !myDisplayReason; +} + +//======================================================================= +//function : IsHighlighted +//purpose : +//======================================================================= +Standard_Boolean PrsMgr_Presentation::IsHighlighted() const +{ + return myStructure->IsHighlighted(); +} + +//======================================================================= +//function : DisplayPriority +//purpose : +//======================================================================= +Standard_Integer PrsMgr_Presentation::DisplayPriority() const +{ + return myStructure->DisplayPriority(); +} + +//======================================================================= +//function : SetDisplayPriority +//purpose : +//======================================================================= +void PrsMgr_Presentation::SetDisplayPriority (const Standard_Integer theNewPrior) +{ + myStructure->SetDisplayPriority (theNewPrior); +} + +//======================================================================= +//function : Connect +//purpose : +//======================================================================= +void PrsMgr_Presentation::Connect (const Handle(PrsMgr_Presentation)& theOther) const +{ + myStructure->Connect (theOther->Presentation()); +} + +//======================================================================= +//function : Transform +//purpose : +//======================================================================= +void PrsMgr_Presentation::Transform (const Handle(Geom_Transformation)& theTrsf) const +{ + myStructure->Transform (theTrsf); +} + +//======================================================================= +//function : Place +//purpose : +//======================================================================= +void PrsMgr_Presentation::Place (const Quantity_Length theX, + const Quantity_Length theY, + const Quantity_Length theZ) const +{ + myStructure->Place (theX, theY, theZ); +} + +//======================================================================= +//function : Multiply +//purpose : +//======================================================================= +void PrsMgr_Presentation::Multiply (const Handle(Geom_Transformation)& theTrsf) const +{ + myStructure->Multiply (theTrsf); +} + +//======================================================================= +//function : Move +//purpose : +//======================================================================= +void PrsMgr_Presentation::Move (const Quantity_Length theX, + const Quantity_Length theY, + const Quantity_Length theZ) const +{ + myStructure->Move (theX, theY, theZ); +} + +//======================================================================= +//function : SetShadingAspect +//purpose : +//======================================================================= +void PrsMgr_Presentation::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theShadingAspect) const +{ + myStructure->SetShadingAspect (theShadingAspect); +} + +//======================================================================= +//function : Compute +//purpose : Methods for hidden parts... +//======================================================================= +Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector) +{ + Handle(Prs3d_Presentation) aPrs = new Prs3d_Presentation (myPresentationManager->StructureManager()); + myPresentableObject->Compute (Projector (theProjector), aPrs); + return aPrs; +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= +void PrsMgr_Presentation::Compute (const Handle(Graphic3d_Structure)& theStructure) +{ + Standard_Integer aDispMode = 0; + Standard_Integer aPresentationsNumber = myPresentableObject->myPresentations.Length(); + for (Standard_Integer anIter = 1; anIter <= aPresentationsNumber; ++anIter) + { + const PrsMgr_ModedPresentation& aModedPresentation = myPresentableObject->myPresentations.Value (anIter); + if (aModedPresentation.Presentation().operator->() == this) + { + aDispMode = aModedPresentation.Mode(); + break; + } + } + + Handle(Prs3d_Presentation) aPrs3d = Handle(Prs3d_Presentation)::DownCast (theStructure); + myPresentableObject->Compute (myPresentationManager, aPrs3d, aDispMode); +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= +void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Graphic3d_Structure)& theStructToFill) +{ + theStructToFill->Clear(); + const Handle(Prs3d_Presentation)& aPrs = *((Handle(Prs3d_Presentation)* )&theStructToFill); + myPresentableObject->Compute (Projector (theProjector), aPrs); +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= +Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf) +{ + Handle(Prs3d_Presentation) aPrs3d = new Prs3d_Presentation (myPresentationManager->StructureManager()); + if (theTrsf->Form() == gp_Translation) + { + myPresentableObject->Compute (Projector (theProjector), aPrs3d); + aPrs3d->Transform (theTrsf); + return aPrs3d; + } + + // waiting that something is done in gp_Trsf...rob + for (Standard_Integer i = 1; i <= 3; ++i) + { + for (Standard_Integer j = 1; j <= 3; ++j) + { + if (i != j) + { + if (Abs (theTrsf->Value (i, j)) > Precision::Confusion()) + { + myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs3d); + return aPrs3d; + } + } + } + } + + myPresentableObject->Compute (Projector (theProjector), aPrs3d); + aPrs3d->Transform (theTrsf); + return aPrs3d; +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= +void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf, + const Handle(Graphic3d_Structure)& theStructToFill) +{ + // recompute HLR after transformation in all the case + Handle(Prs3d_Presentation) aPrs = *((Handle(Prs3d_Presentation)*)&theStructToFill); + theStructToFill->Clear(); + myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs); +} + +//======================================================================= +//function : Projector +//purpose : +//======================================================================= +Handle(Prs3d_Projector) PrsMgr_Presentation::Projector (const Handle(Graphic3d_DataStructureManager)& theProjector) +{ + const Handle(Graphic3d_Camera)& aCamera = Handle(Visual3d_View)::DownCast (theProjector)->Camera(); + const gp_Dir aDir = aCamera->Direction().Reversed(); + const gp_Pnt anAt = aCamera->Center(); + const gp_Dir anUp = aCamera->Up(); + Handle(Prs3d_Projector) aProj = new Prs3d_Projector (!aCamera->IsOrthographic(), + aCamera->Scale(), + aDir.X(), aDir.Y(), aDir.Z(), + anAt.X(), anAt.Y(), anAt.Z(), + anUp.X(), anUp.Y(), anUp.Z()); + return aProj; +} + +//======================================================================= +//function : Destroy +//purpose : +//======================================================================= +void PrsMgr_Presentation::Destroy() +{ + if (!myStructure.IsNull()) + { + myStructure->Clear(); + myStructure.Nullify(); + } +} + +//======================================================================= +//function : SetZLayer +//purpose : +//======================================================================= +void PrsMgr_Presentation::SetZLayer (Standard_Integer theLayerId) +{ + myStructure->SetZLayer (theLayerId); +} + +//======================================================================= +//function : GetZLayer +//purpose : +//======================================================================= +Standard_Integer PrsMgr_Presentation::GetZLayer() const +{ + return myStructure->GetZLayer(); } diff --git a/src/PrsMgr/PrsMgr_Presentation.lxx b/src/PrsMgr/PrsMgr_Presentation.lxx index df5c4f88a2..1d87c8b02e 100644 --- a/src/PrsMgr/PrsMgr_Presentation.lxx +++ b/src/PrsMgr/PrsMgr_Presentation.lxx @@ -14,11 +14,22 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -inline void PrsMgr_Presentation::SetUpdateStatus(const Standard_Boolean TheUpdateStatus) -{myMustBeUpdated = TheUpdateStatus ;} +inline void PrsMgr_Presentation::SetUpdateStatus (const Standard_Boolean theUpdateStatus) +{ + myMustBeUpdated = theUpdateStatus; +} -inline Standard_Boolean PrsMgr_Presentation::MustBeUpdated() const -{return myMustBeUpdated;} +inline Standard_Boolean PrsMgr_Presentation::MustBeUpdated() const +{ + return myMustBeUpdated; +} inline const Handle(PrsMgr_PresentationManager)& PrsMgr_Presentation::PresentationManager() const -{return myPresentationManager;} +{ + return myPresentationManager; +} + +inline const Handle(Prs3d_Presentation)& PrsMgr_Presentation::Presentation() const +{ + return myStructure; +} diff --git a/src/PrsMgr/PrsMgr_Presentation3d.cdl b/src/PrsMgr/PrsMgr_Presentation3d.cdl deleted file mode 100644 index 47af459ce0..0000000000 --- a/src/PrsMgr/PrsMgr_Presentation3d.cdl +++ /dev/null @@ -1,173 +0,0 @@ --- Created on: 1993-10-21 --- Created by: Jean-Louis FRENKEL --- Copyright (c) 1993-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. - --- Modified by rob 09-oct-96 - - - -class Presentation3d from PrsMgr inherits Presentation from PrsMgr - -uses - PresentationManager from PrsMgr, - Presentation from Prs3d, - NameOfColor from Quantity, - Transformation from Geom, - Length from Quantity, - ShadingAspect from Prs3d, - TypeOfPresentation3d from PrsMgr, - DataStructureManager from Graphic3d, - Structure from Graphic3d, - PresentableObjectPointer from PrsMgr,PresentableObject from PrsMgr, - Prs from PrsMgr, - Projector from Prs3d, - KindOfPrs from PrsMgr -is - Create(aPresentationManager: PresentationManager from PrsMgr; - aPresentableObject: PresentableObject from PrsMgr) - returns mutable Presentation3d from PrsMgr - is private; - - KindOfPresentation(me) returns KindOfPrs from PrsMgr is redefined static; - - Destroy(me: mutable) is redefined; - ---Level: Public - ---Purpose: Destructor - ---C++: alias ~ - - Display(me: mutable) - is redefined static private; - - Display (me: mutable; - theIsHighlight: Boolean from Standard) - is static private; - ---Level: Private; - ---Purpose: displays myStructure and sets myDisplayReason to theIsHighlight value if - -- myStructure was not displayed or was invisible - - Erase(me: mutable) is redefined static private; - - SetVisible (me: mutable; theValue: Boolean from Standard) is redefined static private; - - Highlight(me: mutable) is redefined static private; - - Unhighlight (me) is redefined static private; - - IsDisplayed (me) returns Boolean from Standard - is redefined static private; - - IsHighlighted (me) returns Boolean from Standard - is redefined static private; - - - DisplayPriority(me) returns Integer from Standard - is redefined static private; - - 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. - -- - is redefined static private; - - - Color(me:mutable; aColor: NameOfColor from Quantity) - is static private; - - BoundBox(me) - is static private; - ----Category: references to other presentation. - - Connect(me; anOtherPresentation: Presentation3d from PrsMgr) - is static private; - ----Category: Transformation methods. - - Transform (me; aTransformation: Transformation from Geom) - is static private; - - Place (me; X,Y,Z: Length from Quantity) - is static private; - - Multiply (me; aTransformation: Transformation from Geom) - is static private; - - Move (me; X,Y,Z: Length from Quantity) - is static private; - - ---Category: Global Aspect methods - - SetShadingAspect(me; - aShadingAspect: ShadingAspect from Prs3d) - is static private; - - Presentation (me) returns mutable Presentation from Prs3d - is static; - - - ---Category: Computed Structures - - Compute(me : mutable; theStructure: Structure from Graphic3d) - is static private; - - Compute(me : mutable; aProjector: DataStructureManager from Graphic3d) - returns Structure from Graphic3d - is static private; - - Compute(me : mutable; - aProjector : DataStructureManager from Graphic3d; - TheTrsf : Transformation from Geom) - returns Structure from Graphic3d - is static private; - - Compute(me : mutable; - aProjector : DataStructureManager from Graphic3d; - aGivenStruct : Structure from Graphic3d) - is static private; - - Compute(me : mutable; - aProjector : DataStructureManager from Graphic3d; - TheTrsf : Transformation from Geom; - aGivenStruct : Structure from Graphic3d) - is static private; - - - - Projector(myclass; aProjector: DataStructureManager from Graphic3d) - returns Projector from Prs3d - is private; - -fields - - myStructure: Prs from PrsMgr; - myDisplayReason: Boolean from Standard; - myPresentableObject: PresentableObjectPointer from PrsMgr; -friends - class PresentationManager from PrsMgr, - class PresentableObject from PrsMgr, - class Prs from PrsMgr -end Presentation3d from PrsMgr; diff --git a/src/PrsMgr/PrsMgr_Presentation3d.cxx b/src/PrsMgr/PrsMgr_Presentation3d.cxx deleted file mode 100644 index 401c74e091..0000000000 --- a/src/PrsMgr/PrsMgr_Presentation3d.cxx +++ /dev/null @@ -1,401 +0,0 @@ -// Created on: 1993-10-21 -// Created by: Jean-Louis FRENKEL -// Copyright (c) 1993-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. - -// Modified by rob 09-oct-96 - - -#define IMP040200 //GG Recompute HLR after transformation -// in all the case. - -#include -#include -#include -#include -#include -#include -#include - -PrsMgr_Presentation3d::PrsMgr_Presentation3d (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, - const Handle(PrsMgr_PresentableObject)& aPresentableObject) -: PrsMgr_Presentation(aPresentationManager), - myDisplayReason(Standard_False), - myPresentableObject (aPresentableObject.operator->()) -{ - myStructure = new PrsMgr_Prs(aPresentationManager->StructureManager(), - this, aPresentableObject->TypeOfPresentation3d()); - myStructure->SetOwner(myPresentableObject); -} - -PrsMgr_KindOfPrs PrsMgr_Presentation3d::KindOfPresentation() const -{return PrsMgr_KOP_3D;} - - -void PrsMgr_Presentation3d::Display() -{ - Display (Standard_False); - myDisplayReason = Standard_False; -} - -void PrsMgr_Presentation3d::Display(const Standard_Boolean theIsHighlight) -{ - if (!myStructure->IsDisplayed()) - { - myStructure->Display(); - myDisplayReason = theIsHighlight; - } - else if (!myStructure->IsVisible()) - { - myStructure->SetVisible (Standard_True); - myDisplayReason = theIsHighlight; - } -} - -void PrsMgr_Presentation3d::Erase () -{ - if (myStructure.IsNull()) - { - return; - } - - // Erase structure from structure manager - myStructure->Erase(); - myStructure->Clear(); - // Disconnect other structures - myStructure->DisconnectAll (Graphic3d_TOC_DESCENDANT); - // Clear groups and remove graphic structure - myStructure.Nullify(); -} - -void PrsMgr_Presentation3d::SetVisible (const Standard_Boolean theValue) -{ - myStructure->SetVisible (theValue); -} - -void PrsMgr_Presentation3d::Highlight () { - Display (Standard_True); - myStructure->Highlight();} - -void PrsMgr_Presentation3d::Unhighlight () const { - myStructure->UnHighlight(); - if (myDisplayReason) myStructure->SetVisible (Standard_False); -} - -void PrsMgr_Presentation3d::Clear() { - // This modification remove the contain of the structure: - // Consequence: - // 1. The memory zone of the group is reused - // 2. The speed for animation is constant - //myPresentableObject = NULL; - SetUpdateStatus(Standard_True); - if (myStructure.IsNull()) - { - return; - } - - myStructure->Clear(Standard_True); - // myStructure->Clear(Standard_False); - myStructure->RemoveAll(); -} - -void PrsMgr_Presentation3d::Color(const Quantity_NameOfColor aColor){ - Display (Standard_True); - myStructure->Color(aColor); -} - -void PrsMgr_Presentation3d::BoundBox() const { - myStructure->BoundBox(); -} - -Standard_Boolean PrsMgr_Presentation3d::IsDisplayed () const { - return myStructure->IsDisplayed() && myStructure->IsVisible() && !myDisplayReason; -} - -Standard_Boolean PrsMgr_Presentation3d::IsHighlighted () const { - return myStructure->IsHighlighted(); -} - - -Standard_Integer PrsMgr_Presentation3d::DisplayPriority() const { -return myStructure->DisplayPriority(); -} - -void PrsMgr_Presentation3d::SetDisplayPriority(const Standard_Integer TheNewPrior) -{ - myStructure->SetDisplayPriority(TheNewPrior); -} - -Handle(Prs3d_Presentation) PrsMgr_Presentation3d::Presentation() const { - return myStructure; -} -void PrsMgr_Presentation3d::Connect(const Handle(PrsMgr_Presentation3d)& anOtherPresentation) const { - myStructure->Connect(anOtherPresentation->Presentation()); -} - -void PrsMgr_Presentation3d::Transform (const Handle(Geom_Transformation)& aTransformation) const { - myStructure->Transform(aTransformation); -} - -void PrsMgr_Presentation3d::Place (const Quantity_Length X, - const Quantity_Length Y, - const Quantity_Length Z) const { - myStructure->Place(X,Y,Z); -} - -void PrsMgr_Presentation3d::Multiply (const Handle(Geom_Transformation)& aTransformation) const { - myStructure->Multiply(aTransformation); -} - -void PrsMgr_Presentation3d::Move (const Quantity_Length X, - const Quantity_Length Y, - const Quantity_Length Z) const { - myStructure->Move(X,Y,Z); -} - -void PrsMgr_Presentation3d::SetShadingAspect(const Handle(Prs3d_ShadingAspect)& aShadingAspect) const { - myStructure->SetShadingAspect(aShadingAspect); -} - - - -//======================================================================= -//function : Compute -//purpose : Methods for hidden parts... -//======================================================================= - -Handle(Graphic3d_Structure) PrsMgr_Presentation3d:: -Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) -{ -#ifdef DEB - cout<<"passage in g = Compute(P) "<StructureManager()); - myPresentableObject->Compute(Projector(aProjector),g); - return g; -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void PrsMgr_Presentation3d::Compute (const Handle(Graphic3d_Structure)& theStructure) -{ - Standard_Integer aDispMode = 0; - - Standard_Integer aPresentationsNumber = myPresentableObject->myPresentations.Length(); - for (Standard_Integer anIter = 1; anIter <= aPresentationsNumber; anIter++) - { - const PrsMgr_ModedPresentation& aModedPresentation = myPresentableObject->myPresentations.Value (anIter); - Handle(PrsMgr_Presentation) aPresentation = aModedPresentation.Presentation(); - PrsMgr_Presentation3d* aPresentation3d = (PrsMgr_Presentation3d* )aPresentation.operator->(); - if (aPresentation3d == this) - { - aDispMode = aModedPresentation.Mode(); - break; - } - } - - Handle(Prs3d_Presentation) aPrs3d = Handle(Prs3d_Presentation)::DownCast (theStructure); - - myPresentableObject->Compute( - Handle(PrsMgr_PresentationManager3d)::DownCast (PresentationManager()), - aPrs3d, - aDispMode); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, - const Handle(Graphic3d_Structure)& TheStructToFill) -{ -#ifdef DEB - cout<<"passage in Compute(P,Str)"<Clear(); - const Handle(Prs3d_Presentation)& P = *((Handle(Prs3d_Presentation)*) &TheStructToFill); - myPresentableObject->Compute(Projector(aProjector),P); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= -Handle(Graphic3d_Structure) PrsMgr_Presentation3d:: -Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, - const Handle(Geom_Transformation)& TheTrsf) -{ -#ifdef DEB - cout<<"passage in G = Compute(P,Trsf)"<StructureManager()); - - - if(TheTrsf->Form()== gp_Translation){ -#ifdef DEB - cout<<"\tla Trsf est une translation"<Compute(Projector(aProjector),g); - g->Transform(TheTrsf); - } - else{ - // waiting that something is done in gp_Trsf...rob - Standard_Boolean good (Standard_True); - for (Standard_Integer i=1;i<=3 && good ;i++){ - for (Standard_Integer j=1;j<=3 && good ;j++){ - if(i!=j){ - if(Abs(TheTrsf->Value(i,j)) > Precision::Confusion()) - good = Standard_False; - } - } - } - - if(good){ -#ifdef DEB - cout<<"\t it is checked if Trsf is a Translation"<Compute(Projector(aProjector),g); - g->Transform(TheTrsf); - - } - else{ -#ifdef DEB - cout<<"\t Trsf is not only translation..."<Compute(Projector(aProjector),TheTrsf,g); - } - } - return g; -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= -void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, - const Handle(Geom_Transformation)& TheTrsf, - const Handle(Graphic3d_Structure)& TheStructToFill) -{ - -#ifdef DEB - cout<<"passage in Compute(P,Trsf,Str)"<Clear(); - myPresentableObject->Compute(Projector(aProjector),TheTrsf,P); -#else //Does not work properly, HLR seems deactivated for view rotation - if(TheTrsf->Form()== gp_Translation){ -#ifdef DEB - cout<<"\t Trsf is a translation"<Compute(Projector(aProjector),P); - P->Transform(TheTrsf); - } - else{ - // waiting that something is done in gp_Trsf...rob - Standard_Boolean good (Standard_True); - for (Standard_Integer i=1;i<=3 && good ;i++){ - for (Standard_Integer j=1;j<=3 && good ;j++){ - if(i!=j){ - if(Abs(TheTrsf->Value(i,j)) > Precision::Confusion()) - good = Standard_False; - } - } - } - if(good && !TheStructToFill->IsEmpty()){ -#ifdef DEB - cout<<"\t it is checked if Trsf is a Translation"<Transform(TheTrsf); - } - else{ - TheStructToFill->Clear(); - -#ifdef DEB - cout<<"\t Trsf is not only translation..."<Compute(Projector(aProjector),TheTrsf,P); - } - } -#endif -} - - - - - - -//======================================================================= -//function : Projector -//purpose : -//======================================================================= - -Handle(Prs3d_Projector) PrsMgr_Presentation3d::Projector(const Handle(Graphic3d_DataStructureManager)& aProjector) -{ - const Handle(Graphic3d_Camera)& aCamera = Handle(Visual3d_View)::DownCast (aProjector)->Camera(); - - Standard_Real DX, DY, DZ,XAt, YAt , ZAt,XUp, YUp, ZUp; - gp_Dir aDir = aCamera->Direction().Reversed(); - DX = aDir.X(); DY = aDir.Y(); DZ = aDir.Z(); - - gp_Pnt anAt = aCamera->Center(); - XAt = anAt.X(); YAt = anAt.Y(); ZAt = anAt.Z(); - - gp_Dir anUp = aCamera->Up(); - XUp = anUp.X(); YUp = anUp.Y(); ZUp = anUp.Z(); - - Standard_Boolean pers = !aCamera->IsOrthographic(); - Standard_Real focale = aCamera->Scale(); - - Handle(Prs3d_Projector) aProj = - new Prs3d_Projector(pers, focale, DX, DY, DZ, XAt, YAt, ZAt, XUp, YUp, ZUp); - return aProj; - -} - -void PrsMgr_Presentation3d::Destroy () { - if (!myStructure.IsNull()) - 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 (); -} diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cdl b/src/PrsMgr/PrsMgr_PresentationManager.cdl index 74eb87be22..f1b29d8059 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.cdl +++ b/src/PrsMgr/PrsMgr_PresentationManager.cdl @@ -31,7 +31,6 @@ uses Transformation from Geom, NameOfMaterial from Graphic3d, Presentation from PrsMgr, - Presentation3d from PrsMgr, View from V3d, ShadingAspect from Prs3d, Presentation from Prs3d @@ -251,12 +250,6 @@ is ---Purpose: this method will change the color and the aspect of the presentations containing shaded structures. is static; - CastPresentation (me; - thePrsObject : PresentableObject from PrsMgr; - theMode : Integer from Standard = 0) - returns mutable Presentation3d from PrsMgr - is static; - ---Category: Private & deferred methods. HasPresentation (me; diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cxx b/src/PrsMgr/PrsMgr_PresentationManager.cxx index 7908f2302a..72028a7cce 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.cxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.cxx @@ -48,7 +48,7 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject) AddPresentation (thePrsObj, theMode); } - Handle(PrsMgr_Presentation3d) aPrs = CastPresentation (thePrsObj, theMode); + Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); if (aPrs->MustBeUpdated()) { Update (thePrsObj, theMode); @@ -114,7 +114,7 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec AddPresentation (thePrsObj, theMode); } - Handle(PrsMgr_Presentation3d) aPrs = CastPresentation (thePrsObj, theMode); + Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); if (aPrs->MustBeUpdated()) { Update (thePrsObj, theMode); @@ -349,7 +349,7 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj, const Standard_Integer theMode) { - Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation3d (this, thePrsObj); + Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj); thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode)); thePrsObj->Fill (this, aPrs, theMode); @@ -434,7 +434,7 @@ void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject) { AddPresentation (theOtherObject, theOtherMode); } - CastPresentation (thePrsObject, theMode)->Connect (CastPresentation (theOtherObject, theMode)); + Presentation (thePrsObject, theMode)->Connect (Presentation (theOtherObject, theMode)); } // ======================================================================= @@ -445,7 +445,7 @@ void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObjec const Handle(Geom_Transformation)& theTransformation, const Standard_Integer theMode) { - CastPresentation (thePrsObj, theMode)->Transform (theTransformation); + Presentation (thePrsObj, theMode)->Transform (theTransformation); } // ======================================================================= @@ -458,7 +458,7 @@ void PrsMgr_PresentationManager::Place (const Handle(PrsMgr_PresentableObject)& const Quantity_Length theZ, const Standard_Integer theMode) { - CastPresentation (thePrsObj, theMode)->Place (theX, theY, theZ); + Presentation (thePrsObj, theMode)->Place (theX, theY, theZ); } // ======================================================================= @@ -469,7 +469,7 @@ void PrsMgr_PresentationManager::Multiply (const Handle(PrsMgr_PresentableObject const Handle(Geom_Transformation)& theTransformation, const Standard_Integer theMode) { - CastPresentation (thePrsObj, theMode)->Multiply (theTransformation); + Presentation (thePrsObj, theMode)->Multiply (theTransformation); } // ======================================================================= @@ -482,7 +482,7 @@ void PrsMgr_PresentationManager::Move (const Handle(PrsMgr_PresentableObject)& t const Quantity_Length theZ, const Standard_Integer theMode) { - CastPresentation (thePrsObj, theMode)->Move (theX, theY, theZ); + Presentation (thePrsObj, theMode)->Move (theX, theY, theZ); } // ======================================================================= @@ -498,7 +498,7 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& AddPresentation (thePrsObj, theMode); } - Handle(PrsMgr_Presentation3d) aPrs = CastPresentation (thePrsObj, theMode); + Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); if (aPrs->MustBeUpdated()) { Update (thePrsObj, theMode); @@ -531,7 +531,7 @@ void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject { Update (thePrsObject, theMode); } - CastPresentation (thePrsObject, theMode)->BoundBox(); + Presentation (thePrsObject, theMode)->BoundBox(); } // ======================================================================= @@ -559,16 +559,6 @@ void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_Presentab { if (HasPresentation (thePrsObject, theMode)) { - CastPresentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect); + Presentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect); } } - -// ======================================================================= -// function : CastPresentation -// purpose : -// ======================================================================= -Handle(PrsMgr_Presentation3d) PrsMgr_PresentationManager::CastPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, - const Standard_Integer theMode) const -{ - return Handle(PrsMgr_Presentation3d)::DownCast (Presentation (thePrsObject, theMode)); -} diff --git a/src/PrsMgr/PrsMgr_Prs.cdl b/src/PrsMgr/PrsMgr_Prs.cdl index 41b3639b39..cbf729265d 100644 --- a/src/PrsMgr/PrsMgr_Prs.cdl +++ b/src/PrsMgr/PrsMgr_Prs.cdl @@ -25,12 +25,12 @@ uses Structure from Graphic3d, DataStructureManager from Graphic3d, TypeOfPresentation3d from PrsMgr, - Presentation3dPointer from PrsMgr + PresentationPointer from PrsMgr is - Create(aStructureManager : StructureManager from Graphic3d; - aPresentation : Presentation3dPointer from PrsMgr; - aTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr) + Create (theStructManager : StructureManager from Graphic3d; + thePresentation : PresentationPointer from PrsMgr; + theTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr) returns mutable Prs from PrsMgr; Compute (me: mutable) @@ -74,5 +74,5 @@ is fields - myPresentation3d: Presentation3dPointer from PrsMgr; + myPresentation3d: PresentationPointer from PrsMgr; end Prs from PrsMgr; diff --git a/src/PrsMgr/PrsMgr_Prs.cxx b/src/PrsMgr/PrsMgr_Prs.cxx index 125056d9b7..60b214d9c0 100644 --- a/src/PrsMgr/PrsMgr_Prs.cxx +++ b/src/PrsMgr/PrsMgr_Prs.cxx @@ -13,18 +13,18 @@ // commercial license or contractual agreement. #include -#include +#include #include #include #include -PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& aStructureManager, - const PrsMgr_Presentation3dPointer& aPresentation3d, - const PrsMgr_TypeOfPresentation3d aTypeOfPresentation) -:Prs3d_Presentation(aStructureManager),myPresentation3d(aPresentation3d) +PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& theStructManager, + const PrsMgr_PresentationPointer& thePrs, + const PrsMgr_TypeOfPresentation3d theTypeOfPresentation) +: Prs3d_Presentation (theStructManager), + myPresentation3d (thePrs) { - - if (aTypeOfPresentation == PrsMgr_TOP_ProjectorDependant) + if (theTypeOfPresentation == PrsMgr_TOP_ProjectorDependant) SetVisual(Graphic3d_TOS_COMPUTED); } diff --git a/src/TPrsStd/TPrsStd_NamedShapeDriver.cxx b/src/TPrsStd/TPrsStd_NamedShapeDriver.cxx index f4b2a26813..d99ca67d46 100644 --- a/src/TPrsStd/TPrsStd_NamedShapeDriver.cxx +++ b/src/TPrsStd/TPrsStd_NamedShapeDriver.cxx @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include #undef OPTIM_UPDATE // If this variable is defined there will be done -- 2.20.1