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

Method MouseDoubleClickEvent

Views/Infovis/vtkDendrogramItem.cxx:771–813  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

769
770//------------------------------------------------------------------------------
771bool vtkDendrogramItem::MouseDoubleClickEvent(const vtkContextMouseEvent& event)
772{
773 // get the position of the double click and convert it to scene coordinates
774 double pos[3];
775 vtkNew<vtkMatrix3x3> inverse;
776 pos[0] = event.GetPos().GetX();
777 pos[1] = event.GetPos().GetY();
778 pos[2] = 0;
779 this->GetScene()->GetTransform()->GetInverse(inverse);
780 inverse->MultiplyPoint(pos, pos);
781
782 bool rotatedTree = false;
783 int orientation = this->GetOrientation();
784 if (orientation == vtkDendrogramItem::UP_TO_DOWN || orientation == vtkDendrogramItem::DOWN_TO_UP)
785 {
786 rotatedTree = true;
787 }
788
789 // this event is only captured within the tree (not the vertex labels)
790 if ((!rotatedTree && pos[0] <= this->MaxX && pos[0] >= this->MinX) ||
791 (rotatedTree && pos[1] <= this->MaxY && pos[1] >= this->MinY))
792 {
793 vtkIdType collapsedSubTree = this->GetClickedCollapsedSubTree(pos[0], pos[1]);
794 if (collapsedSubTree != -1)
795 {
796 // re-expand the subtree rooted at this vertex
797 this->ExpandSubTree(collapsedSubTree);
798 }
799 else
800 {
801 // collapse the subtree rooted at this vertex
802 vtkIdType closestVertex =
803 this->GetClosestVertex((pos[0] - this->Position[0]) / this->MultiplierX,
804 (pos[1] - this->Position[1]) / this->MultiplierY);
805 this->CollapseSubTree(closestVertex);
806 }
807
808 this->Scene->SetDirty(true);
809 return true;
810 }
811
812 return false;
813}
814
815//------------------------------------------------------------------------------
816vtkIdType vtkDendrogramItem::GetClickedCollapsedSubTree(double x, double y)

Callers

nothing calls this directly

Calls 11

GetOrientationMethod · 0.95
ExpandSubTreeMethod · 0.95
GetClosestVertexMethod · 0.95
CollapseSubTreeMethod · 0.95
SetDirtyMethod · 0.80
GetXMethod · 0.45
GetInverseMethod · 0.45
GetTransformMethod · 0.45
GetSceneMethod · 0.45
MultiplyPointMethod · 0.45

Tested by

no test coverage detected