Reference Source
public class | source

MapBuilding

Map building class

Example:

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

mapView.initAsync(function () {
var geoJSON = { ... };
var building = KQ.Map.MapBuilding.getInstance();
building.setOnClick(function (e) {
console.log('building on click !!!');
})
building.addToMapView(mapView);
building.addData(geoJSON);
});

Static Method Summary

Static Public Methods
public static

Get object instance

Method Summary

Public Methods
public

addData(geojson: Object, options: Object): *

Add data

public

addToMapView(mapview: MapView): Null

Added to the mapview

public

Clear data

public

delData(id: *)

Delete the data

public

Get the data

public

Set or obtain the minimum display zoom

public

remove(): Null

Remove from the map

public

setOnClick(onClick: Function): null

Set the click event response function

Static Public Methods

public static getInstance(options: Object): MapBuilding source

Get object instance

Params:

NameTypeAttributeDescription
options Object

Set the parameters

options.onClick Color

The response event when the mouse clicks

Return:

MapBuilding

Public Methods

public addData(geojson: Object, options: Object): * source

Add data

Params:

NameTypeAttributeDescription
geojson Object

GeoJSON

options Object

Set the parameters

options.wallColor Color

Wall color

options.roofColor Color

Roof color

options.buildingHeight Number

Building height(m)

options.roofHeight Number

Roof height(m)

options.shadows Boolean

Whether to display shadow(true or false)

Return:

*

null

public addToMapView(mapview: MapView): Null source

Added to the mapview

Params:

NameTypeAttributeDescription
mapview MapView

mapview object

Return:

Null

public clearData() source

Clear data

public delData(id: *) source

Delete the data

Params:

NameTypeAttributeDescription
id *

public getData(id: Number): Object source

Get the data

Params:

NameTypeAttributeDescription
id Number

data id

Return:

Object

public minZoom(zoom: Number): Number source

Set or obtain the minimum display zoom

Params:

NameTypeAttributeDescription
zoom Number

Scale index

Return:

Number

public remove(): Null source

Remove from the map

Return:

Null

public setOnClick(onClick: Function): null source

Set the click event response function

Params:

NameTypeAttributeDescription
onClick Function

Event response function

Return:

null