コード例 #1
0
  private Location getLocationByType(Event event, LocationType type) {
    if (event.getLocations() == null) return null;

    for (Location loc : event.getLocations()) {
      if (loc.getType() == type) {
        return loc;
      }
    }

    return null;
  }
コード例 #2
0
  private List<Marker> createMarkersFromEvents(List<Event> events) {
    List<Marker> markers = new ArrayList<Marker>(events.size());
    for (Event event : events) {
      Location start = getLocationByType(event, LocationType.START);
      if (start != null) {
        Marker marker =
            new Marker(
                new LatLng(start.getPoint().getCoordinate().y, start.getPoint().getCoordinate().x));
        marker.setTitle(event.getName());
        marker.setData(event);
        if (event.getPublicEvent() != null && event.getPublicEvent().booleanValue()) {
          marker.setIcon("http://maps.google.com/mapfiles/ms/micons/green-dot.png");
        }

        markers.add(marker);
      }
    }

    return markers;
  }