Show:

ia.Map Class

Extends ia.CanvasBase
Defined in: ia\maps\Map.js:1
Module: ia

ia.Map defines the basic layout behavior of map.

Constructor

ia.Map

(
  • id
)

Defined in ia\maps\Map.js:1

Parameters:

  • id String

    The id of the map.

Methods

_addListeners

() private

Adds the listeners.

_bBoxChangeHandler

(
  • event
)
private

Defined in ia\maps\Map.js:110

Renders the map on a bBox change.

Parameters:

_createCanvas

() HTML Canvas private

Creates a new canvas.

Returns:

HTML Canvas: The canvas.

_drawBBox

(
  • ctx
  • bb
  • s
)
private

Defined in ia\maps\Map.js:292

Draws a bounding box on the map.

Parameters:

  • ctx HTML Canvas Context

    The context to draw to.

  • bb ia.BoundingBox

    The bBox (data units).

  • s Object

    The style.

_drawBitmap

() private

Defined in ia\maps\Map.js:211

Draws the bitmap.

_drawRect

(
  • ctx
  • r
  • s
)
private

Defined in ia\maps\Map.js:273

Draws a rectangle on the canvas in pixel units.

Parameters:

  • ctx HTML Canvas Context

    The context to draw to.

  • r ia.Rectangle

    The rectangle (pixel units).

  • s Object

    The style.

_initBitmap

() private

Defined in ia\maps\Map.js:257

Initialises the bitmap.

_mouseEventHandler

(
  • event
)
private

Responsible for handling mouse events and then dispatching the relevant map event.

Parameters:

  • event MouseEvent

    Dispatched by the mouse.

_onMouseDown

(
  • event
)
private

Defined in ia\maps\Map.js:546

Handles mousedown events.

Parameters:

_onMouseDrag

(
  • event
)
private

Defined in ia\maps\Map.js:598

Handles mousedrag events.

Parameters:

_onMouseDragUp

(
  • event
)
private

Defined in ia\maps\Map.js:631

Handles mousedragup events.

Parameters:

_onMouseMove

(
  • event
)
private

Defined in ia\maps\Map.js:585

Handles mousemove events.

Parameters:

_onMouseOut

(
  • event
)
private

Defined in ia\maps\Map.js:533

Handles mouseout events.

Parameters:

_onMouseOver

(
  • event
)
private

Defined in ia\maps\Map.js:521

Handles mouseover events.

Parameters:

_onMouseUp

(
  • event
)
private

Defined in ia\maps\Map.js:571

Handles mouseup events.

Parameters:

_onMouseWheel

(
  • event
)
private

Defined in ia\maps\Map.js:761

Handles mousewheel events.

Parameters:

_onPinchDown

(
  • event
)
private

Defined in ia\maps\Map.js:670

Handles pinchdown events.

Parameters:

_onPinchMove

(
  • event
)
private

Defined in ia\maps\Map.js:693

Handles pinchmove events.

Parameters:

_onPinchUp

(
  • event
)
private

Defined in ia\maps\Map.js:741

Handles pinchup events.

Parameters:

_touchEventHandler

(
  • event
)
private

Responsible for handling touch events and then dispatching the relevant map event.

Parameters:

  • event TouchEvent

    Dispatched by the mouse.

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.

addLayer

(
  • layer
)

Adds a layer to the map.

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

Defined in ia\maps\Map.js:489

Centers a feature on the map.

Parameters:

  • featureId String

    The id of the feature.

Returns:

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

clear

()

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:590

Clears the canvas.

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.

endDrag

()

Ends a map drag.

exportData

(
  • txt
)

Exports as an image in a new page.

Parameters:

  • txt String

    Any text to go with image.

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).

getLayer

(
  • id
)
ia.LayerBase

Gets the map layer with the given id.

Parameters:

  • id String

    The layer id.

Returns:

ia.LayerBase: The layer, or undefined.

getLayers

() ia.LayerBase[]

Gets the map layers.

Returns:

ia.LayerBase[]: The layers in the map.

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).

hide

()

Hides the chart.

mouseCoords

() ia.Point

Returns the cursor position in data units.

Returns:

ia.Point: The cursor position (data units).

removeLayers

()

Removes all layers from the map.

removeListener

(
  • obj
)

Removes all event listeners for the given object.

Parameters:

  • obj Object

    The object.

render

()

Inherited from ia.CanvasBase but overwritten in ia\maps\Map.js:129

Clears and renders the map.

render

()

Defined in ia\maps\Map.js:189

Clears and renders the map.

setBBox

(
  • bBox
)

Sets the bounding box.

Parameters:

show

()

Shows the chart.

startDrag

()

Starts a map drag.

toggle

()

Toggles the chart visibility.

useNavigation

(
  • useNav
)

Defined in ia\maps\Map.js:71

Indicates whether to use navigation.

Parameters:

  • useNav Boolean

    True or false.

zoomToFeature

(
  • feature
)

Defined in ia\maps\Map.js:366

Zooms to a feature in the map.

Parameters:

  • feature Object

    The feature.

zoomToFeatures

(
  • featureIds
  • optLayers
)

Defined in ia\maps\Map.js:414

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

Defined in ia\maps\Map.js:313

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

Defined in ia\maps\Map.js:339

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

animationMode

Boolean

Animation mode.

Default: false

backgroundContainer

JQUERY Element

Containers the map canvas.

canvas

HTML Canvas

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:122

The canvas.

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.

context

HTML Canvas Context

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:130

The canvas context.

controller

ia.MapController

Defined in ia\maps\Map.js:63

Controls the map.

datatip

ia.ChartTip

The data tip.

embeddedInGoogleMaps

Boolean

Indicates if embedded in google maps.

Default: false

foregroundContainer

JQUERY Element

Containers selection / highlight canvas.

id

String

The id.

isDraggable

Boolean

Indicates if its draggable ie Its a map - used by touch events.

Default: false

isVisible

Boolean

The chart visibility.

Default: true

layerContainer

JQUERY Element

The container that holds the layers.

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

mapContainer

JQUERY Element

The container that holds all the divs.

markerLayer

ia.MarkerLayer

Defined in ia\maps\Map.js:55

A special layer for drawing markers on top of the map layers.

maxZoom

Number

The maximum extent.

Default: -1

minZoom

Number

The minimum extent.

Default: -1

mouseX

Number

The x coordinate of the mouse (pixel units) relative to the map origin.

Default: 0

mouseY

Number

The y coordinate of the mouse (pixel units) relative to the map origin.

Default: 0