0028010: Visualization, Prs3d_Arrow - add Shading presentation builder
[occt.git] / src / Prs3d / Prs3d_Presentation.cxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <Prs3d_Presentation.hxx>
16
17 #include <Geom_Transformation.hxx>
18 #include <gp_Ax1.hxx>
19 #include <gp_Dir.hxx>
20 #include <gp_Pnt.hxx>
21 #include <gp_Trsf.hxx>
22 #include <gp_Vec.hxx>
23 #include <Graphic3d_DataStructureManager.hxx>
24 #include <Graphic3d_Group.hxx>
25 #include <Graphic3d_NameOfMaterial.hxx>
26 #include <Graphic3d_Structure.hxx>
27 #include <Graphic3d_StructureManager.hxx>
28 #include <Prs3d_Root.hxx>
29 #include <Standard_Real.hxx>
30 #include <Standard_Type.hxx>
31
32 IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure)
33
34 //=======================================================================
35 //function : Prs3d_Presentation
36 //purpose  :
37 //=======================================================================
38 Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer,
39                                         const Standard_Boolean                    theToInit)
40 : Graphic3d_Structure (theViewer)
41 {
42   if (!theToInit)
43   {
44     return;
45   }
46 }
47
48 //=======================================================================
49 //function : Prs3d_Presentation
50 //purpose  :
51 //=======================================================================
52 Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer,
53                                         const Handle(Prs3d_Presentation)&         thePrs)
54 : Graphic3d_Structure (theViewer, thePrs)
55 {
56   //
57 }
58
59
60 //=======================================================================
61 //function : Connect
62 //purpose  : 
63 //=======================================================================
64 void Prs3d_Presentation::Connect
65   ( const Handle(Prs3d_Presentation)& aPresentation) 
66 {
67   Graphic3d_Structure::Connect(aPresentation, Graphic3d_TOC_DESCENDANT);
68 }
69
70
71 //=======================================================================
72 //function : Remove
73 //purpose  : 
74 //=======================================================================
75 void Prs3d_Presentation::Remove (const Handle(Prs3d_Presentation)& aPresentation) 
76 {
77   Disconnect(aPresentation);
78 }
79
80 //=======================================================================
81 //function : RemoveAll
82 //purpose  : 
83 //=======================================================================
84 void Prs3d_Presentation::RemoveAll () 
85 {
86   DisconnectAll(Graphic3d_TOC_DESCENDANT);
87 }
88
89
90 //=======================================================================
91 //function : CurrentGroup
92 //purpose  : 
93 //=======================================================================
94 Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const 
95 {
96   if (Groups().IsEmpty())
97   {
98     return const_cast<Prs3d_Presentation* >(this)->NewGroup();
99   }
100   return Groups().Last();
101 }
102
103 //=======================================================================
104 //function : Compute
105 //purpose  : 
106 //=======================================================================
107
108 Handle(Graphic3d_Structure) Prs3d_Presentation::
109        Compute(const Handle(Graphic3d_DataStructureManager)& /*aProjector*/) 
110 {
111   return this;
112 }
113
114 //=======================================================================
115 //function : Compute
116 //purpose  : 
117 //=======================================================================
118
119 void Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& aDataStruct, 
120                                  Handle(Graphic3d_Structure)& aStruct)
121 {
122  Graphic3d_Structure::Compute(aDataStruct,aStruct );
123 }
124
125 //=======================================================================
126 //function : Compute
127 //purpose  :
128 //=======================================================================
129
130 Handle(Graphic3d_Structure) Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
131                                                          const Handle(Geom_Transformation)& theTrsf)
132 {
133   return Graphic3d_Structure::Compute (theDataStruc, theTrsf);
134 }
135
136 //=======================================================================
137 //function : Compute
138 //purpose  :
139 //=======================================================================
140
141 void Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
142                                   const Handle(Geom_Transformation)& theTrsf,
143                                   Handle(Graphic3d_Structure)& theStruc)
144 {
145   Graphic3d_Structure::Compute (theDataStruc, theTrsf, theStruc);
146 }