// A suggested helper method that takes in an earthquake feature and
  // returns a SimplePointMarker for that earthquake
  // Done: Implement this method and call it from setUp, if it helps
  private SimplePointMarker createMarker(PointFeature feature) {
    // finish implementing and use this method, if it helps.
    SimplePointMarker spm = new SimplePointMarker(feature.getLocation());

    Object magnitudeProp = feature.getProperty("magnitude");

    float magnitude = Float.parseFloat(magnitudeProp.toString());

    if (magnitude < 4.0) {
      spm.setColor(color(0, 0, 255));
      spm.setRadius(5);
    } else if (magnitude >= 4.0 && magnitude < 5) {
      spm.setColor(color(255, 255, 0));
      spm.setRadius(10);
    } else {
      spm.setColor(color(255, 0, 0));
      spm.setRadius(15);
    }
    return spm;
  }
예제 #2
0
  public void setup() {
    size(800, 600, OPENGL);
    // size(800, 600);
    smooth();

    map = new UnfoldingMap(this);
    map.zoomToLevel(3);
    map.panTo(new Location(40f, -98f));
    MapUtils.createDefaultEventDispatcher(this, map);

    Location berlinLocation = new Location(40f, -98f);
    berlinMarker = new TestMarker(berlinLocation);
    berlinMarker.setColor(color(255, 0, 0, 100));
    berlinMarker.setStrokeColor(color(255, 0, 0));
    berlinMarker.setStrokeWeight(2);
    map.addMarkers(berlinMarker);
  }