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.
17 #include <MeshVS_DataSource.hxx>
18 #include <MeshVS_Drawer.hxx>
19 #include <MeshVS_Mesh.hxx>
20 #include <MeshVS_PrsBuilder.hxx>
21 #include <Prs3d_Presentation.hxx>
22 #include <Prs3d_Root.hxx>
23 #include <SelectBasics_EntityOwner.hxx>
24 #include <SelectBasics_SensitiveEntity.hxx>
25 #include <Standard_Type.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient)
29 //================================================================
30 // Function : Constructor MeshVS_PrsBuilder
32 //================================================================
33 MeshVS_PrsBuilder::MeshVS_PrsBuilder ( const Handle(MeshVS_Mesh)& Parent,
34 const MeshVS_DisplayModeFlags& Flags,
35 const Handle(MeshVS_DataSource)& DS,
36 const Standard_Integer Id,
37 const MeshVS_BuilderPriority& Priority )
39 if (Id<0 && ! Parent.IsNull())
40 myId = Parent->GetFreeId();
44 myParentMesh = Parent.operator->();
49 myIsExcluding = Standard_False;
51 myPriority = Priority;
54 //================================================================
55 // Function : CustomDraw
57 //================================================================
58 void MeshVS_PrsBuilder::CustomBuild ( const Handle(Prs3d_Presentation)&,
59 const TColStd_PackedMapOfInteger&,
60 TColStd_PackedMapOfInteger&,
61 const Standard_Integer ) const
65 //================================================================
66 // Function : CustomSensitiveEntity
68 //================================================================
69 Handle( SelectBasics_SensitiveEntity ) MeshVS_PrsBuilder::CustomSensitiveEntity
70 ( const Handle( SelectBasics_EntityOwner )&,
71 const Standard_Integer ) const
76 //================================================================
77 // Function : DataSource
79 //================================================================
80 Handle (MeshVS_DataSource) MeshVS_PrsBuilder::DataSource () const
85 //================================================================
86 // Function : GetDataSource
88 //================================================================
89 Handle (MeshVS_DataSource) MeshVS_PrsBuilder::GetDataSource () const
91 if ( myDataSource.IsNull() )
92 return myParentMesh->GetDataSource();
97 //================================================================
98 // Function : SetDataSource
100 //================================================================
101 void MeshVS_PrsBuilder::SetDataSource ( const Handle (MeshVS_DataSource)& DS )
106 //================================================================
107 // Function : GetFlags
109 //================================================================
110 Standard_Integer MeshVS_PrsBuilder::GetFlags () const
115 //================================================================
118 //================================================================
119 Standard_Integer MeshVS_PrsBuilder::GetId () const
124 //================================================================
125 // Function : TestFlags
127 //================================================================
128 Standard_Boolean MeshVS_PrsBuilder::TestFlags ( const Standard_Integer DisplayMode ) const
130 return ( ( DisplayMode & GetFlags() ) > 0 );
133 //================================================================
134 // Function : SetExcluding
136 //================================================================
137 void MeshVS_PrsBuilder::SetExcluding ( const Standard_Boolean state )
139 myIsExcluding = state;
142 //================================================================
143 // Function : IsExcludingOn
145 //================================================================
146 Standard_Boolean MeshVS_PrsBuilder::IsExcludingOn () const
148 return myIsExcluding;
151 //================================================================
152 // Function : GetPriority
154 //================================================================
155 Standard_Integer MeshVS_PrsBuilder::GetPriority () const
160 //================================================================
161 // Function : GetDrawer
163 //================================================================
164 Handle (MeshVS_Drawer) MeshVS_PrsBuilder::GetDrawer () const
166 if ( myDrawer.IsNull() )
167 return myParentMesh->GetDrawer();
172 //================================================================
173 // Function : SetDataSource
175 //================================================================
176 void MeshVS_PrsBuilder::SetDrawer ( const Handle (MeshVS_Drawer)& Dr )
181 //================================================================
184 //================================================================
185 Handle (MeshVS_Drawer) MeshVS_PrsBuilder::Drawer () const
190 //================================================================
191 // Function : SetPresentationManager
192 // Purpose : Set presentation manager. This method is used by
193 // MeshVS_Mesh::Compute methodto assign presentation
194 // manager to the builder.
195 //================================================================
196 void MeshVS_PrsBuilder::SetPresentationManager( const Handle(PrsMgr_PresentationManager3d)& thePrsMgr )
198 myPrsMgr = thePrsMgr;
201 //================================================================
202 // Function : GetPresentationManager
203 // Purpose : Get presentation manager
204 //================================================================
205 Handle(PrsMgr_PresentationManager3d) MeshVS_PrsBuilder::GetPresentationManager() const