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

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


   * Returns the point corresponding to the decoded address.
   *
   * @return the point corresponding to the decoded address.
   */
  public LatLng getPoint() {
    return new LatLng(nativeGetLat(jsoPeer), nativeGetLng(jsoPeer));
  }
View Full Code Here


   * Notifies the map of a change of the size of its container. Call this method
   * after the size of the container DOM object has changed, so that the map can
   * adjust itself to fit the new size.
   */
  public void checkResize() {
    LatLng center = getCenter();
    MapImpl.impl.checkResize(jsoPeer);
    setCenter(center);
  }
View Full Code Here

            Log.debug("In CollegeBound");
            double latitude = Double.parseDouble(getParam("latitude"));

            double longitude = Double.parseDouble(getParam("longitude"));

            LatLng collegeCenter = new LatLng(latitude, longitude);

            if (latitude == -1 && longitude == -1) {
                map = new MapWidget();
            } else {
                map = new MapWidget(collegeCenter, DEFAULT_ZOOM);
View Full Code Here

       
       
    }

    private Marker createMarker(final School school) {
        LatLng point = new LatLng(school.getLatitude(), school
                .getLongitude());
        if (point.getLatitude() == -1 && point.getLongitude() == -1) {
            return null;
        }

        final Marker marker = new Marker(point);
        marker.addMarkerClickListener(new MarkerClickListener() {
View Full Code Here

  {
    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    if( polyline != null)
    {
      for (int i = 0; i < polyline.getVertexCount(); i++) {
        LatLng latLng = polyline.getVertex(i);
        Vertex v = new Vertex();
        v.setLat(latLng.getLatitude());
        v.setLng(latLng.getLongitude());
        vertices.add(v);
      }
    } else {
      throw new Exception("Please draw a road before saving road details");
    }
View Full Code Here

        for (Iterator<StudyRegion> iterator = studyRegionList.iterator(); iterator
            .hasNext();) {
          StudyRegion studyRegion = (StudyRegion) iterator.next();
          if( studyRegion.getId().equals(currentStudyRegionId))
          {
            LatLng center = event.center;
            int mapZoomLevel = event.zoomLevel;
           
            // convert LatLng to Vertex
            Vertex mapCenter = new Vertex();
            mapCenter.setLat(center.getLatitude());
            mapCenter.setLng(center.getLongitude());
           
            studyRegion.setMapCenter(mapCenter);
            studyRegion.setMapZoomLevel(mapZoomLevel);
           
            GWT.log("DUPE Study region now has map view:" + studyRegion);
View Full Code Here

  {
    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

  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

  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

  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

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.