1 // Created on: 2003-09-09
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <MeshVS_PrsBuilder.hxx>
18 #include <MeshVS_DataSource.hxx>
19 #include <MeshVS_Drawer.hxx>
20 #include <MeshVS_Mesh.hxx>
21 #include <Prs3d_Presentation.hxx>
22 #include <Prs3d_Root.hxx>
23 #include <Select3D_SensitiveEntity.hxx>
25 IMPLEMENT_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient)
27 //================================================================
28 // Function : Constructor MeshVS_PrsBuilder
30 //================================================================
31 MeshVS_PrsBuilder::MeshVS_PrsBuilder ( const Handle(MeshVS_Mesh)& Parent,
32 const MeshVS_DisplayModeFlags& Flags,
33 const Handle(MeshVS_DataSource)& DS,
34 const Standard_Integer Id,
35 const MeshVS_BuilderPriority& Priority )
37 if (Id<0 && ! Parent.IsNull())
38 myId = Parent->GetFreeId();
42 myParentMesh = Parent.operator->();
47 myIsExcluding = Standard_False;
49 myPriority = Priority;
52 //================================================================
53 // Function : CustomDraw
55 //================================================================
56 void MeshVS_PrsBuilder::CustomBuild ( const Handle(Prs3d_Presentation)&,
57 const TColStd_PackedMapOfInteger&,
58 TColStd_PackedMapOfInteger&,
59 const Standard_Integer ) const
63 //================================================================
64 // Function : CustomSensitiveEntity
66 //================================================================
67 Handle( Select3D_SensitiveEntity ) MeshVS_PrsBuilder::CustomSensitiveEntity
68 ( const Handle(SelectMgr_EntityOwner)&,
69 const Standard_Integer ) const
74 //================================================================
75 // Function : DataSource
77 //================================================================
78 Handle (MeshVS_DataSource) MeshVS_PrsBuilder::DataSource () const
83 //================================================================
84 // Function : GetDataSource
86 //================================================================
87 Handle (MeshVS_DataSource) MeshVS_PrsBuilder::GetDataSource () const
89 if ( myDataSource.IsNull() )
90 return myParentMesh->GetDataSource();
95 //================================================================
96 // Function : SetDataSource
98 //================================================================
99 void MeshVS_PrsBuilder::SetDataSource ( const Handle (MeshVS_DataSource)& DS )
104 //================================================================
105 // Function : GetFlags
107 //================================================================
108 Standard_Integer MeshVS_PrsBuilder::GetFlags () const
113 //================================================================
116 //================================================================
117 Standard_Integer MeshVS_PrsBuilder::GetId () const
122 //================================================================
123 // Function : TestFlags
125 //================================================================
126 Standard_Boolean MeshVS_PrsBuilder::TestFlags ( const Standard_Integer DisplayMode ) const
128 return ( ( DisplayMode & GetFlags() ) > 0 );
131 //================================================================
132 // Function : SetExcluding
134 //================================================================
135 void MeshVS_PrsBuilder::SetExcluding ( const Standard_Boolean state )
137 myIsExcluding = state;
140 //================================================================
141 // Function : IsExcludingOn
143 //================================================================
144 Standard_Boolean MeshVS_PrsBuilder::IsExcludingOn () const
146 return myIsExcluding;
149 //================================================================
150 // Function : GetPriority
152 //================================================================
153 Standard_Integer MeshVS_PrsBuilder::GetPriority () const
158 //================================================================
159 // Function : GetDrawer
161 //================================================================
162 Handle (MeshVS_Drawer) MeshVS_PrsBuilder::GetDrawer () const
164 if ( myDrawer.IsNull() )
165 return myParentMesh->GetDrawer();
170 //================================================================
171 // Function : SetDataSource
173 //================================================================
174 void MeshVS_PrsBuilder::SetDrawer ( const Handle (MeshVS_Drawer)& Dr )
179 //================================================================
182 //================================================================
183 Handle (MeshVS_Drawer) MeshVS_PrsBuilder::Drawer () const
188 //================================================================
189 // Function : SetPresentationManager
190 // Purpose : Set presentation manager. This method is used by
191 // MeshVS_Mesh::Compute methodto assign presentation
192 // manager to the builder.
193 //================================================================
194 void MeshVS_PrsBuilder::SetPresentationManager( const Handle(PrsMgr_PresentationManager3d)& thePrsMgr )
196 myPrsMgr = thePrsMgr;
199 //================================================================
200 // Function : GetPresentationManager
201 // Purpose : Get presentation manager
202 //================================================================
203 Handle(PrsMgr_PresentationManager3d) MeshVS_PrsBuilder::GetPresentationManager() const