UNPKG

@arcgis/core

Version:

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

191 lines (185 loc) • 7.9 kB
import type CircuitLocation from "./CircuitLocation.js"; import type CircuitPath from "./CircuitPath.js"; import type Subcircuit from "./Subcircuit.js"; import type { EventedMixin } from "../../core/Evented.js"; import type { JSONSupport } from "../../core/JSONSupport.js"; import type { CircuitSectionRoleType, CircuitType } from "./typeUtils.js"; import type { CircuitLocationProperties } from "./CircuitLocation.js"; import type { SubcircuitProperties } from "./Subcircuit.js"; export type CommonProperties = Pick<CircuitSection, "sectionId"> & Partial<Pick<CircuitSection, "attributes" | "globalId" | "sectionType">>; export interface EmptySectionProperties extends CommonProperties { startLocation?: null; stopLocation?: null; subcircuit?: null; } export interface SectionWithLocationsProperties extends CommonProperties { startLocation: CircuitLocation; stopLocation: CircuitLocation; subcircuit?: null; } export interface SectionWithSubcircuitProperties extends CommonProperties { startLocation?: null; stopLocation?: null; subcircuit: Subcircuit; } export interface CircuitSectionEvents {} /** * Represents a circuit section in a telecom domain network. * * ## Creating a CircuitSection * * CircuitSections may be created in one of three ways: with [start location](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#startLocation) and [stop location](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#stopLocation), * with a [subcircuit](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#subcircuit), or with neither. * * Keep in mind that [sectionId](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#sectionId) must always be specified when instantiating a CircuitSection, * and the following may be optionally specified: [attributes](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#attributes), [globalId](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#globalId), * and [sectionType](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitSection/#sectionType) (defaults to `physical`). * * <details> * <summary>Read More</summary> * * ### With start and stop location * * If created with start and stop [locations](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitLocation/), the section does not * consume a subcircuit. * * ```ts * const startLocation = new CircuitLocation({ * sourceId: 20, * globalId: "{728C3E4A-DA4B-4766-9CA5-AF19B9E3F89C}", * firstUnit: 1, * lastUnit: 1, * }); * * const stopLocation = new CircuitLocation({ * sourceId: 20, * globalId: "{0E3D7C20-E74D-482F-AE40-4319BCF0EA74}", * firstUnit: 1, * lastUnit: 1, * }); * * const section = new CircuitSection({ * sectionId: 1, * sectionType: "physical", * startLocation, * stopLocation, * }); * ``` * * ### With a subcircuit * * If created with a [Subcircuit](https://developers.arcgis.com/javascript/latest/references/core/networks/support/Subcircuit/), the section does consume a subcircuit. * * ```ts * const section = new CircuitSection({ * sectionId: 1, * sectionType: "physical", * subcircuit: new Subcircuit({ * name: "SUBCIRCUITVALUE1", * state: "available", * }), * }); * ``` * * ### As an empty section * * To create an empty circuit section: * * ```ts * const section = new CircuitSection({ sectionId: 1 }); * ``` * * </details> * * @beta * @since 4.34 * @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/) * @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/) * @see [Circuit](https://developers.arcgis.com/javascript/latest/references/core/networks/support/Circuit/) * @see [Subcircuit](https://developers.arcgis.com/javascript/latest/references/core/networks/support/Subcircuit/) * @see [CircuitLocation](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitLocation/) * @see [Telecom domain network](https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/telecom-domain-networks.htm) */ export default class CircuitSection extends CircuitSectionSuperclass { /** * @deprecated * Do not directly reference this property. * Use EventNames and EventTypes helpers from \@arcgis/core/Evented */ "@eventTypes": CircuitSectionEvents; constructor(circuitSectionProperties?: CircuitSection | SectionWithLocationsProperties | SectionWithSubcircuitProperties | EmptySectionProperties); /** User-defined attributes on the circuit section. */ accessor attributes: Record<string, any> | null | undefined; /** The global ID of the circuit section. */ accessor globalId: string | null | undefined; /** * The path between the circuit's start and stop locations. * This property is null unless the circuit section is returned by a circuit trace on a sectioned circuit. */ get path(): CircuitPath | null | undefined; /** * The role of the section in the consuming circuit. * This is a system-maintained field derived from the `SectionOrder` field in the Circuit table. * * @default "start-and-end" */ get role(): CircuitSectionRoleType; /** * The unique identifier of the circuit section within a circuit. * This property is used to define section order in a circuit. */ accessor sectionId: number; /** * Indicates the type of the circuit section. * A virtual circuit section does not require traversability between its start and stop locations. * * @default "physical" */ accessor sectionType: CircuitType; /** * The start location associated with the circuit section. * This property is null if the circuit section consumes a subcircuit. */ get startLocation(): CircuitLocation | null | undefined; set startLocation(value: CircuitLocationProperties | null | undefined); /** * The stop location associated with the circuit section. * This property is null if the circuit section consumes a subcircuit. */ get stopLocation(): CircuitLocation | null | undefined; set stopLocation(value: CircuitLocationProperties | null | undefined); /** The subcircuit being consumed by the circuit section. */ get subcircuit(): Subcircuit | null | undefined; set subcircuit(value: SubcircuitProperties | null | undefined); /** * Returns the value of the specified user-defined attribute. * * @param name - The name of the attribute. * @returns Returns the value of the attribute specified by `name`. */ getAttribute<T = any>(name: string): T; /** * Sets a new value for the specified user-defined attribute. * * @param name - The name of the attribute to set. * @param newValue - The new value to set on the named attribute. */ setAttribute(name: string, newValue: any): void; /** * Sets the start and stop locations of the circuit section. * This method sets the section's `subcircuit` to null. * * @param startLocation - The start location of the circuit section. * @param stopLocation - The stop location of the circuit section. */ setStartStopLocations(startLocation: CircuitLocation, stopLocation: CircuitLocation): void; /** * Sets the subcircuit for the circuit section to consume. * This method sets the section's `startLocation` and `stopLocation` to null. * * @param subcircuit - The subcircuit that the section will consume. */ setSubcircuit(subcircuit: Subcircuit): void; } declare const CircuitSectionSuperclass: typeof JSONSupport & typeof EventedMixin