Advertisement
conception

paint

Nov 15th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public void paint(){
  2. final Canvas canvas = new Canvas();
  3. GraphicsContext gc = canvas.getGraphicsContext2D();
  4.  
  5. double mX = (canvas.getWidth() - 1) / (usa.maxLongitude - usa.minLongitude);
  6. double bX = -mX * usa.minLongitude;
  7. double mY = (canvas.getHeight() - 1) / (usa.minLatitude - usa.maxLatitude);
  8. double bY = -mY * usa.maxLatitude;
  9.  
  10. for (int i=0; i<usa.subregionCount; i++) {
  11. double xCoordinate[] = new double[usa.subregionList.get(i).pointCount];
  12. double yCoordinate[] = new double[usa.subregionList.get(i).pointCount];
  13.  
  14. for(int j=0; j<usa.subregionList.get(j).pointCount; j++) {
  15. xCoordinate[j] = mX * usa.subregionList.get(i).longitudes.get(j) + bX;
  16. yCoordinate[j] = mY * usa.subregionList.get(i).latitudes.get(j);
  17.  
  18. } //end for
  19. gc.strokePolygon(xCoordinate, yCoordinate, xCoordinate.length);
  20. } // end for
  21.  
  22. } // end paint
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement