Package com.google.gwt.maps.client.geom

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


  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

  }

  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

    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

  }

  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

  }

  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

            assertEquals("convertLatLngToDivPixel().getX() == 250", 250,
                result.getX());
            assertEquals("convertLatLngToDivPixel().getY() == 250", 250,
                result.getY());

            LatLng latLng;
            latLng = m.convertContainerPixelToLatLng(Point.newInstance(100, 100));
            assertNotNull("convertContainerPixelToLatLng()", result);
            latLng = m.convertDivPixelToLatLng(Point.newInstance(100, 100));
            assertNotNull("convertDivPixelToLatLng()", result);

            latLng = m.convertContainerPixelToLatLng(Point.newInstance(250, 250));
            assertNotNull("convertContainerPixelToLatLng()", result);
            assertTrue(latLng.isEquals(LatLng.newInstance(0, 0)));
            latLng = m.convertDivPixelToLatLng(Point.newInstance(250, 250));
            assertNotNull("convertDivPixelToLatLng()", result);
            assertTrue(latLng.isEquals(LatLng.newInstance(0, 0)));
            finishTest();
          }
        }.schedule(1000);
      }
    }, false);
View Full Code Here

    handlerTable.setHTML(0, 2, "<b>Events</b>");
  }

  private void computeAtlantaTriangle() {
    LatLngBounds bounds = map.getBounds();
    LatLng center = map.getCenter();
    LatLng ne = bounds.getNorthEast();
    LatLng sw = bounds.getSouthWest();
    GWT.log("ne=" + ne + ", sw=" + sw, null);
    double vertDelta = ne.getLatitude() - sw.getLatitude();
    double horizDelta = ne.getLongitude() - sw.getLongitude();
    double vertGrid = vertDelta / 4.0;
    double horizGrid = horizDelta / 8.0;

    // A triangle pointing north to the west of the center of the map.
    ATLANTA_TRIANGLE1[0] = LatLng.newInstance(center.getLatitude() + vertGrid,
View Full Code Here

    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));
    }
  }
View Full Code Here

  public void testMapOptions() {
    loadApi(new Runnable() {
      public void run() {

        LatLng atlanta = LatLng.newInstance(33.7814790, -84.3880580);
        MapOptions options = MapOptions.newInstance();

        // Test the setters
        options.setBackgroundColor("#f00");
        options.setDraggableCursor("text");
View Full Code Here

TOP

Related Classes of com.google.gwt.maps.client.geom.LatLng

Copyright © 2018 www.massapicom. 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.