public void zoomToGarminGeo(double factor, int longitude, int latitude) { Point2D.Double mapCoord = new Point2D.Double(); COORD tempCoord = transformer.createTempCoord(); transformer.wgs84ToMap( CoordUtils.toWGS84Rad(longitude), CoordUtils.toWGS84Rad(latitude), tempCoord, mapCoord); zoom(factor, (int) mapCoord.getX(), (int) mapCoord.getY()); }
/** Zoom and position the map in order to see everything. */ public void showAllMap() { transformer.resetAutoScale(); try { transformer.adjustAutoScaleFromWgs84( CoordUtils.toWGS84Rad(map.getMinLongitude()), CoordUtils.toWGS84Rad(map.getMinLatitude())); transformer.adjustAutoScaleFromWgs84( CoordUtils.toWGS84Rad(map.getMaxLongitude()), CoordUtils.toWGS84Rad(map.getMaxLatitude())); } catch (IOException e) { e.printStackTrace(); } transformer.fixAspectRatio(); transformerChanged(); }