Online Maps v3
Loading...
Searching...
No Matches
OnlineMaps Class Reference

The main class. With it you can control the map. More...

Inheritance diagram for OnlineMaps:
IOnlineMapsSavableComponent

Public Member Functions

void CheckServerConnection (Action< bool > callback)
 Allows you to test the connection to the Internet.
 
void DispatchEvent (params OnlineMapsEvents[] evs)
 Dispatch map events.
 
void GetBottomRightPosition (out double lng, out double lat)
 Get the bottom-right corner of the map.
 
void GetCorners (out double tlx, out double tly, out double brx, out double bry)
 Returns the coordinates of the corners of the map.
 
OnlineMapsDrawingElement GetDrawingElement (Vector2 screenPosition)
 Gets drawing element from screen.
 
void GetPosition (out double lng, out double lat)
 Get the map coordinate.
 
OnlineMapsSavableItem[] GetSavableItems ()
 Returns an array of items to save.
 
void GetTileCorners (out double tlx, out double tly, out double brx, out double bry)
 Get the tile coordinates of the corners of the map.
 
void GetTileCorners (out double tlx, out double tly, out double brx, out double bry, int zoom)
 Get the tile coordinates of the corners of the map.
 
void GetTilePosition (out double px, out double py)
 Get the tile coordinates of the map.
 
void GetTilePosition (out double px, out double py, int zoom)
 Get the tile coordinates of the map.
 
void GetTopLeftPosition (out double lng, out double lat)
 Get the top-left corner of the map.
 
bool InMapView (double lng, double lat)
 Checks if the coordinates are in the map view.
 
void Redraw ()
 Full redraw map.
 
void RedrawImmediately ()
 Stops the current process map generation, clears all buffers and completely redraws the map.
 
void SetPosition (double lng, double lat, bool ignoreSamePosition=true)
 Set the the map coordinate.
 
void SetPositionAndZoom (double lng, double lat, float? ZOOM=null)
 Sets the position and zoom.
 
void SetTexture (Texture2D newTexture)
 Sets the texture, which will draw the map. Texture displaying on the source you need to change yourself.
 
void SetTilePosition (double tx, double ty, int? tileZoom=null)
 Sets the position of the center point of the map based on the tile position.
 
void UpdateCorners ()
 Updates the coordinates of the corners of the map.
 

Public Attributes

Action OnChangePosition
 Event caused when the user change map position.
 
Action OnChangeZoom
 Event caused when the user change map zoom.
 
Action OnGUIAfter
 Event caused at the end of OnGUI method.
 
Action OnGUIBefore
 Event caused at the beginning of OnGUI method.
 
Func< Vector2, OnlineMapsMarkerOnGetMarkerFromScreen
 Intercepts getting marker by the screen coordinates.
 
Action OnLateUpdateAfter
 The event is invoked at the end LateUpdate.
 
Action OnLateUpdateBefore
 The event is called at the start LateUpdate.
 
Action OnMapUpdated
 Event which is called after the redrawing of the map.
 
Action OnUpdateBefore
 Event is called before Update.
 
Action OnUpdateLate
 Event is called after Update.
 
bool allowRedraw
 Allows drawing of map.
Important: The interaction with the map, add or remove markers and drawing elements, automatically allowed to redraw the map.
Use lockRedraw, to prohibit the redrawing of the map.

 
bool blockAllInteractions
 Allows you to block all user interactions with the map, markers, drawing elements. But you can still interact with the map using the API.
 
int countParentLevels = 5
 Tiles for the specified number of parent levels will be loaded.
 
string customProviderURL = "http://localhost/{zoom}/{y}/{x}"
 URL of custom provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail.
 
string customTrafficProviderURL = "http://localhost/{zoom}/{y}/{x}"
 URL of custom traffic provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail.
 
Texture2D defaultTileTexture
 Texture displayed until the tile is not loaded.
 
bool dispatchEvents = true
 Specifies whether to dispatch the event.
 
bool dragMarkerHoldingCTRL = false
 Drag marker while holding CTRL.
 
Color emptyColor = Color.gray
 Color, which is used until the tile is not loaded, unless specified field defaultTileTexture.
 
int height = 1024
 Map height in pixels.
 
bool labels = true
 Specifies whether to display the labels on the map.
 
string language = "en"
 Language of the labels on the map.
 
bool lockRedraw = false
 Prohibits drawing of maps.
