Exemplo n.º 1
0
 private void firePositionChange(LatLng latLng) {
   geocoderService.reverse(latLng);
   PointProxy point = humWorkflow.createPoint();
   point.setLat(latLng.getLatitude());
   point.setLng(latLng.getLongitude());
   bus.fireEvent(new PointEvent(point));
   modeHolder.userEvent();
 }
Exemplo n.º 2
0
  @Override
  public void dispatch(OverviewEvent event) {
    detachOverview();
    overview.clear();

    if (map == null) {
      pendingOverview = event;
      return;
    }
    for (HumProxy hum : event.hums) {
      PointProxy point = hum.getPoint();
      HumProxy.Level level = hum.getLevel();

      if (point == null || level == null) {
        continue;
      }

      MarkerOptions opts =
          new MarkerOptions.Builder(LatLng.newInstance(point.getLat(), point.getLng()))
              .icon(levelHelper.icon(level))
              .shadow(shadowBuilder.getShadow())
              .animation(Animation.DROP)
              .draggable(false)
              .clickable(false)
              .build();
      Marker marker = Marker.newInstance(opts);
      overview.add(marker);
    }
    detachCurrentHum();
    attachOverview();
  }
Exemplo n.º 3
0
  @Override
  public void dispatch(MapsLoadedEvent event) {
    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.center(LatLng.newInstance(42.163403, -82.900772));
    mapOptions.zoom(11);
    mapOptions.roadmap();
    map = Map.newInstance(mapPlace, mapOptions);

    addClickListener(map, firePositionChange);
    switch (modeHolder.mode()) {
      case NEW: // fall through
      case LAST: // fall through
      case UPDATED:
        if (pendingPoint != null) {
          dispatch(pendingPoint);
          pendingPoint = null;
        }
        if (pendingLevel != null) {
          dispatch(pendingLevel);
          pendingLevel = null;
        }
        break;
      case LIST:
        if (pendingOverview != null) {
          dispatch(pendingOverview);
          pendingOverview = null;
        }
        break;
      default:
        throw new RuntimeException("mode not supported: " + modeHolder.mode());
    }
  }
 protected void drawInfoWindow(LatLng position, double elevation) {
   HTML html = new HTML("Elevation is " + elevation + " at " + position.getToString());
   InfoWindowOptions options = InfoWindowOptions.newInstance();
   options.setContent(html);
   InfoWindow iw = InfoWindow.newInstance(options);
   iw.setPosition(position);
   iw.open(mapWidget);
 }
Exemplo n.º 5
0
 private Marker buildMarkerForCurrentHum(PointProxy point) {
   MarkerOptions opts =
       new MarkerOptions.Builder(LatLng.newInstance(point.getLat(), point.getLng()))
           .icon(levelHelper.icon(HumProxy.Level.HIGH))
           .shadow(shadowBuilder.getShadow())
           //                .shape(red.getShape())
           .animation(Animation.DROP)
           .draggable(true)
           .build();
   Marker marker = Marker.newInstance(opts);
   addDragendListener(marker, firePositionChange);
   return marker;
 }
Exemplo n.º 6
0
 private void putPin(PointProxy point) {
   if (point == null) {
     detachCurrentHum();
     return;
   }
   if (currentHum == null) {
     currentHum = buildMarkerForCurrentHum(point);
     if (pendingLevel != null) {
       dispatch(pendingLevel);
       pendingLevel = null;
     }
   } else {
     currentHum.setPosition(LatLng.newInstance(point.getLat(), point.getLng()));
   }
   attachCurrentHum();
 }
  private void drawMap() {
    LatLng center = LatLng.newInstance(49.496675, -102.65625);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(4);
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.HYBRID);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("100%", "100%");

    mapWidget.addClickHandler(
        new ClickMapHandler() {
          public void onEvent(ClickMapEvent event) {
            // TODO fix the event getting, getting ....
            GWT.log("clicked on latlng=" + event.getMouseEvent().getLatLng());
          }
        });
  }
  private void drawMap() {
    LatLng center = LatLng.newInstance(42.35, -71.07);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(14);
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");

    mapWidget.addClickHandler(
        new ClickMapHandler() {
          public void onEvent(ClickMapEvent event) {
            // TODO fix the event getting, getting ....
            GWT.log("clicked on latlng=" + event.getMouseEvent().getLatLng());
          }
        });
  }