Class: IWMap

IWMap

This is the main class of the mapsuite javascript API.

new IWMap(mapContainer)

Creates a new map in the container element with the specified id.
Parameters:
Name Type Description
mapContainer HTMLDivElement the div element to be used as parent for the map

Methods


addLayer(layer)

Adds a new layer or group of layers to the map.
Parameters:
Name Type Description
layer IWLayerInterface (e.g. IWLayer or IWLayerGroup)
Returns:
Type
void

addWindowOverlay(windowOverlay)

Adds a new window overlay in front of the map.
Parameters:
Name Type Description
windowOverlay IWWindowOverlay the window overlay
Returns:
Type
void

changeStyle(style)

Changes the style of the current mapType. Throws an "onmapstylechange"-Event
Parameters:
Name Type Description
style String one of IWMapType constants (IWMapType.STYLE_XXX)
Returns:
Type
void

createPrintMap()

Creates the print image for the visible map area. Not implemented yet.
Returns:
Type
void

getBounds()

Returns the coordinate bounds of the currently visible part of the map.
Returns:
Type
IWBounds

getBoundsZoomlevel(bounds, mapType, offset)

Returns the minimum zoom level at which the specified coordinate bounds fit in the map. The offset can be an object with properties top, right, bottom and left to specify individual offsets for all map borders, or an integer which is used for every border, or null (no borders).
Parameters:
Name Type Description
bounds IWBounds a section of the visible map area
mapType IWMapType the map type to use, or null for the current map type
offset object an object as described above, or an integer value
Returns:
Type
number

getCenter()

Returns the center coordinate of the map.
Returns:
Type
IWCoordinate

getClippingContainer()

Returns the clipping container of the map.
Returns:
the clipping container.
Type
HTMLDivElement

getContainer()

Returns the map container.
Returns:
Type
HTMLDivElement

getControlContainer()

Returns the map container for the controls.
Returns:
the control container.
Type
HTMLDivElement

getCopyrightControl()

Returns the copyright control for this map.
Returns:
Type
IWCopyrightControl

getCurrentMapType()

Returns the current map type.
Returns:
Type
IWMapType

getDrawingContainer()

Returns the drawing container for SVG.
Returns:
Type
HTMLDivElement

getLayerByLayerName()

Returns a layer by its layer name.

Example: If you have created a layer like this:
var layer = new IWLayer(map, 'My Route', 'ROUTE');
map.addLayer(layer);
you can obtain it by map.getLayerByName('ROUTE')
Returns:
Type
IWLayerInterface

getLayerByTitle()

Returns a layer by its title.

Example: If you have created a layer like this:
var layer = new IWLayer(map, 'My Route', 'ROUTE');
map.addLayer(layer);
you can obtain it by map.getLayerByName('My Route')
Returns:
Type
IWLayerInterface

getLayerInfoManager()

Returns the layer info manager for the map.
Returns:
Type
IWLayerInfoManager

getLayers()

Returns all layers.
Returns:
Type
Array.<IWLayerInterface>

getLayoutManager()

Returns the layout manager for the map.
Returns:
Type
IWLayoutManager

getMapHeightInMeter()

Returns the height of the visible map area in meter.
Returns:
Type
number

getMapWidthInMeter()

Returns the width of the visible map area in meter.
Returns:
Type
number

getMeterPerPixel()

Returns the meter per pixel. This function returns meter in Mercator projection.
Deprecated:
  • Yes
Returns:
Type
number

getOptions()

Returns the options used by this map.
Returns:
Type
IWMapOptions

getOverlayContainer()

Returns the map container for the overlays.
Returns:
the overlay container.
Type
HTMLDivElement

getOverlayManager()

Returns the overlay manager for the map.
Returns:
Type
IWOverlayManager

getSessionId()

Returns the id for the current session.
Returns:
the session id
Type
String

getTilesContainer()

Returns the tile container for the map tiles.
Returns:
the tile container
Type
HTMLDivElement

getWindowOverlayContainer()

Returns the WindowOverlay container of the map.
Returns:
the WindowOverlay container.
Type
HTMLDivElement

getWindowOverlayManager()

Returns the WindowOverlayManager
Returns:
Type
IWWindowOverlayManager

getZoom()

Returns the current zoom level.
Returns:
Type
number

getZoomByMeter(meter, mapType)

Returns the optimal zoomlevel by meter.
Parameters:
Name Type Description
meter number
mapType IWMapType a map type (optional, default is the current map type)
Returns:
the zoomlevel
Type
number

getZoomingAndDraggingContainer()

Returns the ZoomingAndDragging container of the map.
Returns:
the ZoomingAndDragging container.
Type
HTMLDivElement

openInfoBalloon(coordinate, content)

