Exemplo n.º 1
0
 public void setZoom(int zoom, Point mapPoint) {
   if (zoom > tileController.getTileSource().getMaxZoom()
       || zoom < tileController.getTileSource().getMinZoom()
       || zoom == this.zoom) return;
   Coordinate zoomPos = getPosition(mapPoint);
   tileController.cancelOutstandingJobs(); // Clearing outstanding load
   // requests
   setDisplayPositionByLatLon(mapPoint, zoomPos.getLat(), zoomPos.getLon(), zoom);
 }
Exemplo n.º 2
0
 public JMapViewer(TileCache tileCache, int downloadThreadCount) {
   super();
   tileController = new TileController(new OsmTileSource.Mapnik(), tileCache, this);
   mapChangeListenerList = new ArrayList<MapViewChangeListener>();
   overlayPainterList = new ArrayList<OverlayPainter>();
   mapMarkerList = new LinkedList<MapMarker>();
   mapRectangleList = new LinkedList<MapRectangle>();
   mapMarkersVisible = true;
   mapRectanglesVisible = true;
   tileGridVisible = false;
   setLayout(null);
   initializeZoomSlider();
   setMinimumSize(new Dimension(Tile.SIZE, Tile.SIZE));
   setPreferredSize(new Dimension(400, 400));
   setDisplayPositionByLatLon(50, 9, 3);
 }
Exemplo n.º 3
0
 /**
  * Changes the map pane so that it is centered on the specified coordinate at the given zoom
  * level.
  *
  * @param lat latitude of the specified coordinate
  * @param lon longitude of the specified coordinate
  * @param zoom {@link #MIN_ZOOM} <= zoom level <= {@link #MAX_ZOOM}
  */
 public void setDisplayPositionByLatLon(double lat, double lon, int zoom) {
   setDisplayPositionByLatLon(new Point(getWidth() / 2, getHeight() / 2), lat, lon, zoom);
 }