MapTrip SDK Android Manual 9.9.7
IwMapView Class Reference

The SDKs View - renders a map as soon as the SDK is initialized. More...

+ Inheritance diagram for IwMapView:

Public Member Functions

boolean dispatchTouchEvent (MotionEvent ev)
 
int general (GeneralCallbackType callbackType, String optionalText, double optionalNumber)
 
void getBitmap (IGLBitmap listener)
 
Object getGlSurface ()
 
int getIwId ()
 
Mapviewer getMapviewer ()
 
IwMapviewerConfig getMapviewerConfig ()
 
void handleMapTouch (MotionEvent motionEvent)
 
 IwMapView (Context context)
 
 IwMapView (Context context, AttributeSet attrs)
 
 IwMapView (Context context, AttributeSet attrs, int defStyle)
 
 IwMapView (Context context, boolean doUseTextureView)
 
void locationTrackingPausedByGesture ()
 
void locationTrackingResumedAfterTimeout ()
 
void mapCenterChange (int changeX, int changeY)
 
void mapContent (Iterable< MapContent > mapContentList)
 
void mapDataLoading (boolean isLoading)
 
void mapMotionStart ()
 
void mapMotionStop ()
 
void mapZoomed ()
 
void onApiInitError (ApiError err, String description)
 
void onApiInitialized ()
 
void onApiUninitialized ()
 
void onMapLongPress (float x, float y)
 
void onMapSingleTap (float x, float y)
 
void onMapviewerDestroyed ()
 
void onMapviewerReady (Mapviewer map)
 
void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
 
void onRestoreInstanceState (Parcelable state)
 
Parcelable onSaveInstanceState ()
 
void onWindowFocusChanged (boolean hasWindowFocus)
 
void pauseRendering ()
 
void resumeRendering ()
 
void setDoubleTapToZoomEnabled (boolean enabled)
 
void setManualRenderingControl (boolean manualControl)
 
void setMapRenderListener (IwGLMapRendererListener listener)
 
void setMapviewerConfig (IwMapviewerConfig config)
 
void setOnLocationTrackingPauseStateListener (IwOnLocationTrackingPauseStateListener listener)
 
void setOnMapCenterChangedListener (IwOnMapCenterChangedListener listener)
 
void setOnMapDataLoadingListener (IwOnMapDataLoadingListener listener)
 
void setOnMapLongPressListener (IwOnMapLongPressListener listener)
 
void setOnMapMotionStartListener (IwOnMapMotionStartListener listener)
 
void setOnMapMotionStopListener (IwOnMapMotionStopListener listener)
 
void setOnMapSingleTapListener (IwOnMapSingleTapListener listener)
 
void setOnMapviewerReadyListener (IwOnMapviewerReadyListener listener)
 
void setOnMapZoomedListener (IwOnMapZoomedListener listener)
 
void setOnNoQbliqueDataListener (IwOnNoObliqueDataListener listener)
 
void setQuickScaleEnabled (boolean enabled)
 
void setTouchEnabled (boolean enabled)
 
void setViewContainer (boolean doUseTextureView)
 
ApiError showSelection (final Selection selection, final Mapviewer mapviewer, final boolean doShow, final String fillColor, final String borderColor, final String iconFileName)
 

Protected Member Functions

void createGlView (Context context, boolean doUseTextureView)
 
void onAttachedToWindow ()
 
void onDetachedFromWindow ()
 
void onWindowVisibilityChanged (int visibility)
 

Detailed Description

This view is a FrameLayout that creates a Surface or Texture view as child(defined as xml attribute). It spawns a separate rendering thread that is bound to the views lifecycle

The SDKs Mapviewer object is created and maintained by this view. to modify the Mapview appearance you can either edit its xml definition, get the Mapviewer Object and modify it (getMapviewer()) or use the IwMapviewerConfig object

Constructor & Destructor Documentation

◆ IwMapView() [1/4]

IwMapView ( Context  context)

◆ IwMapView() [2/4]

IwMapView ( Context  context,
AttributeSet  attrs 
)

◆ IwMapView() [3/4]

IwMapView ( Context  context,
AttributeSet  attrs,
int  defStyle 
)

