import com.c5corp.c5utm.*; import java.util.Vector; import java.sql.Connection; /** * Driver program utilized to discover the "Other Remote Locations" * Makes use of the C5 Landscape Database API 2.0. * Brett Stalbaum, 2005 */ public class FindSimilar { public static void main(String[] args) { // get a database connection Connection connection = DbHelper.getDbConnection(); // first, we need a StatisticalPoint as an input point // this is the SE corner of the remote location StatisticalPoint statPoint = C5UTM.getStatisticalPoint(12, 261186, 4558378, connection); System.out.println("Input point:"); System.out.println(statPoint); System.out.println(); Points points = C5UTM.getPoints( statPoint.getZone(), statPoint.getEasting() - 500, // need to center it statPoint.getNorthing() - 500, // in the image 1000, 1000, connection ); // create a UtmImage object, print the original image UtmImage image =new UtmImage(points, UtmImage.RENDER_HIGH | UtmImage.RENDER_LOW | UtmImage.RENDER_MEAN | UtmImage.RENDER_MEDIAN | UtmImage.RENDER_MODE, false); // write the image image.writeImageFile("" , "c5utm_img_remote_loc"); // local dir, file name // find the similar points Vector results = C5UTM.findSimilarPoints( statPoint, 1, connection ); // print the results, produce images for (int i=0; i < results.size(); i++) { System.out.println("Result " + (i+1) + ":"); System.out.println(results.get(i)); System.out.println(); // Get a Points object from the Database points = C5UTM.getPoints( results.get(i).getZone(), results.get(i).getEasting() - 500, // need to center it results.get(i).getNorthing() - 500, // in the image 1000, 1000, connection ); // create a UtmImage object image =new UtmImage(points, UtmImage.RENDER_HIGH | UtmImage.RENDER_LOW | UtmImage.RENDER_MEAN | UtmImage.RENDER_MEDIAN | UtmImage.RENDER_MODE, false); // write the images image.writeImageFile("" , "c5utm_img_" + (i+1)); // local dir, file name } // clean up the connection DbHelper.closeDbConnection(connection); } }