cadetill's blog | Copyright © Xavier Martínez (cadetill)

# Class TGMLatLngBounds

Description
Hierarchy
Fields
Methods
Properties

## Unit

GMLib.LatLngBounds

## Declaration

`type TGMLatLngBounds = class(TGMPersistentStr, IGMControlChanges)`

## Description

A TGMLatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian.

More information at google.maps.LatLngBounds class

## Hierarchy

- TObject
- TPersistent
- TInterfacedPersistent
- TGMInterfacedOwnedPersistent
- TGMPersistent
- TGMPersistentStr
- TGMLatLngBounds

## Overview

### Methods

| `constructor Create(SW, NE: TGMLatLng; Lang: TGMLang = lnEnglish); reintroduce; overload; virtual;`
| `constructor Create(AOwner: TPersistent; SWLat: Real = 0; SWLng: Real = 0; NELat: Real = 0; NELng: Real = 0); reintroduce; overload; virtual;`
| `constructor Create(AOwner: TPersistent; SW, NE: TGMLatLng); reintroduce; overload; virtual;`
| `constructor Create(SWLat: Real = 0; SWLng: Real = 0; NELat: Real = 0; NELng: Real = 0; Lang: TGMLang = lnEnglish); reintroduce; overload; virtual;`
| `destructor Destroy; override;`
| `function Contains(LatLng: TGMLatLng): Boolean;`
| `function GetCenter: TGMLatLng;`
| `function Intersects(Other: TGMLatLngBounds): Boolean;`
| `function IsEmpty: Boolean;`
| `function IsEqual(Other: TGMLatLngBounds): Boolean;`
| `function PropToString: string; override;`
| `function ToJson(Precision: Integer = 6): string;`
| `function ToSpan: TGMLatLng;`
| `function ToStr(Precision: Integer = 6): string;`
| `function ToUrlValue(Precision: Integer = 6): string;`
| `function GetOwnerLang: TGMLang; override;`
| `procedure Assign(Source: TPersistent); override;`
| `procedure Extend(LatLng: TGMLatLng);`
| `procedure Union(Other: TGMLatLngBounds);`
| `procedure PropertyChanged(Prop: TPersistent; PropName: string);`

### Properties

| `property APIUrl;`
| `property NE: TGMLatLng read FNE write FNE;`
| `property SW: TGMLatLng read FSW write FSW;`

## Description

### Methods

| `constructor Create(SW, NE: TGMLatLng; Lang: TGMLang = lnEnglish); reintroduce; overload; virtual;`
Constructor class. ###### Parameters SW South-west corner. NE North-east corner. Lang TGMLang to use in exceptions.

| `constructor Create(AOwner: TPersistent; SWLat: Real = 0; SWLng: Real = 0; NELat: Real = 0; NELng: Real = 0); reintroduce; overload; virtual;`
Constructor class. ###### Parameters AOwner Object owner. SWLat South-west latitude. Default 0. SWLng South-west longitude. Default 0. NELat North-east latitude. Default 0. NELng North-east longitude. Default 0.

| `constructor Create(AOwner: TPersistent; SW, NE: TGMLatLng); reintroduce; overload; virtual;`
Constructor class. ###### Parameters AOwner Object owner. SW South-west corner. NE North-east corner.

| `constructor Create(SWLat: Real = 0; SWLng: Real = 0; NELat: Real = 0; NELng: Real = 0; Lang: TGMLang = lnEnglish); reintroduce; overload; virtual;`
Constructor class. ###### Parameters SWLat South-west latitude. Default 0. SWLng South-west longitude. Default 0. NELat North-east latitude. Default 0. NELng North-east longitude. Default 0. Lang TGMLang to use in exceptions.

| `destructor Destroy; override;`
Destructor class.

| `function Contains(LatLng: TGMLatLng): Boolean;`
Returns `True` if the given TGMLatLng is in the bounds. ###### Parameters LatLng TGMLatLng to check. ###### Returns `True` if the given TGMLatLng is in the bounds, otherwise `False`. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMUnassignedObject This exception is raised if LanLng param is unassigned. EGMMapIsNull This exception is raised if Map object in JavaScript is null.

