View Javadoc
1 package edu.psu.geovista.app.intersection; 2 import java.util.Vector; 3 /*** 4 * Title: 5 * Description: 6 * Copyright: Copyright (c) 2002 7 * Company: 8 * @author 9 * @version 1.0 10 */ 11 12 public class createarea { 13 14 public createarea() { 15 } 16 /* 17 makes the area by joining the adjacent points. 18 The return is a vector of lines that make the area. 19 The vector has a structure (x1,x2,y1,y2) where all are double. 20 The return vector will have a size one more than number of points 21 */ 22 public Vector makeArea(Vector points){ 23 Vector temp; 24 Vector lines= new Vector(); 25 int noOfPoints = points.size(); 26 int noOfLines = noOfPoints + 1; 27 // connecting to the next point till we reach the last point 28 for(int i=0; i< noOfPoints-1; i++){ 29 temp = new Vector(); 30 temp.add(((Vector)points.elementAt(i)).elementAt(1)); 31 temp.add(((Vector)points.elementAt(i + 1)).elementAt(1)); 32 temp.add(((Vector)points.elementAt(i)).elementAt(2)); 33 temp.add(((Vector)points.elementAt(i + 1)).elementAt(2)); 34 lines.add(temp); 35 } 36 temp = new Vector(); 37 // connecting to the first point. 38 temp.add(((Vector)points.elementAt(noOfPoints)).elementAt(1)); 39 temp.add(((Vector)points.elementAt(0)).elementAt(1)); 40 temp.add(((Vector)points.elementAt(noOfPoints)).elementAt(2)); 41 temp.add(((Vector)points.elementAt(0)).elementAt(2)); 42 lines.add(temp); 43 if (noOfLines!=lines.size()) 44 System.out.println("Error"); 45 return lines; 46 } 47 48 }

This page was automatically generated by Maven