Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void paint(){
- final Canvas canvas = new Canvas();
- GraphicsContext gc = canvas.getGraphicsContext2D();
- double mX = (canvas.getWidth() - 1) / (usa.maxLongitude - usa.minLongitude);
- double bX = -mX * usa.minLongitude;
- double mY = (canvas.getHeight() - 1) / (usa.minLatitude - usa.maxLatitude);
- double bY = -mY * usa.maxLatitude;
- for (int i=0; i<usa.subregionCount; i++) {
- double xCoordinate[] = new double[usa.subregionList.get(i).pointCount];
- double yCoordinate[] = new double[usa.subregionList.get(i).pointCount];
- for(int j=0; j<usa.subregionList.get(j).pointCount; j++) {
- xCoordinate[j] = mX * usa.subregionList.get(i).longitudes.get(j) + bX;
- yCoordinate[j] = mY * usa.subregionList.get(i).latitudes.get(j);
- } //end for
- gc.strokePolygon(xCoordinate, yCoordinate, xCoordinate.length);
- } // end for
- } // end paint
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement