Show:

ia.GoogleMap Class

Module: ia

Map defines the basic layout behavior of a google map.

Constructor

ia.GoogleMap

(
  • id
  • mapType
  • apiKey
  • minZoomLevel
  • maxZoomLevel
  • greyscaleText
  • offText
)

Parameters:

  • id String

    The id of the map.

  • mapType String

    The initial map type.

  • apiKey String

    The api key.

  • minZoomLevel Number

    The min zoom (smaller number).

  • maxZoomLevel Number

    The max zoom (larger number).

  • greyscaleText String

    Toolbar greyscale text.

  • offText String

    Toolbar off text.

Methods

addEventListener

(
  • eventType
  • fnc
  • obj
)

Add an event listener.

Parameters:

  • eventType String

    The type of event to listen for.

  • fnc Function

    The function to call when the event occurs.

  • obj Object

    An optional parent object.

addMapOverlay

(
  • map
)

Adds an IA map as a google overlay.

Parameters:

adjustBBox

(
  • bb
)

Adjusts the bounding box to fit the pixel space whilst maintaining its aspect ratio.

Parameters:

adjustY

(
  • bb
)

Adjusts the y coords to fit the pixel space whilst maintaining x coords.

Parameters:

centerOnFeature

(
  • featureId
)
Boolean

Centers a feature on the map.

Parameters:

  • featureId String

    The id of the feature.

Returns:

Boolean: true if the feature was found, otherwise false.

commitChanges

()

A call to commitChanges commits any changes made to canvasWidth, canvasHeight or bBox.

This function exists to allow properties to be changed without continuous updates to the object.

dispatchEvent

(
  • event
)

Dispatch an event to the listeners.

Parameters:

  • event Object

    The event object.

extra_zoom

(
  • b1
  • b2
  • The
)
private

LatLngBounds b1, b2 -> zoom increment.

Parameters:

  • b1 google.maps.LatLngBounds

    The first LatLngBounds.

  • b2 google.maps.LatLngBounds

    The second LatLngBounds.

  • The Number

    zoom increment.

getBBox

() ia.BoundingBox

Gets the bounding box.

Returns:

ia.BoundingBox: The bounding box.

getDataBBox

(
  • rect
)
ia.BoundingBox

Converts a rectangle (pixel units) to a bBox (data units).

Parameters:

Returns:

ia.BoundingBox: A bBox (data units).

getDataHeight

(
  • dimension
)
Number

Converts a height from pixel units to data units.

Parameters:

  • dimension Number

    A height (pixel units).

Returns:

Number: A height (data units).

getDataPoint

(
  • p
)
ia.Point

Converts a point from pixel units to data units.

Parameters:

Returns:

ia.Point: A point (data units).

getDataWidth

(
  • dimension
)
Number

Converts a width from pixel units to data units.

Parameters:

  • dimension Number

    A width (pixel units).

Returns:

Number: A width (data units).

getDataX

(
  • x
)
Number

Converts an x-coord from pixel units to data units.

Parameters:

  • x Number

    An x-coord (pixel units).

Returns:

Number: An x-coord (data units).

getDataY

(
  • y
)
Number

Converts a y-coord from pixel units to data units.

Parameters:

  • y Number

    A y-coord (pixel units).

Returns:

Number: A y-coord (data units).

getPixelHeight

(
  • y
)
Number

Converts a height from data units to pixel units.

Parameters:

  • y Number

    A height (data units).

Returns:

Number: A height (pixel units).

getPixelPoint

(
  • p
)
ia.Point

Converts a point from data units to pixel units.

Parameters:

Returns:

ia.Point: A point (pixel units).

getPixelRect

(
  • bb
)
ia.Rectangle

Converts a bounding box (data units) to a rectangle (pixel units).

Parameters:

Returns:

ia.Rectangle: A rectangle (pixel units).

getPixelWidth

(
  • x
)
Number

Converts a width from data units to pixel units.

Parameters:

  • x Number

    A width (data units).

Returns:

Number: A width (pixel units).

getPixelX

(
  • x
)
Number

Converts an x-coord from data units to pixel units.

Parameters:

  • x Number

    An x-coord (data units).

Returns:

Number: An x-coord (pixel units).

getPixelY

(
  • y
)
Number

Converts a y-coord from data units to pixel units.

Parameters:

  • y Number

    A y-coord (data units).

Returns:

Number: A y-coord (pixel units).

hwpx

(
  • bnds
  • A
)
private

LatLngBounds bnds -> height and width as a Point

Parameters:

  • bnds google.maps.LatLngBounds

    LatLngBounds.

  • A google.maps.Point

    google point.

init

() private

Initialises.

mapWrapped

() Boolean private

Checks if the IA map fits inside the google map.

Returns:

Boolean: True if it fits, otherwise false.

onIAMAPResize

() private

Called when the IA map resizes.

removeListener

(
  • obj
)

Removes all event listeners for the given object.

Parameters:

  • obj Object

    The object.

setBBox

(
  • bBox
)

Inherited from ia.CartesianSpace but overwritten in ia\maps\GoogleMap.js:477

Sets the bounding box.

Parameters:

setMapType

(
  • mapType
)

Sets the map type.

Parameters:

  • mapType String

    The mapType.

updateBBox

() private

Updates the bounding box after the bounds of the google map have changed.

updateIAMap

() private

Updates the IA map.

zoomToFeature

(
  • featureId
)
Boolean

Zooms to a feature in the map.

Parameters:

  • featureId String

    The id of the feature.

Returns:

Boolean: true if the feature was found, otherwise false.

zoomToFeatures

(
  • featureIds
  • optLayers
)

Zooms to a set of features in the map.

Parameters:

  • featureIds String

    A list of feature ids.

  • optLayers ia.LayerBase[]

    An optional list of layers to check.

zoomToFeatureWithId

(
  • featureId
  • optLayers
)
Boolean

Zooms to a feature in the map.

Parameters:

  • featureId String

    The id of the feature.

  • optLayers ia.LayerBase[]

    An optional list of layers to check.

Returns:

Boolean: true if the feature was found, otherwise false.

zoomToFeatureWithName

(
  • featureName
  • optLayers
)
Boolean

Zooms to a feature in the map with the given name.

Parameters:

  • featureName String

    The name of the feature.

  • optLayers ia.LayerBase[]

    An optional list of layers to check.

Returns:

Boolean: true if the feature was found, otherwise false.

Properties

apiKey

String

The google api key.

canvasHeight

Number

The pixel height.

Default: 0

canvasWidth

Number

The pixel width.

Default: 0

canvasX

Number

The pixel x-position.

Default: 0

canvasY

Number

The pixel y-position.

Default: 0

container

JQUERY Element

The container that holds the object.

defaultBounds

ia.BoundingBox

The map bounds - equivalent of defaultBBox.

gMap

google.maps.Map

The google map object.

id

String

The id.

maintainAspectRatio

Boolean

The data space will often be a different shape to the pixel space it has to fill.

If set to true the data space is adjusted to maintain the aspect ratio.

If set to false the data space stretches to fit the pixel space. This will generally result in the aspect ratio changing (a stretching effect).

Default: false

maxZoom

Number

The maximum extent.

Default: -1

minZoom

Number

The minimum extent.

Default: -1