MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdateWindowInfo

Method UpdateWindowInfo

Rendering/Label/vtkLabeledTreeMapDataMapper.cxx:183–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183int vtkLabeledTreeMapDataMapper::UpdateWindowInfo(vtkViewport* viewport)
184{
185 // Assumes that the view is not rotated w/r to the tree map!
186 int* dc;
187 float p[2][2];
188 this->VCoord->SetViewport(viewport);
189 // Transform 0,0 and 1,1 into screen coordinates
190 this->VCoord->SetValue(0.0, 0.0, 0.0);
191 dc = VCoord->GetComputedDisplayValue(nullptr);
192 p[0][0] = dc[0];
193 p[0][1] = dc[1];
194 this->VCoord->SetValue(1.0, 1.0, 0.0);
195 dc = this->VCoord->GetComputedDisplayValue(nullptr);
196 p[1][0] = dc[0];
197 p[1][1] = dc[1];
198
199 // The translation is defined by 0,0's new position
200 this->BoxTrans[0][0] = p[0][0];
201 this->BoxTrans[1][0] = p[0][1];
202
203 // The scales are defined as p[1] - p[0]
204 this->BoxTrans[0][1] = p[1][0] - p[0][0];
205 this->BoxTrans[1][1] = p[1][1] - p[0][1];
206
207 // Get the window extents
208 vtkWindow* win = viewport->GetVTKWindow();
209 const int* winPos = win->GetPosition();
210 this->WindowLimits[0][0] = winPos[0];
211 this->WindowLimits[1][0] = winPos[1];
212 const int* winSize = win->GetSize();
213 this->WindowLimits[0][1] = this->WindowLimits[0][0] + winSize[0];
214 this->WindowLimits[1][1] = this->WindowLimits[1][0] + winSize[1];
215
216 // We are done with the coordinate, so release the viewport
217 this->VCoord->SetViewport(nullptr);
218
219 // Ideally we can compare the new scales with the original and
220 // see if the change has exceeded some threshold - in that case
221 // we could return 0
222 return 1;
223}
224
225void vtkLabeledTreeMapDataMapper::GetVertexLabel(vtkIdType vertex, vtkDataArray* numericData,
226 vtkStringArray* stringData, int activeComp, int numComp, char* string, size_t stringSize)

Callers 1

RenderOpaqueGeometryMethod · 0.95

Calls 6

GetVTKWindowMethod · 0.80
SetViewportMethod · 0.45
SetValueMethod · 0.45
GetPositionMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected