Online Maps  v3
OnlineMapsControlBase Class Referenceabstract

Class implements the basic functionality control of the map. More...

Inheritance diagram for OnlineMapsControlBase:
IOnlineMapsSavableComponent OnlineMapsControlBase2D OnlineMapsControlBase3D OnlineMapsControlBaseUI< T > OnlineMapsNGUITextureControl OnlineMapsSpriteRendererControl OnlineMapsControlBaseDynamicMesh OnlineMapsTextureControl OnlineMapsTileSetControl

Public Member Functions

Vector2 GetCoords ()
 Returns the geographical coordinates of the location where the cursor is. More...
 
Vector2 GetCoords (Vector2 position)
 Returns the geographical coordinates at the specified coordinates of the screen. More...
 
bool GetCoords (out double lng, out double lat)
 Returns the geographical coordinates of the location where the cursor is. More...
 
Vector2 GetInputPosition ()
 Returns the current cursor position. More...
 
Vector2 GetPosition (Vector2 coords)
 Converts geographical coordinate to position in the scene relative to the top-left corner of the map in map space. More...
 
virtual void GetPosition (double lng, double lat, out double px, out double py)
 Converts geographical coordinate to position in the scene relative to the top-left corner of the map in map space. More...
 
virtual Rect GetRect ()
 Screen area occupied by the map. More...
 
OnlineMapsSavableItem [] GetSavableItems ()
 Returns an array of items to save More...
 
Vector2 GetScreenPosition (Vector2 coords)
 Converts geographical coordinate to position in screen space. More...
 
virtual Vector2 GetScreenPosition (double lng, double lat)
 Converts geographical coordinate to position in screen space. More...
 
int GetTouchCount ()
 Returns the current number of touches. More...
 
void InvokeBasePress ()
 Invokes OnMapBasePress. More...
 
void InvokeBaseRelease ()
 Invokes OnMapBaseRelease. More...
 
virtual void OnAwakeBefore ()
 Event that occurs before Awake. More...
 
virtual void SetTexture (Texture2D texture)
 Specifies the texture, which will draw the map. In texture must be enabled "Read / Write Enabled". More...
 
void UpdateLastPosition ()
 Force updates the latest coordinates of cursor. More...
 
bool ZoomOnPoint (float zoomOffset, Vector2 screenPosition)
 Changes the zoom keeping a specified point on same place. More...
 

Public Attributes

Func< Vector2 > OnGetInputPosition
 Event intercepts getting current cursor position. More...
 
Func< int > OnGetTouchCount
 Event intercepts getting number of touches. More...
 
Action OnMapClick
 Event that occurs when you click on the map. More...
 
Action OnMapDoubleClick
 Event that occurs when you double-click on the map. More...
 
Action OnMapDrag
 Event that occurs when you drag the map. More...
 
Action OnMapLongPress
 Event that occurs when you long press the map. More...
 
Action OnMapPress
 Event that occurs when you press on the map. More...
 
Action OnMapRelease
 Event that occurs when you release the map. More...
 
Action OnMapZoom
 Event that occurs when you zoom the map. More...
 
Action OnSmoothZoomBegin
 Event, which occurs when the smooth zoom is started. More...
 
Action OnSmoothZoomFinish
 Event, which occurs when the smooth zoom is finish. More...
 
Action OnSmoothZoomInit
 Event, which occurs when the smooth zoom is starts init. More...
 
Action OnSmoothZoomProcess
 Event, which occurs when the smooth zoom is process. More...
 
Action OnUpdateAfter
 Event that occurs at end Update. More...
 
Action OnUpdateBefore
 Event that occurs at start Update. More...
 
Func< OnlineMapsZoomEvent, float, bool > OnValidateZoom
 Event validating that current zoom event is allowed.
True - zoom is allowed, false - forbidden. More...
 
Texture2D activeTexture
 Texture, which will draw the map.
To change the texture use OnlineMapsControlBase.SetTexture. More...
 
bool allowZoom = true
 Specifies whether the user can change zoom of the map. More...
 
bool allowUserControl = true
 Specifies whether the user can manipulate the map. More...
 
bool isMapDrag
 Specifies whether to move map. More...
 
bool invertTouchZoom = false
 Inverts the map touch zoom for mobile devices. More...
 
bool smoothZoom = true
 Specifies whether to use a smooth touch zoom. More...
 
bool zoomInOnDoubleClick = true
 Allows you to zoom the map when double-clicked. More...
 
OnlineMapsZoomMode zoomMode = OnlineMapsZoomMode.target
 Mode of zoom. More...
 
