Package de.fhpotsdam.unfolding.utils

Examples of de.fhpotsdam.unfolding.utils.ScreenPosition


   *            Zoom level to zoom to.
   * @param location
   *            The Location to zoom around and pan to.
   */
  public void zoomAndPanTo(int zoomLevel, Location location) {
    ScreenPosition pos = mapDisplay.getScreenPosition(location);
    mapDisplay.setInnerTransformationCenter(new PVector(pos.x, pos.y));
    zoomToLevel(zoomLevel);
    panTo(location);
  }
View Full Code Here


  public void zoomAndPanToFit(List<Location> locations) {
    Location[] boundingBox = GeoUtils.getBoundingBox(locations);
    List<Location> boundingBoxLocations = Arrays.asList(boundingBox);
    Location centerLocation = GeoUtils.getEuclideanCentroid(boundingBoxLocations);
    ScreenPosition pos = mapDisplay.getScreenPosition(centerLocation);
    mapDisplay.setInnerTransformationCenter(new PVector(pos.x, pos.y));
    zoomToFit(boundingBox);
    panTo(centerLocation);
  }
View Full Code Here

    Location[] boundingBox = GeoUtils.getBoundingBox(locations);
    zoomToFit(boundingBox);
  }

  public void zoomToFit(Location[] boundingBox) {
    ScreenPosition nwPos = getScreenPosition(boundingBox[0]);
    ScreenPosition sePos = getScreenPosition(boundingBox[1]);
    float zoomScale = 0.9f / Math.max((sePos.x - nwPos.x) / getWidth(), (sePos.y - nwPos.y) / getHeight());
    innerScale(zoomScale);
  }
View Full Code Here

    map.draw();

    // Draws Markers on screen positions according to their geo-locations.

    // Fixed-size marker
    ScreenPosition posBerlin = markerBerlin.getScreenPosition(map);
    strokeWeight(1);
    stroke(0, 100);
    fill(0, 200, 0, 100);
    ellipse(posBerlin.x, posBerlin.y, 20, 20);

    ScreenPosition posLondon = markerLondon.getScreenPosition(map);
    strokeWeight(12);
    stroke(200, 0, 0, 200);
    strokeCap(SQUARE);
    noFill();
    // Zoom dependent marker size
View Full Code Here

    background(0);
    map.updateMap();

    beginShape();
    for (Location location : MultiMarkerApp.getFranceShapeLocations()) {
      ScreenPosition pos = map.getScreenPosition(location);
      vertex(pos.x, pos.y);
    }
    endShape();
  }
View Full Code Here

    map.draw();

    // Draws locations on screen positions according to their geo-locations.

    // Fixed-size element
    ScreenPosition xyBerlin = map.getScreenPosition(locationBerlin);
    fill(0, 200, 0, 100);
    ellipse(xyBerlin.x, xyBerlin.y, 20, 20);

    // Zoom dependent element size
    ScreenPosition xyLondon = map.getScreenPosition(locationLondon);
    fill(200, 0, 0, 100);
    float s = map.getZoom();
    ellipse(xyLondon.x, xyLondon.y, s, s);
  }
View Full Code Here

    background(255);

    map.draw();

    Location mainLocation = new Location(52.52f, 13.42f);
    ScreenPosition pos = map.getScreenPosition(mainLocation);
    float distanceInKm = getDistance(mainLocation, 5);
    fill(255, 255, 0, 127);
    ellipse(pos.x, pos.y, distanceInKm, distanceInKm);
  }
View Full Code Here

    ellipse(pos.x, pos.y, distanceInKm, distanceInKm);
  }

  public float getDistance(Location mainLocation, float size) {
    Location tempLocation = GeoUtils.getDestinationLocation(mainLocation, 90, size);
    ScreenPosition pos1 = map.getScreenPosition(mainLocation);
    ScreenPosition pos2 = map.getScreenPosition(tempLocation);
    return dist(pos1.x, pos1.y, pos2.x, pos2.y);
  }
View Full Code Here

    background(0);
    map.draw();

    noStroke();
    fill(0, 0, 255);
    ScreenPosition sourcePos = map.getScreenPosition(targetLocation);
    ellipse(sourcePos.x, sourcePos.y, 10, 10);

    fill(255, 0, 0);
    ScreenPosition targetPos = map.getScreenPosition(sourceLocation);
    ellipse(targetPos.x, targetPos.y, 10, 10);

    double bearing = GeoUtils.getAngleBetween(targetLocation, sourceLocation);
    double dist = GeoUtils.getDistance(targetLocation, sourceLocation);

    noFill();
    strokeWeight(4);
    stroke(0, 100);
    beginShape();
    for (float d = 0; d < dist; d += 100) {
      Location tweenLocation = GeoUtils.getDestinationLocation(targetLocation, degrees((float) bearing),
          (float) d);
      ScreenPosition tweenPos = map.getScreenPosition(tweenLocation);
      vertex(tweenPos.x, tweenPos.y);
    }
    endShape();
  }
View Full Code Here

    mapDetail.draw();
  }

  public void updateConnection() {
    // Finder box for overview map
    ScreenPosition tl = mapOverview.mapDisplay.getScreenPosition(mapDetail
        .getTopLeftBorder());
    ScreenPosition br = mapOverview.mapDisplay.getScreenPosition(mapDetail
        .getBottomRightBorder());
    float w = br.x - tl.x;
    float h = br.y - tl.y;
    connection.setOverviewSize(w, h);
    connection.setOverviewPosition(tl.x, tl.y);
View Full Code Here

TOP

Related Classes of de.fhpotsdam.unfolding.utils.ScreenPosition

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.