@Override public void render(Graphics2D g, JXMapViewer map) { if (isSelected()) g.setColor(selectedColor); else g.setColor(color); g.setFont(new Font("font", Font.BOLD, 12)); Point2D p = map.getTileFactory().geoToPixel(pos.getPoint(), map.getZoom()); g.translate( (int) p.getX() - shapes[0].getBounds().width / 2, (int) p.getY() - shapes[0].getBounds().height / 2); for (int i = 0; i < shapes.length; i++) { g.draw(shapes[i]); if (desc == null) g.fill(shapes[i]); } if (desc != null) g.drawString(desc, 5, 20); g.translate( -(int) p.getX() + shapes[0].getBounds().width / 2, -(int) p.getY() + shapes[0].getBounds().height / 2); }
public boolean findItem(JXMapKit map, Point2D pt) { GeoPosition gp = pos.getPoint(); Point2D pt1 = map.getMainMap().getTileFactory().geoToPixel(gp, map.getMainMap().getZoom()); return pt1.distance(pt) < 20; }
public List<MapPoint> getPoints() { List<MapPoint> p = new ArrayList<MapPoint>(); p.add(new MapPoint(pos.getPoint())); return p; }
public GeoPosition getPosition() { return pos.getPoint(); }