Skip to content

Commit

Permalink
Type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Dec 26, 2022
1 parent 3071734 commit 7da4525
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 40 deletions.
4 changes: 3 additions & 1 deletion build/Main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ export { HeightDebugProvider } from './providers/HeightDebugProvider';
export { MapNodeGeometry } from './geometries/MapNodeGeometry';
export { MapNodeHeightGeometry } from './geometries/MapNodeHeightGeometry';
export { MapSphereNodeGeometry } from './geometries/MapSphereNodeGeometry';
export { MapHeightNode } from './nodes/MapHeightNode';
export { MapNode } from './nodes/MapNode';
export { MapHeightNode } from './nodes/MapHeightNode';
export { MapPlaneNode } from './nodes/MapPlaneNode';
export { MapSphereNode } from './nodes/MapSphereNode';
export { MapHeightNodeShader } from './nodes/MapHeightNodeShader';
export { UnitsUtils } from './utils/UnitsUtils';
export { CanvasUtils } from './utils/CanvasUtils';
export { Geolocation } from './utils/Geolocation';
export { GeolocationUtils } from './utils/GeolocationUtils';
export { CancelablePromise } from './utils/CancelablePromise';
export { XHRUtils } from './utils/XHRUtils';
export { TextureUtils } from './utils/TextureUtils';
1 change: 1 addition & 0 deletions build/examples/providers.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions build/examples/transition.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
20 changes: 10 additions & 10 deletions build/geo-three.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var three = require('three');

