Google.Maps.Feature.Shape.Area

A geometric representation of a flat MapFeature. For example, a park.

Summary

Inheritance

Inherits from: Google.Maps.Feature.Shape.MapFeatureShape, IEquatable< Area >

Constructors and Destructors

Area(ICollection< Vector2 > vertices, ICollection< int > vertexBreaks, ICollection< int > triangles, int zOrder, bool recenter)
Constructs an area with no external edges. Included for backwards compatibility.
Area(ICollection< Vector2 > vertices, ICollection< int > vertexBreaks, ICollection< int > triangles, ICollection< bool > externalEdges, int zOrder, bool recenter)
The Area class constructor.

Public attributes

ExternalEdges
readonly bool[]
Contains whether each edge in the area is external to the feature. An external edge is one that borders another feature.
Triangles
readonly int[]
Triangles that make up an Area's polygon. A triangle is represented as a triplet of indices into the Area's Vertices array.
VertexBreaks
readonly int[]
Separates the Area's vertices into discrete intervals, each one that describes an individual polygon.
Vertices
readonly Vector2[]
Vertices that make up the Area's border. This is relative to the MapFeatureShape.Origin.
ZOrder
readonly int
The z-order of this area, as returned in the tile data from Factile.

Public functions

Equals(object obj)
override bool
Equals(Area other)
bool
Type specific equality method.
GenerateBoundaryEdges()
List< EdgeSequence >
Returns a list of lists of vertices, each inner list representing a contiguous edge run for this Area.
GenerateExternalBoundaryEdges()
List< EdgeSequence >
Returns a list of lists of vertices, each inner list representing a contiguous edge run for this Area. Only external boundary edges will be returned.
GetHashCode()
override int
IsEdgeExternal(int v1, int v2)
bool
Determines whether the edge between the verticies at index v1 and v2 is external to the polygon.
IsEmpty()
bool
Determines whether this Area is empty. An Area is empty if it doesn't contain a vertex, a vertex break, or triangle data.
RescaleCoordinates(float scale)
void
Rescale the coordinates of this Feature.Shape.Area, modifying vertices, origin and tile boundary crossing points.
ToString()
override string

Protected functions

CalculateLocalBoundingBox()
virtual override Bounds
Calculates and returns a local bounding box for all of the geometry represented by this object. The bounding box is located relative to the Shape's origin, which means that the center of it might not be at (0, 0) if the Origin is not at the center of all of the vertices.
TranslateGeometry(Vector2 offset)
virtual override void
Translates the geometry by the supplied offset. This does not change the position of the Origin.
Parameters
offset
An offset vector used for translation.

Public static functions

CombineAreas(Area[] areas, int zOrder, bool recenter)
Combines all the areas in the supplied array into a single area.
Empty()
Constructs an empty Area. That is, an Area that has no vertex, vertex break, or triangle information.

Classes

Google.Maps.Feature.Shape.Area.EdgeSequence

Represents a contiguous sequence of edges. Each vertex appears only once, unless this represents a closed loop (in which case the first and last verticies are identical). A sequence of n vertices represents n - 1 contiguous edges: [v0, v1], [v1, v2], ..., [v(n - 2), v(n - 1)].

Public attributes

ExternalEdges

readonly bool[] ExternalEdges

Contains whether each edge in the area is external to the feature. An external edge is one that borders another feature.

These external edges may be used for styling. For example, when drawing borders around regions, they should only be drawn on the external edges of the area.

Currently, this field is only supported for the AdministrativeArea1, Locality, and Sublocality feature types.

This array will always have the same number of elements as the Vertices array. For each vertex index i, the edge from vertex i to NextVertexInLoop[i] is external iff ExternalEdges[i] is true.

Triangles

readonly int[] Triangles

Triangles that make up an Area's polygon. A triangle is represented as a triplet of indices into the Area's Vertices array.

VertexBreaks

readonly int[] VertexBreaks

Separates the Area's vertices into discrete intervals, each one that describes an individual polygon.

Vertices

readonly Vector2[] Vertices

Vertices that make up the Area's border. This is relative to the MapFeatureShape.Origin.

ZOrder

readonly int ZOrder

The z-order of this area, as returned in the tile data from Factile.

Public functions

Area

 Area(
  ICollection< Vector2 > vertices,
  ICollection< int > vertexBreaks,
  ICollection< int > triangles,
  int zOrder,
  bool recenter
)

Constructs an area with no external edges. Included for backwards compatibility.