◆ IwMapView() [4/4]

IwMapView ( Context  context,
boolean  doUseTextureView 
)

Constructor if View created by hand

Member Function Documentation

◆ createGlView()

void createGlView ( Context  context,
boolean  doUseTextureView 
)
protected

Init the GL View that will be added to this layout IwRenderThread and rendering will start when the GLSurface is crated -> after the view is added in the hierarchy

◆ dispatchTouchEvent()

boolean dispatchTouchEvent ( MotionEvent  ev)

◆ general()

int general ( GeneralCallbackType  callbackType,
String  optionalText,
double  optionalNumber 
)

Is called for multiple purposes.

Parameters
callbackType- See GeneralCallbackType
optionalText- Content depends on the callbackType
optionalNumber- Content depends on the callbackType
Returns
The handling of the returned value depends on the callbackType

Implements ApiListener.

◆ getBitmap()

void getBitmap ( IGLBitmap  listener)

get Bitmap of current gl view

◆ getGlSurface()

Object getGlSurface ( )

This Method returns the current rendering surface. It is only needed for the MySpin library support which requires the openGLSurface

Returns
The surface that the renderer renders into

◆ getIwId()

int getIwId ( )

◆ getMapviewer()

Mapviewer getMapviewer ( )
Returns
the api Mapviewer instance

◆ getMapviewerConfig()

IwMapviewerConfig getMapviewerConfig ( )
Returns
the current config of this mapviewer

◆ handleMapTouch()

void handleMapTouch ( MotionEvent  motionEvent)

Calculate movements on mapTouch

◆ locationTrackingPausedByGesture()

void locationTrackingPausedByGesture ( )

◆ locationTrackingResumedAfterTimeout()

void locationTrackingResumedAfterTimeout ( )

◆ mapCenterChange()

void mapCenterChange ( int  changeX,
int  changeY 
)

◆ mapContent()

void mapContent ( Iterable< MapContent mapContentList)

Retrieves a list of all possible map types

Implements ApiListener.

◆ mapDataLoading()

void mapDataLoading ( boolean  isLoading)

◆ mapMotionStart()

void mapMotionStart ( )

◆ mapMotionStop()

void mapMotionStop ( )

◆ mapZoomed()

void mapZoomed ( )

◆ onApiInitError()

void onApiInitError ( ApiError  err,
String  description 
)

callback when Api init fails

Parameters
err

Implements ApiInitListener.

◆ onApiInitialized()

void onApiInitialized ( )

callback when Api is initialized in GL view. Attention: Callback returns on the GL thread and not on the main ui thread

Implements ApiInitListener.

◆ onApiUninitialized()

void onApiUninitialized ( )

callback when api is uninitialized

When api uninit - The thread and Mapviewer need to be destroyed

Implements ApiInitListener.

◆ onAttachedToWindow()

void onAttachedToWindow ( )
protected

When Layout is attached to a window, the GLView is added

◆ onDetachedFromWindow()

void onDetachedFromWindow ( )
protected

When Layout is detached from a window, the GLView and mapviewer will be destroyed

◆ onMapLongPress()

void onMapLongPress ( float  x,
float  y 
)

listener for long press events on the map

Parameters
xin screen coordinates
yin screen coordinates

Implements IwOnMapLongPressListener.

◆ onMapSingleTap()

void onMapSingleTap ( float  x,
float  y 
)

listener for singleTap events on the map

Parameters
xin screen coordinates
yin screen coordinates

Implements IwOnMapSingleTapListener.

◆ onMapviewerDestroyed()

void onMapviewerDestroyed ( )

◆ onMapviewerReady()

void onMapviewerReady ( Mapviewer  map)

apply listeners and configuration when mapviewer is ready

Parameters
map- mapviewer that is ready

◆ onMeasure()

void onMeasure ( int  widthMeasureSpec,
int  heightMeasureSpec 
)

pass view height to gesture controler so that Quickzoom can be calculated accurately

◆ onRestoreInstanceState()

void onRestoreInstanceState ( Parcelable  state)

◆ onSaveInstanceState()

Parcelable onSaveInstanceState ( )

◆ onWindowFocusChanged()

