import Circuit from "@arcgis/core/networks/support/Circuit.js";
const Circuit = await $arcgis.import("@arcgis/core/networks/support/Circuit.js");
@arcgis/core/networks/support/Circuit
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, and subcircuits.
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}",
terminalId: 1,
firstUnit: 1,
numUnits: 1,
});
const stopLocation = new CircuitLocation({
sourceId: 20,
globalId: "{58CB492A-1992-4518-A60F-6119B1317E89}",
terminalId: 1,
firstUnit: 1,
numUnits: 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" });
- See also
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
User-defined attributes on the circuit. | Circuit | ||
An instance of | Circuit | ||
Indicates the type of the circuit. | Circuit | ||
The global ID of the circuit. | Circuit | ||
Whether the circuit has been logically deleted. | Circuit | ||
Whether the circuit is defined by circuit sections. | Circuit | ||
The last time the circuit was exported. | Circuit | ||
The last time the circuit was verified. | Circuit | ||
The name of the circuit. | Circuit | ||
A map representing the logical connectivity between circuit sections as a directed adjacency list. | Circuit | ||
The feature or object associated with the start location of the circuit. | Circuit | ||
Indicates the status of the circuit. | Circuit | ||
The feature or object associated with the stop location of the circuit. | Circuit | ||
The subcircuits that the circuit is subdivided into. | Circuit |
Property Details
-
User-defined attributes on the circuit.
-
circuitManager
circuitManager CircuitManager |null |undefinedautocast
-
An instance of
CircuitManager
associated with the circuit.This is updated when a circuit is successfully created or altered with
CircuitManager.create()
orCircuitManager.alter()
.
-
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.
Possible Values:"physical" |"virtual"
-
isDeleted
isDeleted Booleanreadonly
-
Whether the circuit has been logically deleted.
-
isSectioned
isSectioned Booleanreadonly
-
Whether the circuit is defined by circuit sections.
-
The last time the circuit was exported.
-
The last time the circuit was verified.
-
name
name String
-
The name of the circuit. This name is unique within the domain network.
-
sections
sections 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
Exampleconst 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
startLocation CircuitLocation |null |undefinedautocast
-
The feature or object associated with the start location of the circuit. This property is null if the circuit is sectioned.
-
status
status Stringreadonly
-
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 "clean" if any circuit components are modified.
Possible Values:"clean" |"dirty"
-
stopLocation
stopLocation CircuitLocation |null |undefinedautocast
-
The feature or object associated with the stop location of the circuit. This property is null if the circuit is sectioned.
-
subcircuits
subcircuits Subcircuit[]autocast
-
The subcircuits that the circuit is subdivided into.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
* | Returns the value of the specified attribute. | Circuit | |
Returns the CircuitSection instance with a specified section ID from the circuit's | Circuit | ||
void | Sets a new value for the specified attribute. | Circuit | |
void | Sets the sections of the circuit. | Circuit | |
void | Sets the start and stop locations of the circuit. | Circuit |
Method Details
-
Returns the value of the specified attribute.
Parametername StringThe name of the attribute.
ReturnsType Description * Returns the value of the attribute specified by name
.
-
getSectionById
getSectionById(sectionId){CircuitSection |null |undefined}
-
Returns the CircuitSection instance with a specified section ID from the circuit's
sections
.ParametersectionId NumberThe section ID of the section to retrieve.
ReturnsType Description CircuitSection | null | undefined The circuit section with the specified ID, if one exists in the circuit.
-
Sets a new value for the specified attribute.
Parametersname StringThe name of the attribute to set.
newValue *The new value to set on the named attribute.
ReturnsType Description void
-
Sets the sections of the circuit. This method sets the circuit's
startLocation
andstopLocation
to null, making this a sectioned circuit.Parametersections Map<CircuitSection, CircuitSection[]>The circuit's sections.
ReturnsType Description 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.ParametersstartLocation CircuitLocationThe start location of the circuit.
stopLocation CircuitLocationThe stop location of the circuit.
ReturnsType Description void