Important: Do not forget to disable this restriction. Otherwise, the map will never be redrawn.
 
bool needRedraw
 A flag that indicates that need to redraw the map.
 
bool notInteractUnderGUI = true
 Not interact under the GUI.
 
string mapType
 ID of current map type.
 
OnlineMapsOSMOverpassServer osmServer = OnlineMapsOSMOverpassServer.main
 Server for requests to the Open Street Map Overpass API.
 
string proxyURL = "https://service.infinity-code.com/redirect.php?"
 URL of the proxy server used for WebGL platform.
 
bool redrawOnPlay
 A flag that indicates whether to redraw the map at startup.
 
bool renderInThread = true
 Render map in a separate thread. Recommended.
 
string resourcesPath = "OnlineMapsTiles/{zoom}/{x}/{y}"
 Template path in Resources, from where the tiles will be loaded. This field supports tokens.
 
string streamingAssetsPath = "OnlineMapsTiles/{zoom}/{x}/{y}.png"
 Template path in Streaming Assets, from where the tiles will be loaded. This field supports tokens.
 
OnlineMapsShowMarkerTooltip showMarkerTooltip = OnlineMapsShowMarkerTooltip.onHover
 Indicates when the marker will show tips.
 
OnlineMapsSource source = OnlineMapsSource.Online
 Specifies from where the tiles should be loaded (Online, Resources, Online and Resources).
 
bool stopPlayingWhenScriptsCompile = true
 Indicates that Unity need to stop playing when compiling scripts.
 
Texture2D texture
 Texture, which is used to draw the map.
To change this value, use OnlineMaps.SetTexture.
 
OnlineMapsTileManager tileManager
 Reference to tile manager.
 
OnlineMapsTooltipDrawerBase tooltipDrawer
 Reference to tooltip drawer.
 
Texture2D tooltipBackgroundTexture
 Background texture of tooltip.
 
bool traffic = false
 Specifies whether to draw traffic.
 
OnlineMapsTrafficProvider trafficProvider
 Provider of traffic jams.
 
string trafficProviderID = "googlemaps"
 ID of current traffic provider.
 
bool useCurrentZoomTiles = false
 Use only the current zoom level of the tiles.
 
bool useProxy = true
 Use a proxy server for WebGL?
 
bool useSoftwareJPEGDecoder = false
 Specifies is necessary to use software JPEG decoder. Use only if you have problems with hardware decoding of JPEG.
 
int width = 1024
 Map width in pixels.
 

Static Public Attributes

const string version = "3.9.3.1"
 The current version of Online Maps.
 
const int MINZOOM = 1
 The minimum zoom level.
 
const int MAXZOOM = 20
 The maximum zoom level.
 
static Action< OnlineMapsOnStart
 The event is called when the map starts.
 
static Action< OnlineMapsOnPreloadTiles
 The event occurs after generating buffer and before update control to preload tiles for tileset.
 
static bool isUserControl = false
 Specifies whether the user interacts with the map.
 

Properties

static OnlineMaps instance [get]
 Singleton instance of map.
 
OnlineMapsProvider.MapType activeType [get, set]
 Active type of map.
 
Vector2 bottomRightPosition [get]
 Gets the bottom right position.
 
OnlineMapsGeoRect bounds [get]
 Gets the coordinates of the map view.
 
OnlineMapsBuffer buffer [get]
 Reference to the current draw buffer.
 
OnlineMapsBufferStatus bufferStatus [get]
 The current state of the drawing buffer.
 
OnlineMapsControlBase control [get]
 Gets the current control.
 
OnlineMapsControlBase3D control3D [get]
 Gets the current 3D control.
 
OnlineMapsDrawingElementManager drawingElementManager [get]
 Gets the drawing element manager from control.
 
float floatZoom [get, set]
 Gets and sets float zoom value.
 
OnlineMapsMarkerManager markerManager [get]
 Gets the markers manager from control.
 
OnlineMapsMarker3DManager marker3DManager [get]
 Gets the 3D markers manager from control.
 
Vector2 position [get, set]
 Coordinates of the center point of the map.
 
OnlineMapsPositionRange positionRange [get, set]
 Limits the range of map coordinates.
 
OnlineMapsProjection projection [get]
 Projection of active provider.
 
Vector2 topLeftPosition [get]
 Gets the top left position.
 
int zoom [get, set]
 Current zoom.
 
float zoomFactor [get]
 The scaling factor for zoom.
 