float zoomSensitivity = 1
 Sensitivity of the zoom More...
 

Static Public Attributes

static float longPressDelay = 1
 Delay before invoking event OnMapLongPress. More...
 
static float startDragDistance = 4
 Distance (pixels) after which will start drag the map. More...
 

Protected Member Functions

virtual void AfterUpdate ()
 Function, which is executed after map updating. More...
 
virtual void BeforeUpdate ()
 Function, which is executed before map updating. More...
 
void DragMarker ()
 Moves the marker to the location of the cursor. More...
 
bool HitTest ()
 Checks whether the cursor over the map. More...
 
virtual void OnDestroyLate ()
 Event is called after the control has been disposed. More...
 
virtual void OnEnableLate ()
 Function that is called after control of the map enabled. More...
 
virtual void OnGestureZoom (Vector2 p1, Vector2 p2)
 Called when a gesture zoom. More...
 
virtual void OnMapBasePress ()
 Method that is called when you press the map. More...
 
virtual void OnMapBaseRelease ()
 Method that is called when you release the map. More...
 
void UpdatePosition ()
 Updates the map coordinates for the actions of the user. More...
 
void UpdateZoom ()
 Updates the map zoom for mouse wheel. More...
 

Static Protected Attributes

static OnlineMapsControlBase _instance
 Singleton of control More...
 

Properties

static OnlineMapsControlBase instance [get]
 Singleton instance of map control. More...
 
virtual bool allowMarkerScreenRect [get]
 Indicates whether it is possible to get the screen coordinates store. True - for 2D map, false - for the 3D map. More...
 
OnlineMapsMarkerBase dragMarker [get, set]
 Marker that dragged at the moment. More...
 
OnlineMaps map [get]
 Reference to map instance. More...
 
virtual bool mipmapForTiles [get, set]
 Mipmap for tiles. More...
 
virtual Rect screenRect [get]
 Screen area occupied by the map. More...
 
virtual Rect uvRect [get]
 UV rectangle used by the texture of the map. NGUI: uiTexture.uvRect. Other: new Rect(0, 0, 1, 1); More...
 

Detailed Description

Class implements the basic functionality control of the map.

Member Function Documentation

◆ AfterUpdate()

virtual void OnlineMapsControlBase.AfterUpdate ( )
protectedvirtual

Function, which is executed after map updating.

Reimplemented in OnlineMapsControlBase3D.

◆ BeforeUpdate()

virtual void OnlineMapsControlBase.BeforeUpdate ( )
protectedvirtual

Function, which is executed before map updating.

Reimplemented in OnlineMapsControlBaseUI< T >.

◆ DragMarker()

void OnlineMapsControlBase.DragMarker ( )
protected

Moves the marker to the location of the cursor.

◆ GetCoords() [1/3]

Vector2 OnlineMapsControlBase.GetCoords ( )

Returns the geographical coordinates of the location where the cursor is.

Returns
Geographical coordinates

◆ GetCoords() [2/3]

Vector2 OnlineMapsControlBase.GetCoords ( Vector2  position)

Returns the geographical coordinates at the specified coordinates of the screen.

Parameters
positionScreen coordinates
Returns
Geographical coordinates

◆ GetCoords() [3/3]

bool OnlineMapsControlBase.GetCoords ( out double  lng,
out double  lat 
)

Returns the geographical coordinates of the location where the cursor is.

Parameters
lngLongitude
latLatitude
Returns
True - success, False - otherwise.

◆ GetInputPosition()

Vector2 OnlineMapsControlBase.GetInputPosition ( )

Returns the current cursor position.

Returns
Current cursor position

◆ GetPosition() [1/2]

Vector2 OnlineMapsControlBase.GetPosition ( Vector2  coords)

Converts geographical coordinate to position in the scene relative to the top-left corner of the map in map space.

Parameters
coordsGeographical coordinate (X - Longitude, Y - Latitude)
Returns
Scene position (in map space)

◆ GetPosition() [2/2]

virtual void OnlineMapsControlBase.GetPosition ( double  lng,
double  lat,
out double  px,
out double  py 
)
virtual

Converts geographical coordinate to position in the scene relative to the top-left corner of the map in map space.

Parameters
lngLongitude
latLatitude
pxRelative position X
pyRelative position Y

Reimplemented in OnlineMapsControlBaseDynamicMesh.

◆ GetRect()

virtual Rect OnlineMapsControlBase.GetRect ( )
virtual

Screen area occupied by the map.

Returns
Screen rectangle

Reimplemented in OnlineMapsControlBaseUI< T >, and OnlineMapsSpriteRendererControl.

