From c892aae6667aafeebdfc2dbcc63e890d6ce4727a Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 16 Dec 2024 16:08:42 -0800 Subject: [PATCH] fix: :bug: milepost labels swapped if end milepost < start milepost --- .../milepost-line-layer/MilepostOffsetLineRenderer.ts | 2 +- src/layers/MilepostLayer/symbol/beginOverride.arcade | 5 +++++ src/layers/MilepostLayer/symbol/endOverride.arcade | 5 +++++ src/layers/MilepostLayer/symbol/primitiveOverrides.ts | 7 +++++-- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/layers/MilepostLayer/symbol/beginOverride.arcade create mode 100644 src/layers/MilepostLayer/symbol/endOverride.arcade diff --git a/src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer.ts b/src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer.ts index 17e9f628..1d644a3e 100644 --- a/src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer.ts +++ b/src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer.ts @@ -109,7 +109,7 @@ const lineSegmentCimSymbol = new CIMSymbol({ export default new UniqueValueRenderer({ defaultSymbol: offsetAndMilepostCimSymbol, defaultLabel: "Clicked Milepost", - valueExpression: "IIF($feature.EndSrmp != null, '1', '0')", + valueExpression: "IIf($feature.EndSrmp != null, '1', '0')", valueExpressionTitle: "Has an End Milepost", uniqueValueInfos: [ { diff --git a/src/layers/MilepostLayer/symbol/beginOverride.arcade b/src/layers/MilepostLayer/symbol/beginOverride.arcade new file mode 100644 index 00000000..008310c4 --- /dev/null +++ b/src/layers/MilepostLayer/symbol/beginOverride.arcade @@ -0,0 +1,5 @@ +IIf( + $feature.SRMP > $feature.EndSrmp, + `${$feature.Route}\n${$feature.EndSrmp}${$feature.EndBack}`, + `${$feature.Route}\n${$feature.SRMP}${$feature.Back}` +) \ No newline at end of file diff --git a/src/layers/MilepostLayer/symbol/endOverride.arcade b/src/layers/MilepostLayer/symbol/endOverride.arcade new file mode 100644 index 00000000..b6796dfe --- /dev/null +++ b/src/layers/MilepostLayer/symbol/endOverride.arcade @@ -0,0 +1,5 @@ +IIf( + $feature.SRMP > $feature.EndSrmp, + `${$feature.Route}\n${$feature.SRMP}${$feature.Back}`, + `${$feature.Route}\n${$feature.EndSrmp}${$feature.EndBack}` +) \ No newline at end of file diff --git a/src/layers/MilepostLayer/symbol/primitiveOverrides.ts b/src/layers/MilepostLayer/symbol/primitiveOverrides.ts index 4733baf8..ddccce2a 100644 --- a/src/layers/MilepostLayer/symbol/primitiveOverrides.ts +++ b/src/layers/MilepostLayer/symbol/primitiveOverrides.ts @@ -1,9 +1,12 @@ +import beginOverride from "./beginOverride.arcade?raw"; +import endOverride from "./endOverride.arcade?raw"; + /** * The expression info for the primitive override for the milepost label symbol. * This will be used on the milepost line layer. */ const beginMilepostExpressionInfo = { - expression: "`${$feature.Route}\\n${$feature.SRMP}${$feature.Back}`", + expression: beginOverride, type: "CIMExpressionInfo", returnType: "String", } as const; @@ -14,7 +17,7 @@ const beginMilepostExpressionInfo = { */ const endMilepostExpressionInfo = { ...beginMilepostExpressionInfo, - expression: "`${$feature.Route}\\n${$feature.EndSrmp}${$feature.EndBack}`", + expression: endOverride, } as const; /**