Examples of LatLng


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

  {
    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    if( polygon != null)
    {
      for (int i = 0; i < polygon.getVertexCount(); i++) {
        LatLng latLng = polygon.getVertex(i);
        Vertex v = new Vertex();
        v.setLat(latLng.getLatitude());
        v.setLng(latLng.getLongitude());
        vertices.add(v);
      }
    } else {
      throw new Exception("Please draw a study region on the map before trying to save");
    }
View Full Code Here

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

  public void loadRegionDetails(StudyRegion studyRegion)
  {
    // send a message to RegionMap to set the associated polygon to editable
    String id = studyRegion.getId();
    Vertex v = studyRegion.getMapCenter();
    LatLng center = LatLng.newInstance(v.getLat(), v.getLng());
    int zoomLevel = studyRegion.getMapZoomLevel();
   
    eventBus.fireEvent(new EditRegionSegmentEvent(id, center, zoomLevel));
   
    name.setText(studyRegion.getName());
View Full Code Here

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

  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());
      map.addOverlay(createMarker(point, i + 1));
    }
  }
View Full Code Here

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

  private void displayOverlay() {

    map.clearOverlays();

    LatLngBounds bounds = map.getBounds();
    LatLng southWest = bounds.getSouthWest();
    LatLng northEast = bounds.getNorthEast();
    double lngSpan = northEast.getLongitude() - southWest.getLongitude();
    double latSpan = northEast.getLatitude() - southWest.getLatitude();

    LatLng[] points = new LatLng[NUM_POINTS];

    for (int i = 0; i < NUM_POINTS; i++) {
      points[i] = LatLng.newInstance(southWest.getLatitude() + latSpan * Math.random(),
          southWest.getLongitude() + lngSpan * Math.random());
      GWT.log("points[" + i + "] = " + points[i] + " z-index = "
          + Marker.getZIndex(points[i].getLatitude()), null);
    }

    OverlayDemos selected = OverlayDemos.values()[actionListBox.getSelectedIndex()];

    switch (selected) {
      case TEST_TEN_MARKERS: {
        // Add markers in random locations on the map
        for (int i = 0; i < NUM_POINTS; i++) {
          map.addOverlay(new Marker(points[i]));
        }
      }
        break;

      case TEST_POLYLINE_ONE: {
        // Add a polyline with NUM_POINTS random points. Sort the points by
        // longitude so that the line does not intersect itself.
        Arrays.sort(points, new Comparator<LatLng>() {
          public int compare(LatLng p1, LatLng p2) {
            return new Double(p1.getLongitude()).compareTo(new Double(
                p2.getLongitude()));
          }
        });
        Polyline pline = new Polyline(points);
        map.addOverlay(pline);
        if (pline.getVertexCount() != NUM_POINTS) {
          Window.alert("Created polyline with " + NUM_POINTS
              + " vertices, but now it has " + pline.getVertexCount());
        }
      }
        break;

      case TEST_POLYLINE_ENCODED: {
        // Add a polyline encoded in a string
        map.setCenter(LatLng.newInstance(40.71213418976525, -73.96785736083984), 15);
        Polyline pline = Polyline.fromEncoded("#3333cc", 10, 1.0,
            ENCODED_POINTS, 32, ENCODED_LEVELS, 4);
        map.addOverlay(pline);
      }
        break;
      case TEST_POLYLINE_GEODESIC: {
        LatLng nycToZurich[] = {LatLng.newInstance(40.75, -73.90), // New York
            LatLng.newInstance(47.3, 8.5) // Zurich
        };
        map.setCenter(LatLng.newInstance(40, -25), 2);
        Polyline pline = new Polyline(nycToZurich, "#FF0000", 1, .75,
            PolylineOptions.newInstance(false, true));
View Full Code Here

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

    // The map's bounds are meaningless until the map has been added to the DOM
    // and sized appropriately
    if (firstTime) {
      firstTime = false;
      LatLngBounds bounds = map.getBounds();
      LatLng southWest = bounds.getSouthWest();
      LatLng northEast = bounds.getNorthEast();
      double lngDelta = (northEast.getLongitude() - southWest.getLongitude()) / 4;
      double latDelta = (northEast.getLatitude() - southWest.getLatitude()) / 4;

      // generate bounds that covers center map with half the width and height
      LatLngBounds rectBounds = LatLngBounds.newInstance(LatLng.newInstance(
          southWest.getLatitude() + latDelta, southWest.getLongitude()
              + lngDelta), LatLng.newInstance(northEast.getLatitude() - latDelta,
          northEast.getLongitude() - lngDelta));

      map.addOverlay(new RectangleOverlay(rectBounds, 2));
    }
  }
View Full Code Here

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

  public void gwtSetUp() {
    TestUtilities.cleanDom();
  }

  public MapWidget initMap() {
    LatLng atlanta = LatLng.newInstance(33.7814790, -84.3880580);
    MapWidget map = new MapWidget(atlanta, 8);
    map.setSize("300px", "300px");
    RootPanel.get().add(map);
    return map;
  }
View Full Code Here

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

  }

  public void testMapUIOptions() {
    loadApi(new Runnable() {
      public void run() {
        LatLng atlanta = LatLng.newInstance(33.7814790, -84.3880580);
        MapWidget map = new MapWidget(atlanta, 8);
        map.setSize("300px", "300px");
        RootPanel.get().add(map);

        // A set of options for a small map.
View Full Code Here

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

    assertFalse("Expected the MAPS api to be missing.", Maps.isLoaded());
  }

  public void testLatLngNotLoaded() {
    try {
      LatLng l = LatLng.newInstance(45, 45);
      assertNull("did not expect initialization to succeed", l);
      assertTrue("Expected an exception", false);
    } catch (RuntimeException ex) {
      // Test passed!
    }
View Full Code Here

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

  }

  public void testKeyboardHandler() {
    loadApi(new Runnable() {
      public void run() {
        LatLng center = LatLng.newInstance(0, 0);
        final MapWidget map = new MapWidget(center, 1);
        map.setSize("300px", "300px");
        map.installKeyboardHandler();
        RootPanel.get().add(map);
      }
View Full Code Here

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

  }

  public void testMapWidgetCloseInfoWindow() {
    loadApi(new Runnable() {
      public void run() {
        LatLng center = LatLng.newInstance(0, 0);
        final MapWidget map = new MapWidget(center, 1);
        map.setSize("300px", "300px");
        RootPanel.get().add(map);
        InfoWindowContent content = new InfoWindowContent("<i>Hello World!</i>");
        InfoWindow info = map.getInfoWindow();
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.