◆ GetSavableItems()

OnlineMapsSavableItem [] OnlineMapsControlBase.GetSavableItems ( )

Returns an array of items to save

Returns
Array of items to save

Implements IOnlineMapsSavableComponent.

◆ GetScreenPosition() [1/2]

Vector2 OnlineMapsControlBase.GetScreenPosition ( Vector2  coords)

Converts geographical coordinate to position in screen space.

Parameters
coordsGeographical coordinate (X - longitude, Y - latitude)
Returns
Screen space position

◆ GetScreenPosition() [2/2]

virtual Vector2 OnlineMapsControlBase.GetScreenPosition ( double  lng,
double  lat 
)
virtual

Converts geographical coordinate to position in screen space.

Parameters
lngLongitude
latLatitude
Returns
Screen space position

Reimplemented in OnlineMapsTileSetControl, OnlineMapsControlBase3D, OnlineMapsControlBaseDynamicMesh, OnlineMapsControlBaseUI< T >, and OnlineMapsSpriteRendererControl.

◆ GetTouchCount()

int OnlineMapsControlBase.GetTouchCount ( )

Returns the current number of touches.

Returns
Number of touches

◆ HitTest()

bool OnlineMapsControlBase.HitTest ( )
protected

Checks whether the cursor over the map.

Returns
True - if the cursor over the map, false - if not.

◆ InvokeBasePress()

void OnlineMapsControlBase.InvokeBasePress ( )

Invokes OnMapBasePress.

◆ InvokeBaseRelease()

void OnlineMapsControlBase.InvokeBaseRelease ( )

Invokes OnMapBaseRelease.

◆ OnAwakeBefore()

virtual void OnlineMapsControlBase.OnAwakeBefore ( )
virtual

Event that occurs before Awake.

Reimplemented in OnlineMapsTileSetControl.

◆ OnDestroyLate()

virtual void OnlineMapsControlBase.OnDestroyLate ( )
protectedvirtual

Event is called after the control has been disposed.

Reimplemented in OnlineMapsTileSetControl, and OnlineMapsControlBase3D.

◆ OnEnableLate()

virtual void OnlineMapsControlBase.OnEnableLate ( )
protectedvirtual

Function that is called after control of the map enabled.

Reimplemented in OnlineMapsControlBaseDynamicMesh, OnlineMapsControlBase3D, OnlineMapsControlBaseUI< T >, and OnlineMapsSpriteRendererControl.

◆ OnGestureZoom()

virtual void OnlineMapsControlBase.OnGestureZoom ( Vector2  p1,
Vector2  p2 
)
protectedvirtual

Called when a gesture zoom.

Parameters
p1Screen coordinates of touch point 1
p2Screen coordinates of touch point 2

◆ OnMapBasePress()

virtual void OnlineMapsControlBase.OnMapBasePress ( )
protectedvirtual

Method that is called when you press the map.

Reimplemented in OnlineMapsTileSetControl.

◆ OnMapBaseRelease()

virtual void OnlineMapsControlBase.OnMapBaseRelease ( )
protectedvirtual

Method that is called when you release the map.

Reimplemented in OnlineMapsTileSetControl.

◆ SetTexture()

virtual void OnlineMapsControlBase.SetTexture ( Texture2D  texture)
virtual

Specifies the texture, which will draw the map. In texture must be enabled "Read / Write Enabled".

Parameters
textureTexture

Reimplemented in OnlineMapsSpriteRendererControl, and OnlineMapsTextureControl.

◆ UpdateLastPosition()

void OnlineMapsControlBase.UpdateLastPosition ( )

Force updates the latest coordinates of cursor.

◆ UpdatePosition()

void OnlineMapsControlBase.UpdatePosition ( )
protected

Updates the map coordinates for the actions of the user.

◆ UpdateZoom()

void OnlineMapsControlBase.UpdateZoom ( )
protected

Updates the map zoom for mouse wheel.

◆ ZoomOnPoint()

bool OnlineMapsControlBase.ZoomOnPoint ( float  zoomOffset,
Vector2  screenPosition 
)

Changes the zoom keeping a specified point on same place.

Parameters
zoomOffsetPositive - zoom in, Negative - zoom out
screenPositionScreen position
Returns
True - if zoom changed, False - if zoom not changed

Member Data Documentation

◆ _instance

OnlineMapsControlBase OnlineMapsControlBase._instance
staticprotected

Singleton of control

◆ activeTexture

Texture2D OnlineMapsControlBase.activeTexture

Texture, which will draw the map.
To change the texture use OnlineMapsControlBase.SetTexture.

