Class
JimuMapView
is the view
for developers to develop the map-related functions.
For example, developers can use the view
property of the JimuMapView
instance to get the original<a href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html" target="_blank">ArcGIS Maps SDK for JavaScript View
</a>,
then use the original view
to develop the map-related functions. At the same time, JimuMapView
also provides
properties such as isActive
and status
to indicate the current status in the map widget.
JimuMapView
is a wrapper class for the ArcGIS Maps SDK for JavaScript View
.
It is created by a map widget using a map DataSource
.
import { JimuMapView } from 'jimu-arcgis';
// Add the State interface
interface State {
extent: __esri.Extent
}
// On an active view change, set the extent State property
onActiveViewChange = (jimuMapView: JimuMapView) => {
if(!this.extentWatch){
this.extentWatch = jimuMapView.view.watch('extent', extent => {
this.setState({
extent
})
});
}
}
// Use the `JimuMapView` instance from the map widget through the `JimuMapViewComponent` React component
<JimuMapViewComponent useMapWidgetId={this.props.useMapWidgetIds[0]} onActiveViewChange={this.onActiveViewChange}></JimuMapViewComponent>
Properties
Property | Type | Notes |
---|---|---|
string | The id of the | |
string | The id of the | |
boolean | The | |
JimuLayerViews | The union for all | |
The created map tools (ArcGIS JavaScript API widgets) for this view. | ||
string | The id of the widget creating the | |
The status of the | ||
MapView | SceneView | The |
isActive
isActive: boolean
The isActive
property indicates whether the map in the map widget is accessible.
For example, for a single-source map, there is a single JimuMapView
instance, therefore, the isActive
is always true.
With a multi-source map, there are two JimuMapView
instances. In the multi-source map, the property isActive
is true for the top JimuMapView
instance,
and false for the one beneath. Upon clicking the switch map tool, the isActive
properties will switch.
jimuLayerViews
jimuLayerViews: JimuLayerViews
The union for all JimuLayerView
instances and the layer view object wrapper.
the JimuLayerView instance in this object may not been loaded. Please call whenJimuLayerViewLoaded()
to wait for it's loaded.
jimuMapTools
Class PropertyjimuMapTools: JimuMapTool[]
The created map tools (ArcGIS JavaScript API widgets) for this view.
status
Class Propertystatus: JimuMapViewStatus
The status of the JimuMapView
instance. JimuMapViewStatus
enumeration members include "LOADING"
, "LOADED"
and "FAILED"
.
view
Class Propertyview: MapView | SceneView
The view
is the ArcGIS Maps SDK for JavaScript View
, including a MapView
or a SceneView
. In the ArcGIS Maps SDK for JavaScript,
the MapView
and SceneView
are part of the __esri
namespace types. Thus, their types are __esri.MapView
and __esri.SceneView
.
Methods
Method | Returns | Notes |
---|---|---|
addOrRemoveDataOnMap(newAddToMapDatas) | void | add layers according to the corresponding types of data source |
void | Clear the selected features. | |
createJimuLayerView(layerOrSubLayer, parentJimuLayerId, index, runtimeAddedDataSource?, fromRuntime?) | Promise<JimuLayerView> | Create the JimuLayerView and add it into the jimuLayerViews object. Resolve the promise when it is ready. |
destroy() | void | Destroy the |
drawDataOnMap(newShowOnMapDatas) | void | Draw data on the map, using a dedicated |
drawDataRecordSet(dataSet, targetLayerId, title?, symbolOption?) | Promise<Graphic[]> | Draw the features in a |
getAllChildJimuLayerViews(jimuLayerViewId) | Return all child JimuLayerViews. | |
Return all JimuLayerViews. | ||
getChildJimuLayerViewIds(jimuLayerViewId) | string[] | Return the direct child JimuLayerViews |
getJimuLayerViewByAPILayer(layerOrSubLayer) | Get JimuLayerView by JS API layer or sublayer. | |
getParentJimuLayerViews(jimuLayerViewId) | Return all parent JimuLayerViews. | |
boolean | Indicates if the JimuMapView is destroyed or not. Returns true if the view is not created or if the view is destroyed, otherwise returns false. | |
selectFeaturesByGraphic(graphic, spatialRelationship, selectionMode, options?) | Promise<{ [jimuLayerViewId: string]: __esri.Graphic | IFeature[] }> | Select features in all layers in the map by a graphic. |
updateDrawnDataRecordSet(dataSet, targetLayerId, title?, symbolOption?) | Promise<Graphic[]> | Update the drawn |
Promise<JimuLayerViews> | return the loaded JimuLayerViews only | |
whenJimuLayerViewLoaded(jimuLayerViewId) | Promise<JimuLayerView> | Return the JimuLayerView when it's loaded. |
Promise<JimuLayerView> | ||
Promise<JimuMapView> | Resolve the JimuMapView when it is loaded. |
addOrRemoveDataOnMap
Class MethodaddOrRemoveDataOnMap(newAddToMapDatas: AddToMapDatas): void
add layers according to the corresponding types of data source
Parameters
Parameter | Type |
---|---|
new | AddToMapDatas |
Returns
void
clearSelectedFeatures
Class MethodclearSelectedFeatures(): void
Clear the selected features.
Returns
void
createJimuLayerView
Class MethodcreateJimuLayerView(layerOrSubLayer: Layer | ArcGISSubLayer, parentJimuLayerId: string, index: number, runtimeAddedDataSource?: DataSource, fromRuntime?: boolean): Promise<JimuLayerView>
Create the JimuLayerView and add it into the jimuLayerViews object. Resolve the promise when it is ready.
Parameters
Parameter | Type | Notes |
---|---|---|
layer | Layer | ArcGISSubLayer | the layer can be a Layer or a SubLayer |
parent | string | the layer's parent JimuLayerView ID |
index | number | layer index |
runtime | DataSource | Optional, the layer data source added at runtime. |
from | boolean | Optional, true means the JimuLayerView is created from runtime. e.g. The JimuLayerView is created by AddData widget at runtime. false means the layer is a builtin layer of WebMap or WebScene. |
Returns
Promise<JimuLayerView>
destroy
Class Methoddestroy(): void
Destroy the JimuMapView
instance and the ArcGIS Maps SDK for JavaScript View
at the same time.
Returns
void
drawDataOnMap
Class MethoddrawDataOnMap(newShowOnMapDatas: ShowOnMapDatas): void
Draw data on the map, using a dedicated GraphicsLayer
for every data entry. This will clear the layers drawn previously.
Parameters
Parameter | Type |
---|---|
new | ShowOnMapDatas |
Returns
void
drawDataRecordSet
Class MethoddrawDataRecordSet(dataSet: DataRecordSet, targetLayerId: string, title?: string, symbolOption?: SymbolOption): Promise<Graphic[]>
Draw the features in a GraphicsLayer
.
Parameters
Parameter | Type |
---|---|
data | DataRecordSet |
target | string |
title | string |
symbol | SymbolOption |
Returns
Promise<Graphic[]>
getAllChildJimuLayerViews
Class MethodgetAllChildJimuLayerViews(jimuLayerViewId: any): JimuLayerView[]
Return all child JimuLayerViews.
Parameters
Parameter | Type |
---|---|
jimu | any |
Returns
JimuLayerView[]
getAllJimuLayerViews
Class MethodgetAllJimuLayerViews(): JimuLayerView[]
Return all JimuLayerViews.
Returns
JimuLayerView[]
getChildJimuLayerViewIds
Class MethodgetChildJimuLayerViewIds(jimuLayerViewId: any): string[]
Return the direct child JimuLayerViews
Parameters
Parameter | Type |
---|---|
jimu | any |
Returns
string[]
getJimuLayerViewByAPILayer
Class MethodgetJimuLayerViewByAPILayer(layerOrSubLayer: Layer | ArcGISSubLayer): JimuLayerView
Get JimuLayerView by JS API layer or sublayer.
Parameters
Parameter | Type | Notes |
---|---|---|
layer | Layer | ArcGISSubLayer | JS API layer or sublayer. |
Returns
JimuLayerView
getParentJimuLayerViews
Class MethodgetParentJimuLayerViews(jimuLayerViewId: string): JimuLayerView[]
Return all parent JimuLayerViews.
Parameters
Parameter | Type |
---|---|
jimu | string |
Returns
JimuLayerView[]
isDestroyed
Class MethodisDestroyed(): boolean
Indicates if the JimuMapView is destroyed or not. Returns true if the view is not created or if the view is destroyed, otherwise returns false.
Returns
boolean
selectFeaturesByGraphic
Class MethodselectFeaturesByGraphic(graphic: Graphic, spatialRelationship: string, selectionMode: DataSourceSelectionMode, options?: { filterJimuLayerView?: (jimuLayerView: JimuLayerView) => boolean; returnAllFields?: boolean; returnFullGeometry?: boolean }): Promise<{ [jimuLayerViewId: string]: __esri.Graphic | IFeature[] }>
Select features in all layers in the map by a graphic.
Parameters
Parameter | Type | Notes |
---|---|---|
graphic | Graphic | This is the ArcGIS Maps SDK for JavaScript |
spatial | string | This parameter defines the spatial relationship to query features in the layer, see details here. |
selection | DataSourceSelectionMode | This parameter is to indicate how the new select operation affects the original selection. It can only be the following enumeration values: |
options | { filterJimuLayerView?: (jimuLayerView: JimuLayerView) => boolean; returnAllFields?: boolean; returnFullGeometry?: boolean } | If options.returnAllFields is true, the returned features will contain all fields, otherwise the value will contain the necessary fields. If options.returnFullGeometry is true, the returned features will have full precision geometry. By default, this method selects all eligible JimuLayerViews in the map. If you only want to select some specific JimuLayerViews, you can set options.filterJimuLayerView, which is a callback function. If the return value is true, it will be selected, otherwise it will not be selected. |
Returns
Promise<{ [jimuLayerViewId: string]: __esri.Graphic | IFeature[] }>
updateDrawnDataRecordSet
Class MethodupdateDrawnDataRecordSet(dataSet: DataRecordSet, targetLayerId: string, title?: string, symbolOption?: SymbolOption): Promise<Graphic[]>
Update the drawn GraphicsLayer
.
Parameters
Parameter | Type |
---|---|
data | DataRecordSet |
target | string |
title | string |
symbol | SymbolOption |
Returns
Promise<Graphic[]>
whenAllJimuLayerViewLoaded
Class MethodwhenAllJimuLayerViewLoaded(): Promise<JimuLayerViews>
return the loaded JimuLayerViews only
Returns
Promise<JimuLayerViews>
whenJimuLayerViewLoaded
Class MethodwhenJimuLayerViewLoaded(jimuLayerViewId: string): Promise<JimuLayerView>
Return the JimuLayerView when it's loaded.
For a JimuLayerView id, the instance may not have been craeted, but we can make sure the first level JimuLayerView are created. So, for a JimuLayerView id, we'll make sure its parent JimuLayerView get created and ready, and the JimuLayerView will create its children JimuLayerViews in the ready().
Parameters
Parameter | Type |
---|---|
jimu | string |
Returns
Promise<JimuLayerView>
whenJimuLayerViewLoadedByDataSource
Class MethodwhenJimuLayerViewLoadedByDataSource(ds: DataSource): Promise<JimuLayerView>
Parameters
Parameter | Type |
---|---|
ds | DataSource |
Returns
Promise<JimuLayerView>
whenJimuMapViewLoaded
Class MethodwhenJimuMapViewLoaded(): Promise<JimuMapView>
Resolve the JimuMapView when it is loaded.
Returns
Promise<JimuMapView>