Online Maps v3
Loading...
Searching...
No Matches
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

virtual OnlineMapsTile CreateTile (int x, int y, int zoom, bool isMapTile=true)
 Creates a new tile.
 
Vector2 GetCoords ()
 Returns the geographical coordinates of the location where the cursor is.
 
Vector2 GetCoords (Vector2 position)
 Returns the geographical coordinates at the specified coordinates of the screen.
 
bool GetCoords (out double lng, out double lat)
 Returns the geographical coordinates of the location where the cursor is.
 
bool GetCoords (Vector2 position, out double lng, out double lat)
 Returns the geographical coordinates of the location where the position is.
 
Vector2 GetInputPosition ()
 Returns the current cursor position.
 
virtual IOnlineMapsInteractiveElement GetInteractiveElement (Vector2 screenPosition)
 Get the interactive element located at the screen position.
 
Vector2 GetPosition (Vector2 coords)
 Converts geographical coordinate to position in the scene relative to the top-left corner of the map in map space.
 
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.
 
virtual Rect GetRect ()
 Screen area occupied by the map.
 
OnlineMapsSavableItem[] GetSavableItems ()
 Returns an array of items to save.
 
Vector2 GetScreenPosition (Vector2 coords)
 Converts geographical coordinate to position in screen space.
 
virtual Vector2 GetScreenPosition (double lng, double lat)
 Converts geographical coordinate to position in screen space.
 
bool GetTile (Vector2 position, out double tx, out double ty)
 Gets a tile by screen position.
 
int GetTouchCount ()
 Returns the current number of touches.
 
void InvokeBasePress ()
 Invokes OnMapBasePress.
 
void InvokeBaseRelease ()
 Invokes OnMapBaseRelease.
 
bool IsCursorOnUIElement (Vector2 position)
 Whether the screen position is on UI element.
 
virtual void OnAwakeBefore ()
 Event that occurs before Awake.
 
virtual void SetTexture (Texture2D texture)
 Specifies the texture, which will draw the map. In texture must be enabled "Read / Write Enabled".
 
void UpdateLastPosition ()
 Force updates the latest coordinates of cursor.
 
bool ZoomOnPoint (float zoomOffset, Vector2 screenPosition)
 Changes the zoom keeping a specified point on same place.
 

Public Attributes

Action OnDrawMarkers
 Event that occurs when need to draw markers.
 
Func< Vector2 > OnGetInputPosition
 Event intercepts getting current cursor position.
 
Func< Vector2[]> OnGetMultitouchInputPositions
 The event intercepts getting of the current multitouch points.
 
Func< int > OnGetTouchCount
 Event intercepts getting number of touches.
 
Action OnMapClick
 Event that occurs when you click on the map.
 
Action OnMapDoubleClick
 Event that occurs when you double-click on the map.
 
Action OnMapDrag
 Event that occurs when you drag the map.
 
Action OnMapLongPress
 Event that occurs when you long press the map.
 
Action OnMapPress
 Event that occurs when you press on the map.
 
Action OnMapRelease
 Event that occurs when you release the map.
 
Action OnMapZoom
 Event that occurs when you zoom the map.
 
Action OnSmoothZoomBegin
 Event, which occurs when the smooth zoom is started.
 
Action OnSmoothZoomFinish
 Event, which occurs when the smooth zoom is finish.
 
Action OnSmoothZoomInit
 Event, which occurs when the smooth zoom is starts init.
 
Action OnSmoothZoomProcess
 Event, which occurs when the smooth zoom is process.
 
Action OnUpdateAfter
 Event that occurs at end Update.
 
Action OnUpdateBefore
 Event that occurs at start Update.
 
Predicate< GameObject > OnValidateCursorOnUIElement
 Event validating that cursor is on UI element.
True - cursor on UI element, false - otherwise.
 
Func< OnlineMapsZoomEvent, float, bool > OnValidateZoom
 Event validating that current zoom event is allowed.
True - zoom is allowed, false - forbidden.
 
Texture2D activeTexture
 Texture, which will draw the map.
To change the texture use OnlineMapsControlBase.SetTexture.
 
bool allowZoom = true
 Specifies whether the user can change zoom of the map.
 
bool allowUserControl = true
 Specifies whether the user can manipulate the map.
 
bool checkScreenSizeForWheelZoom = true
 Check that the input position is on the screen.
 
OnlineMapsDrawingElementManager drawingElementManager
 Reference to drawing element manager.
 
bool isMapDrag
 Specifies whether to move map.
 
bool invertTouchZoom = false
 Inverts the map touch zoom for mobile devices.
 
OnlineMapsMarkerManager markerManager
 Reference to marker manager.
 
bool smoothZoom = true
 Specifies whether to use a smooth touch zoom.
 
