Class: IWSelectableMap

IWSelectableMap

main class for SelectionAPI. Container for map, baselayer, selectable layer and other layers

new IWSelectableMap(map)

Erläuterung zur Verwendung der RenderOptions:
var baseLayerRenderOptions = {"fill":"white","fillOpacity":0, "stroke": "blue", "strokeWidth": 2};
var selectionRenderOptions = {"fill": "red", "fillOpacity":0.5, "stroke": "0/0/0", "strokeWidth": 10};

var selectableMap = new IWSelectableMap(map);
selectableMap.setLayer(layerId, area, filters, baseLayerRenderOptions, highlightRenderOptions, selectionRenderOptions)


Rendering attributes:
Property Description Value
fill the fill or text color CSS color description, e.g. #ff0000 or blue or rgb, such as rgb(0,0,0,0)
fillOpacity the opacity of the fill color value between 0 (transparent) 1 (opaque)
stroke the stroke color CSS color description, e.g. #ff0000 or blue
strokeWidth the width of the stroke in pixels number
Parameters:
Name Type Description
map IWMap the map

Methods


clearListeners()

removes all Listener on the selectable Map

disableSelect()

sets the modus to select nothing. Default MapOptions for left, right and double mouse click be set

drawLayer(layerId, area, filters, baseLayerRenderOptions, highlightRenderOptions, options)

draws a layer on the map. New layers draw on a new renderer
Parameters:
Name Type Description
layerId string ID of the layer
area object an area to bound the shapes, e.g. {topleft: "697526,6759257", bottomright: "789250,6667533"}, a bounding box {coord: "726113,6702540", radius: 16758}, a circle {polygon: ["727641,6713853","739566,6726694","749197,6708808"]}, a polygon
filters array a list of filter objects, e.g. {type: "prefix", key: "PLZ", value: "5"} a prefix filter to select only postal codes starting with 5
baseLayerRenderOptions object a set of CSS attributes to render the filtered polygons, e.g. {fill: "red", fillOpacity: 0, stroke: "grey", strokeWidth: 5}
highlightRenderOptions object a set of CSS attributes to render the filtered polygons, e.g. {fill: "red", fillOpacity: 0, stroke: "grey", strokeWidth: 5}
options object set tooltip attribute or textAttributes E.g {tooltip:{value:'$ID$ $NAME$'}, textAttributes:{value:'NAME', renderOptions: {fill: 'red',fontSize: '30px', fontWeight: 'bold'}, boxAttributes: {fill: 'white'}}}

getLayerAttributes(layerId, start, limit)

load the items of the specified layer. Throws the event 'onlayeritemsload', if the layer items are loaded
Parameters:
Name Type Description
layerId String id of the baselayer
start number index of the first item
limit number Number of required elements
Returns:
jsonArray, e.g. [{"itemId": "123", "itemName": "abc"}, ...] (trigger event 'onlayeritemsload')
Type
array

getRenderOptions()

gets the RenderOptions for the selection layer
Returns:
options e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}
Type
object

getSelectedItems(full)

provides the items of the layer that were selected
Parameters:
Name Type Description
full boolean extended informations
Returns:
Array of layerItems (itemId und itemName)}
Type
Array

hasSelection()

returns true, if a selection exists
Returns:
Type
boolean

removeLayer(layer)

removes the given layer
Parameters:
Name Type Description
layer object the layer to remove

selectByCircle(mode)

selects items by drawing a circle on the map
Parameters:
Name Type Description
mode IWSelectionMode

selectByCoordinate(mode)

select items by clicking on the map
Parameters:
Name Type Description
mode IWSelectionMode

selectById(id, mode)

select items by id
Parameters:
Name Type Description
id String id of the item to select or an array with ids ("[01,02,03,04,09,12]")
mode IWSelectionMode

selectByPolygon(mode)

select items by drawing a polygon on the map
Parameters:
Name Type Description
mode IWSelectionMode

selectionchange()

event which is triggered when the selection has changed

setBaseLayerRenderOptions(baseLayerRenderOptions)

sets the render option for the baselayer
Parameters:
Name Type Description
baseLayerRenderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}

setHighlightRenderOptions(highlightRenderOptions)

sets the render option for the highlightlayer
Parameters:
Name Type Description
highlightRenderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}

setLayer(layerId, area, filters, baseLayerRenderOptions, highlightRenderOptions, selectionRenderOptions, options)

change the base layer and refresh the map with this layer
Parameters:
Name Type Description
layerId string id of the baselayer
area object an area to bound the shapes, e.g. {topleft: "697526,6759257", bottomright: "789250,6667533"}, a bounding box {coord: "726113,6702540", radius: 16758}, a circle {polygon: ["727641,6713853","739566,6726694","749197,6708808"]}, a polygon
filters array a list of filter objects, e.g. {type: "prefix", key: "PLZ", value: "5"} a prefix filter to select only postal codes starting with 5
baseLayerRenderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}
highlightRenderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}
selectionRenderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}
options object set tooltip attribute or textAttributes E.g {tooltip:{value:'$ID$ $NAME$'}, textAttributes:{value:'NAME', renderOptions: {fill: 'red',fontSize: '30px', fontWeight: 'bold'}, boxAttributes: {fill: 'white'}}}

setRenderOptions(renderOptions)

Sets the render options for the selection layer
Parameters:
Name Type Description
renderOptions object e.g. {'fill':'255/0/0', 'fillOpacity':0.5, 'stroke':'0/0/0', 'strokeWidth':3}

unselectAll()

removes the current selection from the map