Exemplo n.º 1
0
 @Override
 public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
   if (tileBox.getZoom() >= startZoom) {
     // request to load
     data.queryNewData(tileBox);
     List<OpenStreetNote> objects = data.getResults();
     if (objects != null) {
       for (OpenStreetNote o : objects) {
         int x = tileBox.getPixXFromLonNoRot(o.getLongitude());
         int y = tileBox.getPixYFromLatNoRot(o.getLatitude());
         canvas.drawCircle(
             x,
             y,
             getRadiusBug(tileBox),
             o.isLocal() ? pointNotSubmitedUI : (o.isOpened() ? pointOpenedUI : pointClosedUI));
       }
     }
   }
 }
Exemplo n.º 2
0
 public void getBugFromPoint(RotatedTileBox tb, PointF point, List<? super OpenStreetNote> res) {
   List<OpenStreetNote> objects = data.getResults();
   if (objects != null && view != null) {
     int ex = (int) point.x;
     int ey = (int) point.y;
     final int rad = getRadiusBug(tb);
     int radius = rad * 3 / 2;
     int small = rad * 3 / 4;
     try {
       for (int i = 0; i < objects.size(); i++) {
         OpenStreetNote n = objects.get(i);
         int x = (int) tb.getPixXFromLatLon(n.getLatitude(), n.getLongitude());
         int y = (int) tb.getPixYFromLatLon(n.getLatitude(), n.getLongitude());
         if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
           radius = small;
           res.add(n);
         }
       }
     } catch (IndexOutOfBoundsException e) {
       // that's really rare case, but is much efficient than introduce synchronized block
     }
   }
 }