UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

167 lines (165 loc) • 7.84 kB
import type Graphic from "../../Graphic.js"; import type PopupTemplate from "../../PopupTemplate.js"; import type Point from "../../geometry/Point.js"; import type { ClonableMixin } from "../../core/Clonable.js"; import type { JSONSupport } from "../../core/JSONSupport.js"; import type { CurbApproach, LocationType, Status } from "./types.js"; import type { PointProperties } from "../../geometry/Point.js"; import type { PopupTemplateProperties } from "../../PopupTemplate.js"; export interface StopProperties extends Partial<Pick<Stop, "arriveTimeOffset" | "curbApproach" | "departTimeOffset" | "locationType" | "name" | "sequence" | "snapX" | "snapY" | "snapZ" | "status">> { /** The date and time value indicating the arrival time at the stop. */ arriveTime?: (Date | number | string) | null; /** The date and time value indicating the departure time from the stop. */ departTime?: (Date | number | string) | null; /** The point location of the stop. */ geometry?: PointProperties | null; /** * The template for displaying content in a [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) when the graphic is selected. * * @since 4.30 */ popupTemplate?: PopupTemplateProperties | null; /** * The latest time the route can visit the stop. The values for this field are copied from the TimeWindowEnd field on * the input stops. */ timeWindowEnd?: (Date | number | string) | null; /** * The earliest time the route can visit the stop. The values for this field are copied from the TimeWindowStart * field on the input stops. */ timeWindowStart?: (Date | number | string) | null; } /** * A stop respresents the start, end, or midpoint of a route in [RouteLayer.stops](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/#stops) * or [RouteParameters.stops](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#stops). * * @since 4.23 * @see [RouteParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/) * @see [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/) * @example * // Display the route name and overall distance and duration. * const routeLayer = new RouteLayer({ * portalItem: { * id: "69569b47b1e445b8a42ec12feab41ce9" * } * }); * await routeLayer.load(); * * const locale = "en-US"; * const formatDate = new Intl.DateTimeFormat(locale, { * year: 'numeric', * month: 'numeric', * day: 'numeric', * hour: 'numeric', * minute: 'numeric', * second: 'numeric', * timeZone: "America/Los_Angeles" * }); * * for (const stop of routeLayer.stops) { * const { arriveTime, departTime, name, locationType } = stop; * console.log(`Stop: ${locationType} at ${name}`); * console.log(`Arrival Time: ${formatDate.format(arriveTime)}`); * console.log(`Departure Time: ${formatDate.format(departTime)}`); * } * * // Stop: stop at Kenoak Pl, Pomona, California, 91768 * // Arrival Time: 12/7/2020, 3:58:50 PM * // Departure Time: 12/7/2020, 3:58:50 PM * // Stop: stop at 173 E Arbeth St, Rialto, California, 92377 * // Arrival Time: 12/7/2020, 4:38:29 PM * // Departure Time: 12/7/2020, 4:38:29 PM * // etc */ export default class Stop extends StopSuperclass { /** * Creates a [Stop](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Stop/) from the parsed [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/). * The method assumes that the graphic's attributes conform to the route layer item schema. * * @param graphic - A Graphic instance. * @returns A Stop instance. * @since 4.24 */ static fromGraphic(graphic: Graphic): Stop; constructor(properties?: StopProperties); /** The date and time value indicating the arrival time at the stop. */ get arriveTime(): Date | null | undefined; set arriveTime(value: (Date | number | string) | null | undefined); /** The local time offset (in minutes) for the arrival time. */ accessor arriveTimeOffset: number | null | undefined; /** Specify the direction a vehicle may arrive at and depart from the stop. */ accessor curbApproach: CurbApproach | null | undefined; /** The date and time value indicating the departure time from the stop. */ get departTime(): Date | null | undefined; set departTime(value: (Date | number | string) | null | undefined); /** The local time offset in minutes for the departure time. */ accessor departTimeOffset: number | null | undefined; /** The point location of the stop. */ get geometry(): Point | null | undefined; set geometry(value: PointProperties | null | undefined); accessor locationType: LocationType | null | undefined; /** * The name of the stop. The name is used in the driving directions. If the name is not specified, a unique name * prefixed with Location is automatically generated in the output stops, routes, and directions. */ accessor name: string | null | undefined; /** * The template for displaying content in a [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) when the graphic is selected. * * @since 4.30 */ get popupTemplate(): PopupTemplate | null | undefined; set popupTemplate(value: PopupTemplateProperties | null | undefined); /** * If the findBestSequence parameter is set to false, the output routes will visit the stops in the order you specify * with this attribute. In a group of stops that have the same RouteName value, the sequence number should be greater * than 0 but not greater than the total number of stops. Also, the sequence number should not be duplicated. */ accessor sequence: number | null | undefined; /** * The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of * the network dataset. * * @since 5.0 */ accessor snapX: number | null | undefined; /** * The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of * the network dataset. * * @since 5.0 */ accessor snapY: number | null | undefined; /** * The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of * the network dataset. The `snapZ` field is 0 if the network is two dimensional. * * @since 5.0 */ accessor snapZ: number | null | undefined; /** Indicates the status of the point with respect to its location on the network and the outcome of the analysis. */ accessor status: Status | null | undefined; /** * The latest time the route can visit the stop. The values for this field are copied from the TimeWindowEnd field on * the input stops. */ get timeWindowEnd(): Date | null | undefined; set timeWindowEnd(value: (Date | number | string) | null | undefined); /** * The earliest time the route can visit the stop. The values for this field are copied from the TimeWindowStart * field on the input stops. */ get timeWindowStart(): Date | null | undefined; set timeWindowStart(value: (Date | number | string) | null | undefined); get type(): "stop"; /** * Creates a [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) from the [Stop](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Stop/) instance. * The resulting graphic will have attributes that conform to the route layer item schema. * * @returns A Graphic instance. * @since 4.24 */ toGraphic(): Graphic; } declare const StopSuperclass: typeof JSONSupport & typeof ClonableMixin