OnlineMapsRange zoomRange [get, set]
 Specifies the valid range of map zoom.
 
float zoomScale [get]
 The fractional part of zoom.
 

Detailed Description

The main class. With it you can control the map.

Member Function Documentation

◆ CheckServerConnection()

void OnlineMaps.CheckServerConnection ( Action< bool > callback)

Allows you to test the connection to the Internet.

Parameters
callbackFunction, which will return the availability of the Internet.

◆ DispatchEvent()

void OnlineMaps.DispatchEvent ( params OnlineMapsEvents[] evs)

Dispatch map events.

Parameters
evsEvents you want to dispatch.

◆ GetBottomRightPosition()

void OnlineMaps.GetBottomRightPosition ( out double lng,
out double lat )

Get the bottom-right corner of the map.

Parameters
lngLongitude
latLatitude

◆ GetCorners()

void OnlineMaps.GetCorners ( out double tlx,
out double tly,
out double brx,
out double bry )

Returns the coordinates of the corners of the map.

Parameters
tlxLongitude of the left border
tlyLatitude of the top border
brxLongitude of the right border
bryLatitude of the bottom border

◆ GetDrawingElement()

OnlineMapsDrawingElement OnlineMaps.GetDrawingElement ( Vector2 screenPosition)

Gets drawing element from screen.

Parameters
screenPositionScreen position.
Returns
Drawing element

◆ GetPosition()

void OnlineMaps.GetPosition ( out double lng,
out double lat )

Get the map coordinate.

Parameters
lngLongitude
latLatitude

◆ GetSavableItems()

OnlineMapsSavableItem[] OnlineMaps.GetSavableItems ( )

Returns an array of items to save.

Returns
Array of items to save

Implements IOnlineMapsSavableComponent.

◆ GetTileCorners() [1/2]

void OnlineMaps.GetTileCorners ( out double tlx,
out double tly,
out double brx,
out double bry )

Get the tile coordinates of the corners of the map.

Parameters
tlxLeft tile X
tlyTop tile Y
brxRight tile X
bryBottom tile Y

◆ GetTileCorners() [2/2]

void OnlineMaps.GetTileCorners ( out double tlx,
out double tly,
out double brx,
out double bry,
int zoom )

Get the tile coordinates of the corners of the map.

Parameters
tlxLeft tile X
tlyTop tile Y
brxRight tile X
bryBottom tile Y
zoomZoom

◆ GetTilePosition() [1/2]

void OnlineMaps.GetTilePosition ( out double px,
out double py )

Get the tile coordinates of the map.

Parameters
pxTile X
pyTile Y

◆ GetTilePosition() [2/2]

void OnlineMaps.GetTilePosition ( out double px,
out double py,
int zoom )

Get the tile coordinates of the map.

Parameters
pxTile X
pyTile Y
zoomZoom

◆ GetTopLeftPosition()

void OnlineMaps.GetTopLeftPosition ( out double lng,
out double lat )

Get the top-left corner of the map.

Parameters
lngLongitude
latLatitude

◆ InMapView()

bool OnlineMaps.InMapView ( double lng,
double lat )

Checks if the coordinates are in the map view.

Parameters
lngLongitude
latLatitude
Returns
True - coordinates in map view. False - coordinates outside the map view.

◆ SetPosition()

void OnlineMaps.SetPosition ( double lng,
double lat,
bool ignoreSamePosition = true )

Set the the map coordinate.

Parameters
lngLongitude
latLatitude

◆ SetPositionAndZoom()

void OnlineMaps.SetPositionAndZoom ( double lng,
double lat,
float? ZOOM = null )

Sets the position and zoom.

Parameters
lngLongitude
latLatitude
ZOOMZoom

◆ SetTexture()

void OnlineMaps.SetTexture ( Texture2D newTexture)

Sets the texture, which will draw the map. Texture displaying on the source you need to change yourself.

Parameters
newTextureTexture, where you want to draw the map.

◆ SetTilePosition()

void OnlineMaps.SetTilePosition ( double tx,
double ty,
int? tileZoom = null )

Sets the position of the center point of the map based on the tile position.

Parameters
txTile X
tyTile Y
tileZoomTile zoom

Property Documentation

◆ bottomRightPosition

Vector2 OnlineMaps.bottomRightPosition
get

Gets the bottom right position.

The bottom right position.

◆ topLeftPosition

Vector2 OnlineMaps.topLeftPosition
get

Gets the top left position.

The top left position.