fix: fixed a naming typo

This commit is contained in:
owen.wjh 2021-09-06 17:08:55 +08:00
parent e0fb9d8ac8
commit 68d4ab9032
4 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@ import { aProjectFlat, lngLatToMeters } from '@antv/l7-utils';
import earcut from 'earcut';
import { vec3 } from 'gl-matrix';
import ExtrudePolyline from '../utils/extrude_polyline';
import { calculteCentroid } from '../utils/geo';
import { calculateCentroid } from '../utils/geo';
import extrudePolygon, {
extrude_PolygonNormal,
fillPolygon,
@ -24,8 +24,9 @@ const GeometryCache: IGeometryCache = {};
* 2D
* @param feature feature
*/
export function PointFillTriangulation(feature: IEncodeFeature) {
const coordinates = calculteCentroid(feature.coordinates);
const coordinates = calculateCentroid(feature.coordinates);
return {
vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates],
indices: [0, 1, 2, 2, 3, 0],
@ -57,7 +58,7 @@ export function PointExtrudeTriangulation(feature: IEncodeFeature) {
* @param feature feature
*/
export function PointImageTriangulation(feature: IEncodeFeature) {
const coordinates = calculteCentroid(feature.coordinates);
const coordinates = calculateCentroid(feature.coordinates);
return {
vertices: [...coordinates],
indices: [0],

View File

@ -2,7 +2,7 @@ import { AttributeType, gl, IEncodeFeature, IModel } from '@antv/l7-core';
import { isNumber } from 'lodash';
import BaseModel, { styleOffset, styleSingle } from '../../core/BaseModel';
import { PointExtrudeTriangulation } from '../../core/triangulation';
import { calculteCentroid } from '../../utils/geo';
import { calculateCentroid } from '../../utils/geo';
import pointExtrudeFrag from '../shaders/extrude_frag.glsl';
import pointExtrudeVert from '../shaders/extrude_vert.glsl';
interface IPointLayerStyleOptions {
@ -151,7 +151,7 @@ export default class ExtrudeModel extends BaseModel {
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
const coordinates = calculteCentroid(feature.coordinates);
const coordinates = calculateCentroid(feature.coordinates);
return [coordinates[0], coordinates[1], 0];
},
},

View File

@ -17,7 +17,7 @@ import BaseModel, {
styleSingle,
} from '../../core/BaseModel';
import CollisionIndex from '../../utils/collision-index';
import { calculteCentroid } from '../../utils/geo';
import { calculateCentroid } from '../../utils/geo';
import {
anchorType,
getGlyphQuads,
@ -429,18 +429,18 @@ export default class TextModel extends BaseModel {
feature.glyphQuads = glyphQuads;
// feature.centroid = calculteCentroid(coordinates);
feature.centroid = calculteCentroid(feature.coordinates);
feature.centroid = calculateCentroid(feature.coordinates);
// 此时地图高德2.0 originCentroid == centroid
feature.originCentroid =
feature.version === 'GAODE2.x'
? calculteCentroid(feature.originCoordinates)
? calculateCentroid(feature.originCoordinates)
: (feature.originCentroid = feature.centroid);
this.glyphInfoMap[id as number] = {
shaping,
glyphQuads,
centroid: calculteCentroid(feature.coordinates),
centroid: calculateCentroid(feature.coordinates),
};
return feature;
});

View File

@ -1,6 +1,6 @@
type Position = number[];
import { isNumber } from 'lodash';
export function calculteCentroid(
export function calculateCentroid(
coord: Position | Position[] | Position[][],
): Position {
// let pos = coord as Position;