Class point

A simple point class with x and y coordinates.

class

point

Index

Constructor methods

Methods

Functions

Constructor methods

constructor(x: number, y: number): point

Parameters

  • x: number
  • y: number

Returns

point

Methods

public clone(): point

Creates a deep copy of this point.

Returns

point

The new cloned point.

public convertToPoly(side: number, radius: number): polygon

Creates new n-sided polygon around this point.

Parameters

  • side: number
  • radius: number

    Distance to polygon points.

Returns

polygon

The generated polygon.

public createOffsetBy(dx: number, dy: number): point

Creates a point from this point offset by a given x and y distance.

Parameters

  • dx: number

    The x offset.

  • dy: number

    The y offset.

Returns

point

The offset point.

public distanceTo(pt: point): number

Computes distance between this point and a given point in projected map units.

Parameters

  • pt: point

    Point to which to compute distance.

Returns

number

Distance from this point to the given point in projected map units.

public equals(pt: point): boolean

Equality comparer between this point and a given reference point.

Parameters

  • pt: point

    Reference point.

Returns

boolean

Result of the equality test.

public getBounds(): envelope

Returns this point's bounding box.

Returns

envelope

The bounding box of the point as an envelope.

public getX(): number

Returns the x coordinate.

Returns

number

The x coordinate.

public getY(): number

Returns the y coordinate.

Returns

number

The y coordinate.

public toProps(): pointObject

Returns the x and y coordinates of this point as a pointObject.

Returns

pointObject

Representaton of this point as an pointObject.

public toString(): string

Gets the wkt representation of this point.

Returns

string

The well known text for this point.

Functions

distance(x1: number, y1: number, x2: number, y2: number): number

Computes the distance between two points in coordinate units.

Parameters

  • x1: number

    The x coordinate for the first point.

  • y1: number

    The y coordinate for the first point.

  • x2: number

    The x coordinate for the second point.

  • y2: number

    The y coordinate for the second point.

Returns

number

Distance in coordinate units.

midpoint(x1: number, y1: number, x2: number, y2: number): point

Computes the midpoint of two points.

Parameters

  • x1: number

    The x coordinate for the first point.

  • y1: number

    The y coordinate for the first point.

  • x2: number

    The x coordinate for the second point.

  • y2: number

    The y coordinate for the second point.

Returns

point

Midpoint point.