Show:

ia.FeatureServiceLayer Class

The base class for AGS Feature layers.

Constructor

ia.FeatureServiceLayer

(
  • inSource
)

Parameters:

  • inSource String

    The spatial 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.

_drawItem

(
  • item
  • ctx
)
private

Does the actual drawing.

Parameters:

  • item Object

    The item.

  • ctx HTML Canvas Context

    The context to render to.

_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:

_pointInLine

(
  • coords
  • pointX
  • pointY
)
private

Query if a point lies completely within a polygon.

Parameters:

  • coords Number

    The coords to hit test.

  • pointX Number

    The pixel x coordinate of the test point.

  • pointY Number

    The pixel y coordinate of the test point.

_pointInPoly

(
  • coords
  • pointX
  • pointY
)
private

Query if a point lies completely within a polygon.

Parameters:

  • coords Number

    The coords to hit test.

  • pointX Number

    The x coordinate of the test point.

  • pointY Number

    The y coordinate of the test point.

_pointInRect

(
  • symbolWidth
  • symbolHeight
  • coords
  • pointX
  • pointY
)
private

Query if a point lies completely within a shape.

Parameters:

  • symbolWidth Number

    The symbol width.

  • symbolHeight Number

    The symbol height.

  • coords Number

    The coords to hit test.

  • pointX Number

    The x coordinate of the test point.

  • pointY Number

    The y coordinate of the test point.

_removeFromSelection

(
  • id
)
private

Removes an id from the selection.

Parameters:

  • id String

    The id of the item.

_renderItems

(
  • items
)
private

Renders the passed items.

Parameters:

  • items Object

    An array of layer items to render.

_setLabelStyle

() private

Sets the label style.

_triggerRenderSelection

() private

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

_updateItems

() private

Updates the layer items.

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.

draw

()

Draws the layer.

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}

getFeatureDetails

(
  • callbackFunction
)
String

Gets the feature details for initialising layer items.

Parameters:

  • callbackFunction Function

    The call back function.

Returns:

String: objectIds An array of ids.

getFeatures

(
  • maxAllowableOffset
  • callbackFunction
)
String

Gets the attribute data for the given objectIds from a FeatureServer.

Parameters:

  • maxAllowableOffset Number

    How detailed the returned geometry should be.

  • callbackFunction Function

    The call back function.

Returns:

String: objectIds An array of ids.

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
)

Inherited from ia.ItemLayer but overwritten in ia\maps\layers\FeatureLayer.js:433

Highlights the item.

Parameters:

  • item Object

    The item.

hitItem

(
  • item
  • event
)

Inherited from ia.ItemLayer but overwritten in ia\maps\layers\FeatureLayer.js:574

Runs a hit test on shapes.

Parameters:

isSelected

(
  • id
)

Checks if an id is selected

Parameters:

  • id String

    The id of the item.

loadSource

()

Overrides loadSource in FeatureLayer because we dont actually load anything. The layer data is loaded and rendered every time the map is redrawn.

parseData

(
  • features
  • maxAllowableOffset
)

Parses the layerData every time the map is redrawn.

Parameters:

  • features JSON

    The FeatureServer features.

  • maxAllowableOffset Number

    How detailed the returned geometry should be.

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.

renderItem

(
  • item
)

Renders the item to the given context.

Parameters:

  • item Object

    The item.

renderItemLabel

(
  • item
)

Renders the item label.

Parameters:

  • item Object

    The item.

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
)

Inherited from ia.ItemLayer but overwritten in ia\maps\layers\FeatureLayer.js:422

Selects the item.

Parameters:

  • item Object

    The item.

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
)

Inherited from ia.ItemLayer but overwritten in ia\maps\layers\FeatureLayer.js:721

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"

dataLabel

String

The layer data label.

Default: ""

doHitTest

Boolean

Indicates whether to carry out a hit test.

Default: true

esriGeometryType

String

The FeatureServer geometry type, used to differentiate between multi-point and single-point features.

eval

Boolean

Check if its eval data.

Default: true

featureBBox

ia.BoundingBox

The extents of the layer usin.

geometry

String

The geometry for the layer.

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.

highlightOpacity

Number

The highlight opacity.

Default: 0.3

icon

Image

The loaded icon derived from iconPath.

id

String

The id of the layer.

Default: ""

idField

String

The id field.

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.

maxLabelExtent

Number

The maximum display extent for labels.

Default: Infinity

name

String

The name of the layer.

Default: ""

nameField

String

The name field.

Default: ""

objectIds

String

A list of objectids to use.

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.

selectionOpacity

Number

The selection opacity.

Default: 0.3

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

source

String

The spatial data source for the layer.

srs

Number

The spatial reference system.

Default: 102100

style

Object

The layer style.

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

symbol

String

Inherited from ia.ItemLayer but overwritten in ia\maps\layers\FeatureLayer.js:116

The symbol used for point data.

Default: ia.Shape.CIRCLE

symbolSize

Number

The symbol size.

Default: 15

tip

String

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

Default: ""

uid

String

Unique id.

Default: ""

url

Number

Inherited from ia.FeatureLayer but overwritten in ia\maps\layers\FeatureLayer.js:38

The minimum display extent for labels.

Default: Infinity