From 18c79fdd27fddcce4cd4f91183149c522297f8f0 Mon Sep 17 00:00:00 2001 From: "@thinkinggis" Date: Mon, 1 Nov 2021 20:25:13 +0800 Subject: [PATCH] Fix docs (#817) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: 更新scene 文档 * fix: 更新文档 * fix: 组件文档 * fix: source 循序引用 --- docs/api/component/control.zh.md | 2 +- docs/api/scene.zh.md | 53 +++++++++++++++++++ examples/tutorial/control/demo/amap.js | 6 ++- .../layers/src/plugins/FeatureScalePlugin.ts | 3 -- .../layers/src/plugins/LayerStylePlugin.ts | 1 - packages/layers/src/point/models/text.ts | 2 +- packages/source/src/source.ts | 2 +- 7 files changed, 60 insertions(+), 9 deletions(-) diff --git a/docs/api/component/control.zh.md b/docs/api/component/control.zh.md index fc4a87130b..b380b3a851 100644 --- a/docs/api/component/control.zh.md +++ b/docs/api/component/control.zh.md @@ -17,7 +17,7 @@ L7 目前支持 Control #### option -position: `string` 控件位置支持是个方位 +position: `string` 控件位置支持 8 个方位 - bottomright - topright diff --git a/docs/api/scene.zh.md b/docs/api/scene.zh.md index 85fe200c7a..d6ae92bd4d 100644 --- a/docs/api/scene.zh.md +++ b/docs/api/scene.zh.md @@ -491,6 +491,8 @@ scene.setPitch(pitch); ### setMapStatus 设置地图状态 +可用来关闭地图的一些交互操作 + 参数 : ```javascript @@ -525,6 +527,57 @@ scene.fitBounds([ ]); ``` +### containerToLngLat 画布坐标转经纬度 + +画布坐标转经纬度坐标 + +参数 : + +- pixel 画布的坐标 [x ,y ] {array } + +``` +scene.pixelToLngLat([10,10]); +``` + +### lngLatToContainer 经纬度转画布坐标 + +经纬度坐标转画布坐标 + +参数 : + +- lnglat 经纬度坐标 [lng,lat ] {array } + +``` +scene.lngLatToPixel([120,10]); + +``` + +### pixelToLngLat 像素坐标转经纬度 + +像素坐标:不同级别下地图上某点的位置 +地图像素坐标转经纬度坐标 + +参数 : + +- pixel 画布的坐标 [x ,y ] {array } + +``` +scene.pixelToLngLat([10,10]); +``` + +### lngLatToPixel 经纬度转像素坐标 + +经纬度坐标转像素坐标 + +参数 : + +- lnglat 经纬度坐标 [lng,lat ] {array } + +``` +scene.lngLatToPixel([120,10]); + +``` + ### exportMap 导出地图图片 导出地图,目前仅支持导出可视化层,不支持底图导出 diff --git a/examples/tutorial/control/demo/amap.js b/examples/tutorial/control/demo/amap.js index 9681718efc..6bfe4d0b8b 100644 --- a/examples/tutorial/control/demo/amap.js +++ b/examples/tutorial/control/demo/amap.js @@ -36,15 +36,17 @@ scene.on('loaded', () => { 气泡图: pointLayer }; const layersControl = new Layers({ - overlayers + overlayers, + position: 'rightcenter' }); scene.addControl(layersControl); }); const zoomControl = new Zoom({ - position: 'topright' + position: 'rightcenter' }); + const scaleControl = new Scale({ position: 'bottomright' }); diff --git a/packages/layers/src/plugins/FeatureScalePlugin.ts b/packages/layers/src/plugins/FeatureScalePlugin.ts index 13977d59d3..a02785cd3e 100644 --- a/packages/layers/src/plugins/FeatureScalePlugin.ts +++ b/packages/layers/src/plugins/FeatureScalePlugin.ts @@ -68,9 +68,6 @@ export default class FeatureScalePlugin implements ILayerPlugin { this.scaleOptions = layer.getScaleOptions(); const attributes = styleAttributeService.getLayerStyleAttributes(); const { dataArray } = layer.getSource().data; - // if (dataArray.length === 0) { - // return; - // } this.caculateScalesForAttributes(attributes || [], dataArray); layer.layerModelNeedUpdate = true; return true; diff --git a/packages/layers/src/plugins/LayerStylePlugin.ts b/packages/layers/src/plugins/LayerStylePlugin.ts index 56395c1ebd..aa02a8b6df 100644 --- a/packages/layers/src/plugins/LayerStylePlugin.ts +++ b/packages/layers/src/plugins/LayerStylePlugin.ts @@ -1,5 +1,4 @@ import { ILayer, ILayerPlugin, IMapService, TYPES } from '@antv/l7-core'; -import Source from '@antv/l7-source'; import { encodePickingColor, rgb2arr } from '@antv/l7-utils'; import { injectable } from 'inversify'; import 'reflect-metadata'; diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts index 973d07245e..03d1506cd7 100644 --- a/packages/layers/src/point/models/text.ts +++ b/packages/layers/src/point/models/text.ts @@ -384,7 +384,7 @@ export default class TextModel extends BaseModel { const characterSet: string[] = []; data.forEach((item: IEncodeFeature) => { let { shape = '' } = item; - shape = shape.toString(); + shape = `${shape}`; if (characterSet.indexOf(shape) === -1) { characterSet.push(shape); } diff --git a/packages/source/src/source.ts b/packages/source/src/source.ts index ad2774bb2f..95b186c1a1 100644 --- a/packages/source/src/source.ts +++ b/packages/source/src/source.ts @@ -25,7 +25,7 @@ import { cloneDeep, isFunction, isString, mergeWith } from 'lodash'; // @ts-ignore // tslint:disable-next-line:no-submodule-imports import Supercluster from 'supercluster/dist/supercluster'; -import { getParser, getTransform } from './'; +import { getParser, getTransform } from './factory'; import { cluster } from './transform/cluster'; import { statMap } from './utils/statistics'; import { getColumn } from './utils/util';