Opens a new infoballoon at the specified coordinate on the map.
Parameters:
Name Type Description
coordinate IWCoordinate the coordinate of the infoballoon
content Object the content of the infoballoon
Returns:
Type
void

openTooltip(coordinate, text, properties)

Opens a new IWTooltip at the specified coordinate on the map.
Parameters:
Name Type Description
coordinate IWCoordinate
text String
properties Object properties for this tooltip, so far only duration (in ms)
Returns:
the tooltip
Type
IWWindowOverlay

panBy(offset, undoable, flags)

Moves the map by the specified offset in pixels. If the target coordinate is already visible the map is moved in a smooth animation.
Parameters:
Name Type Description
offset IWPoint the offset in pixels
undoable boolean true, if this action should be undoable, otherwise false.
flags
Returns:
Type
void

panTo(coordinate, undoable, flags)

Moves the map to the specified coordinate. If the target coordinate is already visible the map is moved in a smooth animation; otherwise the result is the same as from a call to #setCenter without the optional parameters.
Parameters:
Name Type Description
coordinate IWCoordinate the new center
undoable Boolean true, if this action should be undoable, otherwise false.
flags Object list of options
Returns:
Type
void

redo()

If the last user action was a call to #undo the effect is cancelled; otherwise nothing is done.
See:
Returns:
Type
void

redraw()

Redraws the layers on the map.
Returns:
Type
void

removeInfoBalloon()

Removes the infoballoon from the map.
Returns:
Type
void

removeLayer(layer)

Removes the layer from the map.
Parameters:
Name Type Description
layer IWLayerInterface (e.g. IWLayer or IWLayerGroup)
Returns:
Type
void

removeLayerByName(layerName)

Removes the layer from the map by its name.
Parameters:
Name Type Description
layerName String
Returns:
layer (e.g. IWLayer or IWLayerGroup)
Type
IWLayerInterface

removeTooltip()

Removes the IWTooltip from the map.
Returns:
Type
void

removeWindowOverlay(windowOverlay)

Removes the window overlay from the map.
Parameters:
Name Type Description
windowOverlay IWWindowOverlay the window overlay
Returns:
Type
void

returnToSavedPosition()

Restores the last saved map view.
See:
Returns:
Type
void

savePosition()

Saves the current map view (the map position and zoom level).
Returns:
Type
void

setCenter(coordinate, zoom, mapType)

Sets the map center to the specified coordinate.
Parameters:
Name Type Description
coordinate IWCoordinate the new map center
zoom number the new zoom level (optional)
mapType IWMapType a map type (optional)
Returns:
Type
void

setRemovalStrategy(strategy)

Sets a removal strategy.
Parameters:
Name Type Description
strategy IWTilesRemovalStrategy
Returns:
Type
void

toString()

Returns a string prepresentation of this map.
Returns:
Type
String

triggerOnMapStyleChange(event)

The onmapstylechange event is fired when the style of current maptype is changed.

Register an event listener with IWEventManager.addListener(yourMapObject, 'onmapstylechange', yourHandlerMethod(event)); to receive the event.

Parameters:
Name Type Description
event

undo()

Reverts the effect of the last user action if there is one on the stack.
See:
Returns:
Type
void

zoom(level, center, adjustToCenter, animation)

Zooms the map to the specified level and screen position. There are two zoom modes which can be toggled by adjustToCenter. If adjustToCenter is true the map center after zooming is the coordinate at the center parameter. This is used for double click actions in the map to center the map on this position. If adjustToCenter is false the coordinate at the center parameter stays on the same screen position. This behavior is used for mouse wheel zooming: A city at the mouse position is still at the mouse position after zooming.
Parameters:
Name Type Description
level number the new zoom level
center IWPoint the zoom center (optional, defaults to the center of the screen)
adjustToCenter boolean the zoom mode as described above
animation boolean true to animate the zoom effect (e.g. double click), false to skip the animation (e.g. slider step)
Returns:
false if the map cannot be zoomed (because the level is not available), true otherwise (optional, defaults to false)
Type
boolean

zoomIn(undoable)

Zooms in a level unless the map is on the highest zoom level.
Parameters:
Name Type Description
undoable boolean true or empty, if this action should be undoable, otherwise false.
Returns:
true if zoom was successful, else false.
Type
boolean

zoomOut(undoable)

Zooms out a level unless the map is on the lowest zoom level.
Parameters:
Name Type Description
undoable boolean true or empty, if this action should be undoable, otherwise false.
Returns:
true if zoom was successful, else false.
Type
boolean

zoomToBounds(bounds, offset)

Zooms the map to show the specified bounds, considering the offset. The offset can be an object with properties top, right, bottom and left to specify individual offsets for all map borders, or an integer which is used for every border, or null (no borders).
Parameters:
Name Type Description
bounds IWBounds a section of the visible map area
offset object an object as described above, or an integer value
Returns:
Type
void