◆ allowUserControl

bool OnlineMapsControlBase.allowUserControl = true

Specifies whether the user can manipulate the map.

◆ allowZoom

bool OnlineMapsControlBase.allowZoom = true

Specifies whether the user can change zoom of the map.

◆ invertTouchZoom

bool OnlineMapsControlBase.invertTouchZoom = false

Inverts the map touch zoom for mobile devices.

◆ isMapDrag

bool OnlineMapsControlBase.isMapDrag

Specifies whether to move map.

◆ longPressDelay

float OnlineMapsControlBase.longPressDelay = 1
static

Delay before invoking event OnMapLongPress.

◆ OnGetInputPosition

Func<Vector2> OnlineMapsControlBase.OnGetInputPosition

Event intercepts getting current cursor position.

◆ OnGetTouchCount

Func<int> OnlineMapsControlBase.OnGetTouchCount

Event intercepts getting number of touches.

◆ OnMapClick

Action OnlineMapsControlBase.OnMapClick

Event that occurs when you click on the map.

◆ OnMapDoubleClick

Action OnlineMapsControlBase.OnMapDoubleClick

Event that occurs when you double-click on the map.

◆ OnMapDrag

Action OnlineMapsControlBase.OnMapDrag

Event that occurs when you drag the map.

◆ OnMapLongPress

Action OnlineMapsControlBase.OnMapLongPress

Event that occurs when you long press the map.

◆ OnMapPress

Action OnlineMapsControlBase.OnMapPress

Event that occurs when you press on the map.

◆ OnMapRelease

Action OnlineMapsControlBase.OnMapRelease

Event that occurs when you release the map.

◆ OnMapZoom

Action OnlineMapsControlBase.OnMapZoom

Event that occurs when you zoom the map.

◆ OnSmoothZoomBegin

Action OnlineMapsControlBase.OnSmoothZoomBegin

Event, which occurs when the smooth zoom is started.

◆ OnSmoothZoomFinish

Action OnlineMapsControlBase.OnSmoothZoomFinish

Event, which occurs when the smooth zoom is finish.

◆ OnSmoothZoomInit

Action OnlineMapsControlBase.OnSmoothZoomInit

Event, which occurs when the smooth zoom is starts init.

◆ OnSmoothZoomProcess

Action OnlineMapsControlBase.OnSmoothZoomProcess

Event, which occurs when the smooth zoom is process.

◆ OnUpdateAfter

Action OnlineMapsControlBase.OnUpdateAfter

Event that occurs at end Update.

◆ OnUpdateBefore

Action OnlineMapsControlBase.OnUpdateBefore

Event that occurs at start Update.

◆ OnValidateZoom

Func<OnlineMapsZoomEvent, float, bool> OnlineMapsControlBase.OnValidateZoom

Event validating that current zoom event is allowed.
True - zoom is allowed, false - forbidden.

◆ smoothZoom

bool OnlineMapsControlBase.smoothZoom = true

Specifies whether to use a smooth touch zoom.

◆ startDragDistance

float OnlineMapsControlBase.startDragDistance = 4
static

Distance (pixels) after which will start drag the map.

◆ zoomInOnDoubleClick

bool OnlineMapsControlBase.zoomInOnDoubleClick = true

Allows you to zoom the map when double-clicked.

◆ zoomMode

OnlineMapsZoomMode OnlineMapsControlBase.zoomMode = OnlineMapsZoomMode.target

Mode of zoom.

◆ zoomSensitivity

float OnlineMapsControlBase.zoomSensitivity = 1

Sensitivity of the zoom

Property Documentation

◆ allowMarkerScreenRect

virtual bool OnlineMapsControlBase.allowMarkerScreenRect
get

Indicates whether it is possible to get the screen coordinates store. True - for 2D map, false - for the 3D map.

◆ dragMarker

OnlineMapsMarkerBase OnlineMapsControlBase.dragMarker
getset

Marker that dragged at the moment.

◆ instance

OnlineMapsControlBase OnlineMapsControlBase.instance
staticget

Singleton instance of map control.

◆ map

OnlineMaps OnlineMapsControlBase.map
get

Reference to map instance.

◆ mipmapForTiles

virtual bool OnlineMapsControlBase.mipmapForTiles
getset

Mipmap for tiles.

◆ screenRect

virtual Rect OnlineMapsControlBase.screenRect
get

Screen area occupied by the map.

◆ uvRect

virtual Rect OnlineMapsControlBase.uvRect
get

UV rectangle used by the texture of the map. NGUI: uiTexture.uvRect. Other: new Rect(0, 0, 1, 1);