00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 import java.util.*;
00036 import java.awt.Color;
00037
00038
00039 public class Arc
00040 {
00041 public int from_node;
00042 public int to_node;
00043 public double f_x, f_y, f_z;
00044 public double t_x, t_y, t_z;
00045 public boolean is_oriented;
00046 public Color color;
00047 public int line_x1, line_x2;
00048 public int line_y1, line_y2;
00049 public int[] arrowhead_x_pts, arrowhead_y_pts;
00050
00051
00052 public Arc(int x_from, int y_from, int x_to, int y_to, Color c) {
00053 line_x1 = x_from;
00054 line_y1 = y_from;
00055 line_x2 = x_to;
00056 line_y2 = y_to;
00057 arrowhead_x_pts = new int[3];
00058 arrowhead_y_pts = new int[3];
00059 is_oriented = true;
00060 color = c;
00061 }
00062
00063
00064 public Arc(Network net, int f, int t) {
00065 from_node = f;
00066 to_node = t;
00067 arrowhead_x_pts = new int[3];
00068 arrowhead_y_pts = new int[3];
00069 is_oriented = false;
00070 color = TopologyPanel.arc_color;
00071
00072 Vector<Node> nv = net.getNodes();
00073 for (int i=0; i<nv.size(); i++) {
00074 Node n = (Node)nv.elementAt(i);
00075 if (n.getId() == from_node) {
00076 f_x = n.getX();
00077 f_y = n.getY();
00078 f_z = n.getZ();
00079 }
00080 if (n.getId() == to_node) {
00081 t_x = n.getX();
00082 t_y = n.getY();
00083 t_z = n.getZ();
00084 }
00085 }
00086 }
00087 }