0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / MeshVS / MeshVS_PrsBuilder.cxx
CommitLineData
b311480e 1// Created on: 2003-09-09
2// Created by: Alexander SOLOVYOV
973c2be1 3// Copyright (c) 2003-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
42cf5bc1 17#include <MeshVS_DataSource.hxx>
18#include <MeshVS_Drawer.hxx>
7fd59977 19#include <MeshVS_Mesh.hxx>
42cf5bc1 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>
7fd59977 26
25e59720 27IMPLEMENT_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient)
92efcf78 28
7fd59977 29//================================================================
30// Function : Constructor MeshVS_PrsBuilder
31// Purpose :
32//================================================================
33MeshVS_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 )
38{
c04c30b3 39 if (Id<0 && ! Parent.IsNull())
7fd59977 40 myId = Parent->GetFreeId();
41 else
42 myId = Id;
43
44 myParentMesh = Parent.operator->();
45 myDataSource = DS;
46 myDrawer = 0;
47
48 myFlags = Flags;
49 myIsExcluding = Standard_False;
50
51 myPriority = Priority;
52}
53
54//================================================================
55// Function : CustomDraw
56// Purpose :
57//================================================================
58void MeshVS_PrsBuilder::CustomBuild ( const Handle(Prs3d_Presentation)&,
59 const TColStd_PackedMapOfInteger&,
60 TColStd_PackedMapOfInteger&,
61 const Standard_Integer ) const
62{
63}
64
65//================================================================
66// Function : CustomSensitiveEntity
67// Purpose :
68//================================================================
69Handle( SelectBasics_SensitiveEntity ) MeshVS_PrsBuilder::CustomSensitiveEntity
70 ( const Handle( SelectBasics_EntityOwner )&,
71 const Standard_Integer ) const
72{
73 return 0;
74}
75
76//================================================================
77// Function : DataSource
78// Purpose :
79//================================================================
80Handle (MeshVS_DataSource) MeshVS_PrsBuilder::DataSource () const
81{
82 return myDataSource;
83}
84
85//================================================================
86// Function : GetDataSource
87// Purpose :
88//================================================================
89Handle (MeshVS_DataSource) MeshVS_PrsBuilder::GetDataSource () const
90{
91 if ( myDataSource.IsNull() )
92 return myParentMesh->GetDataSource();
93 else
94 return myDataSource;
95}
96
97//================================================================
98// Function : SetDataSource
99// Purpose :
100//================================================================
101void MeshVS_PrsBuilder::SetDataSource ( const Handle (MeshVS_DataSource)& DS )
102{
103 myDataSource = DS;
104}
105
106//================================================================
107// Function : GetFlags
108// Purpose :
109//================================================================
110Standard_Integer MeshVS_PrsBuilder::GetFlags () const
111{
112 return myFlags;
113}
114
115//================================================================
116// Function : GetId
117// Purpose :
118//================================================================
119Standard_Integer MeshVS_PrsBuilder::GetId () const
120{
121 return myId;
122}
123
124//================================================================
125// Function : TestFlags
126// Purpose :
127//================================================================
128Standard_Boolean MeshVS_PrsBuilder::TestFlags ( const Standard_Integer DisplayMode ) const
129{
130 return ( ( DisplayMode & GetFlags() ) > 0 );
131}
132
133//================================================================
134// Function : SetExcluding
135// Purpose :
136//================================================================
137void MeshVS_PrsBuilder::SetExcluding ( const Standard_Boolean state )
138{
139 myIsExcluding = state;
140}
141
142//================================================================
143// Function : IsExcludingOn
144// Purpose :
145//================================================================
146Standard_Boolean MeshVS_PrsBuilder::IsExcludingOn () const
147{
148 return myIsExcluding;
149}
150
151//================================================================
152// Function : GetPriority
153// Purpose :
154//================================================================
155Standard_Integer MeshVS_PrsBuilder::GetPriority () const
156{
157 return myPriority;
158}
159
160//================================================================
161// Function : GetDrawer
162// Purpose :
163//================================================================
164Handle (MeshVS_Drawer) MeshVS_PrsBuilder::GetDrawer () const
165{
166 if ( myDrawer.IsNull() )
167 return myParentMesh->GetDrawer();
168 else
169 return myDrawer;
170}
171
172//================================================================
173// Function : SetDataSource
174// Purpose :
175//================================================================
176void MeshVS_PrsBuilder::SetDrawer ( const Handle (MeshVS_Drawer)& Dr )
177{
178 myDrawer = Dr;
179}
180
181//================================================================
182// Function : Drawer
183// Purpose :
184//================================================================
185Handle (MeshVS_Drawer) MeshVS_PrsBuilder::Drawer () const
186{
187 return myDrawer;
188}
189
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//================================================================
196void MeshVS_PrsBuilder::SetPresentationManager( const Handle(PrsMgr_PresentationManager3d)& thePrsMgr )
197{
198 myPrsMgr = thePrsMgr;
199}
200
201//================================================================
202// Function : GetPresentationManager
203// Purpose : Get presentation manager
204//================================================================
205Handle(PrsMgr_PresentationManager3d) MeshVS_PrsBuilder::GetPresentationManager() const
206{
207 return myPrsMgr;
208}