jmapviewer

How to add lat/lon grid lines to JMapViewer

亡梦爱人 提交于 2019-12-11 04:35:44
问题 When using JMapViewer, is there any way to automatically display lat/lon grid lines? The JMapViewer.setTileGridVisible method is unfortunately not the same thing. I know it's possible to do it manually, but then I have to figure out when to display what resolutions, etc. Sounds like a pain. 回答1: As an alternative, you can override mouseMoved() in DefaultMapController using the approach shown here. In the handler, you can update a label or set a tooltip, for example: new DefaultMapController

JMapViewer, load raster to a position

萝らか妹 提交于 2019-12-08 12:52:37
问题 I would like to load and display a raster file over the map in the JMapViewer. The raster file: should be loaded at a specific position, size dynamically changes using the zoom operations, I hope these operations are supported by JMapViewer. Currently, I am using a class derived from the MapMarkerCircle: public class ImageViewer extends MapMarkerCircle implements MapMarker { private BufferedImage img; public ImageViewer(Coordinate position, BufferedImage img) { this(position, 1, img);} public

how can i get the mouse click position from my JMapViewer world map

烈酒焚心 提交于 2019-12-07 12:51:49
问题 Im using the JMapViewer jar to show the world map on a JPanel. On the map im adding MapMarkerDot's which are gps points. The problem is when i click a MapMarkerDot on the map i cannot find an interface or listener to catch the click and give me the clicked MapMarkerDot identity. has anyone here worked with the code or can give me some ideas what to do. I would not like to modify the jar source but maybe i have to input an interface. I know this is kind of an abstract question but hoping for

Creating offline map tiles for JMapViewer

旧街凉风 提交于 2019-12-02 17:37:22
问题 I want to create offline map tiles for JMapViewer from an image. How may I be able to achieve it? What are the tools used to generate those tiles? 回答1: There are different ways to reach that goal. All of them make use of an external toolchain: 1. Offline renderer This is a bit more complex, as you need to use a renderer, a map style and OSM data packages to render your own map tiles on your box. A first simple way is to make use of Maperitive as it's very easy to configure and comes with

Creating offline map tiles for JMapViewer

冷暖自知 提交于 2019-12-02 10:22:01
I want to create offline map tiles for JMapViewer from an image. How may I be able to achieve it? What are the tools used to generate those tiles? There are different ways to reach that goal. All of them make use of an external toolchain: 1. Offline renderer This is a bit more complex, as you need to use a renderer, a map style and OSM data packages to render your own map tiles on your box. A first simple way is to make use of Maperitive as it's very easy to configure and comes with styles. More advanced, you can setup a whole OSM rendering stack (Mapnik, PostgreSQL DB, osmosis, ...) so please

Draw Polyline in JMapViewer [closed]

房东的猫 提交于 2019-12-02 01:56:03
I'm working with OpenStreetMap in Java with JMapViewer. I can draw polygon and rectangle using JMapViewer, but how to draw polyline? Thank you. You could create your own implementation of a polyline. Below is an example that is based on existing MapPolygonImpl . It is hacky, but there seem to be no method in JMapViewer to add lines. import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Path2D; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.openstreetmap.gui.jmapviewer

How can I update JPanel continuously?

≯℡__Kan透↙ 提交于 2019-11-28 14:39:24
I've got a slight problem, I'm writing a gps tracking app to track several objects at once. The data comes in over a serial interface, this is coming in fine from what I can tell. The issue is that I need to continually update the JPanel where the map is created and displayed. public JPanel mapDisplay(){ JPanel mapPanel = new JPanel(); mapPanel.setSize(560, 540); Coordinate start = new Coordinate (-34.9286, 138.6); trackMap.addMapMarker(new MapMarkerDot(1Lat, 1Lon)); trackMap.setDisplayPosition(start,8); System.out.println(1Lat); mapPanel.add(trackMap); mapPanel.setVisible(true); return

JPanel with anonymous EventListener - why doesn't GC destroy listener?

萝らか妹 提交于 2019-11-28 14:17:26
I have been perusing the open source code of JMapViewer . If anyone else wishes to look at it, check the SVN . In a nutshell, the main class is JMapViewer , which is an extension of a JPanel . There is another very important class called DefaultMapController which acts as a MouseListener for the main class. The first weird thing I noticed is that the viewer has no references to the controller. The JMapViewer constructor instantiates an anonymous instance of the DefaultMapController , like this: public JMapViewer() { // other stuff new DefaultMapController(this); } This seems to me to be a poor

How can I highlight a MapMarkerDot in Openstreetmap?

独自空忆成欢 提交于 2019-11-28 11:12:25
问题 I used code from http://svn.openstreetmap.org/applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java to get a map up and running for my swing application. I added a few MapMarkerDot to indicate some points in my map and used how can i get the mouse click position from my JMapViewer world map to identify whether a point has been selected but how can I actually show that a particular MapMarkerDot has been selected? I want to add some kind of border similar to http://bikes

JPanel with anonymous EventListener - why doesn't GC destroy listener?

时光怂恿深爱的人放手 提交于 2019-11-27 08:12:18
问题 I have been perusing the open source code of JMapViewer. If anyone else wishes to look at it, check the SVN. In a nutshell, the main class is JMapViewer , which is an extension of a JPanel . There is another very important class called DefaultMapController which acts as a MouseListener for the main class. The first weird thing I noticed is that the viewer has no references to the controller. The JMapViewer constructor instantiates an anonymous instance of the DefaultMapController , like this: