+
+ public void setPath(Point[] path)
+ {
+ int diff = (path == null ? 0 : path.length) - (this.path == null ? 0 : this.path.length);
+ this.path = path == null ? null : path.clone();
+ recalculateEffectivePath();
+ callPathChangedListeners(diff);
+ callRedrawListeners();
+ }
+
+ public void setPathPoint(Point p, int index)
+ {
+ path[index] = p;
+ recalculateEffectivePath();
+ callPathChangedListeners(0);
+ callRedrawListeners();
+ }
+
+ public void insertPathPoint(Point p, int index)
+ {
+ Point[] path = getPath();
+ if (path == null)
+ setPath(new Point[] { p });
+ else
+ {
+ Point[] newPath = new Point[path.length + 1];
+ System.arraycopy(path, 0, newPath, 0, index);
+ if (index < path.length)
+ System.arraycopy(path, index, newPath, index + 1, path.length - index);
+ newPath[index] = p;
+ setPath(newPath);
+ }
+ }
+
+ public void removePathPoint(int index)
+ {
+ Point[] path = getPath();
+ Point[] newPath = new Point[path.length - 1];
+ System.arraycopy(path, 0, newPath, 0, index);
+ if (index < path.length - 1)
+ System.arraycopy(path, index + 1, newPath, index, path.length - index - 1);
+ setPath(newPath);
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException
+ */
+ public Point getPathPoint(int index)
+ {
+ return path[index];
+ }
+
+ public int getPathLength()
+ {
+ return path.length;
+ }
+
+ public double[] getEffectivePath()
+ {
+ return effectivePath.clone();
+ }