Show:

ia.ItemLayer Class

Extends ia.LayerBase
Module: ia

The base class for map layers.

Constructor

ia.ItemLayer

(
  • inSource
)

Parameters:

  • inSource String

    The spatial data source.

Methods

_addToSelection

(
  • id
)
private

Adds an id to the selection.

Parameters:

  • id String

    The id of the item.

_clearCanvas

(
  • c
  • ctx
)
private

Clears a canvas.

Parameters:

  • c HTML Canvas

    The canvas to clear.

  • ctx HTML Canvas Context

    Its context.

_clearHighlightGraphics

() private

Clears the highlight canvas.

_clearLabelGraphics

() private

Clears the label canvas.

_clearLayerGraphics

() private

Clears the layer canvases.

_clearSelectionGraphics

() private

Clears the selection canvas.

_dispatchItemEvent

(
  • event
  • isHit
  • item
)
private

The hit logic for items in the layer.

Parameters:

  • event ia.MapMouseEvent

    A ia.MapMouseEvent.

  • isHit Boolean

    Indicates if the item was hit.

  • item Object

    The item that was hit.

_hitTest

(
  • event
)
private

Runs a hit test on the layer.

Parameters:

_itemEventHandler

(
  • event
)
private

Handles default selection / highlight functionality.

Parameters:

  • event ia.ItemEvent

    An ia.ItemEvent dispatched by this layer.

_mapEventHandler

(
  • event
)
private

Inherited from ia.LayerBase but overwritten in ia\charts\layers\ItemLayer.js:475

Handles when to carry out hit tests.

Parameters:

_removeFromSelection

(
  • id
)
private

Removes an id from the selection.

Parameters:

  • id String

    The id of the item.

_setLabelStyle

() private

Sets the label style.

_triggerRenderSelection

() private

Triggers a selection render. Prevents over rendering which results in a frozen browser.

addCanvases

()

Adds drawing canvases for the layer when the layer is shown. This method was introduced to fix a bug a chrome when multiple canvases were affecting rendering. It basically reduces the number of unused canvases which are taking up memory.

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.

clear

()

Inherited from ia.LayerBase but overwritten in ia\charts\layers\ItemLayer.js:950

Clears all canvases in the layer.

clearHighlight

()

Clears all highlights.

clearItems

()

Clears the item list.

clearSelection

()

Clears all selections.

createCanvas

() HTML Canvas

Creates a new canvas.

Returns:

HTML Canvas: The canvas.

dispatchEvent

(
  • event
)

Dispatch an event to the listeners.

Parameters:

  • event Object

    The event object.

getData

() Id:"eh11", name:"polwarth", value:2345, associate1:25

Gets a data object for the layer.

Returns:

Id:"eh11", name:"polwarth", value:2345, associate1:25: ["eh11"] ["eh12"]{id:"eh12", name:"morningside", value:4347, associate1:45} ["eh13"]{id:"eh13", name:"merchiston", value:2496, associate1:25}

getItem

(
  • id
)

Gets an item with the given id.

Parameters:

  • id String

    The id of the item to get.

getVisible

() Boolean

Gets the visibility of the layer.

Returns:

Boolean: true/false.

hideTip

()

Hides the tip.

highlight

(
  • id
)

Hightlights an item.

Parameters:

  • id String

    The id of the item to highlight.

highlightItem

(
  • item
)

Highlights the item.

Parameters:

  • item Object

    The item to highlight.

hitItem

(
  • item
  • event
)
private

Runs a hit test on an item.

Parameters:

isSelected

(
  • id
)

Checks if an id is selected

Parameters:

  • id String

    The id of the item.

loadSource

()

Loads the source data.

removeCanvases

()

Removes drawing canvases for the layer when the layer is hidden. This method was introduced to fix a bug a chrome when multiple canvases were affecting rendering. It basically reduces the number of unused canvases which are taking up memory.

