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

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


    int newZoom = uidl.getIntVariable("zoom");
    if (map.getZoomLevel() != newZoom) {
      map.setZoomLevel(newZoom);
    }

    LatLng newCenter = LatLng.newInstance(
        uidl.getDoubleVariable("center_lat"),
        uidl.getDoubleVariable("center_lng"));

    boolean scrollWheelZoomEnabled = uidl.getBooleanVariable("swze");
    if (map.isScrollWheelZoomEnabled() != scrollWheelZoomEnabled) {
      map.setScrollWheelZoomEnabled(scrollWheelZoomEnabled);
    }

    if (map.getCenter().getLatitude() != newCenter.getLatitude()
        || map.getCenter().getLongitude() != newCenter.getLongitude()) {
      map.setCenter(newCenter);
    }

    for (MapControl control : MapControl.values()) {
      if (uidl.hasAttribute(control.name())) {
View Full Code Here


    panel.setWidget(view.asWidget());
  }
 
  public void buildMapsUi(){
    // Open a map centered on 222 Porter Hall at Carnegie Mellon University Information Systems Program
      LatLng cmu_information_systems = LatLng.newInstance(40.44152, -79.946123);
     
      final MapWidget map = new MapWidget(cmu_information_systems, 2);
      map.setSize("60em", "40em");
      // Add some controls for the zoom level
      map.addControl(new LargeMapControl());
View Full Code Here

  public RegionMap(HandlerManager eventBus) {
   
    this.eventBus = eventBus;
   
    //TODO: get center of map from DB
    LatLng center = LatLng.newInstance(0.0, 0.0);
        map = new MapWidget(center, 2);
        mapFirstLoad = true;
       
        map.addMapType(MapType.getNormalMap());
        map.addMapType(MapType.getHybridMap());
View Full Code Here

        {
          currentStudyRegion = event.studyRegion;
          if( currentStudyRegion != null )
          {
            Vertex v = currentStudyRegion.getMapCenter();
            final LatLng center = LatLng.newInstance(v.getLat(), v.getLng());
           
            // do this as a deferred command
                  DeferredCommand.addCommand(new Command() {
                      public void execute() {
                        GWT.log("RegionMap - (on first load only) update to current study region" + currentStudyRegion);
View Full Code Here

          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++) {
              LatLng v = currentPolygon.getVertex(i);
              LatLng p = LatLng.newInstance(v.getLatitude(), v.getLongitude());
              points[i] = p;
            }
              final RegionPolygon p = new RegionPolygon(points);
              p.setRegionDetailsId(currentPolygon.getRegionDetailsId());
              eventBus.fireEvent(new SentUpdatedRegionPolygonEvent(p));
      } else {
        polygon.setEditingEnabled(false);
      }
    }
View Full Code Here

      polygon.addPolygonEndLineHandler(new PolygonEndLineHandler() {
          public void onEnd(PolygonEndLineEvent event) {
           
            currentPolygon = polygon;
           
            LatLng points[] = new LatLng[currentPolygon.getVertexCount()];
            GWT.log("vertex count on add-p-end-line-handler=" + points.length);
            for (int i = 0; i < currentPolygon.getVertexCount(); i++) {
              LatLng v = currentPolygon.getVertex(i);
              LatLng p = LatLng.newInstance(v.getLatitude(), v.getLongitude());
              points[i] = p;
            }
              final RegionPolygon p = new RegionPolygon(points);
              p.setRegionDetailsId(currentPolygon.getRegionDetailsId());
             
              // add a mapCenter and mapZoomLevel to the polygon
              LatLng center = event.getSender().getBounds().getCenter();
              Vertex mapCenter = new Vertex();
              mapCenter.setLat(center.getLatitude());
              mapCenter.setLng(center.getLongitude());
              int mapZoomLevel = map.getZoomLevel();
              p.setMapCenter(mapCenter);
              p.setMapZoomLevel(mapZoomLevel);
             
              eventBus.fireEvent(new EndEditRegionPolygonEvent(p));
          }
        })
    } else {
     
      /**
         * Send a copy of the RegionPolygon to RoadListing
         */
      polygon.addPolygonLineUpdatedHandler(new PolygonLineUpdatedHandler() {
         
      public void onUpdate(PolygonLineUpdatedEvent event) {
            /*
             * If a shape is being edited, it is the current shape
             */
            currentPolygon = polygon;
           
            /*
             * Copy the currentPolygon into a new RegionPolygon
             * in order to send it across the wire.
             */
            LatLng points[] = new LatLng[currentPolygon.getVertexCount()];
            GWT.log("vertex count on update=" + points.length);
            for (int i = 0; i < currentPolygon.getVertexCount(); i++) {
              LatLng v = currentPolygon.getVertex(i);
              LatLng p = LatLng.newInstance(v.getLatitude(), v.getLongitude());
              points[i] = p;
            }
              final RegionPolygon p = new RegionPolygon(points);
              p.setRegionDetailsId(currentPolygon.getRegionDetailsId());
             
              eventBus.fireEvent(new BindPolygonToRegionEvent(p));
          }
        });
     
View Full Code Here

    {
      LatLng[] points = new LatLng[vertices.size()];
      int count = 0;
      for (Iterator iterator = vertices.iterator(); iterator.hasNext();) {
        Vertex v = (Vertex) iterator.next();
        LatLng p = LatLng.newInstance(v.getLat(), v.getLng());
        points[count] = p;
        count++;
      }
      final RegionPolygon polygon = new RegionPolygon(points, polygonColor, weight, opacity, polygonColor, opacity);
      polygon.setRegionDetailsId(zoneDetailsId);
View Full Code Here

   
    this.eventBus = eventBus;
   
    // Accra 5.555717,-0.196306
    //TODO: find a way to let the user decide what the default map center should be
    LatLng center = LatLng.newInstance(5.555717, -0.196306);
        map = new MapWidget(center, 12);
        //Window.alert("Initial map widget hashcode:" + map.hashCode());
       
       
   
View Full Code Here

      public void onUpdate(CurrentStudyRegionUpdatedEvent event) {
        currentStudyRegion = event.studyRegion;
        if( currentStudyRegion != null)
        {
          Vertex v = currentStudyRegion.getMapCenter();
          final LatLng center = LatLng.newInstance(v.getLat(), v.getLng());
         
          // since we have a new current study region, clear map overlays
          map.clearOverlays();
       
          // do this as a deferred command
View Full Code Here

      {
          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());
              points[i] = p;
            }
              final TagPolygon p = new TagPolygon(points);
              p.setZoneDetailsId(currentPolygon.getZoneDetailsId());
              eventBus.fireEvent(new SentUpdatedPolygonEvent(p));
      } else {
        polygon.setEditingEnabled(false);
      }
    }
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.