Search in sources :

Example 1 with DefaultTileFactory

use of org.jxmapviewer.viewer.DefaultTileFactory in project bboxdb by jnidzwetzki.

the class OSMView method createMapViewer.

/**
 * Get an instance of the map viewer
 * @return
 */
protected JXMapViewer createMapViewer() {
    mapViewer = new JXMapViewer();
    // Create a TileFactoryInfo for OpenStreetMap
    final TileFactoryInfo info = new OSMTileFactoryInfo();
    final DefaultTileFactory tileFactory = new DefaultTileFactory(info);
    mapViewer.setTileFactory(tileFactory);
    final MouseInputListener mia = new PanMouseInputListener(mapViewer);
    mapViewer.addMouseListener(mia);
    mapViewer.addMouseMotionListener(mia);
    // Use 8 threads in parallel to load the tiles
    tileFactory.setThreadPoolSize(8);
    // Set the focus
    showHagen();
    // The KD Tree painter
    final OSMOverlayPainter kdosmPainter = new OSMOverlayPainter(guiModel);
    mapViewer.setOverlayPainter(kdosmPainter);
    return mapViewer;
}
Also used : JXMapViewer(org.jxmapviewer.JXMapViewer) PanMouseInputListener(org.jxmapviewer.input.PanMouseInputListener) DefaultTileFactory(org.jxmapviewer.viewer.DefaultTileFactory) PanMouseInputListener(org.jxmapviewer.input.PanMouseInputListener) MouseInputListener(javax.swing.event.MouseInputListener) OSMTileFactoryInfo(org.jxmapviewer.OSMTileFactoryInfo) TileFactoryInfo(org.jxmapviewer.viewer.TileFactoryInfo) OSMTileFactoryInfo(org.jxmapviewer.OSMTileFactoryInfo)

Aggregations

MouseInputListener (javax.swing.event.MouseInputListener)1 JXMapViewer (org.jxmapviewer.JXMapViewer)1 OSMTileFactoryInfo (org.jxmapviewer.OSMTileFactoryInfo)1 PanMouseInputListener (org.jxmapviewer.input.PanMouseInputListener)1 DefaultTileFactory (org.jxmapviewer.viewer.DefaultTileFactory)1 TileFactoryInfo (org.jxmapviewer.viewer.TileFactoryInfo)1