Details
Parameters
vertices
The vertices that make up the Area's border.
vertexBreaks
When you separate the Area's vertices into discrete intervals, each one describes an individual boundary loop of the area. You can use this to check whether an edge is external to the area. Each vertex break is an index into the vertices array, and indicates the start of a new loop. For example, if there are 10 vertices, and a break at vertex index five, then vertices 0-4 comprise one loop, and vertices 5-9 comprise another loop.
triangles
A collection of integer triples that make up the Area's triangles. Each integer is an index into the collection of vertices.
zOrder
The z-order of this Area. Defaults to zero.
recenter
Determines whether the newly created Area will have its coordinates modified to be relative to the center of its bounding box. See also, Recenter().

Area

 Area(
  ICollection< Vector2 > vertices,
  ICollection< int > vertexBreaks,
  ICollection< int > triangles,
  ICollection< bool > externalEdges,
  int zOrder,
  bool recenter
)

The Area class constructor.

Details
Parameters
vertices
The vertices that make up the Area's border.
vertexBreaks
When you separate the Area's vertices into discrete intervals, each one describes an individual boundary loop of the area. You can use this to check whether an edge is external to the area. Each vertex break is an index into the vertices array, and indicates the start of a new loop. For example, if there are 10 vertices, and a break at vertex index five, then vertices 0-4 comprise one loop, and vertices 5-9 comprise another loop.
triangles
A collection of integer triples that make up the Area's triangles. Each integer is an index into the collection of vertices.
externalEdges
Indicates which of the edges are external to the area and border another feature. This should be the same size as the vertices parameter.
zOrder
The z-order of this Area. Defaults to zero.
recenter
Determines whether the newly created Area will have its coordinates modified to be relative to the center of its bounding box. See also, Recenter().

Equals

override bool Equals(
  object obj
)

Equals

bool Equals(
  Area other
)

Type specific equality method.

GenerateBoundaryEdges

List< EdgeSequence > GenerateBoundaryEdges()

Returns a list of lists of vertices, each inner list representing a contiguous edge run for this Area.

The returned edge runs will form closed loops in anticlockwise winding order. This means that the outside of the Area is to the right of each edge.

Details
Returns
A List of connected edge sequences, each sequence represented by a list of vertices where each a list of n vertices represents n - 1 contiguous edges: [v0, v1], [v1, v2], ..., etc. The vertices are in world space.

GenerateExternalBoundaryEdges

List< EdgeSequence > GenerateExternalBoundaryEdges()

Returns a list of lists of vertices, each inner list representing a contiguous edge run for this Area. Only external boundary edges will be returned.

The returned edge runs will form closed loops in anticlockwise winding order. This means that the outside of the Area is to the right of each edge.

This method will return only the edges that are external to the map feature (that is, they border another feature). This makes this method good for adding borders to regions.

Details
Returns
A List of connected edge sequences, each sequence represented by a list of vertices where each a list of n vertices represents n - 1 contiguous edges: [v0, v1], [v1, v2], ..., etc. The vertices are in world space.

GetHashCode

override int GetHashCode()

IsEdgeExternal

bool IsEdgeExternal(
  int v1,
  int v2
)

Determines whether the edge between the verticies at index v1 and v2 is external to the polygon.

IsEmpty

bool IsEmpty()

Determines whether this Area is empty. An Area is empty if it doesn't contain a vertex, a vertex break, or triangle data.

RescaleCoordinates

void RescaleCoordinates(
  float scale
)

Rescale the coordinates of this Feature.Shape.Area, modifying vertices, origin and tile boundary crossing points.

Details
Parameters
scale
Scale factor.

ToString

override string ToString()

Protected functions

CalculateLocalBoundingBox

virtual override Bounds CalculateLocalBoundingBox()

Calculates and returns a local bounding box for all of the geometry represented by this object. The bounding box is located relative to the Shape's origin, which means that the center of it might not be at (0, 0) if the Origin is not at the center of all of the vertices.

TranslateGeometry

virtual override void TranslateGeometry(
  Vector2 offset
)

Translates the geometry by the supplied offset. This does not change the position of the Origin. Parameters

offset
An offset vector used for translation.

Public static functions

CombineAreas

Area CombineAreas(
  Area[] areas,
  int zOrder,
  bool recenter
)

Combines all the areas in the supplied array into a single area.

Concatenates the vertex lists and adjusted triangle and breaks lists where the indices in the latter two are adjusted for the new positions of their respective vertices in the combined vertex lists.

Details
Parameters
areas
The areas to combine.
zOrder
The zOrder for the new, combined area.
recenter
Returns
The combined area.

Empty

Area Empty()

Constructs an empty Area. That is, an Area that has no vertex, vertex break, or triangle information.