import CircuitSection from "@arcgis/core/networks/support/CircuitSection.js";const CircuitSection = await $arcgis.import("@arcgis/core/networks/support/CircuitSection.js");- Inheritance:
- CircuitSection→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Represents a circuit section in a telecom domain network.
Creating a CircuitSection
CircuitSections may be created in one of three ways: with start location and stop location, with a subcircuit, or with neither.
Keep in mind that sectionId must always be specified when instantiating a CircuitSection,
and the following may be optionally specified: attributes, globalId,
and sectionType (defaults to physical).
Read More
With start and stop location
If created with start and stop locations, the section does not consume a subcircuit.
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, the section does consume a subcircuit.
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:
const section = new CircuitSection({ sectionId: 1 });Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| circuitSectionProperties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
declaredClass readonly inherited | ||
| | ||
path readonly | CircuitPath | null | undefined | |
role readonly | | |
| | ||
| | ||
| | ||
| | ||
Subcircuit | null | undefined | |
path
- Type
- CircuitPath | 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.
sectionId
- Type
- number
The unique identifier of the circuit section within a circuit. This property is used to define section order in a circuit.
sectionType
- Type
- CircuitType
Indicates the type of the circuit section. A virtual circuit section does not require traversability between its start and stop locations.
- Default value
- "physical"
startLocation
- Type
- CircuitLocation | null | undefined
The start location associated with the circuit section. This property is null if the circuit section consumes a subcircuit.
stopLocation
- Type
- CircuitLocation | null | undefined
The stop location associated with the circuit section. This property is null if the circuit section consumes a subcircuit.
subcircuit
- Type
- Subcircuit | null | undefined
The subcircuit being consumed by the circuit section.
Methods
| Method | Signature | Class |
|---|---|---|
fromJSON inherited static | fromJSON(json: any): any | |
emit inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
getAttribute<T = any>(name: string): T | | |
hasEventListener inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
on inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle | |
setAttribute(name: string, newValue: any): void | | |
setStartStopLocations(startLocation: CircuitLocation, stopLocation: CircuitLocation): void | | |
setSubcircuit(subcircuit: Subcircuit): void | | |
toJSON inherited | toJSON(): any |
fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
Emits an event on the instance. This method should only be used when creating subclasses of this class.
getAttribute
- Signature
-
getAttribute <T = any>(name: string): T
- Type parameters
- <T = any>
Returns the value of the specified user-defined attribute.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| name | The name of the attribute. | |
- Returns
- T
Returns the value of the attribute specified by
name.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint);}); setStartStopLocations
- Signature
-
setStartStopLocations (startLocation: CircuitLocation, stopLocation: CircuitLocation): void
Sets the start and stop locations of the circuit section.
This method sets the section's subcircuit to null.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| startLocation | The start location of the circuit section. | | |
| stopLocation | The stop location of the circuit section. | |
- Returns
- void
setSubcircuit
- Signature
-
setSubcircuit (subcircuit: Subcircuit): void
Sets the subcircuit for the circuit section to consume.
This method sets the section's startLocation and stopLocation to null.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| subcircuit | The subcircuit that the section will consume. | |
- Returns
- void
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.
Type definitions
CommonProperties
- Supertypes
- Pick<CircuitSection‚ "sectionId"> ‚ Partial<Pick<CircuitSection, "attributes" | "globalId" | "sectionType">>
SectionWithLocationsProperties
- Supertypes
- CommonProperties
startLocation
- Type
- CircuitLocation
stopLocation
- Type
- CircuitLocation
SectionWithSubcircuitProperties
- Supertypes
- CommonProperties
subcircuit
- Type
- Subcircuit