?? polyline.java
字號:
import java.util.*;
public class PolyLine
{
// Construct a polyline from an array of points
public PolyLine(Point[] points)
{
// Add the points
for(int i = 0; i < points.length; i++)
polyline.add(points[i]);
}
// Construct a polyline from an array of coordinate
public PolyLine(double[][] coords)
{
// Add the points
for(int i = 0; i < coords.length; i++)
polyline.add(new Point(coords[i][0], coords[i][1]));
}
// Add a Point object to the list
public void addPoint(Point point)
{
polyline.add(point); // Add the new point
}
// Add a point to the list
public void addPoint(double x, double y)
{
polyline.add(new Point(x, y));
}
// String representation of a polyline
public String toString()
{
StringBuffer str = new StringBuffer("Polyline:");
Iterator points = polyline.iterator(); // Get an iterator
while(points.hasNext())
str.append(" "+ (Point)points.next()); // Append the current point
return str.toString();
}
private LinkedList polyline = new LinkedList(); // Stores points for polyline
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -