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

refacto: migrate Crs to typescript #2436

Merged
merged 8 commits into from
Nov 27, 2024
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --file test/unit/bootstrap.js --import=./config/babel-register/register.mjs",
"build": "cross-env NODE_ENV=production webpack",
"build-dev": "cross-env NODE_ENV=development webpack",
"transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib",
"transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib --extensions .js,.ts",
"start": "cross-env NODE_ENV=development webpack serve",
"start-https": "cross-env NODE_ENV=development webpack serve --https",
"debug": "cross-env noInline=true npm start",
"prepublishOnly": "npm run build && npm run transpile",
"prepare": "cross-env NO_UPDATE_NOTIFIER=true node ./config/prepare.mjs && node ./config/replace.config.mjs",
"watch": "cross-env BABEL_DISABLE_CACHE=1 babel --watch src --out-dir lib",
"watch": "npm run transpile -- --watch",
jailln marked this conversation as resolved.
Show resolved Hide resolved
"changelog": "conventional-changelog -n ./config/conventionalChangelog/config.cjs -i changelog.md -s",
"bump": "if [ -z $npm_config_level ]; then grunt bump:minor; else grunt bump:$npm_config_level; fi && npm run changelog && npm install && git add -A && git commit --amend --no-edit",
"publish-next": "npm version prerelease --preid next && npm publish --access public --tag=next --provenance",
Expand Down
3 changes: 1 addition & 2 deletions src/Converter/Feature2Mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FEATURE_TYPES } from 'Core/Feature';
import ReferLayerProperties from 'Layer/ReferencingLayerProperties';
import { deprecatedFeature2MeshOptions } from 'Core/Deprecated/Undeprecator';
import Extent from 'Core/Geographic/Extent';
import Crs from 'Core/Geographic/Crs';
import OrientationUtils from 'Utils/OrientationUtils';
import Coordinates from 'Core/Geographic/Coordinates';
import Style, { StyleContext } from 'Core/Style';
Expand Down Expand Up @@ -64,7 +63,7 @@ class FeatureMesh extends THREE.Group {
} else {
// calculate the scale transformation to transform the feature.extent
// to feature.extent.as(crs)
coord.crs = Crs.formatToEPSG(this.#originalCrs);
coord.crs = this.#originalCrs;
// TODO: An extent here could be either a geographic extent (for
// features from WFS) or a tiled extent (for features from MVT).
// Unify both behavior.
Expand Down
3 changes: 1 addition & 2 deletions src/Converter/textureConverter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as THREE from 'three';
import Feature2Texture from 'Converter/Feature2Texture';
import Extent from 'Core/Geographic/Extent';
import CRS from 'Core/Geographic/Crs';

const extentTexture = new Extent('EPSG:4326', [0, 0, 0, 0]);

Expand All @@ -27,7 +26,7 @@ export default {
new THREE.Color(backgroundLayer.paint['background-color']) :
undefined;

destinationTile.toExtent(CRS.formatToEPSG(layer.crs), extentTexture);
destinationTile.toExtent(layer.crs, extentTexture);
texture = Feature2Texture.createTextureFromFeature(data, extentTexture, layer.subdivisionThreshold, layer.style, backgroundColor);
texture.features = data;
texture.extent = destinationTile;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Feature.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as THREE from 'three';
import Extent from 'Core/Geographic/Extent';
import Coordinates from 'Core/Geographic/Coordinates';
import CRS from 'Core/Geographic/Crs';
import Style from 'Core/Style';

function defaultExtent(crs) {
Expand Down Expand Up @@ -347,7 +346,7 @@ export class FeatureCollection extends THREE.Object3D {
constructor(options) {
super();
this.isFeatureCollection = true;
this.crs = CRS.formatToEPSG(options.accurate || !options.source?.crs ? options.crs : options.source.crs);
this.crs = options.accurate || !options.source?.crs ? options.crs : options.source.crs;
this.features = [];
this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures;
this.size = options.structure == '3d' ? 3 : 2;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Geographic/Coordinates.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as THREE from 'three';
import proj4 from 'proj4';
import CRS from 'Core/Geographic/Crs';
import * as CRS from 'Core/Geographic/Crs';
import Ellipsoid from 'Core/Math/Ellipsoid';

proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
Expand Down
191 changes: 0 additions & 191 deletions src/Core/Geographic/Crs.js

This file was deleted.

Loading