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

Method OnMouseMove

Views/Infovis/vtkInteractorStyleTreeMapHover.cxx:200–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void vtkInteractorStyleTreeMapHover::OnMouseMove()
201{
202 int x = this->Interactor->GetEventPosition()[0];
203 int y = this->Interactor->GetEventPosition()[1];
204 this->FindPokedRenderer(x, y);
205 vtkRenderer* r = this->CurrentRenderer;
206 if (r == nullptr)
207 {
208 return;
209 }
210
211 if (!r->HasViewProp(this->Balloon))
212 {
213 r->AddActor(this->Balloon);
214 this->Balloon->SetRenderer(r);
215 }
216
217 // Use the hardware picker to find a point in world coordinates.
218 float binfo[4];
219 vtkIdType id = this->GetTreeMapIdAtPos(x, y);
220
221 if (id != -1)
222 {
223 this->GetBoundingBoxForTreeMapItem(id, binfo);
224 }
225
226 double loc[2] = { static_cast<double>(x), static_cast<double>(y) };
227 this->Balloon->EndWidgetInteraction(loc);
228
229 if ((this->Layout != nullptr) && (this->Layout->GetOutput() != nullptr))
230 {
231
232 vtkAbstractArray* absArray =
233 this->Layout->GetOutput()->GetVertexData()->GetAbstractArray(this->LabelField);
234 if (absArray != nullptr && id > -1)
235 {
236 std::string str;
237 if (vtkArrayDownCast<vtkStringArray>(absArray))
238 {
239 str = vtkArrayDownCast<vtkStringArray>(absArray)->GetValue(id);
240 }
241 if (vtkArrayDownCast<vtkDataArray>(absArray))
242 {
243 str = vtkVariant(vtkArrayDownCast<vtkDataArray>(absArray)->GetTuple(id)[0]).ToString();
244 }
245 this->Balloon->SetBalloonText(str.c_str());
246 vtkTree* tree = this->Layout->GetOutput();
247 double z;
248 if (this->TreeMapToPolyData != nullptr)
249 {
250 z = this->TreeMapToPolyData->GetLevelDeltaZ() * (tree->GetLevel(id) + 1);
251 }
252 else
253 {
254 z = 0.02;
255 }
256 this->HighlightPoints->SetPoint(0, binfo[0], binfo[2], z);
257 this->HighlightPoints->SetPoint(1, binfo[1], binfo[2], z);

Callers

nothing calls this directly

Calls 15

GetTreeMapIdAtPosMethod · 0.95
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
vtkVariantClass · 0.50
FindPokedRendererMethod · 0.45
HasViewPropMethod · 0.45
AddActorMethod · 0.45
SetRendererMethod · 0.45
EndWidgetInteractionMethod · 0.45

Tested by

no test coverage detected