Package de.fhpotsdam.unfolding.geo

Examples of de.fhpotsdam.unfolding.geo.Location


  public void mouseClicked() {
    if (mouseEvent.getClickCount() == 2) {
      float mx = mousePos[0];
      float my = mousePos[1];
      Location location = map.getLocation(mx, my);
      map.panTo(location);
    }
  }
View Full Code Here


      PointFeature pointFeature = (PointFeature) feature;

      JSONArray coords = geometry.getJSONArray("coordinates");
      double lat = coords.getDouble(1);
      double lon = coords.getDouble(0);
      pointFeature.setLocation(new Location((float) lat, (float) lon));
    }

    if (featureType.equals("MultiPoint")) {
      PApplet.println("MultiPoint not supported, yet.");
    }
View Full Code Here

  private static void populateLinesFeature(ShapeFeature linesFeature, JSONArray coordinates) throws JSONException {
    for (int i = 0; i < coordinates.length(); i++) {
      JSONArray coords = coordinates.getJSONArray(i);
      double lat = coords.getDouble(1);
      double lon = coords.getDouble(0);
      linesFeature.addLocation(new Location((float) lat, (float) lon));
    }

  }
View Full Code Here

  private static void populatePolygonFeature(ShapeFeature polygonFeature, JSONArray coordinates) throws JSONException {
    for (int i = 0; i < coordinates.length(); i++) {
      double lon = coordinates.getJSONArray(i).getDouble(0);
      double lat = coordinates.getJSONArray(i).getDouble(1);
      polygonFeature.addLocation(new Location((float) lat, (float) lon));
    }
  }
View Full Code Here

  public void setup() {
    size(800, 600, P2D);

    map = new UnfoldingMap(this);
    map.zoomAndPanTo(10, new Location(52.5f, 13.4f));
    MapUtils.createDefaultEventDispatcher(this, map);
  }
View Full Code Here

      XML trackPoint = itemXML[i];

      // Adds location for track point
      float lat = trackPoint.getFloat("lat");
      float lon = trackPoint.getFloat("lon");
      Location location = new Location(lat, lon);
      trackFeature.addLocation(location);

      XML trackPointTime = trackPoint.getChild("time");
      if (trackPointTime != null) {
        trackPointTimes.add(trackPointTime.getContent());
View Full Code Here

  public void draw() {
    map.draw();

    fill(215, 0, 0, 100);
    // Shows latitude,longitude at mouse position
    Location location = map.getLocation(mouseX, mouseY);
    text("geo:" + location.toString(), mouseX, mouseY);

    // Shows marker at Berlin location
    Location loc = new Location(52.5f, 13.4f);
    ScreenPosition pos = map.getScreenPosition(loc);
    ellipse(pos.x, pos.y, 20, 20);

    String berlinDescription = "Berlin at pixel (" + (int) pos.x + "," + (int) pos.y + ")";
    text(berlinDescription, pos.x, pos.y);
View Full Code Here

  public void setup() {
    size(800, 600, OPENGL);

    map = new UnfoldingMap(this);
    map.zoomAndPanTo(new Location(centerLocation), 12);
    map.setPanningRestriction(centerLocation, maxPanningDistance);
    map.setZoomRange(12, 15);

    MapUtils.createDefaultEventDispatcher(this, map);
  }
View Full Code Here

  public void setup() {
    size(800, 600, OPENGL);

    map = new UnfoldingMap(this);
    map.zoomAndPanTo(new Location(52.5, 13.4f), 10);
    map.setZoomRange(10, 12);
    MapUtils.createDefaultEventDispatcher(this, map);
  }
View Full Code Here

  public void mapChanged(MapEvent mapEvent) {
    restrictPanning();
  }

  public void restrictPanning() {
    Location mapTopLeft = map.getTopLeftBorder();
    Location mapBottomRight = map.getBottomRightBorder();

    ScreenPosition mapTopLeftPos = map.getScreenPosition(mapTopLeft);
    ScreenPosition boundTopLeftPos = map.getScreenPosition(boundTopLeft);
    if (boundTopLeft.getLon() > mapTopLeft.getLon()) {
      map.panBy(mapTopLeftPos.x - boundTopLeftPos.x, 0);
    }
    if (boundTopLeft.getLat() < mapTopLeft.getLat()) {
      map.panBy(0, mapTopLeftPos.y - boundTopLeftPos.y);
    }

    ScreenPosition mapBottomRightPos = map.getScreenPosition(mapBottomRight);
    ScreenPosition boundBottomRightPos = map.getScreenPosition(boundBottomRight);
    if (boundBottomRight.getLon() < mapBottomRight.getLon()) {
      map.panBy(mapBottomRightPos.x - boundBottomRightPos.x, 0);
    }
    if (boundBottomRight.getLat() > mapBottomRight.getLat()) {
      map.panBy(0, mapBottomRightPos.y - boundBottomRightPos.y);
    }
  }
View Full Code Here

TOP

Related Classes of de.fhpotsdam.unfolding.geo.Location

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.