bool zoomInOnDoubleClick = true
 Allows you to zoom the map when double-clicked.
 
OnlineMapsZoomMode zoomMode = OnlineMapsZoomMode.target
 Mode of zoom.
 
float zoomSensitivity = 1
 Sensitivity of the touch zoom.
 
float zoomSpeed = 1
 Zoom speed with any interaction (wheel, double click, touch)
 

Static Public Attributes

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

Protected Member Functions

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

Static Protected Attributes

static OnlineMapsControlBase _instance
 Singleton of control.
 

Properties

static OnlineMapsControlBase instance [get]
 Singleton instance of map control.
 
virtual bool allowMarkerScreenRect [get]
 Indicates whether it is possible to get the screen coordinates store. True - for 2D map, false - for the 3D map.
 
virtual bool allowTouchZoom [get]
 Indicates whether it is possible to use the touch zoom.
 
OnlineMapsMarkerBase dragMarker [get, set]
 Marker that dragged at the moment.
 
OnlineMapsMarker2DDrawer markerDrawer [get, set]
 Gets/sets the marker drawer.
 
OnlineMaps map [get]
 Reference to map instance.
 
virtual bool mipmapForTiles [get, set]
 Mipmap for tiles.
 
virtual Rect screenRect [get]
 Screen area occupied by the map.
 
bool resultIsTexture [get]
 Whether the current control draws to a texture.
 
virtual OnlineMapsTarget resultType [get]
 The result type of the current control.
 
virtual bool useRasterTiles [get]
 Whether the current control uses raster tiles.
 
virtual Rect uvRect [get]
 UV rectangle used by the texture of the map. NGUI: uiTexture.uvRect. Other: new Rect(0, 0, 1, 1);.
 

Detailed Description

Class implements the basic functionality control of the map.

Member Function Documentation

◆ CreateTile()

virtual OnlineMapsTile OnlineMapsControlBase.CreateTile ( int x,
int y,
int zoom,
bool isMapTile = true )
virtual

Creates a new tile.

Parameters
xTile X
yTile Y
zoomTile Zoom
isMapTileShould this tile be displayed on the map?
Returns
Tile

◆ GetCoords() [1/4]

Vector2 OnlineMapsControlBase.GetCoords ( )

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

Returns
Geographical coordinates

◆ GetCoords() [2/4]

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.

◆ GetCoords() [3/4]

Vector2 OnlineMapsControlBase.GetCoords ( Vector2 position)

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

Parameters
positionScreen coordinates
Returns
Geographical coordinates

◆ GetCoords() [4/4]

bool OnlineMapsControlBase.GetCoords ( Vector2 position,
out double lng,
out double lat )
abstract

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

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

◆ GetInputPosition()

Vector2 OnlineMapsControlBase.GetInputPosition ( )

Returns the current cursor position.

Returns
Current cursor position

◆ GetInteractiveElement()

virtual IOnlineMapsInteractiveElement OnlineMapsControlBase.GetInteractiveElement ( Vector2 screenPosition)
virtual

Get the interactive element located at the screen position.

Parameters
screenPositionScreen position
Returns
Interactive element

Reimplemented in OnlineMapsControlBase3D.

◆ GetPosition() [1/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.

◆ GetPosition() [2/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)

◆ 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]

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 OnlineMapsControlBase3D, OnlineMapsControlBaseDynamicMesh, OnlineMapsControlBaseUI< T >, OnlineMapsSpriteRendererControl, and OnlineMapsTileSetControl.

◆ GetScreenPosition() [2/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

◆ GetTile()

bool OnlineMapsControlBase.GetTile ( Vector2 position,
out double tx,
out double ty )
abstract

Gets a tile by screen position.

Parameters
positionScreen position
txTile X
tyTile Y
Returns
Tile

◆ GetTouchCount()

int OnlineMapsControlBase.GetTouchCount ( )

Returns the current number of touches.

Returns
Number of touches

◆ HitTest() [1/2]

bool OnlineMapsControlBase.HitTest ( )
protected

Checks whether the cursor over the map.

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

◆ HitTest() [2/2]

virtual bool OnlineMapsControlBase.HitTest ( Vector2 position)
protectedvirtual

Checks whether specified position over the map.

Parameters
positionScreen position
Returns
True - if the position over the map, false - if not.

Reimplemented in OnlineMapsControlBaseUI< T >, and OnlineMapsTileSetControl.

◆ IsCursorOnUIElement()

bool OnlineMapsControlBase.IsCursorOnUIElement ( Vector2 position)

Whether the screen position is on UI element.

Parameters
positionScreen position
Returns
True - on UI element, False - otherwise

◆ 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

◆ 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.

◆ 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