From 8241f5a87265525e0218be7f7507aef3524c3429 Mon Sep 17 00:00:00 2001 From: "@thinkinggis" Date: Thu, 15 Dec 2022 19:54:15 +0800 Subject: [PATCH] Fix token warn (#1540) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 文本更新 * fix: iconfont 更新 * fix: 移除console * docs: scene 增加 setzoom * fix: 地图实例demo * fix: polygon triangle * fix: polygon triangle dimensions * fix: 高德地图v2 坐标转换 * fix: 地图token 警告提醒 * fix: 标准化警告文案 * fix: lint error --- packages/core/src/services/config/warnInfo.ts | 2 +- packages/maps/src/amap2/map.ts | 6 ++++++ packages/maps/src/utils/amap/AMapBaseService.ts | 2 +- packages/utils/src/workers/triangulation.ts | 10 ++++------ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/core/src/services/config/warnInfo.ts b/packages/core/src/services/config/warnInfo.ts index 6337797d1c..bb8e28acce 100644 --- a/packages/core/src/services/config/warnInfo.ts +++ b/packages/core/src/services/config/warnInfo.ts @@ -5,7 +5,7 @@ export interface IWarnInfo { } const WarnInfo: IWarnInfo = { MapToken: - '您正在使用 Demo测试地图token,如果生产环境中使用去对应地图请注册Token', + '您正在使用 Demo 测试 Token, 生产环境务必自行注册 Token 确保服务稳定', SDK: '请确认引入了mapbox-gl api且在L7之前引入', }; diff --git a/packages/maps/src/amap2/map.ts b/packages/maps/src/amap2/map.ts index a3bfcf7538..3bcdb24a78 100644 --- a/packages/maps/src/amap2/map.ts +++ b/packages/maps/src/amap2/map.ts @@ -283,6 +283,12 @@ export default class AMapService extends AMapBaseService { // 高德地图在相同大小下需要比 MapBox 多一个 zoom 层级 mapConstructorOptions.zoom += 1; } + if (token === AMAP_API_KEY) { + console.warn( + `%c${this.configService.getSceneWarninfo('MapToken')}!`, + 'color: #873bf4;font-weigh:900;font-size: 16px;', + ); + } // @ts-ignore const map = new AMap.Map(this.$mapContainer, mapConstructorOptions); // @ts-ignore diff --git a/packages/maps/src/utils/amap/AMapBaseService.ts b/packages/maps/src/utils/amap/AMapBaseService.ts index 0ce9188518..350c56245f 100644 --- a/packages/maps/src/utils/amap/AMapBaseService.ts +++ b/packages/maps/src/utils/amap/AMapBaseService.ts @@ -411,7 +411,7 @@ export default abstract class AMapBaseService }; if (!amapLoaded && !mapInstance) { if (token === AMAP_API_KEY) { - console.warn(this.configService.getSceneWarninfo('MapToken')); + console.warn(`%c${this.configService.getSceneWarninfo('MapToken')}!`,'color: #873bf4;font-weigh:900;font-size: 16px;'); } amapLoaded = true; plugin.push('Map3D'); diff --git a/packages/utils/src/workers/triangulation.ts b/packages/utils/src/workers/triangulation.ts index 3f5bc8f69c..716887a2c2 100644 --- a/packages/utils/src/workers/triangulation.ts +++ b/packages/utils/src/workers/triangulation.ts @@ -83,17 +83,15 @@ export function polygonFillTriangulation(feature: IEncodeFeature) { } function project_y(y: number) { - - if(y > 85 || y<-85) { - return y + if (y > 85 || y < -85) { + return y; } return Math.log(Math.tan((Math.PI * y) / 360)); } function un_project_y(y: number) { - - if(y > 85 || y<-85) { - return y + if (y > 85 || y < -85) { + return y; } return (Math.atan(Math.exp(y)) * 360) / Math.PI; }