CromleyInput.java
Gather user input for complex line and then generalize in heirarchical tree
Size 2.4 kB - File type text/plainFile contents
// Name: CromleyInput.java
// Intent: gather user input for complex line and then generalize in heirarchical tree
// Programmer: John P. Kavanagh #2748 2405
// Date Modified: 7 May 2002
// Audit: Clifford Meyers (cmeyers@buffalo.edu)
import java.io.*;
public class CromleyInput {
public CromleyInput () {
// Create complex line for generalization example
System.out.println("");
System.out.println("Generating geometric objects...");
System.out.println("");
Point pt1 = new Point(5671,5672);
Point pt2 = new Point(1112,2);
Point pt3 = new Point(3567,1);
Point pt4 = new Point(4,33456);
Point pt5 = new Point(5345345,345);
Point pt6 = new Point(6567,343);
Point pt7 = new Point(734,3453);
Point pt8 = new Point(834534,4654);
LineSegment segment1 = new LineSegment(pt1,pt2);
LineSegment segment2 = new LineSegment(pt2,pt3);
LineSegment segment3 = new LineSegment(pt3,pt4);
LineSegment segment4 = new LineSegment(pt4,pt5);
LineSegment segment5 = new LineSegment(pt5,pt6);
LineSegment segment6 = new LineSegment(pt6,pt7);
LineSegment segment7 = new LineSegment(pt7,pt8);
Line myLine = new Line();
myLine.AddLineSegment(segment1);
myLine.AddLineSegment(segment2);
myLine.AddLineSegment(segment3);
myLine.AddLineSegment(segment4);
myLine.AddLineSegment(segment5);
myLine.AddLineSegment(segment6);
myLine.AddLineSegment(segment7);
String userBandwidth = ""; // fathom criterion
InputStreamReader inReader;
BufferedReader bReader;
inReader = new InputStreamReader( System.in );
bReader = new BufferedReader (inReader);
System.out.println("");
System.out.println("Welcome to the GEO555 Cromley Line Generalization Tree.");
System.out.println("The algorithm will first populate the Heirarchical Line Simplification Tree.");
System.out.println("");
// Population simplification tree with a complex line
LineTree generalizeThis = new LineTree(myLine);
try {
System.out.print("\n");
System.out.print("The Tree will now be fathomed to the desired bandwidth.");
System.out.print("\n\n");
System.out.print("Please specify minimum bandwidth: ");
userBandwidth = bReader.readLine();
}
catch(IOException e) {
System.out.println("ERROR gathering user input.");
}
// Retrieve line points above minimum bandwidth
Fathom retrieveNodes = new Fathom(generalizeThis, userBandwidth);
}
}
Click here to get the file