Examples of ZoomMapEvent


Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

  public void mouseWheel(float delta) {
    for (UnfoldingMap map : maps) {
      if (map.isHit(mouseX, mouseY)) {
        // log.debug("mouse: fire zoomBy for " + map.getId());

        ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, map.getId(), ZoomMapEvent.ZOOM_BY_LEVEL);

        // Use location as zoom center, so listening maps can zoom correctly
        Location location = map.getLocation(mouseX, mouseY);
        zoomMapEvent.setTransformationCenterLocation(location);

        // Zoom in or out
        if (delta < 0) {
          zoomMapEvent.setZoomLevelDelta(1);
        } else if (delta > 0) {
          zoomMapEvent.setZoomLevelDelta(-1);
        }

        eventDispatcher.fireMapEvent(zoomMapEvent);
      }
    }
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

  public void keyPressed(char key, int keyCode) {
    for (UnfoldingMap map : maps) {
      if (map.isActive()) {
        if (key == '+' || key == '-') {
          ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, map.getId());
          zoomMapEvent.setTransformationCenterLocation(map.getCenter());
          zoomMapEvent.setSubType(ZoomMapEvent.ZOOM_BY_LEVEL);
          if (key == '+') {
            zoomMapEvent.setZoomLevelDelta(1);
          } else {
            zoomMapEvent.setZoomLevelDelta(-1);
          }
          eventDispatcher.fireMapEvent(zoomMapEvent);

        } else if (key == PConstants.CODED) {
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

      log.debug("programmed: fire panTo + zoomTo");
      PanMapEvent panMapEvent = new PanMapEvent(this, maps.get(0).getId());
      Location location = new Location(52.4115f, 13.0516f);
      panMapEvent.setToLocation(location);
      eventDispatcher.fireMapEvent(panMapEvent);
      ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, maps.get(0).getId());
      zoomMapEvent.setSubType("zoomTo");
      zoomMapEvent.setZoomLevel(14);
      eventDispatcher.fireMapEvent(zoomMapEvent);
    }
  }
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

  }

  public void mapChanged(MapEvent mapEvent) {
    if (mapEvent.getType().equals(ZoomMapEvent.TYPE_ZOOM)) {
      // Reacts to zoom events and reads location and zoom value.
      ZoomMapEvent zoomMapEvent = (ZoomMapEvent) mapEvent;
      lastZoomLocation = zoomMapEvent.getCenter();
      if (zoomMapEvent.getZoomLevelDelta() < 0 || zoomMapEvent.getZoomDelta() < 0) {
        // Zoom in
        rectSize = 50;
        rectSizeDiff = -3;
      } else {
        // Zoom out
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

            transCenter.x = tuioCursor2.getScreenX(p.width);
            transCenter.y = tuioCursor2.getScreenY(p.height);
          }

          if (zoom) {
            ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, map.getId(), ZoomMapEvent.ZOOM_BY);
           
            // 3 variations to zoom with two finger gestures
            // TODO Do study on usability for different interaction approaches.
           
            // 1. pos of last finger
            Location centerLocation = map.getLocation(transCenter.x, transCenter.y);
            zoomMapEvent.setTransformationCenterLocation(centerLocation);

            // 2. object center: pinch gesture w/o fixed finger-location connection
            // float[] objectCenterXY =
            // map.mapDisplay.getScreenFromObjectPosition(map.mapDisplay.getWidth()/2,
            // map.mapDisplay.getHeight()/2);
            // PVector objectCenter = new PVector(objectCenterXY[0], objectCenterXY[1]);
            // map.mapDisplay.setInnerTransformationCenter(objectCenter);

            // 3. middle pos between both fingers

            float newDist = getDistance(tuioCursor1, tuioCursor2);
            float scaleDelta = newDist / oldDist;
            oldDist = newDist;
            zoomMapEvent.setZoomDelta(scaleDelta);

            eventDispatcher.fireMapEvent(zoomMapEvent);
          }

          if (rotate) {
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

          PanMapEvent panMapEvent = new PanMapEvent(this, map.getId());
          Location location = map.getLocation(mouseX, mouseY);
          panMapEvent.setToLocation(location);
          eventDispatcher.fireMapEvent(panMapEvent);

          ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, map.getId(), ZoomMapEvent.ZOOM_BY_LEVEL, 1);
          zoomMapEvent.setTransformationCenterLocation(location);
          eventDispatcher.fireMapEvent(zoomMapEvent);
        }
      }
    }
  }
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

      PanMapEvent panMapEvent = new PanMapEvent(this, mapDetail.getId());
      panMapEvent.setToLocation(berlinLocation);
      eventDispatcher.fireMapEvent(panMapEvent);

      ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, mapDetail.getId(), ZoomMapEvent.ZOOM_TO_LEVEL);
      zoomMapEvent.setZoomLevel(berlinZoomLevel);
      zoomMapEvent.setTransformationCenterLocation(berlinLocation);
      eventDispatcher.fireMapEvent(zoomMapEvent);


      // TODO Create convenience methods to fire map events.
      // MapUtils.fireZoomEvent(eventDispatcher, mapDetail, ZoomMapEvent.ZOOM_TO_LEVEL, berlinZoomLevel);
      // MapUtils.firePanEvent(eventDispatcher, mapDetail, berlinLocation);

    } else if (mouseX > 610 && mouseX < 790 && mouseY > 310 && mouseY < 390) {
      PanMapEvent panMapEvent = new PanMapEvent(this, mapDetail.getId());
      panMapEvent.setToLocation(universityLocation);
      eventDispatcher.fireMapEvent(panMapEvent);

      ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, mapDetail.getId(), ZoomMapEvent.ZOOM_TO_LEVEL);
      zoomMapEvent.setZoomLevel(universityZoomLevel);
      zoomMapEvent.setTransformationCenterLocation(universityLocation);
      eventDispatcher.fireMapEvent(zoomMapEvent);
    }
  }
View Full Code Here

Examples of de.fhpotsdam.unfolding.events.ZoomMapEvent

  public void zoomAndPanTo(Location location) {
    PanMapEvent panMapEvent = new PanMapEvent(this, mapOSM.getId());
    panMapEvent.setToLocation(location);
    eventDispatcher.fireMapEvent(panMapEvent);
    ZoomMapEvent zoomMapEvent = new ZoomMapEvent(this, mapOSM.getId(), ZoomMapEvent.ZOOM_TO_LEVEL);
    zoomMapEvent.setTransformationCenterLocation(location);
    zoomMapEvent.setZoomLevel(10);
    eventDispatcher.fireMapEvent(zoomMapEvent);
  }
View Full Code Here
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.