Reference Source
public class | source

MapView

Extends:

leaflet~L.Evented → MapView

MapView Control Class
notice: basemap need special scale and projection(google)

Example:

var mapView = new KQ.Map.MapView({
center: [ 30.56, 113.66 ],
zoom: 10,
maxZoom: 16,
}, 'osm', 'vector');

mapView.initAsync(function () {
// do something
});

Constructor Summary

Public Constructor
public

constructor(options: Object)

MapView constructor

Method Summary

Public Methods
public

addControl(control: Control): Null

Add control to the map

public

Clear all drawn shape

public

closePopup(popup: MapTooltip): Null

Closes the popup given as parameter.

public

closeTooltip(tooltip: MapTooltip): Null

Close the specified prompt box

public

compareTwoMap(options: Object): Null

Compare map

public

Get the map mouse type

public

flyTo(latlng: LatLng, zoom: Number): Null

Sets the view of the map (geographical center and zoom)

public

flyToBounds(bounds: LatLngBounds): Null

Sets the view of the map with a smooth animation like flyTo, but takes a bounds parameter like fitBounds

public

Get mapview boundary

public

getDrawGeoJSON(isDestProjection: Boolean): GeoJSON

Get drawn shape data

public

Gets the graph drawn on the map

public

Get input control, if input is not exsited, return null.

public

Get mapview permission

public

Get main sidebar control, if input is not exsited, return null

public

Get tree control, if tree is not exsited, return null

public

async initAsync(callback: function(): null): Promise

Init map

public

openPopup(popup: MapTooltip): Null

Opens the specified popup.

public

openTooltip(tooltip: MapTooltip): Null

Open the specified prompt box

public

panBy(offset: Point): Null

Pans the map by a given number of pixels

public

panTo(latlng: LatLng): Null

Pans the map to a given center

public

project(latlng: LatLng): Point

Project WGS84 onto the map target projection

public

removeControl(control: Control): Null

Remove control from the map

public

Restore the map mouse type

public

setCursor(cursor: String): null

Set the map mouse type

public

Open or close drawing panel

public

Projected the coordinates of the map projection onto WGS84

public

zoom(scale_id: Number): Null

Sets the zoom of the map

public

zoomIn(delta: Number): Null

Increases the zoom of the map by delta

public

zoomOut(delta: Number): Null

Decreases the zoom of the map by delta

public

zoomToMap(): Null

Zoom to the full map extent

Public Constructors

public constructor(options: Object) source

MapView constructor

Params:

NameTypeAttributeDescription
options Object

config params

options.center LatLng

map center

options.zoom Number

map scale index

options.permission Number[]

map permission array

Emit:

click

Fired when the user clicks (or taps) the map.

dblclick

Fired when the user double-clicks (or double-taps) the map.

mousedown

Fired when the user pushes the mouse button on the map.

mouseup

Fired when the user releases the mouse button on the map.

mouseover

Fired when the mouse enters the map.

mouseout

Fired when the mouse leaves the map.

mousemove

Fired while the mouse moves over the map.

contextmenu

Fired when the user pushes the right mouse button on the map, prevents default browser context menu from showing if there are listeners on this event. Also fired on mobile when the user holds a single touch for a second (also called long press).

resize

Fired when the map is resized.

load

Fired when the map is initialized (when its center and zoom are set for the first time).

zoomend

Fired when the map has changed, after any animations.

moveend

Fired when the center of the map stops changing (e.g. user stopped dragging the map).

Public Methods

public addControl(control: Control): Null source

Add control to the map

Params:

NameTypeAttributeDescription
control Control

map control object

Return:

Null

public clearDrawGeoJSON(): Null source

Clear all drawn shape

Return:

Null

public closePopup(popup: MapTooltip): Null source

Closes the popup given as parameter.

Params:

NameTypeAttributeDescription
popup MapTooltip

popup object

Return:

Null

public closeTooltip(tooltip: MapTooltip): Null source

Close the specified prompt box

Params:

NameTypeAttributeDescription
tooltip MapTooltip

tooltip object

Return:

Null

public compareTwoMap(options: Object): Null source

Compare map

Params:

