1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <PrsMgr_Prs.ixx>
16 #include <PrsMgr_Presentation.hxx>
17 #include <Precision.hxx>
18 #include <gp_Trsf.hxx>
19 #include <Geom_Transformation.hxx>
21 PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& theStructManager,
22 const PrsMgr_PresentationPointer& thePrs,
23 const PrsMgr_TypeOfPresentation3d theTypeOfPresentation)
24 : Prs3d_Presentation (theStructManager),
25 myPresentation3d (thePrs)
27 if (theTypeOfPresentation == PrsMgr_TOP_ProjectorDependant)
28 SetVisual(Graphic3d_TOS_COMPUTED);
31 //=======================================================================
34 //=======================================================================
36 void PrsMgr_Prs::Compute()
38 myPresentation3d->Compute (this);
41 //=======================================================================
44 //=======================================================================
46 Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) {
47 return myPresentation3d->Compute(aProjector);
49 //=======================================================================
52 //=======================================================================
54 Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
55 const TColStd_Array2OfReal& AMatrix)
58 Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow());
59 TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3),
60 AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3),
61 AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3),
62 Precision::Angular(),Precision::Confusion());
63 Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf);
65 return myPresentation3d->Compute(aProjector,G);
68 //=======================================================================
71 //=======================================================================
73 void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
74 Handle(Graphic3d_Structure)& aGivenStruct)
76 myPresentation3d->Compute(aProjector,aGivenStruct);
80 //=======================================================================
83 //=======================================================================
85 void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
86 const TColStd_Array2OfReal& AMatrix,
87 Handle(Graphic3d_Structure)& aGivenStruct)
90 Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow());
91 TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3),
92 AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3),
93 AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3),
94 Precision::Angular(),Precision::Confusion());
95 Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf);
98 myPresentation3d->Compute(aProjector,G,aGivenStruct);