Skip to content
Snippets Groups Projects
Commit 8e2722f9 authored by Olivier Couet's avatar Olivier Couet
Browse files

- Edges can be picked and attributes changed.

git-svn-id: http://root.cern.ch/svn/root/trunk@30088 27541ba8-7e3a-0410-8455-c3a389f83636
parent 9d9ce0ab
Branches
Tags
No related merge requests found
......@@ -56,6 +56,7 @@ public:
void CreateGVEdge(Agraph_t *gv);
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
void SetGVEdge(Agedge_t *gve) {fGVEdge = gve;}
Agedge_t *GetGVEdge() {return fGVEdge;}
void Layout();
......
......@@ -11,6 +11,7 @@
#include "TGraph.h"
#include "TArrow.h"
#include "TPolyLine.h"
#include "TGraphEdge.h"
#include "TGraphNode.h"
......@@ -86,11 +87,42 @@ void TGraphEdge::CreateGVEdge(Agraph_t *gv)
//______________________________________________________________________________
Int_t TGraphEdge::DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)
Int_t TGraphEdge::DistancetoPrimitive(Int_t px, Int_t py)
{
// Compute distance from point px,py to an edge.
return 999;
Int_t i,n,a,dist=999;
TPolyLine *polyline;
a = 0;
for (i=1; i<=fN[0]; i++) {
n = fN[i];
polyline = new TPolyLine(n, &fX[a], &fY[a], "L");
dist = polyline->DistancetoPrimitive(px, py);
a = a+n;
}
return dist;
}
//______________________________________________________________________________
void TGraphEdge::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
// Execute action corresponding to one event.
Int_t i,n,a;
TPolyLine *polyline;
a = 0;
for (i=1; i<=fN[0]; i++) {
n = fN[i];
polyline = new TPolyLine(n, &fX[a], &fY[a], "L");
polyline->ExecuteEvent(event, px, py);
a = a+n;
}
}
......@@ -148,8 +180,12 @@ void TGraphEdge::Paint(Option_t *)
TArrow arrow;
TGraph graph;
graph.SetLineColor(GetLineColor());
graph.SetLineStyle(GetLineStyle());
graph.SetLineWidth(GetLineWidth());
arrow.SetAngle(38);
arrow.SetFillColor(GetLineColor());
arrow.SetLineColor(GetLineColor());
a = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment