Package de.fhpotsdam.unfolding.marker

Examples of de.fhpotsdam.unfolding.marker.Marker


      marker.setSelected(false);
    }

    // Select hit marker
    // Note: Use getHitMarkers(x, y) if you want to allow multiple selection.
    Marker marker = map.getFirstHitMarker(mouseX, mouseY);
    if (marker != null) {
      marker.setSelected(true);
    }
  }
View Full Code Here


    background(240);
    map.draw();
  }

  public void mouseMoved() {
    Marker marker = map.getDefaultMarkerManager().getNearestMarker(mouseX, mouseY);
    if (marker != null) {
      for (Marker countryMarker : countryMarkers) {
        countryMarker.setSelected(countryMarker == marker);
      }
    }
View Full Code Here

  }

  private MarkerManager<Marker> populateDetailsMarkerManager() {
    MarkerManager<Marker> markerManager = new MarkerManager<Marker>();

    Marker nycMarker1 = new SimplePointMarker(new Location(40.763, -73.979));
    markerManager.addMarker(nycMarker1);
    Marker nycMarker2 = new SimplePointMarker(new Location(40.852, -73.882));
    markerManager.addMarker(nycMarker2);
    Marker nycMarker3 = new SimplePointMarker(new Location(40.656, -73.944));
    markerManager.addMarker(nycMarker3);
    Marker nycMarker4 = new SimplePointMarker(new Location(40.739, -73.802));
    markerManager.addMarker(nycMarker4);

    Marker bostonMarker1 = new SimplePointMarker(new Location(42.3603, -71.060));
    markerManager.addMarker(bostonMarker1);
    Marker bostonMarker2 = new SimplePointMarker(new Location(42.3689, -71.097));
    markerManager.addMarker(bostonMarker2);

    return markerManager;
  }
View Full Code Here

   *            The MultiMarker consisting of multiple markers.
   * @return The largest marker.
   */
  public static Marker getLargestMarker(MultiMarker multiMarker) {
    float largestArea = 0;
    Marker largestMarker = null;
    for (Marker f : multiMarker.getMarkers()) {
      if (largestArea < getArea(f)) {
        largestMarker = f;
        largestArea = getArea(f);
      }
View Full Code Here

  public void mouseMoved() {
    // Not via marker.isInside(...) as this example supports both MultiMarker and two markers.
    // multiMarker.isInside(map, mouseX, mouseY);

    Marker hitMarker = map.getDefaultMarkerManager().getFirstHitMarker(mouseX, mouseY);
    if (hitMarker != null) {
      hitMarker.setSelected(true);
    } else {
      for (Marker marker : map.getDefaultMarkerManager().getMarkers()) {
        marker.setSelected(false);
      }
    }
View Full Code Here

      for (Marker marker : map.getMarkers()) {
        marker.setSelected(false);
      }

      // Select hit marker
      Marker marker = map.getFirstHitMarker(mouseX, mouseY);
      if (marker != null) {
        marker.setSelected(true);
      }
    }
  }
View Full Code Here

  public List<Marker> createMarkers(List<Feature> features) {
    List<Marker> markers = new ArrayList<Marker>();

    try {
      for (Feature feature : features) {
        Marker marker = createMarker(feature);
        markers.add(marker);
      }

    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

   * @param feature
   *            The feature.
   * @return A marker of the appropriate type with ID and properties.
   */
  public Marker createMarker(Feature feature) throws Exception {
    Marker marker = null;

    switch (feature.getType()) {
    case POINT:
      marker = createPointMarker((PointFeature) feature);
      break;
    case LINES:
      marker = createLinesMarker((ShapeFeature) feature);
      break;
    case POLYGON:
      marker = createPolygonMarker((ShapeFeature) feature);
      break;
    case MULTI:
      marker = createMultiMarker((MultiFeature) feature);
      break;
    }

    // Set id
    marker.setId(feature.getId());

    // Copy properties
    marker.setProperties(feature.getProperties());

    return marker;
  }
View Full Code Here

    featureMarkerMap.put(FeatureType.POLYGON, polygonMarkerClass);
  }

  protected Marker createPointMarker(PointFeature feature) throws Exception {
    Class markerClass = featureMarkerMap.get(feature.getType());
    Marker marker = null;
    try {
      Constructor markerConstructor = markerClass.getDeclaredConstructor(Location.class, HashMap.class);
      marker = (Marker) markerConstructor.newInstance(feature.getLocation(), feature.getProperties());
    } catch (NoSuchMethodException e) {
      Constructor markerConstructor = markerClass.getDeclaredConstructor(Location.class);
      marker = (Marker) markerConstructor.newInstance(feature.getLocation());
      marker.setProperties(feature.getProperties());
    }
    return marker;
  }
View Full Code Here

    return marker;
  }

  protected Marker createLinesMarker(ShapeFeature feature) throws Exception {
    Class markerClass = featureMarkerMap.get(feature.getType());
    Marker marker = null;
    try {
      Constructor markerConstructor = markerClass.getDeclaredConstructor(List.class, HashMap.class);
      marker = (Marker) markerConstructor.newInstance(feature.getLocations(), feature.getProperties());
    } catch (NoSuchMethodException e) {
      Constructor markerConstructor = markerClass.getDeclaredConstructor(List.class);
      marker = (Marker) markerConstructor.newInstance(feature.getLocations());
      marker.setProperties(feature.getProperties());
    }
    return marker;
  }
View Full Code Here

TOP

Related Classes of de.fhpotsdam.unfolding.marker.Marker

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.