Example usage for com.google.gwt.maps.client.geom Point newInstance

List of usage examples for com.google.gwt.maps.client.geom Point newInstance

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.geom Point newInstance.

Prototype

public static native Point newInstance(int x, int y) ;

Source Link

Usage

From source file:com.claudiushauptmann.gwt.maps.gxt.client.core.MapMenuController.java

License:Apache License

/**
 * Events Handler for mouse move events.
 * /*from  w  ww. j av  a 2 s.c  om*/
 * @param latlng
 *            The current position of the mouse in latlng.
 */
protected void mapMouseMove(LatLng latlng) {
    currentLatLng = latlng;

    int mapAbsoluteLeft = mapWidget.getAbsoluteLeft();
    int mapAbsoluteTop = mapWidget.getAbsoluteTop();
    currentMouseDivPosition = mapWidget.convertLatLngToContainerPixel(currentLatLng);
    currentMousePosition = Point.newInstance(currentMouseDivPosition.getX() + mapAbsoluteLeft,
            currentMouseDivPosition.getY() + mapAbsoluteTop);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.IconClassDemo.java

License:Apache License

public IconClassDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);// w w  w  . j a va 2  s. c  o m

    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    baseIcon = Icon.newInstance();
    baseIcon.setShadowURL("http://www.google.com/mapfiles/shadow50.png");
    baseIcon.setIconSize(Size.newInstance(20, 34));
    baseIcon.setShadowSize(Size.newInstance(37, 34));
    baseIcon.setIconAnchor(Point.newInstance(9, 34));
    baseIcon.setInfoWindowAnchor(Point.newInstance(9, 2));
    // TOOD(sgross): undocumented?
    // baseIcon.setInfoShadowAnchor(new GPoint(18, 25));
}

From source file:com.google.gwt.maps.sample.hellomaps.client.IconDemo.java

License:Apache License

@Override
public void onShow() {
    map.clearOverlays();/*  ww  w. j  a v  a2 s .  co m*/

    // Create our "tiny" marker icon
    Icon icon = Icon.newInstance("http://labs.google.com/ridefinder/images/mm_20_red.png");
    icon.setShadowURL("http://labs.google.com/ridefinder/images/mm_20_shadow.png");
    icon.setIconSize(Size.newInstance(12, 20));
    icon.setShadowSize(Size.newInstance(22, 20));
    icon.setIconAnchor(Point.newInstance(6, 20));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));

    // Add 10 markers to the map at random locations
    LatLngBounds bounds = map.getBounds();
    LatLng southWest = bounds.getSouthWest();
    LatLng northEast = bounds.getNorthEast();
    double lngSpan = northEast.getLongitude() - southWest.getLongitude();
    double latSpan = northEast.getLatitude() - southWest.getLatitude();
    MarkerOptions options = MarkerOptions.newInstance();
    options.setIcon(icon);
    for (int i = 0; i < 10; i++) {
        LatLng point = LatLng.newInstance(southWest.getLatitude() + latSpan * Math.random(),
                southWest.getLongitude() + lngSpan * Math.random());

        map.addOverlay(new Marker(point, options));
    }
}

From source file:org.onebusaway.webapp.gwt.common.resources.map.StopIconFactory.java

License:Apache License

public static Marker getStopSelectionCircle(LatLng p, boolean bigger) {
    ImageResource resource = bigger ? _r.getSelectionCircle36() : _r.getSelectionCircle30();

    Icon icon = Icon.newInstance();
    icon.setImageURL(resource.getURL());

    int w = resource.getWidth();
    int h = resource.getHeight();
    int w2 = w / 2;
    int h2 = h / 2;

    icon.setIconSize(Size.newInstance(w, h));
    icon.setIconAnchor(Point.newInstance(w2, h2));
    icon.setInfoWindowAnchor(Point.newInstance(w2, h2));

    MarkerOptions options = MarkerOptions.newInstance(icon);
    return new Marker(p, options);
}

From source file:org.onebusaway.webapp.gwt.common.resources.map.StopIconFactory.java

License:Apache License

/*****
 * Private Methods/*from   w w  w  . jav a 2  s .  co m*/
 ****/

private static Icon getRouteIcon(String url) {
    Icon icon = Icon.newInstance();
    icon.setImageURL(url);
    icon.setIconSize(Size.newInstance(20, 34));
    icon.setIconAnchor(Point.newInstance(10, 34));
    return icon;
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private Icon getStar30Marker() {
    OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE;
    ImageResource r = resources.getStar30();
    Icon icon = Icon.newInstance(r.getURL());
    icon.setIconSize(Size.newInstance(30, 28));
    icon.setIconAnchor(Point.newInstance(15, 14));
    return icon;/*from ww  w .  ja  v a 2  s  . co  m*/
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private Icon getStar20Marker() {
    OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE;
    ImageResource r = resources.getStar20();
    Icon icon = Icon.newInstance(r.getURL());
    icon.setIconSize(Size.newInstance(20, 19));
    icon.setIconAnchor(Point.newInstance(10, 10));
    return icon;/*from  w ww .j a v  a  2s. c  o  m*/
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private Icon getStar15Marker() {
    OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE;
    ImageResource r = resources.getStar15();
    Icon icon = Icon.newInstance(r.getURL());
    icon.setIconSize(Size.newInstance(15, 14));
    icon.setIconAnchor(Point.newInstance(8, 7));
    return icon;/*from w w  w.  ja va2 s  . com*/
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ResultsTablePresenter.java

License:Apache License

private Marker getMarker(int index, LocalSearchResult entry) {

    ImageResource resource = getMarkerResource(index);
    Icon icon = Icon.newInstance(resource.getURL());
    icon.setIconSize(Size.newInstance(24, 31));
    icon.setIconAnchor(Point.newInstance(12, 31));
    MarkerOptions opts = MarkerOptions.newInstance();
    opts.setClickable(true);//from  w  w w .  j  a v  a2  s  . c  o  m
    opts.setIcon(icon);
    LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon());
    return new Marker(point, opts);
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.SearchOriginMapPresenter.java

License:Apache License

public void handleUpdate(StateEvent event) {

    State state = event.getState();

    if (state instanceof SearchLocationUpdatedState) {

        if (_marker != null) {
            _mapOverlayManager.removeOverlay(_marker);
            _marker = null;//from   w ww  .  j  a  v a  2 s.c om
        }

        LatLng location = _queryModel.getLocation();

        if (location == null) {
            System.err.println("PROBLEM!");
            return;
        }

        MapResources resources = MapResources.INSTANCE;
        DataResource resource = resources.getImageRouteStart();
        Icon icon = Icon.newInstance();
        icon.setImageURL(resource.getUrl());
        icon.setIconSize(Size.newInstance(20, 34));
        icon.setIconAnchor(Point.newInstance(10, 34));
        MarkerOptions opts = MarkerOptions.newInstance(icon);

        _marker = new Marker(location, opts);
        _mapOverlayManager.addOverlay(_marker);
    }

}