// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <PrsMgr_Presentation.ixx>
-#include <PrsMgr_PresentationManager.hxx>
-#include <PrsMgr_Prs.hxx>
-#include <PrsMgr_ModedPresentation.hxx>
+#include <PrsMgr_Presentation.hxx>
+#include <Geom_Transformation.hxx>
+#include <Graphic3d_DataStructureManager.hxx>
#include <Graphic3d_Structure.hxx>
-#include <Visual3d_View.hxx>
#include <Precision.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <PrsMgr_ModedPresentation.hxx>
+#include <PrsMgr_PresentableObject.hxx>
+#include <PrsMgr_PresentationManager.hxx>
+#include <PrsMgr_Prs.hxx>
+#include <Quantity_Color.hxx>
+#include <Standard_Type.hxx>
+#include <Graphic3d_CView.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Presentation, Standard_Transient)
namespace
{
State_Visible
};
- static BeforeHighlightState StructureState(const Handle(PrsMgr_Prs) theStructure)
+ static BeforeHighlightState StructureState(const Handle(Prs3d_Presentation)& theStructure)
{
return !theStructure->IsDisplayed() ?
State_Empty : !theStructure->IsVisible() ?
//=======================================================================
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())
{
//function : Highlight
//purpose :
//=======================================================================
-void PrsMgr_Presentation::Highlight()
+void PrsMgr_Presentation::Highlight (const Handle(Prs3d_Drawer)& theStyle)
{
if (!IsHighlighted())
{
myBeforeHighlightState = StructureState (myStructure);
}
- Display (Standard_True);
- myStructure->Highlight();
+ display (Standard_True);
+ myStructure->Highlight (theStyle);
}
//=======================================================================
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 :
}
//=======================================================================
-//function : Transform
+//function : SetTransformation
//purpose :
//=======================================================================
-void PrsMgr_Presentation::Transform (const Handle(Geom_Transformation)& theTrsf) const
+void PrsMgr_Presentation::SetTransformation (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);
+ myStructure->SetTransformation (theTrsf);
}
//=======================================================================
const Handle(Graphic3d_Structure)& theStructToFill)
{
theStructToFill->Clear();
- const Handle(Prs3d_Presentation)& aPrs = *((Handle(Prs3d_Presentation)* )&theStructToFill);
+ Handle(Prs3d_Presentation) aPrs (Handle(Prs3d_Presentation)::DownCast (theStructToFill));
myPresentableObject->Compute (Projector (theProjector), aPrs);
}
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);
+ myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs3d);
return aPrs3d;
}
const Handle(Graphic3d_Structure)& theStructToFill)
{
// recompute HLR after transformation in all the case
- Handle(Prs3d_Presentation) aPrs = *((Handle(Prs3d_Presentation)*)&theStructToFill);
+ Handle(Prs3d_Presentation) aPrs = Handle(Prs3d_Presentation)::DownCast (theStructToFill);
theStructToFill->Clear();
myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs);
}
//=======================================================================
Handle(Prs3d_Projector) PrsMgr_Presentation::Projector (const Handle(Graphic3d_DataStructureManager)& theProjector)
{
- const Handle(Graphic3d_Camera)& aCamera = Handle(Visual3d_View)::DownCast (theProjector)->Camera();
+ Handle(Graphic3d_Camera) aCamera = Handle(Graphic3d_CView)::DownCast (theProjector)->Camera();
const gp_Dir aDir = aCamera->Direction().Reversed();
const gp_Pnt anAt = aCamera->Center();
const gp_Dir anUp = aCamera->Up();
}
//=======================================================================
-//function : Destroy
+//function : ~PrsMgr_Presentation
//purpose :
//=======================================================================
-void PrsMgr_Presentation::Destroy()
+PrsMgr_Presentation::~PrsMgr_Presentation()
{
Erase();
}