export namespace Viewer {
/**
* Initialization options for the Viewer constructor
* @property [animation = true] - If set to false, the Animation widget will not be created.
* @property [baseLayerPicker = true] - If set to false, the BaseLayerPicker widget will not be created.
* @property [fullscreenButton = true] - If set to false, the FullscreenButton widget will not be created.
* @property [vrButton = false] - If set to true, the VRButton widget will be created.
* @property [geocoder = true] - If set to false, the Geocoder widget will not be created.
* @property [homeButton = true] - If set to false, the HomeButton widget will not be created.
* @property [infoBox = true] - If set to false, the InfoBox widget will not be created.
* @property [sceneModePicker = true] - If set to false, the SceneModePicker widget will not be created.
* @property [selectionIndicator = true] - If set to false, the SelectionIndicator widget will not be created.
* @property [timeline = true] - If set to false, the Timeline widget will not be created.
* @property [navigationHelpButton = true] - If set to false, the navigation help button will not be created.
* @property [navigationInstructionsInitiallyVisible = true] - True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button.
* @property [scene3DOnly = false] - When true
, each geometry instance will only be rendered in 3D to save GPU memory.
* @property [shouldAnimate = false] - true
if the clock should attempt to advance simulation time by default, false
otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}.
* @property [clockViewModel = new ClockViewModel(clock)] - The clock view model to use to control current time.
* @property [selectedImageryProviderViewModel] - The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true.
* @property [imageryProviderViewModels = createDefaultImageryProviderViewModels()] - The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
* @property [selectedTerrainProviderViewModel] - The view model for the current base terrain layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true.
* @property [terrainProviderViewModels = createDefaultTerrainProviderViewModels()] - The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
* @property [imageryProvider = createWorldImagery()] - The imagery provider to use. This value is only valid if `baseLayerPicker` is set to false.
* @property [terrainProvider = new EllipsoidTerrainProvider()] - The terrain provider to use
* @property [skyBox] - The skybox used to render the stars. When undefined
, the default stars are used. If set to false
, no skyBox, Sun, or Moon will be added.
* @property [skyAtmosphere] - Blue sky, and the glow around the Earth's limb. Set to false
to turn it off.
* @property [fullscreenElement = document.body] - The element or id to be placed into fullscreen mode when the full screen button is pressed.
* @property [useDefaultRenderLoop = true] - True if this widget should control the render loop, false otherwise.
* @property [targetFrameRate] - The target frame rate when using the default render loop.
* @property [showRenderLoopErrors = true] - If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
* @property [useBrowserRecommendedResolution = true] - If true, render at the browser's recommended resolution and ignore window.devicePixelRatio
.
* @property [automaticallyTrackDataSourceClocks = true] - If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently.
* @property [contextOptions] - Context and WebGL creation properties corresponding to options
passed to {@link Scene}.
* @property [sceneMode = SceneMode.SCENE3D] - The initial scene mode.
* @property [mapProjection = new GeographicProjection()] - The map projection to use in 2D and Columbus View modes.
* @property [globe = new Globe(mapProjection.ellipsoid)] - The globe to use in the scene. If set to false
, no globe will be added.
* @property [orderIndependentTranslucency = true] - If true and the configuration supports it, use order independent translucency.
* @property [creditContainer] - The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself.
* @property [creditViewport] - The DOM element or ID that will contain the credit pop up created by the {@link CreditDisplay}. If not specified, it will appear over the widget itself.
* @property [dataSources = new DataSourceCollection()] - The collection of data sources visualized by the widget. If this parameter is provided,
* the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed.
* @property [shadows = false] - Determines if shadows are cast by light sources.
* @property [terrainShadows = ShadowMode.RECEIVE_ONLY] - Determines if the terrain casts or receives shadows from light sources.
* @property [mapMode2D = MapMode2D.INFINITE_SCROLL] - Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
* @property [projectionPicker = false] - If set to true, the ProjectionPicker widget will be created.
* @property [requestRenderMode = false] - If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API.
* @property [maximumRenderTimeChange = 0.0] - If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested.
* @property [depthPlaneEllipsoidOffset = 0.0] - Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
* @property [msaaSamples = 1] - If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
*/
type ConstructorOptions = {
animation?: boolean;
baseLayerPicker?: boolean;
fullscreenButton?: boolean;
vrButton?: boolean;
geocoder?: boolean | GeocoderService[];
homeButton?: boolean;
infoBox?: boolean;
sceneModePicker?: boolean;
selectionIndicator?: boolean;
timeline?: boolean;
navigationHelpButton?: boolean;
navigationInstructionsInitiallyVisible?: boolean;
scene3DOnly?: boolean;
shouldAnimate?: boolean;
clockViewModel?: ClockViewModel;
selectedImageryProviderViewModel?: ProviderViewModel;
imageryProviderViewModels?: ProviderViewModel[];
selectedTerrainProviderViewModel?: ProviderViewModel;
terrainProviderViewModels?: ProviderViewModel[];
imageryProvider?: ImageryProvider;
terrainProvider?: TerrainProvider;
skyBox?: SkyBox | false;
skyAtmosphere?: SkyAtmosphere | false;
fullscreenElement?: Element | string;
useDefaultRenderLoop?: boolean;
targetFrameRate?: number;
showRenderLoopErrors?: boolean;
useBrowserRecommendedResolution?: boolean;
automaticallyTrackDataSourceClocks?: boolean;
contextOptions?: any;
sceneMode?: SceneMode;
mapProjection?: MapProjection;
globe?: Globe | false;
orderIndependentTranslucency?: boolean;
creditContainer?: Element | string;
creditViewport?: Element | string;
dataSources?: DataSourceCollection;
shadows?: boolean;
terrainShadows?: ShadowMode;
mapMode2D?: MapMode2D;
projectionPicker?: boolean;
requestRenderMode?: boolean;
maximumRenderTimeChange?: number;
depthPlaneEllipsoidOffset?: number;
msaaSamples?: number;
};
/**
* A function that augments a Viewer instance with additional functionality.
* @param viewer - The viewer instance.
* @param options - Options object to be passed to the mixin function.
*/
type ViewerMixin = (viewer: Viewer, options: any) => void;
}
/**
* 用于构建应用程序的基本小部件. 它将所有标准的Cesium小部件组合成一个可重用的包.
* 小部件总是可以通过使用mixin进行扩展,mixin为各种应用程序添加了有用的功能.
* @example
* //使用几个自定义选项和mixins初始化查看器小部件.
* const viewer = new Cesium.Viewer('CesiumContainer', {
* sceneMode : Cesium.SceneMode.COLUMBUS_VIEW,
* terrainProvider : Cesium.createWorldTerrain(),
* baseLayerPicker : false,
* imageryProvider : new Cesium.OpenStreetMapImageryProvider({
* url : 'https://a.tile.openstreetmap.org/'
* }),
* skyBox : new Cesium.SkyBox({
* sources : {
* positiveX : 'stars/TychoSkymapII.t3_08192x04096_80_px.jpg',
* negativeX : 'stars/TychoSkymapII.t3_08192x04096_80_mx.jpg',
* positiveY : 'stars/TychoSkymapII.t3_08192x04096_80_py.jpg',
* negativeY : 'stars/TychoSkymapII.t3_08192x04096_80_my.jpg',
* positiveZ : 'stars/TychoSkymapII.t3_08192x04096_80_pz.jpg',
* negativeZ : 'stars/TychoSkymapII.t3_08192x04096_80_mz.jpg'
* }
* }),
* });
* @param container - 包含Widget的DOM元素或ID
* @param [options] - 对象描述初始化选项
*/
export class Viewer {
constructor(container: Element | string, options?: Viewer.ConstructorOptions);
/**
* Gets the parent container.
*/
readonly container: Element;
/**
* Gets the DOM element for the area at the bottom of the window containing the
* {@link CreditDisplay} and potentially other things.
*/
readonly bottomContainer: Element;
/**
* Gets the CesiumWidget.
*/
readonly CesiumWidget: CesiumWidget;
/**
* Gets the selection indicator.
*/
readonly selectionIndicator: SelectionIndicator;
/**
* Gets the info box.
*/
readonly infoBox: InfoBox;
/**
* Gets the Geocoder.
*/
readonly geocoder: Geocoder;
/**
* Gets the HomeButton.
*/
readonly homeButton: HomeButton;
/**
* Gets the SceneModePicker.
*/
readonly sceneModePicker: SceneModePicker;
/**
* Gets the ProjectionPicker.
*/
readonly projectionPicker: ProjectionPicker;
/**
* Gets the BaseLayerPicker.
*/
readonly baseLayerPicker: BaseLayerPicker;
/**
* Gets the NavigationHelpButton.
*/
readonly navigationHelpButton: NavigationHelpButton;
/**
* Gets the Animation widget.
*/
readonly animation: Animation;
/**
* Gets the Timeline widget.
*/
readonly timeline: Timeline;
/**
* Gets the FullscreenButton.
*/
readonly fullscreenButton: FullscreenButton;
/**
* Gets the VRButton.
*/
readonly vrButton: VRButton;
/**
* Gets the display used for {@link DataSource} visualization.
*/
readonly dataSourceDisplay: DataSourceDisplay;
/**
* Gets the collection of entities not tied to a particular data source.
* This is a shortcut to [dataSourceDisplay.defaultDataSource.entities]{@link Viewer#dataSourceDisplay}.
*/
readonly entities: EntityCollection;
/**
* Gets the set of {@link DataSource} instances to be visualized.
*/
readonly dataSources: DataSourceCollection;
/**
* Gets the canvas.
*/
readonly canvas: HTMLCanvasElement;
/**
* Gets the scene.
*/
readonly scene: Scene;
/**
* Determines if shadows are cast by light sources.
*/
shadows: boolean;
/**
* Determines if the terrain casts or shadows from light sources.
*/
terrainShadows: ShadowMode;
/**
* Get the scene's shadow map
*/
readonly shadowMap: ShadowMap;
/**
* Gets the collection of image layers that will be rendered on the globe.
*/
readonly imageryLayers: ImageryLayerCollection;
/**
* The terrain provider providing surface geometry for the globe.
*/
terrainProvider: TerrainProvider;
/**
* Gets the camera.
*/
readonly camera: Camera;
/**
* Gets the post-process stages.
*/
readonly postProcessStages: PostProcessStageCollection;
/**
* Gets the clock.
*/
readonly clock: Clock;
/**
* Gets the clock view model.
*/
readonly clockViewModel: ClockViewModel;
/**
* Gets the screen space event handler.
*/
readonly screenSpaceEventHandler: ScreenSpaceEventHandler;
/**
* Gets or sets the target frame rate of the widget when useDefaultRenderLoop
* is true. If undefined, the browser's {@link requestAnimationFrame} implementation
* determines the frame rate. If defined, this value must be greater than 0. A value higher
* than the underlying requestAnimationFrame implementation will have no effect.
*/
targetFrameRate: number;
/**
* Gets or sets whether or not this widget should control the render loop.
* If set to true the widget will use {@link requestAnimationFrame} to
* perform rendering and resizing of the widget, as well as drive the
* simulation clock. If set to false, you must manually call the
* resize
, render
methods
* as part of a custom render loop. If an error occurs during rendering, {@link Scene}'s
* renderError
event will be raised and this property
* will be set to false. It must be set back to true to continue rendering
* after the error.
*/
useDefaultRenderLoop: boolean;
/**
* Gets or sets a scaling factor for rendering resolution. Values less than 1.0 can improve
* performance on less powerful devices while values greater than 1.0 will render at a higher
* resolution and then scale down, resulting in improved visual fidelity.
* For example, if the widget is laid out at a size of 640x480, setting this value to 0.5
* will cause the scene to be rendered at 320x240 and then scaled up while setting
* it to 2.0 will cause the scene to be rendered at 1280x960 and then scaled down.
*/
resolutionScale: number;
/**
* Boolean flag indicating if the browser's recommended resolution is used.
* If true, the browser's device pixel ratio is ignored and 1.0 is used instead,
* effectively rendering based on CSS pixels instead of device pixels. This can improve
* performance on less powerful devices that have high pixel density. When false, rendering
* will be in device pixels. {@link Viewer#resolutionScale} will still take effect whether
* this flag is true or false.
*/
useBrowserRecommendedResolution: boolean;
/**
* Gets or sets whether or not data sources can temporarily pause
* animation in order to avoid showing an incomplete picture to the user.
* For example, if asynchronous primitives are being processed in the
* background, the clock will not advance until the geometry is ready.
*/
allowDataSourcesToSuspendAnimation: boolean;
/**
* Gets or sets the Entity instance currently being tracked by the camera.
*/
trackedEntity: Entity | undefined;
/**
* Gets or sets the object instance for which to display a selection indicator.
*
* If a user interactively picks a Cesium3DTilesFeature instance, then this property
* will contain a transient Entity instance with a property named "feature" that is
* the instance that was picked.
*/
selectedEntity: Entity | undefined;
/**
* Gets the event that is raised when the selected entity changes.
*/
readonly selectedEntityChanged: Event;
/**
* Gets the event that is raised when the tracked entity changes.
*/
readonly trackedEntityChanged: Event;
/**
* Gets or sets the data source to track with the viewer's clock.
*/
clockTrackedDataSource: DataSource;
/**
* Extends the base viewer functionality with the provided mixin.
* A mixin may add additional properties, functions, or other behavior
* to the provided viewer instance.
* @param mixin - The Viewer mixin to add to this instance.
* @param [options] - The options object to be passed to the mixin function.
*/
extend(mixin: Viewer.ViewerMixin, options?: any): void;
/**
* Resizes the widget to match the container size.
* This function is called automatically as needed unless
* useDefaultRenderLoop
is set to false.
*/
resize(): void;
/**
* This forces the widget to re-think its layout, including
* widget sizes and credit placement.
*/
forceResize(): void;
/**
* Renders the scene. This function is called automatically
* unless useDefaultRenderLoop
is set to false;
*/
render(): void;
/**
* @returns true if the object has been destroyed, false otherwise.
*/
isDestroyed(): boolean;
/**
* Destroys the widget. Should be called if permanently
* removing the widget from layout.
*/
destroy(): void;
/**
* Asynchronously sets the camera to view the provided entity, entities, or data source.
* If the data source is still in the process of loading or the visualization is otherwise still loading,
* this method waits for the data to be ready before performing the zoom.
*
*
The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere. * The heading and the pitch angles are defined in the local east-north-up reference frame. * The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch * angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is * zero, a range will be computed such that the whole bounding sphere is visible.
* *In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the * target will be the range. The heading will be determined from the offset. If the heading cannot be * determined from the offset, the heading will be north.
* @param target - The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types. * @param [offset] - The offset from the center of the entity in the local east-north-up reference frame. * @returns A Promise that resolves to true if the zoom was successful or false if the target is not currently visualized in the scene or the zoom was cancelled. */ // zoomTo(target: Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | PromiseThe offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere. * The heading and the pitch angles are defined in the local east-north-up reference frame. * The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch * angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is * zero, a range will be computed such that the whole bounding sphere is visible.
* *In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the * target will be the range. The heading will be determined from the offset. If the heading cannot be * determined from the offset, the heading will be north.
* @param target - The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types. * @param [options] - Object with the following properties: * @param [options.duration = 3.0] - The duration of the flight in seconds. * @param [options.maximumHeight] - The maximum height at the peak of the flight. * @param [options.offset] - The offset from the target in the local east-north-up reference frame centered at the target. * @returns A Promise that resolves to true if the flight was successful or false if the target is not currently visualized in the scene or the flight was cancelled. //TODO: Cleanup entity mentions */ // flyTo(target: Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promisetrue
if they are equal, false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Cartesian2, right?: Cartesian2): boolean;
/**
* Compares the provided Cartesians componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Cartesian2, right?: Cartesian2, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* An immutable Cartesian2 instance initialized to (0.0, 0.0).
*/
readonly ZERO: Cartesian2;
/**
* An immutable Cartesian2 instance initialized to (1.0, 1.0).
*/
readonly ONE: Cartesian2;
/**
* An immutable Cartesian2 instance initialized to (1.0, 0.0).
*/
readonly UNIT_X: Cartesian2;
/**
* An immutable Cartesian2 instance initialized to (0.0, 1.0).
*/
readonly UNIT_Y: Cartesian2;
/**
* Duplicates this Cartesian2 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian2 instance if one was not provided.
*/
clone(result?: Cartesian2): Cartesian2;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side Cartesian.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Cartesian2): boolean;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [right] - The right hand side Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Cartesian2, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Creates a string representing this Cartesian in the format '(x, y)'.
* @returns A string representing the provided Cartesian in the format '(x, y)'.
*/
toString(): string;
}
/**
* A 3D Cartesian point.
* @param [x = 0.0] - The X component.
* @param [y = 0.0] - The Y component.
* @param [z = 0.0] - The Z component.
*/
export class Cartesian3 {
constructor(x?: number, y?: number, z?: number);
/**
* The X component.
*/
x: number;
/**
* The Y component.
*/
y: number;
/**
* The Z component.
*/
z: number;
/**
* Converts the provided Spherical into Cartesian3 coordinates.
* @param spherical - The Spherical to be converted to Cartesian3.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
fromSpherical(spherical: Spherical, result?: Cartesian3): Cartesian3;
/**
* Creates a Cartesian3 instance from x, y and z coordinates.
* @param x - The x coordinate.
* @param y - The y coordinate.
* @param z - The z coordinate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
fromElements(x: number, y: number, z: number, result?: Cartesian3): Cartesian3;
/**
* Duplicates a Cartesian3 instance.
* @param cartesian - The Cartesian to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)
*/
clone(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the
* x, y, and z properties of the Cartesian4 and drops w.
* @param cartesian - The Cartesian4 instance to create a Cartesian3 instance from.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
fromCartesian4(cartesian: Cartesian4, result?: Cartesian3): Cartesian3;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Cartesian3, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Cartesian3): Cartesian3;
/**
* Flattens an array of Cartesian3s into an array of components.
* @param array - The array of cartesians to pack.
* @param [result] - The array onto which to store the result. If this is a typed array, it must have array.length * 3 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 3) elements.
* @returns The packed array.
*/
packArray(array: Cartesian3[], result?: number[]): number[];
/**
* Unpacks an array of cartesian components into an array of Cartesian3s.
* @param array - The array of components to unpack.
* @param [result] - The array onto which to store the result.
* @returns The unpacked array.
*/
unpackArray(array: number[], result?: Cartesian3[]): Cartesian3[];
/**
* Creates a Cartesian3 from three consecutive elements in an array.
* @example
* // Create a Cartesian3 with (1.0, 2.0, 3.0)
* const v = [1.0, 2.0, 3.0];
* const p = Cesium.Cartesian3.fromArray(v);
*
* // Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
* const v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
* const p2 = Cesium.Cartesian3.fromArray(v2, 2);
* @param array - The array whose three consecutive elements correspond to the x, y, and z components, respectively.
* @param [startingIndex = 0] - The offset into the array of the first element, which corresponds to the x component.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
fromArray(array: number[], startingIndex?: number, result?: Cartesian3): Cartesian3;
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @param cartesian - The cartesian to use.
* @returns The value of the maximum component.
*/
maximumComponent(cartesian: Cartesian3): number;
/**
* Computes the value of the minimum component for the supplied Cartesian.
* @param cartesian - The cartesian to use.
* @returns The value of the minimum component.
*/
minimumComponent(cartesian: Cartesian3): number;
/**
* Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
* @param first - A cartesian to compare.
* @param second - A cartesian to compare.
* @param result - The object into which to store the result.
* @returns A cartesian with the minimum components.
*/
minimumByComponent(first: Cartesian3, second: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
* @param first - A cartesian to compare.
* @param second - A cartesian to compare.
* @param result - The object into which to store the result.
* @returns A cartesian with the maximum components.
*/
maximumByComponent(first: Cartesian3, second: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Constrain a value to lie between two values.
* @param cartesian - The value to clamp.
* @param min - The minimum bound.
* @param max - The maximum bound.
* @param result - The object into which to store the result.
* @returns The clamped value such that min <= value <= max.
*/
clamp(cartesian: Cartesian3, min: Cartesian3, max: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the provided Cartesian's squared magnitude.
* @param cartesian - The Cartesian instance whose squared magnitude is to be computed.
* @returns The squared magnitude.
*/
magnitudeSquared(cartesian: Cartesian3): number;
/**
* Computes the Cartesian's magnitude (length).
* @param cartesian - The Cartesian instance whose magnitude is to be computed.
* @returns The magnitude.
*/
magnitude(cartesian: Cartesian3): number;
/**
* Computes the distance between two points.
* @example
* // Returns 1.0
* const d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0));
* @param left - The first point to compute the distance from.
* @param right - The second point to compute the distance to.
* @returns The distance between two points.
*/
distance(left: Cartesian3, right: Cartesian3): number;
/**
* Computes the squared distance between two points. Comparing squared distances
* using this function is more efficient than comparing distances using {@link Cartesian3#distance}.
* @example
* // Returns 4.0, not 2.0
* const d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0));
* @param left - The first point to compute the distance from.
* @param right - The second point to compute the distance to.
* @returns The distance between two points.
*/
distanceSquared(left: Cartesian3, right: Cartesian3): number;
/**
* Computes the normalized form of the supplied Cartesian.
* @param cartesian - The Cartesian to be normalized.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
normalize(cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the dot (scalar) product of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @returns The dot product.
*/
dot(left: Cartesian3, right: Cartesian3): number;
/**
* Computes the componentwise product of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyComponents(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the componentwise quotient of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideComponents(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the componentwise sum of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the componentwise difference of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Multiplies the provided Cartesian componentwise by the provided scalar.
* @param cartesian - The Cartesian to be scaled.
* @param scalar - The scalar to multiply with.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(cartesian: Cartesian3, scalar: number, result: Cartesian3): Cartesian3;
/**
* Divides the provided Cartesian componentwise by the provided scalar.
* @param cartesian - The Cartesian to be divided.
* @param scalar - The scalar to divide by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideByScalar(cartesian: Cartesian3, scalar: number, result: Cartesian3): Cartesian3;
/**
* Negates the provided Cartesian.
* @param cartesian - The Cartesian to be negated.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the absolute value of the provided Cartesian.
* @param cartesian - The Cartesian whose absolute value is to be computed.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
abs(cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
* @param start - The value corresponding to t at 0.0.
* @param end - The value corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
lerp(start: Cartesian3, end: Cartesian3, t: number, result: Cartesian3): Cartesian3;
/**
* Returns the angle, in radians, between the provided Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @returns The angle between the Cartesians.
*/
angleBetween(left: Cartesian3, right: Cartesian3): number;
/**
* Returns the axis that is most orthogonal to the provided Cartesian.
* @param cartesian - The Cartesian on which to find the most orthogonal axis.
* @param result - The object onto which to store the result.
* @returns The most orthogonal axis.
*/
mostOrthogonalAxis(cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Projects vector a onto vector b
* @param a - The vector that needs projecting
* @param b - The vector to project onto
* @param result - The result cartesian
* @returns The modified result parameter
*/
projectVector(a: Cartesian3, b: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Compares the provided Cartesians componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Cartesian3, right?: Cartesian3): boolean;
/**
* Compares the provided Cartesians componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Cartesian3, right?: Cartesian3, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Computes the cross (outer) product of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The cross product.
*/
cross(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the midpoint between the right and left Cartesian.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The midpoint.
*/
midpoint(left: Cartesian3, right: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Returns a Cartesian3 position from longitude and latitude values given in degrees.
* @example
* const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);
* @param longitude - The longitude, in degrees
* @param latitude - The latitude, in degrees
* @param [height = 0.0] - The height, in meters, above the ellipsoid.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - The object onto which to store the result.
* @returns The position
*/
fromDegrees(longitude: number, latitude: number, height?: number, ellipsoid?: Ellipsoid, result?: Cartesian3): Cartesian3;
/**
* Returns a Cartesian3 position from longitude and latitude values given in radians.
* @example
* const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);
* @param longitude - The longitude, in radians
* @param latitude - The latitude, in radians
* @param [height = 0.0] - The height, in meters, above the ellipsoid.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - The object onto which to store the result.
* @returns The position
*/
fromRadians(longitude: number, latitude: number, height?: number, ellipsoid?: Ellipsoid, result?: Cartesian3): Cartesian3;
/**
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees.
* @example
* const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);
* @param coordinates - A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the coordinates lie.
* @param [result] - An array of Cartesian3 objects to store the result.
* @returns The array of positions.
*/
fromDegreesArray(coordinates: number[], ellipsoid?: Ellipsoid, result?: Cartesian3[]): Cartesian3[];
/**
* Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians.
* @example
* const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);
* @param coordinates - A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the coordinates lie.
* @param [result] - An array of Cartesian3 objects to store the result.
* @returns The array of positions.
*/
fromRadiansArray(coordinates: number[], ellipsoid?: Ellipsoid, result?: Cartesian3[]): Cartesian3[];
/**
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees.
* @example
* const positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]);
* @param coordinates - A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - An array of Cartesian3 objects to store the result.
* @returns The array of positions.
*/
fromDegreesArrayHeights(coordinates: number[], ellipsoid?: Ellipsoid, result?: Cartesian3[]): Cartesian3[];
/**
* Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians.
* @example
* const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);
* @param coordinates - A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - An array of Cartesian3 objects to store the result.
* @returns The array of positions.
*/
fromRadiansArrayHeights(coordinates: number[], ellipsoid?: Ellipsoid, result?: Cartesian3[]): Cartesian3[];
/**
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
*/
readonly ZERO: Cartesian3;
/**
* An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
*/
readonly ONE: Cartesian3;
/**
* An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
*/
readonly UNIT_X: Cartesian3;
/**
* An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
*/
readonly UNIT_Y: Cartesian3;
/**
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
*/
readonly UNIT_Z: Cartesian3;
/**
* Duplicates this Cartesian3 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
clone(result?: Cartesian3): Cartesian3;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side Cartesian.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Cartesian3): boolean;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [right] - The right hand side Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Cartesian3, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Creates a string representing this Cartesian in the format '(x, y, z)'.
* @returns A string representing this Cartesian in the format '(x, y, z)'.
*/
toString(): string;
}
/**
* A 4D Cartesian point.
* @param [x = 0.0] - The X component.
* @param [y = 0.0] - The Y component.
* @param [z = 0.0] - The Z component.
* @param [w = 0.0] - The W component.
*/
export class Cartesian4 {
constructor(x?: number, y?: number, z?: number, w?: number);
/**
* The X component.
*/
x: number;
/**
* The Y component.
*/
y: number;
/**
* The Z component.
*/
z: number;
/**
* The W component.
*/
w: number;
/**
* Creates a Cartesian4 instance from x, y, z and w coordinates.
* @param x - The x coordinate.
* @param y - The y coordinate.
* @param z - The z coordinate.
* @param w - The w coordinate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
fromElements(x: number, y: number, z: number, w: number, result?: Cartesian4): Cartesian4;
/**
* Creates a Cartesian4 instance from a {@link Color}. red
, green
, blue
,
* and alpha
map to x
, y
, z
, and w
, respectively.
* @param color - The source color.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
fromColor(color: Color, result?: Cartesian4): Cartesian4;
/**
* Duplicates a Cartesian4 instance.
* @param cartesian - The Cartesian to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
*/
clone(cartesian: Cartesian4, result?: Cartesian4): Cartesian4;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Cartesian4, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Cartesian4): Cartesian4;
/**
* Flattens an array of Cartesian4s into an array of components.
* @param array - The array of cartesians to pack.
* @param [result] - The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
* @returns The packed array.
*/
packArray(array: Cartesian4[], result?: number[]): number[];
/**
* Unpacks an array of cartesian components into an array of Cartesian4s.
* @param array - The array of components to unpack.
* @param [result] - The array onto which to store the result.
* @returns The unpacked array.
*/
unpackArray(array: number[], result?: Cartesian4[]): Cartesian4[];
/**
* Creates a Cartesian4 from four consecutive elements in an array.
* @example
* // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0)
* const v = [1.0, 2.0, 3.0, 4.0];
* const p = Cesium.Cartesian4.fromArray(v);
*
* // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array
* const v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0];
* const p2 = Cesium.Cartesian4.fromArray(v2, 2);
* @param array - The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
* @param [startingIndex = 0] - The offset into the array of the first element, which corresponds to the x component.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
fromArray(array: number[], startingIndex?: number, result?: Cartesian4): Cartesian4;
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @param cartesian - The cartesian to use.
* @returns The value of the maximum component.
*/
maximumComponent(cartesian: Cartesian4): number;
/**
* Computes the value of the minimum component for the supplied Cartesian.
* @param cartesian - The cartesian to use.
* @returns The value of the minimum component.
*/
minimumComponent(cartesian: Cartesian4): number;
/**
* Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
* @param first - A cartesian to compare.
* @param second - A cartesian to compare.
* @param result - The object into which to store the result.
* @returns A cartesian with the minimum components.
*/
minimumByComponent(first: Cartesian4, second: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
* @param first - A cartesian to compare.
* @param second - A cartesian to compare.
* @param result - The object into which to store the result.
* @returns A cartesian with the maximum components.
*/
maximumByComponent(first: Cartesian4, second: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Constrain a value to lie between two values.
* @param value - The value to clamp.
* @param min - The minimum bound.
* @param max - The maximum bound.
* @param result - The object into which to store the result.
* @returns The clamped value such that min <= result <= max.
*/
clamp(value: Cartesian4, min: Cartesian4, max: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the provided Cartesian's squared magnitude.
* @param cartesian - The Cartesian instance whose squared magnitude is to be computed.
* @returns The squared magnitude.
*/
magnitudeSquared(cartesian: Cartesian4): number;
/**
* Computes the Cartesian's magnitude (length).
* @param cartesian - The Cartesian instance whose magnitude is to be computed.
* @returns The magnitude.
*/
magnitude(cartesian: Cartesian4): number;
/**
* Computes the 4-space distance between two points.
* @example
* // Returns 1.0
* const d = Cesium.Cartesian4.distance(
* new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
* new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));
* @param left - The first point to compute the distance from.
* @param right - The second point to compute the distance to.
* @returns The distance between two points.
*/
distance(left: Cartesian4, right: Cartesian4): number;
/**
* Computes the squared distance between two points. Comparing squared distances
* using this function is more efficient than comparing distances using {@link Cartesian4#distance}.
* @example
* // Returns 4.0, not 2.0
* const d = Cesium.Cartesian4.distance(
* new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
* new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));
* @param left - The first point to compute the distance from.
* @param right - The second point to compute the distance to.
* @returns The distance between two points.
*/
distanceSquared(left: Cartesian4, right: Cartesian4): number;
/**
* Computes the normalized form of the supplied Cartesian.
* @param cartesian - The Cartesian to be normalized.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
normalize(cartesian: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the dot (scalar) product of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @returns The dot product.
*/
dot(left: Cartesian4, right: Cartesian4): number;
/**
* Computes the componentwise product of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyComponents(left: Cartesian4, right: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the componentwise quotient of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideComponents(left: Cartesian4, right: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the componentwise sum of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Cartesian4, right: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the componentwise difference of two Cartesians.
* @param left - The first Cartesian.
* @param right - The second Cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Cartesian4, right: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Multiplies the provided Cartesian componentwise by the provided scalar.
* @param cartesian - The Cartesian to be scaled.
* @param scalar - The scalar to multiply with.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(cartesian: Cartesian4, scalar: number, result: Cartesian4): Cartesian4;
/**
* Divides the provided Cartesian componentwise by the provided scalar.
* @param cartesian - The Cartesian to be divided.
* @param scalar - The scalar to divide by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideByScalar(cartesian: Cartesian4, scalar: number, result: Cartesian4): Cartesian4;
/**
* Negates the provided Cartesian.
* @param cartesian - The Cartesian to be negated.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(cartesian: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the absolute value of the provided Cartesian.
* @param cartesian - The Cartesian whose absolute value is to be computed.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
abs(cartesian: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
* @param start - The value corresponding to t at 0.0.
* @param end - The value corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
lerp(start: Cartesian4, end: Cartesian4, t: number, result: Cartesian4): Cartesian4;
/**
* Returns the axis that is most orthogonal to the provided Cartesian.
* @param cartesian - The Cartesian on which to find the most orthogonal axis.
* @param result - The object onto which to store the result.
* @returns The most orthogonal axis.
*/
mostOrthogonalAxis(cartesian: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Compares the provided Cartesians componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Cartesian4, right?: Cartesian4): boolean;
/**
* Compares the provided Cartesians componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [left] - The first Cartesian.
* @param [right] - The second Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Cartesian4, right?: Cartesian4, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
*/
readonly ZERO: Cartesian4;
/**
* An immutable Cartesian4 instance initialized to (1.0, 1.0, 1.0, 1.0).
*/
readonly ONE: Cartesian4;
/**
* An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
*/
readonly UNIT_X: Cartesian4;
/**
* An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
*/
readonly UNIT_Y: Cartesian4;
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
*/
readonly UNIT_Z: Cartesian4;
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
*/
readonly UNIT_W: Cartesian4;
/**
* Duplicates this Cartesian4 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
clone(result?: Cartesian4): Cartesian4;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side Cartesian.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Cartesian4): boolean;
/**
* Compares this Cartesian against the provided Cartesian componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [right] - The right hand side Cartesian.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Cartesian4, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Creates a string representing this Cartesian in the format '(x, y, z, w)'.
* @returns A string representing the provided Cartesian in the format '(x, y, z, w)'.
*/
toString(): string;
/**
* Packs an arbitrary floating point value to 4 values representable using uint8.
* @param value - A floating point number.
* @param [result] - The Cartesian4 that will contain the packed float.
* @returns A Cartesian4 representing the float packed to values in x, y, z, and w.
*/
packFloat(value: number, result?: Cartesian4): Cartesian4;
}
/**
* A position defined by longitude, latitude, and height.
* @param [longitude = 0.0] - The longitude, in radians.
* @param [latitude = 0.0] - The latitude, in radians.
* @param [height = 0.0] - The height, in meters, above the ellipsoid.
*/
export class Cartographic {
constructor(longitude?: number, latitude?: number, height?: number);
/**
* The longitude, in radians.
*/
longitude: number;
/**
* The latitude, in radians.
*/
latitude: number;
/**
* The height, in meters, above the ellipsoid.
*/
height: number;
/**
* Creates a new Cartographic instance from longitude and latitude
* specified in radians.
* @param longitude - The longitude, in radians.
* @param latitude - The latitude, in radians.
* @param [height = 0.0] - The height, in meters, above the ellipsoid.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if one was not provided.
*/
fromRadians(longitude: number, latitude: number, height?: number, result?: Cartographic): Cartographic;
/**
* Creates a new Cartographic instance from Flongitude and latitude
* specified in degrees. The values in the resulting object will
* be in radians.
* @param longitude - The longitude, in degrees.
* @param latitude - The latitude, in degrees.
* @param [height = 0.0] - The height, in meters, above the ellipsoid.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if one was not provided.
*/
fromDegrees(longitude: number, latitude: number, height?: number, result?: Cartographic): Cartographic;
/**
* Creates a new Cartographic instance from a Cartesian position. The values in the
* resulting object will be in radians.
* @param cartesian - The Cartesian position to convert to cartographic representation.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
*/
fromCartesian(cartesian: Cartesian3, ellipsoid?: Ellipsoid, result?: Cartographic): Cartographic;
/**
* Creates a new Cartesian3 instance from a Cartographic input. The values in the inputted
* object should be in radians.
* @param cartographic - Input to be converted into a Cartesian3 output.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the position lies.
* @param [result] - The object onto which to store the result.
* @returns The position
*/
toCartesian(cartographic: Cartographic, ellipsoid?: Ellipsoid, result?: Cartesian3): Cartesian3;
/**
* Duplicates a Cartographic instance.
* @param cartographic - The cartographic to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if one was not provided. (Returns undefined if cartographic is undefined)
*/
clone(cartographic: Cartographic, result?: Cartographic): Cartographic;
/**
* Compares the provided cartographics componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first cartographic.
* @param [right] - The second cartographic.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Cartographic, right?: Cartographic): boolean;
/**
* Compares the provided cartographics componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [left] - The first cartographic.
* @param [right] - The second cartographic.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Cartographic, right?: Cartographic, epsilon?: number): boolean;
/**
* An immutable Cartographic instance initialized to (0.0, 0.0, 0.0).
*/
readonly ZERO: Cartographic;
/**
* Duplicates this instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if one was not provided.
*/
clone(result?: Cartographic): Cartographic;
/**
* Compares the provided against this cartographic componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The second cartographic.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(right?: Cartographic): boolean;
/**
* Compares the provided against this cartographic componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [right] - The second cartographic.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Cartographic, epsilon?: number): boolean;
/**
* Creates a string representing this cartographic in the format '(longitude, latitude, height)'.
* @returns A string representing the provided cartographic in the format '(longitude, latitude, height)'.
*/
toString(): string;
}
/**
* Geocodes queries containing longitude and latitude coordinates and an optional height.
* Query format: `longitude latitude (height)` with longitude/latitude in degrees and height in meters.
*/
export class CartographicGeocoderService {
constructor();
/**
* @param query - The query to be sent to the geocoder service
*/
geocode(query: string): Promisei
in times
such that the parameter
* time
is in the interval [times[i], times[i + 1]]
.
* @param time - The time.
* @returns The index for the element at the start of the interval.
*/
findTimeInterval(time: number): number;
/**
* Wraps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, wrapped around to the updated animation.
*/
wrapTime(time: number): number;
/**
* Clamps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, clamped to the animation period.
*/
clampTime(time: number): number;
/**
* Evaluates the curve at a given time.
* @param time - The time at which to evaluate the curve.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new instance of the point on the curve at the given time.
*/
evaluate(time: number, result?: Cartesian3): Cartesian3;
}
/**
* A {@link TerrainProvider} 以supermap地形格式访问地形数据.
* @example
* // 创建带有法线的 Arctic DEM terrain.
* const viewer = new SuperMap.Viewer('CesiumContainer', {
* terrainProvider : new SuperMap.SuperMapTerrainProvider({
* url : SuperMap.IonResource.fromAssetId(3956),
* requestVertexNormals : true
* })
* });
* @param options - 具有以下属性的对象:
* @param options.url - SuperMap terrain server的url.
* @param [options.requestVertexNormals = false] - 指示客户端是否应该从服务器请求额外的照明信息,如果可用,以每个顶点法线的形式.
* @param [options.requestWaterMask = false] - 指示客户端是否应该向服务器请求每个瓦片水掩码(如果可用的话).
* @param [options.requestMetadata = true] - 指示客户端是否应该向服务器请求每个tile元数据(如果可用的话).
* @param [options.ellipsoid] - 椭球。如果未指定,则使用WGS84椭球.
* @param [options.credit] - 数据源的信用,它显示在画布上.
*/
export class SuperMapTerrainProvider {
constructor(options: {
url: Resource | string | Promise0
(no intensity) to 1.0
(full intensity).
* @param [red = 1.0] - The red component.
* @param [green = 1.0] - The green component.
* @param [blue = 1.0] - The blue component.
* @param [alpha = 1.0] - The alpha component.
*/
export class Color {
constructor(red?: number, green?: number, blue?: number, alpha?: number);
/**
* The red component.
*/
red: number;
/**
* The green component.
*/
green: number;
/**
* The blue component.
*/
blue: number;
/**
* The alpha component.
*/
alpha: number;
/**
* Creates a Color instance from a {@link Cartesian4}. x
, y
, z
,
* and w
map to red
, green
, blue
, and alpha
, respectively.
* @param cartesian - The source cartesian.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Color instance if one was not provided.
*/
fromCartesian4(cartesian: Cartesian4, result?: Color): Color;
/**
* Creates a new Color specified using red, green, blue, and alpha values
* that are in the range of 0 to 255, converting them internally to a range of 0.0 to 1.0.
* @param [red = 255] - The red component.
* @param [green = 255] - The green component.
* @param [blue = 255] - The blue component.
* @param [alpha = 255] - The alpha component.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Color instance if one was not provided.
*/
fromBytes(red?: number, green?: number, blue?: number, alpha?: number, result?: Color): Color;
/**
* Creates a new Color that has the same red, green, and blue components
* of the specified color, but with the specified alpha value.
* @example
* const translucentRed = SuperMap.Color.fromAlpha(SuperMap.Color.RED, 0.9);
* @param color - The base color
* @param alpha - The new alpha component.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Color instance if one was not provided.
*/
fromAlpha(color: Color, alpha: number, result?: Color): Color;
/**
* Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
* @example
* const color = SuperMap.Color.fromRgba(0x67ADDFFF);
* @param rgba - A single numeric unsigned 32-bit RGBA value.
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The color object.
*/
fromRgba(rgba: number, result?: Color): Color;
/**
* Creates a Color instance from hue, saturation, and lightness.
* @param [hue = 0] - The hue angle 0...1
* @param [saturation = 0] - The saturation value 0...1
* @param [lightness = 0] - The lightness value 0...1
* @param [alpha = 1.0] - The alpha component 0...1
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The color object.
*/
fromHsl(hue?: number, saturation?: number, lightness?: number, alpha?: number, result?: Color): Color;
/**
* Creates a random color using the provided options. For reproducible random colors, you should
* call {@link Math#setRandomNumberSeed} once at the beginning of your application.
* @example
* //Create a completely random color
* const color = SuperMap.Color.fromRandom();
*
* //Create a random shade of yellow.
* const color1 = SuperMap.Color.fromRandom({
* red : 1.0,
* green : 1.0,
* alpha : 1.0
* });
*
* //Create a random bright color.
* const color2 = SuperMap.Color.fromRandom({
* minimumRed : 0.75,
* minimumGreen : 0.75,
* minimumBlue : 0.75,
* alpha : 1.0
* });
* @param [options] - Object with the following properties:
* @param [options.red] - If specified, the red component to use instead of a randomized value.
* @param [options.minimumRed = 0.0] - The maximum red value to generate if none was specified.
* @param [options.maximumRed = 1.0] - The minimum red value to generate if none was specified.
* @param [options.green] - If specified, the green component to use instead of a randomized value.
* @param [options.minimumGreen = 0.0] - The maximum green value to generate if none was specified.
* @param [options.maximumGreen = 1.0] - The minimum green value to generate if none was specified.
* @param [options.blue] - If specified, the blue component to use instead of a randomized value.
* @param [options.minimumBlue = 0.0] - The maximum blue value to generate if none was specified.
* @param [options.maximumBlue = 1.0] - The minimum blue value to generate if none was specified.
* @param [options.alpha] - If specified, the alpha component to use instead of a randomized value.
* @param [options.minimumAlpha = 0.0] - The maximum alpha value to generate if none was specified.
* @param [options.maximumAlpha = 1.0] - The minimum alpha value to generate if none was specified.
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
fromRandom(options?: {
red?: number;
minimumRed?: number;
maximumRed?: number;
green?: number;
minimumGreen?: number;
maximumGreen?: number;
blue?: number;
minimumBlue?: number;
maximumBlue?: number;
alpha?: number;
minimumAlpha?: number;
maximumAlpha?: number;
}, result?: Color): Color;
/**
* Creates a Color instance from a CSS color value.
* @example
* const CesiumBlue = SuperMap.Color.fromCssColorString('#67ADDF');
* const green = SuperMap.Color.fromCssColorString('green');
* @param color - The CSS color value in #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), or hsla() format.
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The color object, or undefined if the string was not a valid CSS color.
*/
fromCssColorString(color: string, result?: Color): Color;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Color, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Color instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Color): Color;
/**
* Converts a 'byte' color component in the range of 0 to 255 into
* a 'float' color component in the range of 0 to 1.0.
* @param number - The number to be converted.
* @returns The converted number.
*/
byteToFloat(number: number): number;
/**
* Converts a 'float' color component in the range of 0 to 1.0 into
* a 'byte' color component in the range of 0 to 255.
* @param number - The number to be converted.
* @returns The converted number.
*/
floatToByte(number: number): number;
/**
* Duplicates a Color.
* @param color - The Color to duplicate.
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)
*/
clone(color: Color, result?: Color): Color;
/**
* Returns true if the first Color equals the second color.
* @param left - The first Color to compare for equality.
* @param right - The second Color to compare for equality.
* @returns true
if the Colors are equal; otherwise, false
.
*/
equals(left: Color, right: Color): boolean;
/**
* Returns a duplicate of a Color instance.
* @param [result] - The object to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
clone(result?: Color): Color;
/**
* Returns true if this Color equals other.
* @param other - The Color to compare for equality.
* @returns true
if the Colors are equal; otherwise, false
.
*/
equals(other: Color): boolean;
/**
* Returns true
if this Color equals other componentwise within the specified epsilon.
* @param other - The Color to compare for equality.
* @param [epsilon = 0.0] - The epsilon to use for equality testing.
* @returns true
if the Colors are equal within the specified epsilon; otherwise, false
.
*/
equalsEpsilon(other: Color, epsilon?: number): boolean;
/**
* Creates a string representing this Color in the format '(red, green, blue, alpha)'.
* @returns A string representing this Color in the format '(red, green, blue, alpha)'.
*/
toString(): string;
/**
* Creates a string containing the CSS color value for this color.
* @returns The CSS equivalent of this color.
*/
toCssColorString(): string;
/**
* Creates a string containing CSS hex string color value for this color.
* @returns The CSS hex string equivalent of this color.
*/
toCssHexString(): string;
/**
* Converts this color to an array of red, green, blue, and alpha values
* that are in the range of 0 to 255.
* @param [result] - The array to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
toBytes(result?: number[]): number[];
/**
* Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
* @example
* const rgba = SuperMap.Color.BLUE.toRgba();
* @returns A single numeric unsigned 32-bit RGBA value.
*/
toRgba(): number;
/**
* Brightens this color by the provided magnitude.
* @example
* const brightBlue = SuperMap.Color.BLUE.brighten(0.5, new SuperMap.Color());
* @param magnitude - A positive number indicating the amount to brighten.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
brighten(magnitude: number, result: Color): Color;
/**
* Darkens this color by the provided magnitude.
* @example
* const darkBlue = SuperMap.Color.BLUE.darken(0.5, new SuperMap.Color());
* @param magnitude - A positive number indicating the amount to darken.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
darken(magnitude: number, result: Color): Color;
/**
* Creates a new Color that has the same red, green, and blue components
* as this Color, but with the specified alpha value.
* @example
* const translucentRed = SuperMap.Color.RED.withAlpha(0.9);
* @param alpha - The new alpha component.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Color instance if one was not provided.
*/
withAlpha(alpha: number, result?: Color): Color;
/**
* Computes the componentwise sum of two Colors.
* @param left - The first Color.
* @param right - The second Color.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Color, right: Color, result: Color): Color;
/**
* Computes the componentwise difference of two Colors.
* @param left - The first Color.
* @param right - The second Color.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Color, right: Color, result: Color): Color;
/**
* Computes the componentwise product of two Colors.
* @param left - The first Color.
* @param right - The second Color.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiply(left: Color, right: Color, result: Color): Color;
/**
* Computes the componentwise quotient of two Colors.
* @param left - The first Color.
* @param right - The second Color.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divide(left: Color, right: Color, result: Color): Color;
/**
* Computes the componentwise modulus of two Colors.
* @param left - The first Color.
* @param right - The second Color.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
mod(left: Color, right: Color, result: Color): Color;
/**
* Computes the linear interpolation or extrapolation at t between the provided colors.
* @param start - The color corresponding to t at 0.0.
* @param end - The color corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
lerp(start: Color, end: Color, t: number, result: Color): Color;
/**
* Multiplies the provided Color componentwise by the provided scalar.
* @param color - The Color to be scaled.
* @param scalar - The scalar to multiply with.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(color: Color, scalar: number, result: Color): Color;
/**
* Divides the provided Color componentwise by the provided scalar.
* @param color - The Color to be divided.
* @param scalar - The scalar to divide with.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideByScalar(color: Color, scalar: number, result: Color): Color;
/**
* An immutable Color instance initialized to CSS color #F0F8FF
*
*/
readonly ALICEBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #FAEBD7
*
*/
readonly ANTIQUEWHITE: Color;
/**
* An immutable Color instance initialized to CSS color #00FFFF
*
*/
readonly AQUA: Color;
/**
* An immutable Color instance initialized to CSS color #7FFFD4
*
*/
readonly AQUAMARINE: Color;
/**
* An immutable Color instance initialized to CSS color #F0FFFF
*
*/
readonly AZURE: Color;
/**
* An immutable Color instance initialized to CSS color #F5F5DC
*
*/
readonly BEIGE: Color;
/**
* An immutable Color instance initialized to CSS color #FFE4C4
*
*/
readonly BISQUE: Color;
/**
* An immutable Color instance initialized to CSS color #000000
*
*/
readonly BLACK: Color;
/**
* An immutable Color instance initialized to CSS color #FFEBCD
*
*/
readonly BLANCHEDALMOND: Color;
/**
* An immutable Color instance initialized to CSS color #0000FF
*
*/
readonly BLUE: Color;
/**
* An immutable Color instance initialized to CSS color #8A2BE2
*
*/
readonly BLUEVIOLET: Color;
/**
* An immutable Color instance initialized to CSS color #A52A2A
*
*/
readonly BROWN: Color;
/**
* An immutable Color instance initialized to CSS color #DEB887
*
*/
readonly BURLYWOOD: Color;
/**
* An immutable Color instance initialized to CSS color #5F9EA0
*
*/
readonly CADETBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #7FFF00
*
*/
readonly CHARTREUSE: Color;
/**
* An immutable Color instance initialized to CSS color #D2691E
*
*/
readonly CHOCOLATE: Color;
/**
* An immutable Color instance initialized to CSS color #FF7F50
*
*/
readonly CORAL: Color;
/**
* An immutable Color instance initialized to CSS color #6495ED
*
*/
readonly CORNFLOWERBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #FFF8DC
*
*/
readonly CORNSILK: Color;
/**
* An immutable Color instance initialized to CSS color #DC143C
*
*/
readonly CRIMSON: Color;
/**
* An immutable Color instance initialized to CSS color #00FFFF
*
*/
readonly CYAN: Color;
/**
* An immutable Color instance initialized to CSS color #00008B
*
*/
readonly DARKBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #008B8B
*
*/
readonly DARKCYAN: Color;
/**
* An immutable Color instance initialized to CSS color #B8860B
*
*/
readonly DARKGOLDENROD: Color;
/**
* An immutable Color instance initialized to CSS color #A9A9A9
*
*/
readonly DARKGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #006400
*
*/
readonly DARKGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #A9A9A9
*
*/
readonly DARKGREY: Color;
/**
* An immutable Color instance initialized to CSS color #BDB76B
*
*/
readonly DARKKHAKI: Color;
/**
* An immutable Color instance initialized to CSS color #8B008B
*
*/
readonly DARKMAGENTA: Color;
/**
* An immutable Color instance initialized to CSS color #556B2F
*
*/
readonly DARKOLIVEGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #FF8C00
*
*/
readonly DARKORANGE: Color;
/**
* An immutable Color instance initialized to CSS color #9932CC
*
*/
readonly DARKORCHID: Color;
/**
* An immutable Color instance initialized to CSS color #8B0000
*
*/
readonly DARKRED: Color;
/**
* An immutable Color instance initialized to CSS color #E9967A
*
*/
readonly DARKSALMON: Color;
/**
* An immutable Color instance initialized to CSS color #8FBC8F
*
*/
readonly DARKSEAGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #483D8B
*
*/
readonly DARKSLATEBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #2F4F4F
*
*/
readonly DARKSLATEGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #2F4F4F
*
*/
readonly DARKSLATEGREY: Color;
/**
* An immutable Color instance initialized to CSS color #00CED1
*
*/
readonly DARKTURQUOISE: Color;
/**
* An immutable Color instance initialized to CSS color #9400D3
*
*/
readonly DARKVIOLET: Color;
/**
* An immutable Color instance initialized to CSS color #FF1493
*
*/
readonly DEEPPINK: Color;
/**
* An immutable Color instance initialized to CSS color #00BFFF
*
*/
readonly DEEPSKYBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #696969
*
*/
readonly DIMGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #696969
*
*/
readonly DIMGREY: Color;
/**
* An immutable Color instance initialized to CSS color #1E90FF
*
*/
readonly DODGERBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #B22222
*
*/
readonly FIREBRICK: Color;
/**
* An immutable Color instance initialized to CSS color #FFFAF0
*
*/
readonly FLORALWHITE: Color;
/**
* An immutable Color instance initialized to CSS color #228B22
*
*/
readonly FORESTGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #FF00FF
*
*/
readonly FUCHSIA: Color;
/**
* An immutable Color instance initialized to CSS color #DCDCDC
*
*/
readonly GAINSBORO: Color;
/**
* An immutable Color instance initialized to CSS color #F8F8FF
*
*/
readonly GHOSTWHITE: Color;
/**
* An immutable Color instance initialized to CSS color #FFD700
*
*/
readonly GOLD: Color;
/**
* An immutable Color instance initialized to CSS color #DAA520
*
*/
readonly GOLDENROD: Color;
/**
* An immutable Color instance initialized to CSS color #808080
*
*/
readonly GRAY: Color;
/**
* An immutable Color instance initialized to CSS color #008000
*
*/
readonly GREEN: Color;
/**
* An immutable Color instance initialized to CSS color #ADFF2F
*
*/
readonly GREENYELLOW: Color;
/**
* An immutable Color instance initialized to CSS color #808080
*
*/
readonly GREY: Color;
/**
* An immutable Color instance initialized to CSS color #F0FFF0
*
*/
readonly HONEYDEW: Color;
/**
* An immutable Color instance initialized to CSS color #FF69B4
*
*/
readonly HOTPINK: Color;
/**
* An immutable Color instance initialized to CSS color #CD5C5C
*
*/
readonly INDIANRED: Color;
/**
* An immutable Color instance initialized to CSS color #4B0082
*
*/
readonly INDIGO: Color;
/**
* An immutable Color instance initialized to CSS color #FFFFF0
*
*/
readonly IVORY: Color;
/**
* An immutable Color instance initialized to CSS color #F0E68C
*
*/
readonly KHAKI: Color;
/**
* An immutable Color instance initialized to CSS color #E6E6FA
*
*/
readonly LAVENDER: Color;
/**
* An immutable Color instance initialized to CSS color #FFF0F5
*
*/
readonly LAVENDAR_BLUSH: Color;
/**
* An immutable Color instance initialized to CSS color #7CFC00
*
*/
readonly LAWNGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #FFFACD
*
*/
readonly LEMONCHIFFON: Color;
/**
* An immutable Color instance initialized to CSS color #ADD8E6
*
*/
readonly LIGHTBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #F08080
*
*/
readonly LIGHTCORAL: Color;
/**
* An immutable Color instance initialized to CSS color #E0FFFF
*
*/
readonly LIGHTCYAN: Color;
/**
* An immutable Color instance initialized to CSS color #FAFAD2
*
*/
readonly LIGHTGOLDENRODYELLOW: Color;
/**
* An immutable Color instance initialized to CSS color #D3D3D3
*
*/
readonly LIGHTGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #90EE90
*
*/
readonly LIGHTGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #D3D3D3
*
*/
readonly LIGHTGREY: Color;
/**
* An immutable Color instance initialized to CSS color #FFB6C1
*
*/
readonly LIGHTPINK: Color;
/**
* An immutable Color instance initialized to CSS color #20B2AA
*
*/
readonly LIGHTSEAGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #87CEFA
*
*/
readonly LIGHTSKYBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #778899
*
*/
readonly LIGHTSLATEGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #778899
*
*/
readonly LIGHTSLATEGREY: Color;
/**
* An immutable Color instance initialized to CSS color #B0C4DE
*
*/
readonly LIGHTSTEELBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #FFFFE0
*
*/
readonly LIGHTYELLOW: Color;
/**
* An immutable Color instance initialized to CSS color #00FF00
*
*/
readonly LIME: Color;
/**
* An immutable Color instance initialized to CSS color #32CD32
*
*/
readonly LIMEGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #FAF0E6
*
*/
readonly LINEN: Color;
/**
* An immutable Color instance initialized to CSS color #FF00FF
*
*/
readonly MAGENTA: Color;
/**
* An immutable Color instance initialized to CSS color #800000
*
*/
readonly MAROON: Color;
/**
* An immutable Color instance initialized to CSS color #66CDAA
*
*/
readonly MEDIUMAQUAMARINE: Color;
/**
* An immutable Color instance initialized to CSS color #0000CD
*
*/
readonly MEDIUMBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #BA55D3
*
*/
readonly MEDIUMORCHID: Color;
/**
* An immutable Color instance initialized to CSS color #9370DB
*
*/
readonly MEDIUMPURPLE: Color;
/**
* An immutable Color instance initialized to CSS color #3CB371
*
*/
readonly MEDIUMSEAGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #7B68EE
*
*/
readonly MEDIUMSLATEBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #00FA9A
*
*/
readonly MEDIUMSPRINGGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #48D1CC
*
*/
readonly MEDIUMTURQUOISE: Color;
/**
* An immutable Color instance initialized to CSS color #C71585
*
*/
readonly MEDIUMVIOLETRED: Color;
/**
* An immutable Color instance initialized to CSS color #191970
*
*/
readonly MIDNIGHTBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #F5FFFA
*
*/
readonly MINTCREAM: Color;
/**
* An immutable Color instance initialized to CSS color #FFE4E1
*
*/
readonly MISTYROSE: Color;
/**
* An immutable Color instance initialized to CSS color #FFE4B5
*
*/
readonly MOCCASIN: Color;
/**
* An immutable Color instance initialized to CSS color #FFDEAD
*
*/
readonly NAVAJOWHITE: Color;
/**
* An immutable Color instance initialized to CSS color #000080
*
*/
readonly NAVY: Color;
/**
* An immutable Color instance initialized to CSS color #FDF5E6
*
*/
readonly OLDLACE: Color;
/**
* An immutable Color instance initialized to CSS color #808000
*
*/
readonly OLIVE: Color;
/**
* An immutable Color instance initialized to CSS color #6B8E23
*
*/
readonly OLIVEDRAB: Color;
/**
* An immutable Color instance initialized to CSS color #FFA500
*
*/
readonly ORANGE: Color;
/**
* An immutable Color instance initialized to CSS color #FF4500
*
*/
readonly ORANGERED: Color;
/**
* An immutable Color instance initialized to CSS color #DA70D6
*
*/
readonly ORCHID: Color;
/**
* An immutable Color instance initialized to CSS color #EEE8AA
*
*/
readonly PALEGOLDENROD: Color;
/**
* An immutable Color instance initialized to CSS color #98FB98
*
*/
readonly PALEGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #AFEEEE
*
*/
readonly PALETURQUOISE: Color;
/**
* An immutable Color instance initialized to CSS color #DB7093
*
*/
readonly PALEVIOLETRED: Color;
/**
* An immutable Color instance initialized to CSS color #FFEFD5
*
*/
readonly PAPAYAWHIP: Color;
/**
* An immutable Color instance initialized to CSS color #FFDAB9
*
*/
readonly PEACHPUFF: Color;
/**
* An immutable Color instance initialized to CSS color #CD853F
*
*/
readonly PERU: Color;
/**
* An immutable Color instance initialized to CSS color #FFC0CB
*
*/
readonly PINK: Color;
/**
* An immutable Color instance initialized to CSS color #DDA0DD
*
*/
readonly PLUM: Color;
/**
* An immutable Color instance initialized to CSS color #B0E0E6
*
*/
readonly POWDERBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #800080
*
*/
readonly PURPLE: Color;
/**
* An immutable Color instance initialized to CSS color #FF0000
*
*/
readonly RED: Color;
/**
* An immutable Color instance initialized to CSS color #BC8F8F
*
*/
readonly ROSYBROWN: Color;
/**
* An immutable Color instance initialized to CSS color #4169E1
*
*/
readonly ROYALBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #8B4513
*
*/
readonly SADDLEBROWN: Color;
/**
* An immutable Color instance initialized to CSS color #FA8072
*
*/
readonly SALMON: Color;
/**
* An immutable Color instance initialized to CSS color #F4A460
*
*/
readonly SANDYBROWN: Color;
/**
* An immutable Color instance initialized to CSS color #2E8B57
*
*/
readonly SEAGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #FFF5EE
*
*/
readonly SEASHELL: Color;
/**
* An immutable Color instance initialized to CSS color #A0522D
*
*/
readonly SIENNA: Color;
/**
* An immutable Color instance initialized to CSS color #C0C0C0
*
*/
readonly SILVER: Color;
/**
* An immutable Color instance initialized to CSS color #87CEEB
*
*/
readonly SKYBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #6A5ACD
*
*/
readonly SLATEBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #708090
*
*/
readonly SLATEGRAY: Color;
/**
* An immutable Color instance initialized to CSS color #708090
*
*/
readonly SLATEGREY: Color;
/**
* An immutable Color instance initialized to CSS color #FFFAFA
*
*/
readonly SNOW: Color;
/**
* An immutable Color instance initialized to CSS color #00FF7F
*
*/
readonly SPRINGGREEN: Color;
/**
* An immutable Color instance initialized to CSS color #4682B4
*
*/
readonly STEELBLUE: Color;
/**
* An immutable Color instance initialized to CSS color #D2B48C
*
*/
readonly TAN: Color;
/**
* An immutable Color instance initialized to CSS color #008080
*
*/
readonly TEAL: Color;
/**
* An immutable Color instance initialized to CSS color #D8BFD8
*
*/
readonly THISTLE: Color;
/**
* An immutable Color instance initialized to CSS color #FF6347
*
*/
readonly TOMATO: Color;
/**
* An immutable Color instance initialized to CSS color #40E0D0
*
*/
readonly TURQUOISE: Color;
/**
* An immutable Color instance initialized to CSS color #EE82EE
*
*/
readonly VIOLET: Color;
/**
* An immutable Color instance initialized to CSS color #F5DEB3
*
*/
readonly WHEAT: Color;
/**
* An immutable Color instance initialized to CSS color #FFFFFF
*
*/
readonly WHITE: Color;
/**
* An immutable Color instance initialized to CSS color #F5F5F5
*
*/
readonly WHITESMOKE: Color;
/**
* An immutable Color instance initialized to CSS color #FFFF00
*
*/
readonly YELLOW: Color;
/**
* An immutable Color instance initialized to CSS color #9ACD32
*
*/
readonly YELLOWGREEN: Color;
/**
* An immutable Color instance initialized to CSS transparent.
*
*/
readonly TRANSPARENT: Color;
}
/**
* Value and type information for per-instance geometry color.
* @example
* const instance = new SuperMap.GeometryInstance({
* geometry : SuperMap.BoxGeometry.fromDimensions({
* dimensions : new SuperMap.Cartesian3(1000000.0, 1000000.0, 500000.0)
* }),
* modelMatrix : SuperMap.Matrix4.multiplyByTranslation(SuperMap.Transforms.eastNorthUpToFixedFrame(
* SuperMap.Cartesian3.fromDegrees(0.0, 0.0)), new SuperMap.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap.Matrix4()),
* id : 'box',
* attributes : {
* color : new SuperMap.ColorGeometryInstanceAttribute(red, green, blue, alpha)
* }
* });
* @param [red = 1.0] - The red component.
* @param [green = 1.0] - The green component.
* @param [blue = 1.0] - The blue component.
* @param [alpha = 1.0] - The alpha component.
*/
export class ColorGeometryInstanceAttribute {
constructor(red?: number, green?: number, blue?: number, alpha?: number);
/**
* The values for the attributes stored in a typed array.
*/
value: Uint8Array;
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@link ColorGeometryInstanceAttribute#value}.
*/
readonly componentDatatype: ComponentDatatype;
/**
* The number of components in the attributes, i.e., {@link ColorGeometryInstanceAttribute#value}.
*/
readonly componentsPerAttribute: number;
/**
* When true
and componentDatatype
is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
*/
readonly normalize: boolean;
/**
* Creates a new {@link ColorGeometryInstanceAttribute} instance given the provided {@link Color}.
* @example
* const instance = new SuperMap.GeometryInstance({
* geometry : geometry,
* attributes : {
* color : SuperMap.ColorGeometryInstanceAttribute.fromColor(SuperMap.Color.CORNFLOWERBLUE),
* }
* });
* @param color - The color.
* @returns The new {@link ColorGeometryInstanceAttribute} instance.
*/
fromColor(color: Color): ColorGeometryInstanceAttribute;
/**
* Converts a color to a typed array that can be used to assign a color attribute.
* @example
* const attributes = primitive.getGeometryInstanceAttributes('an id');
* attributes.color = SuperMap.ColorGeometryInstanceAttribute.toValue(SuperMap.Color.AQUA, attributes.color);
* @param color - The color.
* @param [result] - The array to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
toValue(color: Color, result?: Uint8Array): Uint8Array;
/**
* Compares the provided ColorGeometryInstanceAttributes and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first ColorGeometryInstanceAttribute.
* @param [right] - The second ColorGeometryInstanceAttribute.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: ColorGeometryInstanceAttribute, right?: ColorGeometryInstanceAttribute): boolean;
}
/**
* WebGL component datatypes. Components are intrinsics,
* which form attributes, which form vertices.
*/
export enum ComponentDatatype {
/**
* 8-bit signed byte corresponding to gl.BYTE
and the type
* of an element in Int8Array
.
*/
BYTE = WebGLConstants.BYTE,
/**
* 8-bit unsigned byte corresponding to UNSIGNED_BYTE
and the type
* of an element in Uint8Array
.
*/
UNSIGNED_BYTE = WebGLConstants.UNSIGNED_BYTE,
/**
* 16-bit signed short corresponding to SHORT
and the type
* of an element in Int16Array
.
*/
SHORT = WebGLConstants.SHORT,
/**
* 16-bit unsigned short corresponding to UNSIGNED_SHORT
and the type
* of an element in Uint16Array
.
*/
UNSIGNED_SHORT = WebGLConstants.UNSIGNED_SHORT,
/**
* 32-bit signed int corresponding to INT
and the type
* of an element in Int32Array
.
*/
INT = WebGLConstants.INT,
/**
* 32-bit unsigned int corresponding to UNSIGNED_INT
and the type
* of an element in Uint32Array
.
*/
UNSIGNED_INT = WebGLConstants.UNSIGNED_INT,
/**
* 32-bit floating-point corresponding to FLOAT
and the type
* of an element in Float32Array
.
*/
FLOAT = WebGLConstants.FLOAT,
/**
* 64-bit floating-point corresponding to gl.DOUBLE
(in Desktop OpenGL;
* this is not supported in WebGL, and is emulated in SuperMap via {@link GeometryPipeline.encodeAttribute})
* and the type of an element in Float64Array
.
*/
DOUBLE = WebGLConstants.DOUBLE
}
/**
* Describes a compressed texture and contains a compressed texture buffer.
* @param internalFormat - The pixel format of the compressed texture.
* @param pixelDatatype - The pixel datatype of the compressed texture.
* @param width - The width of the texture.
* @param height - The height of the texture.
* @param buffer - The compressed texture buffer.
*/
export class CompressedTextureBuffer {
constructor(internalFormat: PixelFormat, pixelDatatype: PixelDatatype, width: number, height: number, buffer: Uint8Array);
/**
* The format of the compressed texture.
*/
readonly internalFormat: PixelFormat;
/**
* The datatype of the compressed texture.
*/
readonly pixelDatatype: PixelDatatype;
/**
* The width of the texture.
*/
readonly width: number;
/**
* The height of the texture.
*/
readonly height: number;
/**
* The compressed texture buffer.
*/
readonly bufferView: Uint8Array;
/**
* Creates a shallow clone of a compressed texture buffer.
* @param object - The compressed texture buffer to be cloned.
* @returns A shallow clone of the compressed texture buffer.
*/
clone(object: CompressedTextureBuffer): CompressedTextureBuffer;
/**
* Creates a shallow clone of this compressed texture buffer.
* @returns A shallow clone of the compressed texture buffer.
*/
clone(): CompressedTextureBuffer;
}
/**
* A description of a polygon composed of arbitrary coplanar positions.
* @example
* const polygonGeometry = new SuperMap.CoplanarPolygonGeometry({
* polygonHierarchy: new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArrayHeights([
* -90.0, 30.0, 0.0,
* -90.0, 30.0, 300000.0,
* -80.0, 30.0, 300000.0,
* -80.0, 30.0, 0.0
* ]))
* });
* @param options - Object with the following properties:
* @param options.polygonHierarchy - A polygon hierarchy that can include holes.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.textureCoordinates] - Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points.
*/
export class CoplanarPolygonGeometry {
constructor(options: {
polygonHierarchy: PolygonHierarchy;
stRotation?: number;
vertexFormat?: VertexFormat;
ellipsoid?: Ellipsoid;
textureCoordinates?: PolygonHierarchy;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* A description of a coplanar polygon from an array of positions.
* @example
* // create a polygon from points
* const polygon = SuperMap.CoplanarPolygonGeometry.fromPositions({
* positions : SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* });
* const geometry = SuperMap.PolygonGeometry.createGeometry(polygon);
* @param options - Object with the following properties:
* @param options.positions - An array of positions that defined the corner points of the polygon.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.textureCoordinates] - Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points.
*/
fromPositions(options: {
positions: Cartesian3[];
vertexFormat?: VertexFormat;
stRotation?: number;
ellipsoid?: Ellipsoid;
textureCoordinates?: PolygonHierarchy;
}): CoplanarPolygonGeometry;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CoplanarPolygonGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CoplanarPolygonGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CoplanarPolygonGeometry): CoplanarPolygonGeometry;
/**
* Computes the geometric representation of an arbitrary coplanar polygon, including its vertices, indices, and a bounding sphere.
* @param polygonGeometry - A description of the polygon.
* @returns The computed vertices and indices.
*/
createGeometry(polygonGeometry: CoplanarPolygonGeometry): Geometry | undefined;
}
/**
* A description of the outline of a polygon composed of arbitrary coplanar positions.
* @example
* const polygonOutline = new SuperMap.CoplanarPolygonOutlineGeometry({
* positions : SuperMap.Cartesian3.fromDegreesArrayHeights([
* -90.0, 30.0, 0.0,
* -90.0, 30.0, 1000.0,
* -80.0, 30.0, 1000.0,
* -80.0, 30.0, 0.0
* ])
* });
* const geometry = SuperMap.CoplanarPolygonOutlineGeometry.createGeometry(polygonOutline);
* @param options - Object with the following properties:
* @param options.polygonHierarchy - A polygon hierarchy that can include holes.
*/
export class CoplanarPolygonOutlineGeometry {
constructor(options: {
polygonHierarchy: PolygonHierarchy;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* A description of a coplanar polygon outline from an array of positions.
* @param options - Object with the following properties:
* @param options.positions - An array of positions that defined the corner points of the polygon.
*/
fromPositions(options: {
positions: Cartesian3[];
}): CoplanarPolygonOutlineGeometry;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CoplanarPolygonOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CoplanarPolygonOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CoplanarPolygonOutlineGeometry): CoplanarPolygonOutlineGeometry;
/**
* Computes the geometric representation of an arbitrary coplanar polygon, including its vertices, indices, and a bounding sphere.
* @param polygonGeometry - A description of the polygon.
* @returns The computed vertices and indices.
*/
createGeometry(polygonGeometry: CoplanarPolygonOutlineGeometry): Geometry | undefined;
}
/**
* Style options for corners.
*/
export enum CornerType {
/**
*
*
* Corner has a smooth edge.
*/
ROUNDED = 0,
/**
*
*
* Corner point is the intersection of adjacent edges.
*/
MITERED = 1,
/**
*
*
* Corner is clipped.
*/
BEVELED = 2
}
/**
* A description of a corridor. Corridor geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
* @example
* const corridor = new SuperMap.CorridorGeometry({
* vertexFormat : SuperMap.VertexFormat.POSITION_ONLY,
* positions : SuperMap.Cartesian3.fromDegreesArray([-72.0, 40.0, -70.0, 35.0]),
* width : 100000
* });
* @param options - Object with the following properties:
* @param options.positions - An array of positions that define the center of the corridor.
* @param options.width - The distance between the edges of the corridor in meters.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.height = 0] - The distance in meters between the ellipsoid surface and the positions.
* @param [options.extrudedHeight] - The distance in meters between the ellipsoid surface and the extruded face.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.cornerType = CornerType.ROUNDED] - Determines the style of the corners.
*/
export class CorridorGeometry {
constructor(options: {
positions: Cartesian3[];
width: number;
ellipsoid?: Ellipsoid;
granularity?: number;
height?: number;
extrudedHeight?: number;
vertexFormat?: VertexFormat;
cornerType?: CornerType;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CorridorGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CorridorGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CorridorGeometry): CorridorGeometry;
/**
* Computes the bounding rectangle given the provided options
* @param options - Object with the following properties:
* @param options.positions - An array of positions that define the center of the corridor.
* @param options.width - The distance between the edges of the corridor in meters.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.cornerType = CornerType.ROUNDED] - Determines the style of the corners.
* @param [result] - An object in which to store the result.
* @returns The result rectangle.
*/
computeRectangle(options: {
positions: Cartesian3[];
width: number;
ellipsoid?: Ellipsoid;
cornerType?: CornerType;
}, result?: Rectangle): Rectangle;
/**
* Computes the geometric representation of a corridor, including its vertices, indices, and a bounding sphere.
* @param corridorGeometry - A description of the corridor.
* @returns The computed vertices and indices.
*/
createGeometry(corridorGeometry: CorridorGeometry): Geometry | undefined;
}
/**
* A description of a corridor outline.
* @example
* const corridor = new SuperMap.CorridorOutlineGeometry({
* positions : SuperMap.Cartesian3.fromDegreesArray([-72.0, 40.0, -70.0, 35.0]),
* width : 100000
* });
* @param options - Object with the following properties:
* @param options.positions - An array of positions that define the center of the corridor outline.
* @param options.width - The distance between the edges of the corridor outline.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.height = 0] - The distance in meters between the positions and the ellipsoid surface.
* @param [options.extrudedHeight] - The distance in meters between the extruded face and the ellipsoid surface.
* @param [options.cornerType = CornerType.ROUNDED] - Determines the style of the corners.
*/
export class CorridorOutlineGeometry {
constructor(options: {
positions: Cartesian3[];
width: number;
ellipsoid?: Ellipsoid;
granularity?: number;
height?: number;
extrudedHeight?: number;
cornerType?: CornerType;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CorridorOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CorridorOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CorridorOutlineGeometry): CorridorOutlineGeometry;
/**
* Computes the geometric representation of a corridor, including its vertices, indices, and a bounding sphere.
* @param corridorOutlineGeometry - A description of the corridor.
* @returns The computed vertices and indices.
*/
createGeometry(corridorOutlineGeometry: CorridorOutlineGeometry): Geometry | undefined;
}
/**
* A credit contains data pertaining to how to display attributions/credits for certain content on the screen.
* @example
* //Create a credit with a tooltip, image and link
* @param html - An string representing an html code snippet
* @param [showOnScreen = false] - If true, the credit will be visible in the main credit container. Otherwise, it will appear in a popover
*/
export class Credit {
constructor(html: string, showOnScreen?: boolean);
/**
* The credit content
*/
readonly html: string;
/**
* Whether the credit should be displayed on screen or in a lightbox
*/
showOnScreen: boolean;
/**
* Gets the credit element
*/
readonly element: HTMLElement;
/**
* Returns true if the credits are equal
* @param left - The first credit
* @param right - The second credit
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left: Credit, right: Credit): boolean;
/**
* Returns true if the credits are equal
* @param credit - The credit to compare to.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(credit: Credit): boolean;
/**
* Duplicates a Credit instance.
* @param [credit] - The Credit to duplicate.
* @returns A new Credit instance that is a duplicate of the one provided. (Returns undefined if the credit is undefined)
*/
clone(credit?: Credit): Credit;
}
/**
* Defines functions for 3rd order polynomial functions of one variable with only real coefficients.
*/
export namespace CubicRealPolynomial {
/**
* Provides the discriminant of the cubic equation from the supplied coefficients.
* @param a - The coefficient of the 3rd order monomial.
* @param b - The coefficient of the 2nd order monomial.
* @param c - The coefficient of the 1st order monomial.
* @param d - The coefficient of the 0th order monomial.
* @returns The value of the discriminant.
*/
function computeDiscriminant(a: number, b: number, c: number, d: number): number;
/**
* Provides the real valued roots of the cubic polynomial with the provided coefficients.
* @param a - The coefficient of the 3rd order monomial.
* @param b - The coefficient of the 2nd order monomial.
* @param c - The coefficient of the 1st order monomial.
* @param d - The coefficient of the 0th order monomial.
* @returns The real valued roots.
*/
function computeRealRoots(a: number, b: number, c: number, d: number): number[];
}
/**
* The culling volume defined by planes.
* @param [planes] - An array of clipping planes.
*/
export class CullingVolume {
constructor(planes?: Cartesian4[]);
/**
* Each plane is represented by a Cartesian4 object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin.
*/
planes: Cartesian4[];
/**
* Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.
* The planes are aligned to the x, y, and z axes in world coordinates.
* @param boundingSphere - The bounding sphere used to create the culling volume.
* @param [result] - The object onto which to store the result.
* @returns The culling volume created from the bounding sphere.
*/
fromBoundingSphere(boundingSphere: BoundingSphere, result?: CullingVolume): CullingVolume;
/**
* Determines whether a bounding volume intersects the culling volume.
* @param boundingVolume - The bounding volume whose intersection with the culling volume is to be tested.
* @returns Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE.
*/
computeVisibility(boundingVolume: any): Intersect;
}
/**
* A description of a cylinder.
* @example
* // create cylinder geometry
* const cylinder = new SuperMap.CylinderGeometry({
* length: 200000,
* topRadius: 80000,
* bottomRadius: 200000,
* });
* const geometry = SuperMap.CylinderGeometry.createGeometry(cylinder);
* @param options - Object with the following properties:
* @param options.length - The length of the cylinder.
* @param options.topRadius - The radius of the top of the cylinder.
* @param options.bottomRadius - The radius of the bottom of the cylinder.
* @param [options.slices = 128] - The number of edges around the perimeter of the cylinder.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class CylinderGeometry {
constructor(options: {
length: number;
topRadius: number;
bottomRadius: number;
slices?: number;
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CylinderGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CylinderGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CylinderGeometry): CylinderGeometry;
/**
* Computes the geometric representation of a cylinder, including its vertices, indices, and a bounding sphere.
* @param cylinderGeometry - A description of the cylinder.
* @returns The computed vertices and indices.
*/
createGeometry(cylinderGeometry: CylinderGeometry): Geometry | undefined;
}
/**
* A description of the outline of a cylinder.
* @example
* // create cylinder geometry
* const cylinder = new SuperMap.CylinderOutlineGeometry({
* length: 200000,
* topRadius: 80000,
* bottomRadius: 200000,
* });
* const geometry = SuperMap.CylinderOutlineGeometry.createGeometry(cylinder);
* @param options - Object with the following properties:
* @param options.length - The length of the cylinder.
* @param options.topRadius - The radius of the top of the cylinder.
* @param options.bottomRadius - The radius of the bottom of the cylinder.
* @param [options.slices = 128] - The number of edges around the perimeter of the cylinder.
* @param [options.numberOfVerticalLines = 16] - Number of lines to draw between the top and bottom surfaces of the cylinder.
*/
export class CylinderOutlineGeometry {
constructor(options: {
length: number;
topRadius: number;
bottomRadius: number;
slices?: number;
numberOfVerticalLines?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: CylinderOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new CylinderOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: CylinderOutlineGeometry): CylinderOutlineGeometry;
/**
* Computes the geometric representation of an outline of a cylinder, including its vertices, indices, and a bounding sphere.
* @param cylinderGeometry - A description of the cylinder outline.
* @returns The computed vertices and indices.
*/
createGeometry(cylinderGeometry: CylinderOutlineGeometry): Geometry | undefined;
}
/**
* A simple proxy that appends the desired resource as the sole query parameter
* to the given proxy URL.
* @param proxy - The proxy URL that will be used to requests all resources.
*/
export class DefaultProxy extends Proxy {
constructor(proxy: string);
/**
* Get the final URL to use to request a given resource.
* @param resource - The resource to request.
* @returns proxied resource
*/
getURL(resource: string): string;
}
/**
* Constructs an exception object that is thrown due to a developer error, e.g., invalid argument,
* argument out of range, etc. This exception should only be thrown during development;
* it usually indicates a bug in the calling code. This exception should never be
* caught; instead the calling code should strive not to generate it.
* true
and componentDatatype
is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
*/
readonly normalize: boolean;
/**
* Creates a new {@link DistanceDisplayConditionGeometryInstanceAttribute} instance given the provided an enabled flag and {@link DistanceDisplayCondition}.
* @example
* const distanceDisplayCondition = new SuperMap.DistanceDisplayCondition(100.0, 10000.0);
* const instance = new SuperMap.GeometryInstance({
* geometry : geometry,
* attributes : {
* distanceDisplayCondition : SuperMap.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition)
* }
* });
* @param distanceDisplayCondition - The distance display condition.
* @returns The new {@link DistanceDisplayConditionGeometryInstanceAttribute} instance.
*/
fromDistanceDisplayCondition(distanceDisplayCondition: DistanceDisplayCondition): DistanceDisplayConditionGeometryInstanceAttribute;
/**
* Converts a distance display condition to a typed array that can be used to assign a distance display condition attribute.
* @example
* const attributes = primitive.getGeometryInstanceAttributes('an id');
* attributes.distanceDisplayCondition = SuperMap.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, attributes.distanceDisplayCondition);
* @param distanceDisplayCondition - The distance display condition value.
* @param [result] - The array to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
toValue(distanceDisplayCondition: DistanceDisplayCondition, result?: Float32Array): Float32Array;
}
/**
* Easing functions for use with TweenCollection. These function are from
*/
export namespace EasingFunction {
/**
* Linear easing.
*/
const LINEAR_NONE: EasingFunction.Callback;
/**
* Quadratic in.
*/
const QUADRATIC_IN: EasingFunction.Callback;
/**
* Quadratic out.
*/
const QUADRATIC_OUT: EasingFunction.Callback;
/**
* Quadratic in then out.
*/
const QUADRATIC_IN_OUT: EasingFunction.Callback;
/**
* Cubic in.
*/
const CUBIC_IN: EasingFunction.Callback;
/**
* Cubic out.
*/
const CUBIC_OUT: EasingFunction.Callback;
/**
* Cubic in then out.
*/
const CUBIC_IN_OUT: EasingFunction.Callback;
/**
* Quartic in.
*/
const QUARTIC_IN: EasingFunction.Callback;
/**
* Quartic out.
*/
const QUARTIC_OUT: EasingFunction.Callback;
/**
* Quartic in then out.
*/
const QUARTIC_IN_OUT: EasingFunction.Callback;
/**
* Quintic in.
*/
const QUINTIC_IN: EasingFunction.Callback;
/**
* Quintic out.
*/
const QUINTIC_OUT: EasingFunction.Callback;
/**
* Quintic in then out.
*/
const QUINTIC_IN_OUT: EasingFunction.Callback;
/**
* Sinusoidal in.
*/
const SINUSOIDAL_IN: EasingFunction.Callback;
/**
* Sinusoidal out.
*/
const SINUSOIDAL_OUT: EasingFunction.Callback;
/**
* Sinusoidal in then out.
*/
const SINUSOIDAL_IN_OUT: EasingFunction.Callback;
/**
* Exponential in.
*/
const EXPONENTIAL_IN: EasingFunction.Callback;
/**
* Exponential out.
*/
const EXPONENTIAL_OUT: EasingFunction.Callback;
/**
* Exponential in then out.
*/
const EXPONENTIAL_IN_OUT: EasingFunction.Callback;
/**
* Circular in.
*/
const CIRCULAR_IN: EasingFunction.Callback;
/**
* Circular out.
*/
const CIRCULAR_OUT: EasingFunction.Callback;
/**
* Circular in then out.
*/
const CIRCULAR_IN_OUT: EasingFunction.Callback;
/**
* Elastic in.
*/
const ELASTIC_IN: EasingFunction.Callback;
/**
* Elastic out.
*/
const ELASTIC_OUT: EasingFunction.Callback;
/**
* Elastic in then out.
*/
const ELASTIC_IN_OUT: EasingFunction.Callback;
/**
* Back in.
*/
const BACK_IN: EasingFunction.Callback;
/**
* Back out.
*/
const BACK_OUT: EasingFunction.Callback;
/**
* Back in then out.
*/
const BACK_IN_OUT: EasingFunction.Callback;
/**
* Bounce in.
*/
const BOUNCE_IN: EasingFunction.Callback;
/**
* Bounce out.
*/
const BOUNCE_OUT: EasingFunction.Callback;
/**
* Bounce in then out.
*/
const BOUNCE_IN_OUT: EasingFunction.Callback;
/**
* Function interface for implementing a custom easing function.
* @example
* function quadraticIn(time) {
* return time * time;
* }
* @example
* function quadraticOut(time) {
* return time * (2.0 - time);
* }
* @param time - The time in the range [0, 1]
.
*/
type Callback = (time: number) => number;
}
/**
* A description of an ellipse on an ellipsoid. Ellipse geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
* @example
* // Create an ellipse.
* const ellipse = new SuperMap.EllipseGeometry({
* center : SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883),
* semiMajorAxis : 500000.0,
* semiMinorAxis : 300000.0,
* rotation : SuperMap.Math.toRadians(60.0)
* });
* const geometry = SuperMap.EllipseGeometry.createGeometry(ellipse);
* @param options - Object with the following properties:
* @param options.center - The ellipse's center point in the fixed frame.
* @param options.semiMajorAxis - The length of the ellipse's semi-major axis in meters.
* @param options.semiMinorAxis - The length of the ellipse's semi-minor axis in meters.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid the ellipse will be on.
* @param [options.height = 0.0] - The distance in meters between the ellipse and the ellipsoid surface.
* @param [options.extrudedHeight] - The distance in meters between the ellipse's extruded face and the ellipsoid surface.
* @param [options.rotation = 0.0] - The angle of rotation counter-clockwise from north.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates counter-clockwise from north.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The angular distance between points on the ellipse in radians.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class EllipseGeometry {
constructor(options: {
center: Cartesian3;
semiMajorAxis: number;
semiMinorAxis: number;
ellipsoid?: Ellipsoid;
height?: number;
extrudedHeight?: number;
rotation?: number;
stRotation?: number;
granularity?: number;
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: EllipseGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new EllipseGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: EllipseGeometry): EllipseGeometry;
/**
* Computes the bounding rectangle based on the provided options
* @param options - Object with the following properties:
* @param options.center - The ellipse's center point in the fixed frame.
* @param options.semiMajorAxis - The length of the ellipse's semi-major axis in meters.
* @param options.semiMinorAxis - The length of the ellipse's semi-minor axis in meters.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid the ellipse will be on.
* @param [options.rotation = 0.0] - The angle of rotation counter-clockwise from north.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The angular distance between points on the ellipse in radians.
* @param [result] - An object in which to store the result
* @returns The result rectangle
*/
computeRectangle(options: {
center: Cartesian3;
semiMajorAxis: number;
semiMinorAxis: number;
ellipsoid?: Ellipsoid;
rotation?: number;
granularity?: number;
}, result?: Rectangle): Rectangle;
/**
* Computes the geometric representation of a ellipse on an ellipsoid, including its vertices, indices, and a bounding sphere.
* @param ellipseGeometry - A description of the ellipse.
* @returns The computed vertices and indices.
*/
createGeometry(ellipseGeometry: EllipseGeometry): Geometry | undefined;
}
/**
* A description of the outline of an ellipse on an ellipsoid.
* @example
* const ellipse = new SuperMap.EllipseOutlineGeometry({
* center : SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883),
* semiMajorAxis : 500000.0,
* semiMinorAxis : 300000.0,
* rotation : SuperMap.Math.toRadians(60.0)
* });
* const geometry = SuperMap.EllipseOutlineGeometry.createGeometry(ellipse);
* @param options - Object with the following properties:
* @param options.center - The ellipse's center point in the fixed frame.
* @param options.semiMajorAxis - The length of the ellipse's semi-major axis in meters.
* @param options.semiMinorAxis - The length of the ellipse's semi-minor axis in meters.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid the ellipse will be on.
* @param [options.height = 0.0] - The distance in meters between the ellipse and the ellipsoid surface.
* @param [options.extrudedHeight] - The distance in meters between the ellipse's extruded face and the ellipsoid surface.
* @param [options.rotation = 0.0] - The angle from north (counter-clockwise) in radians.
* @param [options.granularity = 0.02] - The angular distance between points on the ellipse in radians.
* @param [options.numberOfVerticalLines = 16] - Number of lines to draw between the top and bottom surface of an extruded ellipse.
*/
export class EllipseOutlineGeometry {
constructor(options: {
center: Cartesian3;
semiMajorAxis: number;
semiMinorAxis: number;
ellipsoid?: Ellipsoid;
height?: number;
extrudedHeight?: number;
rotation?: number;
granularity?: number;
numberOfVerticalLines?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: EllipseOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new EllipseOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: EllipseOutlineGeometry): EllipseOutlineGeometry;
/**
* Computes the geometric representation of an outline of an ellipse on an ellipsoid, including its vertices, indices, and a bounding sphere.
* @param ellipseGeometry - A description of the ellipse.
* @returns The computed vertices and indices.
*/
createGeometry(ellipseGeometry: EllipseOutlineGeometry): Geometry | undefined;
}
/**
* A quadratic surface defined in Cartesian coordinates by the equation
* (x / a)^2 + (y / b)^2 + (z / c)^2 = 1
. Primarily used
* by SuperMap to represent the shape of planetary bodies.
*
* Rather than constructing this object directly, one of the provided
* constants is normally used.
* @param [x = 0] - The radius in the x direction.
* @param [y = 0] - The radius in the y direction.
* @param [z = 0] - The radius in the z direction.
*/
export class Ellipsoid {
constructor(x?: number, y?: number, z?: number);
/**
* Gets the radii of the ellipsoid.
*/
readonly radii: Cartesian3;
/**
* Gets the squared radii of the ellipsoid.
*/
readonly radiiSquared: Cartesian3;
/**
* Gets the radii of the ellipsoid raise to the fourth power.
*/
readonly radiiToTheFourth: Cartesian3;
/**
* Gets one over the radii of the ellipsoid.
*/
readonly oneOverRadii: Cartesian3;
/**
* Gets one over the squared radii of the ellipsoid.
*/
readonly oneOverRadiiSquared: Cartesian3;
/**
* Gets the minimum radius of the ellipsoid.
*/
readonly minimumRadius: number;
/**
* Gets the maximum radius of the ellipsoid.
*/
readonly maximumRadius: number;
/**
* Duplicates an Ellipsoid instance.
* @param ellipsoid - The ellipsoid to duplicate.
* @param [result] - The object onto which to store the result, or undefined if a new
* instance should be created.
* @returns The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
*/
clone(ellipsoid: Ellipsoid, result?: Ellipsoid): Ellipsoid;
/**
* Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
* @param [cartesian = Cartesian3.ZERO] - The ellipsoid's radius in the x, y, and z directions.
* @param [result] - The object onto which to store the result, or undefined if a new
* instance should be created.
* @returns A new Ellipsoid instance.
*/
fromCartesian3(cartesian?: Cartesian3, result?: Ellipsoid): Ellipsoid;
/**
* An Ellipsoid instance initialized to the WGS84 standard.
*/
readonly WGS84: Ellipsoid;
/**
* An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
*/
readonly UNIT_SPHERE: Ellipsoid;
/**
* An Ellipsoid instance initialized to a sphere with the lunar radius.
*/
readonly MOON: Ellipsoid;
/**
* Duplicates an Ellipsoid instance.
* @param [result] - The object onto which to store the result, or undefined if a new
* instance should be created.
* @returns The cloned Ellipsoid.
*/
clone(result?: Ellipsoid): Ellipsoid;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Ellipsoid, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Ellipsoid instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Ellipsoid): Ellipsoid;
/**
* Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
* @param cartesian - The Cartesian for which to to determine the geocentric normal.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided.
*/
geocentricSurfaceNormal(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
* @param cartographic - The cartographic position for which to to determine the geodetic normal.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided.
*/
geodeticSurfaceNormalCartographic(cartographic: Cartographic, result?: Cartesian3): Cartesian3;
/**
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
* @param cartesian - The Cartesian position for which to to determine the surface normal.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
*/
geodeticSurfaceNormal(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Converts the provided cartographic to Cartesian representation.
* @example
* //Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
* const position = new SuperMap.Cartographic(SuperMap.Math.toRadians(21), SuperMap.Math.toRadians(78), 5000);
* const cartesianPosition = SuperMap.Ellipsoid.WGS84.cartographicToCartesian(position);
* @param cartographic - The cartographic position.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided.
*/
cartographicToCartesian(cartographic: Cartographic, result?: Cartesian3): Cartesian3;
/**
* Converts the provided array of cartographics to an array of Cartesians.
* @example
* //Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
* const positions = [new SuperMap.Cartographic(SuperMap.Math.toRadians(21), SuperMap.Math.toRadians(78), 0),
* new SuperMap.Cartographic(SuperMap.Math.toRadians(21.321), SuperMap.Math.toRadians(78.123), 100),
* new SuperMap.Cartographic(SuperMap.Math.toRadians(21.645), SuperMap.Math.toRadians(78.456), 250)];
* const cartesianPositions = SuperMap.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
* @param cartographics - An array of cartographic positions.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Array instance if none was provided.
*/
cartographicArrayToCartesianArray(cartographics: Cartographic[], result?: Cartesian3[]): Cartesian3[];
/**
* Converts the provided cartesian to cartographic representation.
* The cartesian is undefined at the center of the ellipsoid.
* @example
* //Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
* const position = new SuperMap.Cartesian3(17832.12, 83234.52, 952313.73);
* const cartographicPosition = SuperMap.Ellipsoid.WGS84.cartesianToCartographic(position);
* @param cartesian - The Cartesian position to convert to cartographic representation.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
*/
cartesianToCartographic(cartesian: Cartesian3, result?: Cartographic): Cartographic;
/**
* Converts the provided array of cartesians to an array of cartographics.
* @example
* //Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
* const positions = [new SuperMap.Cartesian3(17832.12, 83234.52, 952313.73),
* new SuperMap.Cartesian3(17832.13, 83234.53, 952313.73),
* new SuperMap.Cartesian3(17832.14, 83234.54, 952313.73)]
* const cartographicPositions = SuperMap.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
* @param cartesians - An array of Cartesian positions.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Array instance if none was provided.
*/
cartesianArrayToCartographicArray(cartesians: Cartesian3[], result?: Cartographic[]): Cartographic[];
/**
* Scales the provided Cartesian position along the geodetic surface normal
* so that it is on the surface of this ellipsoid. If the position is
* at the center of the ellipsoid, this function returns undefined.
* @param cartesian - The Cartesian position to scale.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
*/
scaleToGeodeticSurface(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Scales the provided Cartesian position along the geocentric surface normal
* so that it is on the surface of this ellipsoid.
* @param cartesian - The Cartesian position to scale.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided.
*/
scaleToGeocentricSurface(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
* its components by the result of {@link Ellipsoid#oneOverRadii}.
* @param position - The position to transform.
* @param [result] - The position to which to copy the result, or undefined to create and
* return a new instance.
* @returns The position expressed in the scaled space. The returned instance is the
* one passed as the result parameter if it is not undefined, or a new instance of it is.
*/
transformPositionToScaledSpace(position: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
* its components by the result of {@link Ellipsoid#radii}.
* @param position - The position to transform.
* @param [result] - The position to which to copy the result, or undefined to create and
* return a new instance.
* @returns The position expressed in the unscaled space. The returned instance is the
* one passed as the result parameter if it is not undefined, or a new instance of it is.
*/
transformPositionFromScaledSpace(position: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The other Ellipsoid.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Ellipsoid): boolean;
/**
* Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
* @returns A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
*/
toString(): string;
/**
* Computes a point which is the intersection of the surface normal with the z-axis.
* @param position - the position. must be on the surface of the ellipsoid.
* @param [buffer = 0.0] - A buffer to subtract from the ellipsoid size when checking if the point is inside the ellipsoid.
* In earth case, with common earth datums, there is no need for this buffer since the intersection point is always (relatively) very close to the center.
* In WGS84 datum, intersection point is at max z = +-42841.31151331382 (0.673% of z-axis).
* Intersection point could be outside the ellipsoid if the ratio of MajorAxis / AxisOfRotation is bigger than the square root of 2
* @param [result] - The cartesian to which to copy the result, or undefined to create and
* return a new instance.
* @returns the intersection point if it's inside the ellipsoid, undefined otherwise
*/
getSurfaceNormalIntersectionWithZAxis(position: Cartesian3, buffer?: number, result?: Cartesian3): Cartesian3 | undefined;
/**
* Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using
* Gauss-Legendre 10th order quadrature.
* @param rectangle - The rectangle used for computing the surface area.
* @returns The approximate area of the rectangle on the surface of this ellipsoid.
*/
surfaceArea(rectangle: Rectangle): number;
}
/**
* Initializes a geodesic on the ellipsoid connecting the two provided planetodetic points.
* @param [start] - The initial planetodetic point on the path.
* @param [end] - The final planetodetic point on the path.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the geodesic lies.
*/
export class EllipsoidGeodesic {
constructor(start?: Cartographic, end?: Cartographic, ellipsoid?: Ellipsoid);
/**
* Gets the ellipsoid.
*/
readonly ellipsoid: Ellipsoid;
/**
* Gets the surface distance between the start and end point
*/
readonly surfaceDistance: number;
/**
* Gets the initial planetodetic point on the path.
*/
readonly start: Cartographic;
/**
* Gets the final planetodetic point on the path.
*/
readonly end: Cartographic;
/**
* Gets the heading at the initial point.
*/
readonly startHeading: number;
/**
* Gets the heading at the final point.
*/
readonly endHeading: number;
/**
* Sets the start and end points of the geodesic
* @param start - The initial planetodetic point on the path.
* @param end - The final planetodetic point on the path.
*/
setEndPoints(start: Cartographic, end: Cartographic): void;
/**
* Provides the location of a point at the indicated portion along the geodesic.
* @param fraction - The portion of the distance between the initial and final points.
* @param [result] - The object in which to store the result.
* @returns The location of the point along the geodesic.
*/
interpolateUsingFraction(fraction: number, result?: Cartographic): Cartographic;
/**
* Provides the location of a point at the indicated distance along the geodesic.
* @param distance - The distance from the inital point to the point of interest along the geodesic
* @param [result] - The object in which to store the result.
* @returns The location of the point along the geodesic.
*/
interpolateUsingSurfaceDistance(distance: number, result?: Cartographic): Cartographic;
}
/**
* A description of an ellipsoid centered at the origin.
* @example
* const ellipsoid = new SuperMap.EllipsoidGeometry({
* vertexFormat : SuperMap.VertexFormat.POSITION_ONLY,
* radii : new SuperMap.Cartesian3(1000000.0, 500000.0, 500000.0)
* });
* const geometry = SuperMap.EllipsoidGeometry.createGeometry(ellipsoid);
* @param [options] - Object with the following properties:
* @param [options.radii = Cartesian3(1.0, 1.0, 1.0)] - The radii of the ellipsoid in the x, y, and z directions.
* @param [options.innerRadii = options.radii] - The inner radii of the ellipsoid in the x, y, and z directions.
* @param [options.minimumClock = 0.0] - The minimum angle lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
* @param [options.maximumClock = 2*PI] - The maximum angle lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
* @param [options.minimumCone = 0.0] - The minimum angle measured from the positive z-axis and toward the negative z-axis.
* @param [options.maximumCone = PI] - The maximum angle measured from the positive z-axis and toward the negative z-axis.
* @param [options.stackPartitions = 64] - The number of times to partition the ellipsoid into stacks.
* @param [options.slicePartitions = 64] - The number of times to partition the ellipsoid into radial slices.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class EllipsoidGeometry {
constructor(options?: {
radii?: Cartesian3;
innerRadii?: Cartesian3;
minimumClock?: number;
maximumClock?: number;
minimumCone?: number;
maximumCone?: number;
stackPartitions?: number;
slicePartitions?: number;
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: EllipsoidGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new EllipsoidGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: EllipsoidGeometry): EllipsoidGeometry;
/**
* Computes the geometric representation of an ellipsoid, including its vertices, indices, and a bounding sphere.
* @param ellipsoidGeometry - A description of the ellipsoid.
* @returns The computed vertices and indices.
*/
createGeometry(ellipsoidGeometry: EllipsoidGeometry): Geometry | undefined;
}
/**
* A description of the outline of an ellipsoid centered at the origin.
* @example
* const ellipsoid = new SuperMap.EllipsoidOutlineGeometry({
* radii : new SuperMap.Cartesian3(1000000.0, 500000.0, 500000.0),
* stackPartitions: 6,
* slicePartitions: 5
* });
* const geometry = SuperMap.EllipsoidOutlineGeometry.createGeometry(ellipsoid);
* @param [options] - Object with the following properties:
* @param [options.radii = Cartesian3(1.0, 1.0, 1.0)] - The radii of the ellipsoid in the x, y, and z directions.
* @param [options.innerRadii = options.radii] - The inner radii of the ellipsoid in the x, y, and z directions.
* @param [options.minimumClock = 0.0] - The minimum angle lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
* @param [options.maximumClock = 2*PI] - The maximum angle lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
* @param [options.minimumCone = 0.0] - The minimum angle measured from the positive z-axis and toward the negative z-axis.
* @param [options.maximumCone = PI] - The maximum angle measured from the positive z-axis and toward the negative z-axis.
* @param [options.stackPartitions = 10] - The count of stacks for the ellipsoid (1 greater than the number of parallel lines).
* @param [options.slicePartitions = 8] - The count of slices for the ellipsoid (Equal to the number of radial lines).
* @param [options.subdivisions = 128] - The number of points per line, determining the granularity of the curvature.
*/
export class EllipsoidOutlineGeometry {
constructor(options?: {
radii?: Cartesian3;
innerRadii?: Cartesian3;
minimumClock?: number;
maximumClock?: number;
minimumCone?: number;
maximumCone?: number;
stackPartitions?: number;
slicePartitions?: number;
subdivisions?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: EllipsoidOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new EllipsoidOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: EllipsoidOutlineGeometry): EllipsoidOutlineGeometry;
/**
* Computes the geometric representation of an outline of an ellipsoid, including its vertices, indices, and a bounding sphere.
* @param ellipsoidGeometry - A description of the ellipsoid outline.
* @returns The computed vertices and indices.
*/
createGeometry(ellipsoidGeometry: EllipsoidOutlineGeometry): Geometry | undefined;
}
/**
* Initializes a rhumb line on the ellipsoid connecting the two provided planetodetic points.
* @param [start] - The initial planetodetic point on the path.
* @param [end] - The final planetodetic point on the path.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rhumb line lies.
*/
export class EllipsoidRhumbLine {
constructor(start?: Cartographic, end?: Cartographic, ellipsoid?: Ellipsoid);
/**
* Gets the ellipsoid.
*/
readonly ellipsoid: Ellipsoid;
/**
* Gets the surface distance between the start and end point
*/
readonly surfaceDistance: number;
/**
* Gets the initial planetodetic point on the path.
*/
readonly start: Cartographic;
/**
* Gets the final planetodetic point on the path.
*/
readonly end: Cartographic;
/**
* Gets the heading from the start point to the end point.
*/
readonly heading: number;
/**
* Create a rhumb line using an initial position with a heading and distance.
* @param start - The initial planetodetic point on the path.
* @param heading - The heading in radians.
* @param distance - The rhumb line distance between the start and end point.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rhumb line lies.
* @param [result] - The object in which to store the result.
* @returns The EllipsoidRhumbLine object.
*/
fromStartHeadingDistance(start: Cartographic, heading: number, distance: number, ellipsoid?: Ellipsoid, result?: EllipsoidRhumbLine): EllipsoidRhumbLine;
/**
* Sets the start and end points of the rhumb line.
* @param start - The initial planetodetic point on the path.
* @param end - The final planetodetic point on the path.
*/
setEndPoints(start: Cartographic, end: Cartographic): void;
/**
* Provides the location of a point at the indicated portion along the rhumb line.
* @param fraction - The portion of the distance between the initial and final points.
* @param [result] - The object in which to store the result.
* @returns The location of the point along the rhumb line.
*/
interpolateUsingFraction(fraction: number, result?: Cartographic): Cartographic;
/**
* Provides the location of a point at the indicated distance along the rhumb line.
* @param distance - The distance from the inital point to the point of interest along the rhumbLine.
* @param [result] - The object in which to store the result.
* @returns The location of the point along the rhumb line.
*/
interpolateUsingSurfaceDistance(distance: number, result?: Cartographic): Cartographic;
/**
* Provides the location of a point at the indicated longitude along the rhumb line.
* If the longitude is outside the range of start and end points, the first intersection with the longitude from the start point in the direction of the heading is returned. This follows the spiral property of a rhumb line.
* @param intersectionLongitude - The longitude, in radians, at which to find the intersection point from the starting point using the heading.
* @param [result] - The object in which to store the result.
* @returns The location of the intersection point along the rhumb line, undefined if there is no intersection or infinite intersections.
*/
findIntersectionWithLongitude(intersectionLongitude: number, result?: Cartographic): Cartographic;
/**
* Provides the location of a point at the indicated latitude along the rhumb line.
* If the latitude is outside the range of start and end points, the first intersection with the latitude from that start point in the direction of the heading is returned. This follows the spiral property of a rhumb line.
* @param intersectionLatitude - The latitude, in radians, at which to find the intersection point from the starting point using the heading.
* @param [result] - The object in which to store the result.
* @returns The location of the intersection point along the rhumb line, undefined if there is no intersection or infinite intersections.
*/
findIntersectionWithLatitude(intersectionLatitude: number, result?: Cartographic): Cartographic;
}
/**
* A plane tangent to the provided ellipsoid at the provided origin.
* If origin is not on the surface of the ellipsoid, it's surface projection will be used.
* If origin is at the center of the ellipsoid, an exception will be thrown.
* @param origin - The point on the surface of the ellipsoid where the tangent plane touches.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid to use.
*/
export class EllipsoidTangentPlane {
constructor(origin: Cartesian3, ellipsoid?: Ellipsoid);
/**
* Gets the ellipsoid.
*/
ellipsoid: Ellipsoid;
/**
* Gets the origin.
*/
origin: Cartesian3;
/**
* Gets the plane which is tangent to the ellipsoid.
*/
readonly plane: Plane;
/**
* Gets the local X-axis (east) of the tangent plane.
*/
readonly xAxis: Cartesian3;
/**
* Gets the local Y-axis (north) of the tangent plane.
*/
readonly yAxis: Cartesian3;
/**
* Gets the local Z-axis (up) of the tangent plane.
*/
readonly zAxis: Cartesian3;
/**
* Creates a new instance from the provided ellipsoid and the center
* point of the provided Cartesians.
* @param cartesians - The list of positions surrounding the center point.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid to use.
* @returns The new instance of EllipsoidTangentPlane.
*/
fromPoints(cartesians: Cartesian3[], ellipsoid?: Ellipsoid): EllipsoidTangentPlane;
/**
* Computes the projection of the provided 3D position onto the 2D plane, radially outward from the {@link EllipsoidTangentPlane.ellipsoid} coordinate system origin.
* @param cartesian - The point to project.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian2 instance if none was provided. Undefined if there is no intersection point
*/
projectPointOntoPlane(cartesian: Cartesian3, result?: Cartesian2): Cartesian2;
/**
* Computes the projection of the provided 3D positions onto the 2D plane (where possible), radially outward from the global origin.
* The resulting array may be shorter than the input array - if a single projection is impossible it will not be included.
* @param cartesians - The array of points to project.
* @param [result] - The array of Cartesian2 instances onto which to store results.
* @returns The modified result parameter or a new array of Cartesian2 instances if none was provided.
*/
projectPointsOntoPlane(cartesians: Cartesian3[], result?: Cartesian2[]): Cartesian2[];
/**
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
* @param cartesian - The point to project.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartesian2 instance if none was provided.
*/
projectPointToNearestOnPlane(cartesian: Cartesian3, result?: Cartesian2): Cartesian2;
/**
* Computes the projection of the provided 3D positions onto the 2D plane, along the plane normal.
* @param cartesians - The array of points to project.
* @param [result] - The array of Cartesian2 instances onto which to store results.
* @returns The modified result parameter or a new array of Cartesian2 instances if none was provided. This will have the same length as cartesians
.
*/
projectPointsToNearestOnPlane(cartesians: Cartesian3[], result?: Cartesian2[]): Cartesian2[];
/**
* Computes the projection of the provided 2D position onto the 3D ellipsoid.
* @param cartesian - The points to project.
* @param [result] - The Cartesian3 instance to store result.
* @returns The modified result parameter or a new Cartesian3 instance if none was provided.
*/
projectPointOntoEllipsoid(cartesian: Cartesian2, result?: Cartesian3): Cartesian3;
/**
* Computes the projection of the provided 2D positions onto the 3D ellipsoid.
* @param cartesians - The array of points to project.
* @param [result] - The array of Cartesian3 instances onto which to store results.
* @returns The modified result parameter or a new array of Cartesian3 instances if none was provided.
*/
projectPointsOntoEllipsoid(cartesians: Cartesian2[], result?: Cartesian3[]): Cartesian3[];
}
/**
* A very simple {@link TerrainProvider} that produces geometry by tessellating an ellipsoidal
* surface.
* @param [options] - Object with the following properties:
* @param [options.tilingScheme] - The tiling scheme specifying how the ellipsoidal
* surface is broken into tiles. If this parameter is not provided, a {@link GeographicTilingScheme}
* is used.
* @param [options.ellipsoid] - The ellipsoid. If the tilingScheme is specified,
* this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither
* parameter is specified, the WGS84 ellipsoid is used.
*/
export class EllipsoidTerrainProvider {
constructor(options?: {
tilingScheme?: TilingScheme;
ellipsoid?: Ellipsoid;
});
/**
* Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
* are passed an instance of {@link TileProviderError}.
*/
readonly errorEvent: Event;
/**
* Gets the credit to display when this terrain provider is active. Typically this is used to credit
* the source of the terrain. This function should not be called before {@link EllipsoidTerrainProvider#ready} returns true.
*/
readonly credit: Credit;
/**
* Gets the tiling scheme used by this provider. This function should
* not be called before {@link EllipsoidTerrainProvider#ready} returns true.
*/
readonly tilingScheme: GeographicTilingScheme;
/**
* Gets a value indicating whether or not the provider is ready for use.
*/
readonly ready: boolean;
/**
* Gets a promise that resolves to true when the provider is ready for use.
*/
readonly readyPromise: Promisethis
pointer
* in which the function will execute.
* @param listener - The function to be executed when the event is raised.
* @param [scope] - An optional object scope to serve as the this
* pointer in which the listener function will execute.
* @returns A function that will remove this event listener when invoked.
*/
addEventListener(listener: Listener, scope?: any): Event.RemoveCallback;
/**
* Unregisters a previously registered callback.
* @param listener - The function to be unregistered.
* @param [scope] - The scope that was originally passed to addEventListener.
* @returns true
if the listener was removed; false
if the listener and scope are not registered with the event.
*/
removeEventListener(listener: Listener, scope?: any): boolean;
/**
* Raises the event by calling each registered listener with all supplied arguments.
* @param arguments - This method takes any number of parameters and passes them through to the listener functions.
*/
raiseEvent(...arguments: Parametersthis
* pointer in which the listener function will execute.
* @returns A function that will remove this event listener when invoked.
*/
add(event: Event, listener: (...params: any[]) => any, scope?: any): EventHelper.RemoveCallback;
/**
* Unregisters all previously added listeners.
*/
removeAll(): void;
}
export namespace EventHelper {
/**
* A function that removes a listener.
*/
type RemoveCallback = () => void;
}
/**
* Constants to determine how an interpolated value is extrapolated
* when querying outside the bounds of available data.
*/
export enum ExtrapolationType {
/**
* No extrapolation occurs.
*/
NONE = 0,
/**
* The first or last value is used when outside the range of sample data.
*/
HOLD = 1,
/**
* The value is extrapolated.
*/
EXTRAPOLATE = 2
}
/**
* A set of functions to detect whether the current browser supports
* various features.
*/
export namespace FeatureDetection {
/**
* Detects whether the current browser supports Basis Universal textures and the web assembly modules needed to transcode them.
* @returns true if the browser supports web assembly modules and the scene supports Basis Universal textures, false if not.
*/
function supportsBasis(scene: Scene): boolean;
/**
* Detects whether the current browser supports the full screen standard.
* @returns true if the browser supports the full screen standard, false if not.
*/
function supportsFullscreen(): boolean;
/**
* Detects whether the current browser supports typed arrays.
* @returns true if the browser supports typed arrays, false if not.
*/
function supportsTypedArrays(): boolean;
/**
* Detects whether the current browser supports BigInt64Array typed arrays.
* @returns true if the browser supports BigInt64Array typed arrays, false if not.
*/
function supportsBigInt64Array(): boolean;
/**
* Detects whether the current browser supports BigUint64Array typed arrays.
* @returns true if the browser supports BigUint64Array typed arrays, false if not.
*/
function supportsBigUint64Array(): boolean;
/**
* Detects whether the current browser supports BigInt.
* @returns true if the browser supports BigInt, false if not.
*/
function supportsBigInt(): boolean;
/**
* Detects whether the current browser supports Web Workers.
* @returns true if the browsers supports Web Workers, false if not.
*/
function supportsWebWorkers(): boolean;
/**
* Detects whether the current browser supports Web Assembly.
* @returns true if the browsers supports Web Assembly, false if not.
*/
function supportsWebAssembly(): boolean;
}
/**
* Describes a frustum at the given the origin and orientation.
* @param options - Object with the following properties:
* @param options.frustum - The frustum.
* @param options.origin - The origin of the frustum.
* @param options.orientation - The orientation of the frustum.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class FrustumGeometry {
constructor(options: {
frustum: PerspectiveFrustum | OrthographicFrustum;
origin: Cartesian3;
orientation: Quaternion;
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: FrustumGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
*/
unpack(array: number[], startingIndex?: number, result?: FrustumGeometry): void;
/**
* Computes the geometric representation of a frustum, including its vertices, indices, and a bounding sphere.
* @param frustumGeometry - A description of the frustum.
* @returns The computed vertices and indices.
*/
createGeometry(frustumGeometry: FrustumGeometry): Geometry | undefined;
}
/**
* A description of the outline of a frustum with the given the origin and orientation.
* @param options - Object with the following properties:
* @param options.frustum - The frustum.
* @param options.origin - The origin of the frustum.
* @param options.orientation - The orientation of the frustum.
*/
export class FrustumOutlineGeometry {
constructor(options: {
frustum: PerspectiveFrustum | OrthographicFrustum;
origin: Cartesian3;
orientation: Quaternion;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: FrustumOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
*/
unpack(array: number[], startingIndex?: number, result?: FrustumOutlineGeometry): void;
/**
* Computes the geometric representation of a frustum outline, including its vertices, indices, and a bounding sphere.
* @param frustumGeometry - A description of the frustum.
* @returns The computed vertices and indices.
*/
createGeometry(frustumGeometry: FrustumOutlineGeometry): Geometry | undefined;
}
/**
* Browser-independent functions for working with the standard fullscreen API.
*/
export namespace Fullscreen {
/**
* The element that is currently fullscreen, if any. To simply check if the
* browser is in fullscreen mode or not, use {@link Fullscreen#fullscreen}.
*/
const element: any;
/**
* The name of the event on the document that is fired when fullscreen is
* entered or exited. This event name is intended for use with addEventListener.
* In your event handler, to determine if the browser is in fullscreen mode or not,
* use {@link Fullscreen#fullscreen}.
*/
const changeEventName: string;
/**
* The name of the event that is fired when a fullscreen error
* occurs. This event name is intended for use with addEventListener.
*/
const errorEventName: string;
/**
* Determine whether the browser will allow an element to be made fullscreen, or not.
* For example, by default, iframes cannot go fullscreen unless the containing page
* adds an "allowfullscreen" attribute (or prefixed equivalent).
*/
const enabled: boolean;
/**
* Determines if the browser is currently in fullscreen mode.
*/
const fullscreen: boolean;
/**
* Detects whether the browser supports the standard fullscreen API.
* @returns true
if the browser supports the standard fullscreen API,
* false
otherwise.
*/
function supportsFullscreen(): boolean;
/**
* Asynchronously requests the browser to enter fullscreen mode on the given element.
* If fullscreen mode is not supported by the browser, does nothing.
* @example
* // Put the entire page into fullscreen.
* SuperMap.Fullscreen.requestFullscreen(document.body)
*
* // Place only the SuperMap canvas into fullscreen.
* SuperMap.Fullscreen.requestFullscreen(scene.canvas)
* @param element - The HTML element which will be placed into fullscreen mode.
* @param [vrDevice] - The HMDVRDevice device.
*/
function requestFullscreen(element: any, vrDevice?: any): void;
/**
* Asynchronously exits fullscreen mode. If the browser is not currently
* in fullscreen, or if fullscreen mode is not supported by the browser, does nothing.
*/
function exitFullscreen(): void;
}
/**
* The type of geocoding to be performed by a {@link GeocoderService}.
*/
export enum GeocodeType {
/**
* Perform a search where the input is considered complete.
*/
SEARCH = 0,
/**
* Perform an auto-complete using partial input, typically
* reserved for providing possible results as a user is typing.
*/
AUTOCOMPLETE = 1
}
export namespace GeocoderService {
/**
* @property displayName - The display name for a location
* @property destination - The bounding box for a location
*/
type Result = {
displayName: string;
destination: Rectangle | Cartesian3;
};
}
/**
* Provides geocoding through an external service. This type describes an interface and
* is not intended to be used.
*/
export class GeocoderService {
constructor();
/**
* @param query - The query to be sent to the geocoder service
* @param [type = GeocodeType.SEARCH] - The type of geocode to perform.
*/
geocode(query: string, type?: GeocodeType): PromisePrimitive
can
* be created from many heterogeneous - in many cases - geometries for performance.
* * Geometries can be transformed and optimized using functions in {@link GeometryPipeline}. *
* @example * // Create geometry with a position attribute and indexed lines. * const positions = new Float64Array([ * 0.0, 0.0, 0.0, * 7500000.0, 0.0, 0.0, * 0.0, 7500000.0, 0.0 * ]); * * const geometry = new SuperMap.Geometry({ * attributes : { * position : new SuperMap.GeometryAttribute({ * componentDatatype : SuperMap.ComponentDatatype.DOUBLE, * componentsPerAttribute : 3, * values : positions * }) * }, * indices : new Uint16Array([0, 1, 1, 2, 2, 0]), * primitiveType : SuperMap.PrimitiveType.LINES, * boundingSphere : SuperMap.BoundingSphere.fromVertices(positions) * }); * @param options - Object with the following properties: * @param options.attributes - Attributes, which make up the geometry's vertices. * @param [options.primitiveType = PrimitiveType.TRIANGLES] - The type of primitives in the geometry. * @param [options.indices] - Optional index data that determines the primitives in the geometry. * @param [options.boundingSphere] - An optional bounding sphere that fully enclosed the geometry. */ export class Geometry { constructor(options: { attributes: GeometryAttributes; primitiveType?: PrimitiveType; indices?: Uint16Array | Uint32Array; boundingSphere?: BoundingSphere; }); /** * Attributes, which make up the geometry's vertices. Each property in this object corresponds to a * {@link GeometryAttribute} containing the attribute's data. ** Attributes are always stored non-interleaved in a Geometry. *
** There are reserved attribute names with well-known semantics. The following attributes * are created by a Geometry (depending on the provided {@link VertexFormat}. *
position
- 3D vertex position. 64-bit floating-point (for precision). 3 components per attribute. See {@link VertexFormat#position}.normal
- Normal (normalized), commonly used for lighting. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#normal}.st
- 2D texture coordinate. 32-bit floating-point. 2 components per attribute. See {@link VertexFormat#st}.bitangent
- Bitangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#bitangent}.tangent
- Tangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#tangent}.* The following attribute names are generally not created by a Geometry, but are added * to a Geometry by a {@link Primitive} or {@link GeometryPipeline} functions to prepare * the geometry for rendering. *
position3DHigh
- High 32 bits for encoded 64-bit position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.position3DLow
- Low 32 bits for encoded 64-bit position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.position3DHigh
- High 32 bits for encoded 64-bit 2D (Columbus view) position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.position2DLow
- Low 32 bits for encoded 64-bit 2D (Columbus view) position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.color
- RGBA color (normalized) usually from {@link GeometryInstance#color}. 32-bit floating-point. 4 components per attribute.pickColor
- RGBA color used for picking. 32-bit floating-point. 4 components per attribute.true
and componentDatatype
is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* @param [options.values] - The values for the attributes stored in a typed array.
*/
export class GeometryAttribute {
constructor(options?: {
componentDatatype?: ComponentDatatype;
componentsPerAttribute?: number;
normalize?: boolean;
values?: number[] | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
});
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@link GeometryAttribute#values}.
*/
componentDatatype: ComponentDatatype;
/**
* A number between 1 and 4 that defines the number of components in an attributes.
* For example, a position attribute with x, y, and z components would have 3 as
* shown in the code example.
* @example
* attribute.componentDatatype = SuperMap.ComponentDatatype.FLOAT;
* attribute.componentsPerAttribute = 3;
* attribute.values = new Float32Array([
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]);
*/
componentsPerAttribute: number;
/**
* When true
and componentDatatype
is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* * This is commonly used when storing colors using {@link ComponentDatatype.UNSIGNED_BYTE}. *
* @example * attribute.componentDatatype = SuperMap.ComponentDatatype.UNSIGNED_BYTE; * attribute.componentsPerAttribute = 4; * attribute.normalize = true; * attribute.values = new Uint8Array([ * SuperMap.Color.floatToByte(color.red), * SuperMap.Color.floatToByte(color.green), * SuperMap.Color.floatToByte(color.blue), * SuperMap.Color.floatToByte(color.alpha) * ]); */ normalize: boolean; /** * The values for the attributes stored in a typed array. In the code example, * every three elements invalues
defines one attributes since
* componentsPerAttribute
is 3.
* @example
* attribute.componentDatatype = SuperMap.ComponentDatatype.FLOAT;
* attribute.componentsPerAttribute = 3;
* attribute.values = new Float32Array([
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]);
*/
values: number[] | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
}
/**
* Attributes, which make up a geometry's vertices. Each property in this object corresponds to a
* {@link GeometryAttribute} containing the attribute's data.
* * Attributes are always stored non-interleaved in a Geometry. *
*/ export class GeometryAttributes { constructor(); /** * The 3D position attribute. ** 64-bit floating-point (for precision). 3 components per attribute. *
*/ position: GeometryAttribute; /** * The normal attribute (normalized), which is commonly used for lighting. ** 32-bit floating-point. 3 components per attribute. *
*/ normal: GeometryAttribute; /** * The 2D texture coordinate attribute. ** 32-bit floating-point. 2 components per attribute *
*/ st: GeometryAttribute; /** * The bitangent attribute (normalized), which is used for tangent-space effects like bump mapping. ** 32-bit floating-point. 3 components per attribute. *
*/ bitangent: GeometryAttribute; /** * The tangent attribute (normalized), which is used for tangent-space effects like bump mapping. ** 32-bit floating-point. 3 components per attribute. *
*/ tangent: GeometryAttribute; /** * The color attribute. ** 8-bit unsigned integer. 4 components per attribute. *
*/ color: GeometryAttribute; } /** * Geometry instancing allows one {@link Geometry} object to be positions in several * different locations and colored uniquely. For example, one {@link BoxGeometry} can * be instanced several times, each with a differentmodelMatrix
to change
* its position, rotation, and scale.
* @example
* // Create geometry for a box, and two instances that refer to it.
* // One instance positions the box on the bottom and colored aqua.
* // The other instance positions the box on the top and color white.
* const geometry = SuperMap.BoxGeometry.fromDimensions({
* vertexFormat : SuperMap.VertexFormat.POSITION_AND_NORMAL,
* dimensions : new SuperMap.Cartesian3(1000000.0, 1000000.0, 500000.0)
* });
* const instanceBottom = new SuperMap.GeometryInstance({
* geometry : geometry,
* modelMatrix : SuperMap.Matrix4.multiplyByTranslation(SuperMap.Transforms.eastNorthUpToFixedFrame(
* SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883)), new SuperMap.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap.Matrix4()),
* attributes : {
* color : SuperMap.ColorGeometryInstanceAttribute.fromColor(SuperMap.Color.AQUA)
* },
* id : 'bottom'
* });
* const instanceTop = new SuperMap.GeometryInstance({
* geometry : geometry,
* modelMatrix : SuperMap.Matrix4.multiplyByTranslation(SuperMap.Transforms.eastNorthUpToFixedFrame(
* SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883)), new SuperMap.Cartesian3(0.0, 0.0, 3000000.0), new SuperMap.Matrix4()),
* attributes : {
* color : SuperMap.ColorGeometryInstanceAttribute.fromColor(SuperMap.Color.AQUA)
* },
* id : 'top'
* });
* @param options - Object with the following properties:
* @param options.geometry - The geometry to instance.
* @param [options.modelMatrix = Matrix4.IDENTITY] - The model matrix that transforms to transform the geometry from model to world coordinates.
* @param [options.id] - A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
* @param [options.attributes] - Per-instance attributes like a show or color attribute shown in the example below.
*/
export class GeometryInstance {
constructor(options: {
geometry: Geometry | GeometryFactory;
modelMatrix?: Matrix4;
id?: any;
attributes?: any;
});
/**
* The geometry being instanced.
*/
geometry: Geometry;
/**
* The 4x4 transformation matrix that transforms the geometry from model to world coordinates.
* When this is the identity matrix, the geometry is drawn in world coordinates, i.e., Earth's WGS84 coordinates.
* Local reference frames can be used by providing a different transformation matrix, like that returned
* by {@link Transforms.eastNorthUpToFixedFrame}.
*/
modelMatrix: Matrix4;
/**
* User-defined object returned when the instance is picked or used to get/set per-instance attributes.
*/
id: any;
/**
* Per-instance attributes like {@link ColorGeometryInstanceAttribute} or {@link ShowGeometryInstanceAttribute}.
* {@link Geometry} attributes varying per vertex; these attributes are constant for the entire instance.
*/
attributes: any;
}
/**
* Values and type information for per-instance geometry attributes.
* @example
* const instance = new SuperMap.GeometryInstance({
* geometry : SuperMap.BoxGeometry.fromDimensions({
* dimensions : new SuperMap.Cartesian3(1000000.0, 1000000.0, 500000.0)
* }),
* modelMatrix : SuperMap.Matrix4.multiplyByTranslation(SuperMap.Transforms.eastNorthUpToFixedFrame(
* SuperMap.Cartesian3.fromDegrees(0.0, 0.0)), new SuperMap.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap.Matrix4()),
* id : 'box',
* attributes : {
* color : new SuperMap.GeometryInstanceAttribute({
* componentDatatype : SuperMap.ComponentDatatype.UNSIGNED_BYTE,
* componentsPerAttribute : 4,
* normalize : true,
* value : [255, 255, 0, 255]
* })
* }
* });
* @param options - Object with the following properties:
* @param options.componentDatatype - The datatype of each component in the attribute, e.g., individual elements in values.
* @param options.componentsPerAttribute - A number between 1 and 4 that defines the number of components in an attributes.
* @param [options.normalize = false] - When true
and componentDatatype
is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* @param options.value - The value for the attribute.
*/
export class GeometryInstanceAttribute {
constructor(options: {
componentDatatype: ComponentDatatype;
componentsPerAttribute: number;
normalize?: boolean;
value: number[];
});
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@link GeometryInstanceAttribute#value}.
*/
componentDatatype: ComponentDatatype;
/**
* A number between 1 and 4 that defines the number of components in an attributes.
* For example, a position attribute with x, y, and z components would have 3 as
* shown in the code example.
* @example
* show : new SuperMap.GeometryInstanceAttribute({
* componentDatatype : SuperMap.ComponentDatatype.UNSIGNED_BYTE,
* componentsPerAttribute : 1,
* normalize : true,
* value : [1.0]
* })
*/
componentsPerAttribute: number;
/**
* When true
and componentDatatype
is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* * This is commonly used when storing colors using {@link ComponentDatatype.UNSIGNED_BYTE}. *
* @example * attribute.componentDatatype = SuperMap.ComponentDatatype.UNSIGNED_BYTE; * attribute.componentsPerAttribute = 4; * attribute.normalize = true; * attribute.value = [ * SuperMap.Color.floatToByte(color.red), * SuperMap.Color.floatToByte(color.green), * SuperMap.Color.floatToByte(color.blue), * SuperMap.Color.floatToByte(color.alpha) * ]; */ normalize: boolean; /** * The values for the attributes stored in a typed array. In the code example, * every three elements invalues
defines one attributes since
* componentsPerAttribute
is 3.
* @example
* show : new SuperMap.GeometryInstanceAttribute({
* componentDatatype : SuperMap.ComponentDatatype.UNSIGNED_BYTE,
* componentsPerAttribute : 1,
* normalize : true,
* value : [1.0]
* })
*/
value: number[];
}
/**
* Content pipeline functions for geometries.
*/
export namespace GeometryPipeline {
/**
* Converts a geometry's triangle indices to line indices. If the geometry has an indices
* and its primitiveType
is TRIANGLES
, TRIANGLE_STRIP
,
* TRIANGLE_FAN
, it is converted to LINES
; otherwise, the geometry is not changed.
* * This is commonly used to create a wireframe geometry for visual debugging. *
* @example * geometry = SuperMap.GeometryPipeline.toWireframe(geometry); * @param geometry - The geometry to modify. * @returns The modifiedgeometry
argument, with its triangle indices converted to lines.
*/
function toWireframe(geometry: Geometry): Geometry;
/**
* Creates a new {@link Geometry} with LINES
representing the provided
* attribute (attributeName
) for the provided geometry. This is used to
* visualize vector attributes like normals, tangents, and bitangents.
* @example
* const geometry = SuperMap.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'bitangent', 100000.0);
* @param geometry - The Geometry
instance with the attribute.
* @param [attributeName = 'normal'] - The name of the attribute.
* @param [length = 10000.0] - The length of each line segment in meters. This can be negative to point the vector in the opposite direction.
* @returns A new Geometry
instance with line segments for the vector.
*/
function createLineSegmentsForVectors(geometry: Geometry, attributeName?: string, length?: number): Geometry;
/**
* Creates an object that maps attribute names to unique locations (indices)
* for matching vertex attributes and shader programs.
* @example
* const attributeLocations = SuperMap.GeometryPipeline.createAttributeLocations(geometry);
* // Example output
* // {
* // 'position' : 0,
* // 'normal' : 1
* // }
* @param geometry - The geometry, which is not modified, to create the object for.
* @returns An object with attribute name / index pairs.
*/
function createAttributeLocations(geometry: Geometry): any;
/**
* Reorders a geometry's attributes and indices
to achieve better performance from the GPU's pre-vertex-shader cache.
* @example
* geometry = SuperMap.GeometryPipeline.reorderForPreVertexCache(geometry);
* @param geometry - The geometry to modify.
* @returns The modified geometry
argument, with its attributes and indices reordered for the GPU's pre-vertex-shader cache.
*/
function reorderForPreVertexCache(geometry: Geometry): Geometry;
/**
* Reorders a geometry's indices
to achieve better performance from the GPU's
* post vertex-shader cache by using the Tipsify algorithm. If the geometry primitiveType
* is not TRIANGLES
or the geometry does not have an indices
, this function has no effect.
* @example
* geometry = SuperMap.GeometryPipeline.reorderForPostVertexCache(geometry);
* @param geometry - The geometry to modify.
* @param [cacheCapacity = 24] - The number of vertices that can be held in the GPU's vertex cache.
* @returns The modified geometry
argument, with its indices reordered for the post-vertex-shader cache.
*/
function reorderForPostVertexCache(geometry: Geometry, cacheCapacity?: number): Geometry;
/**
* Splits a geometry into multiple geometries, if necessary, to ensure that indices in the
* indices
fit into unsigned shorts. This is used to meet the WebGL requirements
* when unsigned int indices are not supported.
*
* If the geometry does not have any indices
, this function has no effect.
*
position
attribute to 2D, replacing the position
* attribute with separate position3D
and position2D
attributes.
*
* If the geometry does not have a position
, this function has no effect.
*
geometry
argument with position3D
and position2D
attributes.
*/
function projectTo2D(geometry: Geometry, attributeName: string, attributeName3D: string, attributeName2D: string, projection?: any): Geometry;
/**
* Encodes floating-point geometry attribute values as two separate attributes to improve
* rendering precision.
* * This is commonly used to create high-precision position vertex attributes. *
* @example * geometry = SuperMap.GeometryPipeline.encodeAttribute(geometry, 'position3D', 'position3DHigh', 'position3DLow'); * @param geometry - The geometry to modify. * @param attributeName - The name of the attribute. * @param attributeHighName - The name of the attribute for the encoded high bits. * @param attributeLowName - The name of the attribute for the encoded low bits. * @returns The modifiedgeometry
argument, with its encoded attribute.
*/
function encodeAttribute(geometry: Geometry, attributeName: string, attributeHighName: string, attributeLowName: string): Geometry;
/**
* Transforms a geometry instance to world coordinates. This changes
* the instance's modelMatrix
to {@link Matrix4.IDENTITY} and transforms the
* following attributes if they are present: position
, normal
,
* tangent
, and bitangent
.
* @example
* SuperMap.GeometryPipeline.transformToWorldCoordinates(instance);
* @param instance - The geometry instance to modify.
* @returns The modified instance
argument, with its attributes transforms to world coordinates.
*/
function transformToWorldCoordinates(instance: GeometryInstance): GeometryInstance;
/**
* Computes per-vertex normals for a geometry containing TRIANGLES
by averaging the normals of
* all triangles incident to the vertex. The result is a new normal
attribute added to the geometry.
* This assumes a counter-clockwise winding order.
* @example
* SuperMap.GeometryPipeline.computeNormal(geometry);
* @param geometry - The geometry to modify.
* @returns The modified geometry
argument with the computed normal
attribute.
*/
function computeNormal(geometry: Geometry): Geometry;
/**
* Computes per-vertex tangents and bitangents for a geometry containing TRIANGLES
.
* The result is new tangent
and bitangent
attributes added to the geometry.
* This assumes a counter-clockwise winding order.
* @example
* SuperMap.GeometryPipeline.computeTangentAndBiTangent(geometry);
* @param geometry - The geometry to modify.
* @returns The modified geometry
argument with the computed tangent
and bitangent
attributes.
*/
function computeTangentAndBitangent(geometry: Geometry): Geometry;
/**
* Compresses and packs geometry normal attribute values to save memory.
* @example
* geometry = SuperMap.GeometryPipeline.compressVertices(geometry);
* @param geometry - The geometry to modify.
* @returns The modified geometry
argument, with its normals compressed and packed.
*/
function compressVertices(geometry: Geometry): Geometry;
}
/**
* Provides metadata using the Google Earth Enterprise REST API. This is used by the GoogleEarthEnterpriseImageryProvider
* and GoogleEarthEnterpriseTerrainProvider to share metadata requests.
* @param resourceOrUrl - The url of the Google Earth Enterprise server hosting the imagery
*/
export class GoogleEarthEnterpriseMetadata {
constructor(resourceOrUrl: Resource | string);
/**
* True if imagery is available.
*/
imageryPresent: boolean;
/**
* True if imagery is sent as a protocol buffer, false if sent as plain images. If undefined we will try both.
*/
protoImagery: boolean;
/**
* True if terrain is available.
*/
terrainPresent: boolean;
/**
* Exponent used to compute constant to calculate negative height values.
*/
negativeAltitudeExponentBias: number;
/**
* Threshold where any numbers smaller are actually negative values. They are multiplied by -2^negativeAltitudeExponentBias.
*/
negativeAltitudeThreshold: number;
/**
* Dictionary of provider id to copyright strings.
*/
providers: any;
/**
* Key used to decode packets
*/
key: ArrayBuffer;
/**
* Gets the name of the Google Earth Enterprise server.
*/
readonly url: string;
/**
* Gets the proxy used for metadata requests.
*/
readonly proxy: Proxy;
/**
* Gets the resource used for metadata requests.
*/
readonly resource: Resource;
/**
* Gets a promise that resolves to true when the metadata is ready for use.
*/
readonly readyPromise: PromiseBit Position | Bit Value | Child Tile |
---|---|---|
0 | 1 | Southwest |
1 | 2 | Southeast |
2 | 4 | Northeast |
3 | 8 | Northwest |
true
if they are equal, false
otherwise.
* @param [left] - The first HeadingPitchRoll.
* @param [right] - The second HeadingPitchRoll.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: HeadingPitchRoll, right?: HeadingPitchRoll): boolean;
/**
* Compares the provided HeadingPitchRolls componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [left] - The first HeadingPitchRoll.
* @param [right] - The second HeadingPitchRoll.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: HeadingPitchRoll, right?: HeadingPitchRoll, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Duplicates this HeadingPitchRoll instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new HeadingPitchRoll instance if one was not provided.
*/
clone(result?: HeadingPitchRoll): HeadingPitchRoll;
/**
* Compares this HeadingPitchRoll against the provided HeadingPitchRoll componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side HeadingPitchRoll.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: HeadingPitchRoll): boolean;
/**
* Compares this HeadingPitchRoll against the provided HeadingPitchRoll componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [right] - The right hand side HeadingPitchRoll.
* @param [relativeEpsilon = 0] - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: HeadingPitchRoll, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Creates a string representing this HeadingPitchRoll in the format '(heading, pitch, roll)' in radians.
* @returns A string representing the provided HeadingPitchRoll in the format '(heading, pitch, roll)'.
*/
toString(): string;
}
/**
* The encoding that is used for a heightmap
*/
export enum HeightmapEncoding {
/**
* No encoding
*/
NONE = 0,
/**
* LERC encoding
*/
LERC = 1
}
/**
* Terrain data for a single tile where the terrain data is represented as a heightmap. A heightmap
* is a rectangular array of heights in row-major order from north to south and west to east.
* @example
* const buffer = ...
* const heightBuffer = new Uint16Array(buffer, 0, that._heightmapWidth * that._heightmapWidth);
* const childTileMask = new Uint8Array(buffer, heightBuffer.byteLength, 1)[0];
* const waterMask = new Uint8Array(buffer, heightBuffer.byteLength + 1, buffer.byteLength - heightBuffer.byteLength - 1);
* const terrainData = new SuperMap.HeightmapTerrainData({
* buffer : heightBuffer,
* width : 65,
* height : 65,
* childTileMask : childTileMask,
* waterMask : waterMask
* });
* @param options - Object with the following properties:
* @param options.buffer - The buffer containing height data.
* @param options.width - The width (longitude direction) of the heightmap, in samples.
* @param options.height - The height (latitude direction) of the heightmap, in samples.
* @param [options.childTileMask = 15] - A bit mask indicating which of this tile's four children exist.
* If a child's bit is set, geometry will be requested for that tile as well when it
* is needed. If the bit is cleared, the child tile is not requested and geometry is
* instead upsampled from the parent. The bit values are as follows:
* Bit Position | Bit Value | Child Tile |
---|---|---|
0 | 1 | Southwest |
1 | 2 | Southeast |
2 | 4 | Northwest |
3 | 8 | Northeast |
points[i]
and
* points[i + 1]
, the tangents at the points will be outTangents[i]
and inTangents[i]
,
* respectively.
* @example
* // Create a G1 continuous Hermite spline
* const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
* const spline = new SuperMap.HermiteSpline({
* times : times,
* points : [
* new SuperMap.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new SuperMap.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new SuperMap.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new SuperMap.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new SuperMap.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ],
* outTangents : [
* new SuperMap.Cartesian3(1125196, -161816, 270551),
* new SuperMap.Cartesian3(-996690.5, -365906.5, 184028.5),
* new SuperMap.Cartesian3(-2096917, 48379.5, -292683.5),
* new SuperMap.Cartesian3(-890902.5, 408999.5, -447115)
* ],
* inTangents : [
* new SuperMap.Cartesian3(-1993381, -731813, 368057),
* new SuperMap.Cartesian3(-4193834, 96759, -585367),
* new SuperMap.Cartesian3(-1781805, 817999, -894230),
* new SuperMap.Cartesian3(1165345, 112641, 47281)
* ]
* });
*
* const p0 = spline.evaluate(times[0]);
* @param options - Object with the following properties:
* @param options.times - An array of strictly increasing, unit-less, floating-point times at each point.
* The values are in no way connected to the clock time. They are the parameterization for the curve.
* @param options.points - The array of control points.
* @param options.inTangents - The array of incoming tangents at each control point.
* @param options.outTangents - The array of outgoing tangents at each control point.
*/
export class HermiteSpline {
constructor(options: {
times: number[];
points: Cartesian3[];
inTangents: Cartesian3[];
outTangents: Cartesian3[];
});
/**
* An array of times for the control points.
*/
readonly times: number[];
/**
* An array of control points.
*/
readonly points: Cartesian3[];
/**
* An array of incoming tangents at each control point.
*/
readonly inTangents: Cartesian3[];
/**
* An array of outgoing tangents at each control point.
*/
readonly outTangents: Cartesian3[];
/**
* Creates a spline where the tangents at each control point are the same.
* The curves are guaranteed to be at least in the class C1.
* @example
* const points = [
* new SuperMap.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new SuperMap.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new SuperMap.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new SuperMap.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new SuperMap.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ];
*
* // Add tangents
* const tangents = new Array(points.length);
* tangents[0] = new SuperMap.Cartesian3(1125196, -161816, 270551);
* const temp = new SuperMap.Cartesian3();
* for (let i = 1; i < tangents.length - 1; ++i) {
* tangents[i] = SuperMap.Cartesian3.multiplyByScalar(SuperMap.Cartesian3.subtract(points[i + 1], points[i - 1], temp), 0.5, new SuperMap.Cartesian3());
* }
* tangents[tangents.length - 1] = new SuperMap.Cartesian3(1165345, 112641, 47281);
*
* const spline = SuperMap.HermiteSpline.createC1({
* times : times,
* points : points,
* tangents : tangents
* });
* @param options - Object with the following properties:
* @param options.times - The array of control point times.
* @param options.points - The array of control points.
* @param options.tangents - The array of tangents at the control points.
* @returns A hermite spline.
*/
createC1(options: {
times: number[];
points: Cartesian3[];
tangents: Cartesian3[];
}): HermiteSpline;
/**
* Creates a natural cubic spline. The tangents at the control points are generated
* to create a curve in the class C2.
* @example
* // Create a natural cubic spline above the earth from Philadelphia to Los Angeles.
* const spline = SuperMap.HermiteSpline.createNaturalCubic({
* times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
* points : [
* new SuperMap.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new SuperMap.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new SuperMap.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new SuperMap.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new SuperMap.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ]
* });
* @param options - Object with the following properties:
* @param options.times - The array of control point times.
* @param options.points - The array of control points.
* @returns A hermite spline, or a linear spline if less than 3 control points were given.
*/
createNaturalCubic(options: {
times: number[];
points: Cartesian3[];
}): HermiteSpline | LinearSpline;
/**
* Creates a clamped cubic spline. The tangents at the interior control points are generated
* to create a curve in the class C2.
* @example
* // Create a clamped cubic spline above the earth from Philadelphia to Los Angeles.
* const spline = SuperMap.HermiteSpline.createClampedCubic({
* times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
* points : [
* new SuperMap.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new SuperMap.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new SuperMap.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new SuperMap.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new SuperMap.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ],
* firstTangent : new SuperMap.Cartesian3(1125196, -161816, 270551),
* lastTangent : new SuperMap.Cartesian3(1165345, 112641, 47281)
* });
* @param options - Object with the following properties:
* @param options.times - The array of control point times.
* @param options.points - The array of control points.
* @param options.firstTangent - The outgoing tangent of the first control point.
* @param options.lastTangent - The incoming tangent of the last control point.
* @returns A hermite spline, or a linear spline if less than 3 control points were given.
*/
createClampedCubic(options: {
times: number[];
points: number[] | Cartesian3[];
firstTangent: Cartesian3;
lastTangent: Cartesian3;
}): HermiteSpline | LinearSpline;
/**
* Finds an index i
in times
such that the parameter
* time
is in the interval [times[i], times[i + 1]]
.
* @param time - The time.
* @returns The index for the element at the start of the interval.
*/
findTimeInterval(time: number): number;
/**
* Wraps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, wrapped around to the updated animation.
*/
wrapTime(time: number): number;
/**
* Clamps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, clamped to the animation period.
*/
clampTime(time: number): number;
/**
* Evaluates the curve at a given time.
* @param time - The time at which to evaluate the curve.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new instance of the point on the curve at the given time.
*/
evaluate(time: number, result?: Cartesian3): Cartesian3;
}
/**
* Constants for WebGL index datatypes. These corresponds to the
* type
parameter of {@link http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml|drawElements}.
*/
export enum IndexDatatype {
/**
* 8-bit unsigned byte corresponding to UNSIGNED_BYTE
and the type
* of an element in Uint8Array
.
*/
UNSIGNED_BYTE = WebGLConstants.UNSIGNED_BYTE,
/**
* 16-bit unsigned short corresponding to UNSIGNED_SHORT
and the type
* of an element in Uint16Array
.
*/
UNSIGNED_SHORT = WebGLConstants.UNSIGNED_SHORT,
/**
* 32-bit unsigned int corresponding to UNSIGNED_INT
and the type
* of an element in Uint32Array
.
*/
UNSIGNED_INT = WebGLConstants.UNSIGNED_INT
}
export namespace InterpolationAlgorithm {
/**
* Gets the name of this interpolation algorithm.
*/
var type: string;
/**
* Given the desired degree, returns the number of data points required for interpolation.
* @param degree - The desired degree of interpolation.
* @returns The number of required data points needed for the desired degree of interpolation.
*/
function getRequiredDataPoints(degree: number): number;
/**
* Performs zero order interpolation.
* @param x - The independent variable for which the dependent variables will be interpolated.
* @param xTable - The array of independent variables to use to interpolate. The values
* in this array must be in increasing order and the same value must not occur twice in the array.
* @param yTable - The array of dependent variables to use to interpolate. For a set of three
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
* @param yStride - The number of dependent variable values in yTable corresponding to
* each independent variable value in xTable.
* @param [result] - An existing array into which to store the result.
* @returns The array of interpolated values, or the result parameter if one was provided.
*/
function interpolateOrderZero(x: number, xTable: number[], yTable: number[], yStride: number, result?: number[]): number[];
/**
* Performs higher order interpolation. Not all interpolators need to support high-order interpolation,
* if this function remains undefined on implementing objects, interpolateOrderZero will be used instead.
* @param x - The independent variable for which the dependent variables will be interpolated.
* @param xTable - The array of independent variables to use to interpolate. The values
* in this array must be in increasing order and the same value must not occur twice in the array.
* @param yTable - The array of dependent variables to use to interpolate. For a set of three
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
* @param yStride - The number of dependent variable values in yTable corresponding to
* each independent variable value in xTable.
* @param inputOrder - The number of derivatives supplied for input.
* @param outputOrder - The number of derivatives desired for output.
* @param [result] - An existing array into which to store the result.
* @returns The array of interpolated values, or the result parameter if one was provided.
*/
function interpolate(x: number, xTable: number[], yTable: number[], yStride: number, inputOrder: number, outputOrder: number, result?: number[]): number[];
}
/**
* The interface for interpolation algorithms.
*/
export interface InterpolationAlgorithm {
}
/**
* This enumerated type is used in determining where, relative to the frustum, an
* object is located. The object can either be fully contained within the frustum (INSIDE),
* partially inside the frustum and partially outside (INTERSECTING), or somewhere entirely
* outside of the frustum's 6 planes (OUTSIDE).
*/
export enum Intersect {
/**
* Represents that an object is not contained within the frustum.
*/
OUTSIDE = -1,
/**
* Represents that an object intersects one of the frustum's planes.
*/
INTERSECTING = 0,
/**
* Represents that an object is fully within the frustum.
*/
INSIDE = 1
}
/**
* Functions for computing the intersection between geometries such as rays, planes, triangles, and ellipsoids.
*/
export namespace IntersectionTests {
/**
* Computes the intersection of a ray and a plane.
* @param ray - The ray.
* @param plane - The plane.
* @param [result] - The object onto which to store the result.
* @returns The intersection point or undefined if there is no intersections.
*/
function rayPlane(ray: Ray, plane: Plane, result?: Cartesian3): Cartesian3;
/**
* Computes the intersection of a ray and a triangle as a parametric distance along the input ray. The result is negative when the triangle is behind the ray.
*
* Implements {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf|
* Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
* @param ray - The ray.
* @param p0 - The first vertex of the triangle.
* @param p1 - The second vertex of the triangle.
* @param p2 - The third vertex of the triangle.
* @param [cullBackFaces = false] - If true
, will only compute an intersection with the front face of the triangle
* and return undefined for intersections with the back face.
* @returns The intersection as a parametric distance along the ray, or undefined if there is no intersection.
*/
function rayTriangleParametric(ray: Ray, p0: Cartesian3, p1: Cartesian3, p2: Cartesian3, cullBackFaces?: boolean): number;
/**
* Computes the intersection of a ray and a triangle as a Cartesian3 coordinate.
*
* Implements {@link https://cadxfem.org/inf/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf|
* Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
* @param ray - The ray.
* @param p0 - The first vertex of the triangle.
* @param p1 - The second vertex of the triangle.
* @param p2 - The third vertex of the triangle.
* @param [cullBackFaces = false] - If true
, will only compute an intersection with the front face of the triangle
* and return undefined for intersections with the back face.
* @param [result] - The Cartesian3
onto which to store the result.
* @returns The intersection point or undefined if there is no intersections.
*/
function rayTriangle(ray: Ray, p0: Cartesian3, p1: Cartesian3, p2: Cartesian3, cullBackFaces?: boolean, result?: Cartesian3): Cartesian3;
/**
* Computes the intersection of a line segment and a triangle.
* @param v0 - The an end point of the line segment.
* @param v1 - The other end point of the line segment.
* @param p0 - The first vertex of the triangle.
* @param p1 - The second vertex of the triangle.
* @param p2 - The third vertex of the triangle.
* @param [cullBackFaces = false] - If true
, will only compute an intersection with the front face of the triangle
* and return undefined for intersections with the back face.
* @param [result] - The Cartesian3
onto which to store the result.
* @returns The intersection point or undefined if there is no intersections.
*/
function lineSegmentTriangle(v0: Cartesian3, v1: Cartesian3, p0: Cartesian3, p1: Cartesian3, p2: Cartesian3, cullBackFaces?: boolean, result?: Cartesian3): Cartesian3;
/**
* Computes the intersection points of a ray with a sphere.
* @param ray - The ray.
* @param sphere - The sphere.
* @param [result] - The result onto which to store the result.
* @returns The interval containing scalar points along the ray or undefined if there are no intersections.
*/
function raySphere(ray: Ray, sphere: BoundingSphere, result?: Interval): Interval;
/**
* Computes the intersection points of a line segment with a sphere.
* @param p0 - An end point of the line segment.
* @param p1 - The other end point of the line segment.
* @param sphere - The sphere.
* @param [result] - The result onto which to store the result.
* @returns The interval containing scalar points along the ray or undefined if there are no intersections.
*/
function lineSegmentSphere(p0: Cartesian3, p1: Cartesian3, sphere: BoundingSphere, result?: Interval): Interval;
/**
* Computes the intersection points of a ray with an ellipsoid.
* @param ray - The ray.
* @param ellipsoid - The ellipsoid.
* @returns The interval containing scalar points along the ray or undefined if there are no intersections.
*/
function rayEllipsoid(ray: Ray, ellipsoid: Ellipsoid): Interval;
/**
* Provides the point along the ray which is nearest to the ellipsoid.
* @param ray - The ray.
* @param ellipsoid - The ellipsoid.
* @returns The nearest planetodetic point on the ray.
*/
function grazingAltitudeLocation(ray: Ray, ellipsoid: Ellipsoid): Cartesian3;
/**
* Computes the intersection of a line segment and a plane.
* @example
* const origin = SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883);
* const normal = ellipsoid.geodeticSurfaceNormal(origin);
* const plane = SuperMap.Plane.fromPointNormal(origin, normal);
*
* const p0 = new SuperMap.Cartesian3(...);
* const p1 = new SuperMap.Cartesian3(...);
*
* // find the intersection of the line segment from p0 to p1 and the tangent plane at origin.
* const intersection = SuperMap.IntersectionTests.lineSegmentPlane(p0, p1, plane);
* @param endPoint0 - An end point of the line segment.
* @param endPoint1 - The other end point of the line segment.
* @param plane - The plane.
* @param [result] - The object onto which to store the result.
* @returns The intersection point or undefined if there is no intersection.
*/
function lineSegmentPlane(endPoint0: Cartesian3, endPoint1: Cartesian3, plane: Plane, result?: Cartesian3): Cartesian3;
/**
* Computes the intersection of a triangle and a plane
* @example
* const origin = SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883);
* const normal = ellipsoid.geodeticSurfaceNormal(origin);
* const plane = SuperMap.Plane.fromPointNormal(origin, normal);
*
* const p0 = new SuperMap.Cartesian3(...);
* const p1 = new SuperMap.Cartesian3(...);
* const p2 = new SuperMap.Cartesian3(...);
*
* // convert the triangle composed of points (p0, p1, p2) to three triangles that don't cross the plane
* const triangles = SuperMap.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane);
* @param p0 - First point of the triangle
* @param p1 - Second point of the triangle
* @param p2 - Third point of the triangle
* @param plane - Intersection plane
* @returns An object with properties positions
and indices
, which are arrays that represent three triangles that do not cross the plane. (Undefined if no intersection exists)
*/
function trianglePlaneIntersection(p0: Cartesian3, p1: Cartesian3, p2: Cartesian3, plane: Plane): any;
}
/**
* Contains functions for operating on 2D triangles.
*/
export namespace Intersections2D {
/**
* Splits a 2D triangle at given axis-aligned threshold value and returns the resulting
* polygon on a given side of the threshold. The resulting polygon may have 0, 1, 2,
* 3, or 4 vertices.
* @example
* const result = SuperMap.Intersections2D.clipTriangleAtAxisAlignedThreshold(0.5, false, 0.2, 0.6, 0.4);
* // result === [2, 0, -1, 1, 0, 0.25, -1, 1, 2, 0.5]
* @param threshold - The threshold coordinate value at which to clip the triangle.
* @param keepAbove - true to keep the portion of the triangle above the threshold, or false
* to keep the portion below.
* @param u0 - The coordinate of the first vertex in the triangle, in counter-clockwise order.
* @param u1 - The coordinate of the second vertex in the triangle, in counter-clockwise order.
* @param u2 - The coordinate of the third vertex in the triangle, in counter-clockwise order.
* @param [result] - The array into which to copy the result. If this parameter is not supplied,
* a new array is constructed and returned.
* @returns The polygon that results after the clip, specified as a list of
* vertices. The vertices are specified in counter-clockwise order.
* Each vertex is either an index from the existing list (identified as
* a 0, 1, or 2) or -1 indicating a new vertex not in the original triangle.
* For new vertices, the -1 is followed by three additional numbers: the
* index of each of the two original vertices forming the line segment that
* the new vertex lies on, and the fraction of the distance from the first
* vertex to the second one.
*/
function clipTriangleAtAxisAlignedThreshold(threshold: number, keepAbove: boolean, u0: number, u1: number, u2: number, result?: number[]): number[];
/**
* Compute the barycentric coordinates of a 2D position within a 2D triangle.
* @example
* const result = SuperMap.Intersections2D.computeBarycentricCoordinates(0.0, 0.0, 0.0, 1.0, -1, -0.5, 1, -0.5);
* // result === new SuperMap.Cartesian3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);
* @param x - The x coordinate of the position for which to find the barycentric coordinates.
* @param y - The y coordinate of the position for which to find the barycentric coordinates.
* @param x1 - The x coordinate of the triangle's first vertex.
* @param y1 - The y coordinate of the triangle's first vertex.
* @param x2 - The x coordinate of the triangle's second vertex.
* @param y2 - The y coordinate of the triangle's second vertex.
* @param x3 - The x coordinate of the triangle's third vertex.
* @param y3 - The y coordinate of the triangle's third vertex.
* @param [result] - The instance into to which to copy the result. If this parameter
* is undefined, a new instance is created and returned.
* @returns The barycentric coordinates of the position within the triangle.
*/
function computeBarycentricCoordinates(x: number, y: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, result?: Cartesian3): Cartesian3;
/**
* Compute the intersection between 2 line segments
* @example
* const result = SuperMap.Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1, 1, 1, 1);
* // result === new SuperMap.Cartesian2(0.0, 1.0);
* @param x00 - The x coordinate of the first line's first vertex.
* @param y00 - The y coordinate of the first line's first vertex.
* @param x01 - The x coordinate of the first line's second vertex.
* @param y01 - The y coordinate of the first line's second vertex.
* @param x10 - The x coordinate of the second line's first vertex.
* @param y10 - The y coordinate of the second line's first vertex.
* @param x11 - The x coordinate of the second line's second vertex.
* @param y11 - The y coordinate of the second line's second vertex.
* @param [result] - The instance into to which to copy the result. If this parameter
* is undefined, a new instance is created and returned.
* @returns The intersection point, undefined if there is no intersection point or lines are coincident.
*/
function computeLineSegmentLineSegmentIntersection(x00: number, y00: number, x01: number, y01: number, x10: number, y10: number, x11: number, y11: number, result?: Cartesian2): Cartesian2;
}
/**
* Represents the closed interval [start, stop].
* @param [start = 0.0] - The beginning of the interval.
* @param [stop = 0.0] - The end of the interval.
*/
export class Interval {
constructor(start?: number, stop?: number);
/**
* The beginning of the interval.
*/
start: number;
/**
* The end of the interval.
*/
stop: number;
}
/**
* Constants related to ISO8601 support.
*/
export namespace Iso8601 {
/**
* A {@link JulianDate} representing the earliest time representable by an ISO8601 date.
* This is equivalent to the date string '0000-01-01T00:00:00Z'
*/
const MINIMUM_VALUE: JulianDate;
/**
* A {@link JulianDate} representing the latest time representable by an ISO8601 date.
* This is equivalent to the date string '9999-12-31T24:00:00Z'
*/
const MAXIMUM_VALUE: JulianDate;
/**
* A {@link TimeInterval} representing the largest interval representable by an ISO8601 interval.
* This is equivalent to the interval string '0000-01-01T00:00:00Z/9999-12-31T24:00:00Z'
*/
const MAXIMUM_INTERVAL: TimeInterval;
}
/**
* Represents an astronomical Julian date, which is the number of days since noon on January 1, -4712 (4713 BC).
* For increased precision, this class stores the whole number part of the date and the seconds
* part of the date in separate components. In order to be safe for arithmetic and represent
* leap seconds, the date is always stored in the International Atomic Time standard
* {@link TimeStandard.TAI}.
* @param [julianDayNumber = 0.0] - The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
* @param [secondsOfDay = 0.0] - The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.
* @param [timeStandard = TimeStandard.UTC] - The time standard in which the first two parameters are defined.
*/
export class JulianDate {
constructor(julianDayNumber?: number, secondsOfDay?: number, timeStandard?: TimeStandard);
/**
* Gets or sets the number of whole days.
*/
dayNumber: number;
/**
* Gets or sets the number of seconds into the current day.
*/
secondsOfDay: number;
/**
* Creates a new instance from a GregorianDate.
* @param date - A GregorianDate.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
fromGregorianDate(date: GregorianDate, result?: JulianDate): JulianDate;
/**
* Creates a new instance from a JavaScript Date.
* @param date - A JavaScript Date.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
fromDate(date: Date, result?: JulianDate): JulianDate;
/**
* Creates a new instance from a from an {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601} date.
* This method is superior to Date.parse
because it will handle all valid formats defined by the ISO 8601
* specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.
* @param iso8601String - An ISO 8601 date.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
fromIso8601(iso8601String: string, result?: JulianDate): JulianDate;
/**
* Creates a new instance that represents the current system time.
* This is equivalent to calling JulianDate.fromDate(new Date());
.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
now(result?: JulianDate): JulianDate;
/**
* Creates a {@link GregorianDate} from the provided instance.
* @param julianDate - The date to be converted.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
toGregorianDate(julianDate: JulianDate, result?: GregorianDate): GregorianDate;
/**
* Creates a JavaScript Date from the provided instance.
* Since JavaScript dates are only accurate to the nearest millisecond and
* cannot represent a leap second, consider using {@link JulianDate.toGregorianDate} instead.
* If the provided JulianDate is during a leap second, the previous second is used.
* @param julianDate - The date to be converted.
* @returns A new instance representing the provided date.
*/
toDate(julianDate: JulianDate): Date;
/**
* Creates an ISO8601 representation of the provided date.
* @param julianDate - The date to be converted.
* @param [precision] - The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
* @returns The ISO8601 representation of the provided date.
*/
toIso8601(julianDate: JulianDate, precision?: number): string;
/**
* Duplicates a JulianDate instance.
* @param julianDate - The date to duplicate.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
*/
clone(julianDate: JulianDate, result?: JulianDate): JulianDate;
/**
* Compares two instances.
* @param left - The first instance.
* @param right - The second instance.
* @returns A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.
*/
compare(left: JulianDate, right: JulianDate): number;
/**
* Compares two instances and returns true
if they are equal, false
otherwise.
* @param [left] - The first instance.
* @param [right] - The second instance.
* @returns true
if the dates are equal; otherwise, false
.
*/
equals(left?: JulianDate, right?: JulianDate): boolean;
/**
* Compares two instances and returns true
if they are within epsilon
seconds of
* each other. That is, in order for the dates to be considered equal (and for
* this function to return true
), the absolute value of the difference between them, in
* seconds, must be less than epsilon
.
* @param [left] - The first instance.
* @param [right] - The second instance.
* @param [epsilon = 0] - The maximum number of seconds that should separate the two instances.
* @returns true
if the two dates are within epsilon
seconds of each other; otherwise false
.
*/
equalsEpsilon(left?: JulianDate, right?: JulianDate, epsilon?: number): boolean;
/**
* Computes the total number of whole and fractional days represented by the provided instance.
* @param julianDate - The date.
* @returns The Julian date as single floating point number.
*/
totalDays(julianDate: JulianDate): number;
/**
* Computes the difference in seconds between the provided instance.
* @param left - The first instance.
* @param right - The second instance.
* @returns The difference, in seconds, when subtracting right
from left
.
*/
secondsDifference(left: JulianDate, right: JulianDate): number;
/**
* Computes the difference in days between the provided instance.
* @param left - The first instance.
* @param right - The second instance.
* @returns The difference, in days, when subtracting right
from left
.
*/
daysDifference(left: JulianDate, right: JulianDate): number;
/**
* Computes the number of seconds the provided instance is ahead of UTC.
* @param julianDate - The date.
* @returns The number of seconds the provided instance is ahead of UTC
*/
computeTaiMinusUtc(julianDate: JulianDate): number;
/**
* Adds the provided number of seconds to the provided date instance.
* @param julianDate - The date.
* @param seconds - The number of seconds to add or subtract.
* @param result - An existing instance to use for the result.
* @returns The modified result parameter.
*/
addSeconds(julianDate: JulianDate, seconds: number, result: JulianDate): JulianDate;
/**
* Adds the provided number of minutes to the provided date instance.
* @param julianDate - The date.
* @param minutes - The number of minutes to add or subtract.
* @param result - An existing instance to use for the result.
* @returns The modified result parameter.
*/
addMinutes(julianDate: JulianDate, minutes: number, result: JulianDate): JulianDate;
/**
* Adds the provided number of hours to the provided date instance.
* @param julianDate - The date.
* @param hours - The number of hours to add or subtract.
* @param result - An existing instance to use for the result.
* @returns The modified result parameter.
*/
addHours(julianDate: JulianDate, hours: number, result: JulianDate): JulianDate;
/**
* Adds the provided number of days to the provided date instance.
* @param julianDate - The date.
* @param days - The number of days to add or subtract.
* @param result - An existing instance to use for the result.
* @returns The modified result parameter.
*/
addDays(julianDate: JulianDate, days: number, result: JulianDate): JulianDate;
/**
* Compares the provided instances and returns true
if left
is earlier than right
, false
otherwise.
* @param left - The first instance.
* @param right - The second instance.
* @returns true
if left
is earlier than right
, false
otherwise.
*/
lessThan(left: JulianDate, right: JulianDate): boolean;
/**
* Compares the provided instances and returns true
if left
is earlier than or equal to right
, false
otherwise.
* @param left - The first instance.
* @param right - The second instance.
* @returns true
if left
is earlier than or equal to right
, false
otherwise.
*/
lessThanOrEquals(left: JulianDate, right: JulianDate): boolean;
/**
* Compares the provided instances and returns true
if left
is later than right
, false
otherwise.
* @param left - The first instance.
* @param right - The second instance.
* @returns true
if left
is later than right
, false
otherwise.
*/
greaterThan(left: JulianDate, right: JulianDate): boolean;
/**
* Compares the provided instances and returns true
if left
is later than or equal to right
, false
otherwise.
* @param left - The first instance.
* @param right - The second instance.
* @returns true
if left
is later than or equal to right
, false
otherwise.
*/
greaterThanOrEquals(left: JulianDate, right: JulianDate): boolean;
/**
* Duplicates this instance.
* @param [result] - An existing instance to use for the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
clone(result?: JulianDate): JulianDate;
/**
* Compares this and the provided instance and returns true
if they are equal, false
otherwise.
* @param [right] - The second instance.
* @returns true
if the dates are equal; otherwise, false
.
*/
equals(right?: JulianDate): boolean;
/**
* Compares this and the provided instance and returns true
if they are within epsilon
seconds of
* each other. That is, in order for the dates to be considered equal (and for
* this function to return true
), the absolute value of the difference between them, in
* seconds, must be less than epsilon
.
* @param [right] - The second instance.
* @param [epsilon = 0] - The maximum number of seconds that should separate the two instances.
* @returns true
if the two dates are within epsilon
seconds of each other; otherwise false
.
*/
equalsEpsilon(right?: JulianDate, epsilon?: number): boolean;
/**
* Creates a string representing this date in ISO8601 format.
* @returns A string representing this date in ISO8601 format.
*/
toString(): string;
/**
* Gets or sets the list of leap seconds used throughout SuperMap.
*/
leapSeconds: LeapSecond[];
}
/**
* This enumerated type is for representing keyboard modifiers. These are keys
* that are held down in addition to other event types.
*/
export enum KeyboardEventModifier {
/**
* Represents the shift key being held down.
*/
SHIFT = 0,
/**
* Represents the control key being held down.
*/
CTRL = 1,
/**
* Represents the alt key being held down.
*/
ALT = 2
}
/**
* An {@link InterpolationAlgorithm} for performing Lagrange interpolation.
*/
export namespace LagrangePolynomialApproximation {
/**
* Given the desired degree, returns the number of data points required for interpolation.
* @param degree - The desired degree of interpolation.
* @returns The number of required data points needed for the desired degree of interpolation.
*/
function getRequiredDataPoints(degree: number): number;
/**
* Interpolates values using Lagrange Polynomial Approximation.
* @param x - The independent variable for which the dependent variables will be interpolated.
* @param xTable - The array of independent variables to use to interpolate. The values
* in this array must be in increasing order and the same value must not occur twice in the array.
* @param yTable - The array of dependent variables to use to interpolate. For a set of three
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
* @param yStride - The number of dependent variable values in yTable corresponding to
* each independent variable value in xTable.
* @param [result] - An existing array into which to store the result.
* @returns The array of interpolated values, or the result parameter if one was provided.
*/
function interpolateOrderZero(x: number, xTable: number[], yTable: number[], yStride: number, result?: number[]): number[];
}
/**
* Describes a single leap second, which is constructed from a {@link JulianDate} and a
* numerical offset representing the number of seconds TAI is ahead of the UTC time standard.
* @param [date] - A Julian date representing the time of the leap second.
* @param [offset] - The cumulative number of seconds that TAI is ahead of UTC at the provided date.
*/
export class LeapSecond {
constructor(date?: JulianDate, offset?: number);
/**
* Gets or sets the date at which this leap second occurs.
*/
julianDate: JulianDate;
/**
* Gets or sets the cumulative number of seconds between the UTC and TAI time standards at the time
* of this leap second.
*/
offset: number;
}
/**
* An {@link InterpolationAlgorithm} for performing linear interpolation.
*/
export namespace LinearApproximation {
/**
* Given the desired degree, returns the number of data points required for interpolation.
* Since linear interpolation can only generate a first degree polynomial, this function
* always returns 2.
* @param degree - The desired degree of interpolation.
* @returns This function always returns 2.
*/
function getRequiredDataPoints(degree: number): number;
/**
* Interpolates values using linear approximation.
* @param x - The independent variable for which the dependent variables will be interpolated.
* @param xTable - The array of independent variables to use to interpolate. The values
* in this array must be in increasing order and the same value must not occur twice in the array.
* @param yTable - The array of dependent variables to use to interpolate. For a set of three
* dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
* @param yStride - The number of dependent variable values in yTable corresponding to
* each independent variable value in xTable.
* @param [result] - An existing array into which to store the result.
* @returns The array of interpolated values, or the result parameter if one was provided.
*/
function interpolateOrderZero(x: number, xTable: number[], yTable: number[], yStride: number, result?: number[]): number[];
}
/**
* A spline that uses piecewise linear interpolation to create a curve.
* @example
* const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
* const spline = new SuperMap.LinearSpline({
* times : times,
* points : [
* new SuperMap.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new SuperMap.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new SuperMap.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new SuperMap.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new SuperMap.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ]
* });
*
* const p0 = spline.evaluate(times[0]);
* @param options - Object with the following properties:
* @param options.times - An array of strictly increasing, unit-less, floating-point times at each point.
* The values are in no way connected to the clock time. They are the parameterization for the curve.
* @param options.points - The array of control points.
*/
export class LinearSpline {
constructor(options: {
times: number[];
points: number[] | Cartesian3[];
});
/**
* An array of times for the control points.
*/
readonly times: number[];
/**
* An array of {@link Cartesian3} control points.
*/
readonly points: number[] | Cartesian3[];
/**
* Finds an index i
in times
such that the parameter
* time
is in the interval [times[i], times[i + 1]]
.
* @param time - The time.
* @returns The index for the element at the start of the interval.
*/
findTimeInterval(time: number): number;
/**
* Wraps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, wrapped around to the updated animation.
*/
wrapTime(time: number): number;
/**
* Clamps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, clamped to the animation period.
*/
clampTime(time: number): number;
/**
* Evaluates the curve at a given time.
* @param time - The time at which to evaluate the curve.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new instance of the point on the curve at the given time.
*/
evaluate(time: number, result?: Cartesian3): number | Cartesian3;
}
/**
* Defines how geodetic ellipsoid coordinates ({@link Cartographic}) project to a
* flat map like SuperMap's 2D and Columbus View modes.
*/
export class MapProjection {
constructor();
/**
* Gets the {@link Ellipsoid}.
*/
readonly ellipsoid: Ellipsoid;
/**
* Projects {@link Cartographic} coordinates, in radians, to projection-specific map coordinates, in meters.
* @param cartographic - The coordinates to project.
* @param [result] - An instance into which to copy the result. If this parameter is
* undefined, a new instance is created and returned.
* @returns The projected coordinates. If the result parameter is not undefined, the
* coordinates are copied there and that instance is returned. Otherwise, a new instance is
* created and returned.
*/
project(cartographic: Cartographic, result?: Cartesian3): Cartesian3;
/**
* Unprojects projection-specific map {@link Cartesian3} coordinates, in meters, to {@link Cartographic}
* coordinates, in radians.
* @param cartesian - The Cartesian position to unproject with height (z) in meters.
* @param [result] - An instance into which to copy the result. If this parameter is
* undefined, a new instance is created and returned.
* @returns The unprojected coordinates. If the result parameter is not undefined, the
* coordinates are copied there and that instance is returned. Otherwise, a new instance is
* created and returned.
*/
unproject(cartesian: Cartesian3, result?: Cartographic): Cartographic;
}
/**
* Math functions.
*/
export namespace Math {
/**
* 0.1
*/
const EPSILON1 = 0.1;
/**
* 0.01
*/
const EPSILON2 = 0.01;
/**
* 0.001
*/
const EPSILON3 = 0.001;
/**
* 0.0001
*/
const EPSILON4 = 0.0001;
/**
* 0.00001
*/
const EPSILON5 = 0.00001;
/**
* 0.000001
*/
const EPSILON6 = 0.000001;
/**
* 0.0000001
*/
const EPSILON7 = 1e-7;
/**
* 0.00000001
*/
const EPSILON8 = 1e-8;
/**
* 0.000000001
*/
const EPSILON9 = 1e-9;
/**
* 0.0000000001
*/
const EPSILON10 = 1e-10;
/**
* 0.00000000001
*/
const EPSILON11 = 1e-11;
/**
* 0.000000000001
*/
const EPSILON12 = 1e-12;
/**
* 0.0000000000001
*/
const EPSILON13 = 1e-13;
/**
* 0.00000000000001
*/
const EPSILON14 = 1e-14;
/**
* 0.000000000000001
*/
const EPSILON15 = 1e-15;
/**
* 0.0000000000000001
*/
const EPSILON16 = 1e-16;
/**
* 0.00000000000000001
*/
const EPSILON17 = 1e-17;
/**
* 0.000000000000000001
*/
const EPSILON18 = 1e-18;
/**
* 0.0000000000000000001
*/
const EPSILON19 = 1e-19;
/**
* 0.00000000000000000001
*/
const EPSILON20 = 1e-20;
/**
* 0.000000000000000000001
*/
const EPSILON21 = 1e-21;
/**
* The gravitational parameter of the Earth in meters cubed
* per second squared as defined by the WGS84 model: 3.986004418e14
*/
const GRAVITATIONALPARAMETER = 398600441800000;
/**
* Radius of the sun in meters: 6.955e8
*/
const SOLAR_RADIUS = 695500000;
/**
* The mean radius of the moon, according to the "Report of the IAU/IAG Working Group on
* Cartographic Coordinates and Rotational Elements of the Planets and satellites: 2000",
* Celestial Mechanics 82: 83-110, 2002.
*/
const LUNAR_RADIUS = 1737400;
/**
* 64 * 1024
*/
const SIXTY_FOUR_KILOBYTES: number;
/**
* 4 * 1024 * 1024 * 1024
*/
const FOUR_GIGABYTES: number;
/**
* Returns the sign of the value; 1 if the value is positive, -1 if the value is
* negative, or 0 if the value is 0.
* @param value - The value to return the sign of.
* @returns The sign of value.
*/
function sign(value: number): number;
/**
* Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative.
* This is similar to {@link Math#sign} except that returns 1.0 instead of
* 0.0 when the input value is 0.0.
* @param value - The value to return the sign of.
* @returns The sign of value.
*/
function signNotZero(value: number): number;
/**
* Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMaximum]
* @param value - The scalar value in the range [-1.0, 1.0]
* @param [rangeMaximum = 255] - The maximum value in the mapped range, 255 by default.
* @returns A SNORM value, where 0 maps to -1.0 and rangeMaximum maps to 1.0.
*/
function toSNorm(value: number, rangeMaximum?: number): number;
/**
* Converts a SNORM value in the range [0, rangeMaximum] to a scalar in the range [-1.0, 1.0].
* @param value - SNORM value in the range [0, rangeMaximum]
* @param [rangeMaximum = 255] - The maximum value in the SNORM range, 255 by default.
* @returns Scalar in the range [-1.0, 1.0].
*/
function fromSNorm(value: number, rangeMaximum?: number): number;
/**
* Converts a scalar value in the range [rangeMinimum, rangeMaximum] to a scalar in the range [0.0, 1.0]
* @param value - The scalar value in the range [rangeMinimum, rangeMaximum]
* @param rangeMinimum - The minimum value in the mapped range.
* @param rangeMaximum - The maximum value in the mapped range.
* @returns A scalar value, where rangeMinimum maps to 0.0 and rangeMaximum maps to 1.0.
*/
function normalize(value: number, rangeMinimum: number, rangeMaximum: number): number;
/**
* Returns the hyperbolic sine of a number.
* The hyperbolic sine of value is defined to be
* (ex - e-x)/2.0
* where e is Euler's number, approximately 2.71828183.
*
* Special cases: *
value
.
*/
function sinh(value: number): number;
/**
* Returns the hyperbolic cosine of a number.
* The hyperbolic cosine of value is defined to be
* (ex + e-x)/2.0
* where e is Euler's number, approximately 2.71828183.
*
* Special cases: *
value
.
*/
function cosh(value: number): number;
/**
* Computes the linear interpolation of two values.
* @example
* const n = SuperMap.Math.lerp(0.0, 2.0, 0.5); // returns 1.0
* @param p - The start value to interpolate.
* @param q - The end value to interpolate.
* @param time - The time of interpolation generally in the range [0.0, 1.0]
.
* @returns The linearly interpolated value.
*/
function lerp(p: number, q: number, time: number): number;
/**
* pi
*/
const PI: number;
/**
* 1/pi
*/
const ONE_OVER_PI: number;
/**
* pi/2
*/
const PI_OVER_TWO: number;
/**
* pi/3
*/
const PI_OVER_THREE: number;
/**
* pi/4
*/
const PI_OVER_FOUR: number;
/**
* pi/6
*/
const PI_OVER_SIX: number;
/**
* 3pi/2
*/
const THREE_PI_OVER_TWO: number;
/**
* 2pi
*/
const TWO_PI: number;
/**
* 1/2pi
*/
const ONE_OVER_TWO_PI: number;
/**
* The number of radians in a degree.
*/
const RADIANS_PER_DEGREE: number;
/**
* The number of degrees in a radian.
*/
const DEGREES_PER_RADIAN: number;
/**
* The number of radians in an arc second.
*/
const RADIANS_PER_ARCSECOND: number;
/**
* Converts degrees to radians.
* @param degrees - The angle to convert in degrees.
* @returns The corresponding angle in radians.
*/
function toRadians(degrees: number): number;
/**
* Converts radians to degrees.
* @param radians - The angle to convert in radians.
* @returns The corresponding angle in degrees.
*/
function toDegrees(radians: number): number;
/**
* Converts a longitude value, in radians, to the range [-Math.PI
, Math.PI
).
* @example
* // Convert 270 degrees to -90 degrees longitude
* const longitude = SuperMap.Math.convertLongitudeRange(SuperMap.Math.toRadians(270.0));
* @param angle - The longitude value, in radians, to convert to the range [-Math.PI
, Math.PI
).
* @returns The equivalent longitude value in the range [-Math.PI
, Math.PI
).
*/
function convertLongitudeRange(angle: number): number;
/**
* Convenience function that clamps a latitude value, in radians, to the range [-Math.PI/2
, Math.PI/2
).
* Useful for sanitizing data before use in objects requiring correct range.
* @example
* // Clamp 108 degrees latitude to 90 degrees latitude
* const latitude = SuperMap.Math.clampToLatitudeRange(SuperMap.Math.toRadians(108.0));
* @param angle - The latitude value, in radians, to clamp to the range [-Math.PI/2
, Math.PI/2
).
* @returns The latitude value clamped to the range [-Math.PI/2
, Math.PI/2
).
*/
function clampToLatitudeRange(angle: number): number;
/**
* Produces an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle.
* @param angle - in radians
* @returns The angle in the range [-Math.PI
, Math.PI
].
*/
function negativePiToPi(angle: number): number;
/**
* Produces an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle.
* @param angle - in radians
* @returns The angle in the range [0, Math.TWO_PI
].
*/
function zeroToTwoPi(angle: number): number;
/**
* The modulo operation that also works for negative dividends.
* @param m - The dividend.
* @param n - The divisor.
* @returns The remainder.
*/
function mod(m: number, n: number): number;
/**
* Determines if two values are equal using an absolute or relative tolerance test. This is useful
* to avoid problems due to roundoff error when comparing floating-point values directly. The values are
* first compared using an absolute tolerance test. If that fails, a relative tolerance test is performed.
* Use this test if you are unsure of the magnitudes of left and right.
* @example
* const a = SuperMap.Math.equalsEpsilon(0.0, 0.01, SuperMap.Math.EPSILON2); // true
* const b = SuperMap.Math.equalsEpsilon(0.0, 0.1, SuperMap.Math.EPSILON2); // false
* const c = SuperMap.Math.equalsEpsilon(3699175.1634344, 3699175.2, SuperMap.Math.EPSILON7); // true
* const d = SuperMap.Math.equalsEpsilon(3699175.1634344, 3699175.2, SuperMap.Math.EPSILON9); // false
* @param left - The first value to compare.
* @param right - The other value to compare.
* @param [relativeEpsilon = 0] - The maximum inclusive delta between left
and right
for the relative tolerance test.
* @param [absoluteEpsilon = relativeEpsilon] - The maximum inclusive delta between left
and right
for the absolute tolerance test.
* @returns true
if the values are equal within the epsilon; otherwise, false
.
*/
function equalsEpsilon(left: number, right: number, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
/**
* Determines if the left value is less than the right value. If the two values are within
* absoluteEpsilon
of each other, they are considered equal and this function returns false.
* @param left - The first number to compare.
* @param right - The second number to compare.
* @param absoluteEpsilon - The absolute epsilon to use in comparison.
* @returns true
if left
is less than right
by more than
* absoluteEpsilon. false
if left
is greater or if the two
* values are nearly equal.
*/
function lessThan(left: number, right: number, absoluteEpsilon: number): boolean;
/**
* Determines if the left value is less than or equal to the right value. If the two values are within
* absoluteEpsilon
of each other, they are considered equal and this function returns true.
* @param left - The first number to compare.
* @param right - The second number to compare.
* @param absoluteEpsilon - The absolute epsilon to use in comparison.
* @returns true
if left
is less than right
or if the
* the values are nearly equal.
*/
function lessThanOrEquals(left: number, right: number, absoluteEpsilon: number): boolean;
/**
* Determines if the left value is greater the right value. If the two values are within
* absoluteEpsilon
of each other, they are considered equal and this function returns false.
* @param left - The first number to compare.
* @param right - The second number to compare.
* @param absoluteEpsilon - The absolute epsilon to use in comparison.
* @returns true
if left
is greater than right
by more than
* absoluteEpsilon. false
if left
is less or if the two
* values are nearly equal.
*/
function greaterThan(left: number, right: number, absoluteEpsilon: number): boolean;
/**
* Determines if the left value is greater than or equal to the right value. If the two values are within
* absoluteEpsilon
of each other, they are considered equal and this function returns true.
* @param left - The first number to compare.
* @param right - The second number to compare.
* @param absoluteEpsilon - The absolute epsilon to use in comparison.
* @returns true
if left
is greater than right
or if the
* the values are nearly equal.
*/
function greaterThanOrEquals(left: number, right: number, absoluteEpsilon: number): boolean;
/**
* Computes the factorial of the provided number.
* @example
* //Compute 7!, which is equal to 5040
* const computedFactorial = SuperMap.Math.factorial(7);
* @param n - The number whose factorial is to be computed.
* @returns The factorial of the provided number or undefined if the number is less than 0.
*/
function factorial(n: number): number;
/**
* Increments a number with a wrapping to a minimum value if the number exceeds the maximum value.
* @example
* const n = SuperMap.Math.incrementWrap(5, 10, 0); // returns 6
* const m = SuperMap.Math.incrementWrap(10, 10, 0); // returns 0
* @param [n] - The number to be incremented.
* @param [maximumValue] - The maximum incremented value before rolling over to the minimum value.
* @param [minimumValue = 0.0] - The number reset to after the maximum value has been exceeded.
* @returns The incremented number.
*/
function incrementWrap(n?: number, maximumValue?: number, minimumValue?: number): number;
/**
* Determines if a non-negative integer is a power of two.
* The maximum allowed input is (2^32)-1 due to 32-bit bitwise operator limitation in Javascript.
* @example
* const t = SuperMap.Math.isPowerOfTwo(16); // true
* const f = SuperMap.Math.isPowerOfTwo(20); // false
* @param n - The integer to test in the range [0, (2^32)-1].
* @returns true
if the number if a power of two; otherwise, false
.
*/
function isPowerOfTwo(n: number): boolean;
/**
* Computes the next power-of-two integer greater than or equal to the provided non-negative integer.
* The maximum allowed input is 2^31 due to 32-bit bitwise operator limitation in Javascript.
* @example
* const n = SuperMap.Math.nextPowerOfTwo(29); // 32
* const m = SuperMap.Math.nextPowerOfTwo(32); // 32
* @param n - The integer to test in the range [0, 2^31].
* @returns The next power-of-two integer.
*/
function nextPowerOfTwo(n: number): number;
/**
* Computes the previous power-of-two integer less than or equal to the provided non-negative integer.
* The maximum allowed input is (2^32)-1 due to 32-bit bitwise operator limitation in Javascript.
* @example
* const n = SuperMap.Math.previousPowerOfTwo(29); // 16
* const m = SuperMap.Math.previousPowerOfTwo(32); // 32
* @param n - The integer to test in the range [0, (2^32)-1].
* @returns The previous power-of-two integer.
*/
function previousPowerOfTwo(n: number): number;
/**
* Constraint a value to lie between two values.
* @param value - The value to clamp.
* @param min - The minimum value.
* @param max - The maximum value.
* @returns The clamped value such that min <= result <= max.
*/
function clamp(value: number, min: number, max: number): number;
/**
* Sets the seed used by the random number generator
* in {@link Math#nextRandomNumber}.
* @param seed - An integer used as the seed.
*/
function setRandomNumberSeed(seed: number): void;
/**
* Generates a random floating point number in the range of [0.0, 1.0)
* using a Mersenne twister.
* @returns A random number in the range of [0.0, 1.0).
*/
function nextRandomNumber(): number;
/**
* Generates a random number between two numbers.
* @param min - The minimum value.
* @param max - The maximum value.
* @returns A random number between the min and max.
*/
function randomBetween(min: number, max: number): number;
/**
* Computes Math.acos(value)
, but first clamps value
to the range [-1.0, 1.0]
* so that the function will never return NaN.
* @param value - The value for which to compute acos.
* @returns The acos of the value if the value is in the range [-1.0, 1.0], or the acos of -1.0 or 1.0,
* whichever is closer, if the value is outside the range.
*/
function acosClamped(value: number): number;
/**
* Computes Math.asin(value)
, but first clamps value
to the range [-1.0, 1.0]
* so that the function will never return NaN.
* @param value - The value for which to compute asin.
* @returns The asin of the value if the value is in the range [-1.0, 1.0], or the asin of -1.0 or 1.0,
* whichever is closer, if the value is outside the range.
*/
function asinClamped(value: number): number;
/**
* Finds the chord length between two points given the circle's radius and the angle between the points.
* @param angle - The angle between the two points.
* @param radius - The radius of the circle.
* @returns The chord length.
*/
function chordLength(angle: number, radius: number): number;
/**
* Finds the logarithm of a number to a base.
* @param number - The number.
* @param base - The base.
* @returns The result.
*/
function logBase(number: number, base: number): number;
/**
* Finds the cube root of a number.
* Returns NaN if number
is not provided.
* @param [number] - The number.
* @returns The result.
*/
function cbrt(number?: number): number;
/**
* Finds the base 2 logarithm of a number.
* @param number - The number.
* @returns The result.
*/
function log2(number: number): number;
/**
* Computes a fast approximation of Atan for input in the range [-1, 1].
*
* Based on Michal Drobot's approximation from ShaderFastLibs,
* which in turn is based on "Efficient approximations for the arctangent function,"
* Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.
* Adapted from ShaderFastLibs under MIT License.
* @param x - An input number in the range [-1, 1]
* @returns An approximation of atan(x)
*/
function fastApproximateAtan(x: number): number;
/**
* Computes a fast approximation of Atan2(x, y) for arbitrary input scalars.
*
* Range reduction math based on nvidia's cg reference implementation: http://developer.download.nvidia.com/cg/atan2.html
* @param x - An input number that isn't zero if y is zero.
* @param y - An input number that isn't zero if x is zero.
* @returns An approximation of atan2(x, y)
*/
function fastApproximateAtan2(x: number, y: number): number;
}
export interface Matrix2 extends ArrayLike {
}
/**
* A 2x2 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
* @param [column0Row0 = 0.0] - The value for column 0, row 0.
* @param [column1Row0 = 0.0] - The value for column 1, row 0.
* @param [column0Row1 = 0.0] - The value for column 0, row 1.
* @param [column1Row1 = 0.0] - The value for column 1, row 1.
*/
export class Matrix2 implements ArrayLike {
constructor(column0Row0?: number, column1Row0?: number, column0Row1?: number, column1Row1?: number);
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Matrix2, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Matrix2 instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Matrix2): Matrix2;
/**
* Flattens an array of Matrix2s into an array of components. The components
* are stored in column-major order.
* @param array - The array of matrices to pack.
* @param [result] - The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
* @returns The packed array.
*/
packArray(array: Matrix2[], result?: number[]): number[];
/**
* Unpacks an array of column-major matrix components into an array of Matrix2s.
* @param array - The array of components to unpack.
* @param [result] - The array onto which to store the result.
* @returns The unpacked array.
*/
unpackArray(array: number[], result?: Matrix2[]): Matrix2[];
/**
* Duplicates a Matrix2 instance.
* @param matrix - The matrix to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix2 instance if one was not provided. (Returns undefined if matrix is undefined)
*/
clone(matrix: Matrix2, result?: Matrix2): Matrix2;
/**
* Creates a Matrix2 from 4 consecutive elements in an array.
* @example
* // Create the Matrix2:
* // [1.0, 2.0]
* // [1.0, 2.0]
*
* const v = [1.0, 1.0, 2.0, 2.0];
* const m = SuperMap.Matrix2.fromArray(v);
*
* // Create same Matrix2 with using an offset into an array
* const v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
* const m2 = SuperMap.Matrix2.fromArray(v2, 2);
* @param array - The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
* @param [startingIndex = 0] - The offset into the array of the first element, which corresponds to first column first row position in the matrix.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix2 instance if one was not provided.
*/
fromArray(array: number[], startingIndex?: number, result?: Matrix2): Matrix2;
/**
* Creates a Matrix2 instance from a column-major order array.
* @param values - The column-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix2 instance if one was not provided.
*/
fromColumnMajorArray(values: number[], result?: Matrix2): Matrix2;
/**
* Creates a Matrix2 instance from a row-major order array.
* The resulting matrix will be in column-major order.
* @param values - The row-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix2 instance if one was not provided.
*/
fromRowMajorArray(values: number[], result?: Matrix2): Matrix2;
/**
* Computes a Matrix2 instance representing a non-uniform scale.
* @example
* // Creates
* // [7.0, 0.0]
* // [0.0, 8.0]
* const m = SuperMap.Matrix2.fromScale(new SuperMap.Cartesian2(7.0, 8.0));
* @param scale - The x and y scale factors.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix2 instance if one was not provided.
*/
fromScale(scale: Cartesian2, result?: Matrix2): Matrix2;
/**
* Computes a Matrix2 instance representing a uniform scale.
* @example
* // Creates
* // [2.0, 0.0]
* // [0.0, 2.0]
* const m = SuperMap.Matrix2.fromUniformScale(2.0);
* @param scale - The uniform scale factor.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix2 instance if one was not provided.
*/
fromUniformScale(scale: number, result?: Matrix2): Matrix2;
/**
* Creates a rotation matrix.
* @example
* // Rotate a point 45 degrees counterclockwise.
* const p = new SuperMap.Cartesian2(5, 6);
* const m = SuperMap.Matrix2.fromRotation(SuperMap.Math.toRadians(45.0));
* const rotated = SuperMap.Matrix2.multiplyByVector(m, p, new SuperMap.Cartesian2());
* @param angle - The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix2 instance if one was not provided.
*/
fromRotation(angle: number, result?: Matrix2): Matrix2;
/**
* Creates an Array from the provided Matrix2 instance.
* The array will be in column-major order.
* @param matrix - The matrix to use..
* @param [result] - The Array onto which to store the result.
* @returns The modified Array parameter or a new Array instance if one was not provided.
*/
toArray(matrix: Matrix2, result?: number[]): number[];
/**
* Computes the array index of the element at the provided row and column.
* @example
* const myMatrix = new SuperMap.Matrix2();
* const column1Row0Index = SuperMap.Matrix2.getElementIndex(1, 0);
* const column1Row0 = myMatrix[column1Row0Index]
* myMatrix[column1Row0Index] = 10.0;
* @param row - The zero-based index of the row.
* @param column - The zero-based index of the column.
* @returns The index of the element at the provided row and column.
*/
getElementIndex(row: number, column: number): number;
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getColumn(matrix: Matrix2, index: number, result: Cartesian2): Cartesian2;
/**
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified column.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setColumn(matrix: Matrix2, index: number, cartesian: Cartesian2, result: Cartesian2): Matrix2;
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRow(matrix: Matrix2, index: number, result: Cartesian2): Cartesian2;
/**
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified row.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setRow(matrix: Matrix2, index: number, cartesian: Cartesian2, result: Matrix2): Matrix2;
/**
* Computes a new matrix that replaces the scale with the provided scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setScale(matrix: Matrix2, scale: Cartesian2, result: Matrix2): Matrix2;
/**
* Computes a new matrix that replaces the scale with the provided uniform scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The uniform scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setUniformScale(matrix: Matrix2, scale: number, result: Matrix2): Matrix2;
/**
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getScale(matrix: Matrix2, result: Cartesian2): Cartesian2;
/**
* Computes the maximum scale assuming the matrix is an affine transformation.
* The maximum scale is the maximum length of the column vectors.
* @param matrix - The matrix.
* @returns The maximum scale.
*/
getMaximumScale(matrix: Matrix2): number;
/**
* Sets the rotation assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param rotation - The rotation matrix.
* @returns The modified result parameter.
*/
setRotation(matrix: Matrix2, rotation: Matrix2): Matrix2;
/**
* Extracts the rotation matrix assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRotation(matrix: Matrix2, result: Matrix2): Matrix2;
/**
* Computes the product of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiply(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
/**
* Computes the sum of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
/**
* Computes the difference of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
/**
* Computes the product of a matrix and a column vector.
* @param matrix - The matrix.
* @param cartesian - The column.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByVector(matrix: Matrix2, cartesian: Cartesian2, result: Cartesian2): Cartesian2;
/**
* Computes the product of a matrix and a scalar.
* @param matrix - The matrix.
* @param scalar - The number to multiply by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(matrix: Matrix2, scalar: number, result: Matrix2): Matrix2;
/**
* Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
* @example
* // Instead of SuperMap.Matrix2.multiply(m, SuperMap.Matrix2.fromScale(scale), m);
* SuperMap.Matrix2.multiplyByScale(m, scale, m);
* @param matrix - The matrix on the left-hand side.
* @param scale - The non-uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScale(matrix: Matrix2, scale: number, result: Matrix2): Matrix2;
/**
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
* @example
* // Instead of SuperMap.Matrix2.multiply(m, SuperMap.Matrix2.fromUniformScale(scale), m);
* SuperMap.Matrix2.multiplyByUniformScale(m, scale, m);
* @param matrix - The matrix on the left-hand side.
* @param scale - The uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByUniformScale(matrix: Matrix2, scale: number, result: Matrix2): Matrix2;
/**
* Creates a negated copy of the provided matrix.
* @param matrix - The matrix to negate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(matrix: Matrix2, result: Matrix2): Matrix2;
/**
* Computes the transpose of the provided matrix.
* @param matrix - The matrix to transpose.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
transpose(matrix: Matrix2, result: Matrix2): Matrix2;
/**
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
* @param matrix - The matrix with signed elements.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
abs(matrix: Matrix2, result: Matrix2): Matrix2;
/**
* Compares the provided matrices componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Matrix2, right?: Matrix2): boolean;
/**
* Compares the provided matrices componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Matrix2, right?: Matrix2, epsilon?: number): boolean;
/**
* An immutable Matrix2 instance initialized to the identity matrix.
*/
readonly IDENTITY: Matrix2;
/**
* An immutable Matrix2 instance initialized to the zero matrix.
*/
readonly ZERO: Matrix2;
/**
* The index into Matrix2 for column 0, row 0.
* @example
* const matrix = new SuperMap.Matrix2();
* matrix[SuperMap.Matrix2.COLUMN0ROW0] = 5.0; // set column 0, row 0 to 5.0
*/
readonly COLUMN0ROW0: number;
/**
* The index into Matrix2 for column 0, row 1.
* @example
* const matrix = new SuperMap.Matrix2();
* matrix[SuperMap.Matrix2.COLUMN0ROW1] = 5.0; // set column 0, row 1 to 5.0
*/
readonly COLUMN0ROW1: number;
/**
* The index into Matrix2 for column 1, row 0.
* @example
* const matrix = new SuperMap.Matrix2();
* matrix[SuperMap.Matrix2.COLUMN1ROW0] = 5.0; // set column 1, row 0 to 5.0
*/
readonly COLUMN1ROW0: number;
/**
* The index into Matrix2 for column 1, row 1.
* @example
* const matrix = new SuperMap.Matrix2();
* matrix[SuperMap.Matrix2.COLUMN1ROW1] = 5.0; // set column 1, row 1 to 5.0
*/
readonly COLUMN1ROW1: number;
/**
* Gets the number of items in the collection.
*/
length: number;
/**
* Duplicates the provided Matrix2 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix2 instance if one was not provided.
*/
clone(result?: Matrix2): Matrix2;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side matrix.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Matrix2): boolean;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [right] - The right hand side matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Matrix2, epsilon?: number): boolean;
/**
* Creates a string representing this Matrix with each row being
* on a separate line and in the format '(column0, column1)'.
* @returns A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1)'.
*/
toString(): string;
}
export interface Matrix3 extends ArrayLike {
}
/**
* A 3x3 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
* @param [column0Row0 = 0.0] - The value for column 0, row 0.
* @param [column1Row0 = 0.0] - The value for column 1, row 0.
* @param [column2Row0 = 0.0] - The value for column 2, row 0.
* @param [column0Row1 = 0.0] - The value for column 0, row 1.
* @param [column1Row1 = 0.0] - The value for column 1, row 1.
* @param [column2Row1 = 0.0] - The value for column 2, row 1.
* @param [column0Row2 = 0.0] - The value for column 0, row 2.
* @param [column1Row2 = 0.0] - The value for column 1, row 2.
* @param [column2Row2 = 0.0] - The value for column 2, row 2.
*/
export class Matrix3 implements ArrayLike {
constructor(column0Row0?: number, column1Row0?: number, column2Row0?: number, column0Row1?: number, column1Row1?: number, column2Row1?: number, column0Row2?: number, column1Row2?: number, column2Row2?: number);
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Matrix3, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Matrix3 instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Matrix3): Matrix3;
/**
* Flattens an array of Matrix3s into an array of components. The components
* are stored in column-major order.
* @param array - The array of matrices to pack.
* @param [result] - The array onto which to store the result. If this is a typed array, it must have array.length * 9 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 9) elements.
* @returns The packed array.
*/
packArray(array: Matrix3[], result?: number[]): number[];
/**
* Unpacks an array of column-major matrix components into an array of Matrix3s.
* @param array - The array of components to unpack.
* @param [result] - The array onto which to store the result.
* @returns The unpacked array.
*/
unpackArray(array: number[], result?: Matrix3[]): Matrix3[];
/**
* Duplicates a Matrix3 instance.
* @param matrix - The matrix to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix3 instance if one was not provided. (Returns undefined if matrix is undefined)
*/
clone(matrix: Matrix3, result?: Matrix3): Matrix3;
/**
* Creates a Matrix3 from 9 consecutive elements in an array.
* @example
* // Create the Matrix3:
* // [1.0, 2.0, 3.0]
* // [1.0, 2.0, 3.0]
* // [1.0, 2.0, 3.0]
*
* const v = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
* const m = SuperMap.Matrix3.fromArray(v);
*
* // Create same Matrix3 with using an offset into an array
* const v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
* const m2 = SuperMap.Matrix3.fromArray(v2, 2);
* @param array - The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
* @param [startingIndex = 0] - The offset into the array of the first element, which corresponds to first column first row position in the matrix.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix3 instance if one was not provided.
*/
fromArray(array: number[], startingIndex?: number, result?: Matrix3): Matrix3;
/**
* Creates a Matrix3 instance from a column-major order array.
* @param values - The column-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromColumnMajorArray(values: number[], result?: Matrix3): Matrix3;
/**
* Creates a Matrix3 instance from a row-major order array.
* The resulting matrix will be in column-major order.
* @param values - The row-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromRowMajorArray(values: number[], result?: Matrix3): Matrix3;
/**
* Computes a 3x3 rotation matrix from the provided quaternion.
* @param quaternion - the quaternion to use.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The 3x3 rotation matrix from this quaternion.
*/
fromQuaternion(quaternion: Quaternion, result?: Matrix3): Matrix3;
/**
* Computes a 3x3 rotation matrix from the provided headingPitchRoll. (see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles )
* @param headingPitchRoll - the headingPitchRoll to use.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The 3x3 rotation matrix from this headingPitchRoll.
*/
fromHeadingPitchRoll(headingPitchRoll: HeadingPitchRoll, result?: Matrix3): Matrix3;
/**
* Computes a Matrix3 instance representing a non-uniform scale.
* @example
* // Creates
* // [7.0, 0.0, 0.0]
* // [0.0, 8.0, 0.0]
* // [0.0, 0.0, 9.0]
* const m = SuperMap.Matrix3.fromScale(new SuperMap.Cartesian3(7.0, 8.0, 9.0));
* @param scale - The x, y, and z scale factors.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromScale(scale: Cartesian3, result?: Matrix3): Matrix3;
/**
* Computes a Matrix3 instance representing a uniform scale.
* @example
* // Creates
* // [2.0, 0.0, 0.0]
* // [0.0, 2.0, 0.0]
* // [0.0, 0.0, 2.0]
* const m = SuperMap.Matrix3.fromUniformScale(2.0);
* @param scale - The uniform scale factor.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromUniformScale(scale: number, result?: Matrix3): Matrix3;
/**
* Computes a Matrix3 instance representing the cross product equivalent matrix of a Cartesian3 vector.
* @example
* // Creates
* // [0.0, -9.0, 8.0]
* // [9.0, 0.0, -7.0]
* // [-8.0, 7.0, 0.0]
* const m = SuperMap.Matrix3.fromCrossProduct(new SuperMap.Cartesian3(7.0, 8.0, 9.0));
* @param vector - the vector on the left hand side of the cross product operation.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromCrossProduct(vector: Cartesian3, result?: Matrix3): Matrix3;
/**
* Creates a rotation matrix around the x-axis.
* @example
* // Rotate a point 45 degrees counterclockwise around the x-axis.
* const p = new SuperMap.Cartesian3(5, 6, 7);
* const m = SuperMap.Matrix3.fromRotationX(SuperMap.Math.toRadians(45.0));
* const rotated = SuperMap.Matrix3.multiplyByVector(m, p, new SuperMap.Cartesian3());
* @param angle - The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromRotationX(angle: number, result?: Matrix3): Matrix3;
/**
* Creates a rotation matrix around the y-axis.
* @example
* // Rotate a point 45 degrees counterclockwise around the y-axis.
* const p = new SuperMap.Cartesian3(5, 6, 7);
* const m = SuperMap.Matrix3.fromRotationY(SuperMap.Math.toRadians(45.0));
* const rotated = SuperMap.Matrix3.multiplyByVector(m, p, new SuperMap.Cartesian3());
* @param angle - The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromRotationY(angle: number, result?: Matrix3): Matrix3;
/**
* Creates a rotation matrix around the z-axis.
* @example
* // Rotate a point 45 degrees counterclockwise around the z-axis.
* const p = new SuperMap.Cartesian3(5, 6, 7);
* const m = SuperMap.Matrix3.fromRotationZ(SuperMap.Math.toRadians(45.0));
* const rotated = SuperMap.Matrix3.multiplyByVector(m, p, new SuperMap.Cartesian3());
* @param angle - The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*/
fromRotationZ(angle: number, result?: Matrix3): Matrix3;
/**
* Creates an Array from the provided Matrix3 instance.
* The array will be in column-major order.
* @param matrix - The matrix to use..
* @param [result] - The Array onto which to store the result.
* @returns The modified Array parameter or a new Array instance if one was not provided.
*/
toArray(matrix: Matrix3, result?: number[]): number[];
/**
* Computes the array index of the element at the provided row and column.
* @example
* const myMatrix = new SuperMap.Matrix3();
* const column1Row0Index = SuperMap.Matrix3.getElementIndex(1, 0);
* const column1Row0 = myMatrix[column1Row0Index]
* myMatrix[column1Row0Index] = 10.0;
* @param column - The zero-based index of the column.
* @param row - The zero-based index of the row.
* @returns The index of the element at the provided row and column.
*/
getElementIndex(column: number, row: number): number;
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getColumn(matrix: Matrix3, index: number, result: Cartesian3): Cartesian3;
/**
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified column.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setColumn(matrix: Matrix3, index: number, cartesian: Cartesian3, result: Matrix3): Matrix3;
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRow(matrix: Matrix3, index: number, result: Cartesian3): Cartesian3;
/**
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified row.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setRow(matrix: Matrix3, index: number, cartesian: Cartesian3, result: Matrix3): Matrix3;
/**
* Computes a new matrix that replaces the scale with the provided scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setScale(matrix: Matrix3, scale: Cartesian3, result: Matrix3): Matrix3;
/**
* Computes a new matrix that replaces the scale with the provided uniform scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The uniform scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setUniformScale(matrix: Matrix3, scale: number, result: Matrix3): Matrix3;
/**
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getScale(matrix: Matrix3, result: Cartesian3): Cartesian3;
/**
* Computes the maximum scale assuming the matrix is an affine transformation.
* The maximum scale is the maximum length of the column vectors.
* @param matrix - The matrix.
* @returns The maximum scale.
*/
getMaximumScale(matrix: Matrix3): number;
/**
* Sets the rotation assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param rotation - The rotation matrix.
* @returns The modified result parameter.
*/
setRotation(matrix: Matrix3, rotation: Matrix3): Matrix3;
/**
* Extracts the rotation matrix assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRotation(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the product of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiply(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the sum of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the difference of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the product of a matrix and a column vector.
* @param matrix - The matrix.
* @param cartesian - The column.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByVector(matrix: Matrix3, cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the product of a matrix and a scalar.
* @param matrix - The matrix.
* @param scalar - The number to multiply by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(matrix: Matrix3, scalar: number, result: Matrix3): Matrix3;
/**
* Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
* @example
* // Instead of SuperMap.Matrix3.multiply(m, SuperMap.Matrix3.fromScale(scale), m);
* SuperMap.Matrix3.multiplyByScale(m, scale, m);
* @param matrix - The matrix on the left-hand side.
* @param scale - The non-uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScale(matrix: Matrix3, scale: number, result: Matrix3): Matrix3;
/**
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
* @example
* // Instead of SuperMap.Matrix3.multiply(m, SuperMap.Matrix3.fromUniformScale(scale), m);
* SuperMap.Matrix3.multiplyByUniformScale(m, scale, m);
* @param matrix - The matrix on the left-hand side.
* @param scale - The uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByUniformScale(matrix: Matrix3, scale: number, result: Matrix3): Matrix3;
/**
* Creates a negated copy of the provided matrix.
* @param matrix - The matrix to negate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the transpose of the provided matrix.
* @param matrix - The matrix to transpose.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
transpose(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the eigenvectors and eigenvalues of a symmetric matrix.
*
* Returns a diagonal matrix and unitary matrix such that:
* matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)
*
*
* The values along the diagonal of the diagonal matrix are the eigenvalues. The columns
* of the unitary matrix are the corresponding eigenvectors.
*
* @example
* const a = //... symetric matrix
* const result = {
* unitary : new SuperMap.Matrix3(),
* diagonal : new SuperMap.Matrix3()
* };
* SuperMap.Matrix3.computeEigenDecomposition(a, result);
*
* const unitaryTranspose = SuperMap.Matrix3.transpose(result.unitary, new SuperMap.Matrix3());
* const b = SuperMap.Matrix3.multiply(result.unitary, result.diagonal, new SuperMap.Matrix3());
* SuperMap.Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a
*
* const lambda = SuperMap.Matrix3.getColumn(result.diagonal, 0, new SuperMap.Cartesian3()).x; // first eigenvalue
* const v = SuperMap.Matrix3.getColumn(result.unitary, 0, new SuperMap.Cartesian3()); // first eigenvector
* const c = SuperMap.Cartesian3.multiplyByScalar(v, lambda, new SuperMap.Cartesian3()); // equal to SuperMap.Matrix3.multiplyByVector(a, v)
* @param matrix - The matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.
* @param [result] - An object with unitary and diagonal properties which are matrices onto which to store the result.
* @returns An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.
*/
computeEigenDecomposition(matrix: Matrix3, result?: any): any;
/**
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
* @param matrix - The matrix with signed elements.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
abs(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the determinant of the provided matrix.
* @param matrix - The matrix to use.
* @returns The value of the determinant of the matrix.
*/
determinant(matrix: Matrix3): number;
/**
* Computes the inverse of the provided matrix.
* @param matrix - The matrix to invert.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverse(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Computes the inverse transpose of a matrix.
* @param matrix - The matrix to transpose and invert.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverseTranspose(matrix: Matrix3, result: Matrix3): Matrix3;
/**
* Compares the provided matrices componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Matrix3, right?: Matrix3): boolean;
/**
* Compares the provided matrices componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Matrix3, right?: Matrix3, epsilon?: number): boolean;
/**
* An immutable Matrix3 instance initialized to the identity matrix.
*/
readonly IDENTITY: Matrix3;
/**
* An immutable Matrix3 instance initialized to the zero matrix.
*/
readonly ZERO: Matrix3;
/**
* The index into Matrix3 for column 0, row 0.
*/
readonly COLUMN0ROW0: number;
/**
* The index into Matrix3 for column 0, row 1.
*/
readonly COLUMN0ROW1: number;
/**
* The index into Matrix3 for column 0, row 2.
*/
readonly COLUMN0ROW2: number;
/**
* The index into Matrix3 for column 1, row 0.
*/
readonly COLUMN1ROW0: number;
/**
* The index into Matrix3 for column 1, row 1.
*/
readonly COLUMN1ROW1: number;
/**
* The index into Matrix3 for column 1, row 2.
*/
readonly COLUMN1ROW2: number;
/**
* The index into Matrix3 for column 2, row 0.
*/
readonly COLUMN2ROW0: number;
/**
* The index into Matrix3 for column 2, row 1.
*/
readonly COLUMN2ROW1: number;
/**
* The index into Matrix3 for column 2, row 2.
*/
readonly COLUMN2ROW2: number;
/**
* Gets the number of items in the collection.
*/
length: number;
/**
* Duplicates the provided Matrix3 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix3 instance if one was not provided.
*/
clone(result?: Matrix3): Matrix3;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side matrix.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Matrix3): boolean;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [right] - The right hand side matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Matrix3, epsilon?: number): boolean;
/**
* Creates a string representing this Matrix with each row being
* on a separate line and in the format '(column0, column1, column2)'.
* @returns A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2)'.
*/
toString(): string;
}
export interface Matrix4 extends ArrayLike {
}
/**
* A 4x4 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
* @param [column0Row0 = 0.0] - The value for column 0, row 0.
* @param [column1Row0 = 0.0] - The value for column 1, row 0.
* @param [column2Row0 = 0.0] - The value for column 2, row 0.
* @param [column3Row0 = 0.0] - The value for column 3, row 0.
* @param [column0Row1 = 0.0] - The value for column 0, row 1.
* @param [column1Row1 = 0.0] - The value for column 1, row 1.
* @param [column2Row1 = 0.0] - The value for column 2, row 1.
* @param [column3Row1 = 0.0] - The value for column 3, row 1.
* @param [column0Row2 = 0.0] - The value for column 0, row 2.
* @param [column1Row2 = 0.0] - The value for column 1, row 2.
* @param [column2Row2 = 0.0] - The value for column 2, row 2.
* @param [column3Row2 = 0.0] - The value for column 3, row 2.
* @param [column0Row3 = 0.0] - The value for column 0, row 3.
* @param [column1Row3 = 0.0] - The value for column 1, row 3.
* @param [column2Row3 = 0.0] - The value for column 2, row 3.
* @param [column3Row3 = 0.0] - The value for column 3, row 3.
*/
export class Matrix4 implements ArrayLike {
constructor(column0Row0?: number, column1Row0?: number, column2Row0?: number, column3Row0?: number, column0Row1?: number, column1Row1?: number, column2Row1?: number, column3Row1?: number, column0Row2?: number, column1Row2?: number, column2Row2?: number, column3Row2?: number, column0Row3?: number, column1Row3?: number, column2Row3?: number, column3Row3?: number);
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Matrix4, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Matrix4 instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Matrix4): Matrix4;
/**
* Flattens an array of Matrix4s into an array of components. The components
* are stored in column-major order.
* @param array - The array of matrices to pack.
* @param [result] - The array onto which to store the result. If this is a typed array, it must have array.length * 16 components, else a {@link DeveloperError} will be thrown. If it is a regular array, it will be resized to have (array.length * 16) elements.
* @returns The packed array.
*/
packArray(array: Matrix4[], result?: number[]): number[];
/**
* Unpacks an array of column-major matrix components into an array of Matrix4s.
* @param array - The array of components to unpack.
* @param [result] - The array onto which to store the result.
* @returns The unpacked array.
*/
unpackArray(array: number[], result?: Matrix4[]): Matrix4[];
/**
* Duplicates a Matrix4 instance.
* @param matrix - The matrix to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix4 instance if one was not provided. (Returns undefined if matrix is undefined)
*/
clone(matrix: Matrix4, result?: Matrix4): Matrix4;
/**
* Creates a Matrix4 from 16 consecutive elements in an array.
* @example
* // Create the Matrix4:
* // [1.0, 2.0, 3.0, 4.0]
* // [1.0, 2.0, 3.0, 4.0]
* // [1.0, 2.0, 3.0, 4.0]
* // [1.0, 2.0, 3.0, 4.0]
*
* const v = [1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0];
* const m = SuperMap.Matrix4.fromArray(v);
*
* // Create same Matrix4 with using an offset into an array
* const v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0];
* const m2 = SuperMap.Matrix4.fromArray(v2, 2);
* @param array - The array whose 16 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
* @param [startingIndex = 0] - The offset into the array of the first element, which corresponds to first column first row position in the matrix.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix4 instance if one was not provided.
*/
fromArray(array: number[], startingIndex?: number, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance from a column-major order array.
* @param values - The column-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromColumnMajorArray(values: number[], result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance from a row-major order array.
* The resulting matrix will be in column-major order.
* @param values - The row-major order array.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromRowMajorArray(values: number[], result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance from a Matrix3 representing the rotation
* and a Cartesian3 representing the translation.
* @param rotation - The upper left portion of the matrix representing the rotation.
* @param [translation = Cartesian3.ZERO] - The upper right portion of the matrix representing the translation.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromRotationTranslation(rotation: Matrix3, translation?: Cartesian3, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance from a translation, rotation, and scale (TRS)
* representation with the rotation represented as a quaternion.
* @example
* const result = SuperMap.Matrix4.fromTranslationQuaternionRotationScale(
* new SuperMap.Cartesian3(1.0, 2.0, 3.0), // translation
* SuperMap.Quaternion.IDENTITY, // rotation
* new SuperMap.Cartesian3(7.0, 8.0, 9.0), // scale
* result);
* @param translation - The translation transformation.
* @param rotation - The rotation transformation.
* @param scale - The non-uniform scale transformation.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromTranslationQuaternionRotationScale(translation: Cartesian3, rotation: Quaternion, scale: Cartesian3, result?: Matrix4): Matrix4;
/**
* Creates a Matrix4 instance from a {@link TranslationRotationScale} instance.
* @param translationRotationScale - The instance.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromTranslationRotationScale(translationRotationScale: TranslationRotationScale, result?: Matrix4): Matrix4;
/**
* Creates a Matrix4 instance from a Cartesian3 representing the translation.
* @param translation - The upper right portion of the matrix representing the translation.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromTranslation(translation: Cartesian3, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing a non-uniform scale.
* @example
* // Creates
* // [7.0, 0.0, 0.0, 0.0]
* // [0.0, 8.0, 0.0, 0.0]
* // [0.0, 0.0, 9.0, 0.0]
* // [0.0, 0.0, 0.0, 1.0]
* const m = SuperMap.Matrix4.fromScale(new SuperMap.Cartesian3(7.0, 8.0, 9.0));
* @param scale - The x, y, and z scale factors.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromScale(scale: Cartesian3, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing a uniform scale.
* @example
* // Creates
* // [2.0, 0.0, 0.0, 0.0]
* // [0.0, 2.0, 0.0, 0.0]
* // [0.0, 0.0, 2.0, 0.0]
* // [0.0, 0.0, 0.0, 1.0]
* const m = SuperMap.Matrix4.fromUniformScale(2.0);
* @param scale - The uniform scale factor.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromUniformScale(scale: number, result?: Matrix4): Matrix4;
/**
* Creates a rotation matrix.
* @param rotation - The rotation matrix.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromRotation(rotation: Matrix3, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance from a Camera.
* @param camera - The camera to use.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*/
fromCamera(camera: Camera, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing a perspective transformation matrix.
* @param fovY - The field of view along the Y axis in radians.
* @param aspectRatio - The aspect ratio.
* @param near - The distance to the near plane in meters.
* @param far - The distance to the far plane in meters.
* @param result - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computePerspectiveFieldOfView(fovY: number, aspectRatio: number, near: number, far: number, result: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing an orthographic transformation matrix.
* @param left - The number of meters to the left of the camera that will be in view.
* @param right - The number of meters to the right of the camera that will be in view.
* @param bottom - The number of meters below of the camera that will be in view.
* @param top - The number of meters above of the camera that will be in view.
* @param near - The distance to the near plane in meters.
* @param far - The distance to the far plane in meters.
* @param result - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computeOrthographicOffCenter(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing an off center perspective transformation.
* @param left - The number of meters to the left of the camera that will be in view.
* @param right - The number of meters to the right of the camera that will be in view.
* @param bottom - The number of meters below of the camera that will be in view.
* @param top - The number of meters above of the camera that will be in view.
* @param near - The distance to the near plane in meters.
* @param far - The distance to the far plane in meters.
* @param result - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computePerspectiveOffCenter(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance representing an infinite off center perspective transformation.
* @param left - The number of meters to the left of the camera that will be in view.
* @param right - The number of meters to the right of the camera that will be in view.
* @param bottom - The number of meters below of the camera that will be in view.
* @param top - The number of meters above of the camera that will be in view.
* @param near - The distance to the near plane in meters.
* @param result - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computeInfinitePerspectiveOffCenter(left: number, right: number, bottom: number, top: number, near: number, result: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.
* @example
* // Create viewport transformation using an explicit viewport and depth range.
* const m = SuperMap.Matrix4.computeViewportTransformation({
* x : 0.0,
* y : 0.0,
* width : 1024.0,
* height : 768.0
* }, 0.0, 1.0, new SuperMap.Matrix4());
* @param [viewport = { x : 0.0, y : 0.0, width : 0.0, height : 0.0 }] - The viewport's corners as shown in Example 1.
* @param [nearDepthRange = 0.0] - The near plane distance in window coordinates.
* @param [farDepthRange = 1.0] - The far plane distance in window coordinates.
* @param [result] - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computeViewportTransformation(viewport?: any, nearDepthRange?: number, farDepthRange?: number, result?: Matrix4): Matrix4;
/**
* Computes a Matrix4 instance that transforms from world space to view space.
* @param position - The position of the camera.
* @param direction - The forward direction.
* @param up - The up direction.
* @param right - The right direction.
* @param result - The object in which the result will be stored.
* @returns The modified result parameter.
*/
computeView(position: Cartesian3, direction: Cartesian3, up: Cartesian3, right: Cartesian3, result: Matrix4): Matrix4;
/**
* Computes an Array from the provided Matrix4 instance.
* The array will be in column-major order.
* @example
* //create an array from an instance of Matrix4
* // m = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
* const a = SuperMap.Matrix4.toArray(m);
*
* // m remains the same
* //creates a = [10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0]
* @param matrix - The matrix to use..
* @param [result] - The Array onto which to store the result.
* @returns The modified Array parameter or a new Array instance if one was not provided.
*/
toArray(matrix: Matrix4, result?: number[]): number[];
/**
* Computes the array index of the element at the provided row and column.
* @example
* const myMatrix = new SuperMap.Matrix4();
* const column1Row0Index = SuperMap.Matrix4.getElementIndex(1, 0);
* const column1Row0 = myMatrix[column1Row0Index];
* myMatrix[column1Row0Index] = 10.0;
* @param row - The zero-based index of the row.
* @param column - The zero-based index of the column.
* @returns The index of the element at the provided row and column.
*/
getElementIndex(row: number, column: number): number;
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.
* @example
* //returns a Cartesian4 instance with values from the specified column
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* //Example 1: Creates an instance of Cartesian
* const a = SuperMap.Matrix4.getColumn(m, 2, new SuperMap.Cartesian4());
* @example
* //Example 2: Sets values for Cartesian instance
* const a = new SuperMap.Cartesian4();
* SuperMap.Matrix4.getColumn(m, 2, a);
*
* // a.x = 12.0; a.y = 16.0; a.z = 20.0; a.w = 24.0;
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getColumn(matrix: Matrix4, index: number, result: Cartesian4): Cartesian4;
/**
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian4 instance.
* @example
* //creates a new Matrix4 instance with new column values from the Cartesian4 instance
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* const a = SuperMap.Matrix4.setColumn(m, 2, new SuperMap.Cartesian4(99.0, 98.0, 97.0, 96.0), new SuperMap.Matrix4());
*
* // m remains the same
* // a = [10.0, 11.0, 99.0, 13.0]
* // [14.0, 15.0, 98.0, 17.0]
* // [18.0, 19.0, 97.0, 21.0]
* // [22.0, 23.0, 96.0, 25.0]
* @param matrix - The matrix to use.
* @param index - The zero-based index of the column to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified column.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setColumn(matrix: Matrix4, index: number, cartesian: Cartesian4, result: Matrix4): Matrix4;
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.
* @example
* //returns a Cartesian4 instance with values from the specified column
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* //Example 1: Returns an instance of Cartesian
* const a = SuperMap.Matrix4.getRow(m, 2, new SuperMap.Cartesian4());
* @example
* //Example 2: Sets values for a Cartesian instance
* const a = new SuperMap.Cartesian4();
* SuperMap.Matrix4.getRow(m, 2, a);
*
* // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0;
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to retrieve.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRow(matrix: Matrix4, index: number, result: Cartesian4): Cartesian4;
/**
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian4 instance.
* @example
* //create a new Matrix4 instance with new row values from the Cartesian4 instance
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* const a = SuperMap.Matrix4.setRow(m, 2, new SuperMap.Cartesian4(99.0, 98.0, 97.0, 96.0), new SuperMap.Matrix4());
*
* // m remains the same
* // a = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [99.0, 98.0, 97.0, 96.0]
* // [22.0, 23.0, 24.0, 25.0]
* @param matrix - The matrix to use.
* @param index - The zero-based index of the row to set.
* @param cartesian - The Cartesian whose values will be assigned to the specified row.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setRow(matrix: Matrix4, index: number, cartesian: Cartesian4, result: Matrix4): Matrix4;
/**
* Computes a new matrix that replaces the translation in the rightmost column of the provided
* matrix with the provided translation. This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param translation - The translation that replaces the translation of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setTranslation(matrix: Matrix4, translation: Cartesian3, result: Matrix4): Matrix4;
/**
* Computes a new matrix that replaces the scale with the provided scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setScale(matrix: Matrix4, scale: Cartesian3, result: Matrix4): Matrix4;
/**
* Computes a new matrix that replaces the scale with the provided uniform scale.
* This assumes the matrix is an affine transformation.
* @param matrix - The matrix to use.
* @param scale - The uniform scale that replaces the scale of the provided matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
setUniformScale(matrix: Matrix4, scale: number, result: Matrix4): Matrix4;
/**
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter
*/
getScale(matrix: Matrix4, result: Cartesian3): Cartesian3;
/**
* Computes the maximum scale assuming the matrix is an affine transformation.
* The maximum scale is the maximum length of the column vectors in the upper-left
* 3x3 matrix.
* @param matrix - The matrix.
* @returns The maximum scale.
*/
getMaximumScale(matrix: Matrix4): number;
/**
* Sets the rotation assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param rotation - The rotation matrix.
* @returns The modified result parameter.
*/
setRotation(matrix: Matrix4, rotation: Matrix4): Matrix4;
/**
* Extracts the rotation matrix assuming the matrix is an affine transformation.
* @param matrix - The matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getRotation(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the product of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiply(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the sum of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the difference of two matrices.
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the product of two matrices assuming the matrices are affine transformation matrices,
* where the upper left 3x3 elements are any matrix, and
* the upper three elements in the fourth column are the translation.
* The bottom row is assumed to be [0, 0, 0, 1].
* The matrix is not verified to be in the proper form.
* This method is faster than computing the product for general 4x4
* matrices using {@link Matrix4.multiply}.
* @example
* const m1 = new SuperMap.Matrix4(1.0, 6.0, 7.0, 0.0, 2.0, 5.0, 8.0, 0.0, 3.0, 4.0, 9.0, 0.0, 0.0, 0.0, 0.0, 1.0);
* const m2 = SuperMap.Transforms.eastNorthUpToFixedFrame(new SuperMap.Cartesian3(1.0, 1.0, 1.0));
* const m3 = SuperMap.Matrix4.multiplyTransformation(m1, m2, new SuperMap.Matrix4());
* @param left - The first matrix.
* @param right - The second matrix.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyTransformation(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
/**
* Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]
)
* by a 3x3 rotation matrix. This is an optimization
* for Matrix4.multiply(m, Matrix4.fromRotationTranslation(rotation), m);
with less allocations and arithmetic operations.
* @example
* // Instead of SuperMap.Matrix4.multiply(m, SuperMap.Matrix4.fromRotationTranslation(rotation), m);
* SuperMap.Matrix4.multiplyByMatrix3(m, rotation, m);
* @param matrix - The matrix on the left-hand side.
* @param rotation - The 3x3 rotation matrix on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByMatrix3(matrix: Matrix4, rotation: Matrix3, result: Matrix4): Matrix4;
/**
* Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]
)
* by an implicit translation matrix defined by a {@link Cartesian3}. This is an optimization
* for Matrix4.multiply(m, Matrix4.fromTranslation(position), m);
with less allocations and arithmetic operations.
* @example
* // Instead of SuperMap.Matrix4.multiply(m, SuperMap.Matrix4.fromTranslation(position), m);
* SuperMap.Matrix4.multiplyByTranslation(m, position, m);
* @param matrix - The matrix on the left-hand side.
* @param translation - The translation on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByTranslation(matrix: Matrix4, translation: Cartesian3, result: Matrix4): Matrix4;
/**
* Multiplies an affine transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]
)
* by an implicit non-uniform scale matrix. This is an optimization
* for Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);
, where
* m
must be an affine matrix.
* This function performs fewer allocations and arithmetic operations.
* @example
* // Instead of SuperMap.Matrix4.multiply(m, SuperMap.Matrix4.fromScale(scale), m);
* SuperMap.Matrix4.multiplyByScale(m, scale, m);
* @param matrix - The affine matrix on the left-hand side.
* @param scale - The non-uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScale(matrix: Matrix4, scale: Cartesian3, result: Matrix4): Matrix4;
/**
* Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
* @example
* // Instead of SuperMap.Matrix4.multiply(m, SuperMap.Matrix4.fromUniformScale(scale), m);
* SuperMap.Matrix4.multiplyByUniformScale(m, scale, m);
* @param matrix - The matrix on the left-hand side.
* @param scale - The uniform scale on the right-hand side.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByUniformScale(matrix: Matrix4, scale: number, result: Matrix4): Matrix4;
/**
* Computes the product of a matrix and a column vector.
* @param matrix - The matrix.
* @param cartesian - The vector.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByVector(matrix: Matrix4, cartesian: Cartesian4, result: Cartesian4): Cartesian4;
/**
* Computes the product of a matrix and a {@link Cartesian3}. This is equivalent to calling {@link Matrix4.multiplyByVector}
* with a {@link Cartesian4} with a w
component of zero.
* @example
* const p = new SuperMap.Cartesian3(1.0, 2.0, 3.0);
* const result = SuperMap.Matrix4.multiplyByPointAsVector(matrix, p, new SuperMap.Cartesian3());
* // A shortcut for
* // Cartesian3 p = ...
* // SuperMap.Matrix4.multiplyByVector(matrix, new SuperMap.Cartesian4(p.x, p.y, p.z, 0.0), result);
* @param matrix - The matrix.
* @param cartesian - The point.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByPointAsVector(matrix: Matrix4, cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the product of a matrix and a {@link Cartesian3}. This is equivalent to calling {@link Matrix4.multiplyByVector}
* with a {@link Cartesian4} with a w
component of 1, but returns a {@link Cartesian3} instead of a {@link Cartesian4}.
* @example
* const p = new SuperMap.Cartesian3(1.0, 2.0, 3.0);
* const result = SuperMap.Matrix4.multiplyByPoint(matrix, p, new SuperMap.Cartesian3());
* @param matrix - The matrix.
* @param cartesian - The point.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByPoint(matrix: Matrix4, cartesian: Cartesian3, result: Cartesian3): Cartesian3;
/**
* Computes the product of a matrix and a scalar.
* @example
* //create a Matrix4 instance which is a scaled version of the supplied Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* const a = SuperMap.Matrix4.multiplyByScalar(m, -2, new SuperMap.Matrix4());
*
* // m remains the same
* // a = [-20.0, -22.0, -24.0, -26.0]
* // [-28.0, -30.0, -32.0, -34.0]
* // [-36.0, -38.0, -40.0, -42.0]
* // [-44.0, -46.0, -48.0, -50.0]
* @param matrix - The matrix.
* @param scalar - The number to multiply by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(matrix: Matrix4, scalar: number, result: Matrix4): Matrix4;
/**
* Computes a negated copy of the provided matrix.
* @example
* //create a new Matrix4 instance which is a negation of a Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* const a = SuperMap.Matrix4.negate(m, new SuperMap.Matrix4());
*
* // m remains the same
* // a = [-10.0, -11.0, -12.0, -13.0]
* // [-14.0, -15.0, -16.0, -17.0]
* // [-18.0, -19.0, -20.0, -21.0]
* // [-22.0, -23.0, -24.0, -25.0]
* @param matrix - The matrix to negate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the transpose of the provided matrix.
* @example
* //returns transpose of a Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* const a = SuperMap.Matrix4.transpose(m, new SuperMap.Matrix4());
*
* // m remains the same
* // a = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
* @param matrix - The matrix to transpose.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
transpose(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
* @param matrix - The matrix with signed elements.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
abs(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Compares the provided matrices componentwise and returns
* true
if they are equal, false
otherwise.
* @example
* //compares two Matrix4 instances
*
* // a = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* // b = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* if(SuperMap.Matrix4.equals(a,b)) {
* console.log("Both matrices are equal");
* } else {
* console.log("They are not equal");
* }
*
* //Prints "Both matrices are equal" on the console
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Matrix4, right?: Matrix4): boolean;
/**
* Compares the provided matrices componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @example
* //compares two Matrix4 instances
*
* // a = [10.5, 14.5, 18.5, 22.5]
* // [11.5, 15.5, 19.5, 23.5]
* // [12.5, 16.5, 20.5, 24.5]
* // [13.5, 17.5, 21.5, 25.5]
*
* // b = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* if(SuperMap.Matrix4.equalsEpsilon(a,b,0.1)){
* console.log("Difference between both the matrices is less than 0.1");
* } else {
* console.log("Difference between both the matrices is not less than 0.1");
* }
*
* //Prints "Difference between both the matrices is not less than 0.1" on the console
* @param [left] - The first matrix.
* @param [right] - The second matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Matrix4, right?: Matrix4, epsilon?: number): boolean;
/**
* Gets the translation portion of the provided matrix, assuming the matrix is an affine transformation matrix.
* @param matrix - The matrix to use.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getTranslation(matrix: Matrix4, result: Cartesian3): Cartesian3;
/**
* Gets the upper left 3x3 matrix of the provided matrix.
* @example
* // returns a Matrix3 instance from a Matrix4 instance
*
* // m = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* const b = new SuperMap.Matrix3();
* SuperMap.Matrix4.getMatrix3(m,b);
*
* // b = [10.0, 14.0, 18.0]
* // [11.0, 15.0, 19.0]
* // [12.0, 16.0, 20.0]
* @param matrix - The matrix to use.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
getMatrix3(matrix: Matrix4, result: Matrix3): Matrix3;
/**
* Computes the inverse of the provided matrix using Cramers Rule.
* If the determinant is zero, the matrix can not be inverted, and an exception is thrown.
* If the matrix is a proper rigid transformation, it is more efficient
* to invert it with {@link Matrix4.inverseTransformation}.
* @param matrix - The matrix to invert.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverse(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the inverse of the provided matrix assuming it is a proper rigid matrix,
* where the upper left 3x3 elements are a rotation matrix,
* and the upper three elements in the fourth column are the translation.
* The bottom row is assumed to be [0, 0, 0, 1].
* The matrix is not verified to be in the proper form.
* This method is faster than computing the inverse for a general 4x4
* matrix using {@link Matrix4.inverse}.
* @param matrix - The matrix to invert.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverseTransformation(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* Computes the inverse transpose of a matrix.
* @param matrix - The matrix to transpose and invert.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverseTranspose(matrix: Matrix4, result: Matrix4): Matrix4;
/**
* An immutable Matrix4 instance initialized to the identity matrix.
*/
readonly IDENTITY: Matrix4;
/**
* An immutable Matrix4 instance initialized to the zero matrix.
*/
readonly ZERO: Matrix4;
/**
* The index into Matrix4 for column 0, row 0.
*/
readonly COLUMN0ROW0: number;
/**
* The index into Matrix4 for column 0, row 1.
*/
readonly COLUMN0ROW1: number;
/**
* The index into Matrix4 for column 0, row 2.
*/
readonly COLUMN0ROW2: number;
/**
* The index into Matrix4 for column 0, row 3.
*/
readonly COLUMN0ROW3: number;
/**
* The index into Matrix4 for column 1, row 0.
*/
readonly COLUMN1ROW0: number;
/**
* The index into Matrix4 for column 1, row 1.
*/
readonly COLUMN1ROW1: number;
/**
* The index into Matrix4 for column 1, row 2.
*/
readonly COLUMN1ROW2: number;
/**
* The index into Matrix4 for column 1, row 3.
*/
readonly COLUMN1ROW3: number;
/**
* The index into Matrix4 for column 2, row 0.
*/
readonly COLUMN2ROW0: number;
/**
* The index into Matrix4 for column 2, row 1.
*/
readonly COLUMN2ROW1: number;
/**
* The index into Matrix4 for column 2, row 2.
*/
readonly COLUMN2ROW2: number;
/**
* The index into Matrix4 for column 2, row 3.
*/
readonly COLUMN2ROW3: number;
/**
* The index into Matrix4 for column 3, row 0.
*/
readonly COLUMN3ROW0: number;
/**
* The index into Matrix4 for column 3, row 1.
*/
readonly COLUMN3ROW1: number;
/**
* The index into Matrix4 for column 3, row 2.
*/
readonly COLUMN3ROW2: number;
/**
* The index into Matrix4 for column 3, row 3.
*/
readonly COLUMN3ROW3: number;
/**
* Gets the number of items in the collection.
*/
length: number;
/**
* Duplicates the provided Matrix4 instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Matrix4 instance if one was not provided.
*/
clone(result?: Matrix4): Matrix4;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side matrix.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: Matrix4): boolean;
/**
* Compares this matrix to the provided matrix componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [right] - The right hand side matrix.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if they are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Matrix4, epsilon?: number): boolean;
/**
* Computes a string representing this Matrix with each row being
* on a separate line and in the format '(column0, column1, column2, column3)'.
* @returns A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2, column3)'.
*/
toString(): string;
}
/**
* Represents a scalar value's lower and upper bound at a near distance and far distance in eye space.
* @param [near = 0.0] - The lower bound of the camera range.
* @param [nearValue = 0.0] - The value at the lower bound of the camera range.
* @param [far = 1.0] - The upper bound of the camera range.
* @param [farValue = 0.0] - The value at the upper bound of the camera range.
*/
export class NearFarScalar {
constructor(near?: number, nearValue?: number, far?: number, farValue?: number);
/**
* The lower bound of the camera range.
*/
near: number;
/**
* The value at the lower bound of the camera range.
*/
nearValue: number;
/**
* The upper bound of the camera range.
*/
far: number;
/**
* The value at the upper bound of the camera range.
*/
farValue: number;
/**
* Duplicates a NearFarScalar instance.
* @param nearFarScalar - The NearFarScalar to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new NearFarScalar instance if one was not provided. (Returns undefined if nearFarScalar is undefined)
*/
clone(nearFarScalar: NearFarScalar, result?: NearFarScalar): NearFarScalar;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: NearFarScalar, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new NearFarScalar instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: NearFarScalar): NearFarScalar;
/**
* Compares the provided NearFarScalar and returns true
if they are equal,
* false
otherwise.
* @param [left] - The first NearFarScalar.
* @param [right] - The second NearFarScalar.
* @returns true
if left and right are equal; otherwise false
.
*/
equals(left?: NearFarScalar, right?: NearFarScalar): boolean;
/**
* Duplicates this instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new NearFarScalar instance if one was not provided.
*/
clone(result?: NearFarScalar): NearFarScalar;
/**
* Compares this instance to the provided NearFarScalar and returns true
if they are equal,
* false
otherwise.
* @param [right] - The right hand side NearFarScalar.
* @returns true
if left and right are equal; otherwise false
.
*/
equals(right?: NearFarScalar): boolean;
}
/**
* Creates an Occluder derived from an object's position and radius, as well as the camera position.
* The occluder can be used to determine whether or not other objects are visible or hidden behind the
* visible horizon defined by the occluder and camera position.
* @example
* // Construct an occluder one unit away from the origin with a radius of one.
* const cameraPosition = SuperMap.Cartesian3.ZERO;
* const occluderBoundingSphere = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -1), 1);
* const occluder = new SuperMap.Occluder(occluderBoundingSphere, cameraPosition);
* @param occluderBoundingSphere - The bounding sphere surrounding the occluder.
* @param cameraPosition - The coordinate of the viewer/camera.
*/
export class Occluder {
constructor(occluderBoundingSphere: BoundingSphere, cameraPosition: Cartesian3);
/**
* The position of the occluder.
*/
position: Cartesian3;
/**
* The radius of the occluder.
*/
radius: number;
/**
* The position of the camera.
*/
cameraPosition: Cartesian3;
/**
* Creates an occluder from a bounding sphere and the camera position.
* @param occluderBoundingSphere - The bounding sphere surrounding the occluder.
* @param cameraPosition - The coordinate of the viewer/camera.
* @param [result] - The object onto which to store the result.
* @returns The occluder derived from an object's position and radius, as well as the camera position.
*/
fromBoundingSphere(occluderBoundingSphere: BoundingSphere, cameraPosition: Cartesian3, result?: Occluder): Occluder;
/**
* Determines whether or not a point, the occludee
, is hidden from view by the occluder.
* @example
* const cameraPosition = new SuperMap.Cartesian3(0, 0, 0);
* const littleSphere = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -1), 0.25);
* const occluder = new SuperMap.Occluder(littleSphere, cameraPosition);
* const point = new SuperMap.Cartesian3(0, 0, -3);
* occluder.isPointVisible(point); //returns true
* @param occludee - The point surrounding the occludee object.
* @returns true
if the occludee is visible; otherwise false
.
*/
isPointVisible(occludee: Cartesian3): boolean;
/**
* Determines whether or not a sphere, the occludee
, is hidden from view by the occluder.
* @example
* const cameraPosition = new SuperMap.Cartesian3(0, 0, 0);
* const littleSphere = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -1), 0.25);
* const occluder = new SuperMap.Occluder(littleSphere, cameraPosition);
* const bigSphere = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -3), 1);
* occluder.isBoundingSphereVisible(bigSphere); //returns true
* @param occludee - The bounding sphere surrounding the occludee object.
* @returns true
if the occludee is visible; otherwise false
.
*/
isBoundingSphereVisible(occludee: BoundingSphere): boolean;
/**
* Determine to what extent an occludee is visible (not visible, partially visible, or fully visible).
* @example
* const sphere1 = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -1.5), 0.5);
* const sphere2 = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -2.5), 0.5);
* const cameraPosition = new SuperMap.Cartesian3(0, 0, 0);
* const occluder = new SuperMap.Occluder(sphere1, cameraPosition);
* occluder.computeVisibility(sphere2); //returns Visibility.NONE
* @param occludeeBS - The bounding sphere of the occludee.
* @returns Visibility.NONE if the occludee is not visible,
* Visibility.PARTIAL if the occludee is partially visible, or
* Visibility.FULL if the occludee is fully visible.
*/
computeVisibility(occludeeBS: BoundingSphere): Visibility;
/**
* Computes a point that can be used as the occludee position to the visibility functions.
* Use a radius of zero for the occludee radius. Typically, a user computes a bounding sphere around
* an object that is used for visibility; however it is also possible to compute a point that if
* seen/not seen would also indicate if an object is visible/not visible. This function is better
* called for objects that do not move relative to the occluder and is large, such as a chunk of
* terrain. You are better off not calling this and using the object's bounding sphere for objects
* such as a satellite or ground vehicle.
* @example
* const cameraPosition = new SuperMap.Cartesian3(0, 0, 0);
* const occluderBoundingSphere = new SuperMap.BoundingSphere(new SuperMap.Cartesian3(0, 0, -8), 2);
* const occluder = new SuperMap.Occluder(occluderBoundingSphere, cameraPosition);
* const positions = [new SuperMap.Cartesian3(-0.25, 0, -5.3), new SuperMap.Cartesian3(0.25, 0, -5.3)];
* const tileOccluderSphere = SuperMap.BoundingSphere.fromPoints(positions);
* const occludeePosition = tileOccluderSphere.center;
* const occludeePt = SuperMap.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);
* @param occluderBoundingSphere - The bounding sphere surrounding the occluder.
* @param occludeePosition - The point where the occludee (bounding sphere of radius 0) is located.
* @param positions - List of altitude points on the horizon near the surface of the occluder.
* @returns An object containing two attributes: occludeePoint
and valid
* which is a boolean value.
*/
computeOccludeePoint(occluderBoundingSphere: BoundingSphere, occludeePosition: Cartesian3, positions: Cartesian3[]): any;
/**
* Computes a point that can be used as the occludee position to the visibility functions from a rectangle.
* @param rectangle - The rectangle used to create a bounding sphere.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid used to determine positions of the rectangle.
* @returns An object containing two attributes: occludeePoint
and valid
* which is a boolean value.
*/
computeOccludeePointFromRectangle(rectangle: Rectangle, ellipsoid?: Ellipsoid): any;
}
/**
* Provides geocoding via a {@link https://opencagedata.com/|OpenCage} server.
* @example
* // Configure a Viewer to use the OpenCage Geocoder
* const viewer = new SuperMap.Viewer('CesiumContainer', {
* geocoder: new SuperMap.OpenCageGeocoderService('https://api.opencagedata.com/geocode/v1/', '')
* });
* @param url - The endpoint to the OpenCage server.
* @param apiKey - The OpenCage API Key.
* @param [params] - An object with the following properties (See https://opencagedata.com/api#forward-opt):
* @param [params.abbrv] - When set to 1 we attempt to abbreviate and shorten the formatted string we return.
* @param [options.add_request] - When set to 1 the various request parameters are added to the response for ease of debugging.
* @param [options.bounds] - Provides the geocoder with a hint to the region that the query resides in.
* @param [options.countrycode] - Restricts the results to the specified country or countries (as defined by the ISO 3166-1 Alpha 2 standard).
* @param [options.jsonp] - Wraps the returned JSON with a function name.
* @param [options.language] - An IETF format language code.
* @param [options.limit] - The maximum number of results we should return.
* @param [options.min_confidence] - An integer from 1-10. Only results with at least this confidence will be returned.
* @param [options.no_annotations] - When set to 1 results will not contain annotations.
* @param [options.no_dedupe] - When set to 1 results will not be deduplicated.
* @param [options.no_record] - When set to 1 the query contents are not logged.
* @param [options.pretty] - When set to 1 results are 'pretty' printed for easier reading. Useful for debugging.
* @param [options.proximity] - Provides the geocoder with a hint to bias results in favour of those closer to the specified location (For example: 41.40139,2.12870).
*/
export class OpenCageGeocoderService {
constructor(url: Resource | string, apiKey: string, params?: {
abbrv?: number;
});
/**
* The Resource used to access the OpenCage endpoint.
*/
readonly url: Resource;
/**
* Optional params passed to OpenCage in order to customize geocoding
*/
readonly params: any;
/**
* @param query - The query to be sent to the geocoder service
*/
geocode(query: string): Promise;
}
/**
* Creates an instance of an OrientedBoundingBox.
* An OrientedBoundingBox of some object is a closed and convex cuboid. It can provide a tighter bounding volume than {@link BoundingSphere} or {@link AxisAlignedBoundingBox} in many cases.
* @example
* // Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
* const center = new SuperMap.Cartesian3(1.0, 0.0, 0.0);
* const halfAxes = SuperMap.Matrix3.fromScale(new SuperMap.Cartesian3(1.0, 3.0, 2.0), new SuperMap.Matrix3());
*
* const obb = new SuperMap.OrientedBoundingBox(center, halfAxes);
* @param [center = Cartesian3.ZERO] - The center of the box.
* @param [halfAxes = Matrix3.ZERO] - The three orthogonal half-axes of the bounding box.
* Equivalently, the transformation matrix, to rotate and scale a 0x0x0
* cube centered at the origin.
*/
export class OrientedBoundingBox {
constructor(center?: Cartesian3, halfAxes?: Matrix3);
/**
* The center of the box.
*/
center: Cartesian3;
/**
* The transformation matrix, to rotate the box to the right position.
*/
halfAxes: Matrix3;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: OrientedBoundingBox, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Computes an instance of an OrientedBoundingBox of the given positions.
* This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).
* Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf
* @example
* // Compute an object oriented bounding box enclosing two points.
* const box = SuperMap.OrientedBoundingBox.fromPoints([new SuperMap.Cartesian3(2, 0, 0), new SuperMap.Cartesian3(-2, 0, 0)]);
* @param [positions] - List of {@link Cartesian3} points that the bounding box will enclose.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if one was not provided.
*/
fromPoints(positions?: Cartesian3[], result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Computes an OrientedBoundingBox that bounds a {@link Rectangle} on the surface of an {@link Ellipsoid}.
* There are no guarantees about the orientation of the bounding box.
* @param rectangle - The cartographic rectangle on the surface of the ellipsoid.
* @param [minimumHeight = 0.0] - The minimum height (elevation) within the tile.
* @param [maximumHeight = 0.0] - The maximum height (elevation) within the tile.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rectangle is defined.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if none was provided.
*/
fromRectangle(rectangle: Rectangle, minimumHeight?: number, maximumHeight?: number, ellipsoid?: Ellipsoid, result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Computes an OrientedBoundingBox that bounds an affine transformation.
* @param transformation - The affine transformation.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if none was provided.
*/
fromTransformation(transformation: Matrix4, result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Duplicates a OrientedBoundingBox instance.
* @param box - The bounding box to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined)
*/
clone(box: OrientedBoundingBox, result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Determines which side of a plane the oriented bounding box is located.
* @param box - The oriented bounding box to test.
* @param plane - The plane to test against.
* @returns {@link Intersect.INSIDE} if the entire box is on the side of the plane
* the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is
* on the opposite side, and {@link Intersect.INTERSECTING} if the box
* intersects the plane.
*/
intersectPlane(box: OrientedBoundingBox, plane: Plane): Intersect;
/**
* Computes the estimated distance squared from the closest point on a bounding box to a point.
* @example
* // Sort bounding boxes from back to front
* boxes.sort(function(a, b) {
* return SuperMap.OrientedBoundingBox.distanceSquaredTo(b, camera.positionWC) - SuperMap.OrientedBoundingBox.distanceSquaredTo(a, camera.positionWC);
* });
* @param box - The box.
* @param cartesian - The point
* @returns The distance squared from the oriented bounding box to the point. Returns 0 if the point is inside the box.
*/
distanceSquaredTo(box: OrientedBoundingBox, cartesian: Cartesian3): number;
/**
* The distances calculated by the vector from the center of the bounding box to position projected onto direction.
*
* If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
* closest and farthest planes from position that intersect the bounding box.
* @param box - The bounding box to calculate the distance to.
* @param position - The position to calculate the distance from.
* @param direction - The direction from position.
* @param [result] - A Interval to store the nearest and farthest distances.
* @returns The nearest and farthest distances on the bounding box from position in direction.
*/
computePlaneDistances(box: OrientedBoundingBox, position: Cartesian3, direction: Cartesian3, result?: Interval): Interval;
/**
* Computes the eight corners of an oriented bounding box. The corners are ordered by (-X, -Y, -Z), (-X, -Y, +Z), (-X, +Y, -Z), (-X, +Y, +Z), (+X, -Y, -Z), (+X, -Y, +Z), (+X, +Y, -Z), (+X, +Y, +Z).
* @param box - The oriented bounding box.
* @param [result] - An array of eight {@link Cartesian3} instances onto which to store the corners.
* @returns The modified result parameter or a new array if none was provided.
*/
computeCorners(box: OrientedBoundingBox, result?: Cartesian3[]): Cartesian3[];
/**
* Computes a transformation matrix from an oriented bounding box.
* @param box - The oriented bounding box.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new {@link Matrix4} instance if none was provided.
*/
computeTransformation(box: OrientedBoundingBox, result: Matrix4): Matrix4;
/**
* Determines whether or not a bounding box is hidden from view by the occluder.
* @param box - The bounding box surrounding the occludee object.
* @param occluder - The occluder.
* @returns true
if the box is not visible; otherwise false
.
*/
isOccluded(box: OrientedBoundingBox, occluder: Occluder): boolean;
/**
* Determines which side of a plane the oriented bounding box is located.
* @param plane - The plane to test against.
* @returns {@link Intersect.INSIDE} if the entire box is on the side of the plane
* the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is
* on the opposite side, and {@link Intersect.INTERSECTING} if the box
* intersects the plane.
*/
intersectPlane(plane: Plane): Intersect;
/**
* Computes the estimated distance squared from the closest point on a bounding box to a point.
* @example
* // Sort bounding boxes from back to front
* boxes.sort(function(a, b) {
* return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
* });
* @param cartesian - The point
* @returns The estimated distance squared from the bounding sphere to the point.
*/
distanceSquaredTo(cartesian: Cartesian3): number;
/**
* The distances calculated by the vector from the center of the bounding box to position projected onto direction.
*
* If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
* closest and farthest planes from position that intersect the bounding box.
* @param position - The position to calculate the distance from.
* @param direction - The direction from position.
* @param [result] - A Interval to store the nearest and farthest distances.
* @returns The nearest and farthest distances on the bounding box from position in direction.
*/
computePlaneDistances(position: Cartesian3, direction: Cartesian3, result?: Interval): Interval;
/**
* Computes the eight corners of an oriented bounding box. The corners are ordered by (-X, -Y, -Z), (-X, -Y, +Z), (-X, +Y, -Z), (-X, +Y, +Z), (+X, -Y, -Z), (+X, -Y, +Z), (+X, +Y, -Z), (+X, +Y, +Z).
* @param [result] - An array of eight {@link Cartesian3} instances onto which to store the corners.
* @returns The modified result parameter or a new array if none was provided.
*/
computeCorners(result?: Cartesian3[]): Cartesian3[];
/**
* Computes a transformation matrix from an oriented bounding box.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new {@link Matrix4} instance if none was provided.
*/
computeTransformation(result: Matrix4): Matrix4;
/**
* Determines whether or not a bounding box is hidden from view by the occluder.
* @param occluder - The occluder.
* @returns true
if the sphere is not visible; otherwise false
.
*/
isOccluded(occluder: Occluder): boolean;
/**
* Compares the provided OrientedBoundingBox componentwise and returns
* true
if they are equal, false
otherwise.
* @param left - The first OrientedBoundingBox.
* @param right - The second OrientedBoundingBox.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left: OrientedBoundingBox, right: OrientedBoundingBox): boolean;
/**
* Duplicates this OrientedBoundingBox instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrientedBoundingBox instance if one was not provided.
*/
clone(result?: OrientedBoundingBox): OrientedBoundingBox;
/**
* Compares this OrientedBoundingBox against the provided OrientedBoundingBox componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side OrientedBoundingBox.
* @returns true
if they are equal, false
otherwise.
*/
equals(right?: OrientedBoundingBox): boolean;
}
/**
* The viewing frustum is defined by 6 planes.
* Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin/camera position.
* @example
* const maxRadii = ellipsoid.maximumRadius;
*
* const frustum = new SuperMap.OrthographicFrustum();
* frustum.near = 0.01 * maxRadii;
* frustum.far = 50.0 * maxRadii;
* @param [options] - An object with the following properties:
* @param [options.width] - The width of the frustum in meters.
* @param [options.aspectRatio] - The aspect ratio of the frustum's width to it's height.
* @param [options.near = 1.0] - The distance of the near plane.
* @param [options.far = 500000000.0] - The distance of the far plane.
*/
export class OrthographicFrustum {
constructor(options?: {
width?: number;
aspectRatio?: number;
near?: number;
far?: number;
});
/**
* The horizontal width of the frustum in meters.
*/
width: number;
/**
* The aspect ratio of the frustum's width to it's height.
*/
aspectRatio: number;
/**
* The distance of the near plane.
*/
near: number;
/**
* The distance of the far plane.
*/
far: number;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: OrthographicFrustum, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new OrthographicFrustum instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: OrthographicFrustum): OrthographicFrustum;
/**
* Gets the orthographic projection matrix computed from the view frustum.
*/
readonly projectionMatrix: Matrix4;
/**
* Creates a culling volume for this frustum.
* @example
* // Check if a bounding volume intersects the frustum.
* const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
* const intersect = cullingVolume.computeVisibility(boundingVolume);
* @param position - The eye position.
* @param direction - The view direction.
* @param up - The up direction.
* @returns A culling volume at the given position and orientation.
*/
computeCullingVolume(position: Cartesian3, direction: Cartesian3, up: Cartesian3): CullingVolume;
/**
* Returns the pixel's width and height in meters.
* @example
* // Example 1
* // Get the width and height of a pixel.
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new SuperMap.Cartesian2());
* @param drawingBufferWidth - The width of the drawing buffer.
* @param drawingBufferHeight - The height of the drawing buffer.
* @param distance - The distance to the near plane in meters.
* @param pixelRatio - The scaling factor from pixel space to coordinate space.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
*/
getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, pixelRatio: number, result: Cartesian2): Cartesian2;
/**
* Returns a duplicate of a OrthographicFrustum instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrthographicFrustum instance if one was not provided.
*/
clone(result?: OrthographicFrustum): OrthographicFrustum;
/**
* Compares the provided OrthographicFrustum componentwise and returns
* true
if they are equal, false
otherwise.
* @param [other] - The right hand side OrthographicFrustum.
* @returns true
if they are equal, false
otherwise.
*/
equals(other?: OrthographicFrustum): boolean;
/**
* Compares the provided OrthographicFrustum componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param other - The right hand side OrthographicFrustum.
* @param relativeEpsilon - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if this and other are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(other: OrthographicFrustum, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
}
/**
* The viewing frustum is defined by 6 planes.
* Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin/camera position.
* @example
* const maxRadii = ellipsoid.maximumRadius;
*
* const frustum = new SuperMap.OrthographicOffCenterFrustum();
* frustum.right = maxRadii * SuperMap.Math.PI;
* frustum.left = -c.frustum.right;
* frustum.top = c.frustum.right * (canvas.clientHeight / canvas.clientWidth);
* frustum.bottom = -c.frustum.top;
* frustum.near = 0.01 * maxRadii;
* frustum.far = 50.0 * maxRadii;
* @param [options] - An object with the following properties:
* @param [options.left] - The left clipping plane distance.
* @param [options.right] - The right clipping plane distance.
* @param [options.top] - The top clipping plane distance.
* @param [options.bottom] - The bottom clipping plane distance.
* @param [options.near = 1.0] - The near clipping plane distance.
* @param [options.far = 500000000.0] - The far clipping plane distance.
*/
export class OrthographicOffCenterFrustum {
constructor(options?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
near?: number;
far?: number;
});
/**
* The left clipping plane.
*/
left: number;
/**
* The right clipping plane.
*/
right: number;
/**
* The top clipping plane.
*/
top: number;
/**
* The bottom clipping plane.
*/
bottom: number;
/**
* The distance of the near plane.
*/
near: number;
/**
* The distance of the far plane.
*/
far: number;
/**
* Gets the orthographic projection matrix computed from the view frustum.
*/
readonly projectionMatrix: Matrix4;
/**
* Creates a culling volume for this frustum.
* @example
* // Check if a bounding volume intersects the frustum.
* const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
* const intersect = cullingVolume.computeVisibility(boundingVolume);
* @param position - The eye position.
* @param direction - The view direction.
* @param up - The up direction.
* @returns A culling volume at the given position and orientation.
*/
computeCullingVolume(position: Cartesian3, direction: Cartesian3, up: Cartesian3): CullingVolume;
/**
* Returns the pixel's width and height in meters.
* @example
* // Example 1
* // Get the width and height of a pixel.
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new SuperMap.Cartesian2());
* @param drawingBufferWidth - The width of the drawing buffer.
* @param drawingBufferHeight - The height of the drawing buffer.
* @param distance - The distance to the near plane in meters.
* @param pixelRatio - The scaling factor from pixel space to coordinate space.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
*/
getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, pixelRatio: number, result: Cartesian2): Cartesian2;
/**
* Returns a duplicate of a OrthographicOffCenterFrustum instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new OrthographicOffCenterFrustum instance if one was not provided.
*/
clone(result?: OrthographicOffCenterFrustum): OrthographicOffCenterFrustum;
/**
* Compares the provided OrthographicOffCenterFrustum componentwise and returns
* true
if they are equal, false
otherwise.
* @param [other] - The right hand side OrthographicOffCenterFrustum.
* @returns true
if they are equal, false
otherwise.
*/
equals(other?: OrthographicOffCenterFrustum): boolean;
/**
* Compares the provided OrthographicOffCenterFrustum componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param other - The right hand side OrthographicOffCenterFrustum.
* @param relativeEpsilon - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if this and other are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(other: OrthographicOffCenterFrustum, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
}
export namespace Packable {
/**
* The number of elements used to pack the object into an array.
*/
var packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
*/
function pack(value: any, array: number[], startingIndex?: number): void;
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Object instance if one was not provided.
*/
function unpack(array: number[], startingIndex?: number, result?: any): any;
}
/**
* Static interface for types which can store their values as packed
* elements in an array. These methods and properties are expected to be
* defined on a constructor function.
*/
export interface Packable {
}
/**
* Static interface for {@link Packable} types which are interpolated in a
* different representation than their packed value. These methods and
* properties are expected to be defined on a constructor function.
*/
export namespace PackableForInterpolation {
/**
* The number of elements used to store the object into an array in its interpolatable form.
*/
var packedInterpolationLength: number;
/**
* Converts a packed array into a form suitable for interpolation.
* @param packedArray - The packed array.
* @param [startingIndex = 0] - The index of the first element to be converted.
* @param [lastIndex = packedArray.length] - The index of the last element to be converted.
* @param [result] - The object into which to store the result.
*/
function convertPackedArrayForInterpolation(packedArray: number[], startingIndex?: number, lastIndex?: number, result?: number[]): void;
/**
* Retrieves an instance from a packed array converted with {@link PackableForInterpolation.convertPackedArrayForInterpolation}.
* @param array - The array previously packed for interpolation.
* @param sourceArray - The original packed array.
* @param [startingIndex = 0] - The startingIndex used to convert the array.
* @param [lastIndex = packedArray.length] - The lastIndex used to convert the array.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Object instance if one was not provided.
*/
function unpackInterpolationResult(array: number[], sourceArray: number[], startingIndex?: number, lastIndex?: number, result?: any): any;
}
/**
* Provides geocoding via a {@link https://pelias.io/|Pelias} server.
* @example
* // Configure a Viewer to use the Pelias server hosted by https://geocode.earth/
* const viewer = new SuperMap.Viewer('CesiumContainer', {
* geocoder: new SuperMap.PeliasGeocoderService(new SuperMap.Resource({
* url: 'https://api.geocode.earth/v1/',
* queryParameters: {
* api_key: ''
* }
* }))
* });
* @param url - The endpoint to the Pelias server.
*/
export class PeliasGeocoderService {
constructor(url: Resource | string);
/**
* The Resource used to access the Pelias endpoint.
*/
readonly url: Resource;
/**
* @param query - The query to be sent to the geocoder service
* @param [type = GeocodeType.SEARCH] - The type of geocode to perform.
*/
geocode(query: string, type?: GeocodeType): Promise;
}
/**
* The viewing frustum is defined by 6 planes.
* Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin/camera position.
* @example
* const frustum = new SuperMap.PerspectiveFrustum({
* fov : SuperMap.Math.PI_OVER_THREE,
* aspectRatio : canvas.clientWidth / canvas.clientHeight
* near : 1.0,
* far : 1000.0
* });
* @param [options] - An object with the following properties:
* @param [options.fov] - The angle of the field of view (FOV), in radians.
* @param [options.aspectRatio] - The aspect ratio of the frustum's width to it's height.
* @param [options.near = 1.0] - The distance of the near plane.
* @param [options.far = 500000000.0] - The distance of the far plane.
* @param [options.xOffset = 0.0] - The offset in the x direction.
* @param [options.yOffset = 0.0] - The offset in the y direction.
*/
export class PerspectiveFrustum {
constructor(options?: {
fov?: number;
aspectRatio?: number;
near?: number;
far?: number;
xOffset?: number;
yOffset?: number;
});
/**
* The angle of the field of view (FOV), in radians. This angle will be used
* as the horizontal FOV if the width is greater than the height, otherwise
* it will be the vertical FOV.
*/
fov: number;
/**
* The aspect ratio of the frustum's width to it's height.
*/
aspectRatio: number;
/**
* The distance of the near plane.
*/
near: number;
/**
* The distance of the far plane.
*/
far: number;
/**
* Offsets the frustum in the x direction.
*/
xOffset: number;
/**
* Offsets the frustum in the y direction.
*/
yOffset: number;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PerspectiveFrustum, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PerspectiveFrustum): PerspectiveFrustum;
/**
* Gets the perspective projection matrix computed from the view frustum.
*/
readonly projectionMatrix: Matrix4;
/**
* The perspective projection matrix computed from the view frustum with an infinite far plane.
*/
readonly infiniteProjectionMatrix: Matrix4;
/**
* Gets the angle of the vertical field of view, in radians.
*/
readonly fovy: number;
/**
* Creates a culling volume for this frustum.
* @example
* // Check if a bounding volume intersects the frustum.
* const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
* const intersect = cullingVolume.computeVisibility(boundingVolume);
* @param position - The eye position.
* @param direction - The view direction.
* @param up - The up direction.
* @returns A culling volume at the given position and orientation.
*/
computeCullingVolume(position: Cartesian3, direction: Cartesian3, up: Cartesian3): CullingVolume;
/**
* Returns the pixel's width and height in meters.
* @example
* // Example 1
* // Get the width and height of a pixel.
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new SuperMap.Cartesian2());
* @example
* // Example 2
* // Get the width and height of a pixel if the near plane was set to 'distance'.
* // For example, get the size of a pixel of an image on a billboard.
* const position = camera.position;
* const direction = camera.direction;
* const toCenter = SuperMap.Cartesian3.subtract(primitive.boundingVolume.center, position, new SuperMap.Cartesian3()); // vector from camera to a primitive
* const toCenterProj = SuperMap.Cartesian3.multiplyByScalar(direction, SuperMap.Cartesian3.dot(direction, toCenter), new SuperMap.Cartesian3()); // project vector onto camera direction vector
* const distance = SuperMap.Cartesian3.magnitude(toCenterProj);
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new SuperMap.Cartesian2());
* @param drawingBufferWidth - The width of the drawing buffer.
* @param drawingBufferHeight - The height of the drawing buffer.
* @param distance - The distance to the near plane in meters.
* @param pixelRatio - The scaling factor from pixel space to coordinate space.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
*/
getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, pixelRatio: number, result: Cartesian2): Cartesian2;
/**
* Returns a duplicate of a PerspectiveFrustum instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
*/
clone(result?: PerspectiveFrustum): PerspectiveFrustum;
/**
* Compares the provided PerspectiveFrustum componentwise and returns
* true
if they are equal, false
otherwise.
* @param [other] - The right hand side PerspectiveFrustum.
* @returns true
if they are equal, false
otherwise.
*/
equals(other?: PerspectiveFrustum): boolean;
/**
* Compares the provided PerspectiveFrustum componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param other - The right hand side PerspectiveFrustum.
* @param relativeEpsilon - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if this and other are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(other: PerspectiveFrustum, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
}
/**
* The viewing frustum is defined by 6 planes.
* Each plane is represented by a {@link Cartesian4} object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin/camera position.
* @example
* const frustum = new SuperMap.PerspectiveOffCenterFrustum({
* left : -1.0,
* right : 1.0,
* top : 1.0,
* bottom : -1.0,
* near : 1.0,
* far : 100.0
* });
* @param [options] - An object with the following properties:
* @param [options.left] - The left clipping plane distance.
* @param [options.right] - The right clipping plane distance.
* @param [options.top] - The top clipping plane distance.
* @param [options.bottom] - The bottom clipping plane distance.
* @param [options.near = 1.0] - The near clipping plane distance.
* @param [options.far = 500000000.0] - The far clipping plane distance.
*/
export class PerspectiveOffCenterFrustum {
constructor(options?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
near?: number;
far?: number;
});
/**
* Defines the left clipping plane.
*/
left: number;
/**
* Defines the right clipping plane.
*/
right: number;
/**
* Defines the top clipping plane.
*/
top: number;
/**
* Defines the bottom clipping plane.
*/
bottom: number;
/**
* The distance of the near plane.
*/
near: number;
/**
* The distance of the far plane.
*/
far: number;
/**
* Gets the perspective projection matrix computed from the view frustum.
*/
readonly projectionMatrix: Matrix4;
/**
* Gets the perspective projection matrix computed from the view frustum with an infinite far plane.
*/
readonly infiniteProjectionMatrix: Matrix4;
/**
* Creates a culling volume for this frustum.
* @example
* // Check if a bounding volume intersects the frustum.
* const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
* const intersect = cullingVolume.computeVisibility(boundingVolume);
* @param position - The eye position.
* @param direction - The view direction.
* @param up - The up direction.
* @returns A culling volume at the given position and orientation.
*/
computeCullingVolume(position: Cartesian3, direction: Cartesian3, up: Cartesian3): CullingVolume;
/**
* Returns the pixel's width and height in meters.
* @example
* // Example 1
* // Get the width and height of a pixel.
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new SuperMap.Cartesian2());
* @example
* // Example 2
* // Get the width and height of a pixel if the near plane was set to 'distance'.
* // For example, get the size of a pixel of an image on a billboard.
* const position = camera.position;
* const direction = camera.direction;
* const toCenter = SuperMap.Cartesian3.subtract(primitive.boundingVolume.center, position, new SuperMap.Cartesian3()); // vector from camera to a primitive
* const toCenterProj = SuperMap.Cartesian3.multiplyByScalar(direction, SuperMap.Cartesian3.dot(direction, toCenter), new SuperMap.Cartesian3()); // project vector onto camera direction vector
* const distance = SuperMap.Cartesian3.magnitude(toCenterProj);
* const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new SuperMap.Cartesian2());
* @param drawingBufferWidth - The width of the drawing buffer.
* @param drawingBufferHeight - The height of the drawing buffer.
* @param distance - The distance to the near plane in meters.
* @param pixelRatio - The scaling factor from pixel space to coordinate space.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new instance of {@link Cartesian2} with the pixel's width and height in the x and y properties, respectively.
*/
getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, pixelRatio: number, result: Cartesian2): Cartesian2;
/**
* Returns a duplicate of a PerspectiveOffCenterFrustum instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
*/
clone(result?: PerspectiveOffCenterFrustum): PerspectiveOffCenterFrustum;
/**
* Compares the provided PerspectiveOffCenterFrustum componentwise and returns
* true
if they are equal, false
otherwise.
* @param [other] - The right hand side PerspectiveOffCenterFrustum.
* @returns true
if they are equal, false
otherwise.
*/
equals(other?: PerspectiveOffCenterFrustum): boolean;
/**
* Compares the provided PerspectiveOffCenterFrustum componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param other - The right hand side PerspectiveOffCenterFrustum.
* @param relativeEpsilon - The relative epsilon tolerance to use for equality testing.
* @param [absoluteEpsilon = relativeEpsilon] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if this and other are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(other: PerspectiveOffCenterFrustum, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
}
/**
* A utility class for generating custom map pins as canvas elements.
*
*
*
* Example pins generated using both the maki icon set, which ships with SuperMap, and single character text.
*
*/
export class PinBuilder {
constructor();
/**
* Creates an empty pin of the specified color and size.
* @param color - The color of the pin.
* @param size - The size of the pin, in pixels.
* @returns The canvas element that represents the generated pin.
*/
fromColor(color: Color, size: number): HTMLCanvasElement;
/**
* Creates a pin with the specified icon, color, and size.
* @param url - The url of the image to be stamped onto the pin.
* @param color - The color of the pin.
* @param size - The size of the pin, in pixels.
* @returns The canvas element or a Promise to the canvas element that represents the generated pin.
*/
fromUrl(url: Resource | string, color: Color, size: number): HTMLCanvasElement | Promise;
/**
* Creates a pin with the specified {@link https://www.mapbox.com/maki/|maki} icon identifier, color, and size.
* @param id - The id of the maki icon to be stamped onto the pin.
* @param color - The color of the pin.
* @param size - The size of the pin, in pixels.
* @returns The canvas element or a Promise to the canvas element that represents the generated pin.
*/
fromMakiIconId(id: string, color: Color, size: number): HTMLCanvasElement | Promise;
/**
* Creates a pin with the specified text, color, and size. The text will be sized to be as large as possible
* while still being contained completely within the pin.
* @param text - The text to be stamped onto the pin.
* @param color - The color of the pin.
* @param size - The size of the pin, in pixels.
* @returns The canvas element that represents the generated pin.
*/
fromText(text: string, color: Color, size: number): HTMLCanvasElement;
}
/**
* The format of a pixel, i.e., the number of components it has and what they represent.
*/
export enum PixelFormat {
/**
* A pixel format containing a depth value.
*/
DEPTH_COMPONENT = WebGLConstants.DEPTH_COMPONENT,
/**
* A pixel format containing a depth and stencil value, most often used with {@link PixelDatatype.UNSIGNED_INT_24_8}.
*/
DEPTH_STENCIL = WebGLConstants.DEPTH_STENCIL,
/**
* A pixel format containing an alpha channel.
*/
ALPHA = WebGLConstants.ALPHA,
/**
* A pixel format containing red, green, and blue channels.
*/
RGB = WebGLConstants.RGB,
/**
* A pixel format containing red, green, blue, and alpha channels.
*/
RGBA = WebGLConstants.RGBA,
/**
* A pixel format containing a luminance (intensity) channel.
*/
LUMINANCE = WebGLConstants.LUMINANCE,
/**
* A pixel format containing luminance (intensity) and alpha channels.
*/
LUMINANCE_ALPHA = WebGLConstants.LUMINANCE_ALPHA,
/**
* A pixel format containing red, green, and blue channels that is DXT1 compressed.
*/
RGB_DXT1 = WebGLConstants.COMPRESSED_RGB_S3TC_DXT1_EXT,
/**
* A pixel format containing red, green, blue, and alpha channels that is DXT1 compressed.
*/
RGBA_DXT1 = WebGLConstants.COMPRESSED_RGBA_S3TC_DXT1_EXT,
/**
* A pixel format containing red, green, blue, and alpha channels that is DXT3 compressed.
*/
RGBA_DXT3 = WebGLConstants.COMPRESSED_RGBA_S3TC_DXT3_EXT,
/**
* A pixel format containing red, green, blue, and alpha channels that is DXT5 compressed.
*/
RGBA_DXT5 = WebGLConstants.COMPRESSED_RGBA_S3TC_DXT5_EXT,
/**
* A pixel format containing red, green, and blue channels that is PVR 4bpp compressed.
*/
RGB_PVRTC_4BPPV1 = WebGLConstants.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
/**
* A pixel format containing red, green, and blue channels that is PVR 2bpp compressed.
*/
RGB_PVRTC_2BPPV1 = WebGLConstants.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
/**
* A pixel format containing red, green, blue, and alpha channels that is PVR 4bpp compressed.
*/
RGBA_PVRTC_4BPPV1 = WebGLConstants.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
/**
* A pixel format containing red, green, blue, and alpha channels that is PVR 2bpp compressed.
*/
RGBA_PVRTC_2BPPV1 = WebGLConstants.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
/**
* A pixel format containing red, green, blue, and alpha channels that is ASTC compressed.
*/
RGBA_ASTC = WebGLConstants.COMPRESSED_RGBA_ASTC_4x4_WEBGL,
/**
* A pixel format containing red, green, and blue channels that is ETC1 compressed.
*/
RGB_ETC1 = WebGLConstants.COMPRESSED_RGB_ETC1_WEBGL,
/**
* A pixel format containing red, green, and blue channels that is ETC2 compressed.
*/
RGB8_ETC2 = WebGLConstants.COMPRESSED_RGB8_ETC2,
/**
* A pixel format containing red, green, blue, and alpha channels that is ETC2 compressed.
*/
RGBA8_ETC2_EAC = WebGLConstants.COMPRESSED_RGBA8_ETC2_EAC,
/**
* A pixel format containing red, green, blue, and alpha channels that is BC7 compressed.
*/
RGBA_BC7 = WebGLConstants.COMPRESSED_RGBA_BPTC_UNORM
}
/**
* A plane in Hessian Normal Form defined by
*
* ax + by + cz + d = 0
*
* where (a, b, c) is the plane's normal
, d is the signed
* distance
to the plane, and (x, y, z) is any point on
* the plane.
* @example
* // The plane x=0
* const plane = new SuperMap.Plane(SuperMap.Cartesian3.UNIT_X, 0.0);
* @param normal - The plane's normal (normalized).
* @param distance - The shortest distance from the origin to the plane. The sign of
* distance
determines which side of the plane the origin
* is on. If distance
is positive, the origin is in the half-space
* in the direction of the normal; if negative, the origin is in the half-space
* opposite to the normal; if zero, the plane passes through the origin.
*/
export class Plane {
constructor(normal: Cartesian3, distance: number);
/**
* The plane's normal.
*/
normal: Cartesian3;
/**
* The shortest distance from the origin to the plane. The sign of
* distance
determines which side of the plane the origin
* is on. If distance
is positive, the origin is in the half-space
* in the direction of the normal; if negative, the origin is in the half-space
* opposite to the normal; if zero, the plane passes through the origin.
*/
distance: number;
/**
* Creates a plane from a normal and a point on the plane.
* @example
* const point = SuperMap.Cartesian3.fromDegrees(-72.0, 40.0);
* const normal = ellipsoid.geodeticSurfaceNormal(point);
* const tangentPlane = SuperMap.Plane.fromPointNormal(point, normal);
* @param point - The point on the plane.
* @param normal - The plane's normal (normalized).
* @param [result] - The object onto which to store the result.
* @returns A new plane instance or the modified result parameter.
*/
fromPointNormal(point: Cartesian3, normal: Cartesian3, result?: Plane): Plane;
/**
* Creates a plane from the general equation
* @param coefficients - The plane's normal (normalized).
* @param [result] - The object onto which to store the result.
* @returns A new plane instance or the modified result parameter.
*/
fromCartesian4(coefficients: Cartesian4, result?: Plane): Plane;
/**
* Computes the signed shortest distance of a point to a plane.
* The sign of the distance determines which side of the plane the point
* is on. If the distance is positive, the point is in the half-space
* in the direction of the normal; if negative, the point is in the half-space
* opposite to the normal; if zero, the plane passes through the point.
* @param plane - The plane.
* @param point - The point.
* @returns The signed shortest distance of the point to the plane.
*/
getPointDistance(plane: Plane, point: Cartesian3): number;
/**
* Projects a point onto the plane.
* @param plane - The plane to project the point onto
* @param point - The point to project onto the plane
* @param [result] - The result point. If undefined, a new Cartesian3 will be created.
* @returns The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
projectPointOntoPlane(plane: Plane, point: Cartesian3, result?: Cartesian3): Cartesian3;
/**
* Transforms the plane by the given transformation matrix.
* @param plane - The plane.
* @param transform - The transformation matrix.
* @param [result] - The object into which to store the result.
* @returns The plane transformed by the given transformation matrix.
*/
transform(plane: Plane, transform: Matrix4, result?: Plane): Plane;
/**
* Duplicates a Plane instance.
* @param plane - The plane to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Plane instance if one was not provided.
*/
clone(plane: Plane, result?: Plane): Plane;
/**
* Compares the provided Planes by normal and distance and returns
* true
if they are equal, false
otherwise.
* @param left - The first plane.
* @param right - The second plane.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left: Plane, right: Plane): boolean;
/**
* A constant initialized to the XY plane passing through the origin, with normal in positive Z.
*/
readonly ORIGIN_XY_PLANE: Plane;
/**
* A constant initialized to the YZ plane passing through the origin, with normal in positive X.
*/
readonly ORIGIN_YZ_PLANE: Plane;
/**
* A constant initialized to the ZX plane passing through the origin, with normal in positive Y.
*/
readonly ORIGIN_ZX_PLANE: Plane;
}
/**
* Describes geometry representing a plane centered at the origin, with a unit width and length.
* @example
* const planeGeometry = new SuperMap.PlaneGeometry({
* vertexFormat : SuperMap.VertexFormat.POSITION_ONLY
* });
* @param [options] - Object with the following properties:
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class PlaneGeometry {
constructor(options?: {
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PlaneGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PlaneGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PlaneGeometry): PlaneGeometry;
/**
* Computes the geometric representation of a plane, including its vertices, indices, and a bounding sphere.
* @param planeGeometry - A description of the plane.
* @returns The computed vertices and indices.
*/
createGeometry(planeGeometry: PlaneGeometry): Geometry | undefined;
}
/**
* Describes geometry representing the outline of a plane centered at the origin, with a unit width and length.
*/
export class PlaneOutlineGeometry {
constructor();
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @returns The array that was packed into
*/
pack(value: PlaneOutlineGeometry, array: number[]): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PlaneOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PlaneOutlineGeometry): PlaneOutlineGeometry;
/**
* Computes the geometric representation of an outline of a plane, including its vertices, indices, and a bounding sphere.
* @returns The computed vertices and indices.
*/
createGeometry(): Geometry | undefined;
}
/**
* A description of a polygon on the ellipsoid. The polygon is defined by a polygon hierarchy. Polygon geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
* @example
* // 1. create a polygon from points
* const polygon = new SuperMap.PolygonGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* )
* });
* const geometry = SuperMap.PolygonGeometry.createGeometry(polygon);
*
* // 2. create a nested polygon with holes
* const polygonWithHole = new SuperMap.PolygonGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -109.0, 30.0,
* -95.0, 30.0,
* -95.0, 40.0,
* -109.0, 40.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -107.0, 31.0,
* -107.0, 39.0,
* -97.0, 39.0,
* -97.0, 31.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -105.0, 33.0,
* -99.0, 33.0,
* -99.0, 37.0,
* -105.0, 37.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -103.0, 34.0,
* -101.0, 34.0,
* -101.0, 36.0,
* -103.0, 36.0
* ])
* )]
* )]
* )]
* )
* });
* const geometry = SuperMap.PolygonGeometry.createGeometry(polygonWithHole);
*
* // 3. create extruded polygon
* const extrudedPolygon = new SuperMap.PolygonGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* ),
* extrudedHeight: 300000
* });
* const geometry = SuperMap.PolygonGeometry.createGeometry(extrudedPolygon);
* @param options - Object with the following properties:
* @param options.polygonHierarchy - A polygon hierarchy that can include holes.
* @param [options.height = 0.0] - The distance in meters between the polygon and the ellipsoid surface.
* @param [options.extrudedHeight] - The distance in meters between the polygon's extruded face and the ellipsoid surface.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.perPositionHeight = false] - Use the height of options.positions for each position instead of using options.height to determine the height.
* @param [options.closeTop = true] - When false, leaves off the top of an extruded polygon open.
* @param [options.closeBottom = true] - When false, leaves off the bottom of an extruded polygon open.
* @param [options.arcType = ArcType.GEODESIC] - The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
* @param [options.textureCoordinates] - Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points. Has no effect for ground primitives.
*/
export class PolygonGeometry {
constructor(options: {
polygonHierarchy: PolygonHierarchy;
height?: number;
extrudedHeight?: number;
vertexFormat?: VertexFormat;
stRotation?: number;
ellipsoid?: Ellipsoid;
granularity?: number;
perPositionHeight?: boolean;
closeTop?: boolean;
closeBottom?: boolean;
arcType?: ArcType;
textureCoordinates?: PolygonHierarchy;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* A description of a polygon from an array of positions. Polygon geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
* @example
* // create a polygon from points
* const polygon = SuperMap.PolygonGeometry.fromPositions({
* positions : SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* });
* const geometry = SuperMap.PolygonGeometry.createGeometry(polygon);
* @param options - Object with the following properties:
* @param options.positions - An array of positions that defined the corner points of the polygon.
* @param [options.height = 0.0] - The height of the polygon.
* @param [options.extrudedHeight] - The height of the polygon extrusion.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.perPositionHeight = false] - Use the height of options.positions for each position instead of using options.height to determine the height.
* @param [options.closeTop = true] - When false, leaves off the top of an extruded polygon open.
* @param [options.closeBottom = true] - When false, leaves off the bottom of an extruded polygon open.
* @param [options.arcType = ArcType.GEODESIC] - The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
* @param [options.textureCoordinates] - Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points. Has no effect for ground primitives.
*/
fromPositions(options: {
positions: Cartesian3[];
height?: number;
extrudedHeight?: number;
vertexFormat?: VertexFormat;
stRotation?: number;
ellipsoid?: Ellipsoid;
granularity?: number;
perPositionHeight?: boolean;
closeTop?: boolean;
closeBottom?: boolean;
arcType?: ArcType;
textureCoordinates?: PolygonHierarchy;
}): PolygonGeometry;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PolygonGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
*/
unpack(array: number[], startingIndex?: number, result?: PolygonGeometry): void;
/**
* Returns the bounding rectangle given the provided options
* @param options - Object with the following properties:
* @param options.polygonHierarchy - A polygon hierarchy that can include holes.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions sampled.
* @param [options.arcType = ArcType.GEODESIC] - The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [result] - An object in which to store the result.
* @returns The result rectangle
*/
computeRectangle(options: {
polygonHierarchy: PolygonHierarchy;
granularity?: number;
arcType?: ArcType;
ellipsoid?: Ellipsoid;
}, result?: Rectangle): Rectangle;
/**
* Computes the geometric representation of a polygon, including its vertices, indices, and a bounding sphere.
* @param polygonGeometry - A description of the polygon.
* @returns The computed vertices and indices.
*/
createGeometry(polygonGeometry: PolygonGeometry): Geometry | undefined;
}
/**
* An hierarchy of linear rings which define a polygon and its holes.
* The holes themselves may also have holes which nest inner polygons.
* @param [positions] - A linear ring defining the outer boundary of the polygon or hole.
* @param [holes] - An array of polygon hierarchies defining holes in the polygon.
*/
export class PolygonHierarchy {
constructor(positions?: Cartesian3[], holes?: PolygonHierarchy[]);
/**
* A linear ring defining the outer boundary of the polygon or hole.
*/
positions: Cartesian3[];
/**
* An array of polygon hierarchies defining holes in the polygon.
*/
holes: PolygonHierarchy[];
}
/**
* A description of the outline of a polygon on the ellipsoid. The polygon is defined by a polygon hierarchy.
* @example
* // 1. create a polygon outline from points
* const polygon = new SuperMap.PolygonOutlineGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* )
* });
* const geometry = SuperMap.PolygonOutlineGeometry.createGeometry(polygon);
*
* // 2. create a nested polygon with holes outline
* const polygonWithHole = new SuperMap.PolygonOutlineGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -109.0, 30.0,
* -95.0, 30.0,
* -95.0, 40.0,
* -109.0, 40.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -107.0, 31.0,
* -107.0, 39.0,
* -97.0, 39.0,
* -97.0, 31.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -105.0, 33.0,
* -99.0, 33.0,
* -99.0, 37.0,
* -105.0, 37.0
* ]),
* [new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -103.0, 34.0,
* -101.0, 34.0,
* -101.0, 36.0,
* -103.0, 36.0
* ])
* )]
* )]
* )]
* )
* });
* const geometry = SuperMap.PolygonOutlineGeometry.createGeometry(polygonWithHole);
*
* // 3. create extruded polygon outline
* const extrudedPolygon = new SuperMap.PolygonOutlineGeometry({
* polygonHierarchy : new SuperMap.PolygonHierarchy(
* SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* ),
* extrudedHeight: 300000
* });
* const geometry = SuperMap.PolygonOutlineGeometry.createGeometry(extrudedPolygon);
* @param options - Object with the following properties:
* @param options.polygonHierarchy - A polygon hierarchy that can include holes.
* @param [options.height = 0.0] - The distance in meters between the polygon and the ellipsoid surface.
* @param [options.extrudedHeight] - The distance in meters between the polygon's extruded face and the ellipsoid surface.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.perPositionHeight = false] - Use the height of options.positions for each position instead of using options.height to determine the height.
* @param [options.arcType = ArcType.GEODESIC] - The type of path the outline must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
*/
export class PolygonOutlineGeometry {
constructor(options: {
polygonHierarchy: PolygonHierarchy;
height?: number;
extrudedHeight?: number;
vertexFormat?: VertexFormat;
ellipsoid?: Ellipsoid;
granularity?: number;
perPositionHeight?: boolean;
arcType?: ArcType;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PolygonOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PolygonOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PolygonOutlineGeometry): PolygonOutlineGeometry;
/**
* A description of a polygon outline from an array of positions.
* @example
* // create a polygon from points
* const polygon = SuperMap.PolygonOutlineGeometry.fromPositions({
* positions : SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0,
* -75.0, 30.0,
* -70.0, 30.0,
* -68.0, 40.0
* ])
* });
* const geometry = SuperMap.PolygonOutlineGeometry.createGeometry(polygon);
* @param options - Object with the following properties:
* @param options.positions - An array of positions that defined the corner points of the polygon.
* @param [options.height = 0.0] - The height of the polygon.
* @param [options.extrudedHeight] - The height of the polygon extrusion.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.perPositionHeight = false] - Use the height of options.positions for each position instead of using options.height to determine the height.
* @param [options.arcType = ArcType.GEODESIC] - The type of path the outline must follow. Valid options are {@link LinkType.GEODESIC} and {@link ArcType.RHUMB}.
*/
fromPositions(options: {
positions: Cartesian3[];
height?: number;
extrudedHeight?: number;
ellipsoid?: Ellipsoid;
granularity?: number;
perPositionHeight?: boolean;
arcType?: ArcType;
}): PolygonOutlineGeometry;
/**
* Computes the geometric representation of a polygon outline, including its vertices, indices, and a bounding sphere.
* @param polygonGeometry - A description of the polygon outline.
* @returns The computed vertices and indices.
*/
createGeometry(polygonGeometry: PolygonOutlineGeometry): Geometry | undefined;
}
/**
* A description of a polyline modeled as a line strip; the first two positions define a line segment,
* and each additional position defines a line segment from the previous position. The polyline is capable of
* displaying with a material.
* @example
* // A polyline with two connected line segments
* const polyline = new SuperMap.PolylineGeometry({
* positions : SuperMap.Cartesian3.fromDegreesArray([
* 0.0, 0.0,
* 5.0, 0.0,
* 5.0, 5.0
* ]),
* width : 10.0
* });
* const geometry = SuperMap.PolylineGeometry.createGeometry(polyline);
* @param options - Object with the following properties:
* @param options.positions - An array of {@link Cartesian3} defining the positions in the polyline as a line strip.
* @param [options.width = 1.0] - The width in pixels.
* @param [options.colors] - An Array of {@link Color} defining the per vertex or per segment colors.
* @param [options.colorsPerVertex = false] - A boolean that determines whether the colors will be flat across each segment of the line or interpolated across the vertices.
* @param [options.arcType = ArcType.GEODESIC] - The type of line the polyline segments must follow.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude if options.arcType is not ArcType.NONE. Determines the number of positions in the buffer.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
*/
export class PolylineGeometry {
constructor(options: {
positions: Cartesian3[];
width?: number;
colors?: Color[];
colorsPerVertex?: boolean;
arcType?: ArcType;
granularity?: number;
vertexFormat?: VertexFormat;
ellipsoid?: Ellipsoid;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PolylineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PolylineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PolylineGeometry): PolylineGeometry;
/**
* Computes the geometric representation of a polyline, including its vertices, indices, and a bounding sphere.
* @param polylineGeometry - A description of the polyline.
* @returns The computed vertices and indices.
*/
createGeometry(polylineGeometry: PolylineGeometry): Geometry | undefined;
}
/**
* A description of a polyline with a volume (a 2D shape extruded along a polyline).
* @example
* function computeCircle(radius) {
* const positions = [];
* for (let i = 0; i < 360; i++) {
* const radians = SuperMap.Math.toRadians(i);
* positions.push(new SuperMap.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
* }
* return positions;
* }
*
* const volume = new SuperMap.PolylineVolumeGeometry({
* vertexFormat : SuperMap.VertexFormat.POSITION_ONLY,
* polylinePositions : SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0
* ]),
* shapePositions : computeCircle(100000.0)
* });
* @param options - Object with the following properties:
* @param options.polylinePositions - An array of {@link Cartesian3} positions that define the center of the polyline volume.
* @param options.shapePositions - An array of {@link Cartesian2} positions that define the shape to be extruded along the polyline
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.cornerType = CornerType.ROUNDED] - Determines the style of the corners.
*/
export class PolylineVolumeGeometry {
constructor(options: {
polylinePositions: Cartesian3[];
shapePositions: Cartesian2[];
ellipsoid?: Ellipsoid;
granularity?: number;
vertexFormat?: VertexFormat;
cornerType?: CornerType;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PolylineVolumeGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PolylineVolumeGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PolylineVolumeGeometry): PolylineVolumeGeometry;
/**
* Computes the geometric representation of a polyline with a volume, including its vertices, indices, and a bounding sphere.
* @param polylineVolumeGeometry - A description of the polyline volume.
* @returns The computed vertices and indices.
*/
createGeometry(polylineVolumeGeometry: PolylineVolumeGeometry): Geometry | undefined;
}
/**
* A description of a polyline with a volume (a 2D shape extruded along a polyline).
* @example
* function computeCircle(radius) {
* const positions = [];
* for (let i = 0; i < 360; i++) {
* const radians = SuperMap.Math.toRadians(i);
* positions.push(new SuperMap.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
* }
* return positions;
* }
*
* const volumeOutline = new SuperMap.PolylineVolumeOutlineGeometry({
* polylinePositions : SuperMap.Cartesian3.fromDegreesArray([
* -72.0, 40.0,
* -70.0, 35.0
* ]),
* shapePositions : computeCircle(100000.0)
* });
* @param options - Object with the following properties:
* @param options.polylinePositions - An array of positions that define the center of the polyline volume.
* @param options.shapePositions - An array of positions that define the shape to be extruded along the polyline
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.cornerType = CornerType.ROUNDED] - Determines the style of the corners.
*/
export class PolylineVolumeOutlineGeometry {
constructor(options: {
polylinePositions: Cartesian3[];
shapePositions: Cartesian2[];
ellipsoid?: Ellipsoid;
granularity?: number;
cornerType?: CornerType;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: PolylineVolumeOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new PolylineVolumeOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: PolylineVolumeOutlineGeometry): PolylineVolumeOutlineGeometry;
/**
* Computes the geometric representation of the outline of a polyline with a volume, including its vertices, indices, and a bounding sphere.
* @param polylineVolumeOutlineGeometry - A description of the polyline volume outline.
* @returns The computed vertices and indices.
*/
createGeometry(polylineVolumeOutlineGeometry: PolylineVolumeOutlineGeometry): Geometry | undefined;
}
/**
* The type of a geometric primitive, i.e., points, lines, and triangles.
*/
export enum PrimitiveType {
/**
* Points primitive where each vertex (or index) is a separate point.
*/
POINTS = WebGLConstants.POINTS,
/**
* Lines primitive where each two vertices (or indices) is a line segment. Line segments are not necessarily connected.
*/
LINES = WebGLConstants.LINES,
/**
* Line loop primitive where each vertex (or index) after the first connects a line to
* the previous vertex, and the last vertex implicitly connects to the first.
*/
LINE_LOOP = WebGLConstants.LINE_LOOP,
/**
* Line strip primitive where each vertex (or index) after the first connects a line to the previous vertex.
*/
LINE_STRIP = WebGLConstants.LINE_STRIP,
/**
* Triangles primitive where each three vertices (or indices) is a triangle. Triangles do not necessarily share edges.
*/
TRIANGLES = WebGLConstants.TRIANGLES,
/**
* Triangle strip primitive where each vertex (or index) after the first two connect to
* the previous two vertices forming a triangle. For example, this can be used to model a wall.
*/
TRIANGLE_STRIP = WebGLConstants.TRIANGLE_STRIP,
/**
* Triangle fan primitive where each vertex (or index) after the first two connect to
* the previous vertex and the first vertex forming a triangle. For example, this can be used
* to model a cone or circle.
*/
TRIANGLE_FAN = WebGLConstants.TRIANGLE_FAN
}
/**
* Defines functions for 2nd order polynomial functions of one variable with only real coefficients.
*/
export namespace QuadraticRealPolynomial {
/**
* Provides the discriminant of the quadratic equation from the supplied coefficients.
* @param a - The coefficient of the 2nd order monomial.
* @param b - The coefficient of the 1st order monomial.
* @param c - The coefficient of the 0th order monomial.
* @returns The value of the discriminant.
*/
function computeDiscriminant(a: number, b: number, c: number): number;
/**
* Provides the real valued roots of the quadratic polynomial with the provided coefficients.
* @param a - The coefficient of the 2nd order monomial.
* @param b - The coefficient of the 1st order monomial.
* @param c - The coefficient of the 0th order monomial.
* @returns The real valued roots.
*/
function computeRealRoots(a: number, b: number, c: number): number[];
}
/**
* Terrain data for a single tile where the terrain data is represented as a quantized mesh. A quantized
* mesh consists of three vertex attributes, longitude, latitude, and height. All attributes are expressed
* as 16-bit values in the range 0 to 32767. Longitude and latitude are zero at the southwest corner
* of the tile and 32767 at the northeast corner. Height is zero at the minimum height in the tile
* and 32767 at the maximum height in the tile.
* @example
* const data = new SuperMap.QuantizedMeshTerrainData({
* minimumHeight : -100,
* maximumHeight : 2101,
* quantizedVertices : new Uint16Array([// order is SW NW SE NE
* // longitude
* 0, 0, 32767, 32767,
* // latitude
* 0, 32767, 0, 32767,
* // heights
* 16384, 0, 32767, 16384]),
* indices : new Uint16Array([0, 3, 1,
* 0, 2, 3]),
* boundingSphere : new SuperMap.BoundingSphere(new SuperMap.Cartesian3(1.0, 2.0, 3.0), 10000),
* orientedBoundingBox : new SuperMap.OrientedBoundingBox(new SuperMap.Cartesian3(1.0, 2.0, 3.0), SuperMap.Matrix3.fromRotationX(SuperMap.Math.PI, new SuperMap.Matrix3())),
* horizonOcclusionPoint : new SuperMap.Cartesian3(3.0, 2.0, 1.0),
* westIndices : [0, 1],
* southIndices : [0, 1],
* eastIndices : [2, 3],
* northIndices : [1, 3],
* westSkirtHeight : 1.0,
* southSkirtHeight : 1.0,
* eastSkirtHeight : 1.0,
* northSkirtHeight : 1.0
* });
* @param options - Object with the following properties:
* @param options.quantizedVertices - The buffer containing the quantized mesh.
* @param options.indices - The indices specifying how the quantized vertices are linked
* together into triangles. Each three indices specifies one triangle.
* @param options.minimumHeight - The minimum terrain height within the tile, in meters above the ellipsoid.
* @param options.maximumHeight - The maximum terrain height within the tile, in meters above the ellipsoid.
* @param options.boundingSphere - A sphere bounding all of the vertices in the mesh.
* @param [options.orientedBoundingBox] - An OrientedBoundingBox bounding all of the vertices in the mesh.
* @param options.horizonOcclusionPoint - The horizon occlusion point of the mesh. If this point
* is below the horizon, the entire tile is assumed to be below the horizon as well.
* The point is expressed in ellipsoid-scaled coordinates.
* @param options.westIndices - The indices of the vertices on the western edge of the tile.
* @param options.southIndices - The indices of the vertices on the southern edge of the tile.
* @param options.eastIndices - The indices of the vertices on the eastern edge of the tile.
* @param options.northIndices - The indices of the vertices on the northern edge of the tile.
* @param options.westSkirtHeight - The height of the skirt to add on the western edge of the tile.
* @param options.southSkirtHeight - The height of the skirt to add on the southern edge of the tile.
* @param options.eastSkirtHeight - The height of the skirt to add on the eastern edge of the tile.
* @param options.northSkirtHeight - The height of the skirt to add on the northern edge of the tile.
* @param [options.childTileMask = 15] - A bit mask indicating which of this tile's four children exist.
* If a child's bit is set, geometry will be requested for that tile as well when it
* is needed. If the bit is cleared, the child tile is not requested and geometry is
* instead upsampled from the parent. The bit values are as follows:
*
* Bit Position Bit Value Child Tile
* 0 1 Southwest
* 1 2 Southeast
* 2 4 Northwest
* 3 8 Northeast
*
* @param [options.createdByUpsampling = false] - True if this instance was created by upsampling another instance;
* otherwise, false.
* @param [options.encodedNormals] - The buffer containing per vertex normals, encoded using 'oct' encoding
* @param [options.waterMask] - The buffer containing the watermask.
* @param [options.credits] - Array of credits for this tile.
*/
export class QuantizedMeshTerrainData {
constructor(options: {
quantizedVertices: Uint16Array;
indices: Uint16Array | Uint32Array;
minimumHeight: number;
maximumHeight: number;
boundingSphere: BoundingSphere;
orientedBoundingBox?: OrientedBoundingBox;
horizonOcclusionPoint: Cartesian3;
westIndices: number[];
southIndices: number[];
eastIndices: number[];
northIndices: number[];
westSkirtHeight: number;
southSkirtHeight: number;
eastSkirtHeight: number;
northSkirtHeight: number;
childTileMask?: number;
createdByUpsampling?: boolean;
encodedNormals?: Uint8Array;
waterMask?: Uint8Array;
credits?: Credit[];
});
/**
* An array of credits for this tile.
*/
credits: Credit[];
/**
* The water mask included in this terrain data, if any. A water mask is a rectangular
* Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land.
* Values in between 0 and 255 are allowed as well to smoothly blend between land and water.
*/
waterMask: Uint8Array | HTMLImageElement | HTMLCanvasElement;
/**
* Upsamples this terrain data for use by a descendant tile. The resulting instance will contain a subset of the
* vertices in this instance, interpolated if necessary.
* @param tilingScheme - The tiling scheme of this terrain data.
* @param thisX - The X coordinate of this tile in the tiling scheme.
* @param thisY - The Y coordinate of this tile in the tiling scheme.
* @param thisLevel - The level of this tile in the tiling scheme.
* @param descendantX - The X coordinate within the tiling scheme of the descendant tile for which we are upsampling.
* @param descendantY - The Y coordinate within the tiling scheme of the descendant tile for which we are upsampling.
* @param descendantLevel - The level within the tiling scheme of the descendant tile for which we are upsampling.
* @returns A promise for upsampled heightmap terrain data for the descendant tile,
* or undefined if too many asynchronous upsample operations are in progress and the request has been
* deferred.
*/
upsample(tilingScheme: TilingScheme, thisX: number, thisY: number, thisLevel: number, descendantX: number, descendantY: number, descendantLevel: number): Promise | undefined;
/**
* Computes the terrain height at a specified longitude and latitude.
* @param rectangle - The rectangle covered by this terrain data.
* @param longitude - The longitude in radians.
* @param latitude - The latitude in radians.
* @returns The terrain height at the specified position. The position is clamped to
* the rectangle, so expect incorrect results for positions far outside the rectangle.
*/
interpolateHeight(rectangle: Rectangle, longitude: number, latitude: number): number;
/**
* Determines if a given child tile is available, based on the
* {@link HeightmapTerrainData.childTileMask}. The given child tile coordinates are assumed
* to be one of the four children of this tile. If non-child tile coordinates are
* given, the availability of the southeast child tile is returned.
* @param thisX - The tile X coordinate of this (the parent) tile.
* @param thisY - The tile Y coordinate of this (the parent) tile.
* @param childX - The tile X coordinate of the child tile to check for availability.
* @param childY - The tile Y coordinate of the child tile to check for availability.
* @returns True if the child tile is available; otherwise, false.
*/
isChildAvailable(thisX: number, thisY: number, childX: number, childY: number): boolean;
/**
* Gets a value indicating whether or not this terrain data was created by upsampling lower resolution
* terrain data. If this value is false, the data was obtained from some other source, such
* as by downloading it from a remote server. This method should return true for instances
* returned from a call to {@link HeightmapTerrainData#upsample}.
* @returns True if this instance was created by upsampling; otherwise, false.
*/
wasCreatedByUpsampling(): boolean;
}
/**
* Defines functions for 4th order polynomial functions of one variable with only real coefficients.
*/
export namespace QuarticRealPolynomial {
/**
* Provides the discriminant of the quartic equation from the supplied coefficients.
* @param a - The coefficient of the 4th order monomial.
* @param b - The coefficient of the 3rd order monomial.
* @param c - The coefficient of the 2nd order monomial.
* @param d - The coefficient of the 1st order monomial.
* @param e - The coefficient of the 0th order monomial.
* @returns The value of the discriminant.
*/
function computeDiscriminant(a: number, b: number, c: number, d: number, e: number): number;
/**
* Provides the real valued roots of the quartic polynomial with the provided coefficients.
* @param a - The coefficient of the 4th order monomial.
* @param b - The coefficient of the 3rd order monomial.
* @param c - The coefficient of the 2nd order monomial.
* @param d - The coefficient of the 1st order monomial.
* @param e - The coefficient of the 0th order monomial.
* @returns The real valued roots.
*/
function computeRealRoots(a: number, b: number, c: number, d: number, e: number): number[];
}
/**
* A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
* @param [x = 0.0] - The X component.
* @param [y = 0.0] - The Y component.
* @param [z = 0.0] - The Z component.
* @param [w = 0.0] - The W component.
*/
export class Quaternion {
constructor(x?: number, y?: number, z?: number, w?: number);
/**
* The X component.
*/
x: number;
/**
* The Y component.
*/
y: number;
/**
* The Z component.
*/
z: number;
/**
* The W component.
*/
w: number;
/**
* Computes a quaternion representing a rotation around an axis.
* @param axis - The axis of rotation.
* @param angle - The angle in radians to rotate around the axis.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
fromAxisAngle(axis: Cartesian3, angle: number, result?: Quaternion): Quaternion;
/**
* Computes a Quaternion from the provided Matrix3 instance.
* @param matrix - The rotation matrix.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
fromRotationMatrix(matrix: Matrix3, result?: Quaternion): Quaternion;
/**
* Computes a rotation from the given heading, pitch and roll angles. Heading is the rotation about the
* negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about
* the positive x axis.
* @param headingPitchRoll - The rotation expressed as a heading, pitch and roll.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Quaternion instance if none was provided.
*/
fromHeadingPitchRoll(headingPitchRoll: HeadingPitchRoll, result?: Quaternion): Quaternion;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Quaternion, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Quaternion): Quaternion;
/**
* The number of elements used to store the object into an array in its interpolatable form.
*/
packedInterpolationLength: number;
/**
* Converts a packed array into a form suitable for interpolation.
* @param packedArray - The packed array.
* @param [startingIndex = 0] - The index of the first element to be converted.
* @param [lastIndex = packedArray.length] - The index of the last element to be converted.
* @param [result] - The object into which to store the result.
*/
convertPackedArrayForInterpolation(packedArray: number[], startingIndex?: number, lastIndex?: number, result?: number[]): void;
/**
* Retrieves an instance from a packed array converted with {@link convertPackedArrayForInterpolation}.
* @param array - The array previously packed for interpolation.
* @param sourceArray - The original packed array.
* @param [firstIndex = 0] - The firstIndex used to convert the array.
* @param [lastIndex = packedArray.length] - The lastIndex used to convert the array.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
unpackInterpolationResult(array: number[], sourceArray: number[], firstIndex?: number, lastIndex?: number, result?: Quaternion): Quaternion;
/**
* Duplicates a Quaternion instance.
* @param quaternion - The quaternion to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided. (Returns undefined if quaternion is undefined)
*/
clone(quaternion: Quaternion, result?: Quaternion): Quaternion;
/**
* Computes the conjugate of the provided quaternion.
* @param quaternion - The quaternion to conjugate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
conjugate(quaternion: Quaternion, result: Quaternion): Quaternion;
/**
* Computes magnitude squared for the provided quaternion.
* @param quaternion - The quaternion to conjugate.
* @returns The magnitude squared.
*/
magnitudeSquared(quaternion: Quaternion): number;
/**
* Computes magnitude for the provided quaternion.
* @param quaternion - The quaternion to conjugate.
* @returns The magnitude.
*/
magnitude(quaternion: Quaternion): number;
/**
* Computes the normalized form of the provided quaternion.
* @param quaternion - The quaternion to normalize.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
normalize(quaternion: Quaternion, result: Quaternion): Quaternion;
/**
* Computes the inverse of the provided quaternion.
* @param quaternion - The quaternion to normalize.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
inverse(quaternion: Quaternion, result: Quaternion): Quaternion;
/**
* Computes the componentwise sum of two quaternions.
* @param left - The first quaternion.
* @param right - The second quaternion.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
add(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
/**
* Computes the componentwise difference of two quaternions.
* @param left - The first quaternion.
* @param right - The second quaternion.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
subtract(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
/**
* Negates the provided quaternion.
* @param quaternion - The quaternion to be negated.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
negate(quaternion: Quaternion, result: Quaternion): Quaternion;
/**
* Computes the dot (scalar) product of two quaternions.
* @param left - The first quaternion.
* @param right - The second quaternion.
* @returns The dot product.
*/
dot(left: Quaternion, right: Quaternion): number;
/**
* Computes the product of two quaternions.
* @param left - The first quaternion.
* @param right - The second quaternion.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiply(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
/**
* Multiplies the provided quaternion componentwise by the provided scalar.
* @param quaternion - The quaternion to be scaled.
* @param scalar - The scalar to multiply with.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
multiplyByScalar(quaternion: Quaternion, scalar: number, result: Quaternion): Quaternion;
/**
* Divides the provided quaternion componentwise by the provided scalar.
* @param quaternion - The quaternion to be divided.
* @param scalar - The scalar to divide by.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
divideByScalar(quaternion: Quaternion, scalar: number, result: Quaternion): Quaternion;
/**
* Computes the axis of rotation of the provided quaternion.
* @param quaternion - The quaternion to use.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
computeAxis(quaternion: Quaternion, result: Cartesian3): Cartesian3;
/**
* Computes the angle of rotation of the provided quaternion.
* @param quaternion - The quaternion to use.
* @returns The angle of rotation.
*/
computeAngle(quaternion: Quaternion): number;
/**
* Computes the linear interpolation or extrapolation at t using the provided quaternions.
* @param start - The value corresponding to t at 0.0.
* @param end - The value corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
lerp(start: Quaternion, end: Quaternion, t: number, result: Quaternion): Quaternion;
/**
* Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
* @param start - The value corresponding to t at 0.0.
* @param end - The value corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
slerp(start: Quaternion, end: Quaternion, t: number, result: Quaternion): Quaternion;
/**
* The logarithmic quaternion function.
* @param quaternion - The unit quaternion.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
log(quaternion: Quaternion, result: Cartesian3): Cartesian3;
/**
* The exponential quaternion function.
* @param cartesian - The cartesian.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
exp(cartesian: Cartesian3, result: Quaternion): Quaternion;
/**
* Computes an inner quadrangle point.
* This will compute quaternions that ensure a squad curve is C1.
* @param q0 - The first quaternion.
* @param q1 - The second quaternion.
* @param q2 - The third quaternion.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
computeInnerQuadrangle(q0: Quaternion, q1: Quaternion, q2: Quaternion, result: Quaternion): Quaternion;
/**
* Computes the spherical quadrangle interpolation between quaternions.
* @example
* // 1. compute the squad interpolation between two quaternions on a curve
* const s0 = SuperMap.Quaternion.computeInnerQuadrangle(quaternions[i - 1], quaternions[i], quaternions[i + 1], new SuperMap.Quaternion());
* const s1 = SuperMap.Quaternion.computeInnerQuadrangle(quaternions[i], quaternions[i + 1], quaternions[i + 2], new SuperMap.Quaternion());
* const q = SuperMap.Quaternion.squad(quaternions[i], quaternions[i + 1], s0, s1, t, new SuperMap.Quaternion());
*
* // 2. compute the squad interpolation as above but where the first quaternion is a end point.
* const s1 = SuperMap.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new SuperMap.Quaternion());
* const q = SuperMap.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new SuperMap.Quaternion());
* @param q0 - The first quaternion.
* @param q1 - The second quaternion.
* @param s0 - The first inner quadrangle.
* @param s1 - The second inner quadrangle.
* @param t - The time in [0,1] used to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
squad(q0: Quaternion, q1: Quaternion, s0: Quaternion, s1: Quaternion, t: number, result: Quaternion): Quaternion;
/**
* Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
* This implementation is faster than {@link Quaternion#slerp}, but is only accurate up to 10-6.
* @param start - The value corresponding to t at 0.0.
* @param end - The value corresponding to t at 1.0.
* @param t - The point along t at which to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter.
*/
fastSlerp(start: Quaternion, end: Quaternion, t: number, result: Quaternion): Quaternion;
/**
* Computes the spherical quadrangle interpolation between quaternions.
* An implementation that is faster than {@link Quaternion#squad}, but less accurate.
* @param q0 - The first quaternion.
* @param q1 - The second quaternion.
* @param s0 - The first inner quadrangle.
* @param s1 - The second inner quadrangle.
* @param t - The time in [0,1] used to interpolate.
* @param result - The object onto which to store the result.
* @returns The modified result parameter or a new instance if none was provided.
*/
fastSquad(q0: Quaternion, q1: Quaternion, s0: Quaternion, s1: Quaternion, t: number, result: Quaternion): Quaternion;
/**
* Compares the provided quaternions componentwise and returns
* true
if they are equal, false
otherwise.
* @param [left] - The first quaternion.
* @param [right] - The second quaternion.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(left?: Quaternion, right?: Quaternion): boolean;
/**
* Compares the provided quaternions componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [left] - The first quaternion.
* @param [right] - The second quaternion.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Quaternion, right?: Quaternion, epsilon?: number): boolean;
/**
* An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).
*/
readonly ZERO: Quaternion;
/**
* An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 1.0).
*/
readonly IDENTITY: Quaternion;
/**
* Duplicates this Quaternion instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
clone(result?: Quaternion): Quaternion;
/**
* Compares this and the provided quaternion componentwise and returns
* true
if they are equal, false
otherwise.
* @param [right] - The right hand side quaternion.
* @returns true
if left and right are equal, false
otherwise.
*/
equals(right?: Quaternion): boolean;
/**
* Compares this and the provided quaternion componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [right] - The right hand side quaternion.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(right?: Quaternion, epsilon?: number): boolean;
/**
* Returns a string representing this quaternion in the format (x, y, z, w).
* @returns A string representing this Quaternion.
*/
toString(): string;
}
/**
* A spline that uses spherical linear (slerp) interpolation to create a quaternion curve.
* The generated curve is in the class C1.
* @param options - Object with the following properties:
* @param options.times - An array of strictly increasing, unit-less, floating-point times at each point.
* The values are in no way connected to the clock time. They are the parameterization for the curve.
* @param options.points - The array of {@link Quaternion} control points.
*/
export class QuaternionSpline {
constructor(options: {
times: number[];
points: Quaternion[];
});
/**
* An array of times for the control points.
*/
readonly times: number[];
/**
* An array of {@link Quaternion} control points.
*/
readonly points: Quaternion[];
/**
* Finds an index i
in times
such that the parameter
* time
is in the interval [times[i], times[i + 1]]
.
* @param time - The time.
* @returns The index for the element at the start of the interval.
*/
findTimeInterval(time: number): number;
/**
* Wraps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, wrapped around to the updated animation.
*/
wrapTime(time: number): number;
/**
* Clamps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, clamped to the animation period.
*/
clampTime(time: number): number;
/**
* Evaluates the curve at a given time.
* @param time - The time at which to evaluate the curve.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new instance of the point on the curve at the given time.
*/
evaluate(time: number, result?: Quaternion): Quaternion;
}
/**
* A queue that can enqueue items at the end, and dequeue items from the front.
*/
export class Queue {
constructor();
/**
* The length of the queue.
*/
readonly length: number;
/**
* Enqueues the specified item.
* @param item - The item to enqueue.
*/
enqueue(item: any): void;
/**
* Dequeues an item. Returns undefined if the queue is empty.
* @returns The the dequeued item.
*/
dequeue(): any;
/**
* Returns the item at the front of the queue. Returns undefined if the queue is empty.
* @returns The item at the front of the queue.
*/
peek(): any;
/**
* Check whether this queue contains the specified item.
* @param item - The item to search for.
*/
contains(item: any): void;
/**
* Remove all items from the queue.
*/
clear(): void;
/**
* Sort the items in the queue in-place.
* @param compareFunction - A function that defines the sort order.
*/
sort(compareFunction: Queue.Comparator): void;
}
export namespace Queue {
/**
* A function used to compare two items while sorting a queue.
* @example
* function compareNumbers(a, b) {
* return a - b;
* }
* @param a - An item in the array.
* @param b - An item in the array.
*/
type Comparator = (a: any, b: any) => number;
}
/**
* Represents a ray that extends infinitely from the provided origin in the provided direction.
* @param [origin = Cartesian3.ZERO] - The origin of the ray.
* @param [direction = Cartesian3.ZERO] - The direction of the ray.
*/
export class Ray {
constructor(origin?: Cartesian3, direction?: Cartesian3);
/**
* The origin of the ray.
*/
origin: Cartesian3;
/**
* The direction of the ray.
*/
direction: Cartesian3;
/**
* Duplicates a Ray instance.
* @param ray - The ray to duplicate.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Ray instance if one was not provided. (Returns undefined if ray is undefined)
*/
clone(ray: Ray, result?: Ray): Ray;
/**
* Computes the point along the ray given by r(t) = o + t*d,
* where o is the origin of the ray and d is the direction.
* @example
* //Get the first intersection point of a ray and an ellipsoid.
* const intersection = SuperMap.IntersectionTests.rayEllipsoid(ray, ellipsoid);
* const point = SuperMap.Ray.getPoint(ray, intersection.start);
* @param ray - The ray.
* @param t - A scalar value.
* @param [result] - The object in which the result will be stored.
* @returns The modified result parameter, or a new instance if none was provided.
*/
getPoint(ray: Ray, t: number, result?: Cartesian3): Cartesian3;
}
/**
* A two dimensional region specified as longitude and latitude coordinates.
* @param [west = 0.0] - The westernmost longitude, in radians, in the range [-Pi, Pi].
* @param [south = 0.0] - The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
* @param [east = 0.0] - The easternmost longitude, in radians, in the range [-Pi, Pi].
* @param [north = 0.0] - The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
*/
export class Rectangle {
constructor(west?: number, south?: number, east?: number, north?: number);
/**
* The westernmost longitude in radians in the range [-Pi, Pi].
*/
west: number;
/**
* The southernmost latitude in radians in the range [-Pi/2, Pi/2].
*/
south: number;
/**
* The easternmost longitude in radians in the range [-Pi, Pi].
*/
east: number;
/**
* The northernmost latitude in radians in the range [-Pi/2, Pi/2].
*/
north: number;
/**
* Gets the width of the rectangle in radians.
*/
readonly width: number;
/**
* Gets the height of the rectangle in radians.
*/
readonly height: number;
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: Rectangle, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Rectangle instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: Rectangle): Rectangle;
/**
* Computes the width of a rectangle in radians.
* @param rectangle - The rectangle to compute the width of.
* @returns The width.
*/
computeWidth(rectangle: Rectangle): number;
/**
* Computes the height of a rectangle in radians.
* @param rectangle - The rectangle to compute the height of.
* @returns The height.
*/
computeHeight(rectangle: Rectangle): number;
/**
* Creates a rectangle given the boundary longitude and latitude in degrees.
* @example
* const rectangle = SuperMap.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);
* @param [west = 0.0] - The westernmost longitude in degrees in the range [-180.0, 180.0].
* @param [south = 0.0] - The southernmost latitude in degrees in the range [-90.0, 90.0].
* @param [east = 0.0] - The easternmost longitude in degrees in the range [-180.0, 180.0].
* @param [north = 0.0] - The northernmost latitude in degrees in the range [-90.0, 90.0].
* @param [result] - The object onto which to store the result, or undefined if a new instance should be created.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
fromDegrees(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle;
/**
* Creates a rectangle given the boundary longitude and latitude in radians.
* @example
* const rectangle = SuperMap.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);
* @param [west = 0.0] - The westernmost longitude in radians in the range [-Math.PI, Math.PI].
* @param [south = 0.0] - The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
* @param [east = 0.0] - The easternmost longitude in radians in the range [-Math.PI, Math.PI].
* @param [north = 0.0] - The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
* @param [result] - The object onto which to store the result, or undefined if a new instance should be created.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
fromRadians(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle;
/**
* Creates the smallest possible Rectangle that encloses all positions in the provided array.
* @param cartographics - The list of Cartographic instances.
* @param [result] - The object onto which to store the result, or undefined if a new instance should be created.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
fromCartographicArray(cartographics: Cartographic[], result?: Rectangle): Rectangle;
/**
* Creates the smallest possible Rectangle that encloses all positions in the provided array.
* @param cartesians - The list of Cartesian instances.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid the cartesians are on.
* @param [result] - The object onto which to store the result, or undefined if a new instance should be created.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
fromCartesianArray(cartesians: Cartesian3[], ellipsoid?: Ellipsoid, result?: Rectangle): Rectangle;
/**
* Duplicates a Rectangle.
* @param rectangle - The rectangle to clone.
* @param [result] - The object onto which to store the result, or undefined if a new instance should be created.
* @returns The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)
*/
clone(rectangle: Rectangle, result?: Rectangle): Rectangle;
/**
* Compares the provided Rectangles componentwise and returns
* true
if they pass an absolute or relative tolerance test,
* false
otherwise.
* @param [left] - The first Rectangle.
* @param [right] - The second Rectangle.
* @param [absoluteEpsilon = 0] - The absolute epsilon tolerance to use for equality testing.
* @returns true
if left and right are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(left?: Rectangle, right?: Rectangle, absoluteEpsilon?: number): boolean;
/**
* Duplicates this Rectangle.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
clone(result?: Rectangle): Rectangle;
/**
* Compares the provided Rectangle with this Rectangle componentwise and returns
* true
if they are equal, false
otherwise.
* @param [other] - The Rectangle to compare.
* @returns true
if the Rectangles are equal, false
otherwise.
*/
equals(other?: Rectangle): boolean;
/**
* Compares the provided rectangles and returns true
if they are equal,
* false
otherwise.
* @param [left] - The first Rectangle.
* @param [right] - The second Rectangle.
* @returns true
if left and right are equal; otherwise false
.
*/
equals(left?: Rectangle, right?: Rectangle): boolean;
/**
* Compares the provided Rectangle with this Rectangle componentwise and returns
* true
if they are within the provided epsilon,
* false
otherwise.
* @param [other] - The Rectangle to compare.
* @param [epsilon = 0] - The epsilon to use for equality testing.
* @returns true
if the Rectangles are within the provided epsilon, false
otherwise.
*/
equalsEpsilon(other?: Rectangle, epsilon?: number): boolean;
/**
* Checks a Rectangle's properties and throws if they are not in valid ranges.
* @param rectangle - The rectangle to validate
*/
validate(rectangle: Rectangle): void;
/**
* Computes the southwest corner of a rectangle.
* @param rectangle - The rectangle for which to find the corner
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
southwest(rectangle: Rectangle, result?: Cartographic): Cartographic;
/**
* Computes the northwest corner of a rectangle.
* @param rectangle - The rectangle for which to find the corner
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
northwest(rectangle: Rectangle, result?: Cartographic): Cartographic;
/**
* Computes the northeast corner of a rectangle.
* @param rectangle - The rectangle for which to find the corner
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
northeast(rectangle: Rectangle, result?: Cartographic): Cartographic;
/**
* Computes the southeast corner of a rectangle.
* @param rectangle - The rectangle for which to find the corner
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
southeast(rectangle: Rectangle, result?: Cartographic): Cartographic;
/**
* Computes the center of a rectangle.
* @param rectangle - The rectangle for which to find the center
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
center(rectangle: Rectangle, result?: Cartographic): Cartographic;
/**
* Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are
* latitude and longitude in radians and produces a correct intersection, taking into account the fact that
* the same angle can be represented with multiple values as well as the wrapping of longitude at the
* anti-meridian. For a simple intersection that ignores these factors and can be used with projected
* coordinates, see {@link Rectangle.simpleIntersection}.
* @param rectangle - On rectangle to find an intersection
* @param otherRectangle - Another rectangle to find an intersection
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
*/
intersection(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): Rectangle | undefined;
/**
* Computes a simple intersection of two rectangles. Unlike {@link Rectangle.intersection}, this function
* does not attempt to put the angular coordinates into a consistent range or to account for crossing the
* anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude
* and longitude (i.e. projected coordinates).
* @param rectangle - On rectangle to find an intersection
* @param otherRectangle - Another rectangle to find an intersection
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
*/
simpleIntersection(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): Rectangle | undefined;
/**
* Computes a rectangle that is the union of two rectangles.
* @param rectangle - A rectangle to enclose in rectangle.
* @param otherRectangle - A rectangle to enclose in a rectangle.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
union(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): Rectangle;
/**
* Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
* @param rectangle - A rectangle to expand.
* @param cartographic - A cartographic to enclose in a rectangle.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Rectangle instance if one was not provided.
*/
expand(rectangle: Rectangle, cartographic: Cartographic, result?: Rectangle): Rectangle;
/**
* Returns true if the cartographic is on or inside the rectangle, false otherwise.
* @param rectangle - The rectangle
* @param cartographic - The cartographic to test.
* @returns true if the provided cartographic is inside the rectangle, false otherwise.
*/
contains(rectangle: Rectangle, cartographic: Cartographic): boolean;
/**
* Samples a rectangle so that it includes a list of Cartesian points suitable for passing to
* {@link BoundingSphere#fromPoints}. Sampling is necessary to account
* for rectangles that cover the poles or cross the equator.
* @param rectangle - The rectangle to subsample.
* @param [ellipsoid = Ellipsoid.WGS84] - The ellipsoid to use.
* @param [surfaceHeight = 0.0] - The height of the rectangle above the ellipsoid.
* @param [result] - The array of Cartesians onto which to store the result.
* @returns The modified result parameter or a new Array of Cartesians instances if none was provided.
*/
subsample(rectangle: Rectangle, ellipsoid?: Ellipsoid, surfaceHeight?: number, result?: Cartesian3[]): Cartesian3[];
/**
* Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].
* @param rectangle - The rectangle to subsection.
* @param westLerp - The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.
* @param southLerp - The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.
* @param eastLerp - The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.
* @param northLerp - The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Rectangle instance if none was provided.
*/
subsection(rectangle: Rectangle, westLerp: number, southLerp: number, eastLerp: number, northLerp: number, result?: Rectangle): Rectangle;
/**
* The largest possible rectangle.
*/
readonly MAX_VALUE: Rectangle;
}
/**
* A description of a cartographic rectangle on an ellipsoid centered at the origin. Rectangle geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
* @example
* // 1. create a rectangle
* const rectangle = new SuperMap.RectangleGeometry({
* ellipsoid : SuperMap.Ellipsoid.WGS84,
* rectangle : SuperMap.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0),
* height : 10000.0
* });
* const geometry = SuperMap.RectangleGeometry.createGeometry(rectangle);
*
* // 2. create an extruded rectangle without a top
* const rectangle = new SuperMap.RectangleGeometry({
* ellipsoid : SuperMap.Ellipsoid.WGS84,
* rectangle : SuperMap.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0),
* height : 10000.0,
* extrudedHeight: 300000
* });
* const geometry = SuperMap.RectangleGeometry.createGeometry(rectangle);
* @param options - Object with the following properties:
* @param options.rectangle - A cartographic rectangle with north, south, east and west properties in radians.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rectangle lies.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.height = 0.0] - The distance in meters between the rectangle and the ellipsoid surface.
* @param [options.rotation = 0.0] - The rotation of the rectangle, in radians. A positive rotation is counter-clockwise.
* @param [options.stRotation = 0.0] - The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param [options.extrudedHeight] - The distance in meters between the rectangle's extruded face and the ellipsoid surface.
*/
export class RectangleGeometry {
constructor(options: {
rectangle: Rectangle;
vertexFormat?: VertexFormat;
ellipsoid?: Ellipsoid;
granularity?: number;
height?: number;
rotation?: number;
stRotation?: number;
extrudedHeight?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: RectangleGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new RectangleGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: RectangleGeometry): RectangleGeometry;
/**
* Computes the bounding rectangle based on the provided options
* @param options - Object with the following properties:
* @param options.rectangle - A cartographic rectangle with north, south, east and west properties in radians.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rectangle lies.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.rotation = 0.0] - The rotation of the rectangle, in radians. A positive rotation is counter-clockwise.
* @param [result] - An object in which to store the result.
* @returns The result rectangle
*/
computeRectangle(options: {
rectangle: Rectangle;
ellipsoid?: Ellipsoid;
granularity?: number;
rotation?: number;
}, result?: Rectangle): Rectangle;
/**
* Computes the geometric representation of a rectangle, including its vertices, indices, and a bounding sphere.
* @param rectangleGeometry - A description of the rectangle.
* @returns The computed vertices and indices.
*/
createGeometry(rectangleGeometry: RectangleGeometry): Geometry | undefined;
}
/**
* A description of the outline of a a cartographic rectangle on an ellipsoid centered at the origin.
* @example
* const rectangle = new SuperMap.RectangleOutlineGeometry({
* ellipsoid : SuperMap.Ellipsoid.WGS84,
* rectangle : SuperMap.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0),
* height : 10000.0
* });
* const geometry = SuperMap.RectangleOutlineGeometry.createGeometry(rectangle);
* @param options - Object with the following properties:
* @param options.rectangle - A cartographic rectangle with north, south, east and west properties in radians.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid on which the rectangle lies.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param [options.height = 0.0] - The distance in meters between the rectangle and the ellipsoid surface.
* @param [options.rotation = 0.0] - The rotation of the rectangle, in radians. A positive rotation is counter-clockwise.
* @param [options.extrudedHeight] - The distance in meters between the rectangle's extruded face and the ellipsoid surface.
*/
export class RectangleOutlineGeometry {
constructor(options: {
rectangle: Rectangle;
ellipsoid?: Ellipsoid;
granularity?: number;
height?: number;
rotation?: number;
extrudedHeight?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: RectangleOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new Quaternion instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: RectangleOutlineGeometry): RectangleOutlineGeometry;
/**
* Computes the geometric representation of an outline of a rectangle, including its vertices, indices, and a bounding sphere.
* @param rectangleGeometry - A description of the rectangle outline.
* @returns The computed vertices and indices.
*/
createGeometry(rectangleGeometry: RectangleOutlineGeometry): Geometry | undefined;
}
/**
* Constants for identifying well-known reference frames.
*/
export enum ReferenceFrame {
/**
* The fixed frame.
*/
FIXED = 0,
/**
* The inertial frame.
*/
INERTIAL = 1
}
/**
* Stores information for making a request. In general this does not need to be constructed directly.
* @param [options] - An object with the following properties:
* @param [options.url] - The url to request.
* @param [options.requestFunction] - The function that makes the actual data request.
* @param [options.cancelFunction] - The function that is called when the request is cancelled.
* @param [options.priorityFunction] - The function that is called to update the request's priority, which occurs once per frame.
* @param [options.priority = 0.0] - The initial priority of the request.
* @param [options.throttle = false] - Whether to throttle and prioritize the request. If false, the request will be sent immediately. If true, the request will be throttled and sent based on priority.
* @param [options.throttleByServer = false] - Whether to throttle the request by server.
* @param [options.type = RequestType.OTHER] - The type of request.
*/
export class Request {
constructor(options?: {
url?: string;
requestFunction?: Request.RequestCallback;
cancelFunction?: Request.CancelCallback;
priorityFunction?: Request.PriorityCallback;
priority?: number;
throttle?: boolean;
throttleByServer?: boolean;
type?: RequestType;
});
/**
* The URL to request.
*/
url: string;
/**
* The function that makes the actual data request.
*/
requestFunction: Request.RequestCallback;
/**
* The function that is called when the request is cancelled.
*/
cancelFunction: Request.CancelCallback;
/**
* The function that is called to update the request's priority, which occurs once per frame.
*/
priorityFunction: Request.PriorityCallback;
/**
* Priority is a unit-less value where lower values represent higher priority.
* For world-based objects, this is usually the distance from the camera.
* A request that does not have a priority function defaults to a priority of 0.
*
* If priorityFunction is defined, this value is updated every frame with the result of that call.
*/
priority: number;
/**
* Whether to throttle and prioritize the request. If false, the request will be sent immediately. If true, the
* request will be throttled and sent based on priority.
*/
readonly throttle: boolean;
/**
* Whether to throttle the request by server. Browsers typically support about 6-8 parallel connections
* for HTTP/1 servers, and an unlimited amount of connections for HTTP/2 servers. Setting this value
* to true
is preferable for requests going through HTTP/1 servers.
*/
readonly throttleByServer: boolean;
/**
* Type of request.
*/
readonly type: RequestType;
/**
* The current state of the request.
*/
readonly state: RequestState;
/**
* Duplicates a Request instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Resource instance if one was not provided.
*/
clone(result?: Request): Request;
}
export namespace Request {
/**
* The function that makes the actual data request.
*/
type RequestCallback = () => Promise;
/**
* The function that is called when the request is cancelled.
*/
type CancelCallback = () => void;
/**
* The function that is called to update the request's priority, which occurs once per frame.
*/
type PriorityCallback = () => number;
}
/**
* An event that is raised when a request encounters an error.
* @param [statusCode] - The HTTP error status code, such as 404.
* @param [response] - The response included along with the error.
* @param [responseHeaders] - The response headers, represented either as an object literal or as a
* string in the format returned by XMLHttpRequest's getAllResponseHeaders() function.
*/
export class RequestErrorEvent {
constructor(statusCode?: number, response?: any, responseHeaders?: string | any);
/**
* The HTTP error status code, such as 404. If the error does not have a particular
* HTTP code, this property will be undefined.
*/
statusCode: number;
/**
* The response included along with the error. If the error does not include a response,
* this property will be undefined.
*/
response: any;
/**
* The headers included in the response, represented as an object literal of key/value pairs.
* If the error does not include any headers, this property will be undefined.
*/
responseHeaders: any;
/**
* Creates a string representing this RequestErrorEvent.
* @returns A string representing the provided RequestErrorEvent.
*/
toString(): string;
}
/**
* The request scheduler is used to track and constrain the number of active requests in order to prioritize incoming requests. The ability
* to retain control over the number of requests in CesiumJS is important because due to events such as changes in the camera position,
* a lot of new requests may be generated and a lot of in-flight requests may become redundant. The request scheduler manually constrains the
* number of requests so that newer requests wait in a shorter queue and don't have to compete for bandwidth with requests that have expired.
*/
export namespace RequestScheduler {
/**
* The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.
*/
var maximumRequests: number;
/**
* The maximum number of simultaneous active requests per server. Un-throttled requests or servers specifically
* listed in {@link requestsByServer} do not observe this limit.
*/
var maximumRequestsPerServer: number;
/**
* A per server key list of overrides to use for throttling instead of maximumRequestsPerServer
*/
var requestsByServer: any;
/**
* Specifies if the request scheduler should throttle incoming requests, or let the browser queue requests under its control.
*/
var throttleRequests: boolean;
}
/**
* State of the request.
*/
export enum RequestState {
/**
* Initial unissued state.
*/
UNISSUED = 0,
/**
* Issued but not yet active. Will become active when open slots are available.
*/
ISSUED = 1,
/**
* Actual http request has been sent.
*/
ACTIVE = 2,
/**
* Request completed successfully.
*/
RECEIVED = 3,
/**
* Request was cancelled, either explicitly or automatically because of low priority.
*/
CANCELLED = 4,
/**
* Request failed.
*/
FAILED = 5
}
/**
* An enum identifying the type of request. Used for finer grained logging and priority sorting.
*/
export enum RequestType {
/**
* Terrain request.
*/
TERRAIN = 0,
/**
* Imagery request.
*/
IMAGERY = 1,
/**
* 3D Tiles request.
*/
TILES3D = 2,
/**
* Other request.
*/
OTHER = 3
}
export namespace Resource {
/**
* Initialization options for the Resource constructor
* @property url - The url of the resource.
* @property [queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @property [templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @property [headers = {}] - Additional HTTP headers that will be sent.
* @property [proxy] - A proxy to be used when loading the resource.
* @property [retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @property [retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @property [request] - A Request object that will be used. Intended for internal use only.
*/
type ConstructorOptions = {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
};
/**
* A function that returns the value of the property.
* @param [resource] - The resource that failed to load.
* @param [error] - The error that occurred during the loading of the resource.
*/
type RetryCallback = (resource?: Resource, error?: Error) => boolean | Promise;
}
/**
* A resource that includes the location and any other parameters we need to retrieve it or create derived resources. It also provides the ability to retry requests.
* @example
* function refreshTokenRetryCallback(resource, error) {
* if (error.statusCode === 403) {
* // 403 status code means a new token should be generated
* return getNewAccessToken()
* .then(function(token) {
* resource.queryParameters.access_token = token;
* return true;
* })
* .catch(function() {
* return false;
* });
* }
*
* return false;
* }
*
* const resource = new Resource({
* url: 'http://server.com/path/to/resource.json',
* proxy: new DefaultProxy('/proxy/'),
* headers: {
* 'X-My-Header': 'valueOfHeader'
* },
* queryParameters: {
* 'access_token': '123-435-456-000'
* },
* retryCallback: refreshTokenRetryCallback,
* retryAttempts: 1
* });
* @param options - A url or an object describing initialization options
*/
export class Resource {
constructor(options: string | Resource.ConstructorOptions);
/**
* Additional HTTP headers that will be sent with the request.
*/
headers: any;
/**
* A Request object that will be used. Intended for internal use only.
*/
request: Request;
/**
* A proxy to be used when loading the resource.
*/
proxy: Proxy;
/**
* Function to call when a request for this resource fails. If it returns true or a Promise that resolves to true, the request will be retried.
*/
retryCallback: (...params: any[]) => any;
/**
* The number of times the retryCallback should be called before giving up.
*/
retryAttempts: number;
/**
* Returns true if blobs are supported.
*/
readonly isBlobSupported: boolean;
/**
* Query parameters appended to the url.
*/
readonly queryParameters: any;
/**
* The key/value pairs used to replace template parameters in the url.
*/
readonly templateValues: any;
/**
* The url to the resource with template values replaced, query string appended and encoded by proxy if one was set.
*/
url: string;
/**
* The file extension of the resource.
*/
readonly extension: string;
/**
* True if the Resource refers to a data URI.
*/
isDataUri: boolean;
/**
* True if the Resource refers to a blob URI.
*/
isBlobUri: boolean;
/**
* True if the Resource refers to a cross origin URL.
*/
isCrossOriginUrl: boolean;
/**
* True if the Resource has request headers. This is equivalent to checking if the headers property has any keys.
*/
hasHeaders: boolean;
/**
* Override Object#toString so that implicit string conversion gives the
* complete URL represented by this Resource.
* @returns The URL represented by this Resource
*/
toString(): string;
/**
* Returns the url, optional with the query string and processed by a proxy.
* @param [query = false] - If true, the query string is included.
* @param [proxy = false] - If true, the url is processed by the proxy object, if defined.
* @returns The url with all the requested components.
*/
getUrlComponent(query?: boolean, proxy?: boolean): string;
/**
* Combines the specified object and the existing query parameters. This allows you to add many parameters at once,
* as opposed to adding them one at a time to the queryParameters property. If a value is already set, it will be replaced with the new value.
* @param params - The query parameters
* @param [useAsDefault = false] - If true the params will be used as the default values, so they will only be set if they are undefined.
*/
setQueryParameters(params: any, useAsDefault?: boolean): void;
/**
* Combines the specified object and the existing query parameters. This allows you to add many parameters at once,
* as opposed to adding them one at a time to the queryParameters property.
* @param params - The query parameters
*/
appendQueryParameters(params: any): void;
/**
* Combines the specified object and the existing template values. This allows you to add many values at once,
* as opposed to adding them one at a time to the templateValues property. If a value is already set, it will become an array and the new value will be appended.
* @param template - The template values
* @param [useAsDefault = false] - If true the values will be used as the default values, so they will only be set if they are undefined.
*/
setTemplateValues(template: any, useAsDefault?: boolean): void;
/**
* Returns a resource relative to the current instance. All properties remain the same as the current instance unless overridden in options.
* @param options - An object with the following properties
* @param [options.url] - The url that will be resolved relative to the url of the current instance.
* @param [options.queryParameters] - An object containing query parameters that will be combined with those of the current instance.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}). These will be combined with those of the current instance.
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The function to call when loading the resource fails.
* @param [options.retryAttempts] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.preserveQueryParameters = false] - If true, this will keep all query parameters from the current resource and derived resource. If false, derived parameters will replace those of the current resource.
* @returns The resource derived from the current one.
*/
getDerivedResource(options: {
url?: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
preserveQueryParameters?: boolean;
}): Resource;
/**
* Duplicates a Resource instance.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new Resource instance if one was not provided.
*/
clone(result?: Resource): Resource;
/**
* Returns the base path of the Resource.
* @param [includeQuery = false] - Whether or not to include the query string and fragment form the uri
* @returns The base URI of the resource
*/
getBaseUri(includeQuery?: boolean): string;
/**
* Appends a forward slash to the URL.
*/
appendForwardSlash(): void;
/**
* Asynchronously loads the resource as raw binary data. Returns a promise that will resolve to
* an ArrayBuffer once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* // load a single URL asynchronously
* resource.fetchArrayBuffer().then(function(arrayBuffer) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchArrayBuffer(): Promise | undefined;
/**
* Creates a Resource and calls fetchArrayBuffer() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchArrayBuffer(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
}): Promise | undefined;
/**
* Asynchronously loads the given resource as a blob. Returns a promise that will resolve to
* a Blob once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* // load a single URL asynchronously
* resource.fetchBlob().then(function(blob) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchBlob(): Promise | undefined;
/**
* Creates a Resource and calls fetchBlob() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchBlob(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
}): Promise | undefined;
/**
* Asynchronously loads the given image resource. Returns a promise that will resolve to
* an {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap|ImageBitmap} if preferImageBitmap
is true and the browser supports createImageBitmap
or otherwise an
* {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement|Image} once loaded, or reject if the image failed to load.
* @example
* // load a single image asynchronously
* resource.fetchImage().then(function(image) {
* // use the loaded image
* }).catch(function(error) {
* // an error occurred
* });
*
* // load several images in parallel
* Promise.all([resource1.fetchImage(), resource2.fetchImage()]).then(function(images) {
* // images is an array containing all the loaded images
* });
* @param [options] - An object with the following properties.
* @param [options.preferBlob = false] - If true, we will load the image via a blob.
* @param [options.preferImageBitmap = false] - If true, image will be decoded during fetch and an ImageBitmap
is returned.
* @param [options.flipY = false] - If true, image will be vertically flipped during decode. Only applies if the browser supports createImageBitmap
.
* @param [options.skipColorSpaceConversion = false] - If true, any custom gamma or color profiles in the image will be ignored. Only applies if the browser supports createImageBitmap
.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchImage(options?: {
preferBlob?: boolean;
preferImageBitmap?: boolean;
flipY?: boolean;
skipColorSpaceConversion?: boolean;
}): Promise | undefined;
/**
* Creates a Resource and calls fetchImage() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.flipY = false] - Whether to vertically flip the image during fetch and decode. Only applies when requesting an image and the browser supports createImageBitmap
.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.preferBlob = false] - If true, we will load the image via a blob.
* @param [options.preferImageBitmap = false] - If true, image will be decoded during fetch and an ImageBitmap
is returned.
* @param [options.skipColorSpaceConversion = false] - If true, any custom gamma or color profiles in the image will be ignored. Only applies when requesting an image and the browser supports createImageBitmap
.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchImage(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
flipY?: boolean;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
preferBlob?: boolean;
preferImageBitmap?: boolean;
skipColorSpaceConversion?: boolean;
}): Promise | undefined;
/**
* Asynchronously loads the given resource as text. Returns a promise that will resolve to
* a String once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* // load text from a URL, setting a custom header
* const resource = new Resource({
* url: 'http://someUrl.com/someJson.txt',
* headers: {
* 'X-Custom-Header' : 'some value'
* }
* });
* resource.fetchText().then(function(text) {
* // Do something with the text
* }).catch(function(error) {
* // an error occurred
* });
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchText(): Promise | undefined;
/**
* Creates a Resource and calls fetchText() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchText(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
}): Promise | undefined;
/**
* Asynchronously loads the given resource as JSON. Returns a promise that will resolve to
* a JSON object once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled. This function
* adds 'Accept: application/json,*/*;q=0.01' to the request headers, if not
* already specified.
* @example
* resource.fetchJson().then(function(jsonData) {
* // Do something with the JSON object
* }).catch(function(error) {
* // an error occurred
* });
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchJson(): Promise | undefined;
/**
* Creates a Resource and calls fetchJson() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchJson(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
}): Promise | undefined;
/**
* Asynchronously loads the given resource as XML. Returns a promise that will resolve to
* an XML Document once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* // load XML from a URL, setting a custom header
* SuperMap.loadXML('http://someUrl.com/someXML.xml', {
* 'X-Custom-Header' : 'some value'
* }).then(function(document) {
* // Do something with the document
* }).catch(function(error) {
* // an error occurred
* });
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchXML(): Promise | undefined;
/**
* Creates a Resource and calls fetchXML() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchXML(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
}): Promise | undefined;
/**
* Requests a resource using JSONP.
* @example
* // load a data asynchronously
* resource.fetchJsonp().then(function(data) {
* // use the loaded data
* }).catch(function(error) {
* // an error occurred
* });
* @param [callbackParameterName = 'callback'] - The callback parameter name that the server expects.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchJsonp(callbackParameterName?: string): Promise | undefined;
/**
* Creates a Resource from a URL and calls fetchJsonp() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.callbackParameterName = 'callback'] - The callback parameter name that the server expects.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetchJsonp(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
callbackParameterName?: string;
}): Promise | undefined;
/**
* Asynchronously loads the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled. It's recommended that you use
* the more specific functions eg. fetchJson, fetchBlob, etc.
* @example
* resource.fetch()
* .then(function(body) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetch(options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls fetch() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
fetch(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously deletes the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.delete()
* .then(function(body) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
delete(options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls delete() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.data] - Data that is posted with the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
delete(options: {
url: string;
data?: any;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously gets headers the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.head()
* .then(function(headers) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
head(options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls head() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
head(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously gets options the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.options()
* .then(function(headers) {
* // use the data
* }).catch(function(error) {
* // an error occurred
* });
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
options(options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls options() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
options(options: {
url: string;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously posts data to the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.post(data)
* .then(function(result) {
* // use the result
* }).catch(function(error) {
* // an error occurred
* });
* @param data - Data that is posted with the resource.
* @param [options] - Object with the following properties:
* @param [options.data] - Data that is posted with the resource.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
post(data: any, options?: {
data?: any;
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls post() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param options.data - Data that is posted with the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
post(options: {
url: string;
data: any;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously puts data to the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.put(data)
* .then(function(result) {
* // use the result
* }).catch(function(error) {
* // an error occurred
* });
* @param data - Data that is posted with the resource.
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
put(data: any, options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls put() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param options.data - Data that is posted with the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
put(options: {
url: string;
data: any;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Asynchronously patches data to the given resource. Returns a promise that will resolve to
* the result once loaded, or reject if the resource failed to load. The data is loaded
* using XMLHttpRequest, which means that in order to make requests to another origin,
* the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
* @example
* resource.patch(data)
* .then(function(result) {
* // use the result
* }).catch(function(error) {
* // an error occurred
* });
* @param data - Data that is posted with the resource.
* @param [options] - Object with the following properties:
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.headers] - Additional HTTP headers to send with the request, if any.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
patch(data: any, options?: {
responseType?: string;
headers?: any;
overrideMimeType?: string;
}): Promise | undefined;
/**
* Creates a Resource from a URL and calls patch() on it.
* @param options - A url or an object with the following properties
* @param options.url - The url of the resource.
* @param options.data - Data that is posted with the resource.
* @param [options.queryParameters] - An object containing query parameters that will be sent when retrieving the resource.
* @param [options.templateValues] - Key/Value pairs that are used to replace template values (eg. {x}).
* @param [options.headers = {}] - Additional HTTP headers that will be sent.
* @param [options.proxy] - A proxy to be used when loading the resource.
* @param [options.retryCallback] - The Function to call when a request for this resource fails. If it returns true, the request will be retried.
* @param [options.retryAttempts = 0] - The number of times the retryCallback should be called before giving up.
* @param [options.request] - A Request object that will be used. Intended for internal use only.
* @param [options.responseType] - The type of response. This controls the type of item returned.
* @param [options.overrideMimeType] - Overrides the MIME type returned by the server.
* @returns a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle
is true and the request does not have high enough priority.
*/
patch(options: {
url: string;
data: any;
queryParameters?: any;
templateValues?: any;
headers?: any;
proxy?: Proxy;
retryCallback?: Resource.RetryCallback;
retryAttempts?: number;
request?: Request;
responseType?: string;
overrideMimeType?: string;
}): Promise | undefined;
/**
* A resource instance initialized to the current browser location
*/
readonly DEFAULT: Resource;
}
/**
* Constructs an exception object that is thrown due to an error that can occur at runtime, e.g.,
* out of memory, could not compile shader, etc. If a function may throw this
* exception, the calling code should be prepared to catch it.
*
* On the other hand, a {@link DeveloperError} indicates an exception due
* to a developer error, e.g., invalid argument, that usually indicates a bug in the
* calling code.
* @param [message] - The error message for this exception.
*/
export class RuntimeError extends Error {
constructor(message?: string);
/**
* 'RuntimeError' indicating that this exception was thrown due to a runtime error.
*/
readonly name: string;
/**
* The explanation for why this exception was thrown.
*/
readonly message: string;
/**
* The stack trace of this exception, if available.
*/
readonly stack: string;
}
export namespace ScreenSpaceEventHandler {
/**
* An Event that occurs at a single position on screen.
*/
type PositionedEvent = {
position: Cartesian2;
};
/**
* @param event - The event which triggered the listener
*/
type PositionedEventCallback = (event: ScreenSpaceEventHandler.PositionedEvent) => void;
/**
* An Event that starts at one position and ends at another.
*/
type MotionEvent = {
startPosition: Cartesian2;
endPosition: Cartesian2;
};
/**
* @param event - The event which triggered the listener
*/
type MotionEventCallback = (event: ScreenSpaceEventHandler.MotionEvent) => void;
/**
* An Event that occurs at a two positions on screen.
*/
type TwoPointEvent = {
position1: Cartesian2;
position2: Cartesian2;
};
/**
* @param event - The event which triggered the listener
*/
type TwoPointEventCallback = (event: ScreenSpaceEventHandler.TwoPointEvent) => void;
/**
* An Event that starts at a two positions on screen and moves to two other positions.
*/
type TwoPointMotionEvent = {
position1: Cartesian2;
position2: Cartesian2;
previousPosition1: Cartesian2;
previousPosition2: Cartesian2;
};
/**
* @param event - The event which triggered the listener
*/
type TwoPointMotionEventCallback = (event: ScreenSpaceEventHandler.TwoPointMotionEvent) => void;
/**
* @param delta - The amount that the mouse wheel moved
*/
type WheelEventCallback = (delta: number) => void;
}
/**
* Handles user input events. Custom functions can be added to be executed on
* when the user enters input.
* @param [element = document] - The element to add events to.
*/
export class ScreenSpaceEventHandler {
constructor(element?: HTMLCanvasElement);
/**
* Set a function to be executed on an input event.
* @param action - Function to be executed when the input event occurs.
* @param type - The ScreenSpaceEventType of input event.
* @param [modifier] - A KeyboardEventModifier key that is held when a type
* event occurs.
*/
setInputAction(action: ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback, type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): void;
/**
* Returns the function to be executed on an input event.
* @param type - The ScreenSpaceEventType of input event.
* @param [modifier] - A KeyboardEventModifier key that is held when a type
* event occurs.
* @returns The function to be executed on an input event.
*/
getInputAction(type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback;
/**
* Removes the function to be executed on an input event.
* @param type - The ScreenSpaceEventType of input event.
* @param [modifier] - A KeyboardEventModifier key that is held when a type
* event occurs.
*/
removeInputAction(type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): void;
/**
* Returns true if this object was destroyed; otherwise, false.
*
* If this object was destroyed, it should not be used; calling any function other than
* isDestroyed
will result in a {@link DeveloperError} exception.
* @returns true
if this object was destroyed; otherwise, false
.
*/
isDestroyed(): boolean;
/**
* Removes listeners held by this object.
*
* Once an object is destroyed, it should not be used; calling any function other than
* isDestroyed
will result in a {@link DeveloperError} exception. Therefore,
* assign the return value (undefined
) to the object as done in the example.
* @example
* handler = handler && handler.destroy();
*/
destroy(): void;
/**
* The amount of time, in milliseconds, that mouse events will be disabled after
* receiving any touch events, such that any emulated mouse events will be ignored.
*/
mouseEmulationIgnoreMilliseconds: number;
/**
* The amount of time, in milliseconds, before a touch on the screen becomes a
* touch and hold.
*/
touchHoldDelayMilliseconds: number;
}
/**
* This enumerated type is for classifying mouse events: down, up, click, double click, move and move while a button is held down.
*/
export enum ScreenSpaceEventType {
/**
* Represents a mouse left button down event.
*/
LEFT_DOWN = 0,
/**
* Represents a mouse left button up event.
*/
LEFT_UP = 1,
/**
* Represents a mouse left click event.
*/
LEFT_CLICK = 2,
/**
* Represents a mouse left double click event.
*/
LEFT_DOUBLE_CLICK = 3,
/**
* Represents a mouse left button down event.
*/
RIGHT_DOWN = 5,
/**
* Represents a mouse right button up event.
*/
RIGHT_UP = 6,
/**
* Represents a mouse right click event.
*/
RIGHT_CLICK = 7,
/**
* Represents a mouse middle button down event.
*/
MIDDLE_DOWN = 10,
/**
* Represents a mouse middle button up event.
*/
MIDDLE_UP = 11,
/**
* Represents a mouse middle click event.
*/
MIDDLE_CLICK = 12,
/**
* Represents a mouse move event.
*/
MOUSE_MOVE = 15,
/**
* Represents a mouse wheel event.
*/
WHEEL = 16,
/**
* Represents the start of a two-finger event on a touch surface.
*/
PINCH_START = 17,
/**
* Represents the end of a two-finger event on a touch surface.
*/
PINCH_END = 18,
/**
* Represents a change of a two-finger event on a touch surface.
*/
PINCH_MOVE = 19
}
/**
* Value and type information for per-instance geometry attribute that determines if the geometry instance will be shown.
* @example
* const instance = new SuperMap.GeometryInstance({
* geometry : new SuperMap.BoxGeometry({
* vertexFormat : SuperMap.VertexFormat.POSITION_AND_NORMAL,
* minimum : new SuperMap.Cartesian3(-250000.0, -250000.0, -250000.0),
* maximum : new SuperMap.Cartesian3(250000.0, 250000.0, 250000.0)
* }),
* modelMatrix : SuperMap.Matrix4.multiplyByTranslation(SuperMap.Transforms.eastNorthUpToFixedFrame(
* SuperMap.Cartesian3.fromDegrees(-75.59777, 40.03883)), new SuperMap.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap.Matrix4()),
* id : 'box',
* attributes : {
* show : new SuperMap.ShowGeometryInstanceAttribute(false)
* }
* });
* @param [show = true] - Determines if the geometry instance will be shown.
*/
export class ShowGeometryInstanceAttribute {
constructor(show?: boolean);
/**
* The values for the attributes stored in a typed array.
*/
value: Uint8Array;
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@link ColorGeometryInstanceAttribute#value}.
*/
readonly componentDatatype: ComponentDatatype;
/**
* The number of components in the attributes, i.e., {@link ColorGeometryInstanceAttribute#value}.
*/
readonly componentsPerAttribute: number;
/**
* When true
and componentDatatype
is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
*/
readonly normalize: boolean;
/**
* Converts a boolean show to a typed array that can be used to assign a show attribute.
* @example
* const attributes = primitive.getGeometryInstanceAttributes('an id');
* attributes.show = SuperMap.ShowGeometryInstanceAttribute.toValue(true, attributes.show);
* @param show - The show value.
* @param [result] - The array to store the result in, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
toValue(show: boolean, result?: Uint8Array): Uint8Array;
}
/**
* Contains functions for finding the Cartesian coordinates of the sun and the moon in the
* Earth-centered inertial frame.
*/
export namespace Simon1994PlanetaryPositions {
/**
* Computes the position of the Sun in the Earth-centered inertial frame
* @param [julianDate] - The time at which to compute the Sun's position, if not provided the current system time is used.
* @param [result] - The object onto which to store the result.
* @returns Calculated sun position
*/
function computeSunPositionInEarthInertialFrame(julianDate?: JulianDate, result?: Cartesian3): Cartesian3;
/**
* Computes the position of the Moon in the Earth-centered inertial frame
* @param [julianDate] - The time at which to compute the Sun's position, if not provided the current system time is used.
* @param [result] - The object onto which to store the result.
* @returns Calculated moon position
*/
function computeMoonPositionInEarthInertialFrame(julianDate?: JulianDate, result?: Cartesian3): Cartesian3;
}
/**
* A description of a polyline modeled as a line strip; the first two positions define a line segment,
* and each additional position defines a line segment from the previous position.
* @example
* // A polyline with two connected line segments
* const polyline = new SuperMap.SimplePolylineGeometry({
* positions : SuperMap.Cartesian3.fromDegreesArray([
* 0.0, 0.0,
* 5.0, 0.0,
* 5.0, 5.0
* ])
* });
* const geometry = SuperMap.SimplePolylineGeometry.createGeometry(polyline);
* @param options - Object with the following properties:
* @param options.positions - An array of {@link Cartesian3} defining the positions in the polyline as a line strip.
* @param [options.colors] - An Array of {@link Color} defining the per vertex or per segment colors.
* @param [options.colorsPerVertex = false] - A boolean that determines whether the colors will be flat across each segment of the line or interpolated across the vertices.
* @param [options.arcType = ArcType.GEODESIC] - The type of line the polyline segments must follow.
* @param [options.granularity = Math.RADIANS_PER_DEGREE] - The distance, in radians, between each latitude and longitude if options.arcType is not ArcType.NONE. Determines the number of positions in the buffer.
* @param [options.ellipsoid = Ellipsoid.WGS84] - The ellipsoid to be used as a reference.
*/
export class SimplePolylineGeometry {
constructor(options: {
positions: Cartesian3[];
colors?: Color[];
colorsPerVertex?: boolean;
arcType?: ArcType;
granularity?: number;
ellipsoid?: Ellipsoid;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: SimplePolylineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new SimplePolylineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: SimplePolylineGeometry): SimplePolylineGeometry;
/**
* Computes the geometric representation of a simple polyline, including its vertices, indices, and a bounding sphere.
* @param simplePolylineGeometry - A description of the polyline.
* @returns The computed vertices and indices.
*/
createGeometry(simplePolylineGeometry: SimplePolylineGeometry): Geometry | undefined;
}
/**
* A description of a sphere centered at the origin.
* @example
* const sphere = new SuperMap.SphereGeometry({
* radius : 100.0,
* vertexFormat : SuperMap.VertexFormat.POSITION_ONLY
* });
* const geometry = SuperMap.SphereGeometry.createGeometry(sphere);
* @param [options] - Object with the following properties:
* @param [options.radius = 1.0] - The radius of the sphere.
* @param [options.stackPartitions = 64] - The number of times to partition the ellipsoid into stacks.
* @param [options.slicePartitions = 64] - The number of times to partition the ellipsoid into radial slices.
* @param [options.vertexFormat = VertexFormat.DEFAULT] - The vertex attributes to be computed.
*/
export class SphereGeometry {
constructor(options?: {
radius?: number;
stackPartitions?: number;
slicePartitions?: number;
vertexFormat?: VertexFormat;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: SphereGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new SphereGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: SphereGeometry): SphereGeometry;
/**
* Computes the geometric representation of a sphere, including its vertices, indices, and a bounding sphere.
* @param sphereGeometry - A description of the sphere.
* @returns The computed vertices and indices.
*/
createGeometry(sphereGeometry: SphereGeometry): Geometry | undefined;
}
/**
* A description of the outline of a sphere.
* @example
* const sphere = new SuperMap.SphereOutlineGeometry({
* radius : 100.0,
* stackPartitions : 6,
* slicePartitions: 5
* });
* const geometry = SuperMap.SphereOutlineGeometry.createGeometry(sphere);
* @param [options] - Object with the following properties:
* @param [options.radius = 1.0] - The radius of the sphere.
* @param [options.stackPartitions = 10] - The count of stacks for the sphere (1 greater than the number of parallel lines).
* @param [options.slicePartitions = 8] - The count of slices for the sphere (Equal to the number of radial lines).
* @param [options.subdivisions = 200] - The number of points per line, determining the granularity of the curvature .
*/
export class SphereOutlineGeometry {
constructor(options?: {
radius?: number;
stackPartitions?: number;
slicePartitions?: number;
subdivisions?: number;
});
/**
* The number of elements used to pack the object into an array.
*/
packedLength: number;
/**
* Stores the provided instance into the provided array.
* @param value - The value to pack.
* @param array - The array to pack into.
* @param [startingIndex = 0] - The index into the array at which to start packing the elements.
* @returns The array that was packed into
*/
pack(value: SphereOutlineGeometry, array: number[], startingIndex?: number): number[];
/**
* Retrieves an instance from a packed array.
* @param array - The packed array.
* @param [startingIndex = 0] - The starting index of the element to be unpacked.
* @param [result] - The object into which to store the result.
* @returns The modified result parameter or a new SphereOutlineGeometry instance if one was not provided.
*/
unpack(array: number[], startingIndex?: number, result?: SphereOutlineGeometry): SphereOutlineGeometry;
/**
* Computes the geometric representation of an outline of a sphere, including its vertices, indices, and a bounding sphere.
* @param sphereGeometry - A description of the sphere outline.
* @returns The computed vertices and indices.
*/
createGeometry(sphereGeometry: SphereOutlineGeometry): Geometry | undefined;
}
/**
* A set of curvilinear 3-dimensional coordinates.
* @param [clock = 0.0] - The angular coordinate lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
* @param [cone = 0.0] - The angular coordinate measured from the positive z-axis and toward the negative z-axis.
* @param [magnitude = 1.0] - The linear coordinate measured from the origin.
*/
export class Spherical {
constructor(clock?: number, cone?: number, magnitude?: number);
/**
* The clock component.
*/
clock: number;
/**
* The cone component.
*/
cone: number;
/**
* The magnitude component.
*/
magnitude: number;
/**
* Converts the provided Cartesian3 into Spherical coordinates.
* @param cartesian3 - The Cartesian3 to be converted to Spherical.
* @param [result] - The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new instance if one was not provided.
*/
fromCartesian3(cartesian3: Cartesian3, result?: Spherical): Spherical;
/**
* Creates a duplicate of a Spherical.
* @param spherical - The spherical to clone.
* @param [result] - The object to store the result into, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined. (Returns undefined if spherical is undefined)
*/
clone(spherical: Spherical, result?: Spherical): Spherical;
/**
* Computes the normalized version of the provided spherical.
* @param spherical - The spherical to be normalized.
* @param [result] - The object to store the result into, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
normalize(spherical: Spherical, result?: Spherical): Spherical;
/**
* Returns true if the first spherical is equal to the second spherical, false otherwise.
* @param left - The first Spherical to be compared.
* @param right - The second Spherical to be compared.
* @returns true if the first spherical is equal to the second spherical, false otherwise.
*/
equals(left: Spherical, right: Spherical): boolean;
/**
* Returns true if the first spherical is within the provided epsilon of the second spherical, false otherwise.
* @param left - The first Spherical to be compared.
* @param right - The second Spherical to be compared.
* @param [epsilon = 0.0] - The epsilon to compare against.
* @returns true if the first spherical is within the provided epsilon of the second spherical, false otherwise.
*/
equalsEpsilon(left: Spherical, right: Spherical, epsilon?: number): boolean;
/**
* Returns true if this spherical is equal to the provided spherical, false otherwise.
* @param other - The Spherical to be compared.
* @returns true if this spherical is equal to the provided spherical, false otherwise.
*/
equals(other: Spherical): boolean;
/**
* Creates a duplicate of this Spherical.
* @param [result] - The object to store the result into, if undefined a new instance will be created.
* @returns The modified result parameter or a new instance if result was undefined.
*/
clone(result?: Spherical): Spherical;
/**
* Returns true if this spherical is within the provided epsilon of the provided spherical, false otherwise.
* @param other - The Spherical to be compared.
* @param epsilon - The epsilon to compare against.
* @returns true if this spherical is within the provided epsilon of the provided spherical, false otherwise.
*/
equalsEpsilon(other: Spherical, epsilon: number): boolean;
/**
* Returns a string representing this instance in the format (clock, cone, magnitude).
* @returns A string representing this instance.
*/
toString(): string;
}
/**
* Creates a curve parameterized and evaluated by time. This type describes an interface
* and is not intended to be instantiated directly.
*/
export class Spline {
constructor();
/**
* An array of times for the control points.
*/
times: number[];
/**
* An array of control points.
*/
points: Cartesian3[] | Quaternion[];
/**
* Evaluates the curve at a given time.
* @param time - The time at which to evaluate the curve.
* @param [result] - The object onto which to store the result.
* @returns The modified result parameter or a new instance of the point on the curve at the given time.
*/
evaluate(time: number, result?: Cartesian3 | Quaternion | number[]): Cartesian3 | Quaternion | number[];
/**
* Finds an index i
in times
such that the parameter
* time
is in the interval [times[i], times[i + 1]]
.
* @param time - The time.
* @param startIndex - The index from which to start the search.
* @returns The index for the element at the start of the interval.
*/
findTimeInterval(time: number, startIndex: number): number;
/**
* Wraps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, wrapped around the animation period.
*/
wrapTime(time: number): number;
/**
* Clamps the given time to the period covered by the spline.
* @param time - The time.
* @returns The time, clamped to the animation period.
*/
clampTime(time: number): number;
}
/**
* A wrapper around a web worker that allows scheduling tasks for a given worker,
* returning results asynchronously via a promise.
*
* The Worker is not constructed until a task is scheduled.
* @param workerPath - The Url to the worker. This can either be an absolute path or relative to the SuperMap Workers folder.
* @param [maximumActiveTasks = Number.POSITIVE_INFINITY] - The maximum number of active tasks. Once exceeded,
* scheduleTask will not queue any more tasks, allowing
* work to be rescheduled in future frames.
*/
export class TaskProcessor {
constructor(workerPath: string, maximumActiveTasks?: number);
/**
* Schedule a task to be processed by the web worker asynchronously. If there are currently more
* tasks active than the maximum set by the constructor, will immediately return undefined.
* Otherwise, returns a promise that will resolve to the result posted back by the worker when
* finished.
* @example
* const taskProcessor = new SuperMap.TaskProcessor('myWorkerPath');
* const promise = taskProcessor.scheduleTask({
* someParameter : true,
* another : 'hello'
* });
* if (!SuperMap.defined(promise)) {
* // too many active tasks - try again later
* } else {
* promise.then(function(result) {
* // use the result of the task
* });
* }
* @param parameters - Any input data that will be posted to the worker.
* @param [transferableObjects] - An array of objects contained in parameters that should be
* transferred to the worker instead of copied.
* @returns Either a promise that will resolve to the result when available, or undefined
* if there are too many active tasks,
*/
scheduleTask(parameters: any, transferableObjects?: object[]): Promise