public class GlobeController 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 |
GlobeController.GestureDelegate
Use this delegate when you want user interface feedback from the maply controller.
|
static class |
GlobeController.Settings
Settings needed on startup so we can create the proper elements.
|
class |
GlobeController.ViewState
This encapulates the entire view state.
|
BaseController.ScreenshotListener
RenderControllerInterface.ContextInfo, RenderControllerInterface.TextureSettings, RenderControllerInterface.ThreadMode
Modifier and Type | Field and Description |
---|---|
GlobeController.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 |
---|
GlobeController(android.app.Activity mainActivity) |
GlobeController(android.app.Activity mainActivity,
GlobeController.Settings settings) |
Modifier and Type | Method and Description |
---|---|
void |
animatePositionGeo(double x,
double y,
double z,
double howLong)
Animate to a new view position
|
Point3d |
displayPointFromGeo(Point3d geoPt)
Return a point in display space.
|
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.
|
GlobeView |
getGlobeView() |
boolean |
getKeepNorthUp()
True if the globe is keeping north facing up on the screen.
|
Point3d |
getPositionGeo()
Returns the position in on the globe in terms of longitude and latitude in radians and height.
|
GlobeController.ViewState |
getViewState()
Return a simple description of the view state parameters.
|
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 boolean |
isCompletelySetup() |
Point3d |
modelPointFromScreen(Point2d screenPt)
Return the model point corresponding to a screen point.
|
boolean |
onTouch(android.view.View view,
android.view.MotionEvent e) |
void |
panDidEnd(boolean userMotion) |
void |
panDidStart(boolean userMotion) |
void |
processLongPress(Point2d screenLoc)
Set the gesture delegate to fire callbacks when the user did long press somwhere
|
void |
processTap(Point2d screenLoc) |
Point2d |
realWorldSizeFromScreen(Point2d pt0,
Point2d pt1)
Calculate a size in meters by projecting the two screen points onto the globe.
|
void |
rotateDidEnd(boolean userMotion) |
void |
rotateDidStart(boolean userMotion) |
Point2d |
screenPointFromGeo(Point2d geoCoord)
Return the screen coordinate for a given geographic coordinate (in radians).
|
void |
setAllowTilt(boolean allowTilt)
Call this to allow the user to tilt with three fingers.
|
void |
setAutoRotate(float autoRotateInterval,
float autoRotateDegrees)
This turns on an auto-rotate mode.
|
void |
setHeading(double heading) |
void |
setKeepNorthUp(boolean newVal)
Set the keep north up parameter on or off.
|
void |
setPositionGeo(double x,
double y,
double z)
Set the current view position.
|
void |
setViewState(GlobeController.ViewState viewState)
Set all the view parameters at once.
|
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 |
tiltDidEnd(boolean userMotion) |
void |
tiltDidStart(boolean userMotion) |
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 GlobeController.GestureDelegate gestureDelegate
public GlobeController(android.app.Activity mainActivity, GlobeController.Settings settings)
public GlobeController(android.app.Activity mainActivity)
protected void Init(android.app.Activity mainActivity, int clearColor)
public void shutdown()
BaseController
shutdown
in class BaseController
public GlobeView getGlobeView()
public boolean getKeepNorthUp()
public void setKeepNorthUp(boolean newVal)
public void setAllowTilt(boolean allowTilt)
public Point2d screenPointFromGeo(Point2d geoCoord)
screenPointFromGeo
in class BaseController
geoCoord
- Geographic coordinate to convert (in radians).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 Point2d geoPointFromScreen(Point2d screenPt)
geoPointFromScreen
in class BaseController
screenPt
- Input point on the screen.public Point3d modelPointFromScreen(Point2d screenPt)
public Mbr getCurrentViewGeo()
public Point3d displayPointFromGeo(Point3d geoPt)
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 Point2d realWorldSizeFromScreen(Point2d pt0, Point2d pt1)
public void setViewState(GlobeController.ViewState viewState)
public GlobeController.ViewState getViewState()
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()
protected boolean isCompletelySetup()
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 void setAutoRotate(float autoRotateInterval, float autoRotateDegrees)
autoRotateInterval
- Wait this number of seconds after user interaction to auto rotate.autoRotateDegrees
- Rotate this number of degrees (not radians) per second.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 tiltDidStart(boolean userMotion)
public void tiltDidEnd(boolean userMotion)
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()