Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add point-geometry and vector-tile types #800

Merged
merged 4 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/benchmarks/query_box.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Benchmark from '../lib/benchmark';
import createMap from '../lib/create_map';
import type Map from '../../src/ui/map';
import {PointLike} from '../../src/util/point';
import type {PointLike} from '../../src/ui/camera';

const width = 1024;
const height = 768;
Expand Down
2 changes: 1 addition & 1 deletion build/generate-struct-arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ fs.writeFileSync('src/data/array_types.ts',
import assert from 'assert';
import {Struct, StructArray} from '../util/struct_array';
import {register} from '../util/web_worker_transfer';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';

${layouts.map(emitStructArrayLayout).join('\n')}
${arraysWithStructAccessors.map(emitStructArray).join('\n')}
Expand Down
9 changes: 0 additions & 9 deletions build/post-ts-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ child_process.execSync(`dts-bundle-generator --no-check --umd-module-name=maplib
let types = fs.readFileSync(outputFile, 'utf8');
// Classes are not exported but should be since this is exported as UMD - fixing...
types = types.replace(/declare class/g, "export declare class");
// Missing vector-tile types that are added to this file too
let file = fs.readFileSync("./src/types/packages-types/vector-tile/index.d.ts", 'utf8');
let lines = file.split("\n").filter(Boolean);
lines.pop(); // last } is removed too.
types = lines.join("\n") + "\n" + types;
// remove imports of vector-tile and declare module lines
types = types.split("\n")
.filter(l => !l.includes("@mapbox/vector-tile"))
.join("\n");
HarelM marked this conversation as resolved.
Show resolved Hide resolved
fs.writeFileSync(outputFile, types);
console.log(`Finished bundling types`);

Expand Down
46 changes: 40 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
"@mapbox/geojson-rewind": "^0.5.0",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^2.0.1",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^2.0.4",
"@mapbox/unitbezier": "^0.0.1",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"@types/geojson": "^7946.0.7",
"@types/mapbox__point-geometry": "^0.1.2",
"@types/mapbox__vector-tile": "^1.3.0",
"@types/pbf": "^3.0.2",
"csscolorparser": "~1.0.3",
"earcut": "^2.2.2",
Expand Down Expand Up @@ -57,7 +61,6 @@
"@types/earcut": "^2.1.1",
"@types/ejs": "^3.1.0",
"@types/eslint": "^8.2.1",
"@types/geojson": "^7946.0.7",
"@types/gl": "^4.1.0",
"@types/glob": "^7.1.3",
"@types/jest": "^27.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/data/array_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import assert from 'assert';
import {Struct, StructArray} from '../util/struct_array';
import {register} from '../util/web_worker_transfer';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';

/**
* Implementation of the StructArray layout:
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {FeatureStates} from '../source/source_state';
import type {ImagePosition} from '../render/image_atlas';
import type {CanonicalTileID} from '../source/tile_id';
import type {VectorTileFeature, VectorTileLayer} from '@mapbox/vector-tile';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';

export type BucketParameters<Layer extends TypedStyleLayer> = {
index: number;
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/circle_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer'
import type Context from '../../gl/context';
import type IndexBuffer from '../../gl/index_buffer';
import type VertexBuffer from '../../gl/vertex_buffer';
import type Point from '../../util/point';
import type Point from '@mapbox/point-geometry';
import type {FeatureStates} from '../../source/source_state';
import type {ImagePosition} from '../../render/image_atlas';
import type {VectorTileLayer} from '@mapbox/vector-tile';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/fill_bucket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs';
import path from 'path';
import Protobuf from 'pbf';
import {VectorTile} from '@mapbox/vector-tile';
import Point from '../../util/point';
import Point from '@mapbox/point-geometry';
import segment from '../segment';
import FillBucket from './fill_bucket';
import FillStyleLayer from '../../style/style_layer/fill_style_layer';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/fill_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type FillStyleLayer from '../../style/style_layer/fill_style_layer';
import type Context from '../../gl/context';
import type IndexBuffer from '../../gl/index_buffer';
import type VertexBuffer from '../../gl/vertex_buffer';
import type Point from '../../util/point';
import type Point from '@mapbox/point-geometry';
import type {FeatureStates} from '../../source/source_state';
import type {ImagePosition} from '../../render/image_atlas';
import type {VectorTileLayer} from '@mapbox/vector-tile';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/fill_extrusion_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion
import type Context from '../../gl/context';
import type IndexBuffer from '../../gl/index_buffer';
import type VertexBuffer from '../../gl/vertex_buffer';
import type Point from '../../util/point';
import type Point from '@mapbox/point-geometry';
import type {FeatureStates} from '../../source/source_state';
import type {ImagePosition} from '../../render/image_atlas';
import type {VectorTileLayer} from '@mapbox/vector-tile';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/line_bucket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import Protobuf from 'pbf';
import {VectorTile} from '@mapbox/vector-tile';
import Point from '../../util/point';
import Point from '@mapbox/point-geometry';
import segment from '../segment';
import LineBucket from './line_bucket';
import LineStyleLayer from '../../style/style_layer/line_style_layer';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/line_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
PopulateParameters
} from '../bucket';
import type LineStyleLayer from '../../style/style_layer/line_style_layer';
import type Point from '../../util/point';
import type Point from '@mapbox/point-geometry';
import type {Segment} from '../segment';
import {RGBAImage} from '../../util/image';
import type Context from '../../gl/context';
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/symbol_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {SymbolLayoutArray,
SymbolLineVertexArray
} from '../array_types';

import Point from '../../util/point';
import Point from '@mapbox/point-geometry';
import SegmentVector from '../segment';
import {ProgramConfigurationSet} from '../program_configuration';
import {TriangleIndexArray, LineIndexArray} from '../index_array_type';
Expand Down
2 changes: 1 addition & 1 deletion src/data/evaluation_feature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import loadGeometry from './load_geometry';
import type Point from '../util/point';
import type Point from '@mapbox/point-geometry';
import type {VectorTileFeature} from '@mapbox/vector-tile';

type EvaluationFeature = {
Expand Down
2 changes: 1 addition & 1 deletion src/data/feature_index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import loadGeometry from './load_geometry';
import toEvaluationFeature from './evaluation_feature';
import EXTENT from './extent';
Expand Down
2 changes: 1 addition & 1 deletion src/data/load_geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {warnOnce, clamp} from '../util/util';

import EXTENT from './extent';

import type Point from '../util/point';
import type Point from '@mapbox/point-geometry';
import type {VectorTileFeature} from '@mapbox/vector-tile';

// These bounds define the minimum and maximum supported coordinate values.
Expand Down
2 changes: 1 addition & 1 deletion src/geo/edge_insets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {number} from '../style-spec/util/interpolate';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import {clamp} from '../util/util';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/geo/transform.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import Transform from './transform';
import LngLat from './lng_lat';
import {OverscaledTileID, CanonicalTileID} from '../source/tile_id';
Expand Down
2 changes: 1 addition & 1 deletion src/geo/transform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LngLat from './lng_lat';
import LngLatBounds from './lng_lat_bounds';
import MercatorCoordinate, {mercatorXfromLng, mercatorYfromLat, mercatorZfromAltitude} from './mercator_coordinate';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import {wrap, clamp} from '../util/util';
import {number as interpolate} from '../style-spec/util/interpolate';
import EXTENT from '../data/extent';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Marker from './ui/marker';
import Style from './style/style';
import LngLat from './geo/lng_lat';
import LngLatBounds from './geo/lng_lat_bounds';
import Point from './util/point';
import Point from '@mapbox/point-geometry';
import MercatorCoordinate from './geo/mercator_coordinate';
import {Evented} from './util/evented';
import config from './util/config';
Expand Down
2 changes: 1 addition & 1 deletion src/render/draw_symbol.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import drawCollisionDebug from './draw_collision_debug';

import SegmentVector from '../data/segment';
Expand Down
2 changes: 1 addition & 1 deletion src/source/geojson_wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Point from '../util/point';
import Point from '@mapbox/point-geometry';

import mvt from '@mapbox/vector-tile';
import type {VectorTileFeature, VectorTileLayer, VectorTile} from '@mapbox/vector-tile';
Expand Down
2 changes: 1 addition & 1 deletion src/source/query_features.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from './query_features';
import SourceCache from './source_cache';
import Transform from '../geo/transform';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import Dispatcher from '../util/dispatcher';

describe('QueryFeatures#rendered', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/source/query_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type CollisionIndex from '../symbol/collision_index';
import type Transform from '../geo/transform';
import type {RetainedQueryData} from '../symbol/placement';
import type {FilterSpecification} from '../style-spec/types';
import type Point from '../util/point';
import type Point from '@mapbox/point-geometry';
import assert from 'assert';
import {mat4} from 'gl-matrix';

Expand Down
2 changes: 1 addition & 1 deletion src/source/source_cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Tile from './tile';
import {OverscaledTileID} from './tile_id';
import Transform from '../geo/transform';
import LngLat from '../geo/lng_lat';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import {Event, ErrorEvent, Evented} from '../util/evented';
import {extend} from '../util/util';
import browser from '../util/browser';
Expand Down
2 changes: 1 addition & 1 deletion src/source/source_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MercatorCoordinate from '../geo/mercator_coordinate';
import {keysDifference} from '../util/util';
import EXTENT from '../data/extent';
import Context from '../gl/context';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import browser from '../util/browser';
import {OverscaledTileID} from './tile_id';
import assert from 'assert';
Expand Down
2 changes: 1 addition & 1 deletion src/source/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type Transform from '../geo/transform';
import type {LayerFeatureStates} from './source_state';
import type {Cancelable} from '../types/cancelable';
import type {FilterSpecification} from '../style-spec/types';
import type Point from '../util/point';
import type Point from '@mapbox/point-geometry';
import {mat4} from 'gl-matrix';
import type {VectorTileLayer} from '@mapbox/vector-tile';

Expand Down
2 changes: 1 addition & 1 deletion src/source/tile_id.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getTileBBox} from '@mapbox/whoots-js';
import EXTENT from '../data/extent';
import Point from '../util/point';
import Point from '@mapbox/point-geometry';
import MercatorCoordinate from '../geo/mercator_coordinate';

import assert from 'assert';
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/expression/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {Result} from '../util/result';
import type {InterpolationType} from './definitions/interpolate';
import type {PropertyValueSpecification} from '../types';
import type {FormattedSection} from './types/formatted';
import type Point from '../../util/point';
import type Point from '@mapbox/point-geometry';
import type {CanonicalTileID} from '../../source/tile_id';

export type Feature = {
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/feature_filter/feature_filter.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {default as createFilter, isExpressionFilter} from '.';

import convertFilter from './convert';
import Point from '../../util/point';
import Point from '@mapbox/point-geometry';
import MercatorCoordinate from '../../geo/mercator_coordinate';
import EXTENT from '../../data/extent';
import {CanonicalTileID} from '../../source/tile_id';
Expand Down
2 changes: 1 addition & 1 deletion src/style/query_utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Point from '../util/point';
import Point from '@mapbox/point-geometry';

import type {PossiblyEvaluatedPropertyValue} from './properties';
import type StyleLayer from '../style/style_layer';
Expand Down
2 changes: 1 addition & 1 deletion src/style/style_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {supportsPropertyExpression} from '../style-spec/util/properties';

import type {FeatureState} from '../style-spec/expression';
import type {Bucket} from '../data/bucket';
import type Point from '../util/point';
import type Point from '@mapbox/point-geometry';
import type {FeatureFilter} from '../style-spec/feature_filter';
import type {TransitionParameters, PropertyValue} from './properties';
import EvaluationParameters from './evaluation_parameters';
Expand Down
Loading