diff --git a/typings.json b/typings.json index 30aea57..f22c5cd 100644 --- a/typings.json +++ b/typings.json @@ -7,6 +7,7 @@ "globalDependencies": { "bluebird": "registry:dt/bluebird#3.0.0+20160811111256", "enzyme": "registry:dt/enzyme#2.4.1+20160709041153", + "heremaps": "registry:dt/heremaps#3.0.12+20160914122306", "jquery": "registry:dt/jquery#1.10.0+20160704162008", "jsdom": "registry:dt/jsdom#2.0.0+20160316155526", "lodash": "registry:dt/lodash#4.14.0+20160817155621", diff --git a/typings/index.d.ts b/typings/index.d.ts index 207606f..ab7a654 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,5 +1,6 @@ /// /// +/// /// /// /// @@ -11,5 +12,4 @@ /// /// /// -/// /// diff --git a/typings/packages/heremaps/heremaps-tests.ts b/typings/packages/heremaps/heremaps-tests.ts deleted file mode 100644 index 3b2e1b5..0000000 --- a/typings/packages/heremaps/heremaps-tests.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Test file for HERE Maps API for JavaScript Definition file -/// - -/** - * EXAMPLE from the HERE Maps API - * Takes a snapshot of the map. - * - * @param {Element} resultContainer Reference to DOM Element to show the captured map area - * @param {H.Map} map Reference to initialized map object - * @param {H.ui.UI} ui Reference to UI component - */ -function capture(resultContainer: HTMLElement, map: H.Map, ui: H.ui.UI) { - // Capturing area of the map is asynchronous, callback function receives HTML5 canvas - // element with desired map area rendered on it. - // We also pass an H.ui.UI reference in order to see the ScaleBar in the output. - // If dimensions are omitted, whole veiw port will be captured - map.capture((canvas: HTMLCanvasElement) => { - if (canvas) { - resultContainer.innerHTML = ''; - resultContainer.appendChild(canvas); - } else { - // For example when map is in Panorama mode - resultContainer.innerHTML = 'Capturing is not supported'; - } - }, [ui], 50, 50, 500, 200); -} - -/** - * Boilerplate map initialization code starts below: - */ -// Step 1: initialize communication with the platform -var platform = new H.service.Platform({ - app_id: 'DemoAppId01082013GAL', - app_code: 'AJKnXv84fjrb0KIHawS0Tg', - useHTTPS: true, - useCIT: true -}); - -var defaultLayers = platform.createDefaultLayers(); - -var mapContainer = document.getElementById('map'); - -// Step 2: initialize a map -var map = new H.Map(mapContainer, defaultLayers.normal.map, { - // initial center and zoom level of the map - zoom: 16, - // Champs-Elysees - center: {lat: 48.869145, lng: 2.314298} -}); - -// Step 3: make the map interactive -// MapEvents enables the event system -// Behavior implements default interactions for pan/zoom (also on mobile touch environments) -var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)); - -// Step 4: Create the default UI -var ui = H.ui.UI.createDefault(map, defaultLayers, 'en-US'); - - -// Step 6: Create "Capture" button and place for showing the captured area -var resultContainer = document.getElementById('panel'); - -// Create container for the "Capture" button -var containerNode = document.createElement('div'); -containerNode.setAttribute('style', - 'position:absolute;top:0;left:0;background-color:#fff; padding:10px;'); -containerNode.className = 'btn-group'; - -// Create the "Capture" button -var captureBtn = document.createElement('input'); -captureBtn.value = 'Capture'; -captureBtn.type = 'button'; -captureBtn.className = 'btn btn-sm btn-default'; - -// Add both button and container to the DOM -containerNode.appendChild(captureBtn); -mapContainer.appendChild(containerNode); - -// Step 7: Handle capture button click event -captureBtn.onclick = function() { - capture(resultContainer, map, ui); -}; \ No newline at end of file diff --git a/typings/packages/heremaps/heremaps.d.ts b/typings/packages/heremaps/heremaps.d.ts deleted file mode 100644 index 8d730f3..0000000 --- a/typings/packages/heremaps/heremaps.d.ts +++ /dev/null @@ -1,6354 +0,0 @@ -// Type definitions for HERE Maps API for JavaScript v3.0.12.4 -// Project: https://developer.here.com/ -// Definitions by: Joshua Efiong -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace H { - /***** Map *****/ - /** - * Map class defines map instance in the application. By creating this object you will initialize a visible map object which is attached to the provided dom element. Map class is an entry point to all operations related to layers, map objects and geo-screen transformations. By specifying options you can initialize map with predefined view. - */ - export class Map extends H.util.EventTarget { - /** - * Constructor - * @param element {Element} - html element into which the map will be rendered - * @param baseLayer {H.map.layer.Layer} - The layer to be used as the base (bottom most) layer. - * @param opt_options {H.Map.Options=} - additional map options - */ - constructor(element: Element, baseLayer: H.map.layer.Layer, opt_options?: H.Map.Options); - - /** - * This method returns the map root html element - * @returns {Element} - */ - getElement(): Element; - - /** - * This method sets the new center on a map. - * @param center {H.geo.IPoint} - requested center to be set - * @param opt_animate {boolean=} - parameter indicates if animated transition should be applied, default is false - * @returns {H.Map} - the instance itself - */ - setCenter(center: H.geo.IPoint, opt_animate?: boolean): H.Map; - - /** - * This method returns currently rendered center of the map. - * @returns {H.geo.Point} - */ - getCenter(): H.geo.Point; - - /** - * This method sets the zoom level on the map. Every zoom level represents different scale i.e map at zoom level 2 is twice as large as the map at zoom level 1. - * @param zoom {number} - requested zoom level - * @param opt_animate {boolean=} - parameter indicates if animated transition should be applied, default is false - * @returns {H.Map} - the instance itself - */ - setZoom(zoom: number, opt_animate?: boolean): H.Map; - - /** - * This method returns currently rendered zoom level. - * @returns {number} - */ - getZoom(): number; - - /** - * This method changes the map zoom while keeping target screen coordinates specified as x,y at the same place where they were before. - * @param zoom {number} - new zoom level - * @param x {number} - map viewport x-axis pixel coordinate - * @param y {number} - map viewport y-axis pixel coordinate - */ - zoomAt(zoom: number, x: number, y: number): void; - - /** - * This method sets the bounding rect to be displayed by the map. Maps display the bounding rect in a way that it fits entirely in the current viewport. - * @param boundingRect {H.geo.Rect} - view bound which should be shown on map - * @param opt_animate {boolean=} - parameter indicates if animated transition should be applied, default is false - * @returns {H.Map} - the instance itself - */ - setViewBounds(boundingRect: H.geo.Rect, opt_animate?: boolean): H.Map; - - /** - * This method returns bounding rect for the current map view. Returned bounding rect defines entire currently viewable area on the screen. - * @returns {H.geo.Rect} - */ - getViewBounds(): H.geo.Rect; - - /** - * Calculates the best CameraModel to show the provided bounding rectangle - * @param rect {H.geo.Rect} - The geographical bounding rectangle to use - * @returns {H.map.ViewModel.CameraData} - The result, represented by the properties zoom (number) and position (geo.Point) - */ - getCameraDataForBounds(rect: H.geo.Rect): H.map.ViewModel.CameraData; - - /** - * This method returns current map viewport. Viewport can be used to modify padding and margin which will reflect the position of the viewport center and the amount of extra data loaded (for margin) - * @returns {H.map.ViewPort} - */ - getViewPort(): H.map.ViewPort; - - /** - * This method returns current view model. View model can be used to modify the current view or camera. H.map.ViewModel - * @returns {H.map.ViewModel} - */ - getViewModel(): H.map.ViewModel; - - /** - * This method returns the map's current layer collection. - * @returns {H.map.DataModel} - */ - getLayers(): H.map.DataModel; - - /** - * This method returns the imprint object for this map. - * @returns {H.map.Imprint} - */ - getImprint(): H.map.Imprint; - - /** - * This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. Origin of coordinate system for capturing is in the top left corner of the viewport. - * @param callback {function(HTMLCanvasElement=)} - Callback function to call once result of the capturing is ready - * @param opt_capturables {Array=} - Collection of "capturable" element(s) to draw into the resulting canvas - * @param opt_x1 {number=} - The X coordinate of the left edge of the capturing rectangle defaults to 0 - * @param opt_y1 {number=} - The Y coordinate of the top edge of the capturing rectangle defaults to 0 - * @param opt_x2 {number=} - The X coordinate of the right edge of the capturing rectangle defaults to viewport width - * @param opt_y2 {number=} - The Y coordinate of the bottom edge of the capturing rectangle defaults to viewport height - */ - capture(callback?: (canvas: HTMLCanvasElement) => void, opt_capturables?: Array, opt_x1?: number, opt_y1?: number, opt_x2?: number, opt_y2?: number): void; - - /** - * This method sets the rendering engine type for the map. Rendering engine is responsible for displaying i.e tiles and data on the map. - * @param type {H.Map.EngineType} - * @returns {H.Map} - the map itself - */ - setEngineType(type: H.Map.EngineType): H.Map; - - /** - * To persistently store the content of a map layer for a given area and range of zoom levels. It can be used to enable map rendering when no internet connection is established and also to reduce the download traffic for frequently visited map areas. - * @param opt_onprogress {function(H.util.Request)=} - A callback which is invoked every time when the progress state of the returned store request changes. - * @param opt_bounds {H.geo.Rect=} - The area to store, default is the current view bounds - * @param opt_min {number=} - The minimum zoom level to store, default is the current zoom level - * @param opt_max {number=} - The maximum zoom level to store, default is the current zoom level - * @param opt_layer {H.map.layer.BaseTileLayer=} - The layer to store, default is the current base layer - * @returns {H.util.Request} - A handle to the created storage request - */ - storeContent(opt_onprogress?: (req: H.util.Request) => void, opt_bounds?: H.geo.Rect, opt_min?: number, opt_max?: number, opt_layer?: H.map.layer.BaseTileLayer): H.util.Request; - - /** - * To clear the entire stored content - * @param opt_onprogress {function(H.util.Request)=} - A callback which is invoked every time when the progress state of the returned clear request changes - * @returns {H.util.Request} - A handle to the created flush request - */ - clearContent(opt_onprogress?: (req: H.util.Request) => void): H.util.Request; - - /** - * This method adds a layer to the map. - * @param layer {H.map.layer.Layer} - The map layer to be added - * @param opt_idx {number=} - index at which the new layer should be inserted - * @returns {H.Map} - current map instance - */ - addLayer(layer: H.map.layer.Layer, opt_idx?: number): H.Map; - - /** - * This method removes layer from the map. - * @param layer {H.map.layer.Layer} - The map layer to be removed - * @returns {H.Map} - current map instance - */ - removeLayer(layer: H.map.layer.Layer): H.Map; - - /** - * This method will set provided layer as base map. The layer will be inserted as the bottom most layer in the map. - * @param layer {H.map.layer.Layer} - The layer to use as base map - * @returns {H.Map} - the instance itself - */ - setBaseLayer(layer: H.map.layer.Layer): H.Map; - - /** - * To get the current base map layer. - * @returns {?H.map.layer.Layer} - */ - getBaseLayer(): H.map.layer.Layer; - - /** - * Returns the screen coordinates according to the given geographical coordinates. This method returns a screen pixel coordinates for the provided geo point. - * @param geoPoint {H.geo.IPoint} - point on the map - * @returns {?H.math.Point} - */ - geoToScreen(geoPoint: H.geo.IPoint): H.math.Point; - - /** - * Returns the geographical coordinates according to the given screen coordinates. - * @param x {number} - map viewport x-axis pixel coordinate - * @param y {number} - map viewport y-axis pixel coordinate - * @returns {?H.geo.Point} - */ - screenToGeo(x: number, y: number): H.geo.Point; - - /** - * Returns the camera data according to the given screen coordinates. Method converts screen pixel coordinates to correct camera data object - * @param x {number} - map viewport x-axis pixel coordinate - * @param y {number} - map viewport y-axis pixel coordinate - * @returns {H.map.ViewModel.CameraData} - */ - screenToCameraData(x: number, y: number): H.map.ViewModel.CameraData; - - /** - * This method adds an map object to the map. Map object can be a marker or a spatial object like polygon or polyline. - * @param mapObject {!H.map.Object} - The map object to add - * @returns {!H.map.Object} - the added map object - */ - addObject(mapObject: H.map.Object): H.map.Object; - - /** - * This method removes previously added map object from the map. - * @param mapObject {!H.map.Object} - The map object to remove - * @returns {!H.map.Object} - the removed map object - */ - removeObject(mapObject: H.map.Object): H.map.Object; - - /** - * This method retrieves the list of all objects which have been added to the map. - * @returns {Array} - the list of all use objects which are currently on the map. - */ - getObjects(): Array; - - /** - * This method adds an array of objects or an object group to the map. - * @param mapObjects {Array} - * @returns {H.Map} - the map instance - */ - addObjects(mapObjects: Array): H.Map; - - /** - * This method removes an array of object or an object group from the map. - * @param mapObjects {(Array | H.map.Group)} - * @returns {H.Map} - the map instance - */ - removeObjects(mapObjects: (Array | H.map.Group)): H.Map; - - /** - * Returns the top most z-ordered map object found under the specific screen coordinates. Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point. - * @param x {number} - map viewport x-axis pixel coordinate - * @param y {number} - map viewport y-axis pixel coordinate - * @returns {?H.map.Object} - the encountered top most map object or null if no object found - */ - getObjectAt(x: number, y: number): H.map.Object; - - /** - * Returns a list of map objects in descending z-order found under the specific screen coordinates. Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point. - * @param x {number} - map viewport x-axis pixel coordinate - * @param y {number} - map viewport y-axis pixel coordinate - * @returns {Array} - */ - getObjectsAt(x: number, y: number): Array; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module Map { - /** - * It defines the number of lower and higher zoom levels, where cached content of the base map is rendered while content of the current zoom level is still loading. Example: if range was set to {lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12. - * @property lower {number} - The number of lower zoom levels to take into account, default is 0 - * @property higher {number} - The number of higher zoom levels to take into account, default is 0 - */ - export interface BackgroundRange { - lower: number; - higher: number; - } - - /** - * Types of engines - */ - export enum EngineType { - P2D, - PANORAMA, - } - - /** - * This type defines options which can be used to initialize the map. - * @property center {H.geo.IPoint=} - The initial center of the map, default is {lat:0, lng: 0} - * @property zoom {number=} - The initial zoom level of the map, default is 0 respectively the minimal zoom level of the base map - * @property bounds {H.geo.Rect=} - The view bounds to be displayed on the map. If provided, it takes precedence over center and zoom. and zoom if provided) - * @property layers {Array=} - A list of layers to render on top of the base map - * @property engineType: {H.Map.EngineType=} - The initial engine type to use, default is P2D - * @property pixelRatio {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 - * @property imprint {H.map.Imprint.Options=} - The imprint options or null to suppress the imprint - * @property renderBaseBackground {H.Map.BackgroundRange=} - Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading. Example: {lower: 3, higher: 2} - * @property autoColor {boolean=} - Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the copyright style will be adjusted. See H.map.layer.Layer.Options#dark - * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map - * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map - * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or padding has been changed, default is true - */ - export interface Options { - center?: H.geo.IPoint; - zoom?: number; - bounds?: H.geo.Rect; - layers?: Array; - engineType?: EngineType; - pixelRatio?: number; - imprint?: H.map.Imprint.Options; - renderBaseBackground?: BackgroundRange; - autoColor?: boolean; - margin?: number; - padding?: H.map.ViewPort.Padding; - fixedCenter?: boolean; - } - } - - /***** clustering *****/ - export module clustering { - /** - * This class represents the input data structure for data points to be clustered. - * @property lat {H.geo.Latitude} - The latitude coordinate of the data point's position - * @property lng {H.geo.Longitude} - The longitude coordinate of the data point's position - * @property wt {number} - The weight of the data point - * @property data {*} - Data associated with this data point - */ - export class DataPoint implements H.geo.IPoint { - /** - * Constructor - * @param lat {H.geo.Latitude} - The latitude coordinate of the data point's position - * @param lng {H.geo.Longitude} - The longitude coordinate of the data point's position - * @param opt_weight {number=} - The weight of the data point as a positive number > 0. If not specified it , default is 1. - * @param opt_data {*=} - Optional data, which will be associated with this DataPoint - */ - constructor(lat: H.geo.Latitude, lng: H.geo.Longitude, opt_weight?: number, opt_data?: any); - - lat: H.geo.Latitude; - lng: H.geo.Longitude; - alt: H.geo.Altitude; - ctx: H.geo.AltitudeContext; - wt: number; - data: any; - } - - /** - * This interface describes a cluster of data points, which fulfill the clustering specification (i.e. data points are within the epsilon and there are enough points to form a cluster). - */ - export interface ICluster { - /** - * Returns the maximum zoom level where this cluster doesn't fall apart into sub clusters and/or noise poinst - * @returns {number} - */ - getMaxZoom(): number; - - /** - * Returns the bounding rectangle of this cluster. - * @returns {H.geo.Rect} - */ - getBounds(): H.geo.Rect; - - /** - * Invokes the specified callback for each "entry" of the cluster. That "entry" can be either a cluster which implements H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface. - * @param callback {function(H.clustering.IResult)} - The callback gets the currently traversed entry as an argument, which is cluster or noise point. - */ - forEachEntry(callback: (result: H.clustering.IResult) => void): void; - - /** - * Invokes the specified callback for each data point which is part of this cluster, even indirectly. - * @param callback {function(H.clustering.INoisePoint)} - The callback gets the currently traversed noise point as argument. - */ - forEachDataPoint(callback: (noise: H.clustering.INoisePoint) => void): void; - - /** - * Returns the geographical position of this cluster result. - * @returns {H.geo.Point} - */ - getPosition(): H.geo.Point; - - /** - * Returns the weight of this cluster result. - * @returns {number} - */ - getWeight(): number; - - /** - * To indicate whether this cluster result is a cluster or noise point - * @returns {boolean} - */ - isCluster(): boolean; - - /** - * Returns the minimum zoom level where this item is not part of another cluster - * @returns {number} - */ - getMinZoom(): number; - } - - /** - * This interface represents a data point which does not belong to a cluster. - */ - export interface INoisePoint { - /** - * This method returns data which coresponds to this noise point. - * @returns {*} - */ - getData(): any; - - /** - * Returns the geographical position of this cluster result. - * @returns {H.geo.Point} - */ - getPosition(): H.geo.Point; - - /** - * Returns the weight of this cluster result. - * @returns {number} - */ - getWeight(): number; - - /** - * To indicate whether this cluster result is a cluster or noise point - * @returns {boolean} - */ - isCluster(): boolean; - - /** - * Returns the minimum zoom level where this item is not part of another cluster - * @returns {number} - */ - getMinZoom(): number; - } - - /** - * This interface represents the result item of a clustering operation. - */ - export interface IResult { - - /** - * Returns the geographical position of this cluster result. - * @returns {H.geo.Point} - */ - getPosition(): H.geo.Point; - - /** - * Returns the weight of this cluster result. - * @returns {number} - */ - getWeight(): number; - - /** - * To indicate whether this cluster result is a cluster or noise point - * @returns {boolean} - */ - isCluster(): boolean; - - /** - * Returns the minimum zoom level where this item is not part of another cluster - * @returns {number} - */ - getMinZoom(): number; - } - - /** - * Interface which specifies the methods a theme must implement. - */ - export interface ITheme { - - /** - * Function returns a cluster presentation as a map object. - * @param cluster {H.clustering.ICluster} - * @returns {H.map.Object} - */ - getClusterPresentation(cluster: H.clustering.ICluster): H.map.Object; - - /** - * Function returns noise point presentation as a map object - * @param noisePoint {H.clustering.INoisePoint} - * @returns {H.map.Object} - */ - getNoisePresentation(noisePoint: H.clustering.INoisePoint): H.map.Object; - } - - /** - * The clustering provider serves clusters and noise point representation for the map depending on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options. - * @property min {number} - Minimum zoom level at which provider can cluster data - * @property max {number} - Maximum zoom level at which provider can cluster data - */ - export class Provider extends H.util.EventTarget { - /** - * Constructor - * @param dataPoints {Array} - * @param opt_options {H.clustering.Provider.Options=} - */ - constructor(dataPoints: Array, opt_options?: H.clustering.Provider.Options); - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - * @param opt_scope {Object=} - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - - /** - * This method sets new data to the provider - * @param dataPoints {Array} - */ - setDataPoints(dataPoints: Array): void; - - /** - * This method adds a data point to the provider. Beware that this method provokes reclustering of the whole data set. - * @param dataPoint {H.clustering.DataPoint} - */ - addDataPoint(dataPoint: H.clustering.DataPoint): void; - - /** - * This method adds a list of data points to the provider. Beware that this method provokes reclustering of the whole data set. - * @param dataPoints {Array} - */ - addDataPoints(dataPoints: Array): void; - - /** - * This method removes a data point from the provider. Beware that this method provokes reclustering of the whole data set. - * @param dataPoint {H.clustering.DataPoint} - */ - removeDataPoint(dataPoint: H.clustering.DataPoint): void; - - /** - * This method returns current theme used for creating cluster visualization - * @returns {H.clustering.ITheme} - */ - getTheme(): H.clustering.ITheme; - - /** - * This method sets new theme on the provider. Calling this method will change visuals for displayed clusters and noise points. - * @param theme {H.clustering.ITheme} - */ - setTheme(theme: H.clustering.ITheme): void; - - /** - * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. - * @returns {boolean} - */ - providesDomMarkers(): boolean; - - /** - * Returns all DomMarker cluster and noise point representations which intersect with the provided rectangular area. - * @param bounds {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestDomMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. - * @returns {boolean} - */ - providesMarkers(): boolean; - - /** - * Returns all cluster and noise point markers which intersect with the provided rectangular area. - * @param bounds {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. - * @returns {boolean} - */ - providesSpatials(): boolean; - - /** - * Returns all polyline, polygon, circle and rect objects which represent cluster and noise points and intersect with the provided area. - * @param bounds {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestSpatials(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Returns the spatial objects which intersect the given tile - * @param tile {H.map.provider.SpatialTile} - The tile for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Returns the accumulate invalidations of this provider's objects that have occurred. - * @returns {H.map.provider.Invalidations} - an invalidations object - */ - getInvalidations(): H.map.provider.Invalidations; - - /** - * To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the given map object and triggers dispatchUpdate() - * @param mapObject {!H.map.Object} - The map object to be invalidated - * @param changes {H.math.BitMask} - The flags indicating the types of occurred changes - */ - invalidateObject(mapObject: H.map.Object, changes: H.math.BitMask): void; - - min: number; - max: number; - } - - export module Provider { - /** - * Options which are used within cluster calculations. - * @property eps {number=} - epsilon parameter for cluster calculation. For the FASTGRID strategy it must not exceed 256 and must take values that are power of 2. For the GRID and DYNAMICGRID strategies it can take values from 10 to 127. Default is 32. - * @property minWeight {number=} - the minimum points weight sum to form a cluster, default is 2 - * @property projection {H.geo.IProjection=} - projection to use for clustering, default is H.geo.mercator - * @property strategy {H.clustering.Provider.Strategy=} - clustering stretegy, defaults to H.clustering.Provider.Strategy.FASTGRID - */ - export interface ClusteringOptions { - eps?: number; - minWeight?: number; - projection?: H.geo.IProjection; - strategy?: H.clustering.Provider.Strategy; - } - - /** - * Options which are used to initialize the clustering Provider - * @property min {number=} - The minimal supported zoom level, default is 0 - * @property max {number=} - The maximal supported zoom level, default is 22 - * @property clusteringOptions {H.clustering.Provider.ClusteringOptions=} - options for clustering algorithm - * @property theme {H.clustering.ITheme=} - cluster and noise point graphical representation - */ - export interface Options { - min?: number; - max?: number; - clusteringOptions?: H.clustering.Provider.ClusteringOptions; - theme?: H.clustering.ITheme; - } - - /** - * Enumeration represents possible clustering strategies. FASTGRID clustering is the efficient way to cluster large sets of data points. GRID clustering is slower but has greater precision due to the bigger range of epsilon values, this strategy suitable for clustering smaller data sets (up to 1000 data points) on desktop devices. DYNAMICGRID clustering uses the same algorithm of clustering as the GRID, but clusters on the viewport basis is meant to be used with data sets that are subject to the frequent update operations. - */ - export enum Strategy { - FASTGRID, - GRID, - DYNAMICGRID, - } - } - } - - /***** data *****/ - export module data { - /** - * An abstract reader class defines interface for data readers and has general functionality related to fetching data and reader events. - */ - export class AbstractReader extends H.util.EventTarget { - /** - * Constructor - * @param opt_url {string=} - */ - constructor(opt_url?: string); - - /** - * Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that contains partial information, and reader will add new parsed objects to the layer's provider later on. - * @returns {H.map.layer.ObjectLayer} - */ - getLayer(): H.map.layer.ObjectLayer; - - /** - * Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently parsed objects if parsing is ongoing. - * @returns {Array} - */ - getParsedObjects(): Array; - - /** - * Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed. - * @returns {(string | undefined)} - url - */ - getUrl(): string | void; - - /** - * Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR. - * @param url {string} - The new URL - * @returns {H.data.AbstractReader} - */ - setUrl(url: string): H.data.AbstractReader; - - /** - * Returns the reader's processing state for possible states see H.data.AbstractReader.State - * @returns {H.data.AbstractReader.State} - */ - getState(): H.data.AbstractReader.State; - - /** - * Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers. - */ - parse(): void; - } - - export module AbstractReader { - /** - * The event class for state events that are dispatched by AbstractReader - */ - export class Event extends H.util.Event { - /** - * Constructor - * @param target {(H.data.AbstractReader | H.map.Object)} - The target that's passed to event listeners - * @param type {string} - The type of the event - * @param state {H.data.AbstractReader.State} - The state of the target firing an event - * @param message {string} - The message associated with an event - */ - constructor(target: (H.data.AbstractReader | H.map.Object), type: string, state: H.data.AbstractReader.State, message: string); - } - - /** - * The state types of an Reader. Possible states are: - */ - export enum State { - ERROR, - LOADING, - VISIT, - READY, - } - } - } - - /***** geo *****/ - export module geo { - /** - * A Geographic coordinate that specifies the height of a point in meters. A value of undefined is treated as 0. - */ - export type Altitude = number; - - /** - * Contexts for altitudes to specify the contextual origin of an altitude's value - */ - export enum AltitudeContext { - /** Ground level */ - undefined, - /** Ground level */ - GL, - /** Obstruction level */ - OL, - /** Mean sea level */ - SL, - /** Sea bed level */ - SB, - /** WGS84 ellipsoid */ - WE, - /** WGS84 geoid */ - WG, - } - - /** - * An interface to represent a geographic point. Every point in geo space is represented by three coordinates latitude, longitude and optional altitude. - * @property lat {H.geo.Latitude} - The latitude coordinate. - * @property lng {H.geo.Longitude} - The longitude coordinate. - * @property alt {H.geo.Altitude=} - The altitude coordinate. - * @property ctx {H.geo.AltitudeContext=} - The altitude context. - */ - export interface IPoint { - lat: H.geo.Latitude; - lng: Longitude; - alt?: H.geo.Altitude; - ctx?: H.geo.AltitudeContext; - } - - export interface IProjection { - latLngToPoint(lat: number, lng: number, opt_out?: H.math.Point): H.math.Point; - xyToGeo(x: number, y: number, opt_out?: H.geo.Point): H.geo.Point; - pointToGeo(point: H.math.IPoint, opt_out?: H.geo.Point): H.geo.Point; - geoToPoint(geoPoint: H.geo.IPoint, opt_out?: H.math.Point): H.math.Point; - } - - /** - * A geographic coordinate that specifies the north-south position of a point on the Earth's surface in the range from -90 to + 90 degrees, inclusive. - */ - export type Latitude = number; - - /** - * A Geographic coordinate that specifies the east-west position of a point on the Earth's surface in the range from -180 to 180 degrees, inclusive. - */ - export type Longitude = number; - - /** - * Class represents a geographical point, which is defined by the latitude, longitude and optional altitude. - * @property lat {H.geo.Latitude} - The latitude coordinate. - * @property lng {H.geo.Longitude} - The longitude coordinate. - * @property alt {H.geo.Altitude} - The altitude coordinate. - * @property ctx {H.geo.AltitudeContext} - The altitude context. - */ - export class Point implements IPoint { - /** - * Constructor - * @property lat {H.geo.Latitude} - The latitude coordinate. - * @property lng {H.geo.Longitude} - The longitude coordinate. - * @property opt_alt {H.geo.Altitude=} - The altitude coordinate. - * @property opt_ctx {H.geo.AltitudeContext=} - The altitude context. - */ - constructor(lat: H.geo.Latitude, lng: Longitude, opt_alt?: H.geo.Altitude, opt_ctx?: H.geo.AltitudeContext); - - /** - * To compare this point with a supplied other point for equality. Two points are considered equal if they have the same lat and lng as well as equivalent values for alt and ctx. - * @param other {H.geo.IPoint} - * @returns {boolean} - Whether the two points are equal. - */ - equals(other: IPoint): boolean; - - /** - * To calculate the distance between this point and the supplied other point. The method uses the Haversine formula. The altitude is not considered. - * @param other {H.geo.IPoint} - * @returns {number} - The distance between the given location and the location supplied by the caller in meters. - */ - distance(other: IPoint): number; - - /** - * This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken. - * @param bearing {number} - The bearing to use in the calculation in degrees. - * @param distance {number} - The distance to the destination in meters. - * @param opt_overGreatCircle {boolean=} - If true the computation uses the 'Great Circle' otherwise 'Rhumb Line'. - * @returns {H.geo.Point} - The calculated point - */ - walk(bearing: number, distance: number, opt_overGreatCircle?: boolean): Point; - - /** - * This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat property is clamped into a range of -90 ... +90 and the value of the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and ctx properties - * @param point {H.geo.IPoint} - The point to validate - * @param opt_caller {Function=} - The caller to use for InvalidArgumentError. If omitted no error is thrown - * @param opt_argNr {number=} - The argument number to use for InvalidArgumentError. - * @returns {boolean} - if the given point could validate - */ - static validate(point: IPoint, opt_caller?: Function, opt_argNr?: number): boolean; - - /** - * This method creates a Point instance from a given IPoint object. - * @param iPoint {H.geo.IPoint} - The IPoint object to use - * @returns {H.geo.Point} - the created Point instance - */ - static fromIPoint(iPoint: IPoint): Point; - - lat: H.geo.Latitude; - lng: H.geo.Longitude; - alt: H.geo.Altitude; - ctx: H.geo.AltitudeContext; - } - - /** - * This class represents a rectangular geographic area. The area is defined by four geographical coordinates two (left, right) longitudes and two (top, bottom) latitudes. - */ - export class Rect { - /** - * Constructor - * @param top {H.geo.Latitude} - the northern-most latitude - * @param left {H.geo.Longitude} - the left-most longitude - * @param bottom {H.geo.Latitude} - the southern-most latitude - * @param right {H.geo.Longitude} - the right-most latitude - */ - constructor(top: H.geo.Latitude, left: H.geo.Longitude, bottom: H.geo.Latitude, right: H.geo.Longitude); - - /** - * To compare this rectangle with a supplied other rectangle for equality. - * @param other {H.geo.Rect} - * @returns {boolean} - Whether the two rectangles are equal. - */ - equals(other: H.geo.Rect): boolean; - - /** - * Toclone this rectangle. - * @returns {H.geo.Rect} - */ - clone(): H.geo.Rect; - - /** - * This method returns the top-left corner of the rectangular area. - * @returns {H.geo.Point} - the top-left corner of the area - */ - getTopLeft(): H.geo.Point; - - /** - * This method returns the bottom-right corner of the rectangular area. - * @returns {H.geo.Point} - the bottom-right corner of the area - */ - getBottomRight(): H.geo.Point; - - /** - * This method returns the north-most latitude of this rectangular area - * @returns {H.geo.Latitude} - the north-most latitude of the area - */ - getTop(): H.geo.Latitude; - - /** - * This method returns the south-most latitude of this rectangular area - * @returns {H.geo.Latitude} - the south-most latitude of the area - */ - getBottom(): H.geo.Latitude; - - /** - * This method returns the left-most longitude of this rectangular area - * @returns {H.geo.Longitude} - the left-most longitude of the area - */ - getLeft(): H.geo.Longitude; - - /** - * This method returns the right-most longitude of this rectangular area - * @returns {H.geo.Longitude} - the right-most longitude of the area - */ - getRight(): H.geo.Longitude; - - /** - * This method returns the center point of this rectangular area - * @returns {H.geo.Point} - the center point of the area - */ - getCenter(): H.geo.Point; - - /** - * Returns this width of this rectangular area in decimal degrees. - * @returns {number} - the width of this area - */ - getWidth(): number; - - /** - * Returns this height of this rectangular area in decimal degrees. - * @returns {number} - the height of this area - */ - getHeight(): number; - - /** - * Returns a boolean value indicating whether this rectangular area spans across the date border. - * @returns {boolean} - true if the area spans across the date border, otherwise false - */ - isCDB(): boolean; - - /** - * The method checks if the area enclosed by the given bounding box is 0. - * @returns {boolean} - true if the dimensions of the area a 0, otherwise false - */ - isEmpty(): boolean; - - /** - * This method checks if the latitude and longitude supplied by the caller lie within the area of this rectangular area. - * @param lat {H.geo.Latitude} - the latitude - * @param lng {H.geo.Longitude} - the longitude - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {boolean} - true if the latitude and longitude are contained in this area, otherwise false - */ - containsLatLng(lat: H.geo.Latitude, lng: H.geo.Longitude, opt_skipValidation?: boolean): boolean; - - /** - * This method checks if the point supplied by the caller lies within the area of this rectangular area. - * @param geoPoint {H.geo.IPoint} - the point - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {boolean} - true if the point is contained in this area, otherwise false - */ - containsPoint(geoPoint: H.geo.IPoint, opt_skipValidation?: boolean): boolean; - - /** - * This method checks if the rectangular area supplied by the caller is completely contained within the area of this rectangular area. - * @param geoRect {H.geo.Rect} - the rectangular area - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {boolean} - true if the rectangular area is contained in this area, otherwise false - */ - containsRect(geoRect: H.geo.Rect, opt_skipValidation?: boolean): boolean; - - /** - * This method returns the smallest bounding box that covers this rectangular area and the latitude and longitude supplied by the caller. - * @param lat {H.geo.Latitude} - the latitude - * @param lng {H.geo.Longitude} - the longitude - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @param opt_out {H.geo.Rect=} - an optional rectangular area to store the result - * @returns {H.geo.Rect} - either the rectangular area passed as out parameter or a new rectangular area - */ - mergeLatLng(lat: H.geo.Latitude, lng: H.geo.Longitude, opt_skipValidation?: boolean, opt_out?: H.geo.Rect): H.geo.Rect; - - /** - * This method returns the smallest bounding box that covers this rectangular area and the point supplied by the caller. - * @param geoPoint {H.geo.IPoint} - the point to merge - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @param opt_out {H.geo.Rect=} - an optional rectangular area to store the result - * @returns {H.geo.Rect} - either the rectangular area passed as out parameter or a new rectangular area - */ - mergePoint(geoPoint: H.geo.IPoint, opt_skipValidation?: boolean, opt_out?: H.geo.Rect): H.geo.Rect; - - /** - * This method returns the smallest bounding box that covers this rectangular area and the rectangular area supplied by the caller. - * @param geoRect {H.geo.Rect} - the point to merge - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @param opt_out {H.geo.Rect=} - an optional rectangular area to store the result - * @returns {H.geo.Rect} - either the rectangular area passed as out parameter or a new rectangular area - */ - mergeRect(geoRect: H.geo.Rect, opt_skipValidation?: boolean, opt_out?: H.geo.Rect): H.geo.Rect; - - /** - * This method returns the smallest bounding box that covers this rectangular area and the rectangular area supplied by the caller. - * @param top {H.geo.Latitude} - The top latitude of the rectangle to merge - * @param left {H.geo.Longitude} - The left longitude of the rectangle to merge - * @param bottom {H.geo.Latitude} - The bottom latitude of the rectangle to merge - * @param right {H.geo.Longitude} - The right longitude of the rectangle to merge - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @param opt_out {H.geo.Rect=} - an optional rectangular area to store the result - * @returns {H.geo.Rect} - either the rectangular area passed as out parameter or a new rectangular area - */ - mergeTopLeftBottomRight(top: H.geo.Latitude, left: H.geo.Longitude, bottom: H.geo.Latitude, right: H.geo.Longitude, opt_skipValidation?: boolean, opt_out?: H.geo.Rect): H.geo.Rect; - - /** - * This method checks if the intersection of two bounding boxes is non-empty. - * @param geoRect {H.geo.Rect} - a rectangular area to be tested for intersection with this rectangular area - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {boolean} - a boolean value indicating whether the two areas intersect - */ - intersects(geoRect: H.geo.Rect, opt_skipValidation?: boolean): boolean; - - /** - * This method merges two rects by their values. The result of the merge is a bounding rect which covers all provided rect bounds. - * @param topA {H.geo.Latitude} - the northern-most latitude - * @param leftA {H.geo.Longitude} - the left-most longitude of operand A - * @param bottomA {H.geo.Latitude} - the southern-most latitude of operand A - * @param rightA {H.geo.Longitude} - the right-most latitude of operand A - * @param topB {H.geo.Latitude} - the northern-most latitude of operand B - * @param leftB {H.geo.Longitude} - the left-most longitude of operand B - * @param bottomB {H.geo.Latitude} - the southern-most latitude of operand B - * @param rightB {H.geo.Longitude} - the right-most latitude of operand B - * @param opt_out {H.geo.Rect=} - an optional rect to store the results - * @returns {H.geo.Rect} - either the opt_out rect or a new rect - */ - static merge(topA: H.geo.Latitude, leftA: H.geo.Longitude, bottomA: H.geo.Latitude, rightA: H.geo.Longitude, topB: H.geo.Latitude, leftB: H.geo.Longitude, bottomB: H.geo.Latitude, rightB: H.geo.Longitude, opt_out?: H.geo.Rect): H.geo.Rect; - - /** - * This method creates a rectangular area from a top-left and bottom-right point pair. - * @param topLeft {H.geo.IPoint} - the top-left corner of the area - * @param bottomRight {H.geo.IPoint} - the bottom-right corner of the area - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {H.geo.Rect} - returns the rectangular area defined by the top-left and bottom-right corners - */ - static fromPoints(topLeft: H.geo.IPoint, bottomRight: H.geo.IPoint, opt_skipValidation?: boolean): H.geo.Rect; - - /** - * This method creates the minimum rectangular area covering all of the points in the argument array. - * @param pointArray {Array} - the array of points to cover - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {H.geo.Rect} - returns the minimum rectangular area covering the points or null if no point is covered - */ - static coverPoints(pointArray: Array, opt_skipValidation?: boolean): H.geo.Rect; - - /** - * This method creates the minimum rectangular area covering all of the coordinates in the argument array. - * @param latLngAltArray {Array} - the array of coordinates to cover - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the coordinates - */ - static coverLatLngAlts(latLngAltArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; - - /** - * This method creates the minimum rectangular area covering all of the rectangular areas in the argument array. - * @param rectArray {Array} - the array of points to cover - * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments - * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the rectangular areas - */ - static coverRects(rectArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; - - /** - * This method clones the given bounding rect and resizes the clone if necessary until the location supplied by the caller is at its center. - * @param center {H.geo.IPoint} - a point which is to be the center of the resized rectangular area - * @param opt_out {H.geo.Rect=} - an optional rectangular area to store the result - * @returns {H.geo.Rect} - the resized rectangular area - */ - resizeToCenter(center: H.geo.IPoint, opt_out?: H.geo.Rect): H.geo.Rect; - } - - /** - * A strip is a flat list of latitude, longitude, altitude tuples in a fixed order. - */ - export class Strip { - /** - * Constructor - * @param opt_latLngAlts {Array=} - An optional array of latitude, longitude and altitude triples to initialize the strip with. - * @param opt_ctx {H.geo.AltitudeContext=} - An optional altitude context for all altitudes contained in this strip. - */ - constructor(opt_latLngAlts?: Array, opt_ctx?: H.geo.AltitudeContext); - - /** - * This method pushes a lat, lng, alt to the end of this strip. - * @param lat {H.geo.Latitude} - * @param lng {H.geo.Longitude} - * @param alt {H.geo.Altitude} - */ - pushLatLngAlt(lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude): void; - - /** - * This method splices the strip at the provided index, removing the specified number of items at that index and inserting the lat, lng, alt array. - * @param index {number} - The index at which to splice - * @param opt_nRemove {number=} - The number of lat, lng, alt values to remove - * @param opt_latLngAlts {Array=} - The lat, lng, alt values to add - * @returns {Array} - an array of removed elements - */ - spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: Array): Array; - - /** - * This method inserts one set of lat, lng, alt values into the strip at the specified index. - * @param index {number} - the index at which to add the element - * @param lat {H.geo.Latitude} - the latitude to insert - * @param lng {H.geo.Longitude} - the longitude to insert - * @param alt {H.geo.Altitude} - the altitude to insert - */ - insertLatLngAlt(index: number, lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude): void; - - /** - * This method removes one set of lat, lng, alt values from the strip at the specified index. - * @param index {number} - */ - removeLatLngAlt(index: number): void; - - /** - * This method pushes the lat, lng, alt values of a H.geo.Point to the end of this strip. - * @param geoPoint {H.geo.IPoint} - */ - pushPoint(geoPoint: H.geo.IPoint): void; - - /** - * This method inserts the lat, lng, alt values of a H.geo.Point into the list at the specified index. - * @param pointIndex {number} - * @param geoPoint {H.geo.IPoint} - */ - insertPoint(pointIndex: number, geoPoint: H.geo.IPoint): void; - - /** - * This method removes one set of lat, lng, alt values from this strip at the virtual point index specified. - * @param pointIndex {number} - the virtual point index - */ - removePoint(pointIndex: number): void; - - /** - * This method extracts a H.geo.Point from this strip at the virtual point index. If the extracted point has an alt value, the strip's altitude context will be supplied to the point. - * @param pointIndex {number} - the virtual point index in the strip - * @param opt_out {H.geo.Point=} - an optional point object to store the lat, lng, alt values - * @returns {H.geo.Point} - returns either the 'opt_out' point object or a new point object. - */ - extractPoint(pointIndex: number, opt_out?: H.geo.Point): H.geo.Point; - - /** - * This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point index as arguments. - * @param eachFn {function(H.geo.Latitude, H.geo.Longitude, H.geo.Altitude, number)} - the function to be called for each 3 elements - * @param opt_start {number=} - an optional start index to iterate from - * @param opt_end {number=} - an optional end index to iterate to - */ - eachLatLngAlt(eachFn: (lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude, n: number) => void, opt_start?: number, opt_end?: number): void; - - /** - * This method returns the number of times that legs in this strip cross the date border. - * @param opt_closed {boolean=} - indicates whether the strip is closed (i.e. whether the strip's last and first coordinates form the closing leg of a polygon) - * @returns {number} - the amount of times this strip crosses the date border. - */ - getDBCs(opt_closed?: boolean): number; - - /** - * This method return the number of points stored in this strip. - * @returns {number} - the number of points in this strip - */ - getPointCount(): number; - - /** - * This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can destroy the integrity of this strip. Use it only for read access. - * @returns {Array} - returns the raw lat, lng, alt values of this strip - */ - getLatLngAltArray(): Array; - - /** - * This method returns the bounding box of this strip. - * @returns {?H.geo.Rect} - this strip's bounding rectangle - */ - getBounds(): H.geo.Rect; - - /** - * This method checks whether two longitudes form a leg which crosses the date border. - * @param lng1 {H.geo.Longitude} - the start longitude of the leg - * @param lng2 {H.geo.Longitude} - the end longitude of the leg - * @returns {boolean} - true if the leg crosses the date border, otherwise false - */ - static isDBC(lng1: H.geo.Longitude, lng2: H.geo.Longitude): boolean; - - /** - * This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even length with the format [lat, lng, lat, lng, ...]. - * @param latLngs {Array} - the array of lat, lng value. - * @returns {H.geo.Strip} - the strip containing the lat, lng values - */ - static fromLatLngArray(latLngs: Array): H.geo.Strip; - } - } - - /***** lang *****/ - - /***** map *****/ - export module map { - /** - * This class represents marker, which offers a means of identifying a location on the map with an icon. - */ - export class AbstractMarker extends H.map.Object { - /** - * Constructor - * @param position {H.geo.IPoint} - The location of this marker - * @param opt_options {H.map.AbstractMarker.Options=} - The values to initialize this marker - */ - constructor(position: H.geo.IPoint, opt_options?: H.map.AbstractMarker.Options); - - /** - * This method returns this marker's current position. - * @returns {H.geo.Point} - current marker geo position - */ - getPosition(): H.geo.Point; - - /** - * This method sets the marker's current position. - * @param position {H.geo.IPoint} - * @returns {H.map.AbstractMarker} - the marker itself - */ - setPosition(position: H.geo.IPoint): H.map.AbstractMarker; - - /** - * Returns this marker's current icon. - * @returns {!(H.map.Icon | H.map.DomIcon)} - */ - getIcon(): (H.map.Icon | H.map.DomIcon); - - /** - * Sets the marker's current icon. - * @param icon {!(H.map.Icon | H.map.DomIcon)} - The new marker icon - * @returns {H.map.AbstractMarker} - the marker itself - */ - setIcon(icon: (H.map.Icon | H.map.DomIcon)): H.map.AbstractMarker; - } - - export module AbstractMarker { - /** - * Options used to initialize a AbstractMarker - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property icon {(H.map.Icon | H.map.DomIcon)=} - The icon to use for the visual representation, if omitted a default icon is used. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - */ - export interface Options { - min?: number; - max?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - icon?: H.map.Icon | H.map.DomIcon; - data?: any; - } - } - - /** - * This class represents style attributes for arrows to be rendered along a polyline. A ArrowStyle instance is always treated as immutable to avoid inconstiencies and must not modified. - */ - export class ArrowStyle { - /** - * Constructor - * @param opt_options {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} - */ - constructor(opt_options?: (H.map.ArrowStyle | H.map.ArrowStyle.Options)); - - /** - * This method checks value-equality with another arrow style. - * @param other {(H.map.ArrowStyle | H.map.ArrowStyle.Options)} - the arrow style to compare with - * @returns {boolean} - true if the arrow styles are value-equal, otherwise false - */ - equals(other: (H.map.ArrowStyle | H.map.ArrowStyle.Options)): boolean; - } - - export module ArrowStyle { - /** - * An object type to specify the style of arrows to render along a polyline - * @property fillColor {string=} - The CSS color value used to fill the arrow shapes. If omitted or the value evaluates to false it defaults to "rgba(255, 255, 255, 0.75)" - * @property width {number=} - The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. If omitted or the value is <= 0 it defaults to 1.2 - * @property length {number=} - The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn. If omitted or the value is <= 0 it defaults to 1.6 - * @property frequency {number=} - The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows. If omitted or the value is false it defaults to 5 - */ - export interface Options { - fillColor?: string; - width?: number; - length?: number; - frequency?: number; - } - } - - /** - * A Polygon with a circular shape. - */ - export class Circle extends H.map.Polygon { - /** - * Constructor - * @param center {H.geo.IPoint} - The geographical coordinates of the circle's center - * @param radius {number} - The radius of the circle in meters - * @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle - please see - */ - constructor(center: H.geo.IPoint, radius: number, opt_options?: H.map.Circle.Options); - - /** - * To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter immediately afterwards. - * @param center {H.geo.IPoint} - */ - setCenter(center: H.geo.IPoint): void; - - /** - * To get the center point of this circle You must not modify the returned Point instance without calling setCenter immediately afterwards. - * @returns {H.geo.Point} - */ - getCenter(): H.geo.Point; - - /** - * To set the length of the radius of the circle in meters. The value is clamped to the of {@code[0 ... 20015089.27787877]} (half WGS84 mean circumference) - * @param radius {number} - */ - setRadius(radius: number): void; - - /** - * To get the length of the radius of the circle in meters. - * @returns {number} - */ - getRadius(): number; - - /** - * To set the precision of this circle {@see H.map.Circle.Options#precision} - * @param precision {number} - */ - setPrecision(precision: number): void; - - /** - * To get the precision value of this circle - * @returns {number} - */ - getPrecision(): number; - } - - export module Circle { - /** - * @property style {H.map.SpatialStyle=} - the style to be used when tracing the polyline - * @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true - * @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth circle. - * @property zIndex {number=} - The z-index value of the circle, default is 0 - * @property min {number=} - The minimum zoom level for which the circle is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the circle is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData - */ - export interface Options { - style?: H.map.SpatialStyle | H.map.SpatialStyle.Options; - visibility?: boolean; - precision?: number; - zIndex?: number; - min?: number; - max?: number; - provider?: H.map.provider.Provider; - data?: any; - } - } - - /** - * The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. The class listens to 'update' events from layers and dispatches them to the RenderEngine. - */ - export class DataModel extends H.util.OList { - /** - * Constructor - * @param opt_layers {Array=} - array of layers to be added to the data model - */ - constructor(opt_layers?: Array); - } - - /** - * A visual representation of the H.map.DomMarker. - */ - export class DomIcon { - /** - * Constructor - * @param element {!(Element | string)} - The element or markup to use for this icon - * @param opt_options {H.map.DomIcon.Options=} - */ - constructor(element: (Element | string), opt_options?: H.map.DomIcon.Options); - } - - export module DomIcon { - /** - * Options used to initialize a DomIcon - * @property onAttach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked before a clone of the icon's element is appended and displayed on the map. This callback can be used to setup the clone. - * @property onDetach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked after a clone of the icon's element is removed from the map. This callback can be used to clean up the clone. - */ - export interface Options { - onAttach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; - onDetach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; - } - } - - /** - * A marker with a visual representation in the form of a full styleable and scripteable DOM element. DomMarker are predestinated if small amounts of markers with dynamic styled and/or scripted icons should be displayed om the map (e.g. animated interactive SVG). - */ - export class DomMarker extends H.map.AbstractMarker { - /** - * Constructor - * @param position {H.geo.IPoint} - * @param opt_options {H.map.DomMarker.Options=} - */ - constructor(position: H.geo.IPoint, opt_options?: H.map.DomMarker.Options); - } - - export module DomMarker { - /** - * Options used to initialize a DomMarker - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property icon {H.map.DomIcon=} - The icon to use for the visual representation, if omitted a default icon is used. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData - */ - export interface Options { - min?: number; - max?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - icon?: H.map.DomIcon; - data?: any; - } - } - - /** - * This class represents a spatial shape in geographic space. It is defined by a path containing the vertices of the shape (lat, lng, alt values). - */ - export class GeoShape extends H.map.Spatial { - /** - * Constructor - * @param isClosed {boolean} - Indicates whether this geographical shape is closed (a polygon) - * @param strip {H.geo.Strip} - The strip describing the shape of the spatial object - * @param options {H.map.Spatial.Options} - The options to apply - */ - constructor(isClosed: boolean, strip: H.geo.Strip, options: H.map.Spatial.Options); - - /** - * This method returns the strip which represents the shape of the spatial object. - * @returns {H.geo.Strip} - the strip - */ - getStrip(): H.geo.Strip; - - /** - * This method sets the geo-information for the spatial object - * @param strip {?H.geo.Strip} - The strip which represents the shape of the spatial object. - * @returns {H.map.GeoShape} - the Spatial instance itself - */ - setStrip(strip: H.geo.Strip): H.map.GeoShape; - - /** - * This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points of the spatial object. - * @returns {H.geo.Rect} - */ - getBounds(): H.geo.Rect; - } - - /** - * This class represents a map object which can contain other map objects. It's visibility, zIndex and object-order influences the contained map objects - */ - export class Group extends H.map.Object { - /** - * Constructor - * @param opt_options {H.map.Group.Options=} - an optional object containing initialization values - */ - constructor(opt_options?: H.map.Group.Options); - - /** - * - * @param callback {function(!H.map.Object, number, !H.map.Group)} - * @param opt_recursive {boolean=} - Indicates whether sub groups should be traversed recursively - * @param opt_context {*=} - The context to use as "this" within the callback - */ - forEach(callback: (object: H.map.Object, n: number, group: H.map.Group) => void, opt_recursive?: boolean, opt_context?: any): void; - - /** - * To get a list of all objects of this group. On groups with many chilren this method can cause a higher memory and CPU consumption. Alternatively you case use H.map.Group#forEach - * @param opt_recursive {boolean=} - Indicates whether objects in sub-groups are also collected . - * @returns {!Array} - */ - getObjects(opt_recursive?: boolean): Array; - - /** - * Method returns the bounding rectangle for the group. The rectangle is the smallest rectangle that covers all objects. If group doesn't contains objects method returns null. - * @returns {H.geo.Rect} - geo ractangle that covers all objects in the group - */ - getBounds(): H.geo.Rect; - - /** - * To add an object to this group. - * @param object {!H.map.Object} - * @returns {!H.map.Object} - a reference to the appended object - */ - addObject(object: H.map.Object): H.map.Object; - - /** - * Appends a list of objects to this group - * @param objects {Array} - */ - addObjects(objects: Array): void; - - /** - * Removes an object from this group. - * @param object {!H.map.Object} - The object to remove - * @returns {!H.map.Object} - a reference to the removed object - */ - removeObject(object: H.map.Object): H.map.Object; - - /** - * Removes objects from this group. - * @param objects {!Array} - The list of objects to remove - */ - removeObjects(objects: Array): void; - - /** - * Method removes all objects from the group. - */ - removeAll(): void; - } - - export module Group { - /** - * Options used to initialize a group - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property visibility {boolean=} - Indicates whether the map object is visible, default is true - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - * @property objects {Array=} - A list of map objects to add initially to this group. - */ - export interface Options { - min?: number; - max?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - data?: any; - objects?: Array; - } - } - - /** - * This class represents an area that objects, like a marker, occupies in the screen space, meaning that object can be probed and returned by H.Map@getObjectsAt method. - */ - export class HitArea { - /** - * Constructor - * @param shapeType {H.map.HitArea.ShapeType} - The shape type of the HitArea - * @param opt_values {Array=} - The type-dependent values to define the shape of the hit area. The format for the different types are: - */ - constructor(shapeType: H.map.HitArea.ShapeType, opt_values?: Array); - } - - export module HitArea { - /** - * Enumeration represents possible shape types that HitArea can have. - */ - export enum ShapeType { - NONE, - RECT, - CIRCLE, - POLYGON, - } - } - - /** - * Control interface defines method which are used for direct view or camera manipulation - */ - export interface IControl { - - /** - * This method starts control action for camera. This action allows to control camera animation and movement according to provided values in the H.map.IControl#control function - * @param opt_kinetics {H.util.kinetics.IKinetics=} - kinetics settings - * @param opt_atX {number=} - control starts at x screen coordinate - * @param opt_atY {number=} - control starts at y screen coordinate - */ - startControl(opt_kinetics?: H.util.kinetics.IKinetics, opt_atX?: number, opt_atY?: number): void; - - /** - * This method triggers single control action on engine. This will trigger an animation which will start modification of the view's or camera's properties according to values begin set. Modification will occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to a distance to next zoom level. - * @param moveX {number} - moves the view/cam in right/left direction - * @param moveY {number} - moves the view/cam in bottom/top direction - * @param moveZ {number} - moves the view/cam in depth direction (changes zoom level) - * @param angleX {number} - rotates cam over x-axis - * @param angleY {number} - rotates cam over y-axis - * @param angleZ {number} - rotates cam over z-axis - * @param zoom {number} - changes current zoom level (for view works as moveZ) - * @param opt_timestamp {number=} - */ - control(moveX: number, moveY: number, moveZ: number, angleX: number, angleY: number, angleZ: number, zoom: number, opt_timestamp?: number): void; - - /** - * This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can prevent kinetics as well as it can adjust the final view if the adjust function is being passed. - * @param opt_preventKinetics {boolean=} - if set to true will prevent kinetics animation - * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - user defined function which can adjust the final view this function takes last requestedData from the view model and should return a modified H.map.ViewModel.CameraData which will be set as the final view - */ - endControl(opt_preventKinetics?: boolean, opt_adjustView?: (data: H.map.ViewModel.CameraData) => void): void; - } - - /** - * An interface to specify a copyright note - * @property label {string} - A short textual representation of the copyright note, e.g. "DigitalGlobe 2009" - * @property alt {string} - A detailed textual representation of the copyright note, e.g. "copyright 2009 DigitalGlobe, Inc." - */ - export interface ICopyright { - label: string; - alt: string; - } - - /** - * Interface describes interaction with the view port. Interaction will reflect view change depending on the interaction coordinates passed and the modifiers which specify the type of interaction. - */ - export interface IInteraction { - /** - * This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse grab, or touch start. - * @param modifiers {number} - a bitmask which specifies what operations should performed during every interaction - * @param opt_kinetics {H.util.kinetics.IKinetics=} - specifies kinetic move at the end of interaction - */ - startInteraction(modifiers: H.math.BitMask, opt_kinetics?: H.util.kinetics.IKinetics): void; - - /** - * This method resolves direct screen (view port) interaction. This function will modify the current view according to values passed in. - * @param x {number} - viewport x coordinate - * @param y {number} - viewport y coordinate - * @param opt_bx {number=} - x coordinate for second pointer/touch if present - * @param opt_by {number=} - y coordinate for secong pointer/touch if present - * @param opt_timestamp {number=} - known timestamp which should be passed - */ - interaction(x: number, y: number, opt_bx?: number, opt_by?: number, opt_timestamp?: number): void; - - /** - * This method ends interaction and applies kinetic movement if defined by using startInteraction method - * @param opt_preventKinetics {boolean=} - if set to true will prevent kinetics behaviour at the end of interaction - */ - endInteraction(opt_preventKinetics?: boolean): void; - } - - /** - * A visual representation of the H.map.Marker. - */ - export class Icon { - /** - * Constructor - * @param bitmap {!(string | HTMLImageElement | HTMLCanvasElement)} - Either an image URL, a SVG markup, an image or a canvas. - * @param opt_options {H.map.Icon.Options=} - */ - constructor(bitmap: (string | HTMLImageElement | HTMLCanvasElement), opt_options?: H.map.Icon.Options); - - /** - * Returns the icon's bitmap loading state - * @returns {H.map.Icon.prototype.State} - */ - getState(): H.map.Icon.State; - - /** - * Returns the bitmap of this icon or null if the bitmap is not ready yet (see H.map.Icon#getState) - * @returns {?(HTMLImageElement | HTMLCanvasElement)} - */ - getBitmap(): (HTMLImageElement | HTMLCanvasElement); - - /** - * Returns the size of this icon or null if a size wasn't specified in the constructor's options and the state of this icon is not H.map.Icon.prototype.State.READY - * @returns {?H.math.Size} - */ - getSize(): H.math.Size; - - /** - * Returns the anchor point of this icon or null if an anchor wasn't specified in the constructor's options and the state of this icon is not H.map.Icon.prototype.State.READY. - * @returns {?H.math.Point} - */ - getAnchor(): H.math.Point; - - /** - * Returns the hit area of the icon. - * @returns {?H.map.HitArea} - icon's anchor point - */ - getHitArea(): H.map.HitArea; - - /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. - * @param type {string} - name of event - * @param handler {Function} - event handler function - * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) - * @param opt_scope {Object=} - scope for the handler function - */ - addEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; - - /** - * This method will removed previously added listener from the event target - * @param type {string} - name of event - * @param handler {Function} - previously added event handler - * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) - * @param opt_scope {Object=} - scope for the handler function - */ - removeEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module Icon { - /** - * The state types of an Icon - */ - export enum State { - ERROR, - LOADING, - READY, - } - - /** - * Options used to initialize a Icon - * @property size {H.math.ISize=} - The icon's size in pixel, default is the bitmap's natural size - * @property anchor {H.math.IPoint=} - The anchorage point in pixel, default is bottom-center - * @property hitArea {H.map.HitArea=} - The area to use for hit detection, default is the whole rectangular area - * @property asCanvas {H.map.HitArea=} - Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering performance but it could also cause a higher memory consumption. - * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is false. The option is ignored by IE9-10. - */ - export interface Options { - size?: H.math.ISize; - anchor?: H.math.IPoint; - hitArea?: H.map.HitArea; - asCanvas?: H.map.HitArea; - crossOrigin: boolean; - } - } - - /** - * This class encapsulates the brand, copyright and terms of use elements on the map. - */ - export class Imprint { - /** - * Constructor - * @param map {H.Map} - The map where the imprint is attached to - * @param opt_options {H.map.Imprint.Options=} - The options to style the imprint - */ - constructor(map: H.Map, opt_options?: H.map.Imprint.Options); - - /** - * To set the imprint options. If no opt_options argument is defined then all values are reset to their defaults. - * @param opt_options {H.map.Imprint.Options=} - The options to style the imprint - */ - setOptions(opt_options?: H.map.Imprint.Options): void; - - /** - * This method retrieves the copyright string for the current view of the map. - * @returns {string} - The copyright string for the current map view - */ - getCopyrights(): string; - - /** - * To get the CSS style declaration of the imprint DOM element - * @returns {CSSStyleDeclaration} - */ - getStyle(): CSSStyleDeclaration; - - /** - * Method adds a callback which will be triggered when the object is disposed - * @param callback {Function} - * @param opt_scope {Object=} - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - - /** - * This method is used to capture the element view - * @param canvas {HTMLCanvasElement} - HTML Canvas element to draw the view of the capturable element - * @param pixelRatio {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 - * @param callback {function(HTMLCanvasElement=)} - Callback function to call once result of the capturing is ready - * @param opt_errback {function(string)=} - Callback function to call if error occurred during capturing - */ - capture(canvas: HTMLCanvasElement, pixelRatio: number, callback?: (canvas: HTMLCanvasElement) => void, opt_errback?: (s: string) => void): void; - } - - export module Imprint { - /** - * Options to style an imprint - * @property invert {boolean=} - Indicates whether the logo is inverted. If omitted the current value remains, default is false. - * @property font {string=} - The font of the text. If omitted the current value remains, default is "11px Arial,sans-serif". - * @property href {string=} - The URL of the "Terms of use" link. If omitted the current value remains, default is "http://here.com/terms". - */ - export interface Options { - invert?: boolean; - font?: string; - href?: string; - } - } - - /** - * A marker with a visual representation in the form of a bitmap icon. Marker are predestinated if large amounts of markers with static icons should be displayed om the map. - */ - export class Marker extends H.map.AbstractMarker { - /** - * Constructor - * @param position {H.geo.IPoint} - The location of this marker - * @param opt_options {H.map.Marker.Options=} - The values to initialize this marker - */ - constructor(position: H.geo.IPoint, opt_options?: H.map.Marker.Options); - } - - export module Marker { - /** - * Options used to initialize a Marker - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property icon {H.map.Icon=} - The icon to use for the visual representation, if omitted a default icon is used. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - */ - export interface Options { - min?: number; - max?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - icon?: H.map.Icon; - data?: any; - } - } - - /** - * This class represents the abstract base class for map objects such as polylines, polygons, markers, groups etc. - */ - export class Object extends H.util.EventTarget { - /** - * Constructor - * @param opt_options {H.map.Object.Options=} - The values to initialize this object - */ - constructor(opt_options?: H.map.Object.Options); - - /** - * Returns the ID of this object. - * @returns {*} - */ - getId(): any; - - /** - * Sets the visibility of this object. - * @param opt_visibility {boolean=} - Indicates whether this map object should be visible. - * @returns {H.map.Object} - returns this object - */ - setVisibility(opt_visibility?: boolean): H.map.Object; - - /** - * Returns the visibility of this object. - * @param opt_effective {boolean=} - Indicates that the effective visibility is requested. In this case the visibility of all possible ancestor groups is also taken into account - * @returns {boolean} - */ - getVisibility(opt_effective?: boolean): boolean; - - /** - * Returns the z-index of this object. - * @returns {(number | undefined)} - */ - getZIndex(): number | void; - - /** - * To set the-index of this object. - * @param zIndex {(number | undefined)} - * @returns {H.map.Object} - returns this object - */ - setZIndex(zIndex?: number): H.map.Object; - - /** - * Compares two objects regarding their z-order, useful to sort a list of objects via Array's sort() method - * @param first {H.map.Object} - The first object to compare - * @param second {H.map.Object} - The second object to compare - * @returns {number} - If less then 0 the first object has a lower z-order. If equal 0 booth objects have the same z-order. If greater then 0 the first object has a higher z-order. - */ - static compareZOrder(first: H.map.Object, second: H.map.Object): number; - - /** - * Returns the parent group which contains this object or null if the object is not contained by any group. - * @returns {?H.map.Group} - */ - getParentGroup(): H.map.Group; - - /** - * The root object in which this object is attached or the object itself. - * @returns {!H.map.Object} - */ - getRootGroup(): H.map.Object; - - /** - * Checks whether the given object is an inclusive descendant of this object - * @param object {*} - The object that's being compared against. - * @returns {boolean} - */ - contains(object: any): boolean; - - /** - * The current provider of this object - * @returns {?H.map.provider.ObjectProvider} - the current provider - */ - getProvider(): H.map.provider.ObjectProvider; - - /** - * Returns the invalidations of this object - * @returns {H.map.provider.Invalidations} - an invalidation object - */ - getInvalidations(): H.map.provider.Invalidations; - - /** - * This method invalidates this map object. - * @param flags {H.math.BitMask} - The flags indicating the types of occurred changes - * @returns {boolean} - indicates whether a validtion was executed (only if the object has a provider) - */ - invalidate(flags: H.math.BitMask): boolean; - - /** - * This method returns previously stored arbitrary data from this object. - * @returns {*} - the previously stored data or undefined if not data was stored. - */ - getData(): any; - - /** - * This method stores arbitrary data with this map object - * @param data {*} - the data to be stored - * @returns {H.map.Object} - returns this map object instance - */ - setData(data: any): H.map.Object; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module Object { - /** - * Options used to initialize a map object - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - */ - export interface Options { - min?: number; - max?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - data?: any; - } - - /** - * The major types of map objects - */ - export enum Type { - /** spatial object */ - ANY, - /** spatial object */ - OVERLAY, - /** spatial object */ - SPATIAL, - /** Marker object */ - MARKER, - /** DomMarker object */ - DOM_MARKER, - /** DomMarker object */ - GROUP, - } - } - - /** - * This class represents an overlay, which offers a bitmap that covers a geographical reactangular area on the map. - */ - export class Overlay extends H.map.Object { - /** - * Constructor - * @param bounds {H.geo.Rect} - The geographical reactangular area of this overlay - * @param bitmap {!(string | HTMLImageElement | HTMLCanvasElement)} - Either an image URL, a SVG markup, an image or a canvas. - * @param opt_options {H.map.Overlay.Options=} - Optional values values to initialize this overlay - */ - constructor(bounds: H.geo.Rect, bitmap: (string | HTMLImageElement | HTMLCanvasElement), opt_options?: H.map.Overlay.Options); - - /** - * This method returns this overlay's current bounds. - * @returns {H.geo.Rect} - */ - getBounds(): H.geo.Rect; - - /** - * This method sets the overlay's current bounds. - * @param bounds {H.geo.Rect} - * @returns {H.map.Overlay} - the overlay itself - */ - setBounds(bounds: H.geo.Rect): H.map.Overlay; - - /** - * Returns this overlay's current bitmap. - * @returns {?(HTMLImageElement | HTMLCanvasElement)} - the bitmap of this Overlay or null if it isn't ready yet - */ - getBitmap(): (HTMLImageElement | HTMLCanvasElement); - - /** - * Sets the overlay's current bitmap. - * @param bitmap {!(string | HTMLImageElement | HTMLCanvasElement)} - Either an image URL, a SVG markup, an image or a canvas. - * @returns {H.map.Overlay} - the overlay itself - */ - setBitmap(bitmap: (string | HTMLImageElement | HTMLCanvasElement)): H.map.Overlay; - - /** - * Returns this overlay's current opacity. - * @returns {number} - */ - getOpacity(): number; - - /** - * Sets the overlay's current opacity. - * @param opacity {number} - The opacity in range from 0 (transparent) to 1 (opaque). - * @returns {H.map.Overlay} - the overlay itself - */ - setOpacity(opacity: number): H.map.Overlay; - } - - export module Overlay { - /** - * Options used to initialize an Overlay - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property opacity {number=} - The opacity of the object in range from 0 (transparent) to 1 (opaque), default is 1. - * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - */ - export interface Options { - min?: number; - max?: number; - opacity?: number; - visibility?: boolean; - zIndex?: number; - provider?: H.map.provider.Provider; - data?: any; - } - } - - /** - * This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip - */ - export class Polygon extends H.map.GeoShape { - /** - * Constructor - * @param strip {H.geo.Strip} - the strip describing this polygon's vertices - * @param opt_options {H.map.Spatial.Options=} - optional initialization parameters - */ - constructor(strip: H.geo.Strip, opt_options?: H.map.Spatial.Options); - - /** - * To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon. - * @param flag {boolean} - A value of true means it covers the north pole, false means south pole - * @returns {H.map.Polygon} - the Polygon instance itself - */ - setNorthPoleCovering(flag: boolean): H.map.Polygon; - - /** - * See H.map.Polygon#setNorthPoleCovering - * @returns {boolean} - */ - getNorthPoleCovering(): boolean; - } - - /** - * This class represents a polyline in geo-space. It is defined by a path containing the vertices of a polyline (lat, lng, alt values) and a pen to use when tracing the path on the map. - */ - export class Polyline extends H.map.GeoShape { - /** - * Constructor - * @param strip {H.geo.Strip} - the strip describing this polygon's vertices - * @param opt_options {H.map.Polyline.Options=} - optional initialization parameters - */ - constructor(strip: H.geo.Strip, opt_options?: H.map.Polyline.Options); - - /** - * This method clips this polyline against a rectangular area and returns the intersecting sub-lines. - * @param geoRect {H.geo.Rect} - * @returns {Array>} - */ - clip(geoRect: H.geo.Rect): Array>; - } - - export module Polyline { - /** - * Options which are used to initialize a polyline - * @property style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - the style to be used when tracing the polyline - * @property arrows {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} - The arrows style to be used when rendering the polyline. - * @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData - */ - export interface Options { - style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); - arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); - visibility?: boolean; - zIndex?: number; - min?: number; - max?: number; - provider?: H.map.provider.Provider; - data?: any; - } - } - - /** - * A Polygon with a rectangular shape. - */ - export class Rect extends H.map.Polygon { - /** - * Constructor - * @param bounds {H.geo.Rect} - The geographical bounding box for this rectangle - * @param opt_options {H.map.Spatial.Options=} - */ - constructor(bounds: H.geo.Rect, opt_options?: H.map.Spatial.Options); - - /** - * To set the bounds of this rectangle. - * @param bounds {H.geo.Rect} - */ - setBounds(bounds: H.geo.Rect): void; - } - - /** - * This class represents a spatial map object which provides its projected geometry. - */ - export class Spatial extends H.map.Object { - /** - * Constructor - * @param isClosed {boolean} - Indicates whether this spatial object represents a closed shape - * @param opt_options {H.map.Spatial.Options=} - The options to apply - */ - constructor(isClosed: boolean, opt_options?: H.map.Spatial.Options); - - /** - * To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to prevent inconsistancies! - * @returns {H.map.SpatialStyle} - */ - getStyle(): H.map.SpatialStyle; - - /** - * To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent inconsistancies! . - * @param opt_style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The style to set. If it evaluates to a falsy the H.map.SpatialStyle.DEFAULT_STYLE is used. - * @returns {H.map.Spatial} - the Spatial instance itself - */ - setStyle(opt_style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): H.map.Spatial; - - /** - * To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as immutable and must not be modified afterwards to prevent inconsistancies! - * @returns {(H.map.ArrowStyle | undefined)} - */ - getArrows(): H.map.ArrowStyle | void; - - /** - * To set the arrow style of this object. - * @param opt_arrows {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} - the arrow style to be applied - * @returns {H.map.Spatial} - the Spatial instance itself - */ - setArrows(opt_arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options)): H.map.Spatial; - - /** - * Indicates whether this spatial object represents a closed shape - * @returns {boolean} - */ - isClosed(): boolean; - } - - export module Spatial { - /** - * Data to used as rendering hint for a label - * @property x {number} - The X coordinate of the first line's starting point - * @property y {number} - The Y coordinate of the first line's base line - * @property angle {number} - The clockwise rotation angle in radians - * @property font {string} - The CSS font-family - * @property size {number} - The CSS font-size - * @property color {string} - The CSS color - * @property text {string} - The text content, new line characters (\u000A) are interpreted as line breaks - */ - export interface Label { - x: number; - y: number; - angle: number; - font: string; - size: number; - color: string; - text: string; - } - - /** - * Options which are used to initialize spatial object object - * @property style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - the style to be used when tracing the spatial object - * @property arrows {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} - The arrows style to be used when rendering the spatial. - * @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true - * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity - * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. - * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. - */ - export interface Options { - style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); - arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); - visibility?: boolean; - zIndex?: number; - min?: number; - max?: number; - provider?: H.map.provider.Provider; - data?: any; - } - } - - /** - * The SpatialStyle class represents a style with which spatial objects like polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies and must not modified. - * @property strokeColor {string} - The color of the stroke in CSS syntax, default is 'rgba(0, 85, 170, 0.6)'. - * @property fillColor {string} - The filling color in CSS syntax, default is 'rgba(0, 85, 170, 0.4)'. - * @property lineWidth {number} - The width of the line in pixels, default is 2. - * @property lineCap {H.map.SpatialStyle.LineCap} - The style of the end caps for a line, default is 'round'. - * @property lineJoin {H.map.SpatialStyle.LineJoin} - The type of corner created, when two lines meet, default is 'miter'. - * @property miterLimit {number} - The miter length is the distance between the inner corner and the outer corner where two lines meet. The default is 10. - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is [ ]. - * @property lineDashOffset {number} - The phase offset of the line dash pattern The default is 0. - * @property MAX_LINE_WIDTH {number} - This constant represents the maximum line width which can be used for rendering. - * @property DEFAULT_STYLE {H.map.SpatialStyle} - This static member defines the default style for spatial objects on the map. It's value is { strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [ ], lineDashOffset: 0 } - */ - export class SpatialStyle { - /** - * Constructor - * @param opt_options {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The optional style attributes - */ - constructor(opt_options?: (H.map.SpatialStyle | H.map.SpatialStyle.Options)); - - /** - * This method checks value-equality with another style. - * @param other {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - the style to compare with - * @returns {boolean} - true if the styles are value-equal, otherwise false - */ - equals(other: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): boolean; - - /** - * Returns a copy of spatial style object and replaces the passed style attributes into it. - * @param opt_attributes {H.map.SpatialStyle.Options=} - The style attributes to set on the copied style instance - * @returns {H.map.SpatialStyle} - */ - getCopy(opt_attributes?: H.map.SpatialStyle.Options): H.map.SpatialStyle; - - strokeColor: string; - fillColor: string; - lineWidth: number; - lineCap: H.map.SpatialStyle.LineCap; - lineJoin: H.map.SpatialStyle.LineJoin; - miterLimit: number; - lineDash: Array; - lineDashOffset: number; - static MAX_LINE_WIDTH: number; - static DEFAULT_STYLE: H.map.SpatialStyle; - } - - export module SpatialStyle { - /** - * The style of the end caps for a line, one of 'butt', 'round' or 'square'. - */ - export type LineCap = 'butt' | 'round' | 'square'; - - /** - * The type of corner created, when two lines meet, one of 'round', 'bevel' or 'miter'. - */ - export type LineJoin = 'round' | 'bevel' | 'miter'; - - /** - * Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is taken. - * @property strokeColor {string=} - The color of the stroke in CSS syntax. - * @property fillColor {string=} - The color of the stroke in CSS syntax. - * @property lineWidth {number=} - The width of the line in pixels, default is 2. The maximum supported line width is 100. - * @property lineCap {H.map.SpatialStyle.LineCap=} - The style of the end caps for a line. - * @property lineJoin {H.map.SpatialStyle.LineJoin=} - The type of corner created, when two lines meet. - * @property miterLimit {number=} - The miter limit in pixel, default is 10. The maximum supported miter limit is 100 - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't support this feature this style property is ignored. - * @property lineDashOffset {number=} - The phase offset of the line dash pattern - */ - export interface Options { - strokeColor?: string; - fillColor?: string; - lineWidth?: number; - lineCap?: H.map.SpatialStyle.LineCap; - lineJoin?: H.map.SpatialStyle.LineJoin; - miterLimit?: number; - lineDash?: Array; - lineDashOffset?: number; - } - } - - /** - * This class represents a view of the map. It consists of a virtual camera and a look-at point both of which have a position in geo-space and orientation angles. The view model allows to change the values of these objects in order to move or rotate the map or zoom in and out. - */ - export class ViewModel extends H.util.EventTarget implements H.map.IControl { - /** - * This method returns the camera data, which is currently rendered. - * @returns {H.map.ViewModel.CameraData} - the current rendered camera data - */ - getCameraData(): H.map.ViewModel.CameraData; - - /** - * This method sets new camera data to be processed by the renderer. - * @param data {H.map.ViewModel.CameraData} - the values to be modified - * @returns {H.map.ViewModel} - this view model object - */ - setCameraData(data: H.map.ViewModel.CameraData): H.map.ViewModel; - - /** - * This method sets a new zoom level to be processed by the renderer - * @param zoom {number} - the new zoom level - * @param animate {boolean} - */ - setZoom(zoom: number, animate: boolean): void; - - /** - * This method returns the zoom level that is currently rendered. - * @returns {number} - current zoom level (scale) - */ - getZoom(): number; - - /** - * This method returns the currently requested data. - * @returns {H.map.ViewModel.CameraData} - last requested cam/view data - */ - getRequestedCameraData(): H.map.ViewModel.CameraData; - - /** - * A method to signal the begin of a control operation. - * @param opt_kinetics {H.util.kinetics.IKinetics=} - kinetics settings - * @param opt_atX {number=} - x screen coordinate at which control has started - * @param opt_atY {number=} - y screen coordinate at which control has started - */ - startControl(opt_kinetics?: H.util.kinetics.IKinetics, opt_atX?: number, opt_atY?: number): void; - - /** - * A method to set the values for a continuously modification of the ViewModel on different axes. If the current render engine doesn't support certain modifications then they are ignored. - * @param moveX {number} - The movement on x-axis as levels per millisecond where a level correlates to the distance between camera and look-at point. - * @param moveY {number} - The movement on y-axis as levels per millisecond where a level correlates to the distance between camera and look-at point - * @param moveZ {number} - The movement on z-axis as levels per millisecond. - * @param angleX {number} - The rotation of on screen's x axis as degrees per millisecond. - * @param angleY {number} - The rotation of on screen's y axis as degrees per millisecond. - * @param angleZ {number} - The rotation of on screen's z axis as degrees per millisecond. - * @param opt_zoom {number=} - The modification of the zoom level as levels per millisecond - */ - control(moveX: number, moveY: number, moveZ: number, angleX: number, angleY: number, angleZ: number, opt_zoom?: number): void; - - /** - * A method to signal the end of a control operation. - * @param opt_preventKinetics {boolean=} - A flag to indicate whether a kinetic effect is performed - * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - An callback to adjust the final ViewModel by modifying the passed camera data. - */ - endControl(opt_preventKinetics?: boolean, opt_adjustView?: (data: H.map.ViewModel.CameraData) => void): void; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module ViewModel { - /** - * Defines camera's properties. - * @property zoom {number=} - zoom level to be used by rendering engine - * @property position {H.geo.IPoint} - the position of the virtual camera in geo-space - * @property pitch {number=} - the rotation of the virtual camera along its local x-axis - * @property yaw {number=} - the rotation of the virtual camera along its local y-axis - * @property roll {number=} - the rotation of the virtual camera along its local z-axis - * @property fov {number=} - - */ - export interface CameraData { - zoom?: number; - position: H.geo.IPoint; - pitch?: number; - yaw?: number; - roll?: number; - fov?: number; - } - - /** - * Defines currently requested view data, which will be rendered by the map. - * @property camera {H.map.ViewModel.CameraData=} - The requested camera properties - * @property zoom {number=} - The requested zoom level - * @property animate {boolean=} - indicates if the requested transition should be animated - */ - export interface RequestedData { - camera?: H.map.ViewModel.CameraData; - zoom?: number; - animate?: boolean; - } - - /** - * Update event is fired whenever view model data is changed. It contains property which hold currently requested data - * @property target {*} - Object which triggered the event - * @property currentTarget {*} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class UpdateEvent extends H.util.Event { - /** - * Constructor - * @param requested {H.map.ViewModel.RequestedData} - */ - constructor(requested: H.map.ViewModel.RequestedData); - - /** - * Sets defaultPrevented to true. Which can be used to prevent some default behavior. - */ - preventDefault(): void; - - /** - * Stops propagation for current event. - */ - stopPropagation(): void; - - target: any; - currentTarget: any; - type: string; - defaultPrevented: boolean; - } - } - - /** - * ViewPort object holds information about the HTML element where the map is rendered. It contains information regarding the element (view port) size and triggers events when the element size is changed. - * @property element {Element} - This property holds the HTML element, which defines the viewport. - * @property width {number} - This property holds this viewport's current width - * @property height {number} - This property holds this viewport's current height - * @property margin {number} - This property holds this viewport's current margin value - * @property padding {H.map.ViewPort.Padding} - This property holds this viewport's current padding - * @property center {H.math.Point} - This property holds this viewport's current center point - */ - export class ViewPort extends H.util.EventTarget implements H.map.IInteraction { - /** - * Constructor - * @param element {Element} - html element were map will be rendered - * @param opt_options {H.map.ViewPort.Options=} - optional configuration parameters - */ - constructor(element: Element, opt_options?: H.map.ViewPort.Options); - - /** - * This method sets the margin on the viewPort - * @param margin {number} - margin which is used to fetch map data - */ - setMargin(margin: number): void; - - /** - * This method sets the padding on the viewport. Padding will result in shifted map center which will be the visual center of the padded area. - * @param top {number} - padding from the top - * @param right {number} - padding from the right - * @param bottom {number} - padding from the bottom - * @param left {number} - padding from the left - */ - setPadding(top: number, right: number, bottom: number, left: number): void; - - /** - * This method updates size of the viewport according to container size. It must be called whenever the HTML element changed size in order to update the map's viewport values. - */ - resize(): void; - - /** - * This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse grab, or touch start. - * @param modifiers {number} - a bitmask which specifies what operations should performed during every interaction - * @param opt_kinetics {H.util.kinetics.IKinetics=} - specifies kinetic move at the end of interaction - */ - startInteraction(modifiers: H.math.BitMask, opt_kinetics?: H.util.kinetics.IKinetics): void; - - /** - * This method resolves direct screen (view port) interaction. This function will modify the current view according to values passed in. - * @param x {number} - viewport x coordinate - * @param y {number} - viewport y coordinate - * @param opt_bx {number=} - x coordinate for second pointer/touch if present - * @param opt_by {number=} - y coordinate for secong pointer/touch if present - * @param opt_timestamp {number=} - known timestamp which should be passed - */ - interaction(x: number, y: number, opt_bx?: number, opt_by?: number, opt_timestamp?: number): void; - - /** - * This method ends interaction and applies kinetic movement if defined by using startInteraction method - * @param opt_preventKinetics {boolean=} - if set to true will prevent kinetics behaviour at the end of interaction - */ - endInteraction(opt_preventKinetics?: boolean): void; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - - element: Element; - width: number; - height: number; - margin: number; - padding: H.map.ViewPort.Padding; - center: H.math.Point; - } - - export module ViewPort { - /** - * Options which may be used to initialize new ViewPort instance - * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map - * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map - * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or or padding has been changed, default is true - */ - export interface Options { - margin?: number; - padding?: H.map.ViewPort.Padding; - fixedCenter?: boolean; - } - - /** - * Represents viewport padding definition. - * @property top {number} - the padding on the top edge (in pixels) - * @property right {number} - the padding on the right edge (in pixels) - * @property bottom {number} - the padding on the bottom edge (in pixels) - * @property left {number} - the padding on the left edge (in pixels) - */ - export interface Padding { - top: number; - right: number; - bottom: number; - left: number; - } - } - - export module layer { - /** - * BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request management. - */ - export class BaseTileLayer extends H.map.layer.Layer { - /** - * Constructor - * @param provider {H.map.provider.TileProvider} - data source for the TileLayer - * @param opt_options {H.map.layer.ITileLayer.Options=} - additional options - */ - constructor(provider: H.map.provider.TileProvider, opt_options?: H.map.layer.ITileLayer.Options); - - /** - * This method returns the provider which feeds this layer with data. - * @returns {H.map.provider.TileProvider} - this layer's provider - */ - getProvider(): H.map.provider.TileProvider; - - /** - * This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at provided zoom level - * @param geoRect {H.geo.Rect} - geo bounds to be projected - * @param opt_zoom {number=} - overrides current projection zoom level - * @returns {H.math.Rect} - projected 2d space rect cooresponding to provided geo bounds - */ - geoRectToRect(geoRect: H.geo.Rect, opt_zoom?: number): H.math.Rect; - - /** - * This method returns tile grid for a bounding rectangle - * @param rectBounds {H.math.Rect} - projected rect bounds which coorespond to geo bounding box - * @param zoom {number} - current zoom level - * @returns {H.math.Rect} - rectangle which represents the tile grid bounds - */ - getTileBounds(rectBounds: H.math.Rect, zoom: number): H.math.Rect; - - /** - * This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or undefined and starts loading the tile - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - The zoom level for which the tile is requested - * @param cacheOnly {boolean} - indicates whether only cached tiles are to be considered - * @returns {(H.map.provider.Tile | undefined)} - tile object corresponding to requested coordinates - */ - requestTile(x: number, y: number, z: number, cacheOnly: boolean): H.map.provider.Tile | void; - - /** - * This method cancels a previously requested tile. - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - zoom level - */ - cancelTile(x: number, y: number, z: number): void; - - /** - * This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be available during subsequent calls. - * @param tileBounds {H.math.Rect} - bounds in tile grid - * @param isCDB {boolean} - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {H.map.layer.ITileLayer.Response} - returns an array if tile which are already loaded - */ - getProviderTiles(tileBounds: H.math.Rect, isCDB: boolean, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): H.map.layer.ITileLayer.Response; - } - - /** - * This interface describes a layer which provides marker objects to the renderer. - */ - export interface IMarkerLayer { - - /** - * This method requests marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - - /** - * This method requests dom marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - } - - export module IMarkerLayer { - /** - * This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers function. - * @property total {number} - The total number of markers, inclusive markers with not ready icons - * @property markers {Array} - The marker objects for the bounding rectangle (only ready) - */ - export interface Response { - total: number; - markers: Array; - } - - /** - * This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers function. - * @property number {number} - of returned tiles - * @property requested {number} - number of requested tiles - * @property objects {Array} - the marker objects within requested tiled area - */ - export interface TiledResponse { - number: number; - requested: number; - objects: Array; - } - } - - /** - * This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion (where z describes the level within the tree and x and y describe the absolute column and row indeces whithin the level). - */ - export interface ITileLayer { - /** - * This method requests tiles for the current bounding rectangle at the given zoom level (z-value). - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which tiles are to be returned - * @param zoomLevel {number} - The zoom level for which the tiles are requested - * @param cacheOnly {boolean} - Indicates whether only cached tiles are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {H.map.layer.ITileLayer.Response} - a response object containing the total number of tiles requested and the tile objects that could be immediately returned - */ - requestTiles(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): H.map.layer.ITileLayer.Response; - - /** - * This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or undefined and starts loading the tile - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - The zoom level for which the tile is requested - * @param cacheOnly {boolean} - indicates whether only cached tiles are to be considered - * @returns {(H.map.provider.Tile | undefined)} - tile object corresponding to requested coordinates - */ - requestTile(x: number, y: number, z: number, cacheOnly: boolean): H.map.provider.Tile | void; - - /** - * This method cancels a previously requested tile. - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - zoom level - */ - cancelTile(x: number, y: number, z: number): void; - } - - export module ITileLayer { - /** - * Options which are used to initialize a TileLayer object. - * @property projection {H.geo.IProjection=} - an optional projection to be used for this layer, default is H.geo.mercator - * @property opacity {number=} - tile layer opacity, default is 1 - */ - export interface Options { - projection?: H.geo.IProjection; - opacity?: number; - } - - /** - * A response object for a tile request. Contains total number of elements requested and an array of currently available Tiles - * @property total {number} - the total number of requested tiles - * @property tiles {Array} - the tiles which this provider can currently return synchronously - */ - export interface Response { - total: number; - tiles: Array; - } - } - - /** - * The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the layers collection. It provides the basic infrastructure for dispatching update events to the renderer in case new data is available. - */ - export class Layer extends H.util.EventTarget { - /** - * Constructor - * @param opt_options {H.map.layer.Layer.Options=} - optional configuration object - */ - constructor(opt_options?: H.map.layer.Layer.Options); - - /** - * This method checks if a zoom level can be served by this layer. - * @param zoomLevel {number} - the zoom level to check - * @returns {boolean} - true if this layer can provide data for the zoom level, otherwise false - */ - isValid(zoomLevel: number): boolean; - - /** - * This method sets the minimum zoom level for which this layer will provide tiles. - * @param min {number} - The new minimum zoom level of this layer - * @returns {H.map.layer.Layer} - Returns this instance of the layer - */ - setMin(min: number): H.map.layer.Layer; - - /** - * This method sets the maximum zoom level for which this layer will provide tiles. - * @param max {number} - The new maximum zoom level of this layer - * @returns {H.map.layer.Layer} - Returns this instance of the layer - */ - setMax(max: number): H.map.layer.Layer; - - /** - * This method returns the copyright of the current data provider. - * @param bounds {H.geo.Rect} - the bounding area for which to retrieve the copyright information - * @param level {number} - the zoom level for which to retrieve the copyright information - * @returns {Array} - a list of copyright information objects for the provided area and zoom level - */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module Layer { - /** - * Options which can be used when creating new layer object. - * @property min {number=} - The minimum zoom level for which the layer can provide data, default is 0 - * @property max {number=} - The maximum zoom level for which the layer can provide data, default is 22 - * @property dark {boolean=} - Indicates whether the content of this layer is mainly dark, default is false See also H.Map.Options#autoColor - * @property projection {H.geo.IProjection=} - The projection to be used for this layer, default is H.geo.mercator - * @property minWorldSize {number=} - The minimal world size at zoom level 0, default is 256 - */ - export interface Options { - min?: number; - max?: number; - dark?: boolean; - projection?: H.geo.IProjection; - minWorldSize?: number; - } - } - - /** - * ObjectTileLayer represents map objects which are requested on a tile basis - */ - export class MarkerTileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.IMarkerLayer { - /** - * Constructor - * @param provider {H.map.provider.MarkerTileProvider} - * @param opt_options {H.map.layer.ITileLayer.Options=} - */ - constructor(provider: H.map.provider.MarkerTileProvider, opt_options?: H.map.layer.ITileLayer.Options); - - /** - * This method requests marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - - /** - * This method requests dom marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - } - - /** - * This class represents a layer which renders map objects. Spatial objects like polygons and polylines a rendered to tiles before being passed to the enigne. Point objects like markers are provided as objects given an rectangular area. - */ - export class ObjectLayer extends H.map.layer.Layer implements H.map.layer.ITileLayer { - /** - * Constructor - * @param provider {H.map.provider.ObjectProvider} - the ObjectProvider which provides the map objects to this object layer. - * @param opt_options {H.map.layer.ObjectLayer.Options=} - The options for this layer - */ - constructor(provider: H.map.provider.ObjectProvider, opt_options?: H.map.layer.ObjectLayer.Options); - - /** - * This method returns current ObjectLayer's data provider - * @returns {H.map.provider.ObjectProvider} - */ - getProvider(): H.map.provider.ObjectProvider; - - /** - * To request overlay objects for the passsed bounding rectangle. It returns all overlay objects which are contained within this bounding rectangle. - * @param bounds {H.geo.Rect} - The bounding rectangle for which overlays are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {H.map.layer.ObjectLayer.OverlaysResponse} - */ - requestOverlays(bounds: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): H.map.layer.ObjectLayer.OverlaysResponse; - - /** - * This method requests tiles for the current bounding rectangle at the given zoom level (z-value). - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which tiles are to be returned - * @param zoomLevel {number} - The zoom level for which the tiles are requested - * @param cacheOnly {boolean} - Indicates whether only cached tiles are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {H.map.layer.ITileLayer.Response} - a response object containing the total number of tiles requested and the tile objects that could be immediately returned - */ - requestTiles(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): H.map.layer.ITileLayer.Response; - - /** - * This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or undefined and starts loading the tile - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - The zoom level for which the tile is requested - * @param cacheOnly {boolean} - indicates whether only cached tiles are to be considered - * @returns {(H.map.provider.Tile | undefined)} - tile object corresponding to requested coordinates - */ - requestTile(x: number, y: number, z: number, cacheOnly: boolean): H.map.provider.Tile | void; - - /** - * This method cancels a previously requested tile. - * @param x {number} - tile row position - * @param y {number} - tile column position - * @param z {number} - zoom level - */ - cancelTile(x: number, y: number, z: number): void; - - /** - * This method requests marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - - /** - * This method requests dom marker objects for provided bounding rectangle. - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves - */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); - } - - export module ObjectLayer { - /** - * Configuration object which can be use to initialize the ObjectLayer. - * @property tileSize {number=} - the size of the tiles rendered by this layer for polylines and polygons (must be power of 2, default is 256) - * @property tileCacheSize {number=} - the number of fully rendered spatial tiles that are cached for immediate reuse, default is 32 - * @property dataCacheSize {number=} - the number of tiles to cache which have render data only, default is 512 - * @property pixelRatio {number=} - The pixelRatio to use for over-sampling in cases of high-resolution displays - */ - export interface Options { - tileSize?: number; - tileCacheSize?: number; - dataCacheSize?: number; - pixelRatio?: number; - } - - /** - * A response object returned by the H.map.layer.ObjectLayer#requestOverlays function. - * @property total {number} - The total number of overlays within the requested bounds, inclusive overlays which are not ready loaded yet - * @property overlays {Array} - A list all overlays which are ready to render - */ - export interface OverlaysResponse { - total: number; - overlays: Array; - } - } - - /** - * Tile Layer, represents data shown on map on a tile basis. Can be used to show map tile images or other type of data which is partitioned into tiles. - * @event update {H.util.Event} - */ - export class TileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.ITileLayer { - /** - * Constructor - * @param provider {H.map.provider.TileProvider} - data source for the TileLayer - * @param opt_options {H.map.layer.ITileLayer.Options=} - additional options - */ - constructor(provider: H.map.provider.TileProvider, opt_options?: H.map.layer.ITileLayer.Options); - - /** - * This method requests tiles for the current bounding rectangle at the given zoom level (z-value). - * @param boundingRect {H.geo.Rect} - the bounding rectangle for which tiles are to be returned - * @param zoomLevel {number} - The zoom level for which the tiles are requested - * @param cacheOnly {boolean} - Indicates whether only cached tiles are to be considered - * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center - * @returns {H.map.layer.ITileLayer.Response} - a response object containing the total number of tiles requested and the tile objects that could be immediately returned - */ - requestTiles(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): H.map.layer.ITileLayer.Response; - - update: H.util.Event; - } - } - - export module provider { - /** - * An ImageTileProvider uses network service to provide bitmap images as tiles. - * @property tileSize {number} - Size of a tile image supported by the provider - */ - export class ImageTileProvider extends H.map.provider.RemoteTileProvider { - /** - * Constructor - * @param options {H.map.provider.ImageTileProvider.Options} - configuration for tile provider - */ - constructor(options: H.map.provider.ImageTileProvider.Options); - - tileSize: number; - } - - export module ImageTileProvider { - /** - * Options to initialize an ImageTileProvider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. - * @property min {number=} - The minimal supported zoom level, default is 0 - * @property max {number=} - The maximal supported zoom level, default is 22 - * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights - * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 - * @property getURL {function(number, number, number)} - The function to create an URL for the specified tile. If it returns a falsy the tile is not requested. - * @property crossOrigin {(string | boolean=)} - The CORS settings to use for the crossOrigin attribute for the image, if omitted or if the value evaluates to false no CORS settings are used. - */ - export interface Options { - uri?: string; - min?: number; - max?: number; - getCopyrights?: ((rect: H.geo.Rect, n: number) => Array); - tileSize?: number; - getURL: (n1: number, n2: number, n3: number) => string; - crossOrigin?: (string | boolean); - } - } - - /** - * This class represents invalidation states of a renderable object. A renderer can optimize its rendering strategies based on the information in this object. - * @property MARK_INITIAL {H.map.provider.Invalidations.Mark} - This constant represents the initial invalidation mark an invalidations object has. - */ - export class Invalidations { - - /** - * To update invalidation marks accordingly to the given the invalidation types. - * @param mark {H.map.provider.Invalidations.Mark} - The invalidation mark to set - * @param types {H.math.BitMask} - The descrete invalidation types to update - */ - update(mark: H.map.provider.Invalidations.Mark, types: H.math.BitMask): void; - - /** - * This method returns the current invalidation mark of this invalidations object. - * @returns {H.map.provider.Invalidations.Mark} - the current invalidation mark - */ - getMark(): H.map.provider.Invalidations.Mark; - - /** - * Checks whether any change occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isAny(since: H.map.provider.Invalidations.Mark): boolean; - - /** - * Checks whether a visual change occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isVisual(since: H.map.provider.Invalidations.Mark): boolean; - - /** - * Checks whether a spatial change occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isSpatial(since: H.map.provider.Invalidations.Mark): boolean; - - /** - * Checks whether an add-operation occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isAdd(since: H.map.provider.Invalidations.Mark): boolean; - - /** - * Checks whether a remove operation occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isRemove(since: H.map.provider.Invalidations.Mark): boolean; - - /** - * Checks whether a z-order change occurred after the specified since mark - * @param since {H.map.provider.Invalidations.Mark} - The invalidation mark to check against - * @returns {boolean} - */ - isZOrder(since: H.map.provider.Invalidations.Mark): boolean; - - static MARK_INITIAL: H.map.provider.Invalidations.Mark; - } - - export module Invalidations { - /** - * This enumeration encapsulates bit flags for different invalidations of map objects. - */ - export enum Flag { - NONE, - VISUAL, - SPATIAL, - ADD, - REMOVE, - Z_ORDER, - } - - /** - * The invalidation mark represents a counter which is increased whenever an invalidation takes place. - */ - export interface Mark { } - } - - /** - * A MarkerTileProvider uses network service to provide markers on tile basis. - * @property requestTile {} - Request data on a tile basis - * @property cancelTile {} - Cancels tile from being requested using x, y, z coordinates (column, row, zoom) - * @property cancelTileByKey {} - Cancels tile from being requested using a tile-key - * @property uri {string} - This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid - * @property min {number} - Minimum zoom level at which provider can serve data, set at construction time - * @property max {number} - Maximum zoom level at which provider can server data, set at construction time - * @property uid {string} - Provider instance unique identifier, generated at construction time - */ - export class MarkerTileProvider extends H.map.provider.RemoteTileProvider { - /** - * Constructor - * @param options {H.map.provider.MarkerTileProvider.Options} - configuration for tile provider - */ - constructor(options: H.map.provider.MarkerTileProvider.Options); - - /** - * To signal to this provider that a map object has been changed. The method marks tile, that contains that object as invalid and triggers dispatchUpdate() - * @param marker {!H.map.AbstractMarker} - The map object to be invalidated - * @param flags {H.math.BitMask} - The flags indicating the types of occurred changes - */ - invalidateObject(marker: H.map.AbstractMarker, flags: H.math.BitMask): void; - - /** - * Checks whether this provider is currently providing H.map.DomMarker map objects. - * @returns {boolean} - */ - providesDomMarkers(): boolean; - } - - export module MarkerTileProvider { - /** - * Options which are used to initialize the MarkerTileProvider object. - * @property min {number=} - The minimal supported zoom level, default is 0 - * @property max {number=} - The maximal supported zoom level, default is 22 - * @property requestData {function(number, number, number, function(Array), Function) : H.util.ICancelable} - function that fetches marker data and creates array of H.map.AbstractMarker that is passed success callback, if function fails to fetch data onError callback must be called - * @property providesDomMarkers {boolean=} - indicates if markers provided are of type H.map.DomMarker or H.map.Marker, default is H.map.Marker - */ - export interface Options { - min?: number; - max?: number; - requestData: (n1: number, n2: number, n3: number, markerCallback: (markers: Array) => void, f: Function) => H.util.ICancelable; - providesDomMarkers?: boolean; - } - } - - /** - * An abstract class to manage and provide map objects (Marker, Polyline, Polygon) - */ - export class ObjectProvider extends H.map.provider.Provider { - /** - * Constructor - * @param opt_options {H.map.provider.Provider.Options=} - */ - constructor(opt_options?: H.map.provider.Provider.Options); - - /** - * Returns the accumulate invalidations of this provider's objects that have occurred. - * @param opt_type {H.map.Object.Type=} - The type of objects to consider for the invalidations. If undefined, all types are taken into account. - * @returns {H.map.provider.Invalidations} - */ - getInvalidations(opt_type?: H.map.Object.Type): H.map.provider.Invalidations; - - /** - * To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the given map object and triggers dispatchUpdate() - * @param mapObject {!H.map.Object} - The map object to be invalidated - * @param changes {H.math.BitMask} - The flags indicating the types of occurred changes - */ - invalidateObject(mapObject: H.map.Object, changes: H.math.BitMask): void; - - /** - * Checks whether this provider is currently providing overlay map objects. A concrete implementation of ObjectProvider must override it if it currently provides overlays. - * @returns {boolean} - */ - providesOverlays(): boolean; - - /** - * Returns all Overlay objects which intersect with the provided area. - * @param geoRect {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestOverlays(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Checks whether this provider is currently providing spatial map objects. A concrete implementation of ObjectProvider must override it if it currently provides Spatials. - * @returns {boolean} - */ - providesSpatials(): boolean; - - /** - * Returns all polyline, polygon, circle and rect objects which intersect with the provided area. - * @param geoRect {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestSpatials(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Returns the spatial objects which intersect the given tile - * @param tile {H.map.provider.SpatialTile} - The tile for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Checks whether this provider is currently providing Marker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. - * @returns {boolean} - */ - providesMarkers(): boolean; - - /** - * Returns all Marker map objects which intersect with the provided rectangular area. - * @param geoRect {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - - /** - * Checks whether this provider is currently providing DomMarker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. - * @returns {boolean} - */ - providesDomMarkers(): boolean; - - /** - * Returns all DomMarker map objects which intersect with the provided rectangular area. - * @param geoRect {H.geo.Rect} - A rectangular area in geo space to intersect with - * @param zoomLevel {number} - The zoom level for which the objects are requested - * @param visiblesOnly {boolean} - Indicates whether only invisible objects are to be considered - * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered - * @returns {Array} - a list of intersecting objects - */ - requestDomMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; - } - - /** - * A Provider defines an object which works as a database for the map. Providers can exists in different forms they can implement client side object storage or they can request data from the remote service. - * @property uri {string} - This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid - * @property min {number} - Minimum zoom level at which provider can serve data, set at construction time - * @property max {number} - Maximum zoom level at which provider can server data, set at construction time - * @property uid {string} - Provider instance unique identifier, generated at construction time - */ - export class Provider extends H.util.EventTarget { - /** - * Constructor - * @param opt_options {H.map.provider.Provider.Options=} - */ - constructor(opt_options?: H.map.provider.Provider.Options); - - /** - * This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level. - * @param bounds {H.geo.Rect} - The bounding area for which to retrieve the copyright information - * @param level {number} - The zoom level for which to retrieve the copyright information - * @returns {?Array} - a list of copyright information objects for the provided area and zoom level - */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - - uri: string; - min: number; - max: number; - uid: string; - } - - export module Provider { - /** - * Options to initialize a Provider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. - * @property min {number=} - The minimal supported zoom level, default is 0 - * @property max {number=} - The maximal supported zoom level, default is 22 - * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights - */ - export interface Options { - uri?: string; - min?: number; - max?: number; - getCopyrights?: (rect: H.geo.Rect, n: number) => Array; - } - } - - /** - * RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement 'requestInternal' (to request remote tile) and 'getCache' (to provide configured cache object were tiled data is being cached) - */ - export class RemoteTileProvider extends H.map.provider.TileProvider { - /** - * Constructor - * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider - */ - constructor(options: H.map.provider.TileProvider.Options); - - /** - * This method returns cache which should be used to store tiles - * @returns {H.util.ICache} - cache - */ - getCache(): H.util.ICache; - - /** - * This method request tile from remote service - * @param x {number} - The row number of the tile - * @param y {number} - The column number of the tile - * @param z {number} - The zoom level for which the tile is requested - * @param onResponse {function((Array | HTMLImageElement | HTMLCanvasElement | ArrayBuffer | null), *=)} - function which is called after response arrives - * @param onError {function(string=)} - function which is called in case of communication error - * @param opt_priority {H.net.Request.Priority=} - optional request priority level - * @returns {H.util.ICancelable} - */ - requestInternal( - x: number, - y: number, - z: number, - - onResponse?: ( - object: Array | HTMLImageElement | HTMLCanvasElement | ArrayBuffer, - response: any - ) => void, - - onError?: (s: string) => void, - opt_priority?: H.net.Request.Priority - ): H.util.ICancelable; - - /** - * This method instructs the provider to reload data from it's source. - * @param hard {boolean} - a boolean flag indicating whether to invalidate in hard mode (true) or in soft mode (false); - */ - reload(hard: boolean): void; - } - - /** - * Generic Tile object which represents a part of the world fiting into the Tile area represented by the Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles at particular zoom level (which means number of areas into world is being splitted) is defined as following: numberOfRows = numberOfColumns = 2^zoomlevel - * @property key {string} - Unique tile key generated by provider - * @property data {*} - Tile data (an image for example) - * @property valid {boolean} - This property holds a boolean flag indicating whether this tile is still valid (true) or whether it should be re-fetched (false) - * @property x {number} - Tile column - * @property y {number} - Tile row - * @property z {number} - Tile zoom level - */ - export class Tile { - /** - * Constructor - * @param x {number} - x tile coordinate (row) - * @param y {number} - y tile coordinate (column) - * @param z {number} - tile zoom level - * @param data {*} - generic data object which cooresponds to the given coordinates - */ - constructor(x: number, y: number, z: number, data?: any); key: string; - - data: any; - valid: boolean; - x: number; - y: number; - z: number; - } - - /** - * TileProvider is an abstract class to provide data on a tile basis - * @property requestTile {} - Request data on a tile basis - * @property cancelTile {} - Cancels tile from being requested using x, y, z coordinates (column, row, zoom) - * @property cancelTileByKey {} - Cancels tile from being requested using a tile-key - * @property uri {string} - This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid - * @property min {number} - Minimum zoom level at which provider can serve data, set at construction time - * @property max {number} - Maximum zoom level at which provider can server data, set at construction time - * @property uid {string} - Provider instance unique identifier, generated at construction time - */ - export class TileProvider extends H.map.provider.Provider { - /** - * Constructor - * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider - */ - constructor(options: H.map.provider.TileProvider.Options); - - /** - * This method creates a tile object with given parameters - * @param x {number} - x tile coordinate (row) - * @param y {number} - y tile coordinate (column) - * @param z {number} - tile coordinate (zoom) - * @param data {(HTMLImageElement | HTMLCanvasElement)} - data for the tile - * @param opt_options {Object=} - free form options object. These options are meant to be used in tile specific rendering cases - * @returns {H.map.provider.Tile} - */ - createTileInternal(x: number, y: number, z: number, data: (HTMLImageElement | HTMLCanvasElement), opt_options?: { [key: string]: any }): H.map.provider.Tile; - - /** - * This method creates a tile key consisting of the provider's uri, and the tile's x, y and z coordinates, seperated by underscores e.g.: "4711_7_42_23" - * @param x {number} - The x tile coordinate (row) - * @param y {number} - The y tile coordinate (column) - * @param z {number} - The z tile coordinate (zoom level) - * @returns {string} - string - */ - getTileKey(x: number, y: number, z: number): string; - - requestTile: any; - cancelTile: any; - cancelTileByKey: any; - uri: string; - min: number; - max: number; - uid: string; - } - - export module TileProvider { - /** - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. - * @property min {number=} - The minimal supported zoom level, default is 0 - * @property max {number=} - The maximal supported zoom level, default is 22 - * @property getCopyrights {(function(H.geo.Rect, number): Array)=} - A function to replace the default implememtation of H.map.provider.Provider#getCopyrights - * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 - */ - export interface Options { - uri?: string; - min?: number; - max?: number; - getCopyrights?(rect: H.geo.Rect, number: number): Array; - tileSize?: number; - } - } - } - } - - /***** mapevents *****/ - export module mapevents { - /** - * Behavior class uses map events and adds behavior functionality to the map. This allows map panning and zooming via using mouse wheel - * @property DRAGGING {number} - Map responds to user dragging via mouse or touch - * @property WHEELZOOM {number} - Map zooms in or out in respond to mouse wheel events - * @property DBLTAPZOOM {number} - Map zooms in or out in response to double click or double tap. For double tap if more that one touches are on the screen map will zoom out. - */ - export class Behavior extends H.util.Disposable { - /** - * Constructor - * @param mapEvents {H.mapevents.MapEvents} - previously initialized map events instance - * @param options {H.mapevents.Behavior.Options} - additional options (i.e kinetics) - */ - constructor(mapEvents: H.mapevents.MapEvents, options?: H.mapevents.Behavior.Options); - - /** - * This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior object will also be disposed (this function will be called) when attached H.mapevents.MapEvents object is dispose. - */ - dispose(): void; - - /** - * This method disables the behavior functionality for the map - * @param opt_behavior {number=} - The bitmask of behaviors to disable. If no arguments are passed, all behaviors will be disabled. - */ - disable(opt_behavior?: H.math.BitMask): void; - - /** - * This method re-enables the behavior functionality for the map. - * @param opt_behavior {number=} - The bitmask of behaviors to enable. If no arguments are passed, all behaviors will be enabled. - */ - enable(opt_behavior?: H.math.BitMask): void; - - /** - * This method checks if certain functionality is enabled - * @param behavior {number} - value like H.mapevents.Behavior.DRAGGING which the check is being performed - * @returns {boolean} - */ - isEnabled(behavior: number): boolean; - - static DRAGGING: number; - static WHEELZOOM: number; - static DBLTAPZOOM: number; - } - - export module Behavior { - /** - * Options which are used to initialize the Behavior class. - * @property kinetics {H.util.kinetics.IKinetics=} - The parameters for the kinetic movement. - * @property enable {number=} - The bitmask of behaviors to enable like H.mapevents.Behavior.DRAGGING. All are enabled by default. - */ - export interface Options { - kinetics?: H.util.kinetics.IKinetics; - enable?: H.math.BitMask; - } - } - - /** - * ContextMenuEvent should be fired, when a user right-clicks or longpresses on a map object. - * @property viewportX {Array} - Contains ContextItems, that will be used to create context menu entries. Should be filled by listeners of the "contextmenu" event - * @property viewportY {number} - Map viewport y position - * @property target {(H.map.Object | H.Map)} - Target for the event - * @property originalEvent {Event} - Original event - * @property currentTarget {(H.map.Object | H.Map)} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class ContextMenuEvent extends H.util.Event { - /** - * Constructor - * @param viewportX {number} - The x coordinate on the viewport - * @param viewportY {number} - The y coordinate on the viewport - * @param target {(H.Map | H.map.Object)} - The event's target element - * @param originalEvent {Event} - target of the event - */ - constructor(viewportX: number, viewportY: number, target: (H.Map | H.map.Object), originalEvent: Event); - - viewportX: Array; - viewportY: number; - originalEvent: Event; - } - - /** - * Custom map event. Contains list of pointers on the map, list of changed pointers and original event. Inherits from H.util.Event. - * @property pointers {Array} - Pointers which are currently on the screen - * @property changedPointers {Array} - Pointers which has changed in course of event - * @property targetPointers {Array} - Pointers which are on same target as the current pointer - * @property currentPointer {H.mapevents.Pointer} - Current pointer - * @property originalEvent {Event} - Original event fired by the browser - * @property target {(H.map.Object | H.Map)} - Object which triggered event. Can be the map object (i.e marker or polyline) or the map itself - * @property currentTarget {(H.map.Object | H.Map)} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class Event extends H.util.Event { - /** - * Constructor - * @param type {string} - type of event - * @param pointers {Array} - pointers which are currently on the screen - * @param changedPointers {Array} - pointers which changed during event - * @param targetPointers {Array} - pointers on the event target - * @param currentPointer {H.mapevents.Pointer} - pointer which triggered the event - * @param target {(H.Map | H.map.Object)} - target map object which triggered event - * @param originalEvent {Event} - original dom event - */ - constructor(type: string, pointers: Array, changedPointers: Array, targetPointers: Array, currentPointer: H.mapevents.Pointer, target: (H.Map | H.map.Object), originalEvent: Event); - - /** - * Sets defaultPrevented to true. Which can be used to prevent some default behavior. - */ - preventDefault(): void; - - /** - * Stops propagation for current event. - */ - stopPropagation(): void; - - pointers: Array; - changedPointers: Array; - targetPointers: Array; - currentPointer: H.mapevents.Pointer; - originalEvent: Event; - target: (H.map.Object | H.Map); - currentTarget: (H.map.Object | H.Map); - type: string; - defaultPrevented: boolean; - } - - /** - * MapEvents enable the events functionality on the map and on the map objects. By using this extension it is possible to listen to events on map objects like markers, polylines, polygons, circles and on the map object itself. Events are triggered depending on user interaction. Please check the Events Summary section for the list of events fired by this class and by the map objects. - */ - export class MapEvents extends H.util.Disposable { - /** - * Constructor - * @param map {H.Map} - map instance which is used for firing events - */ - constructor(map: H.Map); - - /** - * This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents and map objects will not trigger any events. This object will be disposed automatically if the corresponding map object is disposed. - */ - dispose(): void; - - /** - * This method returns map into which events are attached - * @returns {H.Map} - */ - getAttachedMap(): H.Map; - } - - /** - * Class representing pointer on the map surface. A pointer in platform specific definition would mean either mouse, touch, pen or any pointing device which can trigger browser events. - * @property viewportX {number} - X coordinate on the map's viewport - * @property viewportY {number} - Y coordinate on the map's viewport - * @property target {(H.map.Object | H.Map)} - Map object directly under the pointer. Can be null if if pointer is out of the map viewport - * @property id {number} - Pointer unique identifier. - * @property type {string} - Pointer type can be: 'mouse', 'touch' or 'pen' - * @property dragTarget {(H.map.Object | H.Map)} - Object which is currently dragged by the pointer - * @property button {H.mapevents.Pointer.Button} - Indicates which pointer device button has changed. - */ - export class Pointer { - /** - * Constructor - * @param viewportX {number} - pointer position on x-axis - * @param viewportY {number} - pointer position on y-axis - * @param id {number} - unique pointer identifier among currently available pointers - * @param type {string} - type of pointer can be i.e 'mouse', 'touch'. 'pen' - * @param opt_button {H.mapevents.Pointer.Button=} - Indicates which pointer device button has changed. - * @param opt_buttons {number=} - Indicates which pointer device buttons are being pressed, expressed as a bitmask. Uses the same values, as "buttons" in Pointer Events spec. - */ - constructor(viewportX: number, viewportY: number, id: number, type: string, opt_button?: H.mapevents.Pointer.Button, opt_buttons?: H.math.BitMask); - static viewportX: number; - static viewportY: number; - static target: (H.map.Object | H.Map); - static id: number; - static type: string; - static dragTarget: (H.map.Object | H.Map); - static button: H.mapevents.Pointer.Button; - } - - export module Pointer { - /** - * Types of a button - */ - export enum Button { - /** No button */ - NONE, - /** Left mouse button or touch contact or pen contact */ - LEFT, - /** Middle mouse button */ - MIDDLE, - /** Right mouse button or Pen barrel button */ - RIGHT, - } - - /** - * Indicates which pointer device buttons are being pressed, expressed as a bitmask. Bit values are: - * - * - 0: No button pressed - * - 1: Left mouse button pressed, or Touch contact or Pen contact - * - 2: Right mouse button pressed, or Pen contact with barrel button pressed - * - 4: Middle mouse button pressed - */ - // TODO not sure this is the right interpretation of the docs - export type Buttons = H.math.BitMask; - } - - /** - * WheelEvent is fired when the mouse wheel is used over the map. It contains information about cursor position and the map object which resides directly under the cursor. - * @property delta {number} - Wheel move delta - * @property viewportX {number} - Map viewport x position - * @property viewportY {number} - Map viewport y position - * @property target {(H.map.Object | H.Map)} - Target for the event - * @property originalEvent {Event} - Original mouse wheel event - * @property currentTarget {(H.map.Object | H.Map)} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class WheelEvent extends H.util.Event { - /** - * Constructor - * @param deltaY {number} - The wheel move delta on y-axis - * @param viewportX {number} - The x coordinate on the viewport - * @param viewportY {number} - The y coordinate on the viewport - * @param target {(H.Map | H.map.Object)} - The event's target element - * @param originalEvent {Event} - target of the event - */ - constructor(deltaY: number, viewportX: number, viewportY: number, target: (H.Map | H.map.Object), originalEvent: Event); - - delta: number; - viewportX: number; - viewportY: number; - originalEvent: Event; - } - } - - /***** math *****/ - export module math { - /** - * A signed 32 bit integer (JS restriction) where bit operator can be applied to. The range is [-2,147,483,648 ... 2,147,483,647] or [-2^31 ... 2^31 − 1] - */ - export type BitMask = number; - - /** - * An interface for a 2-dimensional point consisting a x and y coordinate. - * @property x {number} - The point's coordinate on X-axis. - * @property y {number} - The point's coordinate on Y-axis. - */ - export interface IPoint { - x: number; - y: number; - } - - /** - * An interface for a 2-dimensional size consisting a with and a height. - * @property w {number} - The size's width. - * @property h {number} - The size's height. - */ - export interface ISize { - w: number; - h: number; - } - - /** - * Class represents a 2-dimensional point, defined by x and y coordinates. - * @property x {number} - The point's coordinate on X-axis. - * @property y {number} - The point's coordinate on Y-axis. - */ - export class Point implements IPoint { - /** - * Constructor - * @param x {number} - The point's coordinate on X-axis. - * @param y {number} - The point's coordinate on Y-axis. - */ - constructor(x: number, y: number); - - /** - * Sets the x and y coordinate of this point - * @param x {number} - The point's coordinate on X-axis. - * @param y {number} - The point's coordinate on Y-axis. - */ - set(x: number, y: number): void; - - /** - * This method creates a copy of the current point. - * @param opt_out {H.math.Point=} - An optional point to store the copied values - * @returns {H.math.Point} - The clone of the point - */ - clone(opt_out?: Point): Point; - - /** - * This method adds given point coordinates to the current one. - * @param other {H.math.IPoint} - The point to add - * @returns {H.math.Point} - the point itself after adding - */ - add(other: IPoint): Point; - - /** - * This method subtracts given point coordinates from the current point. - * @param other {H.math.IPoint} - The point to subtract - * @returns {H.math.Point} - the point itself after subtracting - */ - sub(other: IPoint): Point; - - /** - * This method scales the current point coordinates by the given factor(s). - * @param factor {number} - multiplication factor - * @param opt_factorY {number=} - If omitted, the factor argument is used - * @returns {H.math.Point} - the point itself after scaling - */ - scale(factor: number, opt_factorY?: number): Point; - - /** - * This method rounds the x and y coordinates of the point. - * @returns {H.math.Point} - the point itself after rounding - */ - round(): Point; - - /** - * Rounds the x and y coordinates to the next smaller integer values. - * @returns {H.math.Point} - the point itself after flooring - */ - floor(): Point; - - /** - * Rounds the x and y coordinates to the next greater integer values. - * @returns {H.math.Point} - the point itself after ceiling - */ - ceil(): Point; - - /** - * This method compares current point coordinates with the supplied point coordinates. - * @param other {H.math.IPoint} - The point to compare to. - * @returns {boolean} - True if the points are equal - */ - equals(other: IPoint): boolean; - - /** - * Calculates the closest point on a given line - * @param start {H.math.IPoint} - The start point of the line - * @param end {H.math.IPoint} - The end point of the line - * @returns {H.math.IPoint} - the closest point - */ - getNearest(start: IPoint, end: IPoint): IPoint; - - /** - * This method calculates the distance to a point supplied by the caller. - * @param other {H.math.IPoint} - * @returns {number} - */ - distance(other: IPoint): number; - - /** - * This method creates a Point instance from a given IPoint object. - * @param iPoint {H.math.IPoint} - The IPoint object to use - * @returns {H.math.Point} - the created Point instance - */ - static fromIPoint(iPoint: IPoint): Point; - - x: number; - y: number; - } - - /** - * Class defines a rectangle in 2-dimensional geometric space. It is used to represent the area in projected space. - */ - export class Rect { - /** - * Constructor - * @param left {number} - The rectangle's left edge x value - * @param top {number} - The rectangle's top edge y value - * @param right {number} - The rectangle's right edge x value - * @param bottom {number} - The rectangle's bottom edge y value - */ - constructor(left: number, top: number, right: number, bottom: number); - - /** - * To set all values of the rectangle's edges - * @param left {number} - The rectangle's left edge x value - * @param top {number} - The rectangle's top edge y value - * @param right {number} - The rectangle's right edge x value - * @param bottom {number} - The rectangle's bottom edge y value - */ - set(left: number, top: number, right: number, bottom: number): void; - - /** - * To get the rectangle's top-left vertex - * @returns {H.math.Point} - */ - getTopLeft(): H.math.Point; - - /** - * To get the rectangle's bottom-right vertex - * @returns {H.math.Point} - */ - getBottomRight(): H.math.Point; - - /** - * Method checks if provided coordinates lie within rectangle. - * @param x {number} - x-coordinate to check - * @param y {number} - y-coordinate to check - * @returns {boolean} - returns true if coordinates lie within rectangle, if parameters are isNaN returns false - */ - containsXY(x: number, y: number): boolean; - - /** - * To create a rectangle from a top-left and bottom-right point pair. - * @param topLeft {H.math.IPoint} - the top-left vertex of the rectanle - * @param bottomRight {H.math.IPoint} - the bottom-right vertex of the rectanle - * @returns {H.math.Rect} - returns the rectangular area defined by the top-left and bottom-right vertices - */ - static fromPoints(topLeft: H.math.IPoint, bottomRight: H.math.IPoint): H.math.Rect; - - /** - * To clone a rectangle - * @returns {H.math.Rect} - */ - clone(): H.math.Rect; - } - - /** - * Class for representing sizes consisting of a width and height. - * @property w {number} - The size's width value - * @property h {number} - The size's height value - */ - export class Size { - /** - * Constructor - * @param width {number} - Width. - * @param height {number} - Height. - */ - constructor(width: number, height: number); - w: number; - h: number; - } - } - - /***** net *****/ - export module net { - export module Request { - export enum State { - DONE = 2, - OPENED = 1, - UNSENT = 0, - } - - // TODO no idea how this interface is set up, investigate - export interface Priority { } - } - } - - /***** places *****/ - - /***** service *****/ - export module service { - /** - * Abstract rest service class - */ - export class AbstractRestService implements H.service.IConfigurable { - /** - * Constructor - * @param opt_options {H.service.AbstractRestService.Options=} - */ - constructor(opt_options?: H.service.AbstractRestService.Options); - - /** - * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. - * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) - * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) - * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false - * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. - * @returns {H.service.IConfigurable} - */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; - } - - export module AbstractRestService { - export interface Options { - - } - } - - /** - * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getEnterpriseRoutingService. - */ - export class EnterpriseRoutingService extends H.service.AbstractRestService { - /** - * Constructor - * @param opt_options {H.service.EnterpriseRoutingService.Options=} - */ - constructor(opt_options?: H.service.EnterpriseRoutingService.Options); - - /** - * This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. - * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - */ - calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; - - /** - * This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. - * @param getRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - */ - getRoute(getRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; - - /** - * This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. - * @param getLinkInfoParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - */ - getLinkInfo(getLinkInfoParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; - - /** - * This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. - * @param calculateIsolineParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - */ - calculateIsoline(calculateIsolineParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; - } - - export module EnterpriseRoutingService { - /** - * @property subDomain {string=} - The sub-domain of the routing service relative to the platform's base URL (default is 'route') - * @property path {string=} - The path of the map tile service, default is "routing/7.2" - * @property baseUrl {H.service.Url=} - The base URL of the service, defaults to the the platform's base URL if instance was created using H.service.Platform#getEnterpriseRoutingService method. - */ - export interface Options { - subDomain?: string; - path?: string; - baseUrl?: H.service.Url; - } - } - - /** - * This class encapsulates the Geocoding REST API in a service stub with calls to its various resources implemented. - */ - export class GeocodingService extends H.service.AbstractRestService { - /** - * Constructor - * @param opt_options {H.service.GeocodingService.Options=} - */ - constructor(opt_options?: H.service.GeocodingService.Options); - - /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. - * @param geoodingParams {H.service.ServiceParameters} - the service parameters to be sent with the geocoding request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - * @returns {H.service.JsonpRequestHandle} - */ - geocode(geoodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; - - /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. - * @param reverseGeocodingParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - * @returns {H.service.JsonpRequestHandle} - */ - reverseGeocode(reverseGeocodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; - - /** - * This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. - * @param searchParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - * @returns {H.service.JsonpRequestHandle} - */ - search(searchParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; - } - - export module GeocodingService { - /** - * @property subDomain {string=} - the sub-domain of the geo-coding service relative to the platform's base URL, default is 'geocoder' - * @property path {string=} - the path of the Geocoding service, default is '6.2' - */ - export interface Options { - subDomain?: string; - path?: string; - } - } - - /** - * An interface represents an object, that can be configured credentials, settings etc. by H.service.Platform - */ - export interface IConfigurable { - /** - * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. - * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) - * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) - * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false - * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. - * @returns {H.service.IConfigurable} - */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; - } - - /** - * @property id {number} - the ID associated internally with this request - * @property cancel {function()} - this function cancels the request and invokes the errback function - */ - export interface JsonpRequestHandle { - id: number; - cancel: () => void; - } - - /** - * This class encapsulates a map tile end point of the HERE Map Tile API. - */ - export class MapTileService extends H.util.EventTarget implements H.service.IConfigurable { - /** - * Constructor - * @param opt_options {H.service.MapTileService.Options=} - */ - constructor(opt_options?: H.service.MapTileService.Options); - - /** - * This method returns the map tile type provided by this service. - * @returns {string} - the map tile type - */ - getType(): string; - - /** - * This method returns the map tile service's newest version hash. - * @returns {string} - meta information for this map tile service - */ - getVersion(): string; - - /** - * This method returns the map tile service's meta information. The method will return an object once the map tile service's data has been fetched. - * @returns {(H.service.MapTileService.Info | undefined)} - meta information for this map tile service - */ - getInfo(): H.service.MapTileService.Info | void; - - /** - * This method creates a tile provider which uses the specified map tiles. This provider can be used as a data source for an ImageTileLayer. - * @param tileType {string} - the tile type - * @param scheme {string} - the tile scheme - * @param tileSize {number} - the tile size - * @param format {string} - the tile image format - * @param opt_additionalParameters {H.service.ServiceParameters=} - a hash of additional parameters to be - * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider - * @returns {H.map.provider.ImageTileProvider} - the image tile provider - */ - createTileProvider(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_options?: H.service.TileProviderOptions): H.map.provider.ImageTileProvider; - - /** - * This method creates a tile layer. This layer can be used as a layer on a map's data model. - * @param tileType {string} - the tile type - * @param scheme {string} - the tile scheme - * @param tileSize {number} - the tile size - * @param format {string} - the tile image format - * @param opt_additionalParameters {H.service.ServiceParameters=} - Additional parameters for the map tile service - * @param opt_opacity {number=} - The opacity of this layer - * @param opt_dark {boolean=} - Indicates whether the content of this layer is mainly dark, default is false See also H.Map.Options#autoColor - * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider - * @returns {H.map.layer.TileLayer} - the tile layer - */ - createTileLayer(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_opacity?: number, opt_dark?: boolean, opt_options?: H.service.TileProviderOptions): H.map.layer.TileLayer; - - /** - * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. - * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) - * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) - * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false - * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. - * @returns {H.service.IConfigurable} - */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; - } - - export module MapTileService { - /** - * @property maps {Object} - - * @property schemes {Object} - - * @property tiletypes {Object} - - * @property formats {Object} - - * @property resolutions {Object} - - * @property languages {Object} - - */ - export interface Info { - maps: { [key: string]: any }; - schemes: { [key: string]: any }; - tiletypes: { [key: string]: any }; - formats: { [key: string]: any }; - resolutions: { [key: string]: any }; - languages: { [key: string]: any }; - } - - /** - * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for available types) - * @property version {string=} - the map version hash to use for retrieving tiles, default is newest and will be automatically updated - * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' - * @property path {string=} - the path of the map tile service, default is 'maptile/2.1' - */ - export interface Options { - type?: string; - version?: string; - subDomain?: string; - path?: string; - } - } - - /** - * A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or 'terrain'). A map type contains at least a map property which defines the basic map layer for a given map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic etc. - * @property map {H.map.layer.TileLayer} - the basic map tiles with all features and labels - * @property mapnight {H.map.layer.TileLayer} - the basic map tiles with all features and labels (night mode) - * @property xbase {H.map.layer.TileLayer=} - map tiles without features and labels - * @property xbasenight {H.map.layer.TileLayer=} - map tiles without features and labels (night mode) - * @property base {H.map.layer.TileLayer=} - map tiles without labels - * @property basenight {H.map.layer.TileLayer=} - map tiles without labels (night mode) - * @property traffic {H.map.layer.TileLayer=} - map tiles with traffic flow highlighting - * @property trafficnight {H.map.layer.TileLayer=} - map tiles with traffic flow highlighting (night mode) - * @property transit {H.map.layer.TileLayer=} - map tiles with public transit lines highlighted - * @property panorama {H.map.layer.TileLayer=} - map tiles highlighting areas with HERE StreetLevel coverage - * @property panoramanight {H.map.layer.TileLayer=} - map tiles highlighting areas with HERE StreetLevel coverage (night mode) - * @property labels {H.map.layer.TileLayer=} - transparent map tiles with labels only - */ - export interface MapType { - map: H.map.layer.TileLayer; - mapnight: H.map.layer.TileLayer; - xbase?: H.map.layer.TileLayer; - xbasenight?: H.map.layer.TileLayer; - base?: H.map.layer.TileLayer; - basenight?: H.map.layer.TileLayer; - traffic?: H.map.layer.TileLayer; - trafficnight?: H.map.layer.TileLayer; - transit?: H.map.layer.TileLayer; - panorama?: H.map.layer.TileLayer; - panoramanight?: H.map.layer.TileLayer; - labels?: H.map.layer.TileLayer; - } - - /** - * Places service implements a low level places RestApi access. Please refer to Restful API documentation for providing parameters and handling response objects. - */ - export class PlacesService extends H.service.AbstractRestService { - /** - * Constructor - * @param opt_options {H.service.PlacesService.Options=} - */ - constructor(opt_options?: H.service.PlacesService.Options); - - /** - * This is generic method to query places RestAPI. - * @param entryPoint {string} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH - * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places restful api documentation documentation for available parameters for chose entry point - * @param onResult {Function} - callback which is called when result is returned - * @param onError {Function} - callback which is called when error occured (i.e request timeout) - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - request(entryPoint: string, entryPointParams: Object, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response handling. - * @param searchParams {H.service.ServiceParameters} - places api search entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - search(searchParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and response handling. - * @param suggestParams {H.service.ServiceParameters} - places api suggest entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - suggest(suggestParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response handling. - * @param exploreParams {H.service.ServiceParameters} - places api explore entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - explore(exploreParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response handling. - * @param aroundParams {H.service.ServiceParameters} - places api around entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - around(aroundParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response handling. - * @param hereParams {H.service.ServiceParameters} - places api here entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - here(hereParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response handling. - * @param categoriesParams {H.service.ServiceParameters} - places api here entry point parameters please refer to places api documentation - * @param onResult {Function} - * @param onError {Function} - * @returns {H.service.JsonpRequestHandle} - jsonp request handle - */ - categories(categoriesParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; - - /** - * This method should be used to follow hyperlinks available in results returned by dicovery queries. - * @param hyperlink {string} - * @param onResult {Function} - * @param onError {Function} - * @param opt_additionalParameters {Object=} - additional parameters to send with request - * @returns {H.service.JsonpRequestHandle} - jsonp resquest handle - */ - follow(hyperlink: string, onResult: Function, onError: Function, opt_additionalParameters?: Object): H.service.JsonpRequestHandle; - } - - export module PlacesService { - /** - * List of available entry points - */ - export enum EntryPoint { - SEARCH, - SUGGEST, - EXPLORE, - AROUND, - HERE, - CATEGORIES, - } - - /** - * @property subDomain {string=} - the sub-domain of the places service relative to the platform's base URL, default is 'places' - * @property path {string=} - the path of the places service, default is 'places/v1' - * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL - */ - export interface Options { - subDomain?: string; - path?: string; - baseUrl?: H.service.Url; - } - } - - /** - * The Platform class represents central class from which all other service stubs are created. It also contains the shared settings to be passed to the individual service stubs, for example the root URL of the platform, application credentials, etc. - */ - export class Platform { - /** - * Constructor - * @param options {H.service.Platform.Options} - */ - constructor(options: H.service.Platform.Options); - - /** - * Method attempts to configure object that implements H.service.IConfigurable - * @param configurable {H.service.IConfigurable} - * @returns {H.service.IConfigurable} - */ - configure(configurable: H.service.IConfigurable): H.service.IConfigurable; - - /** - * This method enables or disables HTTPS communication with the platform - * @param useHTTPS {boolean} - a boolean value indicating whether to communicate with the platform via HTTPS - */ - setUseHTTPS(useHTTPS: boolean): void; - - /** - * This method configures whether to use the "customer integration testing" instance of the platform. - * @param useCIT {boolean} - a boolean value indicating whether the CIT platform instance is to be used - */ - setUseCIT(useCIT: boolean): void; - - /** - * This method modifies the base URL to be used when creating service stubs. - * @param baseUrl {H.service.Url} - the new base URL to use - */ - setBaseUrl(baseUrl: H.service.Url): void; - - /** - * This method returns the currently used base URL. - * @returns {H.service.Url} - */ - getBaseUrl(): H.service.Url; - - /** - * This method returns an instance of H.service.TrafficIncidentsService to query the Traffic API Traffic Incident Data - * @returns {H.service.TrafficIncidentsService} - a new places service instance - */ - getTrafficIncidentsService(): H.service.TrafficIncidentsService; - - /** - * This method returns an instance of H.service.MapTileService to query the Map Tile API. - * @param opt_options {H.service.MapTileService.Options=} - * @returns {H.service.MapTileService} - */ - getMapTileService(opt_options?: H.service.MapTileService.Options): H.service.MapTileService; - - /** - * This method returns an instance of H.service.venues.Service to query the Venue Maps API - * @param opt_params {H.service.venues.Service.Options=} - additional service parameters - * @returns {H.service.venues.Service} - */ - getVenueService(opt_params?: H.service.venues.Service.Options): H.service.venues.Service; - - /** - * This method returns an instance of H.service.metaInfo.Service to query the Map Tile API Metainfo Tiles - * @param opt_params {H.service.metaInfo.Service.Options=} - additional service parameters - * @returns {H.service.metaInfo.Service} - */ - getMetaInfoService(opt_params?: H.service.metaInfo.Service.Options): H.service.metaInfo.Service; - - /** - * This method creates a pre-configured set of HERE tile layers for convenient use with the map. - * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. If the parameter is an object, then it represents options and all remaining below parameters should be omitted. - * @param opt_ppi {number=} - optional 'ppi' parameter to use when querying tiles, default is not specified - * @param opt_lang {string=} - optional primary language parameter, default is not specified - * @param opt_secondaryLang {string=} - optional secondary language parameter, default is not specified - * @param opt_style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified - * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the POI Categories as described at the Map Tile API documentation POI Categories chapter. - * @returns {Object} - a set of tile layers ready to use - */ - createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, opt_pois?: (string | boolean)): H.service.Platform.MapTypes; - - /** - * This method returns an instance of H.service.RoutingService to query the Routing API. - * @param opt_options {H.service.RoutingService.Options=} - * @returns {H.service.RoutingService} - */ - getRoutingService(opt_options?: H.service.RoutingService.Options): H.service.RoutingService; - - /** - * This method returns an instance of H.service.GeocodingService to query the Geocoder API - * @param opt_options {H.service.GeocodingService.Options=} - an optional set of options for the new geocoding service to connect to - * @returns {H.service.GeocodingService} - a new geocoding service instance - */ - getGeocodingService(opt_options?: H.service.GeocodingService.Options): H.service.GeocodingService; - - /** - * This method returns an instance of H.service.PlacesService to query the Places API. - * @returns {H.service.PlacesService} - a new places service instance - */ - getPlacesService(): H.service.PlacesService; - - /** - * This method returns an instance of H.service.EnterpriseRoutingService to query the Enterprise Routing API. - * @param opt_options {H.service.EnterpriseRoutingService.Options=} - * @returns {H.service.EnterpriseRoutingService} - */ - getEnterpriseRoutingService(opt_options?: H.service.EnterpriseRoutingService.Options): H.service.EnterpriseRoutingService; - } - - export module Platform { - /** - * Options used to create default layers - * @property tileSize {number=} - tile size to be queried from the HERE Map Tile API, default is 256 - * @property ppi {number=} - 'ppi' parameter to use when querying tiles, default is not specified - * @property lg {string=} - optional primary language parameter, default is not specified - * @property lg2 {string=} - optional secondary language parameter, default is not specified - * @property style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified - * @property pois {boolean=} - indicates if pois are displayed on the map - * @property crossOrigin {(string | boolean=)} - indicates if CORS headers should be used for default layers, if false is specified, CORS headers are not set, defaults to 'anonymous'. Be aware that storing of content is not possible if crossOrigin is not set to true (see H.Map#storeContent). - */ - export interface DefaultLayersOptions { - tileSize?: number; - ppi?: number; - lg?: string; - lg2?: string; - style?: string; - pois?: boolean; - crossOrigin?: (string | boolean); - } - - /** - * @property app_id {string} - The application ID to identify the client against the platform (mandatory to provide) - * @property app_code {string} - The application code to identify the client against the platform (mandatory to provide) - * @property baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com - * @property useCIT {boolean=} - Indicates whether the Customer Integration Testing should be used, default is false - * @property useHTTPS {boolean=} - Indicates whether secure communication should be used, default is false - */ - export interface Options { - app_id: string; - app_code: string; - baseUrl?: H.service.Url; - useCIT?: boolean; - useHTTPS?: boolean; - } - - /** - * pre-configured set of HERE tile layers for convenient use with the map. - */ - export interface MapTypes { - normal?: H.service.MapType; - satellite?: H.service.MapType; - terrain?: H.service.MapType; - [key: string]: H.service.MapType; - } - } - - /** - * This class encapsulates the Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getRoutingService. - */ - export class RoutingService extends H.service.AbstractRestService { - /** - * Constructor - * @param opt_options {H.service.RoutingService.Options=} - */ - constructor(opt_options?: H.service.RoutingService.Options); - - /** - * This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. - * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Routing REST API provides a response to the request. - * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request - */ - calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; - } - - export module RoutingService { - /** - * @property subDomain {string=} - the sub-domain of the routing service relative to the platform's base URL, default is 'route' - * @property path {string=} - the path of the map tile service, default is 'routing/7.2' - * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL - */ - export interface Options { - subDomain?: string; - path?: string; - baseUrl?: H.service.Url; - } - } - - /** - * This type encapsulates URL parameters to be sent to a HERE platform service. - */ - export interface ServiceParameters { - [key: string]: string; - } - - /** - * This type encapsulates a response object provider by a HERE platform service. - */ - export interface ServiceResult { - [key: string]: string; - } - - /** - * Options which are used to initialize the tile provider. - * @property crossOrigin {boolean=} - The string to be set for the crossOrigin attribute for loaded images - */ - export interface TileProviderOptions { - crossOrigin?: boolean; - } - - /** - * TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API documentation where it is possible to retrieve traffic incident information on a tile basis - */ - export class TrafficIncidentsService extends H.service.AbstractRestService { - /** - * Constructor - * @param opt_options {H.service.TrafficIncidentsService.Options=} - */ - constructor(opt_options?: H.service.TrafficIncidentsService.Options); - - /** - * This method requests traffic incidents based on the service parameters provided. - * @param serviceParams {H.service.ServiceParameters} - * @param onResponse {function(H.service.ServiceResult)} - * @param onError {function()} - * @returns {H.service.JsonpRequestHandle} - */ - requestIncidents(serviceParams: H.service.ServiceParameters, onResponse: (result: H.service.ServiceResult) => void, onError: () => void): H.service.JsonpRequestHandle; - - /** - * This method requests traffic incident information by tile coordinates - * @param x {number} - tile column number - * @param y {number} - tile row number - * @param z {number} - zoom level - * @param onResponse {function(H.service.ServiceResult)} - callback to handle service resposne - * @param onError {function()} - callback to habdle communication error - * @param opt_serviceParams {H.service.ServiceParameters=} - optional service parameters to be added to the request - * @returns {H.service.JsonpRequestHandle} - */ - requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): H.service.JsonpRequestHandle; - } - - export module TrafficIncidentsService { - /** - * @property subDomain {string=} - the sub-domain of the traffic incidents service relative to the platform's base URL, default is 'traffic' - * @property path {string=} - the path of the traffic incidents service, default is 'traffic/6.1' - * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL - */ - export interface Options { - subDomain?: string; - path?: string; - baseUrl?: H.service.Url; - } - } - - /** - * This class represents a URL giving access to the individual parts that make up a URL,such as the scheme, host/domain, path, etc. Use the static parse method to populate a new URL object from a URL string. Be aware that URLs with user and password like "ftp://user:password@foo.bar/" are not supported! - */ - export class Url { - /** - * Constructor - * @param scheme {string} - the URL scheme (e.g. "http" or "https" or "mailto") - * @param host {string} - the host (or domain) part of the URL - * @param opt_path {string=} - the path following the host pointing to a resource - * @param opt_params {Object=} - the query string parameters of this URL - * @param opt_port {number=} - The port of the host on which the host listens. If a string is passed it must be convertible to an integer. - * @param opt_anchor {string=} - an optional anchor part of the URL (usually preceded by '#'); - */ - constructor(scheme: string, host: string, opt_path?: string, opt_params?: Object, opt_port?: number, opt_anchor?: string); - - /** - * This function parses a URL string and returns a H.service.Url object. The URL string must contain at least a scheme and a host. - * @param url {string} - The URL string to parse. - * @param opt_baseURL {string=} - The base URL to use to resolve relative URLs. If ommited the base URL of the document which loaded the API is taken. - * @returns {H.service.Url} - the parsed URL object - */ - static parse(url: string, opt_baseURL?: string): H.service.Url; - - /** - * Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note that URL parameters are not replaced but merged with the parameters of this instance. - * @returns {H.service.Url} - the clone of the URL object - */ - clone(): H.service.Url; - - /** - * This function sets the scheme of this URL object. - * @param scheme {string} - the new scheme - * @returns {H.service.Url} - this URL object - */ - setScheme(scheme: string): H.service.Url; - - /** - * This function returns the scheme of this Url object. - * @returns {string} - the scheme (for example 'http') - */ - getScheme(): string; - - /** - * This function sets the host of this URL object. - * @param host {string} - the new host - * @returns {H.service.Url} - this URL object - */ - setHost(host: string): H.service.Url; - - /** - * This function returns the host name of this Url object. - * @returns {string} - the host (for example 'api.here.com') - */ - getHost(): string; - - /** - * This function sets the path of this URL object. - * @param path {(string | undefined)} - the new path or a boolean to clear the path - * @returns {H.service.Url} - this URL object - */ - setPath(path: string | boolean): H.service.Url; - - /** - * This function returns the path part of this Url object. - * @returns {(string | undefined)} - the path (for example 'myresources/resource.html') - */ - getPath(): string | void; - - /** - * This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined values will be treated as query string parameters with no value. - * @param params {(Object | undefined)} - a hash of query string parameters specifying the parameters to be set.or a boolean to clear the parameters. - * @returns {H.service.Url} - this URL object - */ - setQuery(params?: Object | boolean): H.service.Url; - - /** - * This function returns a boolean value indicating whether there are any query string parameter associated with this URL. - * @returns {boolean} - true if there are parameters, false if none are present - */ - hasQuery(): boolean; - - /** - * This function returns the query object of this Url object. - * @returns {Object} - the query object - */ - getQuery(): Object; - - /** - * This function sets the anchor of this URL object. - * @param anchor {(string | boolean | undefined)} - the new anchor or undefined to clear the anchor - * @returns {H.service.Url} - this URL object - */ - setAnchor(anchor?: string | boolean): H.service.Url; - - /** - * This function returns the anchor of this Url object. - * @returns {(string | undefined)} - the anchor - */ - getAnchor(): string | void; - - /** - * This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in the argument and this URL's parameters will be overwritten. Key-value pairs which are defined in the argument and are not defined in this URL's parameters will be added. Prototype properties and function properties will not be merged. - * @param other {Object} - the parmeters to be merged into this URL's query string parameters - * @returns {H.service.Url} - this URL object - */ - mergeQuery(other: Object): H.service.Url; - - /** - * This function adds a sub-domain to the host of this URL object. - * @param subDomain {string} - the sub domain (non-empty string) to be added - * @returns {H.service.Url} - this URL object - */ - addSubDomain(subDomain: string): H.service.Url; - - /** - * This function adds a sub-path to this URL's path - * @param subPath {string} - the path to be added - * @returns {H.service.Url} - this URL object - */ - addSubPath(subPath: string): H.service.Url; - - /** - * This function formats this URL object to a full URL string. - * @returns {string} - the URL's string representation - */ - toString(): string; - } - - export module metaInfo { - /** - * This class encapsulates a Metainfo Tile end point of the HERE Map Tile API. - */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { - /** - * Constructor - * @param opt_options {H.service.metaInfo.Service.Options=} - additional service parameters - */ - constructor(opt_options?: H.service.metaInfo.Service.Options); - - /** - * This method returns the meta info tile service's newest version hash. - * @returns {string} - meta information for this map tile service - */ - getVersion(): string; - - /** - * This method returns the meta info tile service's meta information. The method will return an object once the map tile service's data has been fetched. - * @returns {(H.service.metaInfo.Service.Info | undefined)} - meta information for this meta info tile service - */ - getInfo(): H.service.metaInfo.Service.Info | void; - - /** - * This method creates a tile provider which uses the meta info tile backend. This provider can be used as a data source for an TileLayer. - * @param tileSize {number} - The tile size - * @param pixelRatio {number} - The tile's pixel ratio, should be aligned with base map tile - * @param opt_categoryFilter {Array=} - A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names. - * @param opt_additionalParameters {H.service.ServiceParameters=} - Additional parameters for the meta info service - * @param opt_tileType {string=} - the tile type (default is 'maptile') - * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') - * @returns {H.map.provider.TileProvider} - the tile provider - */ - createTileProvider(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.provider.TileProvider; - - /** - * This method creates a tile layer. This layer can be used as a layer on a map's data model. - * @param tileSize {number} - The tile size - * @param pixelRatio {number} - The tile's pixel ratio, should be aligned with base map tile - * @param opt_categoryFilter {Array=} - A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names. - * @param opt_additionalParameters {H.service.ServiceParameters=} - Additional parameters for the meta info service - * @param opt_tileType {string=} - the tile type (default is 'maptile') - * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') - * @returns {H.map.layer.TileLayer} - the tile layer - */ - createTileLayer(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.layer.TileLayer; - - /** - * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. - * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) - * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) - * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false - * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. - * @returns {H.service.IConfigurable} - */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; - } - - export module Service { - /** - * @property maps {Object} - - * @property schemes {Object} - - * @property tiletypes {Object} - - * @property formats {Object} - - * @property resolutions {Object} - - * @property languages {Object} - - */ - export interface Info { - maps: { [key: string]: any }; - schemes: { [key: string]: any }; - tiletypes: { [key: string]: any }; - formats: { [key: string]: any }; - resolutions: { [key: string]: any }; - languages: { [key: string]: any }; - } - - /** - * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for available types) - * @property version {string=} - the map version hash to use for retrieving tiles, default is newest and will be automatically updated - * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' - */ - export interface Options { - type?: string; - version?: string; - subDomain?: string; - } - } - - /** - * This class utilizes Metainfo Tiles functionality provided by the Map Tile API to load meta information about map objects (buildings, labels, public transport etc.). - */ - export class TileProvider extends H.map.provider.RemoteTileProvider { - /** - * Constructor - * @param service {(H.service.metaInfo.Service | H.service.MapTileService)} - the tile service which holds information from about the source of the tiles - * @param opt_params {H.service.ServiceParameters=} - an additional set of URL parameters - * @param opt_options {H.service.metaInfo.TileProvider.Options=} - additional parameters - */ - constructor(service: (H.service.metaInfo.Service | H.service.MapTileService), opt_params?: H.service.ServiceParameters, opt_options?: H.service.metaInfo.TileProvider.Options); - } - - export module TileProvider { - /** - * Configuration object which can be used to initialize the TileProvider. - * @property tileType {string=} - The tile type for which to request meta info - * @property scheme {string=} - The map scheme for which to request meta info - * @property tileCacheSize {number=} - The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32 - * @property tileSize {number=} - The size of the tiles rendered by this provider (must be power of 2, default is 256) - * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays - * @property categoryFilter {Array=} - A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names. - */ - export interface Options { - tileType?: string; - scheme?: string; - tileCacheSize?: number; - tileSize?: number; - pixelRatio?: number; - categoryFilter?: Array; - } - } - } - - export module venues { - /** - * The class represents the building in the venue hiearachy (see H.service.venues.Venue) and holds floors that belong to the building. - */ - export class Building extends H.map.Group { - /** - * Constructor - * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue building - * @param uid {string} - The unique identifier of this building - * @param minLevel {number} - The minimum floor level of this building - * @param maxLevel {number} - The maximum floor level of this building - */ - constructor(provider: H.map.provider.ObjectProvider, uid: string, minLevel: number, maxLevel: number); - - /** - * Method returns the parent object - venue (see H.service.venues.Venue) to which the building belongs to. - * @returns {H.service.venues.Venue} - */ - getVenue(): H.service.venues.Venue; - - /** - * Method returns the minimum floor level of this building. - * @returns {number} - */ - getMinLevel(): number; - - /** - * Method returns the maximum floor level of this building - * @returns {number} - */ - getMaxLevel(): number; - - /** - * Method returns the floor (see H.service.venues.Floor) if one was already loaded. This method doesn't make attempt to fetch the floor data. - * @param level {number} - floor level within minimum and maximum level boundaries for the building - * @returns {(H.service.venues.Floor | undefined)} - The floor object or undefined if floor was not loaded - */ - getFloor(level: number): H.service.venues.Floor | void; - } - - /** - * The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class holds information about floor geometry and spaces (see H.service.venues.Space) that belong to this floor. - */ - export class Floor extends H.map.Group { - /** - * Constructor - * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue floor - * @param data {*} - The meta data of this floor - * @param level {number} - The level of this floor - */ - constructor(provider: H.map.provider.ObjectProvider, data: any, level: number); - - /** - * Method returns the level of the floor in the building. - * @returns {number} - */ - getLevel(): number; - - /** - * Method returns map geometry that represents floor boundaries. - * @returns {(H.service.venues.Space | undefined)} - */ - getFloorSpace(): H.service.venues.Space | void; - - /** - * Method returns the H.map.Group of all spaces that belong to the floor. - * @returns {H.map.Group} - */ - getSpaces(): H.map.Group; - - /** - * Method returns parent object - building (see H.service.venues.Building) of the floor. - * @returns {H.service.venues.Building} - */ - getBuilding(): H.service.venues.Building; - - /** - * Method returns raw data associated with the floor. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html - * @returns {*} - the raw floor data object - */ - getData(): any; - - /** - * Method returns the space object with the given ID, that belongs to the floor. - * @param id {string} - The ID of the space. - * @returns {(H.service.venues.Space | undefined)} - The requested space or undefined if space not found. - */ - getSpace(id: string): H.service.venues.Space | void; - } - - /** - * This class encapsulates methods to call Venue Maps API endpoints. - */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { - /** - * Constructor - * @param opt_options {H.service.venues.Service.Options=} - additional service parameters - */ - constructor(opt_options?: H.service.venues.Service.Options); - - /** - * This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object, or the onError callback if a communication error occured. - * @param serviceParams {H.service.ServiceParameters} - the service parameters to be sent with the discovery request - * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Venue Maps API provides a response to the request - * @param onError {function(string)} - this function will be called if a communication error occurs during request and error type is passed as an argument - */ - discover(serviceParams: H.service.ServiceParameters, onResult: (res: H.service.ServiceResult) => void, onError: (s: string) => void): void; - - /** - * This method creates a tile layer which can be added to the map in order to see the venues. It uses Interaction Tile endpoint of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html. - * @param opt_options {H.service.venues.TileProvider.Options=} - Tile provider options - * @returns {H.map.layer.TileLayer} - the tile layer - */ - createTileLayer(opt_options?: H.service.venues.TileProvider.Options): H.map.layer.TileLayer; - - /** - * Method returns current state of the service. - * @returns {H.service.venues.Service.State} - State of the service - */ - getState(): H.service.venues.Service.State; - - /** - * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. - * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) - * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) - * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false - * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. - * @returns {H.service.IConfigurable} - */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; - } - - export module Service { - /** - * @property subDomain {string=} - the sub-domain of the Venue Maps service relative to the platform's base URL, default is 'venue.maps' - * @property path {string=} - the path to append after host name when making requests to the Venue Maps API, default is empty - */ - export interface Options { - subDomain?: string; - path?: string; - } - - /** - * The state types of the H.service.venues.Service. Possible states are: - */ - export enum State { - ERROR, - INIT, - READY, - } - } - - /** - * Represents a spatial object for this space. Each space object contains data associated with that space and can be retrieved by using H.service.venues.Space#getData method. - */ - export class Space { - /** - * Constructor - * @param provider {H.map.provider.ObjectProvider} - The provider of this object. - * @param uid {string} - The unique identifier of this space - * @param data {*} - The meta data of this space - * @param opt_isFloorSpace {boolean=} - Indicates whether this space represents a floor itself, defaults to false - */ - constructor(provider: H.map.provider.ObjectProvider, uid: string, data?: any, opt_isFloorSpace?: boolean); - - /** - * The method indicates whether the spatial object represents the whole floor space or a space within a floor boundaries, that belongs to the floor. - * @returns {boolean} - True if this spatial object represents the floor space. - */ - isFloorSpace(): boolean; - - /** - * This method sets custom style to use for rendering the labels. Should be called before the first render of the space, otherwise has no any effect. Note that due to the design consistency currently it is not allowed to change the font family and the size of the labels. - * @param labelStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - Custom label style - */ - initLabelStyle(labelStyle: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): void; - - /** - * Method returns parent object - floor (see H.service.venues.Floor) of the space. - * @returns {H.service.venues.Floor} - */ - getFloor(): H.service.venues.Floor; - - /** - * Method returns raw data associated with the space. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html - * @returns {Object} - raw space data object - */ - getData(): Object; - } - - /** - * This class represents a Venue Maps tile provider which requests venues tiles from a platform venue tile service. - */ - export class TileProvider extends H.map.provider.RemoteTileProvider { - /** - * Constructor - * @param service {H.service.venues.Service} - * @param opt_options {H.service.venues.TileProvider.Options=} - */ - constructor(service: H.service.venues.Service, opt_options?: H.service.venues.TileProvider.Options); - - /** - * Method specifies which floor level of the venues must be fetched by provider. Floor level is global to all venues and defaults to 0. - * @param level {number} - */ - setCurrentLevel(level: number): void; - - /** - * Method returns the floor level that provider uses for tile fetching. - * @returns {number} - current provider's floor level - */ - getCurrentLevel(): number; - } - - export module TileProvider { - /** - * Configuration object which can be used to initialize the TileProvider. - * @property tileCacheSize {number=} - The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32 - * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays - * @property onSpaceCreated {function(H.service.venues.Space)=} - A callback function that is called on every created space (see H.service.venues.Space) object. The function can be used for space object styling. - */ - export interface Options { - tileCacheSize?: number; - pixelRatio?: number; - onSpaceCreated?: (space: H.service.venues.Space) => void; - } - } - - /** - * The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from H.map.Group and holds building objects (see H.service.venues.Building). Building objects hold floor objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces (see H.service.venues.Space) that are spatial map objects and reside inside floor containers. - */ - export class Venue extends H.map.Group { - /** - * Constructor - * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue - * @param uid {string} - The unique identifier of this venue - */ - constructor(provider: H.map.provider.ObjectProvider, uid: string); - - /** - * Method returns the building object, that belongs to the venue, with the given ID . The method doesn't attempt to fetch building data. - * @param id {string} - the ID of the building - * @returns {(H.service.venues.Building | undefined)} - The requested building or undefined if building wasn't loaded - */ - getBuilding(id: string): H.service.venues.Building | void; - - /** - * Method returns map of all loaded buildings associated with the venue. - * @returns {Object<*, H.service.venues.Building>} - */ - getBuildings(): any; - } - } - } - - /***** ui *****/ - export module ui { - /** - * This class represents the base class for UI controls on the map. - */ - export class Control extends H.ui.base.Container { - /** - * This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes. - * @param unitSystem {H.ui.UnitSystem} - the unit system the UI currently uses - */ - onUnitSystemChange(unitSystem: H.ui.UnitSystem): void; - - /** - * This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes. - * @param engineType {H.Map.EngineType} - the engine type the map currently uses - */ - onMapEngineTypeChange(engineType: H.Map.EngineType): void; - - /** - * This method returns the map to which this control is attached. - * @returns {?H.Map} - return the map - */ - getMap(): H.Map; - - /** - * This method returns the localization object which corresponds to the UI's current locale. - * @returns {H.ui.i18n.Localization} - */ - getLocalization(): H.ui.i18n.Localization; - - /** - * This method returns this control's layout alignment. - * @returns {H.ui.LayoutAlignment} - the control's current layout alignment - */ - getAlignment(): H.ui.LayoutAlignment; - - /** - * This method sets the control's layout alignments. - * @param alignment {H.ui.LayoutAlignment} - The new alignment of the control - * @returns {H.ui.Control} - returns this control instance - */ - setAlignment(alignment: H.ui.LayoutAlignment): H.ui.Control; - } - - /** - * This class represents a distance measurement control which helps calculating distances between geographical locations indicated by the user clicks. - */ - export class DistanceMeasurement extends H.ui.Control { - /** - * Constructor - * @param opt_options {H.ui.DistanceMeasurement.Options=} - optional parameters to be passed to this control - */ - constructor(opt_options?: H.ui.DistanceMeasurement.Options); - } - - export module DistanceMeasurement { - /** - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM - * @property startIcon {H.map.Icon=} - the icon to use for the first measurement point - * @property stopoverIcon {H.map.Icon=} - the icon to use for the intermediate measurement points - * @property endIcon {H.map.Icon=} - the icon to use for the last measurement point - * @property splitIcon {H.map.Icon=} - the icon to use for indicating position under pointer over the line where new point will be created once user clicks - * @property lineStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - the style to use for connecting lines of the measurement points - * @property distanceFormatter {function(number)=} - Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to the specified measurement unit (see H.ui.UI.Options#unitSystem) - */ - export interface Options { - alignment?: H.ui.LayoutAlignment; - startIcon?: H.map.Icon; - stopoverIcon?: H.map.Icon; - endIcon?: H.map.Icon; - splitIcon?: H.map.Icon; - lineStyle: H.map.SpatialStyle | H.map.SpatialStyle.Options; - distanceFormatter?(n: number): void; - } - } - - /** - * This class represents an information bubble bound to a geo-position on the map. - */ - export class InfoBubble extends base.Element { - /** - * Constructor - * @param position {H.geo.IPoint} - the geo-position to which this info bubble corresponds - * @param opt_options {H.ui.InfoBubble.Options=} - optional parameters to be passed to the info bubble - */ - constructor(position: H.geo.IPoint, opt_options?: InfoBubble.Options); - - /** - * This method sets the geo-position of this info bubble - * @param position {(H.geo.IPoint | H.geo.Point)} - the new geo-position of this bubble - */ - setPosition(position: H.geo.IPoint | H.geo.Point): void; - - /** - * This method returns this info bubble's current state. - * @returns {H.ui.InfoBubble.State} - this bubble's current state - */ - getState(): InfoBubble.State; - - /** - * This method sets the info bubble's state. - * @param state {H.ui.InfoBubble.State} - the new state - */ - setState(state: InfoBubble.State): void; - - /** - * This method closes the info bubble (setting its state to CLOSED) - */ - close(): void; - - /** - * This method opens the info bubble (setting its state to OPEN) - */ - open(): void; - - /** - * This method returns the bubble's content element. - * - * Note: Before adding an info bubble to a UI object the content element is null. - * @returns {?HTMLElement} - the content element of this info bubble - */ - getContentElement(): HTMLElement; - - /** - * This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of this info bubble or a HTML node which is appended to the content element. - * @param content {(string | Node)} - the content for this bubble - */ - setContent(content: string | Node): void; - } - - export module InfoBubble { - /** - * This enumeration holds the state an info bubble can have. - */ - export enum State { - /** This value represents the state where an info bubble is open and visible (value: 'open'). */ - OPEN, - /** This value represents the state where an info bubble is closed and invisible (value: 'closed') */ - CLOSED, - } - - export interface Options { - /** - * a callback to be invoked when the info bubble's state changes - * @param event {H.util.Event} - */ - onStateChange?(event: H.util.Event): void; - - /** - * content to be added to the info bubble - */ - content: string | Node; - } - } - - /** - * This enumeration holds the possible layout alignments for the UI elements. - */ - export enum LayoutAlignment { - TOP_LEFT, - TOP_CENTER, - TOP_RIGHT, - LEFT_TOP, - LEFT_MIDDLE, - LEFT_BOTTOM, - RIGHT_TOP, - RIGHT_MIDDLE, - RIGHT_BOTTOM, - BOTTOM_LEFT, - BOTTOM_CENTER, - BOTTOM_RIGHT, - } - - /** - * This class represents a menu control allowing to control which map type the map shows, etc. - */ - export class MapSettingsControl extends H.ui.Control { - /** - * Constructor - * @param opt_options {H.ui.MapSettingsControl.Options=} - optional parameters to be passed to this control - */ - constructor(opt_options?: H.ui.MapSettingsControl.Options); - - /** - * Sets the traffic incidents layer to be shown when activating the respective button on the map settings control. - * @param incidentsLayer {H.map.layer.Layer} - the incidents layer - */ - setIncidentsLayer(incidentsLayer: H.map.layer.Layer): void; - } - - export module MapSettingsControl { - /** - * The map type entry is an object containing a display name and a map type object to which it refers. - * @property name {string} - label which describes the map type - * @property mapType {H.service.MapType} - reference to map type - */ - export interface MapTypeEntry { - name: string; - mapType: H.service.MapType; - } - - /** - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT - * @property entries {Array=} - the map type entries to be shown in this map settings control - * @property incidents {H.map.layer.Layer} - the traffic incidents layer to be activated by the map settings control - */ - export interface Options { - alignment?: H.ui.LayoutAlignment; - entries?: Array; - incidents: H.map.layer.Layer; - } - } - - /** - * This class represents the UI controls for panorama - */ - export class Pano extends H.ui.Control { - /** - * Constructor - * @param opt_options {H.ui.Pano.Options=} - optional parameters to be passed to the map. - */ - constructor(opt_options?: H.ui.Pano.Options); - } - - export module Pano { - /** - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM - * @property mapTypes {H.service.MapTypes} - The map types to use - */ - export interface Options { - alignment?: H.ui.LayoutAlignment; - mapTypes: H.service.MapType; - } - } - - /** - * This class represents a UI element showing the current zoom scale. - */ - export class ScaleBar { - /** - * Constructor - * @param opt_options {H.ui.ScaleBar.Options=} - optional parameters to be passed to this scale bar. - */ - constructor(opt_options?: H.ui.ScaleBar.Options); - } - - export module ScaleBar { - /** - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT - */ - export interface Options { - alignment?: H.ui.LayoutAlignment; - } - } - - /** - * This class encapsulates map UI functionality. - */ - export class UI implements H.util.ICapturable { - /** - * Constructor - * @param map {H.Map} - * @param opt_options {H.ui.UI.Options=} - */ - constructor(map: H.Map, opt_options?: UI.Options); - - /** - * This method returns this ui's root element. - * @returns {ELement} - the root element - */ - getElement(): Element; - - /** - * Returns the map instance to which this UI was added. - * @returns {H.Map} - */ - getMap(): H.Map; - - /** - * This method returns this UI object's current unit system. - * @returns {H.ui.UnitSystem} - the current unit system - */ - getUnitSystem(): UnitSystem; - - /** - * This method sets this UI object's unit system for displaying distances. - * @param unitSystem {H.ui.UnitSystem} - the unit system to use - */ - setUnitSystem(unitSystem: UnitSystem): void; - - /** - * Toggles this UI's unit system between {@link H.ui.UnitSystem.METRIC} and {@link H.ui.UnitSystem.IMPERIAL}. - */ - toggleUnitSystem(): void; - - /** - * This method adds an info bubble to the UI. - * @param bubble {H.ui.InfoBubble} - the info bubble to be added - */ - addBubble(bubble: InfoBubble): void; - - /** - * This method removes a previously added info bubble from the UI. - * @param bubble {H.ui.InfoBubble} - the info bubble to be removed - */ - removeBubble(bubble: InfoBubble): void; - - /** - * This method returns a list of info bubble objects which are currently attached to this UI. - * @returns {Array} - the list of info bubbles - */ - getBubbles(): Array; - - /** - * This method appends a control to the UI. - * @param name {string} - the name under which to register this control - * @param control {H.ui.Control} - the control to add to this UI - */ - addControl(name: string, control: Control): void; - - /** - * Removes a previously registered control from the UI object. - * @param name {string} - the name under which this control was previously registered - * @returns {H.ui.Control} - the removed control - */ - removeControl(name: string): Control; - - /** - * This method returns a UI control which was previously registered with the provided name. - * @param name {string} - the name under which the control was registered. - * @returns {H.ui.Control} - the control or undefined if the control does not exist. - */ - getControl(name: string): Control; - - /** - * This function creates the default UI including the zoom control, - * map settings control and scalebar and panorama discovery control. - * The default controls will be assigned the following values: - * - * Zoom control: - * id: 'zoom' - * alignment: 'right-middle' - * Map settings control: - * id: 'mapsettings' - * alignment: 'bottom-right' - * Scalebar: - * id: 'scalebar' - * alignment: 'bottom-right' - * Pano: - * id: 'panorama' - * alignment: 'top-right' - * - * @param map {H.Map} - The map instance to which to append the UI - * @param mapTypes {Object} - The map types to use - * @param opt_locale {(H.ui.i18n.Localization | string)=} - the language to use (or a full localization object). - * @returns {H.ui.UI} - the UI instance configured with the default controls - */ - static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes, opt_locale?: H.ui.i18n.Localization | string): UI; - - /** - * This method is used to capture the element view - * @param canvas {HTMLCanvasElement} - HTML Canvas element to draw the view of the capturable element - * @param pixelRation {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 - * @param callback {ICapturable~captureCallback} - Callback function to call once result of the capturing is ready - * @param opt_errback {ICapturable~errorCallback} - Callback function to call if error occurred during capturing - */ - capture(canvas: HTMLCanvasElement, pixelRation: number, callback: (canvas?: HTMLCanvasElement) => void, opt_errback?: (error: string) => void): void; - - /** - * @callback ICapturable~captureCallback - * @param canvas {HTMLCanvasElement=} - */ - - /** - * @callback ICapturable~errorCallback - * @param error {string} - */ - } - - export module UI { - /** - * Optional parameters to be passed to the UI constructor. - * @property unitSystem {H.ui.UnitSystem=} - An optional unit system to be used by the UI, default is H.ui.UnitSystem.METRIC - * @property zoom {(H.ui.ZoomControl.Options | boolean)=} - - * @property zoomrectangle {(H.ui.ZoomRectangle.Options | boolean)=} - - * @property mapsettings {(H.ui.MapSettingsControl.Options | boolean)=} - - * @property scalebar {(H.ui.ScaleBar.Options | boolean)=} - - * @property panorama {(H.ui.Pano.Options | boolean)=} - - * @property distancemeasurement {(H.ui.DistanceMeasurement.Options | boolean)=} - - * @property locale {(H.ui.i18n.Localization | string)=} - defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map, or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' by default - */ - export interface Options { - unitSystem?: H.ui.UnitSystem; - zoom?: (H.ui.ZoomControl.Options | boolean); - zoomrectangle?: (H.ui.ZoomRectangle.Options | boolean); - mapsettings?: (H.ui.MapSettingsControl.Options | boolean); - scalebar?: (H.ui.ScaleBar.Options | boolean); - panorama?: (H.ui.Pano.Options | boolean); - distancemeasurement?: (H.ui.DistanceMeasurement.Options | boolean); - locale?: (H.ui.i18n.Localization | string); - } - } - - /** - * This enumeration holds the possible unit systems for the UI to display distances. - */ - export enum UnitSystem { - /** This value represents the imperial unit system using miles and feet (value: 'imperial'). */ - IMPERIAL, - /** This value represents the metric unit system using meters and kilometers, etc (value: 'metric'). */ - METRIC, - } - - /** - * This class represents the UI controls for zooming in an out of the map. - */ - export class ZoomControl extends H.ui.Control { - /** - * Constructor - * @param opt_options {H.ui.ZoomControl.Options=} - optional parameters to be passed to the map. - */ - constructor(opt_options?: H.ui.ZoomControl.Options); - - /** - * This method returns the zoom speed (in levels per millisecond) which is applied when the button is pressed constantly. - * @returns {number} - the current zoom speed - */ - getZoomSpeed(): number; - } - - export module ZoomControl { - /** - * @property zoomSpeed {number=} - the speed if zooming in and out in levels per millisecond, defaults to 0.05 - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, defaults to H.ui.LayoutAlignment.RIGHT_MIDDLE - * @property slider {boolean=} - flag whether to show the slider (true) or not, defaults to false - * @property sliderSnaps {boolean=} - flag whether slider should snap to the integer values or not, defaults to false. This option has effect only if slider is enabled. - */ - export interface Options { - zoomSpeed?: number; - alignment?: H.ui.LayoutAlignment; - slider?: boolean; - sliderSnaps?: boolean; - } - } - - /** - * This class represents a zoom rectangle control element that allows zooming to the selected area on the screen. - */ - export class ZoomRectangle extends H.ui.Control { - /** - * Constructor - * @param opt_options {H.ui.ZoomRectangle.Options=} - optional parameters to be passed to this control - */ - constructor(opt_options?: H.ui.ZoomRectangle.Options); - } - - export module ZoomRectangle { - /** - * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT - * @property adjustZoom {function(number, H.Map) : number=} - optional function that defines how zoom level should be changed, by default zoom level is picked to fit the bounding rectangle into the view port. - */ - export interface Options { - alignment?: H.ui.LayoutAlignment; - adjustZoom?(n: number, m: H.Map): number; - } - } - - type ES6Element = Element; - - /** - * This namespace contains basic UI elements from which the UI controls are built. - */ - export module base { - export class Container extends H.util.EventTarget { - /** - * Constructor - * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' - * @param opt_className {string=} - an optional class name to be used on this element - * @param opt_children {Array=} - optional child elements to be added to this container - */ - constructor(opt_elementType?: string, opt_className?: string, opt_children?: Array); - - /** - * Adds a child element to be rendered within the container element. - * @param child {H.ui.base.Element} - the child element to be added - * @returns {H.ui.base.Container} - this container instance - */ - addChild(child: Element): Container; - - /** - * Returns the child collection of this container. - * @returns {Array} - Returns the child collection of this container. - */ - getChildren(): Array; - - /** - * Removes a child element from this container's child collection. - * @param child {H.ui.base.Element} - the child element to be removed - */ - removeChild(child: Element): void; - - /** - * This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which may be modified by deriving classes. - * @param element {Element} - this UI element's HTML representation - * @param doc {Document} - the HTML document into which the element is currently being rendered - */ - renderInternal(element: ES6Element, doc: Document): void; - - /** - * This method returns this UI element's disabled state as a boolean value. - * @returns {boolean} - true if the element is disabled, false otherwise - */ - isDisabled(): boolean; - - /** - * This method set's the disabled state of this UI element. - * @param disabled {boolean} - true to disable the element, false to enable it - * @param opt_force {boolean=} - an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state - * @returns {H.ui.base.Element} - this element instance - */ - setDisabled(disabled: boolean, opt_force?: boolean): ES6Element; - - /** - * This method returns a previously stored arbitrary data from this element. - * @returns {*} - the previously stored data object or null if not data was stored. - */ - getData(): any; - - /** - * This method stores arbitrary data with this UI element. - * @param data {*} - the data to be stored - */ - setData(data: any): void; - - /** - * This method returns the HTML element this UI element renders. - * - * Note: Before the UI element was rendered the method returns null. - * @returns {?HTMLElement} - the element - */ - getElement(): HTMLElement; - - /** - * Sets the visibility of this element. - * @param visibility {boolean} - visibility - */ - setVisibility(visibility: boolean): void; - - /** - * Returns the visibility of this element. - * @returns {boolean} - visibility - */ - getVisibility(): boolean; - - /** - * This method adds a CSS class to this UI element (if it is not already present). - * @param className {string} - the CSS class name to add - * @returns {H.ui.base.Element} - this UI element instance - */ - addClass(className: string): Element; - - /** - * This method removes a CSS class from this UI element (if it is present). - * @param className {string} - the CSS class name to remove - * @returns {H.ui.base.Element} - this UI element instance - */ - removeClass(className: string): Element; - } - - export class Element extends H.util.EventTarget { - /** - * Constructor - * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' - * @param opt_className {string=} - an optional class name to be used on this element - */ - constructor(opt_elementType?: string, opt_className?: string); - - /** - * This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which may be modified by deriving classes. - * @param element {Element} - this UI element's HTML representation - * @param doc {Document} - the HTML document into which the element is currently being rendered - */ - renderInternal(element: ES6Element, doc: Document): void; - - /** - * This method returns this UI element's disabled state as a boolean value. - * @returns {boolean} - true if the element is disabled, false otherwise - */ - isDisabled(): boolean; - - /** - * This method set's the disabled state of this UI element. - * @param disabled {boolean} - true to disable the element, false to enable it - * @param opt_force {boolean=} - an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state - * @returns {H.ui.base.Element} - this element instance - */ - setDisabled(disabled: boolean, opt_force?: boolean): ES6Element; - - /** - * This method returns a previously stored arbitrary data from this element. - * @returns {*} - the previously stored data object or null if not data was stored. - */ - getData(): any; - - /** - * This method stores arbitrary data with this UI element. - * @param data {*} - the data to be stored - */ - setData(data: any): void; - - /** - * This method returns the HTML element this UI element renders. - * - * Note: Before the UI element was rendered the method returns null. - * @returns {?HTMLElement} - the element - */ - getElement(): HTMLElement; - - /** - * Sets the visibility of this element. - * @param visibility {boolean} - visibility - */ - setVisibility(visibility: boolean): void; - - /** - * Returns the visibility of this element. - * @returns {boolean} - visibility - */ - getVisibility(): boolean; - - /** - * This method adds a CSS class to this UI element (if it is not already present). - * @param className {string} - the CSS class name to add - * @returns {H.ui.base.Element} - this UI element instance - */ - addClass(className: string): Element; - - /** - * This method removes a CSS class from this UI element (if it is present). - * @param className {string} - the CSS class name to remove - * @returns {H.ui.base.Element} - this UI element instance - */ - removeClass(className: string): Element; - } - } - - /** - * Namespace contains functionality related to internationalization. - */ - export module i18n { - /** - * Default available locales. UI provides default translations for this set of locale codes. - */ - export const defaultLocales: Array; - - /** - * This class is used for internationalization of UI components. - */ - export class Localization { - constructor(locale: string, opt_translationMap?: any); - - /** - * This method returns current locale code i.e 'en-US' - * @returns {string} - locale code - */ - getLocale(): string; - - /** - * This method returns translation keys for current locale. Keys from this set can be used to get translations via translate method. - * @returns {Array} - */ - getKeys(): Array; - - /** - * This method returns a boolean value indicating whether this localization object has a translation for the specified translation key. - * @param key {string} - a translation key - * @returns {boolean} - true if the key exists, otherwise false - */ - hasKey(key: string): boolean; - - /** - * This method returns translation for provided key. It throws exception if translation is not available - * @param key {string} - a translation key - * @returns {string} - a localized string corresponding to provided key - */ - translate(key: string): string; - } - } - } - - /***** util *****/ - export module util { - /** - * The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until the cache's content exceeds a maximum size. Once the size of all content elements exceeds the maximum size the cache will drop the least recently retrieved elements until the size of the cache is within the bounds of its maximum size. Data elements are always associated with an identifier that allow to retrieve them at a later stage and their content size. - */ - export class Cache implements H.util.ICache { - /** - * Constructor - * @param maxSize {number} - the maximum size of the cache - * @param opt_onDrop {function(string, ?, number)=} - A callback to be invoked when a data element is dropped from the cache - * @param opt_filter {(function(string, ?, number) : boolean)=} - A function to filter data elements that are not to be cached - */ - constructor(maxSize: number, opt_onDrop?: (s: string, i: any, n: number) => void, opt_filter?: (s: string, i: any, n: number) => boolean); - - /** - * This method sets this cache's maximum size to a new size. If the cache's contents exceed the new size, least recently used data elements will be dropped. - * @param maxSize {number} - the new maximum size of this cache. - * @returns {H.util.Cache} - this cache - */ - setMaxSize(maxSize: number): H.util.Cache; - - /** - * This method returns the maximum size of this cache. - * @returns {number} - the maximum size of the cache - */ - getMaxSize(): number; - - /** - * This method returns the current size of this cache. - * @returns {number} - the current size of the cache - */ - getCurrentSize(): number; - - /** - * This method adds an element to the cache. - * @param id {*} - The identifier of this data element, the value is converted to a string. - * @param data {*} - the actual data to be stored - * @param size {number} - the size of the data element - * @returns {boolean} - a boolean value indicating whether the data was added - */ - add(id: any, data: any, size: number): boolean; - - /** - * This method retrieves an element from the cache. - * @param id {string} - the ID of the data element to be retrieved. - * @param opt_noUpdate {boolean=} - and optional flag to indicate that the retrieved object should not be marked as 'most recently used'. - * @returns {*} - returns the data associated with the ID or undefined if the data element is not currently in the cache. - */ - get(id: string, opt_noUpdate?: boolean): any; - - /** - * This method explicitly drops an element from the cache. - * @param id {*} - the id of the item to drop - */ - drop(id: any): void; - - /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. - * @param callback {function(string, ?, number)} - the callback to be invoked for each entry - * @param opt_ctx {Object=} - an optional context object to be used as this within the callback - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called - */ - forEach(callback: (s: string, i: any, n: number) => void, opt_ctx?: any, opt_matcher?: (s: string, i: any, n: number) => boolean): void; - - /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively - */ - removeAll(opt_matcher?: (s: string, i: any, n: number) => boolean): void; - - /** - * This method registers a callback that should be called each time an entry is dropped from the cache. - * @param callback {(function(string, ?, number))} - the callback to be invoked for each entry - */ - registerOnDrop(callback: (s: string, i: any, n: number) => void): void; - } - - /** - * This event indicates a change. It contains the old and the new value. - * @property target {*} - Object which triggered the event - * @property currentTarget {*} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class ChangeEvent extends H.util.Event { - /** - * Constructor - * @param type {string} - The type of the event - * @param newValue {*} - The new value of the property - * @param oldValue {*} - The previous value of the property - */ - constructor(type: string, newValue: any, oldValue: any); - - /** - * Sets defaultPrevented to true. Which can be used to prevent some default behavior. - */ - preventDefault(): void; - - /** - * Stops propagation for current event. - */ - stopPropagation(): void; - - target: any; - currentTarget: any; - type: string; - defaultPrevented: boolean; - } - - /** - * This class represents a contextual information/action. - * @property SEPARATOR {H.util.ContextItem} - Separator for the context items - */ - export class ContextItem extends H.util.EventTarget { - /** - * Constructor - * @param opt_options {H.util.ContextItem.Options=} - The values to initialize this context item - */ - constructor(opt_options?: H.util.ContextItem.Options); - - /** - * This method returns label of the context item - * @returns {string} - the label of the context item - */ - getLabel(): string; - - /** - * This method changes context item label to the specified one - * @param label {string} - New label for the context item - * @returns {H.util.ContextItem} - this context item instance - */ - setLabel(label: string): H.util.ContextItem; - - /** - * This method returns disabled state of the context item. - * @returns {boolean} - true if the item is disabled, false otherwise - */ - isDisabled(): boolean; - - /** - * This method enables/disables the context item - * @param disabled {boolean} - true to disable and false to enabled it - * @returns {H.util.ContextItem} - this context item instance - */ - setDisabled(disabled: boolean): H.util.ContextItem; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - - static SEPARATOR: H.util.ContextItem; - } - - export module ContextItem { - /** - * This type defines options which can be used to initialize the context item. - * @property label {string=} - the label of the context item - * @property disabled {boolean=} - flag indicatting whether context item is disabled or no, by default false - * @property callback {function(H.util.Event)=} - Optional callback function to call once context item is selected - */ - export interface Options { - label?: string; - disabled?: boolean; - callback?: (event: H.util.Event) => void; - } - } - - /** - * Object which can be safely disposed. - */ - export class Disposable { - /** - * Constructor - */ - constructor(); - - /** - * Method adds a callback which will be triggered when the object is disposed - * @param callback {Function} - * @param opt_scope {Object=} - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - /** - * Base Event class which is used for all events dispatched by any EventTarget within the api. - * @property target {*} - Object which triggered the event - * @property currentTarget {*} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class Event { - /** - * Constructor - * @param type {string} - Event Type. - * @param opt_target {Object=} - Reference to the object that is the target of this event. It has to implement the {@link EventTargetInstance} interface. - */ - constructor(type: string, opt_target?: any); - - /** - * Sets defaultPrevented to true. Which can be used to prevent some default behavior. - */ - preventDefault(): void; - - /** - * Stops propagation for current event. - */ - stopPropagation(): void; - - target: any; - currentTarget: any; - type: string; - defaultPrevented: boolean; - } - - /** - * EventTarget enabled listening and dispatching events on all instances and derived classes. - */ - export class EventTarget { - /** - * Constructor - */ - constructor(); - - /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. - * @param type {string} - name of event - * @param handler {Function} - event handler function - * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) - * @param opt_scope {Object=} - scope for the handler function - */ - addEventListener(type: string, handler: EventListenerOrEventListenerObject, opt_capture?: boolean, opt_scope?: any): void; - - /** - * This method will removed previously added listener from the event target - * @param type {string} - name of event - * @param handler {Function} - event handler function - * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) - * @param opt_scope {Object=} - scope for the handler function - */ - removeEventListener(type: string, handler: EventListenerOrEventListenerObject, opt_capture?: boolean, opt_scope?: any): void; - - /** - * This method will dispatch event on the event target object - * @param evt {H.util.Event | string} - event object or event name - */ - dispatchEvent(evt: H.util.Event | string): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: () => void, opt_scope?: any): void; - } - - /** - * An interface definition for the generic cache. Any data elements can be stored in the cache. They are always associated with an identifier to retrieve them at a later stage and their content size. - */ - export interface ICache { - /** - * This method adds an element to the cache. - * @param id {*} - The identifier of this data element, the value is converted to a string. - * @param data {*} - the actual data to be stored - * @param size {number} - the size of the data element - * @returns {boolean} - a boolean value indicating whether the data was added - */ - add(id: any, data: any, size: number): boolean; - - /** - * This method retrieves an element from the cache. - * @param id {string} - the ID of the data element to be retrieved. - * @param opt_noUpdate {boolean=} - and optional flag to indicate that the retrieved object should not be marked as 'most recently used'. - * @returns {*} - returns the data associated with the ID or undefined if the data element is not currently in the cache. - */ - get(id: string, opt_noUpdate?: boolean): any; - - /** - * This method explicitly drops an element from the cache. - * @param id {*} - the id of the item to drop - */ - drop(id: any): void; - - /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. - * @param callback {function(string, ?, number)} - the callback to be invoked for each entry - * @param opt_ctx {Object=} - an optional context object to be used as this within the callback - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called - */ - forEach(callback: (s: string, t: any, n: number) => void, opt_ctx?: Object, opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; - - /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively - */ - removeAll(opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; - - /** - * This method registers a callback that should be called each time an entry is dropped from the cache. - * @param callback {(function(string, ?, number))} - the callback to be invoked for each entry - */ - registerOnDrop(callback: ((s: string, t: any, n: number) => void)): void; - } - - /** - * An interface to cancelable requests and actions. - */ - export interface ICancelable { - /** - * This method is used to cancel current action - */ - cancel(): void; - } - - export interface ICapturable { - /** - * This method is used to capture the element view - * @param canvas {HTMLCanvasElement} - HTML Canvas element to draw the view of the capturable element - * @param pixelRation {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 - * @param callback {ICapturable~captureCallback} - Callback function to call once result of the capturing is ready - * @param opt_errback {ICapturable~errorCallback} - Callback function to call if error occurred during capturing - */ - capture(canvas: HTMLCanvasElement, pixelRation: number, callback: (canvas?: HTMLCanvasElement) => void, opt_errback?: (error: string) => void): void; - - /** - * @callback ICapturable~captureCallback - * @param canvas {HTMLCanvasElement=} - */ - - /** - * @callback ICapturable~errorCallback - * @param error {string} - */ - } - - /** - * This class represents an list of ordered entries which dispatches events when the list is modified. - * @event add {H.util.OList.Event} - Fired when an entry was added to the list. - * @event remove {H.util.OList.Event} - Fired when an entry was removed from the list. - * @event set {H.util.OList.Event} - Fired when an entry was set in the list. - * @event move {H.util.OList.Event} - Fired when an entry was moved within the list. - */ - export class OList extends H.util.EventTarget { - - /** - * This method inserts an entry to the list. Optionally it can place new entry at provided index. - * @param entry {?} - The entry to insert - * @param opt_idx {number=} - The index where the new entry should be inserted; if omitted or greater then the current size of the list, the entry is added at the end of the list; a negative index is treated as being relative from the end of the list - */ - add(entry: any, opt_idx?: number): void; - - /** - * This method removes an entry by a given index from the list. - * @param idx {number} - The index of the entry which should be removed; a negative index is treated as being relative from the end of the list - * @returns {?} - The removed entry - */ - removeAt(idx: number): any; - - /** - * This method removes the the first entry which is identical with the given entry. - * @param entry {?} - The entry to remove - * @returns {boolean} - signals if the entry could be found in the list and is removed - */ - remove(entry: any): boolean; - - /** - * This method replaces an entry at the given index with the given entry. - * @param idx {number} - The index of the entry which should be replaced; a negative index is treated as being relative from the end of the list - * @param entry {?} - The entry which replaces the existing one - * @returns {?} - The replaced entry - */ - set(idx: number, entry: any): any; - - /** - * This method retrieves the index of the first object in this list that is identical with the object supplied by the caller. - * @param entry {?} - The entry for which to return the index. - * @returns {number} - The index of the first matching entry in this list or -1 if the entry provided by the caller is not found in the list - */ - indexOf(entry: any): number; - - /** - * To get the entry at the specified index. - * @param idx {number} - The index of the entry to get a negative index is treated as being relative from the end of the list - * @returns {?} - The element at the given index - */ - get(idx: number): any; - - /** - * This method returns the length of the list. - * @returns {number} - */ - getLength(): number; - - /** - * This method returns all list's entries as an array. - * @returns {Array<*>} - The list as an array - */ - asArray(): Array; - - /** - * This method removes all entries from the list. - */ - flush(): void; - - /** - * This method will dispatch event on the event target object - * @param evt {(H.util.Event | string)} - event object or event name - */ - dispatchEvent(evt: (H.util.Event | string)): void; - - /** - * Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners. - */ - dispose(): void; - - /** - * This method adds callback which is triggered when the object is being disposed - * @param callback {Function} - The callback function. - * @param opt_scope {Object=} - An optional scope to call the callback in. - */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; - } - - export module OList { - /** - * The event class for events that are dispatched by OList - * @property target {*} - Object which triggered the event - * @property currentTarget {*} - Object which has listener attached - * @property type {string} - Name of the dispatched event - * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event - */ - export class Event extends H.util.Event { - /** - * Constructor - * @param list {H.util.OList} - The OList instance which is emitting the event - * @param type {H.util.OList.prototype.EventType} - The type of the event - * @param idx {number} - The affected index within this list - * @param added {?*} - The value of the entry which was added or set - * @param removed {?*} - The value of the entry which was removed or replaced - * @param moved {?*} - The value of the entry which was moved - */ - constructor(list: H.util.OList, type: string, idx: number, added: any, removed: any, moved: any); - - /** - * Sets defaultPrevented to true. Which can be used to prevent some default behavior. - */ - preventDefault(): void; - - /** - * Stops propagation for current event. - */ - stopPropagation(): void; - - target: any; - currentTarget: any; - type: string; - defaultPrevented: boolean; - } - } - - /** - * A generic class to represent a handle for any kind of asynchronous processed requests - */ - export class Request { - /** - * Constructor - * @param opt_onprogress {function(H.util.Request)=} - A callback to invoke every time when the request's progress state changes - * @param opt_total {number=} - The total number of processing steps to complete this request, default is 1 - */ - constructor(opt_onprogress?: (req: H.util.Request) => void, opt_total?: number); - - /** - * Returns the state of this request - * @returns {H.util.Request.State} - */ - getState(): H.util.Request.State; - - /** - * Returns the number of processing steps to complete this request - * @returns {number} - */ - getTotal(): number; - - /** - * Returns the number of steps which are already processed by this request - * @returns {number} - */ - getProcessed(): number; - - /** - * Returns the number of processingsteps which have been failed - * @returns {number} - */ - getFailed(): number; - } - - export module Request { - /** - * The supported states of an request - */ - export enum State { - PENDING, - PROCESSING, - COMPLETE, - CANCELLED, - ERROR, - } - } - - export module animation { - /** - * This mamespace contains easing functions used for Animation class. - */ - export class ease { - /** - * This function defines linear ease. - * @param val {number} - A value in range [0..1] to translate - * @returns {number} - the translated value - */ - static LINEAR(val: number): number; - - /** - * This function defines quadratic ease in. - * @param val {number} - A value in range [0..1] to translate - * @returns {number} - the translated value - */ - static EASE_IN_QUAD(val: number): number; - - /** - * This function defines quadratic ease out. - * @param val {number} - A value in range [0..1] to translate - * @returns {number} - the translated value - */ - static EASE_OUT_QUAD(val: number): number; - - /** - * This function defines ease in and out with slope. - * @param val {number} - A value in range [0..1] to translate - * @returns {number} - the translated value - */ - static EASE_IN_OUT_QUINT(val: number): number; - - /** - * This function defines ease out with circ function. - * @param val {number} - A value in range [0..1] to translate - * @returns {number} - the translated value - */ - static EASE_OUT_CIRC(val: number): number; - } - } - - export module kinetics { - /** - * This interface defines kinetic move parameters used by map for kinetic drag. - * @property power {number} - Power multiplier. Multiplier is used to increase the speed of the kinetic move. By default map uses 1. - * @property duration {number} - Defines duration of the kinetic move. - */ - export interface IKinetics { - /** - * Easing function modifies animation progress. In example it can modify the animation in a way it starts rapidly and then slows down at the end. - * @param p {number} - current progress - * @returns {number} - modified progress - */ - ease(p: number): number; - - power: number; - duration: number; - } - } - } -}