Search in sources :

Example 1 with MarkerBitmap

use of de.bahnhoefe.deutschlands.bahnhofsfotos.mapsforge.MarkerBitmap in project RSAndroidApp by RailwayStations.

the class MapsActivity method getMarkerBitmap.

private List<MarkerBitmap> getMarkerBitmap() {
    final List<MarkerBitmap> markerBitmaps = new ArrayList<>();
    // prepare for marker icons.
    // small icon for maximum single item
    final Bitmap bitmapWithPhoto = loadBitmap(R.drawable.marker_green);
    final Bitmap markerWithoutPhoto = loadBitmap(R.drawable.marker_red);
    final Bitmap markerOwnPhoto = loadBitmap(R.drawable.marker_violet);
    final Bitmap markerPendingUpload = loadBitmap(R.drawable.marker_yellow);
    final Bitmap markerWithPhotoInactive = loadBitmap(R.drawable.marker_green_inactive);
    final Bitmap markerWithoutPhotoInactive = loadBitmap(R.drawable.marker_red_inactive);
    final Bitmap markerOwnPhotoInactive = loadBitmap(R.drawable.marker_violet_inactive);
    final Paint paint1 = AndroidGraphicFactory.INSTANCE.createPaint();
    paint1.setStyle(Style.FILL);
    paint1.setTextAlign(Align.CENTER);
    FontFamily fontFamily = FontFamily.DEFAULT;
    FontStyle fontStyle = FontStyle.BOLD;
    paint1.setTypeface(fontFamily, fontStyle);
    paint1.setColor(Color.RED);
    markerBitmaps.add(new MarkerBitmap(this.getApplicationContext(), markerWithoutPhoto, bitmapWithPhoto, markerOwnPhoto, markerWithoutPhotoInactive, markerWithPhotoInactive, markerOwnPhotoInactive, markerPendingUpload, new Point(0, -(markerWithoutPhoto.getHeight() / 2.0)), 10f, 1, paint1));
    // small cluster icon. for 10 or less items.
    final Bitmap bitmapBalloonSN = loadBitmap(R.drawable.balloon_s_n);
    final Paint paint2 = AndroidGraphicFactory.INSTANCE.createPaint();
    paint2.setStyle(Style.FILL);
    paint2.setTextAlign(Align.CENTER);
    fontFamily = FontFamily.DEFAULT;
    fontStyle = FontStyle.BOLD;
    paint2.setTypeface(fontFamily, fontStyle);
    paint2.setColor(Color.BLACK);
    markerBitmaps.add(new MarkerBitmap(this.getApplicationContext(), bitmapBalloonSN, new Point(0, 0), 9f, 10, paint2));
    // large cluster icon. 100 will be ignored.
    final Bitmap bitmapBalloonMN = loadBitmap(R.drawable.balloon_m_n);
    final Paint paint3 = AndroidGraphicFactory.INSTANCE.createPaint();
    paint3.setStyle(Style.FILL);
    paint3.setTextAlign(Align.CENTER);
    fontFamily = FontFamily.DEFAULT;
    fontStyle = FontStyle.BOLD;
    paint3.setTypeface(fontFamily, fontStyle);
    paint3.setColor(Color.BLACK);
    markerBitmaps.add(new MarkerBitmap(this.getApplicationContext(), bitmapBalloonMN, new Point(0, 0), 11f, 100, paint3));
    return markerBitmaps;
}
Also used : FontFamily(org.mapsforge.core.graphics.FontFamily) Bitmap(org.mapsforge.core.graphics.Bitmap) MarkerBitmap(de.bahnhoefe.deutschlands.bahnhofsfotos.mapsforge.MarkerBitmap) FontStyle(org.mapsforge.core.graphics.FontStyle) ArrayList(java.util.ArrayList) MarkerBitmap(de.bahnhoefe.deutschlands.bahnhofsfotos.mapsforge.MarkerBitmap) Paint(org.mapsforge.core.graphics.Paint) Point(org.mapsforge.core.model.Point)

Aggregations

MarkerBitmap (de.bahnhoefe.deutschlands.bahnhofsfotos.mapsforge.MarkerBitmap)1 ArrayList (java.util.ArrayList)1 Bitmap (org.mapsforge.core.graphics.Bitmap)1 FontFamily (org.mapsforge.core.graphics.FontFamily)1 FontStyle (org.mapsforge.core.graphics.FontStyle)1 Paint (org.mapsforge.core.graphics.Paint)1 Point (org.mapsforge.core.model.Point)1