Package de.fhpotsdam.unfolding.examples.image

Source Code of de.fhpotsdam.unfolding.examples.image.LargeMapImageSaveApp

package de.fhpotsdam.unfolding.examples.image;

import processing.core.PApplet;
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.utils.LargeMapImageUtils;
import de.fhpotsdam.unfolding.utils.MapUtils;

/**
* Uses LargeMapImageUtils to create a large map image, stitched together from multiple map screenshots.
*/
public class LargeMapImageSaveApp extends PApplet {

  // Set to the center location you want to grab the map for.
  Location location = new Location(52.5f, 13.4f);
  // Set to zoom level you want to grab.
  int zoomLevel = 9;

  UnfoldingMap map;

  LargeMapImageUtils lmiUtils;

  public void setup() {
    size(500, 500, OPENGL);

    map = new UnfoldingMap(this);
    map.zoomAndPanTo(location, zoomLevel);
    MapUtils.createDefaultEventDispatcher(this, map);

    println("Init large map image.");
    lmiUtils = new LargeMapImageUtils(this, map);
  }

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

    lmiUtils.run();
  }

  public void keyPressed() {
    if (key == 's') {
      // Around current center and with current zoom level
      lmiUtils.init();
    }
    if (key == 'b') {
      // Around set center and zoom level (pans there before screenshoting)
      lmiUtils.init(location, zoomLevel);
    }
  }
}
TOP

Related Classes of de.fhpotsdam.unfolding.examples.image.LargeMapImageSaveApp

TOP
Copyright © 2018 www.massapi.com. 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.