Online Maps v3
Loading...
Searching...
No Matches
OnlineMapsLocationServiceBase Class Referenceabstract

Controls map using Location Service (GPS and compass). More...

Inheritance diagram for OnlineMapsLocationServiceBase:
IOnlineMapsSavableComponent OnlineMapsLocationServiceGenericBase< T >

Public Member Functions

void GetLocation (out float longitude, out float latitude)
 Returns the current GPS location or emulator location.
 
OnlineMapsSavableItem[] GetSavableItems ()
 Returns an array of items to save.
 
bool IsLocationServiceRunning ()
 Checks that the Location Service is running.
 
void StopLocationService ()
 Stops Location Service.
 
bool TryStartLocationService ()
 Try to start Location Service.
 
void UpdatePosition ()
 Sets map position using GPS coordinates.
 
void UpdateSpeed ()
 Updates the speed data.
 

Public Attributes

Action< float > OnCompassChanged
 This event is called when the user rotates the device.
 
OnGetLocationDelegate OnGetLocation
 This event allows you to intercept receiving a GPS location.
 
Action OnFindLocationByIPComplete
 This event is called when the IP location are found.
 
Action< Vector2 > OnLocationChanged
 This event is called when changed your GPS location.
 
Action OnLocationInited
 This event is called when the GPS is initialized (the first value is received) or location by IP is found.
 
Action OnPositionRestored
 This event called after map position restored when timeout "Restore After" expires.
 
bool autoStopUpdateOnInput = true
 Update stop position when user input.
 
float compassThreshold = 8
 Threshold of compass.
 
bool createMarkerInUserPosition = false
 Specifies the need to create a marker that indicates the current GPS coordinates.
 
bool disableEmulatorInPublish = true
 Indicates whether to disable the emulator when used on the device.
 
float emulatorCompass
 Emulated compass trueHeading. Do not use this field. Use OnlineMapsLocationService.trueHeading instead.
 
Vector2 emulatorPosition
 Emulated GPS position. Do not use this field. Use OnlineMapsLocationService.position instead.
 
bool findLocationByIP = false
 Specifies whether to search for a location by IP.
 
bool lerpCompassValue = true
 Smooth rotation by compass. This helps to bypass the jitter.
 
float markerScale = 1
 Scale of the marker.
 
string markerTooltip
 Tooltip of the marker.
 
OnlineMapsLocationServiceMarkerType markerType = OnlineMapsLocationServiceMarkerType.twoD
 Type of the marker.
 
OnlineMapsAlign marker2DAlign = OnlineMapsAlign.Center
 Align of the 2D marker.
 
Texture2D marker2DTexture
 Texture of 2D marker.
 
GameObject marker3DPrefab
 Prefab of 3D marker.
 
OnlineMapsMarker3D.SizeType marker3DSizeType = OnlineMapsMarker3D.SizeType.scene
 Marker size type.
 
int maxPositionCount = 3
 The maximum number of stored positions.
It is used to calculate the speed.
 
Vector2 position = Vector2.zero
 Current GPS coordinates.
Important: position not available Start, because GPS is not already initialized.
Use OnLocationInited event, to determine the initialization of GPS.

 
int restoreAfter = 10
 Use the GPS coordinates after seconds of inactivity.
 
bool rotateCameraByCompass = false
 Rotates the camera through a compass. Requires OnlineMapsCameraOrbit component.
 
float trueHeading = 0
 The heading in degrees relative to the geographic North Pole.
Important: position not available Start, because compass is not already initialized.
Use OnCompassChanged event, to determine the initialization of compass.

 
bool updateEmulatorPositionByMarker = false
 Specifies the need to update the position of the emulator by marker position.
 
bool updatePosition = true
 Specifies whether the script will automatically update the location.
 
bool useCompassForMarker = false
 Specifies the need for marker rotation.
 
bool useGPSEmulator = false
 Specifies GPS emulator usage. Works only in Unity Editor.
 

Protected Member Functions

void GetLocationFromSensor (out float longitude, out float latitude)
 Returns the current GPS location from sensor.
 

Properties

static OnlineMapsLocationServiceBase baseInstance [get]
 Instance of LocationService base.
 
static OnlineMapsMarkerBase marker [get, set]
 Instance of marker.
 
bool allowUpdatePosition [get, set]
 Is it allowed to update the position.
 
float speed [get]
 Speed km/h. Note: in Unity Editor will always be zero.
 

Detailed Description

Controls map using Location Service (GPS and compass).

Member Function Documentation

◆ GetLocation()

void OnlineMapsLocationServiceBase.GetLocation ( out float longitude,
out float latitude )

Returns the current GPS location or emulator location.

Parameters
longitudeLongitude
latitudeLatitude

◆ GetLocationFromSensor()

void OnlineMapsLocationServiceBase.GetLocationFromSensor ( out float longitude,
out float latitude )
abstractprotected

Returns the current GPS location from sensor.

Parameters
longitudeLongitude
latitudeLatitude

◆ GetSavableItems()

OnlineMapsSavableItem[] OnlineMapsLocationServiceBase.GetSavableItems ( )

Returns an array of items to save.

Returns
Array of items to save

Implements IOnlineMapsSavableComponent.

◆ IsLocationServiceRunning()

bool OnlineMapsLocationServiceBase.IsLocationServiceRunning ( )
abstract

Checks that the Location Service is running.

Returns
True - location service is running, false - otherwise.

◆ TryStartLocationService()

bool OnlineMapsLocationServiceBase.TryStartLocationService ( )
abstract

Try to start Location Service.

Returns
True - success, false - otherwise.