/*! *****************************************************************************
Expand Down Expand Up @@ -388,7 +386,7 @@ class UnitsUtils {
return new three.Vector3(-Math.cos(rotX + Math.PI) * cos, Math.sin(rotY), Math.sin(rotX + Math.PI) * cos);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
return (color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1 - 10000.0;
}
}
UnitsUtils.EARTH_RADIUS = 6371008;
Expand Down Expand Up @@ -1616,14 +1614,14 @@ class GoogleMapsProvider extends MapProvider {
}

class HereMapsProvider extends MapProvider {
constructor(appId, appCode, style, scheme, format, size) {
constructor(appId = '', appCode = '', style = 'base', scheme = 'normal.day', format = 'png', size = 512) {
super();
this.appId = appId !== undefined ? appId : '';
this.appCode = appCode !== undefined ? appCode : '';
this.style = style !== undefined ? style : 'base';
this.scheme = scheme !== undefined ? scheme : 'normal.day';
this.format = format !== undefined ? format : 'png';
this.size = size !== undefined ? size : 512;
this.appId = appId;
this.appCode = appCode;
this.style = style;
this.scheme = scheme;
this.format = format;
this.size = size;
this.version = 'newest';
this.server = 1;
}
Expand Down Expand Up @@ -1905,6 +1903,7 @@ class CancelablePromise {

exports.BingMapsProvider = BingMapsProvider;
exports.CancelablePromise = CancelablePromise;
exports.CanvasUtils = CanvasUtils;
exports.DebugProvider = DebugProvider;
exports.Geolocation = Geolocation;
exports.GeolocationUtils = GeolocationUtils;
Expand All @@ -1928,5 +1927,6 @@ exports.MapTilerProvider = MapTilerProvider;
exports.MapView = MapView;
exports.OpenMapTilesProvider = OpenMapTilesProvider;
exports.OpenStreetMapsProvider = OpenStreetMapsProvider;
exports.TextureUtils = TextureUtils;
exports.UnitsUtils = UnitsUtils;
exports.XHRUtils = XHRUtils;
20 changes: 10 additions & 10 deletions build/geo-three.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
return new three.Vector3(-Math.cos(rotX + Math.PI) * cos, Math.sin(rotY), Math.sin(rotX + Math.PI) * cos);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
return (color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1 - 10000.0;
}
}
UnitsUtils.EARTH_RADIUS = 6371008;
Expand Down Expand Up @@ -1616,14 +1616,14 @@
}

class HereMapsProvider extends MapProvider {
constructor(appId, appCode, style, scheme, format, size) {
constructor(appId = '', appCode = '', style = 'base', scheme = 'normal.day', format = 'png', size = 512) {
super();
this.appId = appId !== undefined ? appId : '';
this.appCode = appCode !== undefined ? appCode : '';
this.style = style !== undefined ? style : 'base';
this.scheme = scheme !== undefined ? scheme : 'normal.day';
this.format = format !== undefined ? format : 'png';
this.size = size !== undefined ? size : 512;
this.appId = appId;
this.appCode = appCode;
this.style = style;
this.scheme = scheme;
this.format = format;
this.size = size;
this.version = 'newest';
this.server = 1;
}
Expand Down Expand Up @@ -1905,6 +1905,7 @@

exports.BingMapsProvider = BingMapsProvider;
exports.CancelablePromise = CancelablePromise;
exports.CanvasUtils = CanvasUtils;
exports.DebugProvider = DebugProvider;
exports.Geolocation = Geolocation;
exports.GeolocationUtils = GeolocationUtils;
Expand All @@ -1928,9 +1929,8 @@
exports.MapView = MapView;
exports.OpenMapTilesProvider = OpenMapTilesProvider;
exports.OpenStreetMapsProvider = OpenStreetMapsProvider;
exports.TextureUtils = TextureUtils;
exports.UnitsUtils = UnitsUtils;
exports.XHRUtils = XHRUtils;

Object.defineProperty(exports, '__esModule', { value: true });

}));
18 changes: 9 additions & 9 deletions build/geo-three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class UnitsUtils {
return new Vector3(-Math.cos(rotX + Math.PI) * cos, Math.sin(rotY), Math.sin(rotX + Math.PI) * cos);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
return (color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1 - 10000.0;
}
}
UnitsUtils.EARTH_RADIUS = 6371008;
Expand Down Expand Up @@ -1612,14 +1612,14 @@ class GoogleMapsProvider extends MapProvider {
}

class HereMapsProvider extends MapProvider {
constructor(appId, appCode, style, scheme, format, size) {
constructor(appId = '', appCode = '', style = 'base', scheme = 'normal.day', format = 'png', size = 512) {
super();
this.appId = appId !== undefined ? appId : '';
this.appCode = appCode !== undefined ? appCode : '';
this.style = style !== undefined ? style : 'base';
this.scheme = scheme !== undefined ? scheme : 'normal.day';
this.format = format !== undefined ? format : 'png';
this.size = size !== undefined ? size : 512;
this.appId = appId;
this.appCode = appCode;
this.style = style;
this.scheme = scheme;
this.format = format;
this.size = size;
this.version = 'newest';
this.server = 1;
}
Expand Down Expand Up @@ -1899,4 +1899,4 @@ class CancelablePromise {
}
}

export { BingMapsProvider, CancelablePromise, DebugProvider, Geolocation, GeolocationUtils, GoogleMapsProvider, HeightDebugProvider, HereMapsProvider, LODFrustum, LODRadial, LODRaycast, MapBoxProvider, MapHeightNode, MapHeightNodeShader, MapNode, MapNodeGeometry, MapNodeHeightGeometry, MapPlaneNode, MapProvider, MapSphereNode, MapSphereNodeGeometry, MapTilerProvider, MapView, OpenMapTilesProvider, OpenStreetMapsProvider, UnitsUtils, XHRUtils };
export { BingMapsProvider, CancelablePromise, CanvasUtils, DebugProvider, Geolocation, GeolocationUtils, GoogleMapsProvider, HeightDebugProvider, HereMapsProvider, LODFrustum, LODRadial, LODRaycast, MapBoxProvider, MapHeightNode, MapHeightNodeShader, MapNode, MapNodeGeometry, MapNodeHeightGeometry, MapPlaneNode, MapProvider, MapSphereNode, MapSphereNodeGeometry, MapTilerProvider, MapView, OpenMapTilesProvider, OpenStreetMapsProvider, TextureUtils, UnitsUtils, XHRUtils };
2 changes: 1 addition & 1 deletion build/providers/HereMapsProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export declare class HereMapsProvider extends MapProvider {
size: number;
version: string;
server: number;
constructor(appId: string, appCode: string, style: string, scheme: string, format: string, size: number);
constructor(appId?: string, appCode?: string, style?: string, scheme?: string, format?: string, size?: number);
nextServer(): void;
getMetaData(): Promise<void>;
fetchTile(zoom: number, x: number, y: number): Promise<any>;
Expand Down
1 change: 0 additions & 1 deletion build/utils/CanvasUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="offscreencanvas" />
export declare class CanvasUtils {
static createOffscreenCanvas(width: number, height: number): (HTMLCanvasElement | OffscreenCanvas);
}
5 changes: 4 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import typescript from '@rollup/plugin-typescript';
export default [
{
input: 'source/Main.ts',

external: ['three'],
plugins: [
typescript({ tsconfig: './tsconfig.json' }),
typescript({
tsconfig: './tsconfig.json'
}),
strip({
functions: ['assert.*', 'debug', 'alert', 'console.*']
})
Expand Down
1 change: 1 addition & 0 deletions rollup.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default [
resolve(),
typescript({
declaration: false

})
],
output: [
Expand Down
5 changes: 2 additions & 3 deletions source/nodes/MapHeightNode.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {LinearFilter, Material, MeshPhongMaterial, BufferGeometry, RGBAFormat, Texture, Vector3, Raycaster, Intersection} from 'three';
import {Material, MeshPhongMaterial, BufferGeometry, Vector3, Raycaster, Intersection} from 'three';
import {MapNodeGeometry} from '../geometries/MapNodeGeometry';
import {MapNode, QuadTreePosition} from './MapNode';
import {MapPlaneNode} from './MapPlaneNode';
import {UnitsUtils} from '../utils/UnitsUtils';
import {MapView} from '../MapView';
import {MapNodeHeightGeometry} from '../geometries/MapNodeHeightGeometry';
import {CanvasUtils} from '../utils/CanvasUtils';
import {TextureUtils} from '../utils/TextureUtils';

/**
* Represents a height map tile node that can be subdivided into other height nodes.
Expand Down Expand Up @@ -131,7 +130,7 @@ export class MapHeightNode extends MapNode

const canvas = CanvasUtils.createOffscreenCanvas(this.geometrySize + 1, this.geometrySize + 1);

const context = canvas.getContext('2d');
const context = canvas.getContext('2d') as CanvasRenderingContext2D;
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, MapHeightNode.tileSize, MapHeightNode.tileSize, 0, 0, canvas.width, canvas.height);

Expand Down
2 changes: 1 addition & 1 deletion source/nodes/MapMartiniHeightNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class MapMartiniHeightNode extends MapHeightNode
const gridSize = tileSize + 1;
var canvas = CanvasUtils.createOffscreenCanvas(tileSize, tileSize);

var context = canvas.getContext('2d');
var context = canvas.getContext('2d') as CanvasRenderingContext2D;
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, tileSize, tileSize, 0, 0, canvas.width, canvas.height);

Expand Down
2 changes: 1 addition & 1 deletion source/providers/DebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class DebugProvider extends MapProvider
public fetchTile(zoom: number, x: number, y: number): Promise<any>
{
const canvas = CanvasUtils.createOffscreenCanvas(this.resolution, this.resolution);
const context = canvas.getContext('2d');
const context = canvas.getContext('2d') as CanvasRenderingContext2D;

const green = new Color(0x00ff00);
const red = new Color(0xff0000);
Expand Down
2 changes: 1 addition & 1 deletion source/providers/HeightDebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class HeightDebugProvider extends MapProvider
const resolution = 256;

const canvas = CanvasUtils.createOffscreenCanvas(resolution, resolution);
const context = canvas.getContext('2d');
const context = canvas.getContext('2d') as CanvasRenderingContext2D;

context.drawImage(image, 0, 0, resolution, resolution, 0, 0, resolution, resolution);

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
"source/**/*"
],
"exclude": [
"source/examples/**/*",
"node_modules/**/*",
"docs/**/*",
"build/**/*"
"build/**/*",
]
}

0 comments on commit 7da4525

Please sign in to comment.