Examples of LatLngBounds


Examples of com.google.gwt.maps.client.geom.LatLngBounds

  @Override
  public void onShow() {
    map.clearOverlays();

    // 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();
    for (int i = 0; i < 10; i++) {
      LatLng point = LatLng.newInstance(southWest.getLatitude() + latSpan
          * Math.random(), southWest.getLongitude() + lngSpan * Math.random());
 
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

    for (Iterator iterator = polygons.iterator(); iterator.hasNext();) {
      RegionPolygon polygon = (RegionPolygon) iterator.next();
      if(polygon.getRegionDetailsId().equals(id))
      {
          polygon.setEditingEnabled(true);
          LatLngBounds bounds = polygon.getBounds();
          // For Regions, we don't want to recenter on the polygon
          // map.panTo(bounds.getCenter());
          currentPolygon = polygon;
          LatLng points[] = new LatLng[currentPolygon.getVertexCount()];
            for (int i = 0; i < currentPolygon.getVertexCount(); i++) {
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

    for (Iterator iterator = polygons.iterator(); iterator.hasNext();) {
      TagPolygon polygon = (TagPolygon) iterator.next();
      if(polygon.getZoneDetailsId().equals(id))
      {
          polygon.setEditingEnabled(true);
          LatLngBounds bounds = polygon.getBounds();
          map.panTo(bounds.getCenter());
          currentPolygon = polygon;
          LatLng points[] = new LatLng[currentPolygon.getVertexCount()];
            for (int i = 0; i < currentPolygon.getVertexCount(); i++) {
              LatLng v = currentPolygon.getVertex(i);
              LatLng p = LatLng.newInstance(v.getLatitude(), v.getLongitude());
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

      TagPolyline polyline = (TagPolyline) iterator.next();
      //Window.alert("Check polyline id=" + polyline.getRoadDetailsId());
      if(polyline.getRoadDetailsId().equals(id))
      {
          polyline.setEditingEnabled(true);
          LatLngBounds bounds = polyline.getBounds();
          map.panTo(bounds.getCenter());
          currentPolyline = polyline;
         
          // make a back up and store it for a single level of Undo (via CancelRoadEvent)
          //backupEditPolyline = createBackUpPolyline(currentPolyline);
         
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

    });
  }

  public void drawCircleFromRadius(LatLng center, double radius,
      int nbOfPoints) {
    LatLngBounds bounds = LatLngBounds.newInstance();
    LatLng[] circlePoints = new LatLng[nbOfPoints];

    double EARTH_RADIUS = 6371000;
    double d = radius / EARTH_RADIUS;
    double lat1 = Math.toRadians(center.getLatitude());
    double lng1 = Math.toRadians(center.getLongitude());

    double a = 0;
    double step = 360.0 / (double) nbOfPoints;
    for (int i = 0; i < nbOfPoints; i++) {
      double tc = Math.toRadians(a);
      double lat2 = Math.asin(Math.sin(lat1) * Math.cos(d)
          + Math.cos(lat1) * Math.sin(d) * Math.cos(tc));
      double lng2 = lng1
          + Math.atan2(Math.sin(tc) * Math.sin(d) * Math.cos(lat1),
              Math.cos(d) - Math.sin(lat1) * Math.sin(lat2));
      LatLng point = LatLng.newInstance(Math.toDegrees(lat2),
          Math.toDegrees(lng2));
      circlePoints[i] = point;
      bounds.extend(point);
      a += step;
    }

    Polygon circle = new Polygon(circlePoints, "green", 0, 0, "#00800", 0.5);
    oldCircle = circle;
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

          map.addOverlay(g.getLabel(true));
        }
        freezeZoom = map.getZoomLevel();
      }
    } else {
      final LatLngBounds bounds = map.getBounds();
      recalculateCells(bounds);
    }
    updateToken();
  }
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

    map.setZoomLevel(mz);
    disableUpdates = false;

    resolution = r;
    res.setItemSelected(r, true);
    final LatLngBounds bounds;
    if (sw != null) {
      bounds = LatLngBounds.newInstance(sw, ne);
      freezeZoom = -1;
      updateFreeze(bounds);
      setFreezeActive();
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

  private static LatLngBounds getSearchBoundsAsLatLngBounds(double radius) {

    CoordinateBounds bounds = getSearchBounds(radius);

    LatLngBounds b = LatLngBounds.newInstance();
    b.extend(LatLng.newInstance(bounds.getMinLat(), bounds.getMinLon()));
    b.extend(LatLng.newInstance(bounds.getMaxLat(), bounds.getMaxLon()));
    return b;
  }
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

    public void handleUpdate(TimedPolygonModel model) {

      clear();

      LatLngBounds bounds = LatLngBounds.newInstance();

      double maxTime = model.getMaxTime();

      for (TimedPolygon tp : model.getPolygons()) {

        Polygon poly = tp.getPolyline();

        String color = getColorForTime(tp.getTime(), maxTime);
        double opacity = getOpacityForTime(tp.getTime(), maxTime);

        poly.setFillStyle(PolyStyleOptions.newInstance(color, 1, opacity));
        poly.setStrokeStyle(PolyStyleOptions.newInstance(color, 1, opacity));

        _mapOverlayManager.addOverlay(poly);
        _overlays.add(poly);
        LatLngBounds b = poly.getBounds();
        bounds.extend(b.getNorthEast());
        bounds.extend(b.getSouthWest());
      }

      if (!bounds.isEmpty()) {
        MapWidget map = _mapOverlayManager.getMapWidget();
        if (model.isComplete()) {
View Full Code Here

Examples of com.google.gwt.maps.client.geom.LatLngBounds

      clear();

      double maxTime = model.getMaxTime();

      LatLngBounds bounds = LatLngBounds.newInstance();

      for (TimedRegion region : model.getRegions()) {

        String color = getColorForTime(region.getTime(), maxTime);

        LatLngBounds regionBounds = region.getBounds();
        PatchMarker marker = new PatchMarker(regionBounds);
        Style style = marker.getStyle();
        style.setProperty("backgroundColor", color);
        marker.addStyleName("patch");

        // _overlays.add(marker);
        _mapOverlayManager.addOverlay(marker, 10, 15);

        bounds.extend(regionBounds.getNorthEast());
        bounds.extend(regionBounds.getSouthWest());
      }

      if (!bounds.isEmpty()) {
        MapWidget map = _mapOverlayManager.getMapWidget();
        int zoom = map.getBoundsZoomLevel(bounds);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.