NameTypeAttributeDescription
options Object

setting options

options.win Object

parent window object

options.parentID String

parent DOM object ID

options.leftLayerInfos Object[]

the layer information array on the left, format:{ src_name: "abc", id: "1" }

options.rightLayerInfos Object[]

the layer information array on the right, format:{ src_name: "abc", id: "1" }

options.leftGeoJSON Object

the graphics data object added to the left image

options.rightGeoJSON Object

the graphical data object added to the right image

options.center LatLng

map center

options.zoom Number

map scale index

Return:

Null

public cursor(): String source

Get the map mouse type

Return:

String

public flyTo(latlng: LatLng, zoom: Number): Null source

Sets the view of the map (geographical center and zoom)

Params:

NameTypeAttributeDescription
latlng LatLng

position number(wgs84)

zoom Number

map scale id

Return:

Null

public flyToBounds(bounds: LatLngBounds): Null source

Sets the view of the map with a smooth animation like flyTo, but takes a bounds parameter like fitBounds

Params:

NameTypeAttributeDescription
bounds LatLngBounds

fit bound(wgs84)

Return:

Null

public getBounds(): LatLngBounds source

Get mapview boundary

Return:

LatLngBounds

public getDrawGeoJSON(isDestProjection: Boolean): GeoJSON source

Get drawn shape data

Params:

NameTypeAttributeDescription
isDestProjection Boolean

if true, return target projection position

Return:

GeoJSON

public getDrawnItems(): Object[] source

Gets the graph drawn on the map

Return:

Object[]

public getInput(): Object source

Get input control, if input is not exsited, return null. The input control must be set in config file.

Return:

Object

public getPermission(): String[] source

Get mapview permission

Return:

String[]

public getSidebar(): Object source

Get main sidebar control, if input is not exsited, return null

Return:

Object

public getTree(): Object source

Get tree control, if tree is not exsited, return null

Return:

Object

public async initAsync(callback: function(): null): Promise source

Init map

Params:

NameTypeAttributeDescription
callback function(): null

callback function will run after initialization

Return:

Promise

public openPopup(popup: MapTooltip): Null source

Opens the specified popup.

Params:

NameTypeAttributeDescription
popup MapTooltip

popup object

Return:

Null

public openTooltip(tooltip: MapTooltip): Null source

Open the specified prompt box

Params:

NameTypeAttributeDescription
tooltip MapTooltip

tooltip object

Return:

Null

public panBy(offset: Point): Null source

Pans the map by a given number of pixels

Params:

NameTypeAttributeDescription
offset Point

a given number of pixels for offset

Return:

Null

public panTo(latlng: LatLng): Null source

Pans the map to a given center

Params:

NameTypeAttributeDescription
latlng LatLng

position number(wgs84)

Return:

Null

public project(latlng: LatLng): Point source

Project WGS84 onto the map target projection

Params:

NameTypeAttributeDescription
latlng LatLng

geographic coordinates

Return:

Point

public removeControl(control: Control): Null source

Remove control from the map

Params:

NameTypeAttributeDescription
control Control

map control object

Return:

Null

public resetCursor(): null source

Restore the map mouse type

Return:

null

public setCursor(cursor: String): null source

Set the map mouse type

Params:

NameTypeAttributeDescription
cursor String

mouse type, REF:https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

Return:

null

public toggleDrawControl(): Null source

Open or close drawing panel

Return:

Null

public unproject(point: Point): LatLng source

Projected the coordinates of the map projection onto WGS84

Params:

NameTypeAttributeDescription
point Point

Target projection coordinates

Return:

LatLng

public zoom(scale_id: Number): Null source

Sets the zoom of the map

Params:

NameTypeAttributeDescription
scale_id Number

map scale id

Return:

Null

public zoomIn(delta: Number): Null source

Increases the zoom of the map by delta

Params:

NameTypeAttributeDescription
delta Number

zoom delta number

Return:

Null

public zoomOut(delta: Number): Null source

Decreases the zoom of the map by delta

Params:

NameTypeAttributeDescription
delta Number

zoom delta number

Return:

Null

public zoomToMap(): Null source

Zoom to the full map extent

Return:

Null