Package com.google.gwt.maps.client.overlay

Examples of com.google.gwt.maps.client.overlay.Polyline


          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));
        map.addOverlay(pline);
      }
        break;
      case TEST_POLYLINE_ENCODED_TRANSPARENT: {
        // Add a polyline with transparency
        map.setCenter(LatLng.newInstance(40.71213418976525, -73.96785736083984), 15);
        Polyline pline = Polyline.fromEncoded(ENCODED_POINTS, 32,
            ENCODED_LEVELS, 4);
        map.addOverlay(pline);
      }
        break;
View Full Code Here


  private void createPolyline() {
    PolyStyleOptions style = PolyStyleOptions.newInstance(color, weight,
        opacity);

    final Polyline poly = new Polyline(new LatLng[0]);
    lastPolyline = poly;
    map.addOverlay(poly);
    poly.setDrawingEnabled();
    poly.setStrokeStyle(style);
    message2.setText("");
    poly.addPolylineLineUpdatedHandler(new PolylineLineUpdatedHandler() {

      public void onUpdate(PolylineLineUpdatedEvent event) {
        message2.setText(message2.getText() + " : Line Updated");
      }
    });

    poly.addPolylineCancelLineHandler(new PolylineCancelLineHandler() {

      public void onCancel(PolylineCancelLineEvent event) {
        message2.setText(message2.getText() + " : Line Canceled");
      }
    });

    poly.addPolylineEndLineHandler(new PolylineEndLineHandler() {

      public void onEnd(PolylineEndLineEvent event) {
        message2.setText(message2.getText() + " : Line End at "
            + event.getLatLng() + ".  Bounds="
            + poly.getBounds().getNorthEast() + ","
            + poly.getBounds().getSouthWest() + " length=" + poly.getLength()
            + "m");
      }
    });
  }
View Full Code Here

  public void onShow() {
    map.addOverlay(marker);
    if (firstTime) {
      computeAtlantaTriangle();
      polygon = new Polygon(ATLANTA_TRIANGLE1);
      polyline = new Polyline(ATLANTA_TRIANGLE2);
      firstTime = false;
    }
  }
View Full Code Here

    String color = polyUIDL.getStringAttribute("color");
    int weight = polyUIDL.getIntAttribute("weight");
    double opacity = polyUIDL.getDoubleAttribute("opacity");
    boolean clickable = polyUIDL.getBooleanAttribute("clickable");

    return new Polyline(points, color, weight, opacity,
        PolylineOptions.newInstance(clickable, false));
  }
View Full Code Here

      LatLng a = LatLng.newInstance(lb.getMinLat(), lb.getMinLon());
      LatLng b = LatLng.newInstance(lb.getMaxLat(), lb.getMinLon());
      LatLng c = LatLng.newInstance(lb.getMaxLat(), lb.getMaxLon());
      LatLng d = LatLng.newInstance(lb.getMinLat(), lb.getMaxLon());
      LatLng[] points = {a, b, c, d, a};
      Polyline line = new Polyline(points);
      _mapManager.addOverlay(line, 10, 20);

      Marker marker = new Marker(b);
      marker.addMarkerClickHandler(new MarkerClickHandler() {
        public void onClick(MarkerClickEvent event) {
View Full Code Here

        if (path != null) {

          List<CoordinatePoint> points = PolylineEncoder.decode(path);
          EncodedPolylineBean bean = PolylineEncoder.createEncodings(points);
         
          Polyline line = getPathAsPolyline(bean);
          PolyStyleOptions style = PolyStyleOptions.newInstance("#0000FF", 4,
              0.5);
          line.setStrokeStyle(style);
          resultingOverlays.add(line);

          addBoundsToBounds(line.getBounds(), bounds);
        }

        StopBean stop = leg.getFromStop();

        if (stop != null) {
          String routeName = leg.getRouteShortName();

          TripPlannerResources resources = TripPlannerResources.INSTANCE;
          SpanPanel w = new SpanPanel();
          w.addStyleName(_css.routeTinyInfoWindow());
          Image image = new Image(resources.getBus14x14().getUrl());
          image.addStyleName(_css.routeModeIcon());
          w.add(image);
          SpanWidget name = new SpanWidget(routeName);
          name.setStyleName(_css.routeName());
          w.add(name);

          LatLng point = LatLng.newInstance(stop.getLat(), stop.getLon());
          TinyInfoWindowMarker marker = new TinyInfoWindowMarker(point, w);
          resultingOverlays.add(marker);

          bounds.extend(point);
        }
      } else if (mode.equals("walk")) {
        List<StreetLegBean> streetLegs = segment.getStreetLegs();
        List<CoordinatePoint> allPoints = new ArrayList<CoordinatePoint>();
        for (StreetLegBean streetLeg : streetLegs) {
          String path = streetLeg.getPath();
          List<CoordinatePoint> points = PolylineEncoder.decode(path);
          allPoints.addAll(points);
        }
        EncodedPolylineBean polyline = PolylineEncoder.createEncodings(allPoints);
        Polyline line = getPathAsPolyline(polyline);
        PolyStyleOptions style = PolyStyleOptions.newInstance("#000000", 4, 0.8);
        line.setStrokeStyle(style);
        resultingOverlays.add(line);

        addBoundsToBounds(line.getBounds(), bounds);
      }
    }

    for (Overlay overlay : resultingOverlays)
      _map.addOverlay(overlay);
View Full Code Here

      EncodedPolyline epl = EncodedPolyline.newInstance(path.getPoints(), 32,
          path.getLevels(3), 4);
      epl.setColor("#4F64BA");
      epl.setWeight(3);
      epl.setOpacity(1.0);
      Polyline polyline = Polyline.fromEncoded(epl);
      _manager.addOverlay(polyline);
      _otherOverlays.add(polyline);
    }

    if (centerViewOnRoute) {
View Full Code Here

TOP

Related Classes of com.google.gwt.maps.client.overlay.Polyline

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.