void onWindowFocusChanged ( boolean  hasWindowFocus)

This is called if the views window is accessible or not. It pauses the map rendering if the screen is shut off ( which will not trigger onWindowVisibilityChanged )

Parameters
hasWindowFocus- true if has focus

◆ onWindowVisibilityChanged()

void onWindowVisibilityChanged ( int  visibility)
protected

Used to stop or resume rendering if window gets visible / invisible like switching to another activity

Parameters
visibility- new visibility state

◆ pauseRendering()

void pauseRendering ( )

pause the rendering and the gl thread

◆ resumeRendering()

void resumeRendering ( )

resume the rendering and the gl threadfffs if GLThread is not paused, it will render another frame

◆ setDoubleTapToZoomEnabled()

void setDoubleTapToZoomEnabled ( boolean  enabled)

This method can be used to enable or disable double tap to zoom a predefined distance

Parameters
enabled- true to allow double tap zoom( default )

◆ setManualRenderingControl()

void setManualRenderingControl ( boolean  manualControl)

set manual rendering control, start and stop rendering only by @method pauseRendering and @method resumeRendering

Parameters
manualControl- true if control rendering manually

◆ setMapRenderListener()

void setMapRenderListener ( IwGLMapRendererListener  listener)
Parameters
listener- listener for renderer runs that informs about every render iteration

◆ setMapviewerConfig()

void setMapviewerConfig ( IwMapviewerConfig  config)
Parameters
configto set for this Mapviewer ( overwrite existing one ) and apply it

◆ setOnLocationTrackingPauseStateListener()

void setOnLocationTrackingPauseStateListener ( IwOnLocationTrackingPauseStateListener  listener)

◆ setOnMapCenterChangedListener()

void setOnMapCenterChangedListener ( IwOnMapCenterChangedListener  listener)

◆ setOnMapDataLoadingListener()

void setOnMapDataLoadingListener ( IwOnMapDataLoadingListener  listener)

◆ setOnMapLongPressListener()

void setOnMapLongPressListener ( IwOnMapLongPressListener  listener)

◆ setOnMapMotionStartListener()

void setOnMapMotionStartListener ( IwOnMapMotionStartListener  listener)

◆ setOnMapMotionStopListener()

void setOnMapMotionStopListener ( IwOnMapMotionStopListener  listener)

◆ setOnMapSingleTapListener()

void setOnMapSingleTapListener ( IwOnMapSingleTapListener  listener)

◆ setOnMapviewerReadyListener()

void setOnMapviewerReadyListener ( IwOnMapviewerReadyListener  listener)
Parameters
listener- listener for maptouch and mapviewer lifecycle events

◆ setOnMapZoomedListener()

void setOnMapZoomedListener ( IwOnMapZoomedListener  listener)

◆ setOnNoQbliqueDataListener()

void setOnNoQbliqueDataListener ( IwOnNoObliqueDataListener  listener)

◆ setQuickScaleEnabled()

void setQuickScaleEnabled ( boolean  enabled)

This method can be used to enable or disable Quick scale - double tap the map and keep finger on it to scale via movement

Parameters
enabled- true to allow quickscale ( default )

◆ setTouchEnabled()

void setTouchEnabled ( boolean  enabled)

This method can be used to enable or disable touch gestures on the mapview

Parameters
enabled- true to allow touch ( default )

◆ setViewContainer()

void setViewContainer ( boolean  doUseTextureView)

Switch the view type at runtime Attention - This destroys the mapviewer until the next time onMapviewerReady is called

◆ showSelection()

ApiError showSelection ( final Selection  selection,
final Mapviewer  mapviewer,
final boolean  doShow,
final String  fillColor,
final String  borderColor,
final String  iconFileName 
)

Show (or hide) the selection in the map. A selection is visible as long as the object is kept alive or this method is called to hide it explicitly.

Parameters
selection- selection to show or hide
doShow- Show (=true) or hide (=false).
mapviewer- map to show selection on
fillColor- Fill color for highlighted polylines and polygons.
borderColor- Border color for highlighted polylines and polygons.
iconFileName- Png icon filename for highlighted points.
Returns
Errorcode
ApiError#OK if successful

The documentation for this class was generated from the following file: