Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
container |
Element | String | Specify the Document Object Model (DOM) or ID of the HTML element that contains the viewer part. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
optional
The object has the following properties:
|
Throws:
-
DeveloperError : There is no "container" element with this identifier in the document.
-
DeveloperError : When using the BaseLayerPicker component, options.imageryProvider is not available, please change to specify options.selectedImageryProviderViewModel.
-
DeveloperError : When using the BaseLayerPicker widget, options.terrainProvider is not available, please change to specify options.selectedTerrainProviderViewModel.
-
DeveloperError : When using the BaseLayerPicker component, options.selectedImageryProviderViewModel is not available, please change to specify options.imageryProvider.
-
DeveloperError : When using the BaseLayerPicker widget, options.selectedTerrainProviderViewModel is not available, please change to specify options.terrainProvider.
Example:
//Initialize the viewer widget
var viewer = new Supermap3D.Viewer('Supermap3DContainer', {
//Use STK World Terrain
terrainProvider : new Supermap3D.Supermap3DTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world'
}),
//Use OpenStreetMaps
imageryProvider : Supermap3D.createOpenStreetMapImageryProvider({
url : 'https://a.tile.openstreetmap.org/'
}),
});
//Add basic drag and drop functionality
viewer.extend(Supermap3D.viewerDragDropMixin);
//An error was encountered while processing the deleted file and a pop-up warning was displayed.
viewer.dropError.addEventListener(function(dropHandler, name, error) {
console.log(error);
window.alert(error);
});
See:
Members
-
Gets or sets whether the datasource can temporarily pause the animation to avoid displaying incomplete pictures to the user. For example, if an asynchronous function is being processed in the background, the clock will not advance until the geometry is ready.
-
readonlyanimation : Animation
-
Get the Animation widget.
-
readonlybaseLayerPicker : BaseLayerPicker
-
Get the BaseLayerPicker object.
-
Get the DOM element at the bottom of the window that contains
CreditDisplay
and other potential information. -
readonlycamera : Camera
-
Get the camera object.
-
Get the canvas object.
-
Obtain Supermap3D trademark elements.
-
readonlySupermap3DWidget : Supermap3DWidget
-
Get the Supermap3DWidget object.
-
readonlyclock : Clock
-
Get the clock object.
-
readonlyclockViewModel : ClockViewModel
-
Get the clock view model.
-
Get the parent container.
-
readonlydataSourceDisplay : DataSourceDisplay
-
Get the display for
DataSource
. -
readonlydataSources : DataSourceCollection
-
Gets or sets the collection of instances of data source
DataSource
to be visualized. -
readonlyentities : EntityCollection
-
Get a collection of entities unrelated to a specific data source. This is a shortcut to access
dataSourceDisplay.defaultDataSource.entities
. -
readonlyfullscreenButton : FullscreenButton
-
Get the FullscreenButton object.
-
readonlygeocoder : Geocoder
-
Get the Geocoder object.
-
readonlyhomeButton : HomeButton
-
Get the HomeButton object.
-
readonlyimageryLayers : ImageryLayerCollection
-
Get the image layer collection that will be rendered on the earth.
-
readonlyinfoBox : InfoBox
-
Get the InfoBox object.
-
readonlynavigationHelpButton : NavigationHelpButton
-
Get the navigation help button (NavigationHelpButton) object.
-
pickEvent : Event
-
Click the attribute to query the event. Through this event, you can get the object properties returned when you click the specified position on the screen. When using this event, The monitoring event should be set first, and the specified attribute information returned by the callback.
Example:
//Register for click events viewer.pickEvent.addEventListener(function(feature)); //Remove click event viewer.pickEvent.removeEventListener(function(feature));
-
readonlyprojectionPicker : ProjectionPicker
-
Obtain the projection picker.
-
Gets or sets the zoom factor of the rendering resolution. A value less than 1.0 can improve performance on less powerful devices; on the contrary, a value greater than 1.0 will render at a higher resolution and then scale it down to improve visual fidelity. For example, if the widget is laid out in a size of 640x480, setting this property to 0.5 will cause the scene to be rendered at 320x240 resolution and the scene is scaled up, while setting it to 2.0 will cause the scene to be rendered at 1280x960 and the scene is scaled down.
-
Default Value:
1.0
-
readonlyscene : Scene
-
Get the scene object.
-
readonlysceneModePicker : SceneModePicker
-
Get the scene mode picker (SceneModePicker) object.
-
readonlyscreenSpaceEventHandler : ScreenSpaceEventHandler
-
Get the screen space event handler.
-
selectedEntity : Entity
-
Gets or sets the object instance for which the selection indicator is displayed.
-
readonlyselectedEntityChanged : Event
-
Get the event triggered when the selected entity object changes.
-
readonlyselectionIndicator : SelectionIndicator
-
Get the selection indicator (SelectionIndicator) object.
-
readonlyshadowMap : ShadowMap
-
Get the shadow map of the scene.
-
Determine whether the shadow is cast by the sun.
-
When useDefaultRenderLoop is set to true, get or set the target frame rate of the widget. If this attribute is not defined, the browser��s
requestAnimationFrame
implementation determines the frame rate; if this attribute is defined, the value should be greater than 0, and Values greater than the underlying requestAnimationFrame will not work. -
terrainProvider : TerrainProvider
-
A TerrainProvider object that provides surface geometry for the earth.
-
terrainShadows : ShadowMode
-
Determine whether the terrain casts or accepts shadows from the sun.
-
readonlytimeline : Timeline
-
Get the Timeline widget.
-
trackedEntity : Entity
-
Gets or sets the entity instance currently tracked by the camera.
-
readonlytrackedEntityChanged : Event
-
Gets the event that is triggered when tracking the change of the entity object.
-
Gets or sets whether the component can control the rendering cycle.
When set to true, the component will use requestAnimationFrame to perform rendering and resize the component, and drive clock simulation; When set to false, you must manually call the render and resize methods as part of the custom loop rendering.
If an error occurs during rendering, the renderError event of Scene will be triggered, and this property will be changed to false. After the error occurs, this property must be changed back to true to continue rendering. -
readonlyvrButton : VRButton
-
Get the VRButton object.
Methods
-
Release the resources occupied by the object.
-
Use the provided mixin to extend the basic viewer functionality. The mixin can add additional properties, functions, or other behaviors to the provided viewer instance.
Name Type Description mixin
Viewer~ViewerMixin Specify the Viewer mixin object to be added to the instance. options
Object optional Specify the options object passed to the mixin function. See:
-
The camera flies to the specified entity, entity set, or data source. If the data source is still being loaded or the visualization is still in progress, this method needs to wait for the data to be ready before executing the flight.
The offset variable is represented by the "azimuth/pitch angle/range" in the local "east-north-up" reference frame (the center point is the center of the enclosing sphere). The azimuth and pitch angles are defined in the local "east-north-up" reference system. Azimuth heading is an angle value that starts from the y axis and increases toward the x axis. The pitch angle is the rotation angle from the xy plane. A positive pitch angle means it is above the plane, and a negative pitch angle means it is below the plane. The distance range represents the distance from the center point. If range is 0, a range will be calculated so that the entire bounding ball is visible.
There must be a top-down view in 2D. The camera is above the looking down target. Range is the height above the target; headingy is determined by the offset. If the azimuth angle cannot be determined based on the offset, heading is the north direction.
Name Type Description target
Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer)> Specify the entity, entity set, data source, or image layer to view. You can also specify a promise to resolve one of the aforementioned types. options
Object optional The object has the following properties: Name Type Default Description duration
Number 3.0
optional Flight duration (in seconds). maximumHeight
Number optional The maximum altitude in flight. offset
HeadingPitchRange optional The offset from the target in the local "east-north-up" reference system centered on the target. Returns:
When the flight is successful, the promise is resolved to true; if the entity is not visualized in the scene or the flight is cancelled, the promise is resolved to false. -
Mandatory readjustment makes the components reconsider the layout including component size and credit placement.
-
Returns whether to release the resources occupied by the object.
Returns:
True indicates that the occupied resources have been released, otherwise it returns false. -
Render the scene. Unless useDefaultRenderLoop is set to false, this function will be called automatically.
-
Resize the part to match the container. This function will be called automatically as required, unless
useDefaultRenderLoop
is set to false. -
Set the camera asynchronously to view the specified entity, entity set, or data source. If the data source is still loading or the visualization is still in progress, this method needs to wait for the data to be ready before performing zooming.
The offset variable is represented by the "azimuth/pitch angle/range" in the local "east-north-up" reference system (the center point is the center of the bounding sphere). The azimuth and pitch angles are defined in the local "east-north-up" reference system. Azimuth heading is an angle value that starts from the y axis and increases toward the x axis. The pitch angle is the rotation angle from the xy plane. A positive pitch angle means it is above the plane, and a negative pitch angle means it is below the plane. The distance range represents the distance from the center point. If range is 0, a range will be calculated so that the entire bounding ball is visible.
There must be a top-down view in 2D. The camera is located above the looking down target. Range is the height above the target; heading is determined by an offset, otherwise the azimuth cannot be determined based on the offset, and heading is the north direction.
Name Type Description target
Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer)> Specify the entity, entity set, data source, or image layer to view. You can also specify a promise to resolve one of the aforementioned types. offset
HeadingPitchRange optional Specify the offset from the center of the local "East-North-Up" reference system. Returns:
When the zoom is successful, the promise is resolved to true; if the entity is not visualized in the scene or the zoom is cancelled, the promise is resolved to false.
Type Definitions
-
Added the function of Viewer instance with additional functions.
Name Type Description viewer
Viewer The viewer instance object. options
Object The options object passed to the mixin function. See: