Skip to content

Commit

Permalink
some tweak (#2315)
Browse files Browse the repository at this point in the history
* some tweak

* update
  • Loading branch information
deyihu authored May 10, 2024
1 parent 8b10f8d commit 29cd832
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/GlobalConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getGlobalThis } from "./core/util/env";

/**
* global config
* idle/worker etc
Expand All @@ -8,13 +10,13 @@ const GlobalConfig = {
//idle logging
idleLog: false,
//idle 时间阈值
idleTimeRemaining: 8,
idleTimeRemaining: 4,
//idle 申请不到idle时,强制执行时间阈值
idleForceTimeThreshold: 100,
//idle 超时阈值
idleTimeout: 1000,
//worker 数量
workerCount: ((window as any).MAPTALKS_WORKER_COUNT) as number || 0,
workerCount: (getGlobalThis().MAPTALKS_WORKER_COUNT) as number || 0,
//每个Worker Message中封装的task message数量
taskCountPerWorkerMessage: 5,
//当前运行环境的最大FPS,用户可以手动配置,否则将自动检测并赋值,为地图锁帧渲染准备
Expand Down
4 changes: 4 additions & 0 deletions src/core/Error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const GEOMETRY_NOT_FIND_PROJECTION = 'not find Geometry\' Projection. please add Geometry to Layer and add Layer to Map';
/**
* other error
*/
2 changes: 1 addition & 1 deletion src/geometry/Ellipse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function quarticIn(k: number) {

function angleT(numberOfShellPoints: number) {
//利用曲线方程,让角度的变化变成非线性
const fs: number[] = [0];
const fs: number[] = [];
// [0,90] 变化曲线
const ts1: number[] = [];
for (let i = 0; i < numberOfShellPoints; i++) {
Expand Down
5 changes: 5 additions & 0 deletions src/geometry/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import simplify from 'simplify-js';
import Point from '../geo/Point';
import { CommonProjectionType } from '../geo/projection';
import { FillSymbol, LineSymbol } from '../symbol';
import { GEOMETRY_NOT_FIND_PROJECTION } from '../core/Error';

/**
* @property {Object} options - configuration options
Expand Down Expand Up @@ -99,6 +100,10 @@ export class Path extends Geometry {
const isPolygon = !!this.getShell;
const animCoords = isPolygon ? this.getShell().concat(this.getShell()[0]) : coordinates;
const projection = this._getProjection();
if (!projection) {
console.error(GEOMETRY_NOT_FIND_PROJECTION);
return;
}

const prjAnimCoords = projection.projectCoords(animCoords, this.options['antiMeridian']) as Coordinate[];

Expand Down
6 changes: 6 additions & 0 deletions src/geometry/ext/Geometry.Animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { extendSymbol } from '../../core/util/style';
import { Animation, AnimationOptionsType, Frame, Player } from '../../core/Animation';
import Coordinate from '../../geo/Coordinate';
import Geometry from '../Geometry';
import { GEOMETRY_NOT_FIND_PROJECTION } from '../../core/Error';

type AnimationStyles = { [key: string]: any };

Expand Down Expand Up @@ -72,6 +73,11 @@ Geometry.include(/** @lends Geometry.prototype */ {
options['framer'] = framer;
}

if (!projection && isFocusing) {
console.error(GEOMETRY_NOT_FIND_PROJECTION);
return;
}

const player: any = Animation.animate(stylesToAnimate, options, frame => {
if (map && map.isRemoved()) {
player.finish();
Expand Down

0 comments on commit 29cd832

Please sign in to comment.