32 TGraphEdge::TGraphEdge(): TObject(), TAttLine()
47 TGraphEdge::TGraphEdge(TGraphNode *n1, TGraphNode *n2)
48 :TObject(), TAttLine()
63 TGraphEdge::~TGraphEdge()
65 if (fNode1)
delete fNode1;
66 if (fNode2)
delete fNode2;
67 if (fX) {
delete [] fX; fX = 0; }
68 if (fY) {
delete [] fY; fY = 0; }
69 if (fN) {
delete [] fN; fN = 0; }
75 void TGraphEdge::CreateGVEdge(GVizAgraph_t *gv)
78 Agnode_t *n1 = (Agnode_t*)fNode1->GetGVNode();
79 Agnode_t *n2 = (Agnode_t*)fNode2->GetGVNode();
81 fGVEdge = (GVizAgedge_t*)agedge((Agraph_t *)gv, n1, n2, NULL, 1);
83 fGVEdge = (GVizAgedge_t*)agedge((Agraph_t *)gv, n1, n2);
86 Error(
"CreateGVEdge",
"Invalid graphviz graph");
93 Int_t TGraphEdge::DistancetoPrimitive(Int_t px, Int_t py)
100 for (i=1; i<=fN[0]; i++) {
102 polyline =
new TPolyLine(n, &fX[a], &fY[a],
"L");
103 dist = polyline->DistancetoPrimitive(px, py);
113 void TGraphEdge::ExecuteEvent(Int_t event, Int_t px, Int_t py)
120 for (i=1; i<=fN[0]; i++) {
122 polyline =
new TPolyLine(n, &fX[a], &fY[a],
"L");
123 polyline->ExecuteEvent(event, px, py);
132 void TGraphEdge::Layout()
137 if (fX) {
delete [] fX; fX = 0; }
138 if (fY) {
delete [] fY; fY = 0; }
139 if (fN) {
delete [] fN; fN = 0; }
141 Int_t np = ED_spl((Agedge_t*)fGVEdge)->size;
142 fN =
new Int_t[np+1];
147 for (i=0; i<np; i++) {
148 bz = ED_spl((Agedge_t*)fGVEdge)->list[i];
154 fX =
new Double_t[nb];
155 fY =
new Double_t[nb];
159 for (i=0; i<np; i++) {
160 bz = ED_spl((Agedge_t*)fGVEdge)->list[i];
163 for (j=0; j<fN[i+1]; j++) {
164 fX[k] = bz.list[j].x;
165 fY[k] = bz.list[j].y;
174 void TGraphEdge::Paint(Option_t *)
181 graph.SetLineColor(GetLineColor());
182 graph.SetLineStyle(GetLineStyle());
183 graph.SetLineWidth(GetLineWidth());
185 arrow.SetFillColor(GetLineColor());
186 arrow.SetLineColor(GetLineColor());
190 for (i=1; i<=fN[0]; i++) {
194 graph.PaintGraph(n, &fX[a], &fY[a],
"L");
197 arrow.PaintArrow(fX[a+n-1], fY[a+n-1], fArrX, fArrY, 0.03,
"|>");
206 void TGraphEdge::SavePrimitive(std::ostream &, Option_t *)
214 void TGraphEdge::SaveAttributes(std::ostream &out,
const char* name)
216 SaveLineAttributes(out,name,1,1,1);
221 void TGraphEdge::Streamer(TBuffer &)