Esempio n. 1
0
 @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);
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 public List<MapPoint> getPoints() {
   List<MapPoint> p = new ArrayList<MapPoint>();
   p.add(new MapPoint(pos.getPoint()));
   return p;
 }
Esempio n. 4
0
 public GeoPosition getPosition() {
   return pos.getPoint();
 }