You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
export function createPoint (BMap, options = {}) {
|
|
const {lng, lat} = options
|
|
return new BMap.Point(lng, lat)
|
|
}
|
|
|
|
export function createPixel (BMap, options = {}) {
|
|
const {x, y} = options
|
|
return new BMap.Pixel(x, y)
|
|
}
|
|
|
|
export function createBounds (BMap, options = {}) {
|
|
const {sw, ne} = options
|
|
return new BMap.Bounds(createPoint(BMap, sw), createPoint(BMap, ne))
|
|
}
|
|
|
|
export function createSize (BMap, options = {}) {
|
|
const {width, height} = options
|
|
return new BMap.Size(width, height)
|
|
}
|
|
|
|
export function createIcon (BMap, options = {}) {
|
|
const {url, size, opts = {}} = options
|
|
return new BMap.Icon(url, createSize(BMap, size), {
|
|
anchor: opts.anchor && createSize(BMap, opts.anchor),
|
|
imageSize: opts.imageSize && createSize(BMap, opts.imageSize),
|
|
imageOffset: opts.imageOffset && createSize(BMap, opts.imageOffset),
|
|
infoWindowAnchor: opts.infoWindowAnchor && createSize(BMap, opts.infoWindowAnchor),
|
|
printImageUrl: opts.printImageUrl
|
|
})
|
|
}
|
|
|
|
export function createLabel (BMap, options = {}) {
|
|
const {content, opts} = options
|
|
return new BMap.Label(content, {
|
|
offset: opts.offset && createSize(BMap, opts.offset),
|
|
position: opts.position && createPoint(BMap, opts.position),
|
|
enableMassClear: opts.enableMassClear
|
|
})
|
|
}
|
|
|