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

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

Introduction

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

Prototype

public final native int getX() ;

Source Link

Document

Returns the X coordinate.

Usage

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

License:Apache License

/**
 * Calculates the current vertex.// ww w  .  j av  a  2s  .  c  o m
 */
@Override
protected int getCurrentVertex() {
    int temp = -1;
    for (int i = 0; i < polygon.getVertexCount(); i++) {
        Point vp = mapMenuController.getMapWidget().convertLatLngToContainerPixel(polygon.getVertex(i));
        if ((Math.abs(vp.getX() - mapMenuController.getCurrentMouseDivPosition().getX()) < 7)
                && (Math.abs(vp.getY() - mapMenuController.getCurrentMouseDivPosition().getY()) < 7)) {
            temp = i;
            break;
        }
    }
    return temp;
}

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

License:Apache License

/**
 * Calculates the current vertex./*  w  w w .  j ava  2 s .c om*/
 */
@Override
protected int getCurrentVertex() {
    int temp = -1;
    for (int i = 0; i < polyline.getVertexCount(); i++) {
        Point vp = mapMenuController.getMapWidget().convertLatLngToContainerPixel(polyline.getVertex(i));
        if ((Math.abs(vp.getX() - mapMenuController.getCurrentMouseDivPosition().getX()) < 7)
                && (Math.abs(vp.getY() - mapMenuController.getCurrentMouseDivPosition().getY()) < 7)) {
            temp = i;
            break;
        }
    }
    return temp;
}

From source file:org.maps.client.GMapCreatorTileLayer.java

License:Apache License

@Override
public String getTileURL(Point tile, int zoomLevel) {
    String prefix = getUrlPrefix();
    String secondaryPrefix = getSecondaryPrefix();
    if (zoomLevel >= getSecondaryZoomStart() && secondaryPrefix == null) {
        return prefix + "blank-tile.png";
    } else if (zoomLevel >= getSecondaryZoomStart() && secondaryPrefix != null) {
        prefix = secondaryPrefix;/*from   w ww .  j a va2s. c  om*/
    }
    //System.out.println("prefix is: " + prefix);
    final LatLngBounds mapBounds = LatLngBounds.newInstance(LatLng.newInstance(17.884813, -179.14734),
            LatLng.newInstance(71.35256, 179.77847));

    double c = Math.pow(2, zoomLevel);
    double x = 360 / c * tile.getX() - 180;
    double y = 180 - 360 / c * tile.getY();
    double x2 = x + 360 / c;
    double y2 = y - 360 / c;
    double lon = x; // Math.toRadians(x); //would be lon=x+lon0, but lon0=0
    // degrees
    double lat = (2.0 * Math.atan(Math.exp(y / 180 * Math.PI)) - Math.PI / 2.0) * 180 / Math.PI; // in degrees
    double lon2 = x2;
    double lat2 = (2.0 * Math.atan(Math.exp(y2 / 180 * Math.PI)) - Math.PI / 2.0) * 180 / Math.PI; // in degrees
    LatLngBounds tileBounds = LatLngBounds.newInstance(LatLng.newInstance(lat2, lon),
            LatLng.newInstance(lat, lon2));
    if (!tileBounds.intersects(mapBounds)) {
        return prefix + "blank-tile.png";
    }
    ;
    double d = tile.getX();
    double e = tile.getY();
    String f = "t";
    for (int g = 0; g < zoomLevel; g++) {
        c = c / 2;
        if (e < c) {
            if (d < c) {
                f = f + "q";
            } else {
                f = f + "r";
                d -= c;
            }
        } else {
            if (d < c) {
                f = f + "t";
                e -= c;
            } else {
                f = f + "s";
                d -= c;
                e -= c;
            }
        }
    }
    return prefix + f + ".png";
}

From source file:org.onebusaway.webapp.gwt.oba_library.view.PatchMarker.java

License:Apache License

@Override
protected void redraw(boolean force) {

    Point point = _map.convertLatLngToDivPixel(_northWestCorner);
    int x = point.getX();
    int y = point.getY();

    _map.getPane(MapPaneType.MARKER_SHADOW_PANE).setWidgetPosition(_widget, x, y);

    Point point2 = _map.convertLatLngToDivPixel(_southEastCorner);
    int x2 = point2.getX();
    int y2 = point2.getY();

    _widget.setWidth((x2 - x) + "px");
    _widget.setHeight((y2 - y) + "px");
}

From source file:org.onebusaway.webapp.gwt.tripplanner_library.view.TinyInfoWindowMarker.java

License:Apache License

@Override
protected void redraw(boolean force) {
    Point point = _map.convertLatLngToDivPixel(_point);
    int x = point.getX();
    int y = point.getY();
    _map.getPane(MapPaneType.MARKER_PANE).setWidgetPosition(_panel, x, y);
}

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

License:Open Source License

@Override
public String getTileURL(Point tile, int zoomLevel) {
    return baseMap.getTileUrl(zoomLevel, tile.getX(), tile.getY());
}

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

License:Open Source License

@Override
public String getTileURL(Point tile, int zoomLevel) {
    return baseUrl + "/z" + zoomLevel + "/" + tile.getX() + "x" + tile.getY() + ".png";
}

From source file:org.thechiselgroup.choosel.visualization_component.map.client.DefaultOverlay.java

License:Apache License

private boolean sameLocation(Point newLocationPoint) {
    assert newLocationPoint != null;
    return locationPoint != null && locationPoint.getX() == newLocationPoint.getX()
            && locationPoint.getY() == newLocationPoint.getY();
}