Package globus.glmap

Class GLMapView

  • All Implemented Interfaces:
    android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback, android.view.SurfaceHolder.Callback, android.view.SurfaceHolder.Callback2, android.view.TextureView.SurfaceTextureListener

    @ParametersAreNonnullByDefault
    public class GLMapView
    extends android.view.SurfaceView
    implements android.view.SurfaceHolder.Callback2, android.view.TextureView.SurfaceTextureListener
    GLMapView is a custom SurfaceView that renders and presents vector map
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  GLMapView.AnimateCallback
      Called to configure animation.
      static interface  GLMapView.GLMapPlacement  
      static interface  GLMapView.GLMapTileState  
      static interface  GLMapView.GLUnitSystem  
      static interface  GLMapView.ResourceLoadCallback
      Called when GLMapView need to load some image
      static interface  GLMapView.ScreenCaptureCallback
      Called when GLMapView finished rendering map and text to Bitmap
      static interface  GLMapView.ScreenCaptureRawCallback
      Called when GLMapView finished rendering map and text to raw data
      • Nested classes/interfaces inherited from class android.view.View

        android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnCapturedPointerListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener, android.view.View.OnUnhandledKeyEventListener
    • Field Summary

      Fields 
      Modifier and Type Field Description
      ImageManager imageManager  
      float screenScale  
      android.view.TextureView textureView  
      • Fields inherited from class android.view.View

        ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VISIBLE, X, Y, Z
    • Constructor Summary

      Constructors 
      Constructor Description
      GLMapView​(android.content.Context context)
      Creates map view
      GLMapView​(android.content.Context context, android.util.AttributeSet attrs)
      Creates map view
      GLMapView​(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
      Creates map view
      GLMapView​(android.content.Context context, android.view.TextureView textureView)
      Creates map view
    • Method Summary

      Modifier and Type Method Description
      void add​(GLMapDrawObject drawObject)
      Adds the GLMapDrawObject to map.
      GLMapAnimation animate​(GLMapView.AnimateCallback callback)
      Create and starts animation using provided callback
      GLMapAnimation animate​(GLMapView.AnimateCallback callback, java.lang.Runnable onFinish)
      Create and starts animation using provided callback
      static double bearingAngle​(MapGeoPoint from, MapGeoPoint to)
      Calculates bearing between two geo points
      void captureFrameWhenFinish​(GLMapView.ScreenCaptureCallback callback)
      Captures frame when surface will be created and loading of resources finished.
      MapPoint convertDisplayDeltaToInternal​(MapPoint val)
      Converts a distance between two points on the screen to delta in internal format of GLMapView.
      MapPoint convertDisplayDeltaToInternal​(MapPoint val, double mapZoom, double mapAngle)
      Converts a distance between two points on the screen to delta in internal format of GLMapView.
      MapPoint convertDisplayToInternal​(MapPoint val)
      Converts a point on the surface to an internal map coordinate.
      MapPoint convertInternalToDisplay​(MapPoint val)
      Converts a point in internal format of GLMapView to point on the surface of view.
      double convertMetersToInternal​(double meters)
      Converts meters distance to internal distance
      static void crashNDK()  
      static void crashNDK2()  
      static double distanceInMeters​(MapGeoPoint from, MapGeoPoint to)
      Calculates distance between two geo points
      void doWhenSurfaceCreated​(java.lang.Runnable r)
      Runs command on internal rendering thread.
      static void ForceOpenGL2()
      After calling this function any new GLMapView will use OpenGL 2.0 even if device supports OpenGL 3.0 Some cheap Android devices have problems with drivers.
      GLMapBBox getBBox()
      BBox of current visible part of GLMapView
      int getCenterTileState()
      Return state of center tile
      MapPoint getCurrentMapCenter​(MapPoint point)
      Gets current coordinates of the origin point of the map.
      double getCurrentMapScale()
      Gets current scale of the map.
      double getCurrentMapZoom()
      Gets current zoom level of the map.
      float getFontScale()  
      float getFps()
      Returns fps
      GLMapGesturesDetector getGesturesDetector()  
      android.os.Handler getHandler()  
      GLMapLocaleSettings getLocaleSettings()  
      float getMapAngle()
      Gets current angle of the map.
      MapPoint getMapCenter()
      Gets coordinates of the origin point of the map.
      MapPoint getMapCenter​(MapPoint point)
      Gets coordinates of the origin point of the map.
      MapGeoPoint getMapGeoCenter()
      Gets coordinates of the origin point of the map.
      MapPoint getMapOrigin()  
      MapPoint getMapOrigin​(MapPoint point)
      Origin point of the map coordinate system.
      double getMapScale()
      Gets scale of the map.
      double getMapZoom()
      Get zoom level of the map.
      double getMaxScale()
      Gets maximum scale of the map
      GLMapRasterTileSource[] getRasterTileSources()  
      java.lang.String[] getStyleOptions()
      Returns options available in loaded style.
      boolean loadStyle​(android.content.res.AssetManager assetManager, java.lang.String path)
      Loads map style.
      boolean loadStyle​(GLMapView.ResourceLoadCallback callback)
      Loads map style.
      double mapZoomForBBox​(GLMapBBox bbox, int mapWidth, int mapHeight)
      Calculates zoom of map to fit given bbox
      void onSurfaceTextureAvailable​(android.graphics.SurfaceTexture surfaceTexture, int width, int height)  
      boolean onSurfaceTextureDestroyed​(android.graphics.SurfaceTexture surfaceTexture)  
      void onSurfaceTextureSizeChanged​(android.graphics.SurfaceTexture surfaceTexture, int width, int height)  
      void onSurfaceTextureUpdated​(android.graphics.SurfaceTexture surfaceTexture)  
      boolean onTouchEvent​(android.view.MotionEvent event)  
      void reloadTiles()
      Force reloading of all tiles.
      void remove​(GLMapDrawObject drawObject)
      Removes `GLMapDrawObject` from map.
      void removeAllObjects()
      Remove all images, image groups, tracks and marker layers from map
      void setAttributionPosition​(int placement)
      Sets position of attribution.
      void setCenterTileStateChangedCallback​(java.lang.Runnable callback)
      Set callback that will be called when center tile state is changed
      void setFontScale​(float scale)
      Sets scale of font.
      void setFps​(float fps)
      Sets fps
      void setGesturesDetector​(GLMapGesturesDetector gesturesDetector)
      If map do not need to handle touches set gesturesDetector to null.
      void setLocaleSettings​(GLMapLocaleSettings localeSettings)
      Sets map locale settings
      void setMapAngle​(float newAngle)
      Sets zoom level of the map.
      void setMapCenter​(MapPoint center)
      Sets coordinates of the origin point of the map.
      void setMapDidMoveCallback​(java.lang.Runnable callback)
      Sets callback that will be called after move animation finished
      void setMapGeoCenter​(MapGeoPoint geoCenter)
      Sets coordinates of the origin point of the map.
      void setMapOrigin​(MapPoint point)
      Origin point of the map coordinate system (X, Y).
      void setMapScale​(double newScale)
      Set scale of the map.
      void setMapZoom​(double newZoom)
      Sets zoom level of the map.
      void setMaxScale​(double maxScale)
      Sets maximum scale of the map
      void setNeedRedraw()
      Force redraw
      void setRasterTileSources​(GLMapRasterTileSource[] tileSources)
      By default rasterTileSources is null.
      void setScaleRulerBottomText​(java.lang.String text)
      Sets text that will be displayed under scale ruler.
      void setScaleRulerStyle​(int units, int placement, MapPoint paddings, double maxWidth)
      Set style of scale ruler.
      void setStyleOptions​(java.lang.String[] options)
      Sets enabled style options.
      void startAnimation​(GLMapAnimation animation)
      Starts animation.
      void surfaceChanged​(android.view.SurfaceHolder holder, int format, int width, int height)  
      void surfaceCreated​(android.view.SurfaceHolder holder)  
      void surfaceDestroyed​(android.view.SurfaceHolder holder)  
      void surfaceRedrawNeeded​(android.view.SurfaceHolder holder)  
      void surfaceRedrawNeededAsync​(android.view.SurfaceHolder holder, java.lang.Runnable drawingFinished)  
      • Methods inherited from class android.view.SurfaceView

        draw, gatherTransparentRegion, getHolder, getSurfaceControl, setSecure, setVisibility, setZOrderMediaOverlay, setZOrderOnTop
      • Methods inherited from class android.view.View

        addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, autofill, autofill, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableHotspotChanged, findFocus, findViewById, findViewsWithText, findViewWithTag, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityClassName, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchables, getTouchDelegate, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, jumpDrawablesToCurrentState, keyboardNavigationClusterSearch, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideStructure, onProvideVirtualStructure, onResolvePointerIcon, onRtlPropertiesChanged, onScreenStateChanged, onStartTemporaryDetach, onTrackballEvent, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • screenScale

        public float screenScale
      • textureView

        public android.view.TextureView textureView
    • Constructor Detail

      • GLMapView

        public GLMapView​(android.content.Context context,
                         android.util.AttributeSet attrs,
                         int defStyle)
        Creates map view
        Parameters:
        context - context
        defStyle - defStyle
        attrs - attributes
      • GLMapView

        public GLMapView​(android.content.Context context,
                         android.util.AttributeSet attrs)
        Creates map view
        Parameters:
        context - context
        attrs - attributes
      • GLMapView

        public GLMapView​(android.content.Context context)
        Creates map view
        Parameters:
        context - context
      • GLMapView

        public GLMapView​(android.content.Context context,
                         android.view.TextureView textureView)
        Creates map view
        Parameters:
        context - context
        textureView - textureView
    • Method Detail

      • getHandler

        public android.os.Handler getHandler()
        Overrides:
        getHandler in class android.view.View
      • surfaceChanged

        public void surfaceChanged​(android.view.SurfaceHolder holder,
                                   int format,
                                   int width,
                                   int height)
        Specified by:
        surfaceChanged in interface android.view.SurfaceHolder.Callback
      • surfaceCreated

        public void surfaceCreated​(android.view.SurfaceHolder holder)
        Specified by:
        surfaceCreated in interface android.view.SurfaceHolder.Callback
      • surfaceDestroyed

        public void surfaceDestroyed​(android.view.SurfaceHolder holder)
        Specified by:
        surfaceDestroyed in interface android.view.SurfaceHolder.Callback
      • onSurfaceTextureAvailable

        public void onSurfaceTextureAvailable​(android.graphics.SurfaceTexture surfaceTexture,
                                              int width,
                                              int height)
        Specified by:
        onSurfaceTextureAvailable in interface android.view.TextureView.SurfaceTextureListener
      • onSurfaceTextureSizeChanged

        public void onSurfaceTextureSizeChanged​(android.graphics.SurfaceTexture surfaceTexture,
                                                int width,
                                                int height)
        Specified by:
        onSurfaceTextureSizeChanged in interface android.view.TextureView.SurfaceTextureListener
      • onSurfaceTextureDestroyed

        public boolean onSurfaceTextureDestroyed​(android.graphics.SurfaceTexture surfaceTexture)
        Specified by:
        onSurfaceTextureDestroyed in interface android.view.TextureView.SurfaceTextureListener
      • onSurfaceTextureUpdated

        public void onSurfaceTextureUpdated​(android.graphics.SurfaceTexture surfaceTexture)
        Specified by:
        onSurfaceTextureUpdated in interface android.view.TextureView.SurfaceTextureListener
      • surfaceRedrawNeeded

        public void surfaceRedrawNeeded​(android.view.SurfaceHolder holder)
        Specified by:
        surfaceRedrawNeeded in interface android.view.SurfaceHolder.Callback2
      • surfaceRedrawNeededAsync

        public void surfaceRedrawNeededAsync​(android.view.SurfaceHolder holder,
                                             java.lang.Runnable drawingFinished)
        Specified by:
        surfaceRedrawNeededAsync in interface android.view.SurfaceHolder.Callback2
      • onTouchEvent

        public boolean onTouchEvent​(android.view.MotionEvent event)
        Overrides:
        onTouchEvent in class android.view.View
      • getFps

        public float getFps()
        Returns fps
        Returns:
        fps
      • setFps

        public void setFps​(float fps)
        Sets fps
        Parameters:
        fps - fps to set
      • setCenterTileStateChangedCallback

        public void setCenterTileStateChangedCallback​(@Nullable
                                                      java.lang.Runnable callback)
        Set callback that will be called when center tile state is changed
        Parameters:
        callback - Runnable that will be post to main thread when center tile state is changed
      • getCenterTileState

        public int getCenterTileState()
        Return state of center tile
        Returns:
        state of center tile
      • convertDisplayDeltaToInternal

        public MapPoint convertDisplayDeltaToInternal​(MapPoint val)
        Converts a distance between two points on the screen to delta in internal format of GLMapView.
        Parameters:
        val - The point with the delta
        Returns:
        The same object that was passed to method call.
        See Also:
        convertDisplayToInternal(MapPoint)
      • convertDisplayDeltaToInternal

        public MapPoint convertDisplayDeltaToInternal​(MapPoint val,
                                                      double mapZoom,
                                                      double mapAngle)
        Converts a distance between two points on the screen to delta in internal format of GLMapView.
        Parameters:
        val - The point with the delta
        mapZoom - Zoom to use for calculations
        mapAngle - Angle to use for calculations
        Returns:
        The same object that was passed to method call.
        See Also:
        convertDisplayToInternal(MapPoint)
      • convertDisplayToInternal

        public MapPoint convertDisplayToInternal​(MapPoint val)
        Converts a point on the surface to an internal map coordinate.

        MapPoint pt = mapView.convertDisplayToInternal(new MapPoint(touchX, touchY));

        Parameters:
        val - The point on surface to be converted
        Returns:
        The same object that was passed to method call.
        See Also:
        convertInternalToDisplay(MapPoint)
      • convertInternalToDisplay

        public MapPoint convertInternalToDisplay​(MapPoint val)
        Converts a point in internal format of GLMapView to point on the surface of view.
        Parameters:
        val - The point to be converted
        Returns:
        The same object that was passed to method call.
        See Also:
        convertDisplayToInternal(MapPoint)
      • convertMetersToInternal

        public double convertMetersToInternal​(double meters)
        Converts meters distance to internal distance
        Parameters:
        meters - The value to be converted
        Returns:
        Returns distance in internal units
      • doWhenSurfaceCreated

        public void doWhenSurfaceCreated​(java.lang.Runnable r)
        Runs command on internal rendering thread. If surface does not exists at this moment Runnable will be executed when it will be created.
        
             final GLMapView mapView = (GLMapView) this.findViewById(R.id.map_view);
             mapView.doWhenSurfaceCreated(new Runnable() {
                public void run() {
                    mapView.setMapCenter(center, false);
                    mapView.scaleMap(scaleChange, null, false);
                }
             });
             
        Parameters:
        r - The Runnable to be executed at internal thread when surface will be created
      • loadStyle

        public boolean loadStyle​(android.content.res.AssetManager assetManager,
                                 java.lang.String path)
        Loads map style. mapView.loadStyle(getAssets(), "DefaultStyle.bundle"); After style modification is finished, call `reloadTiles`.
        Parameters:
        assetManager - The AssetManager to be used while loading resources
        path - Path to folder in assets that contains Style.mapcss and images
        Returns:
        true if style loaded successfully
      • loadStyle

        public boolean loadStyle​(GLMapView.ResourceLoadCallback callback)
        Loads map style. After style modification is finished, call `reloadTiles`.
        Parameters:
        callback - The ResourceLoadCallback to be used while loading resources
        Returns:
        true if style loaded successfully
      • getStyleOptions

        @Nullable
        public java.lang.String[] getStyleOptions()
        Returns options available in loaded style. By default they are all enabled.
        Returns:
        options available in loaded style.
      • setStyleOptions

        public void setStyleOptions​(java.lang.String[] options)
        Sets enabled style options.
        Parameters:
        options - options to enable in style.
      • setLocaleSettings

        public void setLocaleSettings​(GLMapLocaleSettings localeSettings)
        Sets map locale settings
        Parameters:
        localeSettings - New locale settings to use for translating map labels
      • getLocaleSettings

        @NonNull
        public GLMapLocaleSettings getLocaleSettings()
        Returns:
        GLMapLocaleSettings that was previously set
      • getGesturesDetector

        @NonNull
        public GLMapGesturesDetector getGesturesDetector()
        Returns:
        value that was previously set.
      • setGesturesDetector

        public void setGesturesDetector​(GLMapGesturesDetector gesturesDetector)
        If map do not need to handle touches set gesturesDetector to null. By default map view have gesture detector
        Parameters:
        gesturesDetector - GLMapGesturesDetector gestures detector to set
      • setRasterTileSources

        public void setRasterTileSources​(@Nullable
                                         GLMapRasterTileSource[] tileSources)
        By default rasterTileSources is null. In this case GLMapView will use vector sources that was added or downloaded by GLMapManager.
        Parameters:
        tileSources - Raster tile sources to use
      • getRasterTileSources

        @Nullable
        public GLMapRasterTileSource[] getRasterTileSources()
        Returns:
        value that was previously set.
      • captureFrameWhenFinish

        public void captureFrameWhenFinish​(GLMapView.ScreenCaptureCallback callback)
        Captures frame when surface will be created and loading of resources finished. ScreenCaptureCallback provides Bitmap as a result
        Parameters:
        callback - ScreenCaptureCallback to call with result
      • mapZoomForBBox

        public double mapZoomForBBox​(GLMapBBox bbox,
                                     int mapWidth,
                                     int mapHeight)
        Calculates zoom of map to fit given bbox
        Parameters:
        bbox - bbox that you wish to fit
        mapWidth - width of visible area
        mapHeight - height of visible area
        Returns:
        zoom of map to fit given bbox or NaN if bbox is empty.
      • getMapCenter

        public MapPoint getMapCenter​(MapPoint point)
        Gets coordinates of the origin point of the map. If animation is in progress - this value returns final value.
        MapPoint pt = mapView.getMapCenter(new MapPoint());
        Parameters:
        point - The point to be filled with values.
        Returns:
        The same object that was passed to method call.
        See Also:
        setMapCenter(MapPoint)
      • getCurrentMapCenter

        public MapPoint getCurrentMapCenter​(MapPoint point)
        Gets current coordinates of the origin point of the map.
        Parameters:
        point - The point to be filled with values.
        Returns:
        The same object that was passed to method call.
      • getMapCenter

        public MapPoint getMapCenter()
        Gets coordinates of the origin point of the map.
        MapPoint pt = mapView.getMapCenter();
        Returns:
        Returns coordinates of map center point.
        See Also:
        setMapCenter(MapPoint)
      • setMapCenter

        public void setMapCenter​(MapPoint center)
        Sets coordinates of the origin point of the map.
        mapView.setMapCenter(center);
        Parameters:
        center - New map center.
        See Also:
        getMapCenter(MapPoint)
      • getMapGeoCenter

        public MapGeoPoint getMapGeoCenter()
        Gets coordinates of the origin point of the map.
        MapPoint pt = mapView.getMapCenter();
        Returns:
        Returns coordinates of map center point.
        See Also:
        setMapGeoCenter(MapGeoPoint)
      • setMapGeoCenter

        public void setMapGeoCenter​(MapGeoPoint geoCenter)
        Sets coordinates of the origin point of the map.
        mapView.setMapGeoCenter(center);
        Parameters:
        geoCenter - New map center.
        See Also:
        getMapCenter(MapPoint)
      • getMapOrigin

        public MapPoint getMapOrigin​(MapPoint point)
        Origin point of the map coordinate system.
        Parameters:
        point - The point to be filled with values.
        Returns:
        The same object that was passed to method call.
      • getMapOrigin

        public MapPoint getMapOrigin()
        Returns:
        Returns origin point of the map coordinate system.
      • setMapOrigin

        public void setMapOrigin​(MapPoint point)
        Origin point of the map coordinate system (X, Y). Changing the values in this property between 0 and 1 in relative coordinates describes the point of GLMapView which is considered as a center point for `mapCenter` and `setMapCenter:animated:`.
        Parameters:
        point - The point to be filled with values.
      • getBBox

        public GLMapBBox getBBox()
        BBox of current visible part of GLMapView
        Returns:
        bbox of visible part of GLMapView
      • setFontScale

        public void setFontScale​(float scale)
        Sets scale of font. Will trigger reloadTiles automatically;
        Parameters:
        scale - New font scale (default is 1).
      • getFontScale

        public float getFontScale()
        Returns:
        value of font scale
      • getMapAngle

        public float getMapAngle()
        Gets current angle of the map.
        Returns:
        Current angle of the map.
      • setMapAngle

        public void setMapAngle​(float newAngle)
        Sets zoom level of the map.
        mapView.setMapZoom(16, false);
        Parameters:
        newAngle - new zoom level for map.
        See Also:
        getMapAngle()
      • getMapZoom

        public double getMapZoom()
        Get zoom level of the map. If animation is in progress final value will return.
        double zoom = mapView.getMapZoom();
        Returns:
        Current zoom of the map.
        See Also:
        setMapZoom(double)
      • getCurrentMapZoom

        public double getCurrentMapZoom()
        Gets current zoom level of the map.
        double zoom = mapView.getCurrentMapZoom();
        Returns:
        Current zoom of the map.
        See Also:
        setMapZoom(double)
      • getCurrentMapScale

        public double getCurrentMapScale()
        Gets current scale of the map.
        Returns:
        current scale of the map
      • getMapScale

        public double getMapScale()
        Gets scale of the map.
        Returns:
        scale of the map
        See Also:
        getMapZoom()
      • setMapZoom

        public void setMapZoom​(double newZoom)
        Sets zoom level of the map.
        mapView.setMapZoom(16);
        Parameters:
        newZoom - new zoom level for map.
        See Also:
        getMapZoom()
      • setMaxScale

        public void setMaxScale​(double maxScale)
        Sets maximum scale of the map
        Parameters:
        maxScale - max scale to set
      • getMaxScale

        public double getMaxScale()
        Gets maximum scale of the map
        Returns:
        maximum scale of the map
      • setMapScale

        public void setMapScale​(double newScale)
        Set scale of the map. Same as setMapZoom(pow(2, zoomLevel)). If animation is in progress final value will return.
        Parameters:
        newScale - new scale for map.
        See Also:
        getMapZoom()
      • setScaleRulerStyle

        public void setScaleRulerStyle​(int units,
                                       int placement,
                                       MapPoint paddings,
                                       double maxWidth)
        Set style of scale ruler.
        
         mapView.setScaleRulerStyle(GLUnitSystem.International, GLMapPlacement.BottomCenter, new MapPoint(10, 10), 200);
         
        Parameters:
        units - format of values to display
        placement - alignment of text
        paddings - paddings of scale ruler in points
        maxWidth - width of scale hit in points
      • setScaleRulerBottomText

        public void setScaleRulerBottomText​(@Nullable
                                            java.lang.String text)
        Sets text that will be displayed under scale ruler.
        Parameters:
        text - text to display
      • setAttributionPosition

        public void setAttributionPosition​(int placement)
        Sets position of attribution.
        mapView.setAttributionPosition(GLMapPlacement.TopCenter);
        Parameters:
        placement - placement of attribution
      • removeAllObjects

        public void removeAllObjects()
        Remove all images, image groups, tracks and marker layers from map
        See Also:
        remove(GLMapDrawObject)
      • startAnimation

        public void startAnimation​(GLMapAnimation animation)
        Starts animation.
        Parameters:
        animation - animation to start
      • animate

        public GLMapAnimation animate​(GLMapView.AnimateCallback callback)
        Create and starts animation using provided callback
        Parameters:
        callback - Callback that will configure animation
        Returns:
        created animation.
      • animate

        public GLMapAnimation animate​(GLMapView.AnimateCallback callback,
                                      @Nullable
                                      java.lang.Runnable onFinish)
        Create and starts animation using provided callback
        Parameters:
        callback - Callback that will configure animation
        onFinish - Callback that will be called when animation is finished
        Returns:
        created animation.
      • reloadTiles

        public void reloadTiles()
        Force reloading of all tiles.
      • setNeedRedraw

        public void setNeedRedraw()
        Force redraw
      • setMapDidMoveCallback

        public void setMapDidMoveCallback​(@Nullable
                                          java.lang.Runnable callback)
        Sets callback that will be called after move animation finished
        Parameters:
        callback - callback that will be post to ui thread after animation finished
      • distanceInMeters

        public static double distanceInMeters​(MapGeoPoint from,
                                              MapGeoPoint to)
        Calculates distance between two geo points
        Parameters:
        from - first geo point
        to - second geo point
        Returns:
        distance in meters
      • bearingAngle

        public static double bearingAngle​(MapGeoPoint from,
                                          MapGeoPoint to)
        Calculates bearing between two geo points
        Parameters:
        from - first geo point
        to - second geo point
        Returns:
        bearing angle in degrees
      • ForceOpenGL2

        public static void ForceOpenGL2()
        After calling this function any new GLMapView will use OpenGL 2.0 even if device supports OpenGL 3.0 Some cheap Android devices have problems with drivers.
      • crashNDK

        public static void crashNDK()
      • crashNDK2

        public static void crashNDK2()