HERE Android SDK Developer's Guide

GeoPolyline

The class GeoPolyline is a member of com.here.android.mpa.common .

Class Summary

public class GeoPolyline

extends java.lang.Object

Interface representing a GeoPolyline .

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in GeoPolyline
Constructors

GeoPolyline ()

Public Constructor

GeoPolyline (java.util.List <GeoCoordinate> points)

Creates a GeoPolyline from a list of points.

Method Summary

Table 2. Methods in GeoPolyline
Methods

public void add (java.util.List <GeoCoordinate> points)

Add a list of new points into the GeoPolyline

public void add (GeoCoordinate point)

Add a new point into the GeoPolyline

public void clear ()

Remove all points from the GeoPolyline

public boolean contains (GeoCoordinate point)

Check to see if a GeoCoordinate resides within this GeoPolyline

public boolean equals (Object other)

For documentation, see java.lang.Object

public GeoBoundingBox getBoundingBox ()

Get the geographic bounding box that contains this GeoPolyline .

public GeoCoordinate getNearest (GeoCoordinate point)

Gets the GeoCoordinate along the path of the MapPolyline that is closest to the specified GeoCoordinate .

public int getNearestIndex (GeoCoordinate point)

Gets the index in the path array that is closest to the specified GeoCoordinate .

public int getNumberOfPoints ()

Get the total number of points currently in the GeoPolyline .

public GeoCoordinate getPoint (int index)

Get a point in the GeoPolyline .

public int hashCode ()

For documentation, see java.lang.Object

public void insert (GeoCoordinate point, int index)

Insert a point into the GeoPolyline at index

public double length ()

The geographical length of this GeoPolyline .

public void remove (int index)

Remove a specific point from the GeoPolyline

Class Details

Interface representing a GeoPolyline . A GeoPolyline consists of 2 or more points. This class can be used with MapPolyline to render a polyline.

Constructor Details

GeoPolyline ()

Public Constructor

GeoPolyline (java.util.List <GeoCoordinate> points)

Creates a GeoPolyline from a list of points.

Parameters:

  • points

    A list of points to form the GeoPolyline

See also:

MapPolyline

Method Details

public void add (java.util.List <GeoCoordinate> points)

Add a list of new points into the GeoPolyline

Parameters:

  • points

    A list of {code GeoCoordinate}s to be added

public void add (GeoCoordinate point)

Add a new point into the GeoPolyline

Parameters:

  • point

    Point to be added

public void clear ()

Remove all points from the GeoPolyline

public boolean contains (GeoCoordinate point)

Check to see if a GeoCoordinate resides within this GeoPolyline

Parameters:

  • point

    The coordinate that will be used to match against the points in this GeoPolyline

Returns:

boolean true if the point is in this GeoPolyline

public boolean equals (Object other)

For documentation, see java.lang.Object

Parameters:

  • other

public GeoBoundingBox getBoundingBox ()

Get the geographic bounding box that contains this GeoPolyline .

Returns:

GeoBoundingBox that contains this GeoPolyline. Can be null if the line has fewer than 2 points.

public GeoCoordinate getNearest (GeoCoordinate point)

Gets the GeoCoordinate along the path of the MapPolyline that is closest to the specified GeoCoordinate .

Parameters:

  • point

    A GeoCoordinate reference point for finding the nearest GeoCoordinate along the MapPolyline path

Returns:

The GeoCoordinate along the MapPolyline path that is closest to the specified GeoCoordinate

See also:

getNearestIndex(GeoCoordinate)

public int getNearestIndex (GeoCoordinate point)

Gets the index in the path array that is closest to the specified GeoCoordinate .

Parameters:

  • point

    A GeoCoordinate reference point for finding the nearest index in the path array

Returns:

The index of the path array that is closest to the specified GeoCoordinate

See also:

getNearest(GeoCoordinate)

public int getNumberOfPoints ()

Get the total number of points currently in the GeoPolyline .

Returns:

int total number of points

public GeoCoordinate getPoint (int index)

Get a point in the GeoPolyline .

Parameters:

  • index

    index of the point to get.

Returns:

GeoCoordinate. Returns null if the index is out of bound.

public int hashCode ()

For documentation, see java.lang.Object

public void insert (GeoCoordinate point, int index)

Insert a point into the GeoPolyline at index

Parameters:

  • point

    Point to be added

  • index

    Index to add the point into the list. index must be within the bounds of 0 and current count of points.

public double length ()

The geographical length of this GeoPolyline .

Returns:

double length in meters.

public void remove (int index)

Remove a specific point from the GeoPolyline

Parameters:

  • index

    index of the point to be removed.