* @function ThemeLayer.prototype.getLocalXY * @description 地理坐标转为像素坐标。 * @param {Object} [coordinate] - 坐标位置。 * @returns {Array} 长度为 2 的像素坐标数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
(coordinate)
| 416 | * @returns {Array} 长度为 2 的像素坐标数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。 |
| 417 | */ |
| 418 | getLocalXY(coordinate) { |
| 419 | var pixelP, map = this.map; |
| 420 | if (coordinate instanceof Point || coordinate instanceof GeoText) { |
| 421 | let tempPoint = map.project(new mapboxgl.LngLat(coordinate.x, coordinate.y)); |
| 422 | pixelP = [tempPoint.x, tempPoint.y]; |
| 423 | } |
| 424 | if (coordinate instanceof LonLat) { |
| 425 | let tempPoint = map.project(new mapboxgl.LngLat(coordinate.lon, coordinate.lat)); |
| 426 | pixelP = [tempPoint.x, tempPoint.y]; |
| 427 | } |
| 428 | return pixelP; |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * @function ThemeLayer.prototype.toiClientFeature |