Skip to content
import Circuit from "@arcgis/core/networks/support/Circuit.js";
Inheritance:
CircuitAccessor
Since
ArcGIS Maps SDK for JavaScript 4.34
beta

Represents a circuit in a telecom domain network.

Creating a Circuit

Circuits may be created in one of three ways: with start location and stop location, with sections, or with neither.

Keep in mind that name must always be specified when instantiating a Circuit, and the following may be optionally specified: attributes, circuitManager, circuitType, globalId, and subcircuits.

Read More

With start and stop location

If created with start and stop locations, isSectioned is false.

const startLocation = new CircuitLocation({
sourceId: 20,
globalId: "{665803BB-258E-4BAE-A5B2-27DBD8A83C30}",
firstUnit: 1,
lastUnit: 1,
});
const stopLocation = new CircuitLocation({
sourceId: 20,
globalId: "{58CB492A-1992-4518-A60F-6119B1317E89}",
firstUnit: 1,
lastUnit: 1,
});
const circuit = new Circuit({
name: "FIRSTCIRCUIT",
circuitType: "physical",
startLocation,
stopLocation,
});

With sections

If created with sections, isSectioned is true.

const sectionOne = new CircuitSection({
sectionId: 1,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE1" }),
});
const sectionTwo = new CircuitSection({
sectionId: 2,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE2" }),
});
const sectionThree = new CircuitSection({
sectionId: 3,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE3" }),
});
const sectionFour = new CircuitSection({
sectionId: 4,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE4" }),
});
const sections = new Map([
[sectionOne, [sectionTwo, sectionThree]],
[sectionTwo, [sectionFour]],
[sectionThree, [sectionFour]],
[sectionFour, []],
]);
const circuit = new Circuit({
name: "TESTCIRCUIT",
sections,
});

As an empty circuit

It is possible to create an empty Circuit, without start locations, stop locations, or sections. In this scenario, isSectioned will be false until locations or sections are added to the Circuit.

const circuit = new Circuit({ name: "TESTCIRCUIT" });

To create an empty sectioned Circuit, specify an empty Map for the sections property.

const circuit = new Circuit({
name: "TESTCIRCUIT",
sections: new Map(),
});
See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
circuitProperties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

attributes

Property
Type
Record<string, any> | null | undefined

User-defined attributes on the circuit.

circuitManager

Property
Type
CircuitManager | null | undefined

An instance of CircuitManager associated with the circuit.

This is updated when a circuit is successfully created or altered with CircuitManager.create() or CircuitManager.alter().

circuitType

Property
Type
CircuitType

Indicates the type of the circuit.

A virtual circuit does not require traversability between its start and stop locations. If a virtual circuit is also a sectioned circuit, the circuit must have at least one virtual section.

Default value
"physical"

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

globalId

Property
Type
string | null | undefined

The global ID of the circuit.

isDeleted

readonly Property
Type
boolean

Whether the circuit has been logically deleted.

isSectioned

readonly Property
Type
boolean

Whether the circuit is defined by circuit sections.

lastExportedTime

readonly Property
Type
Date | null | undefined

The last time the circuit was exported.

lastVerifiedTime

readonly Property
Type
Date | null | undefined

The last time the circuit was verified.

name

Property
Type
string

The name of the circuit. This name is unique within the domain network.

sections

Property
Type
Map<CircuitSection, CircuitSection[]> | null | undefined

A map representing the logical connectivity between circuit sections as a directed adjacency list. Each key is a CircuitSection that connects to the other CircuitSection instances indicated by the key's value.

For example, consider the following keys and values, where each number is a section ID:

{
"1": [2, 3],
"2": [4],
"3": [4],
"4": [],
}

In this example, section 1 connects to 2 and 3 (where sections 2 and 3 are in parallel), 2 connects to 4, 3 connects to 4, and 4 connects to nothing (is the end of the circuit).

This connectivity between sections is graphically represented as:

