Search in sources :

Example 1 with IconGenerator

use of com.google.maps.android.ui.IconGenerator in project iosched by google.

the class MapUtils method getLabelIconGenerator.

/**
     * Creates a new IconGenerator for labels on the map.
     */
public static IconGenerator getLabelIconGenerator(Context c) {
    IconGenerator iconFactory = new IconGenerator(c);
    iconFactory.setTextAppearance(R.style.MapLabel);
    iconFactory.setBackground(null);
    return iconFactory;
}
Also used : IconGenerator(com.google.maps.android.ui.IconGenerator)

Example 2 with IconGenerator

use of com.google.maps.android.ui.IconGenerator in project android-maps-utils by googlemaps.

the class IconGeneratorDemoActivity method startDemo.

@Override
protected void startDemo() {
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8696, 151.2094), 10));
    IconGenerator iconFactory = new IconGenerator(this);
    addIcon(iconFactory, "Default", new LatLng(-33.8696, 151.2094));
    iconFactory.setColor(Color.CYAN);
    addIcon(iconFactory, "Custom color", new LatLng(-33.9360, 151.2070));
    iconFactory.setRotation(90);
    iconFactory.setStyle(IconGenerator.STYLE_RED);
    addIcon(iconFactory, "Rotated 90 degrees", new LatLng(-33.8858, 151.096));
    iconFactory.setContentRotation(-90);
    iconFactory.setStyle(IconGenerator.STYLE_PURPLE);
    addIcon(iconFactory, "Rotate=90, ContentRotate=-90", new LatLng(-33.9992, 151.098));
    iconFactory.setRotation(0);
    iconFactory.setContentRotation(90);
    iconFactory.setStyle(IconGenerator.STYLE_GREEN);
    addIcon(iconFactory, "ContentRotate=90", new LatLng(-33.7677, 151.244));
    iconFactory.setRotation(0);
    iconFactory.setContentRotation(0);
    iconFactory.setStyle(IconGenerator.STYLE_ORANGE);
    addIcon(iconFactory, makeCharSequence(), new LatLng(-33.77720, 151.12412));
}
Also used : LatLng(com.google.android.gms.maps.model.LatLng) IconGenerator(com.google.maps.android.ui.IconGenerator)

Example 3 with IconGenerator

use of com.google.maps.android.ui.IconGenerator in project iosched by google.

the class MarkerLoadingTask method loadInBackground.

@Override
public List<MarkerEntry> loadInBackground() {
    List<MarkerEntry> list = null;
    // Create a URI to get a cursor of all map markers
    final Uri uri = ScheduleContract.MapMarkers.buildMarkerUri();
    Cursor cursor = getContext().getContentResolver().query(uri, MarkerQuery.PROJECTION, null, null, null);
    // Create a MarkerModel for each entry
    final int count = cursor.getCount();
    if (cursor != null) {
        list = new ArrayList<>(count);
        final IconGenerator labelIconGenerator = MapUtils.getLabelIconGenerator(getContext());
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
            // get data
            final String id = cursor.getString(MarkerQuery.MARKER_ID);
            final int floor = cursor.getInt(MarkerQuery.MARKER_FLOOR);
            final float lat = cursor.getFloat(MarkerQuery.MARKER_LATITUDE);
            final float lon = cursor.getFloat(MarkerQuery.MARKER_LONGITUDE);
            final String typeString = cursor.getString(MarkerQuery.MARKER_TYPE);
            final int type = MapUtils.detectMarkerType(typeString);
            final String label = cursor.getString(MarkerQuery.MARKER_LABEL);
            final LatLng position = new LatLng(lat, lon);
            MarkerOptions marker = null;
            if (type == MarkerModel.TYPE_LABEL) {
                // Label markers contain the label as its icon
                marker = MapUtils.createLabelMarker(labelIconGenerator, id, position, label);
            } else if (type == MarkerModel.TYPE_ICON) {
                // An icon marker is mapped to a drawable based on its full type name
                marker = MapUtils.createIconMarker(typeString, id, position, getContext());
            } else if (type != MarkerModel.TYPE_INACTIVE) {
                // All other markers (that are not inactive) contain a pin icon
                marker = MapUtils.createPinMarker(id, position);
            }
            MarkerModel model = new MarkerModel(id, floor, type, label, null);
            MarkerEntry entry = new MarkerEntry(model, marker);
            list.add(entry);
            cursor.moveToNext();
        }
        cursor.close();
    }
    return list;
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) LatLng(com.google.android.gms.maps.model.LatLng) Cursor(android.database.Cursor) Uri(android.net.Uri) IconGenerator(com.google.maps.android.ui.IconGenerator)

Aggregations

IconGenerator (com.google.maps.android.ui.IconGenerator)3 LatLng (com.google.android.gms.maps.model.LatLng)2 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1