b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
2 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
3 | // |
4 | // The content of this file is subject to the Open CASCADE Technology Public |
5 | // License Version 6.5 (the "License"). You may not use the content of this file |
6 | // except in compliance with the License. Please obtain a copy of the License |
7 | // at http://www.opencascade.org and read it completely before using this file. |
8 | // |
9 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
10 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
11 | // |
12 | // The Original Code and all software distributed under the License is |
13 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
14 | // Initial Developer hereby disclaims all such warranties, including without |
15 | // limitation, any warranties of merchantability, fitness for a particular |
16 | // purpose or non-infringement. Please see the License for the specific terms |
17 | // and conditions governing the rights and limitations under the License. |
18 | |
7fd59977 |
19 | #include <PrsMgr_Prs.ixx> |
20 | #include <PrsMgr_Presentation3d.hxx> |
21 | #include <Precision.hxx> |
22 | #include <gp_Trsf.hxx> |
23 | #include <Geom_Transformation.hxx> |
24 | |
25 | PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& aStructureManager, |
26 | const PrsMgr_Presentation3dPointer& aPresentation3d, |
27 | const PrsMgr_TypeOfPresentation3d aTypeOfPresentation) |
28 | :Prs3d_Presentation(aStructureManager),myPresentation3d(aPresentation3d) |
29 | { |
30 | |
31 | if (aTypeOfPresentation == PrsMgr_TOP_ProjectorDependant) |
32 | SetVisual(Graphic3d_TOS_COMPUTED); |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : Compute |
37 | //purpose : |
38 | //======================================================================= |
39 | |
eb4320f2 |
40 | void PrsMgr_Prs::Compute() |
41 | { |
42 | myPresentation3d->Compute (this); |
43 | } |
44 | |
45 | //======================================================================= |
46 | //function : Compute |
47 | //purpose : |
48 | //======================================================================= |
49 | |
7fd59977 |
50 | Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) { |
51 | return myPresentation3d->Compute(aProjector); |
52 | } |
53 | //======================================================================= |
54 | //function : Compute |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, |
59 | const TColStd_Array2OfReal& AMatrix) |
60 | { |
61 | gp_Trsf TheTrsf; |
62 | Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow()); |
63 | TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3), |
64 | AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3), |
65 | AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3), |
66 | Precision::Angular(),Precision::Confusion()); |
67 | Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf); |
68 | |
69 | return myPresentation3d->Compute(aProjector,G); |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : Compute |
74 | //purpose : |
75 | //======================================================================= |
76 | |
77 | void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, |
78 | Handle(Graphic3d_Structure)& aGivenStruct) |
79 | { |
80 | myPresentation3d->Compute(aProjector,aGivenStruct); |
81 | } |
82 | |
83 | |
84 | //======================================================================= |
85 | //function : Compute |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, |
90 | const TColStd_Array2OfReal& AMatrix, |
91 | Handle(Graphic3d_Structure)& aGivenStruct) |
92 | { |
93 | gp_Trsf TheTrsf; |
94 | Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow()); |
95 | TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3), |
96 | AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3), |
97 | AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3), |
98 | Precision::Angular(),Precision::Confusion()); |
99 | Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf); |
100 | |
101 | |
102 | myPresentation3d->Compute(aProjector,G,aGivenStruct); |
103 | } |