jmapviewer

How to add a ToolTip to MapMarker in JMapViewer

余生长醉 提交于 2020-01-10 05:23:07
问题 I'm trying to add a ToolTip to a custom MapMarker on JMapViewer . But repeaded searches on are not helping me solve this. The custom MapMarker is: public class MapMarkerUnit extends MapObjectImpl implements MapMarker and the Paint Method overide is public void paint(Graphics g, Point position, int radio) { String filename = "marker.png"; //System.out.print(filename); BufferedImage x = null; try { x = ImageIO.read(getClass().getResource(filename)); } catch (IOException ex) { Logger.getLogger

JMapViewer, MouseListener called 2 times

≯℡__Kan透↙ 提交于 2019-12-30 11:09:43
问题 Working with JMapViewer, a strange behavior of the component was recognized. I am using DefaultMapController to get the map position (lat, lon). import java.awt.Graphics; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import org.openstreetmap.gui.jmapviewer.DefaultMapController; import org.openstreetmap.gui.jmapviewer.JMapViewer; public class Test extends JMapViewer{ public Test() { addMouseListener(new

How can I update JPanel continuously?

六月ゝ 毕业季﹏ 提交于 2019-12-29 02:01:06
问题 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

Java JMapViewer: How can I change the color of a MapPolygon?

我们两清 提交于 2019-12-24 17:01:03
问题 I'm creating an application for drawing pollution information on a JMapViewer. I want to do this with MapPolygons, but I didn't find a good documentation about it. I succeeded to create new MapPolygons like this: private MapPolygon getPolygon(double lat, double lon, Color col){ List<Coordinate> coords = new ArrayList<>(); //add all points to the list... MapPolygon poly = new MapPolygonImpl(coords); return poly; } I'm wondering how I could change the color and remove the border of the

Java JMapViewer: How can I change the color of a MapPolygon?

佐手、 提交于 2019-12-24 16:59:57
问题 I'm creating an application for drawing pollution information on a JMapViewer. I want to do this with MapPolygons, but I didn't find a good documentation about it. I succeeded to create new MapPolygons like this: private MapPolygon getPolygon(double lat, double lon, Color col){ List<Coordinate> coords = new ArrayList<>(); //add all points to the list... MapPolygon poly = new MapPolygonImpl(coords); return poly; } I'm wondering how I could change the color and remove the border of the

How can I ensure correct drawing order in an OverlayLayout?

六眼飞鱼酱① 提交于 2019-12-23 15:52:39
问题 I am using a JPanel with an OverlayLayout to draw two unrelated components on top of each other. Specifically, I have a transparent component which contains my own line drawings, and beneath that, I am using a JMapViewer component, which displays OpenStreetMap tiles. This works. Except when the JMapViewer loads tiles asynchronously. In that case, it calls repaint() on itself when the loading is finished, and it draws itself over my line layer. My line layer cannot know this, since it cannot

Draw Polyline in JMapViewer [closed]

北城以北 提交于 2019-12-20 03:02:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm working with OpenStreetMap in Java with JMapViewer. I can draw polygon and rectangle using JMapViewer, but how to draw polyline? Thank you. 回答1: 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

JMapViewer add mouse listener to MapMarkerDot

六眼飞鱼酱① 提交于 2019-12-17 07:53:15
问题 I am trying to add a mouse listener to a MapMarker, so that when a mouse will hover a MapMarker, I could react with an event. I implemented the mouseListener, but I can't really add a listener. The issue is that I did not find a way the MapMarker will addMouseListener, due to the fact that non of the hierarchy implements JPanel. Any help appreciated 回答1: As noted here, the default JMapViewer constructor uses a DefaultMapController , "which implements map moving by pressing the right mouse

Dynamically updating markers in JMapViewer

ε祈祈猫儿з 提交于 2019-12-12 21:23:17
问题 Hello Stack Overflow community, I am a Java newbie and I am doing a simple java project where I take coordinates (lat and lon) from a (dynamic) source and use JMapViewer (Yes, not JXMapViewer) to display the markers on a map. I have put all the coordinates in two ArrayList(s). It looks like that: for(int i = 0; i < latArrayList.size(); i++){ map.addMapMarker(new MapMarkerDot((double)latArrayList.get(i), (double)longArrayList.get(i))); } EDIT: map is a jMapViewer object. And it works pretty

OpenStreetMap - java library to handle offline map

偶尔善良 提交于 2019-12-11 19:20:12
问题 I need to create an application that would run on a linux system. Basically, I want to achieve something like Google Maps, but with much less functionality. The application needs to be able to do the followings: open and display offline maps, as there won't be any internet connection there will be a static route, like a railway, that has to be displayed, it won't change there will be one dynamically changing point, it should be updated I never really developed this kind of an application, I