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

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

Introduction

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

Prototype

public final native void setTransparentImageURL(String url) ;

Source Link

Document

The URL of a virtually transparent version of the foreground icon image used to capture click events in Internet Explorer.

Usage

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

License:Open Source License

/**
 * Creates an icon based on the specified options
 *   Supported options are: width, height, primaryColor,
 *   strokeColor, and cornerColor.//from w  ww. j  a v  a  2  s  .  com
  *
  * @return Icon for GoogleMaps
 */
public Icon createMarkerIcon() {

    String baseUrl = "http://chart.apis.google.com/chart?cht=mm";
    String iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + cornerColor.replace("#", "") + ","
            + primaryColor.replace("#", "") + "," + strokeColor.replace("#", "") + "&ext=.png";

    Icon icon = Icon.newInstance(iconUrl);
    icon.setIconSize(Size.newInstance(width, height));
    icon.setShadowSize(Size.newInstance((int) Math.floor(width * 1.6), height));
    icon.setIconAnchor(Point.newInstance(width / 2, height));
    icon.setInfoWindowAnchor(Point.newInstance(width / 2, (int) Math.floor(height / 12)));
    icon.setPrintImageURL(iconUrl + "&chof=gif");
    icon.setMozPrintImageURL(iconUrl + "&chf=bg,s,ECECD8" + "&chof=gif");

    iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + cornerColor.replace("#", "") + ","
            + primaryColor.replace("#", "") + "," + strokeColor.replace("#", "");
    icon.setTransparentImageURL(iconUrl + "&chf=a,s,ffffff11&ext=.png");
    icon.setImageMap(new int[] { width / 2, height, (int) ((7d / 16d) * width), (int) ((5d / 8d) * height),
            (int) ((5d / 16d) * width), (int) ((7d / 16d) * height), (int) ((7d / 32d) * width),
            (int) ((5d / 16d) * height), (int) ((5d / 16d) * width), (int) ((1d / 8d) * height),
            (int) ((1d / 2d) * width), 0, (int) ((11d / 16d) * width), (int) ((1d / 8d) * height),
            (int) ((25d / 32d) * width), (int) ((5d / 16d) * height), (int) ((11d / 16d) * width),
            (int) ((7d / 16d) * height), (int) ((9d / 16d) * width), (int) ((5d / 8d) * height) });

    return icon;
}

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   www. j a  v  a 2s . 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;
}