Skip to content

Commit f5008ac

Browse files
committed
feat: ✨ Line layer now has same popup template as point layer
1 parent a6c1369 commit f5008ac

File tree

1 file changed

+24
-24
lines changed
  • src/layers/MilepostLayer/milepost-line-layer

1 file changed

+24
-24
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
import { fields } from "..";
1+
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
2+
import { createPopupTemplate, fields } from "..";
23
import waExtent from "../../../WAExtent";
34
import { objectIdFieldName } from "../../../elc/types";
45
import MilepostOffsetLineRenderer from "./MilepostOffsetLineRenderer";
5-
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
66

77
/**
88
* Creates a new feature layer that displays mileposts as lines.
99
* @param spatialReference - The spatial reference of the layer.
1010
* @returns A new feature layer that displays mileposts as lines.
1111
*/
1212
export function createMilepostLineLayer(
13-
spatialReference = waExtent.spatialReference,
13+
spatialReference = waExtent.spatialReference,
1414
) {
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+
};
3333

34-
const lineLayer = new FeatureLayer(lineLayerProperties);
35-
lineLayer.popupTemplate = lineLayer.createPopupTemplate();
34+
const lineLayer = new FeatureLayer(lineLayerProperties);
35+
lineLayer.popupTemplate = createPopupTemplate(lineLayer);
3636

37-
return lineLayer;
37+
return lineLayer;
3838
}

0 commit comments

Comments
 (0)