Skip to content

Commit

Permalink
refactor(exports): remove default exports
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloTheDrunk committed Oct 22, 2024
1 parent b1ebae8 commit c131f60
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 25 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = {
devDependencies: ['test/**', 'tests/**', 'examples/**'],
}], */
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',

// TODO reactivate all the following rules

Expand Down Expand Up @@ -95,9 +96,9 @@ module.exports = {
'error',
'ignorePackages',
{
'js': 'never',
'ts': 'never',
'tsx': 'never',
js: 'never',
ts: 'never',
tsx: 'never',
},
],
camelcase: 'off',
Expand Down
2 changes: 1 addition & 1 deletion src/Converter/convertToTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as THREE from 'three';
import TileMesh from 'Core/TileMesh';
import LayeredMaterial from 'Renderer/LayeredMaterial';
import newTileGeometry from 'Core/Prefab/TileBuilder';
import { newTileGeometry } from 'Core/Prefab/TileBuilder';
import ReferLayerProperties from 'Layer/ReferencingLayerProperties';
import { geoidLayerIsVisible } from 'Layer/GeoidLayer';

Expand Down
7 changes: 3 additions & 4 deletions src/Core/Prefab/Globe/BuilderEllipsoidTile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export interface GlobeTileBuilderParams extends TileBuilderParams {
quatNormalToZ: THREE.Quaternion;
}

class BuilderEllipsoidTile implements TileBuilder<GlobeTileBuilderParams> {
export class GlobeTileBuilder
implements TileBuilder<GlobeTileBuilderParams> {
private _crs: string;
private _transform: {
coords: Coordinates[];
Expand Down Expand Up @@ -63,7 +64,7 @@ class BuilderEllipsoidTile implements TileBuilder<GlobeTileBuilderParams> {
// Offset: Float row coordinate from Pseudo mercator coordinates
// EPSG:3857
if (options.uvCount > 1) {
this.computeExtraOffset = BuilderEllipsoidTile._computeExtraOffset;
this.computeExtraOffset = GlobeTileBuilder._computeExtraOffset;
}
}

Expand Down Expand Up @@ -167,5 +168,3 @@ class BuilderEllipsoidTile implements TileBuilder<GlobeTileBuilderParams> {
};
}
}

export default BuilderEllipsoidTile;
4 changes: 2 additions & 2 deletions src/Core/Prefab/Globe/GlobeLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as THREE from 'three';
import TiledGeometryLayer from 'Layer/TiledGeometryLayer';
import { ellipsoidSizes } from 'Core/Math/Ellipsoid';
import { globalExtentTMS, schemeTiles } from 'Core/Tile/TileGrid';
import BuilderEllipsoidTile from 'Core/Prefab/Globe/BuilderEllipsoidTile';
import { GlobeTileBuilder } from 'Core/Prefab/Globe/BuilderEllipsoidTile';
import CRS from 'Core/Geographic/Crs';

// matrix to convert sphere to ellipsoid
Expand Down Expand Up @@ -57,7 +57,7 @@ class GlobeLayer extends TiledGeometryLayer {
CRS.tms_3857,
];
const uvCount = config.tileMatrixSets.length;
const builder = new BuilderEllipsoidTile({ crs: 'EPSG:4978', uvCount });
const builder = new GlobeTileBuilder({ crs: 'EPSG:4978', uvCount });

super(id, object3d || new THREE.Group(), schemeTile, builder, config);

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Prefab/Planar/PlanarLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as THREE from 'three';
import TiledGeometryLayer from 'Layer/TiledGeometryLayer';
import { globalExtentTMS } from 'Core/Tile/TileGrid';
import CRS from 'Core/Geographic/Crs';
import PlanarTileBuilder from './PlanarTileBuilder';
import { PlanarTileBuilder } from './PlanarTileBuilder';

/**
* @property {boolean} isPlanarLayer - Used to checkout whether this layer is a
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Prefab/Planar/PlanarTileBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface PlanarTileBuilderParams extends TileBuilderParams {
nbRow: number;
}

class PlanarTileBuilder implements TileBuilder<PlanarTileBuilderParams> {
export class PlanarTileBuilder implements TileBuilder<PlanarTileBuilderParams> {
private _uvCount: number;
private _transform: Transform;
private _crs: string;
Expand Down Expand Up @@ -110,5 +110,3 @@ class PlanarTileBuilder implements TileBuilder<PlanarTileBuilderParams> {
};
}
}

export default PlanarTileBuilder;
6 changes: 3 additions & 3 deletions src/Core/Prefab/TileBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as THREE from 'three';
import TileGeometry from 'Core/TileGeometry';
import { TileGeometry } from 'Core/TileGeometry';
import Cache from 'Core/Scheduler/Cache';
import computeBuffers from 'Core/Prefab/computeBufferTileGeometry';
import { computeBuffers } from 'Core/Prefab/computeBufferTileGeometry';
import OBB from 'Renderer/OBB';
import type Extent from 'Core/Geographic/Extent';

Expand Down Expand Up @@ -73,7 +73,7 @@ export interface TileBuilder<SpecializedParams extends TileBuilderParams> {
computeShareableExtent(extent: Extent): ShareableExtent;
}

export default function newTileGeometry(
export function newTileGeometry(
builder: TileBuilder<TileBuilderParams>,
params: TileBuilderParams,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Prefab/computeBufferTileGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type ComputeUvs =
[typeof computeUv0 | (() => void), ReturnType<typeof initComputeUv1>?];

// TODO: Split this even further into subfunctions
export default function computeBuffers(
export function computeBuffers(
builder: TileBuilder<TileBuilderParams>,
params: TileBuilderParams,
) {
Expand Down
6 changes: 2 additions & 4 deletions src/Core/TileGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
import computeBuffers, { getBufferIndexSize }
import { computeBuffers, getBufferIndexSize }
from 'Core/Prefab/computeBufferTileGeometry';
import { GpuBufferAttributes, Projected, TileBuilder, TileBuilderParams }
from './Prefab/TileBuilder';
Expand Down Expand Up @@ -45,7 +45,7 @@ function defaultBuffers(
return bufferAttributes;
}

class TileGeometry extends THREE.BufferGeometry {
export class TileGeometry extends THREE.BufferGeometry {
public OBB: unknown;
public extent: Extent;
public segments: number;
Expand Down Expand Up @@ -148,5 +148,3 @@ class TileGeometry extends THREE.BufferGeometry {
}
}
}

export default TileGeometry;
6 changes: 3 additions & 3 deletions src/Renderer/OBB.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as THREE from 'three';
import TileGeometry from 'Core/TileGeometry';
import BuilderEllipsoidTile from 'Core/Prefab/Globe/BuilderEllipsoidTile';
import { TileGeometry } from 'Core/TileGeometry';
import { GlobeTileBuilder } from 'Core/Prefab/Globe/BuilderEllipsoidTile';
import Coordinates from 'Core/Geographic/Coordinates';
import CRS from 'Core/Geographic/Crs';

// get oriented bounding box of tile
const builder = new BuilderEllipsoidTile({ crs: 'EPSG:4978', uvCount: 1 });
const builder = new GlobeTileBuilder({ crs: 'EPSG:4978', uvCount: 1 });
const size = new THREE.Vector3();
const dimension = new THREE.Vector2();
const center = new THREE.Vector3();
Expand Down

0 comments on commit c131f60

Please sign in to comment.