|
1 |
| -import { fields } from ".."; |
| 1 | +import FeatureLayer from "@arcgis/core/layers/FeatureLayer"; |
| 2 | +import { createPopupTemplate, fields } from ".."; |
2 | 3 | import waExtent from "../../../WAExtent";
|
3 | 4 | import { objectIdFieldName } from "../../../elc/types";
|
4 | 5 | import MilepostOffsetLineRenderer from "./MilepostOffsetLineRenderer";
|
5 |
| -import FeatureLayer from "@arcgis/core/layers/FeatureLayer"; |
6 | 6 |
|
7 | 7 | /**
|
8 | 8 | * Creates a new feature layer that displays mileposts as lines.
|
9 | 9 | * @param spatialReference - The spatial reference of the layer.
|
10 | 10 | * @returns A new feature layer that displays mileposts as lines.
|
11 | 11 | */
|
12 | 12 | export function createMilepostLineLayer(
|
13 |
| - spatialReference = waExtent.spatialReference, |
| 13 | + spatialReference = waExtent.spatialReference, |
14 | 14 | ) {
|
15 |
| - // Make a clone of the milepost point layer, as most of the properties |
16 |
| - // will be the same aside from the geometry type and renderer. |
17 |
| - const lineLayerProperties: __esri.FeatureLayerProperties = { |
18 |
| - geometryType: "polyline", |
19 |
| - title: "Near Mileposts", |
20 |
| - fields, |
21 |
| - objectIdField: objectIdFieldName, |
22 |
| - id: "nearMileposts", |
23 |
| - listMode: "hide", |
24 |
| - fullExtent: waExtent, |
25 |
| - spatialReference, |
26 |
| - // Since there are no features at the beginning, |
27 |
| - // need to add an empty array as the source. |
28 |
| - renderer: MilepostOffsetLineRenderer, |
29 |
| - source: [], |
30 |
| - popupEnabled: true, |
31 |
| - hasM: true, |
32 |
| - }; |
| 15 | + // Make a clone of the milepost point layer, as most of the properties |
| 16 | + // will be the same aside from the geometry type and renderer. |
| 17 | + const lineLayerProperties: __esri.FeatureLayerProperties = { |
| 18 | + geometryType: "polyline", |
| 19 | + title: "Near Mileposts", |
| 20 | + fields, |
| 21 | + objectIdField: objectIdFieldName, |
| 22 | + id: "nearMileposts", |
| 23 | + listMode: "hide", |
| 24 | + fullExtent: waExtent, |
| 25 | + spatialReference, |
| 26 | + // Since there are no features at the beginning, |
| 27 | + // need to add an empty array as the source. |
| 28 | + renderer: MilepostOffsetLineRenderer, |
| 29 | + source: [], |
| 30 | + popupEnabled: true, |
| 31 | + hasM: true, |
| 32 | + }; |
33 | 33 |
|
34 |
| - const lineLayer = new FeatureLayer(lineLayerProperties); |
35 |
| - lineLayer.popupTemplate = lineLayer.createPopupTemplate(); |
| 34 | + const lineLayer = new FeatureLayer(lineLayerProperties); |
| 35 | + lineLayer.popupTemplate = createPopupTemplate(lineLayer); |
36 | 36 |
|
37 |
| - return lineLayer; |
| 37 | + return lineLayer; |
38 | 38 | }
|
0 commit comments