MapView
Extends:
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 |
clearDrawGeoJSON(): Null 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 |
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 |
getDrawnItems(): Object[] Gets the graph drawn on the map |
|
public |
Get input control, if input is not exsited, return null. |
|
public |
getPermission(): String[] Get mapview permission |
|
public |
getSidebar(): Object Get main sidebar control, if input is not exsited, return null |
|
public |
Get tree control, if tree is not exsited, return null |
|
public |
Init map |
|
public |
openPopup(popup: MapTooltip): Null Opens the specified popup. |
|
public |
openTooltip(tooltip: MapTooltip): Null Open the specified prompt box |
|
public |
Pans the map by a given number of pixels |
|
public |
Pans the map to a given center |
|
public |
Project WGS84 onto the map target projection |
|
public |
removeControl(control: Control): Null Remove control from the map |
|
public |
resetCursor(): null Restore the map mouse type |
|
public |
Set the map mouse type |
|
public |
toggleDrawControl(): Null Open or close drawing panel |
|
public |
Projected the coordinates of the map projection onto WGS84 |
|
public |
Sets the zoom of the map |
|
public |
Increases the zoom of the map by delta |
|
public |
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
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:
Name | Type | Attribute | Description |
control | Control | map control object |
Return:
Null |
public closePopup(popup: MapTooltip): Null source
Closes the popup given as parameter.
Params:
Name | Type | Attribute | Description |
popup | MapTooltip | popup object |
Return:
Null |
public closeTooltip(tooltip: MapTooltip): Null source
Close the specified prompt box
Params:
Name | Type | Attribute | Description |
tooltip | MapTooltip | tooltip object |
Return:
Null |
public compareTwoMap(options: Object): Null source
Compare map
Params:
Name | Type | Attribute | Description |
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 flyTo(latlng: LatLng, zoom: Number): Null source
Sets the view of the map (geographical center and zoom)
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:
Name | Type | Attribute | Description |
bounds | LatLngBounds | fit bound(wgs84) |
Return:
Null |
public getDrawGeoJSON(isDestProjection: Boolean): GeoJSON source
Get drawn shape data
Params:
Name | Type | Attribute | Description |
isDestProjection | Boolean | if true, return target projection position |
Return:
GeoJSON |
public getInput(): Object source
Get input control, if input is not exsited, return null. The input control must be set in config file.
public openPopup(popup: MapTooltip): Null source
Opens the specified popup.
Params:
Name | Type | Attribute | Description |
popup | MapTooltip | popup object |
Return:
Null |
public openTooltip(tooltip: MapTooltip): Null source
Open the specified prompt box
Params:
Name | Type | Attribute | Description |
tooltip | MapTooltip | tooltip object |
Return:
Null |
public panBy(offset: Point): Null source
Pans the map by a given number of pixels
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
latlng | LatLng | position number(wgs84) |
Return:
Null |
public project(latlng: LatLng): Point source
Project WGS84 onto the map target projection
Params:
Name | Type | Attribute | Description |
latlng | LatLng | geographic coordinates |
public removeControl(control: Control): Null source
Remove control from the map
Params:
Name | Type | Attribute | Description |
control | Control | map control object |
Return:
Null |
public setCursor(cursor: String): null source
Set the map mouse type
Params:
Name | Type | Attribute | Description |
cursor | String | mouse type, REF:https://developer.mozilla.org/en-US/docs/Web/CSS/cursor |
public unproject(point: Point): LatLng source
Projected the coordinates of the map projection onto WGS84
Params:
Name | Type | Attribute | Description |
point | Point | Target projection coordinates |
public zoom(scale_id: Number): Null source
Sets the zoom of the map
Params:
Name | Type | Attribute | Description |
scale_id | Number | map scale id |
Return:
Null |
public zoomIn(delta: Number): Null source
Increases the zoom of the map by delta
Params:
Name | Type | Attribute | Description |
delta | Number | zoom delta number |
Return:
Null |