Search in sources :

Example 1 with AMapPoint

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;
}
Also used : TargetPointMenuController(net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController) WptPt(net.osmand.plus.GPXUtilities.WptPt) HistoryMenuController(net.osmand.plus.mapcontextmenu.controllers.HistoryMenuController) TransportStopController(net.osmand.plus.mapcontextmenu.controllers.TransportStopController) FavouritePoint(net.osmand.data.FavouritePoint) MapMarker(net.osmand.plus.MapMarkersHelper.MapMarker) MapillaryImage(net.osmand.plus.mapillary.MapillaryImage) ParkingPositionMenuController(net.osmand.plus.parkingpoint.ParkingPositionMenuController) GpxDisplayItem(net.osmand.plus.GpxSelectionHelper.GpxDisplayItem) GpxItemMenuController(net.osmand.plus.mapcontextmenu.controllers.GpxItemMenuController) MapDataMenuController(net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) RenderedObjectMenuController(net.osmand.plus.mapcontextmenu.controllers.RenderedObjectMenuController) ImpassibleRoadsMenuController(net.osmand.plus.mapcontextmenu.controllers.ImpassibleRoadsMenuController) EditPOIMenuController(net.osmand.plus.osmedit.EditPOIMenuController) TransportStopRoute(net.osmand.plus.transport.TransportStopRoute) MapMarkerMenuController(net.osmand.plus.mapcontextmenu.controllers.MapMarkerMenuController) PointDescriptionMenuController(net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController) AMapPointMenuController(net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController) TransportStop(net.osmand.data.TransportStop) Amenity(net.osmand.data.Amenity) FavouritePointMenuController(net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController) AudioVideoNoteMenuController(net.osmand.plus.audionotes.AudioVideoNoteMenuController) OsmBugMenuController(net.osmand.plus.osmedit.OsmBugMenuController) OsmPoint(net.osmand.plus.osmedit.OsmPoint) TransportRouteController(net.osmand.plus.mapcontextmenu.controllers.TransportRouteController) AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) AmenityMenuController(net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController) DownloadMapObject(net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject) MyLocationMenuController(net.osmand.plus.mapcontextmenu.controllers.MyLocationMenuController) RenderedObjectMenuController(net.osmand.plus.mapcontextmenu.controllers.RenderedObjectMenuController) PointDescriptionMenuController(net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController) MapMarkerMenuController(net.osmand.plus.mapcontextmenu.controllers.MapMarkerMenuController) AMapPointMenuController(net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController) OsmBugMenuController(net.osmand.plus.osmedit.OsmBugMenuController) WptPtMenuController(net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController) MapillaryMenuController(net.osmand.plus.mapillary.MapillaryMenuController) GpxItemMenuController(net.osmand.plus.mapcontextmenu.controllers.GpxItemMenuController) HistoryMenuController(net.osmand.plus.mapcontextmenu.controllers.HistoryMenuController) ParkingPositionMenuController(net.osmand.plus.parkingpoint.ParkingPositionMenuController) MapDataMenuController(net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController) TargetPointMenuController(net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController) AudioVideoNoteMenuController(net.osmand.plus.audionotes.AudioVideoNoteMenuController) AmenityMenuController(net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController) ImpassibleRoadsMenuController(net.osmand.plus.mapcontextmenu.controllers.ImpassibleRoadsMenuController) EditPOIMenuController(net.osmand.plus.osmedit.EditPOIMenuController) FavouritePointMenuController(net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController) MyLocationMenuController(net.osmand.plus.mapcontextmenu.controllers.MyLocationMenuController) LatLon(net.osmand.data.LatLon) RenderedObject(net.osmand.NativeLibrary.RenderedObject) OpenStreetNote(net.osmand.plus.osmedit.OsmBugsLayer.OpenStreetNote) RouteDataObject(net.osmand.binary.RouteDataObject) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) WptPtMenuController(net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController) MapillaryMenuController(net.osmand.plus.mapillary.MapillaryMenuController)

Example 2 with AMapPoint

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);
    }
}
Also used : AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) ArrayList(java.util.ArrayList)

Example 3 with AMapPoint

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);
        }
    }
}
Also used : AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) Paint(android.graphics.Paint) ALatLon(net.osmand.aidl.map.ALatLon)

Example 4 with AMapPoint

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);
                }
            }
        }
    }
}
Also used : AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) Paint(android.graphics.Paint) ALatLon(net.osmand.aidl.map.ALatLon)

Aggregations

AMapPoint (net.osmand.aidl.maplayer.point.AMapPoint)4 Paint (android.graphics.Paint)2 ALatLon (net.osmand.aidl.map.ALatLon)2 ArrayList (java.util.ArrayList)1 RenderedObject (net.osmand.NativeLibrary.RenderedObject)1 RouteDataObject (net.osmand.binary.RouteDataObject)1 Amenity (net.osmand.data.Amenity)1 FavouritePoint (net.osmand.data.FavouritePoint)1 LatLon (net.osmand.data.LatLon)1 TransportStop (net.osmand.data.TransportStop)1 WptPt (net.osmand.plus.GPXUtilities.WptPt)1 GpxDisplayItem (net.osmand.plus.GpxSelectionHelper.GpxDisplayItem)1 MapMarker (net.osmand.plus.MapMarkersHelper.MapMarker)1 TargetPoint (net.osmand.plus.TargetPointsHelper.TargetPoint)1 AudioVideoNoteMenuController (net.osmand.plus.audionotes.AudioVideoNoteMenuController)1 Recording (net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording)1 AMapPointMenuController (net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController)1 AmenityMenuController (net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController)1 FavouritePointMenuController (net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController)1 GpxItemMenuController (net.osmand.plus.mapcontextmenu.controllers.GpxItemMenuController)1