public class MapController extends BaseController implements android.view.View.OnTouchListener, android.view.Choreographer.FrameCallback
The controller starts by creating an OpenGL ES surface and handling all the various setup between Maply and that surface. It also kicks off a LayerThread, which it uses to queue requests to the rest of Maply.
Once the controller is set up and running the toolkit user can make calls to add and remove geometry. Those calls are thread safe.
Modifier and Type | Class and Description |
---|---|
static interface |
MapController.GestureDelegate
Use this delegate when you want user interface feedback from the maply controller.
|
static class |
MapController.Settings
Settings are parameters we need at the very start of the
setup process.
|
BaseController.ScreenshotListener
RenderControllerInterface.ContextInfo, RenderControllerInterface.TextureSettings, RenderControllerInterface.ThreadMode
Modifier and Type | Field and Description |
---|---|
MapController.GestureDelegate |
gestureDelegate
Set the gesture delegate to get callbacks when the user taps somewhere.
|
activity, coordAdapter, frameInterval, httpClient, metroThread, renderControl, renderWrapper, running, scene, view
Constructor and Description |
---|
MapController(android.app.Activity mainActivity)
Initialize a new map controller with the standard (spherical mercator)
coordinate system.
|
MapController(android.app.Activity mainActivity,
MapController.Settings settings)
Construct with the activity and a coordinate system.
|
Modifier and Type | Method and Description |
---|---|
void |
animatePositionGeo(double x,
double y,
double z,
double howLong)
Animate to a new view position
|
void |
doFrame(long frameTimeNanos)
Frame callback for the Choreographer
|
double |
findHeightToViewBounds(Mbr mbr,
Point2d pos)
For a given position, how high do we have to be to see the given area.
|
Point2d |
geoPointFromScreen(Point2d screenPt)
Return the geographic point (radians) corresponding to the screen point.
|
Mbr |
getCurrentViewGeo()
Returns what the user is currently looking at in geographic extents.
|
double |
getHeading()
Return the current heading.
|
Point3d |
getPositionGeo()
Return the position in lat/lon in radians.
|
Point3d[] |
getVisibleCorners()
Calculate visible corners for what's currently being seen.
|
void |
handleStartMoving(boolean userMotion)
Called by the gesture handler to filter out start motion events.
|
void |
handleStopMoving(boolean userMotion)
Called by the gesture handler to filter out end motion events.
|
protected void |
Init(android.app.Activity mainActivity,
int clearColor) |
protected void |
InitCoordSys(android.app.Activity mainActivity,
CoordSystem coordSys,
Point3d displayCenter,
int clearColor) |
boolean |
onTouch(android.view.View view,
android.view.MotionEvent e) |
void |
panDidEnd(boolean userMotion) |
void |
panDidStart(boolean userMotion) |
void |
processLongPress(Point2d screenLoc)
Called by the gesture handler to let us know the user long pressed somewhere
|
void |
processTap(Point2d screenLoc) |
void |
rotateDidEnd(boolean userMotion) |
void |
rotateDidStart(boolean userMotion) |
Point2d |
screenPointFromGeo(Point2d geoCoord)
Return the screen coordinate for a given geographic coordinate (in radians).
|
void |
setAllowPan(boolean allowPan)
If set, the user can pan around.
|
void |
setAllowRotateGesture(boolean allowRotate)
If set we'll allow the user to rotate.
|
void |
setAllowZoom(boolean allowZoom)
If set, the user can zoom in and out.
|
void |
setHeading(double heading)
Set the heading for the current visual.
|
void |
setPositionGeo(double x,
double y,
double z)
Set the current view position.
|
protected void |
setupTheRest(com.mousebird.maply.CoordSystemDisplayAdapter inCoordAdapter,
int clearColor) |
void |
setZoomLimits(double inMin,
double inMax)
Set the zoom limits for the globe.
|
void |
shutdown()
Call shutdown when you're done with the MaplyController.
|
void |
zoomDidEnd(boolean userMotion) |
void |
zoomDidStart(boolean userMotion) |
addActiveObject, addActiveObjectAtStart, addBillboards, addClusterGenerator, addLayer, addLight, addLoftedPoly, addLoftedPolys, addMainThreadTask, addMainThreadTaskAfter, addMarker, addMarkers, addParticleBatch, addParticleSystem, addPoints, addPoints, addPostSurfaceRunnable, addRenderTarget, addScreenLabel, addScreenLabels, addScreenMarker, addScreenMarkers, addScreenMovingLabels, addScreenMovingMarkers, addShaderProgram, addShapes, addStickers, addTask, addTexture, addTexture, addTileFetcher, addVector, addVectors, addWideVector, addWideVectors, changeRenderTarget, changeSticker, changeVector, clearLights, clearRenderTarget, clearTempContext, createTexture, currentMapScale, currentMapZoom, disableObject, disableObjects, displayCoord, enableObject, enableObjects, findSamplingLayer, geoPointFromScreenBatch, getActivity, getContentView, getCoordSystem, getFrameBufferSize, getFrameSize, getHttpClient, getLayerThread, getMaxLineWidth, getObjectAtScreenLoc, getObjectsAtScreenLoc, getOfflineMode, getRenderController, getScene, getShader, getViewSize, getWorkingThread, heightForMapScale, Init, instanceVectors, instanceWideVectors, makeLayerThread, processChangeSet, releaseSamplingLayer, removeActiveObject, removeLayer, removeLayerThread, removeLight, removeObject, removeObjects, removeRenderTarget, removeShader, removeTexture, removeTextures, removeTexturesByID, rendererIsAttached, requestRender, resetLights, screenPointFromGeoBatch, setClearColor, setDisplayRate, setEGLContext, setPerfInterval, setupTempContext, setViewExtents, takeScreenshot, usesTextureView
public MapController.GestureDelegate gestureDelegate
public MapController(android.app.Activity mainActivity, MapController.Settings settings)
mainActivity
- The activity this is part of.public MapController(android.app.Activity mainActivity)
protected void InitCoordSys(android.app.Activity mainActivity, CoordSystem coordSys, Point3d displayCenter, int clearColor)
protected void Init(android.app.Activity mainActivity, int clearColor)
protected void setupTheRest(com.mousebird.maply.CoordSystemDisplayAdapter inCoordAdapter, int clearColor)
public void shutdown()
BaseController
shutdown
in class BaseController
public Point2d screenPointFromGeo(Point2d geoCoord)
screenPointFromGeo
in class BaseController
geoCoord
- Geographic coordinate to convert (in radians).public Point2d geoPointFromScreen(Point2d screenPt)
geoPointFromScreen
in class BaseController
screenPt
- Input point on the screen.public Mbr getCurrentViewGeo()
public void setZoomLimits(double inMin, double inMax)
inMin
- Closest the user is allowed to zoom in.inMax
- Farthest the user is allowed to zoom out.public double findHeightToViewBounds(Mbr mbr, Point2d pos)
Even for 2D maps we represent things in terms of height.
mbr
- Bounding box for the area we want to see in geographic (radians).pos
- Center of the viewing area in geographic (radians).public void setPositionGeo(double x, double y, double z)
x
- Horizontal location of the center of the screen in geographic radians (not degrees).y
- Vertical location of the center of the screen in geographic radians (not degrees).z
- Height above the map in display units.public Point3d getPositionGeo()
public void animatePositionGeo(double x, double y, double z, double howLong)
x
- Horizontal location of the center of the screen in geographic radians (not degrees).y
- Vertical location of the center of the screen in geographic radians (not degrees).z
- Height above the map in display units.howLong
- Time (in seconds) to animate.public void setHeading(double heading)
public double getHeading()
public void setAllowRotateGesture(boolean allowRotate)
public void setAllowZoom(boolean allowZoom)
public void setAllowPan(boolean allowPan)
public void processTap(Point2d screenLoc)
public void processLongPress(Point2d screenLoc)
screenLoc
- public boolean onTouch(android.view.View view, android.view.MotionEvent e)
onTouch
in interface android.view.View.OnTouchListener
public void panDidStart(boolean userMotion)
public void panDidEnd(boolean userMotion)
public void zoomDidStart(boolean userMotion)
public void zoomDidEnd(boolean userMotion)
public void rotateDidStart(boolean userMotion)
public void rotateDidEnd(boolean userMotion)
public void handleStartMoving(boolean userMotion)
userMotion
- Set if kicked off by user motion.public void handleStopMoving(boolean userMotion)
userMotion
- Set if kicked off by user motion.public void doFrame(long frameTimeNanos)
doFrame
in interface android.view.Choreographer.FrameCallback
public Point3d[] getVisibleCorners()