1
/ \
2 3
\ /
4
Example
const sectionOne = new CircuitSection({
sectionId: 1,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE1" }),
});
const sectionTwo = new CircuitSection({
sectionId: 2,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE2" }),
});
const sectionThree = new CircuitSection({
sectionId: 3,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE3" }),
});
const sectionFour = new CircuitSection({
sectionId: 4,
subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE4" }),
});
const sections = new Map([
[sectionOne, [sectionTwo, sectionThree]],
[sectionTwo, [sectionFour]],
[sectionThree, [sectionFour]],
[sectionFour, []],
]);
const circuit = new Circuit({
name: "TESTCIRCUIT",
sections,
});

startLocation

autocast Property
Type
CircuitLocation | null | undefined

The feature or object associated with the start location of the circuit. This property is null if the circuit is sectioned.

status

readonly Property
Type
CircuitStatus

Indicates the status of the circuit.

The circuit status is initially "dirty" and remains dirty until the circuit is validated. The circuit status is "clean" when the circuit has been successfully validated. The circuit status returns to "dirty" if any circuit components are modified.

stopLocation

autocast Property
Type
CircuitLocation | null | undefined

The feature or object associated with the stop location of the circuit. This property is null if the circuit is sectioned.

subcircuits

autocast Property
Type
Subcircuit[]

The subcircuits that the circuit is subdivided into.

Methods

MethodSignatureClass
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
getSectionById(sectionId: number): CircuitSection | null
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
setSections(sections: Map<CircuitSection, CircuitSection[]>): void
setStartStopLocations(startLocation: CircuitLocation, stopLocation: CircuitLocation): void
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

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
ParameterTypeDescriptionRequired
json
any

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

inherited Method
Signature
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

event
this["@eventTypes"][Type]

The event payload.

Returns
boolean

true if a listener was notified

getAttribute

Method
Signature
getAttribute <T = any>(name: string): T
Type parameters
<T = any>

Returns the value of the specified user-defined attribute.

Parameters
ParameterTypeDescriptionRequired
name

The name of the attribute.

Returns
T

Returns the value of the attribute specified by name.

getSectionById

Method
Signature
getSectionById (sectionId: number): CircuitSection | null

Returns the CircuitSection instance with a specified section ID from the circuit's sections.

Parameters
ParameterTypeDescriptionRequired
sectionId

The section ID of the section to retrieve.

Returns
CircuitSection | null

The circuit section with the specified ID, if one exists in the circuit.

hasEventListener

inherited Method
Signature
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

Returns
boolean

Returns true if the class supports the input event.

on

inherited Method
Signature
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters
ParameterTypeDescriptionRequired
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).

PropertyTypeDescription
removeFunctionWhen 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);
});

setAttribute

Method
Signature
setAttribute (name: string, newValue: any): void

Sets a new value for the specified user-defined attribute.

Parameters
ParameterTypeDescriptionRequired
name

The name of the attribute to set.

newValue
any

The new value to set on the named attribute.

Returns
void

setSections

Method
Signature
setSections (sections: Map<CircuitSection, CircuitSection[]>): void

Sets the sections of the circuit. This method sets the circuit's startLocation and stopLocation to null, making this a sectioned circuit.

Parameters
ParameterTypeDescriptionRequired
sections

The circuit's sections.

Returns
void

setStartStopLocations

Method
Signature
setStartStopLocations (startLocation: CircuitLocation, stopLocation: CircuitLocation): void

Sets the start and stop locations of the circuit. This method sets the circuit's sections to null, making this a non-sectioned circuit.

Parameters
ParameterTypeDescriptionRequired
startLocation

The start location of the circuit.

stopLocation

The stop location of the circuit.

Returns
void

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

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

Type definition
Supertypes
Pick<Circuit‚ "name"> ‚  Partial<Pick<Circuit, "attributes" | "circuitManager" | "circuitType" | "globalId" | "subcircuits">>

EmptyCircuitProperties

Type definition
Supertypes
CommonProperties

startLocation

Property
Type
null | undefined

stopLocation

Property
Type
null | undefined

sections

Property
Type
null | undefined

NonSectionedCircuitProperties

Type definition
Supertypes
CommonProperties

startLocation

Property
Type
CircuitLocation

stopLocation

Property
Type
CircuitLocation

sections

Property
Type
null | undefined

SectionedCircuitProperties

Type definition
Supertypes
CommonProperties

startLocation

Property
Type
null | undefined

stopLocation

Property
Type
null | undefined

sections

Property
Type
Map<CircuitSection, CircuitSection[]>