osgearthwasm
Version:
osgEarth ported to WebAssembly to run it on the web platform
198 lines (179 loc) • 4.58 kB
TypeScript
/**
* osgEarth ported to WebAssembly to run it on the web platform
*
* @packageDocumentation
*/
/// <reference types="emscripten" />
/**
* @public
*/
export declare enum BuildType {
release = "release",
test = "test",
dev = "dev",
debug = "debug"
}
/**
* Extension of a EmscriptenModule that provides a additional APIs to interact with the engine/scene.
*
* @public
*/
export declare interface EmscriptenRuntimeModule extends EmscriptenModule {
[x: string]: any;
}
/**
* @public
*/
export declare enum EmscriptenRuntimeStatus {
LOAD = "LOAD",
READY = "READY",
START = "START",
CREATE = "CREATE",
BOOT = "BOOT",
SETUP = "SETUP",
INIT = "INIT",
RUN = "RUN"
}
/**
* Representation of static Environment
*
* @public
*/
export declare interface Environment {
platform: Platform;
buildType: BuildType;
threadingModel: ThreadingModel;
variables: {
[key: string]: string;
};
}
/**
* Implementation of a static Environment
*
* @public
*/
export declare class Environment implements Environment {
constructor(platform: Platform, buildType: BuildType, threadingModel: ThreadingModel, variables?: {
[key: string]: string;
});
}
/**
* Request the runtime constraint by one or more environment properties
*
* @public
*/
export declare interface EnvironmentRequest {
platform?: Platform;
buildType?: BuildType;
threadingModel?: ThreadingModel;
variables?: {
[key: string]: string;
};
}
/**
* Representation of a osgearthwasm Globe.
*
* @public
*/
export declare interface Globe {
options: Options;
environment: Environment;
shell: HTMLDivElement;
canvas: HTMLCanvasElement;
runtime: Runtime;
fs: any;
api: OsgEarthApi;
util: typeof OsgEarthUtil;
}
/**
* Implementation of a osgearthwasm Globe.
*
* @public
*/
export declare class Globe implements Globe {
/* Excluded from this release type: _ready */
/* Excluded from this release type: _resolve */
constructor(options: Options, environment: Environment, shell: HTMLDivElement);
/* Excluded from this release type: API */
protected onStatus(_status: string): void;
init(api: string, payload: string): Promise<void>;
}
/**
* Options to initialize a new osgearthwasm Globe.
*
* @public
*/
export declare interface Options {
runtime?: string;
baseUrl?: string;
silent?: boolean;
onStatus?: (status: EmscriptenRuntimeStatus) => void;
}
/**
* @public
*/
export declare interface OsgEarthApi {
flyToPoint(longitude: number, latitude: number, duration?: number): void;
flyToBox(north: number, east: number, south: number, west: number, duration?: number): void;
getViewpoint(): Viewpoint;
setViewpoint(viewpoint: Viewpoint, duration?: number): void;
setLighting(lighting: boolean): void;
setDate(dateTime: Date): void;
setDateTime(year: number, month: number, day: number, hours: number): void;
addMap(earthFilePath: string, resolve?: () => void, reject?: (error: string) => void): void;
addEarthFile(earthFileContent: string): Promise<void>;
isLayerOpen(layerName: string): boolean;
openLayer(layerName: string): void;
closeLayer(layerName: string): void;
setOpacity(layerName: string, opacity: number): void;
}
/**
* @public
*/
export declare const OsgEarthUtil: {
/**
* @public
*/
styleFunction(styleFunction: (feature: any) => string, name?: string): string;
};
/**
* Creates a new osgearthwasm globe and binds it to the given HTML container.
*
* @public
*/
export declare function osgearthwasm(container: string | HTMLDivElement, payload?: string, options?: Options, _enviroment?: EnvironmentRequest): Promise<Globe>;
/**
* @public
*/
export declare enum Platform {
node = "node",
browser = "browser"
}
/**
* Extension of a EmscriptenModule that provides a additional APIs to interact with the engine/scene.
*
* @public
*/
export declare interface Runtime {
module: EmscriptenRuntimeModule;
fs: any;
}
/**
* @public
*/
export declare enum ThreadingModel {
single = "single",
multi = "multi"
}
/**
* @public
*/
export declare interface Viewpoint {
longitude: number;
latitude: number;
altitude: number;
heading: number;
pitch: number;
range: number;
}
export { }