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

Helper class, which contains all the basic methods. More...

Static Public Member Functions

static float Angle2D (Vector2 point1, Vector2 point2)
 The angle between the two points in degree.
 
static float Angle2D (Vector3 point1, Vector3 point2)
 The angle between the two points in degree.
 
static double Angle2D (double p1x, double p1y, double p2x, double p2y)
 The angle between the two points in degree.
 
static float Angle2D (Vector3 point1, Vector3 point2, Vector3 point3, bool unsigned=true)
 The angle between the three points in degree.
 
static float Angle2DRad (Vector3 point1, Vector3 point2, float offset=0)
 The angle between the two points in radians.
 
static float Angle2DRad (float p1x, float p1z, float p2x, float p2z, float offset=0)
 The angle between the two points in radians.
 
static float AngleOfTriangle (Vector2 A, Vector2 B, Vector2 C)
 Calculates the angle of a triangle in radians.
 
static double Clip (double n, double minValue, double maxValue)
 Clamps a value between a minimum double and maximum double value.
 
static Vector2 Crossing (Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
 Calculates the point of intersection between two line segments defined by the given Vector2 objects.
 
static T DeepCopy< T > (object obj)
 Deep copy object.
 
static object DeepCopy (object obj, Type targetType)
 Deep copy object.
 
static List< Vector2 > DecodePolylinePoints (string encodedPoints)
 Converts Polyline to point list.
 
static List< OnlineMapsVector2dDecodePolylinePointsD (string encodedPoints)
 Converts Polyline to point list.
 
static void Destroy (Object obj)
 Removes a gameobject, component or asset.
 
static Vector2 DistanceBetweenPoints (Vector2 point1, Vector2 point2)
 The distance between two geographical coordinates.
 
static void DistanceBetweenPoints (double x1, double y1, double x2, double y2, out double dx, out double dy)
 The distance between two geographical coordinates.
 
static double DistanceBetweenPoints (double x1, double y1, double a1, double x2, double y2, double a2)
 The distance between two geographical coordinates with altitude.
 
static double DistanceBetweenPoints (IEnumerable points, out double dx, out double dy)
 The distance between geographical coordinates.
 
static double DistanceBetweenPointsD (Vector2 point1, Vector2 point2)
 The distance between two geographical coordinates.
 
static double Dot (double lx, double ly, double rx, double ry)
 Calculates the dot product of two 2D vectors given their x and y components.
 
static T FindObjectOfType< T > ()
 Returns the first active loaded object of Type type.
 
static Vector2 FixAngle (Vector2 v)
 Fix geographic coordinates.
 
static void FlipNegative (ref Rect r)
 Flip the negative dimensions of the rect.
 
static void GetCenterPointAndZoom (OnlineMapsMarkerBase[] markers, out Vector2 center, out int zoom, Vector2 inset=default(Vector2))
 Get the center point and best zoom for the array of markers.
 
static void GetCenterPointAndZoom (Vector2[] positions, out Vector2 center, out int zoom, Vector2 inset=default(Vector2))
 Get the center point and best zoom for the array of coordinates.
 
static void GetCoordinateInDistance (double lng, double lat, float distance, float angle, out double nlng, out double nlat)
 Given a start point, angle and distance, this will calculate the destination point travelling along a (shortest distance) great circle arc.
 
static Vector2 GetIntersectionPointOfTwoLines (Vector2 p11, Vector2 p12, Vector2 p21, Vector2 p22, out int state)
 Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.
 
static int GetIntersectionPointOfTwoLines (float p11x, float p11y, float p12x, float p12y, float p21x, float p21y, float p22x, float p22y, out float resultx, out float resulty)
 Calculates the intersection point of two 2D lines defined by four coordinates, and returns a value indicating the state of the calculation.
 
static Vector2 GetIntersectionPointOfTwoLines (Vector3 p11, Vector3 p12, Vector3 p21, Vector3 p22, out int state)
 Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.
 
static Object GetObject (int tid)
 Gets the object with the specified instance ID.
 
static void GetValuesFromEnum (StringBuilder builder, string key, Type type, int value)
 Appends to a StringBuilder the names of the enumeration flags that are set in the given integer value.
 
static Color HexToColor (string hex)
 Converts HEX string to color.
 
static bool Intersect (Rect a, Rect b)
 Determines whether two rectangles intersect.
 
static bool LineIntersection (Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2, out Vector2 out_intersection)
 Determines if two line segments intersect and returns the intersection point.
 
static bool LineIntersection (float s1x, float s1y, float e1x, float e1y, float s2x, float s2y, float e2x, float e2y, out float intX, out float intY)
 Determines if two line segments intersect and returns the intersection point.
 
static bool IsPointInPolygon (List< Vector2 > poly, float x, float y)
 Determines whether a point with the given coordinates is inside the specified polygon.
 
static bool IsPointInPolygon (IEnumerable poly, double x, double y)
 Determines whether a point with the given coordinates is inside the specified polygon.
 
static bool IsPointInPolygon (double[] poly, double x, double y)
 Determines whether a point with the given coordinates is inside the specified polygon.
 
static Vector2 LatLongToMercat (float x, float y)
 Converts geographic coordinates to Mercator coordinates.
 
static void LatLongToMercat (ref float x, ref float y)
 Converts geographic coordinates to Mercator coordinates.
 
static void LatLongToMercat (ref double x, ref double y)
 Converts geographic coordinates to Mercator coordinates.
 
static double Magnitude (double p1x, double p1y, double p2x, double p2y)
 Returns the length of vector.
 
static Vector2 NearestPointStrict (Vector2 point, Vector2 lineStart, Vector2 lineEnd)
 Returns the nearest point on the segment.
 
static void NearestPointStrict (double pointX, double pointY, double lineStartX, double lineStartY, double lineEndX, double lineEndY, out double nearestPointX, out double nearestPointY)
 Returns the nearest point on the segment.
 
static double Repeat (double n, double minValue, double maxValue)
 Loops the value n, so that it is never larger than maxValue and never smaller than minValue.
 
static double SqrMagnitude (double p1x, double p1y, double p2x, double p2y)
 Returns the square of the magnitude of the segment.
 
static string StrReplace (string str, string[] origin, string[] replace)
 Replaces multiple values in a string.
 
static void ThreadSleep (int millisecondsTimeout)
 The current thread sleeps for the specified number of milliseconds.
 
static string TileToQuadKey (int x, int y, int zoom)
 Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx.
 
static StringBuilder TileToQuadKey (int x, int y, int zoom, StringBuilder quadKey)
 Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx.
 
static List< int > Triangulate (List< Vector2 > points)
 Triangulates list of points.
 
static IEnumerable< int > Triangulate (float[] points, int countVertices, List< int > indices)
 Triangulates points.
 

Static Public Attributes

static string persistentDataPath
 The path to the persistent data.
 
const float angleSecond = 1 / 3600f
 Arcseconds in meters.
 
const int maxRaycastDistance = 100000
 Maximal distance of raycast.
 
const double R = 6371
 Earth radius.
 
const double Deg2Rad = Math.PI / 180
 Degrees-to-radians conversion constant.
 
const double Rad2Deg = 180 / Math.PI
 Radians-to-degrees conversion constant.
 
const int mb = 1024 * 1024
 Bytes per megabyte.
 
const float pi4 = 4 * Mathf.PI
 PI * 4.
 
const short tileSize = 256
 Size of the tile texture in pixels.
 
const long second = 10000000
 The second in ticks.
 
const int sqrTileSize = tileSize * tileSize
 tileSize squared, to accelerate the calculations.
 

Properties

static CultureInfo cultureInfo [get]
 Gets the CultureInfo object that is culture-independent (invariant).
 
static NumberFormatInfo numberFormat [get]
 Gets the NumberFormatInfo object that is culture-independent (invariant).
 

Detailed Description

Helper class, which contains all the basic methods.

Member Function Documentation

◆ Angle2D() [1/4]

static double OnlineMapsUtils.Angle2D ( double p1x,
double p1y,
double p2x,
double p2y )
static

The angle between the two points in degree.

Parameters
p1xPoint 1 X
p1yPoint 1 Y
p2xPoint 2 X
p2yPoint 2 Y
Returns
Angle in degree

◆ Angle2D() [2/4]

static float OnlineMapsUtils.Angle2D ( Vector2 point1,
Vector2 point2 )
static

The angle between the two points in degree.

Parameters
point1Point 1
point2Point 2
Returns
Angle in degree

◆ Angle2D() [3/4]

static float OnlineMapsUtils.Angle2D ( Vector3 point1,
Vector3 point2 )
static

The angle between the two points in degree.

Parameters
point1Point 1
point2Point 2
Returns
Angle in degree

◆ Angle2D() [4/4]

static float OnlineMapsUtils.Angle2D ( Vector3 point1,
Vector3 point2,
Vector3 point3,
bool unsigned = true )
static

The angle between the three points in degree.

Parameters
point1Point 1
point2Point 2
point3Point 3
unsignedReturn a positive result.
Returns
Angle in degree

◆ Angle2DRad() [1/2]

static float OnlineMapsUtils.Angle2DRad ( float p1x,
float p1z,
float p2x,
float p2z,
float offset = 0 )
static

The angle between the two points in radians.

Parameters
p1xPoint 1 X
p1zPoint 1 Z
p2xPoint 2 X
p2zPoint 2 Z
offsetResult offset in degrees.
Returns
Angle in radians

◆ Angle2DRad() [2/2]

static float OnlineMapsUtils.Angle2DRad ( Vector3 point1,
Vector3 point2,
float offset = 0 )
static

The angle between the two points in radians.

Parameters
point1Point 1
point2Point 2
offsetResult offset in degrees.
Returns
Angle in radians

◆ AngleOfTriangle()

static float OnlineMapsUtils.AngleOfTriangle ( Vector2 A,
Vector2 B,
Vector2 C )
static

Calculates the angle of a triangle in radians.

Parameters
APoint A
BPoint B
CPoint C
Returns
Angle in radians

◆ Clip()

static double OnlineMapsUtils.Clip ( double n,
double minValue,
double maxValue )
static

Clamps a value between a minimum double and maximum double value.

Parameters
nValue
minValueMinimum
maxValueMaximum
Returns
Value between a minimum and maximum.

◆ Crossing()

static Vector2 OnlineMapsUtils.Crossing ( Vector2 p1,
Vector2 p2,
Vector2 p3,
Vector2 p4 )
static

Calculates the point of intersection between two line segments defined by the given Vector2 objects.

Parameters
p1The first endpoint of the first line segment.
p2The second endpoint of the first line segment.
p3The first endpoint of the second line segment.
p4The second endpoint of the second line segment.
Returns
The point of intersection between the two line segments, or Vector2.zero if they do not intersect.

◆ DecodePolylinePoints()

static List< Vector2 > OnlineMapsUtils.DecodePolylinePoints ( string encodedPoints)
static

Converts Polyline to point list.

Parameters
encodedPointsThe encoded polyline.
Returns
A List of Vector2 points;

◆ DecodePolylinePointsD()

static List< OnlineMapsVector2d > OnlineMapsUtils.DecodePolylinePointsD ( string encodedPoints)
static

Converts Polyline to point list.

Parameters
encodedPointsThe encoded polyline.
Returns
A List of Vector2 points;

◆ DeepCopy()

static object OnlineMapsUtils.DeepCopy ( object obj,
Type targetType )
static

Deep copy object.

Parameters
objObject to copy
targetTypeType of target object
Returns
Copy of object
Exceptions
ArgumentExceptionIf the object is not serializable.

◆ DeepCopy< T >()

static T OnlineMapsUtils.DeepCopy< T > ( object obj)
static

Deep copy object.

Parameters
objObject to copy
Template Parameters
TType of target object
Returns
Copy of object

◆ Destroy()

static void OnlineMapsUtils.Destroy ( Object obj)
static

Removes a gameobject, component or asset.

Parameters
objThe object to destroy.

◆ DistanceBetweenPoints() [1/4]

static double OnlineMapsUtils.DistanceBetweenPoints ( double x1,
double y1,
double a1,
double x2,
double y2,
double a2 )
static

The distance between two geographical coordinates with altitude.

Parameters
x1Longitude 1
y1Latitude 1
a1Altitude 1 (km)
x2Longitude 2
y2Latitude 2
a2Altitude 2 (km)
Returns
Distance (km).

◆ DistanceBetweenPoints() [2/4]

static void OnlineMapsUtils.DistanceBetweenPoints ( double x1,
double y1,
double x2,
double y2,
out double dx,
out double dy )
static

The distance between two geographical coordinates.

Parameters
x1Longitude 1.
y1Latitude 1.
x2Longitude 2.
y2Latitude 2.
dxDistance longitude (km).
dyDistance latitude (km).

◆ DistanceBetweenPoints() [3/4]

static double OnlineMapsUtils.DistanceBetweenPoints ( IEnumerable points,
out double dx,
out double dy )
static

The distance between geographical coordinates.

Parameters
pointsIEnumerate of double, float, Vector2 or Vector3
dxDistance longitude (km).
dyDistance latitude (km).
Returns
Distance (km).

◆ DistanceBetweenPoints() [4/4]

static Vector2 OnlineMapsUtils.DistanceBetweenPoints ( Vector2 point1,
Vector2 point2 )
static

The distance between two geographical coordinates.

Parameters
point1Coordinate (X - Lng, Y - Lat)
point2Coordinate (X - Lng, Y - Lat)
Returns
Distance (km).

◆ DistanceBetweenPointsD()

static double OnlineMapsUtils.DistanceBetweenPointsD ( Vector2 point1,
Vector2 point2 )
static

The distance between two geographical coordinates.

Parameters
point1Coordinate (X - Lng, Y - Lat)
point2Coordinate (X - Lng, Y - Lat)
Returns
Distance (km).

◆ Dot()

static double OnlineMapsUtils.Dot ( double lx,
double ly,
double rx,
double ry )
static

Calculates the dot product of two 2D vectors given their x and y components.

Parameters
lxThe x-component of the first vector.
lyThe y-component of the first vector.
rxThe x-component of the second vector.
ryThe y-component of the second vector.
Returns
The dot product of the two vectors.

◆ FindObjectOfType< T >()

static T OnlineMapsUtils.FindObjectOfType< T > ( )
static

Returns the first active loaded object of Type type.

Template Parameters
TThe type of object to find.
Returns
The first active loaded object that matches the specified type. It returns null if no Object matches the type.
Type Constraints
T :Object 

◆ FixAngle()

static Vector2 OnlineMapsUtils.FixAngle ( Vector2 v)
static

Fix geographic coordinates.

Parameters
vCoordinates for fix.
Returns
Correct geographic coordinates.

◆ FlipNegative()

static void OnlineMapsUtils.FlipNegative ( ref Rect r)
static

Flip the negative dimensions of the rect.

Parameters
rRect.

◆ GetCenterPointAndZoom() [1/2]

static void OnlineMapsUtils.GetCenterPointAndZoom ( OnlineMapsMarkerBase[] markers,
out Vector2 center,
out int zoom,
Vector2 inset = default(Vector2) )
static

Get the center point and best zoom for the array of markers.

Parameters
markersArray of markers.
centerCenter point.
zoomBest zoom.
insetInset for finding a cropped zoom level.

◆ GetCenterPointAndZoom() [2/2]

static void OnlineMapsUtils.GetCenterPointAndZoom ( Vector2[] positions,
out Vector2 center,
out int zoom,
Vector2 inset = default(Vector2) )
static

Get the center point and best zoom for the array of coordinates.

Parameters
positionsArray of coordinates
centerCenter coordinate
zoomBest zoom
insetInset for finding a cropped zoom level.

◆ GetCoordinateInDistance()

static void OnlineMapsUtils.GetCoordinateInDistance ( double lng,
double lat,
float distance,
float angle,
out double nlng,
out double nlat )
static

Given a start point, angle and distance, this will calculate the destination point travelling along a (shortest distance) great circle arc.

Parameters
lngLongitude of start point
latLatitude of start point
distanceDistance (km)
angleAngle, clockwise from north (degree)
nlngLongitude of destination point
nlatLatitude of destination point

◆ GetIntersectionPointOfTwoLines() [1/3]

static int OnlineMapsUtils.GetIntersectionPointOfTwoLines ( float p11x,
float p11y,
float p12x,
float p12y,
float p21x,
float p21y,
float p22x,
float p22y,
out float resultx,
out float resulty )
static

Calculates the intersection point of two 2D lines defined by four coordinates, and returns a value indicating the state of the calculation.

Parameters
p11xThe x-coordinate of the first point on the first line.
p11yThe y-coordinate of the first point on the first line.
p12xThe x-coordinate of the second point on the first line.
p12yThe y-coordinate of the second point on the first line.
p21xThe x-coordinate of the first point on the second line.
p21yThe y-coordinate of the first point on the second line.
p22xThe x-coordinate of the second point on the second line.
p22yThe y-coordinate of the second point on the second line.
resultxAn output parameter that will contain the x-coordinate of the intersection point if the calculation is successful, otherwise zero.
resultyAn output parameter that will contain the y-coordinate of the intersection point if the calculation is successful, otherwise zero.
Returns
A value indicating the state of the calculation.

◆ GetIntersectionPointOfTwoLines() [2/3]

static Vector2 OnlineMapsUtils.GetIntersectionPointOfTwoLines ( Vector2 p11,
Vector2 p12,
Vector2 p21,
Vector2 p22,
out int state )
static

Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.

Parameters
p11The first point on the first line.
p12The second point on the first line.
p21The first point on the second line.
p22The second point on the second line.
stateThe state of the calculation.
Returns
The intersection point of the two lines if it exists, or a Vector2.zero if the lines do not intersect.

◆ GetIntersectionPointOfTwoLines() [3/3]

static Vector2 OnlineMapsUtils.GetIntersectionPointOfTwoLines ( Vector3 p11,
Vector3 p12,
Vector3 p21,
Vector3 p22,
out int state )
static

Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.

Parameters
p11The first point on the first line.
p12The second point on the first line.
p21The first point on the second line.
p22The second point on the second line.
stateThe state of the calculation.
Returns
The intersection point of the two lines if it exists, or a Vector2.zero if the lines do not intersect.

◆ GetObject()

static Object OnlineMapsUtils.GetObject ( int tid)
static

Gets the object with the specified instance ID.

Parameters
tidThe instance ID of the object.
Returns
The object with the specified instance ID.

◆ GetValuesFromEnum()

static void OnlineMapsUtils.GetValuesFromEnum ( StringBuilder builder,
string key,
Type type,
int value )
static

Appends to a StringBuilder the names of the enumeration flags that are set in the given integer value.

Parameters
builderThe StringBuilder to append to.
keyThe key to append to the StringBuilder before the enumeration value(s).
typeThe Type of the enumeration.
valueThe integer value representing the enumeration flags to check.

◆ HexToColor()

static Color OnlineMapsUtils.HexToColor ( string hex)
static

Converts HEX string to color.

Parameters
hexHEX string
Returns
Color

◆ Intersect()

static bool OnlineMapsUtils.Intersect ( Rect a,
Rect b )
static

Determines whether two rectangles intersect.

Parameters
aThe first rectangle.
bThe second rectangle.
Returns
True if the two rectangles intersect; otherwise, false.

◆ IsPointInPolygon() [1/3]

static bool OnlineMapsUtils.IsPointInPolygon ( double[] poly,
double x,
double y )
static

Determines whether a point with the given coordinates is inside the specified polygon.

Parameters
polyArray of vertices that define the polygon.
xThe x-coordinate of the point to check.
yThe y-coordinate of the point to check.
Returns
true if the point is inside the polygon; otherwise, false.

◆ IsPointInPolygon() [2/3]

static bool OnlineMapsUtils.IsPointInPolygon ( IEnumerable poly,
double x,
double y )
static

Determines whether a point with the given coordinates is inside the specified polygon.

Parameters
polyIEnumerable of vertices that define the polygon. Can be Vector2, float, double or OnlineMapsVector2d.
xThe x-coordinate of the point to check.
yThe y-coordinate of the point to check.
Returns
true if the point is inside the polygon; otherwise, false.

◆ IsPointInPolygon() [3/3]

static bool OnlineMapsUtils.IsPointInPolygon ( List< Vector2 > poly,
float x,
float y )
static

Determines whether a point with the given coordinates is inside the specified polygon.

Parameters
polyThe list of vertices that define the polygon.
xThe x-coordinate of the point to check.
yThe y-coordinate of the point to check.
Returns
true if the point is inside the polygon; otherwise, false.

◆ LatLongToMercat() [1/3]

static Vector2 OnlineMapsUtils.LatLongToMercat ( float x,
float y )
static

Converts geographic coordinates to Mercator coordinates.

Parameters
xLongitude
yLatitude
Returns
Mercator coordinates

◆ LatLongToMercat() [2/3]

static void OnlineMapsUtils.LatLongToMercat ( ref double x,
ref double y )
static

Converts geographic coordinates to Mercator coordinates.

Parameters
xLongitude
yLatitude

◆ LatLongToMercat() [3/3]

static void OnlineMapsUtils.LatLongToMercat ( ref float x,
ref float y )
static

Converts geographic coordinates to Mercator coordinates.

Parameters
xLongitude
yLatitude

◆ LineIntersection() [1/2]

static bool OnlineMapsUtils.LineIntersection ( float s1x,
float s1y,
float e1x,
float e1y,
float s2x,
float s2y,
float e2x,
float e2y,
out float intX,
out float intY )
static

Determines if two line segments intersect and returns the intersection point.

Parameters
s1xThe x-coordinate of the starting point of the first line segment.
s1yThe y-coordinate of the starting point of the first line segment.
e1xThe x-coordinate of the ending point of the first line segment.
e1yThe y-coordinate of the ending point of the first line segment.
s2xThe x-coordinate of the starting point of the second line segment.
s2yThe y-coordinate of the starting point of the second line segment.
e2xThe x-coordinate of the ending point of the second line segment.
e2yThe y-coordinate of the ending point of the second line segment.
intXThe x-coordinate of the intersection point if the line segments intersect, otherwise 0.
intYThe y-coordinate of the intersection point if the line segments intersect, otherwise 0.
Returns
True if the line segments intersect, otherwise false.

summary> Returns the intersection point of two line segments, represented by their endpoints, or Vector2.zero if the segments do not intersect. /summary> param name="p1">The first endpoint of the first line segment

param name="p2">The second endpoint of the first line segment

param name="p3">The first endpoint of the second line segment

param name="p4">The second endpoint of the second line segment

returns>The intersection point of the two line segments, or Vector2.zero if the segments do not intersect

◆ LineIntersection() [2/2]

static bool OnlineMapsUtils.LineIntersection ( Vector2 start1,
Vector2 end1,
Vector2 start2,
Vector2 end2,
out Vector2 out_intersection )
static

Determines if two line segments intersect and returns the intersection point.

Parameters
start1The starting point of the first line segment.
end1The ending point of the first line segment.
start2The starting point of the second line segment.
end2The ending point of the second line segment.
out_intersectionThe intersection point if the line segments intersect, otherwise Vector2.zero.
Returns
True if the line segments intersect, otherwise false.

◆ Magnitude()

static double OnlineMapsUtils.Magnitude ( double p1x,
double p1y,
double p2x,
double p2y )
static

Returns the length of vector.

Parameters
p1xPoint 1 X
p1yPoint 1 Y
p2xPoint 2 X
p2yPoint 2 Y
Returns
Length of vector

◆ NearestPointStrict() [1/2]

static void OnlineMapsUtils.NearestPointStrict ( double pointX,
double pointY,
double lineStartX,
double lineStartY,
double lineEndX,
double lineEndY,
out double nearestPointX,
out double nearestPointY )
static

Returns the nearest point on the segment.

Parameters
pointXPoint X
pointYPoint Y
lineStartXStart X of the segment
lineStartYStart Y of the segment
lineEndXEnd X of the segment
lineEndYEnd Y of the segment
nearestPointXNearest point X
nearestPointYNearest point Y

◆ NearestPointStrict() [2/2]

static Vector2 OnlineMapsUtils.NearestPointStrict ( Vector2 point,
Vector2 lineStart,
Vector2 lineEnd )
static

Returns the nearest point on the segment.

Parameters
pointPoint
lineStartStart of the segment
lineEndEnd of segment
Returns
Nearest point

◆ Repeat()

static double OnlineMapsUtils.Repeat ( double n,
double minValue,
double maxValue )
static

Loops the value n, so that it is never larger than maxValue and never smaller than minValue.

Parameters
nValue
minValueMinimum value
maxValueMaximum value
Returns
Looped value from minValue to maxValue.

◆ SqrMagnitude()

static double OnlineMapsUtils.SqrMagnitude ( double p1x,
double p1y,
double p2x,
double p2y )
static

Returns the square of the magnitude of the segment.

Parameters
p1xPoint 1 X
p1yPoint 1 Y
p2xPoint 2 X
p2yPoint 2 Y
Returns
Square of the magnitude

◆ StrReplace()

static string OnlineMapsUtils.StrReplace ( string str,
string[] origin,
string[] replace )
static

Replaces multiple values in a string.

Parameters
strInput string
originValues to be replaced
replaceValues to replace
Returns
String with replaced values

◆ ThreadSleep()

static void OnlineMapsUtils.ThreadSleep ( int millisecondsTimeout)
static

The current thread sleeps for the specified number of milliseconds.

Parameters
millisecondsTimeoutnumber of milliseconds

◆ TileToQuadKey() [1/2]

static string OnlineMapsUtils.TileToQuadKey ( int x,
int y,
int zoom )
static

Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx.

Parameters
xTile X
yTile Y
zoomZoom
Returns
Quadkey

◆ TileToQuadKey() [2/2]

static StringBuilder OnlineMapsUtils.TileToQuadKey ( int x,
int y,
int zoom,
StringBuilder quadKey )
static

Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx.

Parameters
xTile X
yTile Y
zoomTile Zoom
quadKeyStringBuilder where to write quadKey
Returns
quadKey StringBuilder

◆ Triangulate() [1/2]

static IEnumerable< int > OnlineMapsUtils.Triangulate ( float[] points,
int countVertices,
List< int > indices )
static

Triangulates points.

Parameters
pointsAn array of points containing the values [x, y, x, y...]
countVerticesNumber of vertices to be triangulated/param>
Parameters
indicesList where vertex indices will be written
Returns
Indices

◆ Triangulate() [2/2]

static List< int > OnlineMapsUtils.Triangulate ( List< Vector2 > points)
static

Triangulates list of points.

Parameters
pointsList of points
Returns
List of vertex numbers