public void filterChange() {

    this.filteredEvents = new ArrayList<Event>();
    EventFilter eventFilter = new EventFilter();

    logger.info("filter event");

    if (selectedOptions.size() == ALL_OPTIONS_SELECTED || selectedOptions.size() == 0) {

      this.filteredEvents = this.events;
    } else {

      for (String filter : selectedOptions) {

        if (filter.equals("past")) {
          this.filteredEvents.addAll((eventFilter.filterPastEvents(this.events)));

        } else if (filter.equals("upcoming")) {
          this.filteredEvents.addAll(eventFilter.filterUpcomingEvents(this.events));

        } else {
          this.filteredEvents.addAll(eventFilter.filterActiveEvents(this.events));
        }
      }
    }

    List<Marker> markers = createMarkersFromEvents(this.filteredEvents);
    mapModel.getMarkers().clear();
    for (Marker marker : markers) {
      mapModel.addOverlay(marker);
    }
  }
  private void generateMapParams() {
    MapUtils mapUtils = new MapUtils();
    mapUtils.computeGeoAverage(mapModel.getMarkers());

    center = mapUtils.getLastAvgLat() + ", " + mapUtils.getLastAvgLon();

    zoom = String.valueOf(mapUtils.computeZoom(mapModel.getMarkers(), 800, 400));
  }
Exemplo n.º 3
0
 public void addMarker(ActionEvent actionEvent) {
   Marker marker = new Marker(new LatLng(lat, lng), title);
   marker.setDraggable(true);
   draggableModel.addOverlay(marker);
   addMessage(
       new FacesMessage(
           FacesMessage.SEVERITY_INFO, "Marca agregada", "Lat:" + lat + ", Lng:" + lng));
   for (Marker marker1 : draggableModel.getMarkers()) {
     marker1.setDraggable(true);
   }
 }
Exemplo n.º 4
0
  public StartStationMapBean() {
    draggableModel = new DefaultMapModel();

    // Shared coordinates
    LatLng coord1 = new LatLng(50.784361, 6.053046);
    LatLng coord2 = new LatLng(51.214619, 6.792017);

    // Draggable
    draggableModel.addOverlay(new Marker(coord1, "Aachen, Kastanienweg 13"));
    draggableModel.addOverlay(new Marker(coord2, "Düsseldorf"));

    for (Marker marker : draggableModel.getMarkers()) {
      marker.setDraggable(true);
    }
  }
Exemplo n.º 5
0
  /** Initializes the map */
  @PostConstruct
  private void init() {
    map = new DefaultMapModel();

    LatLng coord = new LatLng(baseStationBean.getLatitude(), baseStationBean.getLongitude());

    Marker marker = new Marker(coord);
    marker.setDraggable(true);

    map.addOverlay(marker);
  }
Exemplo n.º 6
0
 public void addRequirement() {
   Marker marker = new Marker(new LatLng(lat, lng), description);
   emptyModel.addOverlay(marker);
   FacesContext.getCurrentInstance()
       .addMessage(
           null,
           new FacesMessage(
               FacesMessage.SEVERITY_INFO,
               "Requirenment Added",
               "types:" + aptTypes + "Min:" + minCost + "Max:" + maxCost + "Lat:" + lat + ", Lng:"
                   + lng));
 }
Exemplo n.º 7
0
  public MapBean() {
    polygonModel = new DefaultMapModel();

    // Shared coordinates
    LatLng coord1 = new LatLng(36.879466, 30.667648);
    LatLng coord2 = new LatLng(36.883707, 30.689216);
    LatLng coord3 = new LatLng(36.879703, 30.706707);

    // Polygon
    Polygon polygon = new Polygon();
    polygon.getPaths().add(coord1);
    polygon.getPaths().add(coord2);
    polygon.getPaths().add(coord3);

    polygon.setStrokeColor("#FF9900");
    polygon.setFillColor("#FF9900");
    polygon.setStrokeOpacity(0.7);
    polygon.setFillOpacity(0.7);

    polygonModel.addOverlay(polygon);

    // Shared coordinates
    coord1 = new LatLng(36.877466, 30.666648);
    coord2 = new LatLng(36.884707, 30.688216);
    coord3 = new LatLng(36.873703, 30.705707);

    // Polygon
    polygon = new Polygon();
    polygon.getPaths().add(coord1);
    polygon.getPaths().add(coord2);
    polygon.getPaths().add(coord3);

    polygon.setStrokeColor("#FF9700");
    polygon.setFillColor("#FF9600");
    polygon.setStrokeOpacity(0.8);
    polygon.setFillOpacity(0.9);

    polygonModel.addOverlay(polygon);
  }
  @PostConstruct
  private void init() {
    mapModel = new DefaultMapModel();
    this.events = eventDAO.findAllByOwner(signedMember);
    this.filteredEvents = events;

    List<Marker> markers = createMarkersFromEvents(this.filteredEvents);
    for (Marker marker : markers) {
      mapModel.addOverlay(marker);
    }

    generateMapParams();
  }
Exemplo n.º 9
0
  @PostConstruct
  public void init() {

    circleModel = new DefaultMapModel();

    // Shared coordinates
    LatLng coord1 = new LatLng(36.879466, 30.667648);
    LatLng coord4 = new LatLng(36.885233, 30.702323);

    // Circle
    Circle circle1 = new Circle(coord1, 500);
    circle1.setStrokeColor("#d93c3c");
    circle1.setFillColor("#d93c3c");
    circle1.setFillOpacity(0.5);

    Circle circle2 = new Circle(coord4, 300);
    circle2.setStrokeColor("#00ff00");
    circle2.setFillColor("#00ff00");
    circle2.setStrokeOpacity(0.7);
    circle2.setFillOpacity(0.7);

    circleModel.addOverlay(circle1);
    circleModel.addOverlay(circle2);
  }
Exemplo n.º 10
0
 /** Disables drag on the map. Used for viewing. */
 public void disableDrag() {
   map.getMarkers().get(0).setDraggable(false);
 }
Exemplo n.º 11
0
  /** Called when a latitude/longitude change happens in the BaseStationBean class. */
  public void onLatLngChange() {
    double lat = baseStationBean.getLatitude();
    double lng = baseStationBean.getLongitude();

    map.getMarkers().get(0).setLatlng(new LatLng(lat, lng));
  }