Example usage for com.google.gwt.maps.client.overlay Icon DEFAULT_ICON

List of usage examples for com.google.gwt.maps.client.overlay Icon DEFAULT_ICON

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlay Icon DEFAULT_ICON.

Prototype

Icon DEFAULT_ICON

To view the source code for com.google.gwt.maps.client.overlay Icon DEFAULT_ICON.

Click Source Link

Usage

From source file:org.sigmah.client.map.GcIconFactory.java

License:Open Source License

/**
* Creates a flat icon based on the specified options
*     Supported options are: width, height, primaryColor,
*     shadowColor, label, labelColor, labelSize, and shape..
 *
 * @return Icon object for use in GoogleMaps
*///from ww w.  j ava2  s  .c  o m
public Icon createFlatIcon() {
    String shapeCode = ("circle".equals(shape)) ? "it" : "itr";

    String baseUrl = "http://chart.apis.google.com/chart?cht=" + shapeCode;
    String iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + primaryColor.replace("#", "") + ","
            + shadowColor.replace("#", "") + "ff,ffffff01" + "&chl=" + label + "&chx="
            + labelColor.replace("#", "") + "," + labelSize;
    Icon icon = Icon.newInstance(Icon.DEFAULT_ICON);
    icon.setImageURL(iconUrl + "&chf=bg,s,00000000" + "&ext=.png");
    icon.setIconSize(Size.newInstance(width, height));
    icon.setShadowSize(Size.newInstance(0, 0));
    icon.setIconAnchor(Point.newInstance(width / 2, height / 2));
    icon.setInfoWindowAnchor(Point.newInstance(width / 2, height / 2));
    icon.setPrintImageURL(iconUrl + "&chof=gif");
    icon.setMozPrintImageURL(iconUrl + "&chf=bg,s,ECECD8" + "&chof=gif");
    icon.setTransparentImageURL(iconUrl + "&chf=a,s,ffffff01&ext=.png");

    if (shapeCode.equals("itr")) {
        icon.setImageMap(new int[] { 0, 0, width, 0, width, height, 0, height });
    } else {
        icon.setImageMap(createCircleImageMap(width, height, 8));
    }

    return icon;
}

From source file:org.sigmah.client.map.IconFactory.java

License:Open Source License

public static Icon createIcon(MapMarker marker) {
    if (marker instanceof IconMapMarker) {
        return createIconMapMarker((IconMapMarker) marker);
    } else if (marker instanceof BubbleMapMarker) {
        return createBubbleMapMarker((BubbleMapMarker) marker);
    } else {/*from w  w  w  .ja va  2 s.c o  m*/
        return Icon.DEFAULT_ICON;
    }
}

From source file:org.sigmah.client.map.IconFactory.java

License:Open Source License

/**
 * Creates a Google Maps icon based on an ActivityInfo MapIcon
 *
 * @author Alex Bertram//from  w  ww.j a va  2 s. c o m
 */
public static Icon createIconMapMarker(IconMapMarker marker) {

    MapIcon mapIcon = marker.getIcon();
    String iconUrl = "mapicons/" + mapIcon.getName() + ".png";

    Icon icon = Icon.newInstance(Icon.DEFAULT_ICON);
    icon.setImageURL(iconUrl);
    icon.setIconSize(Size.newInstance(mapIcon.getWidth(), mapIcon.getHeight()));
    icon.setShadowSize(Size.newInstance(0, 0));
    Point anchor = Point.newInstance(mapIcon.getAnchorX(), mapIcon.getAnchorY());
    icon.setIconAnchor(anchor);
    icon.setInfoWindowAnchor(anchor);
    icon.setPrintImageURL(iconUrl + "&chof=gif");
    icon.setMozPrintImageURL(iconUrl);

    return icon;
}

From source file:org.sigmah.client.map.IconFactory.java

License:Open Source License

public static Icon createBubbleMapMarker(BubbleMapMarker marker) {
    StringBuilder sb = new StringBuilder();
    sb.append("icon?t=bubble&r=").append(marker.getRadius()).append("&c=").append(marker.getColor());
    String iconUrl = sb.toString();
    int size = marker.getRadius() * 2;

    Icon icon = Icon.newInstance(Icon.DEFAULT_ICON);
    icon.setImageURL(iconUrl);/*from w w  w.  j av  a  2  s.co  m*/
    icon.setIconSize(Size.newInstance(size, size));
    icon.setShadowSize(Size.newInstance(0, 0));
    Point anchor = Point.newInstance(marker.getRadius(), marker.getRadius());
    icon.setIconAnchor(anchor);
    icon.setInfoWindowAnchor(anchor);
    icon.setPrintImageURL(iconUrl);
    icon.setMozPrintImageURL(iconUrl);

    return icon;
}