我在任何地方都找不到简单的答案,所以我想我错过了一些东西:
我在java中使用openstreetmap,我制作了一个GUI,点击时我得到了一个地理点,我想在我点击的地方显示一个标记,我试过这个但它不起作用:
GeoPosition gp2 = map.convertPointToGeoPosition(map.getMousePosition());
Waypoint wp = new Waypoint() {
@Override
public GeoPosition getPosition() {
// TODO Auto-generated method stub
return gp2;
}
};
Set<Waypoint> set = null;
set.add(wp);
WaypointPainter<Waypoint> wpp = new WaypointPainter<Waypoint>();
wpp.setRenderer(new WaypointRenderer<Waypoint>() {
@Override
public void paintWaypoint(Graphics2D g, JXMapViewer map, Waypoint waypoint) {
// TODO Auto-generated method stub
}
});
wpp.setWaypoints(set);
Map.this.getJXMapViewer().setOverlayPainter(wpp);
Map.this.getJXMapViewer().revalidate();
Map.this.getJXMapViewer().repaint();
任何线索为什么?