esri-map-view
Version:
Display an Esri map view as a web component.
93 lines (92 loc) • 3.9 kB
TypeScript
/**
* Utility functions and helpers.
*/
/**
* Parse a viewpoint string into its constituent parts: longitude, latitude, and
* level of detail. This helper makes sure all the parts are valid values and
* assigned defaults when things are missing.
*
* @param viewpoint {string} Expect 3 comma separated number indicating
* longitude, latitude, and level of detail, e.g. "-118.4324,34.1234,9".
* @returns {viewpointProps} An object made up of {longitude, latitude,
* levelOfDetail, scale}
*/
export interface viewpointProps {
longitude: number;
latitude: number;
levelOfDetail: number;
scale: number;
}
export declare function parseViewpoint(viewpoint: string): viewpointProps;
/**
* Parse a string looking for the minimum and maximum numbers. It expects either one
* number or two numbers separated by a comma. The minimum and maximum values must be
* within the range of the default min and max parameters. If only one value is parsed then it
* is used for both min and max. If two numbers are parsed the smallest is set to
* the min value and the largest to the max.
* @param minMax {string} Either 1 or 2 numbers comma separated.
* @param defaultMin {number} A number to use as the default value for the minimum if not found, or the smallest minimum value allowed.
* @param defaultMax {number} A number to use as the default value for the maximum if not found, or the largest maximum value allowed.
* @returns {object} {min, max}
*/
export interface minMaxProps {
min: number;
max: number;
}
export declare function parseMinMax(minMax: string, defaultMin: number, defaultMax: number): minMaxProps;
/**
* Parse an offset string into its constituent parts: x, y. This helper
* makes sure all the parts are valid values and assigned defaults when
* things are missing.
*
* @param offset {string} Expect 2 comma separated numbers indicating x and y
* values for a geographic offset, denominated in points. e.g. "-2,3".
* @returns {offsetProps} An object made up of {x, y}
*/
export interface offsetProps {
x: number;
y: number;
}
export declare function parseOffset(offset: string): offsetProps;
/**
* Parse a camera position string into its constituent parts: x, y, z, heading,
* and tilt. This helper makes sure all the parts are valid values and
* assigned defaults when things are missing.
*
* @param cameraPosition {string} Expect 5 comma separated numbers indicating
* x, y, z, heading, and tilt, e.g. "-118.4324,34.1234,9,93.5,86.9".
* @returns {cameraProps} An object made up of {x, y, z, heading, tilt}
*/
export interface cameraProps {
x: number;
y: number;
z: number;
heading: number;
tilt: number;
}
export declare function parseCameraPosition(cameraPosition: string): cameraProps;
/**
* Helper function to test a string to see if it is a valid ArcGIS Online item ID.
* @param itemID {string} A proposed ArcGIS Online item ID.
* @returns {boolean} `true` if the input appears to be a valid item ID, otherwise `false`.
*/
export declare function isValidItemID(itemID: string): boolean;
/**
* Helper function to test a string to see if it is a valid URL.
* @param itemID {string} A proposed URL.
* @returns {boolean} `true` if the input appears to be a valid URL, otherwise `false`.
*/
export declare function isValidURL(url: string): boolean;
/**
* Verify a proposed search widget position is an expected value.
* @param position {string} A search position specification.
* @returns {boolean} `true` when OK, `false` when bad.
*/
export declare function isValidSearchPosition(position: string): boolean;
/**
* Given a user attribute setting for the UI show setting, return either true to show the UI
* or false to hide it.
* @param uiSetting {string} The string to check.
* @returns {boolean} Either true or false.
*/
export declare function showUI(uiSetting: string): boolean;