Skip to content

Commit

Permalink
Add events for scale / rotate / tilt by user (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Longri authored and devemux86 committed Nov 28, 2016
1 parent 5f53465 commit 7765309
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vtm/src/org/oscim/layers/MapEventLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
Expand Down Expand Up @@ -404,6 +405,15 @@ private void onActionMove(MotionEvent e) {
mPrevY2 = y2;

mMap.updateMap(true);

if (mMap.viewport().getMapPosition(mapPosition)) {
if (mDoScale)
mMap.events.fire(Map.SCALE_EVENT, mapPosition);
if (mDoRotate)
mMap.events.fire(Map.ROTATE_EVENT, mapPosition);
if (mDoTilt)
mMap.events.fire(Map.TILT_EVENT, mapPosition);
}
}

private void updateMulti(MotionEvent e) {
Expand Down
10 changes: 10 additions & 0 deletions vtm/src/org/oscim/layers/MapEventLayer2.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
Expand Down Expand Up @@ -498,6 +499,15 @@ private void onActionMove(MotionEvent e) {
mPrevY2 = y2;

mMap.updateMap(true);

if (mMap.viewport().getMapPosition(mapPosition)) {
if (mDoScale)
mMap.events.fire(Map.SCALE_EVENT, mapPosition);
if (mDoRotate)
mMap.events.fire(Map.ROTATE_EVENT, mapPosition);
if (mDoTilt)
mMap.events.fire(Map.TILT_EVENT, mapPosition);
}
}

private void updateMulti(MotionEvent e) {
Expand Down
16 changes: 16 additions & 0 deletions vtm/src/org/oscim/map/Map.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright 2016 Andrey Novikov
* Copyright 2016 Stephan Leuschner
* Copyright 2016 devemux86
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
Expand Down Expand Up @@ -85,6 +86,21 @@ public interface InputListener extends EventListener {
*/
public static final Event MOVE_EVENT = new Event();

/**
* UpdateListener event. Map was scaled by user.
*/
public static final Event SCALE_EVENT = new Event();

/**
* UpdateListener event. Map was rotated by user.
*/
public static final Event ROTATE_EVENT = new Event();

/**
* UpdateListener event. Map was tilted by user.
*/
public static final Event TILT_EVENT = new Event();

/**
* UpdateLister event. Delivered on main-thread when updateMap() was called
* and no CLEAR_EVENT or POSITION_EVENT was triggered.
Expand Down

0 comments on commit 7765309

Please sign in to comment.