removeListener

(
  • obj
)

Removes all event listeners for the given object.

Parameters:

  • obj Object

    The object.

render

()

Renders the layer.

renderSelection

()

Renders the selection canvas.

select

(
  • id
)

Selects an item.

Parameters:

  • id String

    The id of the item.

selectAll

()

Selects all the items in the layer.

selectItem

(
  • item
)

Selects the item.

Parameters:

  • item Object

    The item to select.

setData

(
  • value
)

Sets a data object for the layer.

Parameters:

  • value Id:"eh11", name:"polwarth", value:2345, associate1:25

    ["eh11"]
    ["eh12"]{id:"eh12", name:"morningside", value:4347, associate1:45}
    ["eh13"]{id:"eh13", name:"merchiston", value:2496, associate1:25}

setMap

(
  • map
  • map
)

Sets the map and canvas for the layer.

Parameters:

  • map ia.Map

    The map.

  • map HTML Element

    The container.

setVisible

(
  • value
)

Sets the visibility of the layer.

Parameters:

  • value Boolean

    true/false.

showTip

(
  • item
  • event
)

Displays the tip for the passed item

Parameters:

  • item Object

    The map item.

  • event ia.ItemEvent

    An ia.ItemEvent.

tipFunction

(
  • item
)

Supplies the default text for the layer. This can be replaced with a custom function

Parameters:

  • item Object

    The map item.

unselect

(
  • id
)

Unselects an item.

Parameters:

  • id String

    The id of the item.

Properties

animationMode

Boolean

Animation mode.

Default: false

bBox

ia.BoundingBox

The bounding box for the layer.

canvas

HTML Canvas

The canvas associated with this layer.

context

HTML Canvas Context

The canvas context associated with this layer.

dataChanged

Boolean

Indicates the data has changed.

Default: false

dataField

String

Specifies the field of the data provider that provides the values.

Default: "value"

doHitTest

Boolean

Indicates whether to carry out a hit test.

Default: true

highlightCanvas

HTML Canvas

The highlight canvas associated with this layer.

highlightColor

String

The item highlight color.

Default: "#00ff00"

highlightContext

HTML Canvas Context

The highlight canvas context associated with this layer.

id

String

The id of the layer.

Default: ""

interactive

Boolean

Is selection and highlighting switched on.

Default: false

isLoaded

Boolean

Indicates whether the layer is loaded.

Default: false

itemArray

Object

An array containing the layer items.

items

Associative Array

An associate array containing the layer items.

labelContext

HTML Canvas Context

The label canvas context associated with this layer.

map

ia.Map

The map associated with this layer.

name

String

The name of the layer.

Default: ""

ROLLOVER

String final static

Value that indicates the Feature appears as if the mouse is over it.

Default: "rollOver"

ROLLOVER_SELECTED

String final static

Value that indicates the Feature appears as if the mouse is over it and is selected.

Default: "rollOverSelected"

SELECTED

String final static

Value that indicates the Feature appears selected.

Default: "selected"

selectionCanvas

HTML Canvas

The selection canvas associated with this layer.

selectionColor

String

The item selection color.

Default: "#ff0000"E

selectionContext

HTML Canvas Context

The selection canvas context associated with this layer.

selectionIds

String

An array of selected ids.

showDataTips

Boolean

Are data tips displayed.

Default: trueE

showInLayerList

Boolean

Should the layer be displayed ina layer list.

Default: false

showLabels

Boolean

Show labels.

Default: false

style

Object

The layer style.

Default: {fillStyle:'#EFEFEF', strokeStyle:'#CCCCCC', lineWidth:'1', lineJoin:'round'}

symbol

String

The label canvas associated with this layer.

Default: ia.Shape.SQUARE

tip

String

The data tip - used by charts that have fixed tip templates.

Default: ""

UNSELECTED

String final static

Value that indicates the Feature appears unselected.

Default: "unselected"