File: vtkSelectionRepresentation.cxx

package info (click to toggle)
paraview 5.1.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 221,108 kB
  • ctags: 236,092
  • sloc: cpp: 2,416,026; ansic: 190,891; python: 99,856; xml: 81,001; tcl: 46,915; yacc: 5,039; java: 4,413; perl: 3,108; sh: 1,974; lex: 1,926; f90: 748; asm: 471; pascal: 228; makefile: 198; objc: 83; fortran: 31
file content (282 lines) | stat: -rw-r--r-- 10,711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/*=========================================================================

  Program:   ParaView
  Module:    vtkSelectionRepresentation.cxx

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkSelectionRepresentation.h"

#include "vtkDataLabelRepresentation.h"
#include "vtkGeometryRepresentation.h"
#include "vtkInformation.h"
#include "vtkLabeledDataMapper.h"
#include "vtkMemberFunctionCommand.h"
#include "vtkObjectFactory.h"
#include "vtkView.h"

vtkStandardNewMacro(vtkSelectionRepresentation);
vtkCxxSetObjectMacro(vtkSelectionRepresentation, LabelRepresentation,
  vtkDataLabelRepresentation);
//----------------------------------------------------------------------------
vtkSelectionRepresentation::vtkSelectionRepresentation()
{
  this->GeometryRepresentation = vtkGeometryRepresentation::New();
  this->GeometryRepresentation->SetPickable(0);
  this->GeometryRepresentation->SetDebugString("vtkSelectionRepresentation");
  this->GeometryRepresentation->RequestGhostCellsIfNeededOff();

  this->LabelRepresentation = vtkDataLabelRepresentation::New();
  this->LabelRepresentation->SetPointLabelMode(VTK_LABEL_FIELD_DATA);
  this->LabelRepresentation->SetCellLabelMode(VTK_LABEL_FIELD_DATA);

  vtkCommand* observer = vtkMakeMemberFunctionCommand(*this,
    &vtkSelectionRepresentation::TriggerUpdateDataEvent);
  this->GeometryRepresentation->AddObserver(vtkCommand::UpdateDataEvent,
    observer);
  this->LabelRepresentation->AddObserver(vtkCommand::UpdateDataEvent,
    observer);
  observer->Delete();
}

//----------------------------------------------------------------------------
vtkSelectionRepresentation::~vtkSelectionRepresentation()
{
  this->GeometryRepresentation->Delete();
  this->LabelRepresentation->Delete();
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetInputConnection(
  int port, vtkAlgorithmOutput* input)
{
  this->GeometryRepresentation->SetInputConnection(port, input);
  this->LabelRepresentation->SetInputConnection(port, input);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetInputConnection(vtkAlgorithmOutput* input)
{
  this->GeometryRepresentation->SetInputConnection(input);
  this->LabelRepresentation->SetInputConnection(input);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::AddInputConnection(
  int port, vtkAlgorithmOutput* input)
{
  this->GeometryRepresentation->AddInputConnection(port, input);
  this->LabelRepresentation->AddInputConnection(port, input);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::AddInputConnection(vtkAlgorithmOutput* input)
{
  this->GeometryRepresentation->AddInputConnection(input);
  this->LabelRepresentation->AddInputConnection(input);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::RemoveInputConnection(
  int port, vtkAlgorithmOutput* input)
{
  this->GeometryRepresentation->RemoveInputConnection(port, input);
  this->LabelRepresentation->RemoveInputConnection(port, input);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::RemoveInputConnection(
  int port, int idx)
{
  this->GeometryRepresentation->RemoveInputConnection(port, idx);
  this->LabelRepresentation->RemoveInputConnection(port, idx);
}


//----------------------------------------------------------------------------
int vtkSelectionRepresentation::FillInputPortInformation(
  int vtkNotUsed(port), vtkInformation* info)
{
  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataObject");
  info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
  return 1;
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetUpdateTime(double val)
{
  this->GeometryRepresentation->SetUpdateTime(val);
  this->LabelRepresentation->SetUpdateTime(val);
  this->Superclass::SetUpdateTime(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetForceUseCache(bool val)
{
  this->GeometryRepresentation->SetForceUseCache(val);
  this->LabelRepresentation->SetForceUseCache(val);
  this->Superclass::SetForceUseCache(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetForcedCacheKey(double val)
{
  this->GeometryRepresentation->SetForcedCacheKey(val);
  this->LabelRepresentation->SetForcedCacheKey(val);
  this->Superclass::SetForcedCacheKey(val);
}

//----------------------------------------------------------------------------
bool vtkSelectionRepresentation::AddToView(vtkView* view)
{
  view->AddRepresentation(this->GeometryRepresentation);
  view->AddRepresentation(this->LabelRepresentation);
  return this->Superclass::AddToView(view);
}

//----------------------------------------------------------------------------
bool vtkSelectionRepresentation::RemoveFromView(vtkView* view)
{
  view->RemoveRepresentation(this->GeometryRepresentation);
  view->RemoveRepresentation(this->LabelRepresentation);
  return this->Superclass::RemoveFromView(view);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::MarkModified()
{
  this->GeometryRepresentation->MarkModified();
  this->LabelRepresentation->MarkModified();
  this->Superclass::MarkModified();
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::TriggerUpdateDataEvent()
{
  //we need to mark the geometry as always needing to be moved. The reason
  //is that in client server mode and the first interaction with the renderer
  //is a selection the geometryrepr is properly marked for modification.
  //this shouldn't degrade preformance as the geometryRepr in most other
  //cases is already dirty ( Bug #11587)
  this->GeometryRepresentation->MarkModified();

  // We fire UpdateDataEvent to notify the representation proxy that the
  // representation was updated. The representation proxty will then call
  // PostUpdateData(). We do this since now representations are not updated at
  // the proxy level.
  this->InvokeEvent(vtkCommand::UpdateDataEvent);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os, indent);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetColor(double r, double g, double b)
{
  this->GeometryRepresentation->SetColor(r, g, b);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetLineWidth(double val)
{
  this->GeometryRepresentation->SetLineWidth(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetOpacity(double val)
{
  this->GeometryRepresentation->SetOpacity(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetPointSize(double val)
{
  this->GeometryRepresentation->SetPointSize(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetVisibility(bool val)
{
  this->GeometryRepresentation->SetVisibility(val);
  this->LabelRepresentation->SetVisibility(val);
  this->Superclass::SetVisibility(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetUseOutline(int val)
{
  this->GeometryRepresentation->SetUseOutline(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetRepresentation(int val)
{
  this->GeometryRepresentation->SetRepresentation(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetOrientation(double x, double y, double z)
{
  this->GeometryRepresentation->SetOrientation(x, y, z);
  this->LabelRepresentation->SetOrientation(x, y, z);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetOrigin(double x, double y, double z)
{
  this->GeometryRepresentation->SetOrigin(x, y, z);
  this->LabelRepresentation->SetOrigin(x, y, z);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetPosition(double x, double y, double z)
{
  this->GeometryRepresentation->SetPosition(x, y, z);
  this->LabelRepresentation->SetPosition(x, y, z);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetScale(double x, double y, double z)
{
  this->GeometryRepresentation->SetScale(x, y, z);
  this->LabelRepresentation->SetScale(x, y, z);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetUserTransform(const double matrix[16])
{
  this->GeometryRepresentation->SetUserTransform(matrix);
  this->LabelRepresentation->SetUserTransform(matrix);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetPointFieldDataArrayName(const char* val)
{
  this->LabelRepresentation->SetPointFieldDataArrayName(val);
}

//----------------------------------------------------------------------------
void vtkSelectionRepresentation::SetCellFieldDataArrayName(const char* val)
{
  this->LabelRepresentation->SetCellFieldDataArrayName(val);
}
//----------------------------------------------------------------------------
unsigned int vtkSelectionRepresentation::Initialize(unsigned int minIdAvailable,
                                                    unsigned int maxIdAvailable)
{
  unsigned int minId = minIdAvailable;
  minId = this->LabelRepresentation->Initialize(minId, maxIdAvailable);
  minId = this->GeometryRepresentation->Initialize(minId, maxIdAvailable);

  return  this->Superclass::Initialize(minId, maxIdAvailable);
}