@arcgis/map-components
Version:
ArcGIS Map Components
367 lines (364 loc) • 19.3 kB
TypeScript
/// <reference types="@arcgis/core/interfaces.d.ts" />
/// <reference types="../../index.d.ts" />
import { Use } from '@arcgis/components-controllers';
import { Nil } from '@arcgis/components-utils';
import { default as MapView } from '@arcgis/core/views/MapView.js';
import { default as WebMap } from '@arcgis/core/WebMap.js';
import { PublicLitElement as LitElement, ToElement, TargetedEvent } from '@arcgis/lumina';
declare const useWebMap: (component: import('@arcgis/components-controllers').StencilLifecycles & {
manager: import('@arcgis/components-controllers').ControllerManager;
el: HTMLElement;
autoDestroyDisabled?: boolean;
destroy?: () => Promise<void>;
} & Pick<WebMap, never> & {
reactiveUtils?: typeof __esri.reactiveUtils;
autoDestroyDisabled: boolean;
destroy: () => Promise<void>;
}, options?: {
editConstructorProperties(props: __esri.WebMapProperties | undefined): __esri.WebMapProperties | Promise<__esri.WebMapProperties | undefined> | undefined;
} | undefined) => WebMap;
declare const useMapView: (component: import('@arcgis/components-controllers').StencilLifecycles & {
manager: import('@arcgis/components-controllers').ControllerManager;
el: HTMLElement;
autoDestroyDisabled?: boolean;
destroy?: () => Promise<void>;
} & Pick<MapView, never> & {
reactiveUtils?: typeof __esri.reactiveUtils;
autoDestroyDisabled: boolean;
destroy: () => Promise<void>;
}, options?: {
editConstructorProperties(props: __esri.MapViewProperties | undefined): __esri.MapViewProperties | Promise<__esri.MapViewProperties | undefined> | undefined;
} | undefined) => MapView;
/** The ArcGIS Map Component is used to add 2D maps to web applications. For 3D maps, use the
* [ArcGIS Scene component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-scene/).
*
* The Map component creates a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) and loads a WebMap from either [ArcGIS Online](https://www.arcgis.com/home/index.html) or [ArcGIS Enterprise portal](https://enterprise.arcgis.com/en/portal/latest/administer/windows/what-is-portal-for-arcgis-.htm).
*
* ```html
* <arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca"></arcgis-map>
* ```
*
* Alternatively, the Map component can be initialized without a WebMap item.
*
* ```html
* <arcgis-map basemap="satellite" center="-154.88, 19.46" zoom="15"></arcgis-map>
* ```
*
* Other components can be added and connected to the Map component.
* ```html
* <arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca">
* <arcgis-zoom position="top-left"></arcgis-zoom>
* <arcgis-legend position="bottom-left"></arcgis-legend>
* </arcgis-map>
* ```
*
* The Map component can be customized further using any of the [core API functionalities](https://developers.arcgis.com/javascript/latest/api-reference/) of the ArcGIS Maps SDK for JavaScript.
*
* ```js
* const arcgisMap = document.querySelector("arcgis-map");
* arcgisMap.addEventListener("arcgisViewReadyChange", () => {
* const layer = new GraphicsLayer({ title: "My Layer" });
* arcgisMap.map.add(layer);
* });
* ```
*
* See also:
* - [SDK sample apps using the Map component](https://developers.arcgis.com/javascript/latest/sample-code/?tagged=arcgis-map)
* - [Getting started](https://developers.arcgis.com/javascript/latest/get-started-overview/)
* - [Programming patterns](https://developers.arcgis.com/javascript/latest/programming-patterns/)
*/
export declare class ArcgisMap extends LitElement {
/** Internal view of the component. */
readonly view: MapView;
/**
* Collection containing a flat list of all the created LayerViews
* related to the basemap, operational layers, and group layers in this view.
*/
readonly allLayerViews: __esri.Collection<__esri.LayerView>;
/**
* If true, the component will not be destroyed automatically when it is
* disconnected from the document. This is useful when you want to move the
* component to a different place on the page, or temporarily hide it. If this
* is set, make sure to call the \`destroy\` method when you are done to prevent
* memory leaks.
*/
autoDestroyDisabled: boolean;
/**
* The background color of the MapView. If the view's map changes, the view's `background` is reset to the map's background,
* even if the user set it previously.
*/
background: nullish | __esri.ColorBackground;
/**
* Specifies a basemap for the map. The basemap is a set of layers that give
* geographic context to the view and the other operational layers
* in the map.
* It can either be set using a basemap ID string ([see values](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap)),
* [Basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html)
* or [BasemapStyle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-BasemapStyle.html).
*
* [Read more](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap)
*/
basemap: __esri.Basemap | nullish | string;
/** Represents the view for a single basemap after it has been added to the map. */
basemapView: __esri.BasemapView;
/**
* Represents the view's center point; when setting the center, you may pass a
* esri/geometry/Point instance or a string representing
* a longitude/latitude pair (`"-100.4593, 36.9014"`).
* Setting the center immediately changes the current view.
* For animating the view, see this component's goTo() method.
*/
get center(): __esri.MapView["center"];
set center(newValue: __esri.MapView["center"] | Nil | number[] | string);
/** Specifies constraints to scale, zoom, and rotation that may be applied to the MapView. */
constraints: __esri.View2DConstraints;
/**
* Indicates whether layer's displayFilter are honored when rendering layers in the view.
* If `false`, display filters are ignored and all features are rendered.
*
* @default false
*/
displayFilterDisabled: boolean;
/**
* The extent represents the visible portion of a map within the view as an instance of esri/geometry/Extent.
* Setting the extent immediately changes the view without animation. To animate
* the view, see this component's goTo() method.
* When the view is rotated, the extent does not update to include the newly visible portions of the map.
*/
get extent(): __esri.MapView["extent"];
set extent(newValue: __esri.MapView["extent"]);
/** A rejected view indicates a fatal error making it unable to display. */
fatalError: nullish | __esri.Error;
/**
* Applies a display filter on the view for a specific set of floor levels.
* It can filter the map display on floor-aware layers by zero or more level IDs.
*/
floors: __esri.Collection<string>;
/** Gamepad input specific configuration settings. */
get gamepad(): __esri.GamepadSettings;
/**
* Allows for adding graphics directly to the default graphics in the View.
* Example:
* ```
* // Adds a graphic to the View
* graphics.add(pointGraphic);
* ```
* Example:
* ```
* // Removes a graphic from the View
* graphics.remove(pointGraphic);
* ```
*/
graphics: __esri.Collection<__esri.Graphic>;
/** Specifies the surface properties for the map. */
ground: __esri.Ground | string;
/**
* The highlights property is a collection of HighlightGroup objects that
* allow you to visually emphasize specific features on the map.
*/
highlights: __esri.Collection<__esri.HighlightOptions>;
/**
* @deprecated
*
* Options for configuring the highlight. Use the highlight method on the
* appropriate esri/views/layers/LayerView to highlight a feature.
* The layerView's `highlightOptions` will take precedence over the MapView's `highlightOptions` if both properties are set.
*/
highlightOptions: __esri.HighlightOptions;
/** Indication whether the view is being interacted with (for example when panning or by an interactive tool). */
get interacting(): boolean;
/**
* Contains indoor positioning system information for the map.
*/
ipsInfo: nullish | __esri.IPSInfo;
/** The ID of a WebMap from ArcGIS Online or ArcGIS Enterprise portal.
*
* To configure the portal url you must set the [`portalUrl` property on `config`](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl) before the `arcgis-map` component loads.
*/
get itemId(): Nil | string;
set itemId(newValue: Nil | string);
/**
* A collection containing a hierarchical list of all the created
* esri/views/layers/LayerView LayerViews of the
* esri/Map#layers operational layers in the map.
*/
readonly layerViews: __esri.Collection<__esri.LayerView>;
/** The magnifier allows for showing a portion of the view as a magnifier image on top of the view. */
readonly magnifier: __esri.Magnifier;
/** An instance of a esri/Map object to display in the view. */
map: __esri.Map;
/** Indication whether the view is being navigated (for example when panning). */
get navigating(): boolean;
/** Options to configure the navigation behavior of the View. */
navigation: __esri.Navigation;
padding: __esri.ViewPadding;
popup: nullish | __esri.Popup;
/**
* Controls whether the popup opens when users click on the view.
*
* @default false
*/
popupDisabled: boolean;
/**
* When `true`, this property indicates whether the view successfully satisfied all dependencies,
* signaling that the following conditions are met.
*/
readonly ready: boolean;
/**
* Defines which anchor stays still while resizing the browser window. The default, `center`,
* ensures the view's center point remains constantly visible as the window size changes. The other
* options allow the respective portion of the view to remain visible when the window's size is changed.
*/
resizeAlign: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
/**
* Represents the current value of one pixel in the unit of the view's spatialReference.
* The value of resolution is calculated by dividing the view's extent width
* by its width.
*/
readonly resolution: number;
/**
* The clockwise rotation of due north in relation to the top of the view in degrees.
* The view may be rotated by directly setting
* the rotation or by using the following mouse event: `Right-click + Drag`.
* Map rotation may be disabled by setting the `rotationEnabled` property
* in [constraints](#constraints) to `false`. See the code snippet below for
* an example of this.
*/
rotation: number;
/**
* Represents the map scale at the center of the view. Setting the scale immediately changes the view. For animating
* the view, see this component's goTo() method.
*/
get scale(): number;
set scale(newValue: number);
/**
* The spatial reference of the view.
* This indicates the projected or geographic coordinate system used
* to locate geographic features in the map.
*/
spatialReference: __esri.SpatialReference;
/** Indication whether the view is animating, being navigated with or resizing. */
get stationary(): boolean;
/** Indicates if the view is visible on the page. */
readonly suspended: boolean;
/**
* This property specifies the base colors used by some widgets
* and components to render graphics and labels.
*/
theme: nullish | __esri.Theme;
/**
* The view's time extent. Time-aware layers display their temporal data that falls within
* the view's time extent. Setting the view's time extent is similar to setting the spatial
* extent because once the time extent is set, the
* view updates automatically to conform to the change.
*/
timeExtent: nullish | __esri.TimeExtent;
/**
* Defines the time zone of the view.
* The time zone property determines how dates and times are represented to the user,
* but the underlying data is unchanged.
*/
timeZone: string;
/**
* Indicates whether the view is being updated by additional data requests to the network,
* or by processing received data.
*/
readonly updating: boolean;
/**
* Represents the current view as a Viewpoint or point of observation on the view.
* Setting the viewpoint immediately changes the current view. For animating
* the view, see this component's goTo() method.
*/
get viewpoint(): __esri.Viewpoint;
set viewpoint(newValue: __esri.Viewpoint);
/**
* Represents the level of detail (LOD) at the center of the view.
* A zoom level (or scale) is a number that defines how large or small the contents of a map appear in a map view.
* Zoom level is a number usually between 0 (global view) and 23 (very detailed view) and is used as a shorthand for predetermined scale values.
* A value of -1 means the view has no LODs.
* When setting the zoom value, the MapView converts it to the corresponding scale, or interpolates it if the zoom is a fractional number.
* MapView can display maps with different projections at a full range of scales, and so use the scale property on this component rather than zoom level.
*
* Setting the zoom immediately changes the current view. For animating the view, see this component's goTo() method.
* Setting this property in conjunction with `center` is a convenient way to set the initial extent of the view.
*/
get zoom(): number;
set zoom(newValue: number);
/** Adds a layer to the map layers collection. */
addLayer(layer: __esri.Layer | Promise<any>, index?: number): Promise<void>;
/** Adds a layer or array of layers to the map layers collection. */
addLayers(layers: __esri.Layer[], index?: number): Promise<void>;
/** Adds a table to the map tables collection. */
addTable(table: __esri.FeatureLayer): Promise<void>;
/** Adds a table or array of tables to the map tables collection. */
addTables(tables: __esri.FeatureLayer[], index?: number): Promise<void>;
/** Closes the popup. */
closePopup(): Promise<void>;
/** Destroys the view, and any associated resources, including its map, popup, and UI elements. */
destroy(): Promise<void>;
/** Sets the view to a given target. */
goTo(target: __esri.GoToTarget2D, options?: __esri.GoToOptions2D): Promise<unknown>;
/** Returns hit test results from each layer that intersects the specified screen coordinates. */
hitTest(screenPoint: __esri.MapViewScreenPoint | MouseEvent, options?: __esri.MapViewHitTestOptions): Promise<__esri.HitTestResult>;
/**
* Opens the popup at the given location with content defined either explicitly with content or driven
* from the PopupTemplate of input features.
*/
openPopup(options?: __esri.PopupViewOpenPopupOptions): Promise<void>;
/** Create a screenshot of the current view. */
takeScreenshot(options?: __esri.MapViewTakeScreenshotOptions): Promise<__esri.Screenshot>;
toMap(screenPoint: __esri.MapViewScreenPoint | MouseEvent): __esri.Point;
toScreen(point: __esri.Point, options?: __esri.ToScreenOptions2D): __esri.MapViewScreenPoint | nullish;
/** Call this method to clear any fatal errors resulting from a lost WebGL context. */
tryFatalErrorRecovery(): Promise<void>;
/** Gets the LayerView created on the view for the given layer. */
whenLayerView(layer: __esri.Layer): Promise<__esri.LayerView>;
/**
* This event is for view related property changes: zoom, scale, center, rotation, extent, camera, viewpoint.
* This event will also emit if stationary toggles from true to false.
*/
readonly arcgisViewChange: TargetedEvent<this, void>;
/** Fires after a user clicks on the view. */
readonly arcgisViewClick: TargetedEvent<this, __esri.ViewClickEvent>;
/** Fires after double-clicking on the view. */
readonly arcgisViewDoubleClick: TargetedEvent<this, __esri.ViewDoubleClickEvent>;
/** Fires during a pointer drag on the view. */
readonly arcgisViewDrag: TargetedEvent<this, __esri.ViewDragEvent>;
/** Fires during a pointer drag on the view. */
readonly arcgisViewHold: TargetedEvent<this, __esri.ViewHoldEvent>;
/** Fires right after a user clicks on the view. */
readonly arcgisViewImmediateClick: TargetedEvent<this, __esri.ViewImmediateClickEvent>;
/** Is emitted after two consecutive immediate-click events. */
readonly arcgisViewImmediateDoubleClick: TargetedEvent<this, __esri.ViewImmediateDoubleClickEvent>;
/** Fires after a keyboard key is pressed. */
readonly arcgisViewKeyDown: TargetedEvent<this, __esri.ViewKeyDownEvent>;
/** Fires after a keyboard key is pressed. */
readonly arcgisViewKeyUp: TargetedEvent<this, __esri.ViewKeyUpEvent>;
/** Fires after each layer in the map has a corresponding LayerView created and rendered in the view. */
readonly arcgisViewLayerviewCreate: TargetedEvent<this, __esri.ViewLayerviewCreateEvent>;
/** Fires when an error emits during the creation of a LayerView after a layer has been added to the map. */
readonly arcgisViewLayerviewCreateError: TargetedEvent<this, __esri.ViewLayerviewCreateErrorEvent>;
/** Fires after a LayerView is destroyed and is no longer rendered in the view. */
readonly arcgisViewLayerviewDestroy: TargetedEvent<this, __esri.ViewLayerviewDestroyEvent>;
/** Fires when a wheel button of a pointing device (typically a mouse) is scrolled on the view. */
readonly arcgisViewMouseWheel: TargetedEvent<this, __esri.ViewMouseWheelEvent>;
/** Fires after a mouse button is pressed, or a finger touches the display. */
readonly arcgisViewPointerDown: TargetedEvent<this, __esri.ViewPointerDownEvent>;
/** Fires after a mouse cursor enters the view, or a display touch begins. */
readonly arcgisViewPointerEnter: TargetedEvent<this, __esri.ViewPointerEnterEvent>;
/** Fires after a mouse cursor leaves the view, or a display touch ends. */
readonly arcgisViewPointerLeave: TargetedEvent<this, __esri.ViewPointerLeaveEvent>;
/** Fires after the mouse or a finger on the display moves. */
readonly arcgisViewPointerMove: TargetedEvent<this, __esri.ViewPointerMoveEvent>;
/** Fires after a mouse button is released, or a display touch ends. */
readonly arcgisViewPointerUp: TargetedEvent<this, __esri.ViewPointerUpEvent>;
/**
* This event is for the `ready` property and will be emitted when the view is ready.
* This event will also emit if the `map` property is changed.
*/
readonly arcgisViewReadyChange: TargetedEvent<this, void>;
readonly _setterTypes: {
center?: __esri.MapView["center"] | Nil | number[] | string;
};
}
export {};