use of net.osmand.aidl.map.ALatLon in project Osmand by osmandapp.
the class AidlMapLayer method onDraw.
@Override
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
final int r = getRadiusPoi(tileBox);
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
List<AMapPoint> points = aidlLayer.getPoints();
for (AMapPoint point : points) {
ALatLon l = point.getLocation();
if (l != null) {
int x = (int) tileBox.getPixXFromLatLon(l.getLatitude(), l.getLongitude());
int y = (int) tileBox.getPixYFromLatLon(l.getLatitude(), l.getLongitude());
pointInnerCircle.setColor(point.getColor());
pointOuter.setColor(POINT_OUTER_COLOR);
paintTextIcon.setColor(PAINT_TEXT_ICON_COLOR);
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), pointOuter);
canvas.drawCircle(x, y, r - (float) Math.ceil(tileBox.getDensity()), pointInnerCircle);
paintTextIcon.setTextSize(r * 3 / 2);
canvas.drawText(point.getShortName(), x, y + r / 2, paintTextIcon);
}
}
}
use of net.osmand.aidl.map.ALatLon in project Osmand by osmandapp.
the class AidlMapLayer method getFromPoint.
private void getFromPoint(RotatedTileBox tb, PointF point, List<? super AMapPoint> points) {
if (view != null) {
int ex = (int) point.x;
int ey = (int) point.y;
final int rp = getRadiusPoi(tb);
int compare = rp;
int radius = rp * 3 / 2;
for (AMapPoint p : aidlLayer.getPoints()) {
ALatLon position = p.getLocation();
if (position != null) {
int x = (int) tb.getPixXFromLatLon(position.getLatitude(), position.getLongitude());
int y = (int) tb.getPixYFromLatLon(position.getLatitude(), position.getLongitude());
if (Math.abs(x - ex) <= compare && Math.abs(y - ey) <= compare) {
compare = radius;
points.add(p);
}
}
}
}
}