use of net.osmand.aidl.maplayer.point.AMapPoint in project Osmand by osmandapp.
the class MenuController method getMenuController.
public static MenuController getMenuController(MapActivity mapActivity, LatLon latLon, PointDescription pointDescription, Object object, MenuType menuType) {
MenuController menuController = null;
if (object != null) {
if (object instanceof Amenity) {
menuController = new AmenityMenuController(mapActivity, pointDescription, (Amenity) object);
} else if (object instanceof FavouritePoint) {
menuController = new FavouritePointMenuController(mapActivity, pointDescription, (FavouritePoint) object);
} else if (object instanceof SearchHistoryHelper.HistoryEntry) {
menuController = new HistoryMenuController(mapActivity, pointDescription, (SearchHistoryHelper.HistoryEntry) object);
} else if (object instanceof TargetPoint) {
menuController = new TargetPointMenuController(mapActivity, pointDescription, (TargetPoint) object);
} else if (object instanceof Recording) {
menuController = new AudioVideoNoteMenuController(mapActivity, pointDescription, (Recording) object);
} else if (object instanceof OsmPoint) {
menuController = new EditPOIMenuController(mapActivity, pointDescription, (OsmPoint) object);
} else if (object instanceof WptPt) {
menuController = new WptPtMenuController(mapActivity, pointDescription, (WptPt) object);
} else if (object instanceof DownloadMapObject) {
menuController = new MapDataMenuController(mapActivity, pointDescription, (DownloadMapObject) object);
} else if (object instanceof OpenStreetNote) {
menuController = new OsmBugMenuController(mapActivity, pointDescription, (OpenStreetNote) object);
} else if (object instanceof GpxDisplayItem) {
menuController = new GpxItemMenuController(mapActivity, pointDescription, (GpxDisplayItem) object);
} else if (object instanceof MapMarker) {
menuController = new MapMarkerMenuController(mapActivity, pointDescription, (MapMarker) object);
} else if (object instanceof TransportStopRoute) {
menuController = new TransportRouteController(mapActivity, pointDescription, (TransportStopRoute) object);
} else if (object instanceof TransportStop) {
menuController = new TransportStopController(mapActivity, pointDescription, (TransportStop) object);
} else if (object instanceof AMapPoint) {
menuController = new AMapPointMenuController(mapActivity, pointDescription, (AMapPoint) object);
} else if (object instanceof LatLon) {
if (pointDescription.isParking()) {
menuController = new ParkingPositionMenuController(mapActivity, pointDescription);
} else if (pointDescription.isMyLocation()) {
menuController = new MyLocationMenuController(mapActivity, pointDescription);
}
} else if (object instanceof RouteDataObject) {
menuController = new ImpassibleRoadsMenuController(mapActivity, pointDescription, (RouteDataObject) object);
} else if (object instanceof RenderedObject) {
menuController = new RenderedObjectMenuController(mapActivity, pointDescription, (RenderedObject) object);
} else if (object instanceof MapillaryImage) {
menuController = new MapillaryMenuController(mapActivity, pointDescription, (MapillaryImage) object);
}
}
if (menuController == null) {
menuController = new PointDescriptionMenuController(mapActivity, pointDescription);
}
menuController.menuType = menuType;
menuController.setLatLon(latLon);
menuController.onCreated();
return menuController;
}
use of net.osmand.aidl.maplayer.point.AMapPoint in project Osmand by osmandapp.
the class AMapLayer method readFromParcel.
private void readFromParcel(Parcel in) {
id = in.readString();
name = in.readString();
zOrder = in.readFloat();
List<AMapPoint> pointList = new ArrayList<>();
in.readTypedList(pointList, AMapPoint.CREATOR);
for (AMapPoint p : pointList) {
this.points.put(p.getId(), p);
}
}
use of net.osmand.aidl.maplayer.point.AMapPoint 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.maplayer.point.AMapPoint 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);
}
}
}
}
}
Aggregations