| `function GetCenter: TGMLatLng;`
Get the center of current bounds. ###### Parameters LatLng TGMLatLng representing the centre. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMJSError This exception is raised if an error occurred executing JavaScript function.

| `function Intersects(Other: TGMLatLngBounds): Boolean;`
Returns `True` if this bounds shares any points with this bounds. ###### Parameters Other Bounds to compare. ###### Returns `True` if shares, otherwise `False`. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMJSError This exception is raised if an error occurred executing JavaScript function. EGMUnassignedObject This exception is raised if LanLng param is unassigned.

| `function IsEmpty: Boolean;`
Returns `True` if the bounds is empty. ###### Returns `True` if empty, otherwise `False`.

| `function IsEqual(Other: TGMLatLngBounds): Boolean;`
Returns `True` if this bounds is equals the given bounds. Two bounds are equals if his coordinates NE and SW are equals. ###### Parameters Other Bounds to compare. ###### Returns `True` if equals, otherwise `False`.

| `function PropToString: string; override;`
Converts all class properties values to a string separated by comma used to send values to a JavaScript function. ###### Returns string with all properties.

| `function ToJson(Precision: Integer = 6): string;`
Convert bounds to Json representation. ###### Parameters Precision Precision of values. Default 6. ###### Returns Json with the bounds.

| `function ToSpan: TGMLatLng;`
Converts the given bounds to a lat/lng span. ###### Parameters LatLng TGMLatLng with the span. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMJSError This exception is raised if an error occurred executing JavaScript function.

| `function ToStr(Precision: Integer = 6): string;`
Convert bounds to string representation. ###### Parameters Precision Precision of values. Default 6. ###### Returns String with the bounds.

| `function ToUrlValue(Precision: Integer = 6): string;`
Returns a string with format `"lat_lo,lng_lo,lat_hi,lng_hi"` for this bounds, where "lo" corresponds to the southwest corner of the bounding box and "hi" corresponds to the northeast corner of that box. ###### Parameters Precision Precision of values. Default 6. ###### Returns Formatted string.

| `function GetOwnerLang: TGMLang; override;`
Returns the TGMLang of the Owner. If Owner is not assigned or not supports IGMOwnerLang interface then should be returned `lnEnglish`. ###### Returns TGMLang of the owner object.

| `procedure Assign(Source: TPersistent); override;`
Call `Assign` to copy the properties or other attributes form an object to another. The standard form of a call to `Assign` method is `Destination.Assign(Source);` which tells the `Destination` object to copy the contents of the `Source` object to itself. ###### Parameters Source Object to copy the content.

| `procedure Extend(LatLng: TGMLatLng);`
Extends the bounds to contain the given point. ###### Parameters LatLng TGMLatLng to contain. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMJSError This exception is raised if an error occurred executing JavaScript function. EGMUnassignedObject This exception is raised if LanLng param is unassigned.

| `procedure Union(Other: TGMLatLngBounds);`
Extends this bounds to contain the union of this and the given bounds. ###### Parameters Other TGMLatLngBounds to union. ###### Exceptions raised EGMWithoutOwner This exception is raised if the object don't have a owner. EGMOwnerWithoutJS This exception is raised if the owner can't execute JavaScript functions. EGMJSError This exception is raised if an error occurred executing JavaScript function. EGMUnassignedObject This exception is raised if LanLng param is unassigned.

| `procedure PropertyChanged(Prop: TPersistent; PropName: string);`
Method to call into the owner object when changes a property into the current object. ###### Parameters Prop Object property that has changed. PropName Name of the property that has changed.

### Properties

| `property APIUrl;`
URL to Google Maps API page.

| `property NE: TGMLatLng read FNE write FNE;`
North-east coordinates.

| `property SW: TGMLatLng read FSW write FSW;`
South-west coordinates.

Generated by PasDoc 0.15.0.