@corpsmap/corpsmap 4.1.18 → 4.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -95,7 +95,6 @@ export default {
|
|
|
95
95
|
} else {
|
|
96
96
|
try {
|
|
97
97
|
const data = JSON.parse(body);
|
|
98
|
-
console.log(data);
|
|
99
98
|
if (type === "EsriFeatureService") {
|
|
100
99
|
if (legendOverride === true) {
|
|
101
100
|
store.doGenerateArcImages(data, lyr);
|
|
@@ -187,7 +186,7 @@ export default {
|
|
|
187
186
|
},
|
|
188
187
|
});
|
|
189
188
|
},
|
|
190
|
-
false
|
|
189
|
+
false,
|
|
191
190
|
);
|
|
192
191
|
img.src = `data:${legend.contentType};base64,${legend.imageData}`;
|
|
193
192
|
img.alt = `Style for ${legend.label}`;
|
|
@@ -215,6 +214,7 @@ export default {
|
|
|
215
214
|
let legendLayers = store.selectLegendLayers();
|
|
216
215
|
let legendCanvases = store.selectLegendCanvases();
|
|
217
216
|
const drawingInfo = data.drawingInfo;
|
|
217
|
+
console.log("[legend] doGenerateEsriImages", displayName, data.geometryType, drawingInfo?.renderer?.type, "uniqueValueInfos:", drawingInfo?.renderer?.uniqueValueInfos?.length);
|
|
218
218
|
legendCanvases[uid] = {
|
|
219
219
|
displayName: displayName,
|
|
220
220
|
layerDescription: layerDescription,
|
|
@@ -224,10 +224,6 @@ export default {
|
|
|
224
224
|
heights: [],
|
|
225
225
|
};
|
|
226
226
|
legendLayers[uid] = [];
|
|
227
|
-
//TODO Logic below is needs to include other Esri styles.
|
|
228
|
-
console.log(drawingInfo.renderer);
|
|
229
|
-
console.log(drawingInfo.renderer.symbol);
|
|
230
|
-
// debugger;
|
|
231
227
|
switch (data.geometryType) {
|
|
232
228
|
case "esriGeometryPolygon":
|
|
233
229
|
if (
|
|
@@ -236,8 +232,9 @@ export default {
|
|
|
236
232
|
drawingInfo.renderer.symbol.style === "esriSFSSolid"
|
|
237
233
|
) {
|
|
238
234
|
let img = new Image();
|
|
239
|
-
const outlineColor = drawingInfo.renderer.symbol.outline?.color;
|
|
240
235
|
const fillColor = drawingInfo.renderer.symbol.color;
|
|
236
|
+
const outlineColor =
|
|
237
|
+
drawingInfo.renderer.symbol.outline?.color ?? fillColor;
|
|
241
238
|
|
|
242
239
|
let canvas = document.createElement("canvas");
|
|
243
240
|
let ctx = canvas.getContext("2d");
|
|
@@ -285,8 +282,9 @@ export default {
|
|
|
285
282
|
drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal"
|
|
286
283
|
) {
|
|
287
284
|
let img = new Image();
|
|
288
|
-
const outlineColor = drawingInfo.renderer.symbol.outline?.color;
|
|
289
285
|
const fillColor = drawingInfo.renderer.symbol.color;
|
|
286
|
+
const outlineColor =
|
|
287
|
+
drawingInfo.renderer.symbol.outline?.color ?? fillColor;
|
|
290
288
|
|
|
291
289
|
let canvas = document.createElement("canvas");
|
|
292
290
|
let ctx = canvas.getContext("2d");
|
|
@@ -346,10 +344,7 @@ export default {
|
|
|
346
344
|
let img = new Image();
|
|
347
345
|
|
|
348
346
|
const fillColor = val.symbol.color;
|
|
349
|
-
const outlineColor =
|
|
350
|
-
val.symbol.outline && val.symbol.outline.color
|
|
351
|
-
? val.symbol.outline.color
|
|
352
|
-
: fillColor;
|
|
347
|
+
const outlineColor = val.symbol.outline?.color ?? fillColor;
|
|
353
348
|
|
|
354
349
|
let canvas = document.createElement("canvas");
|
|
355
350
|
let ctx = canvas.getContext("2d");
|
|
@@ -546,7 +541,7 @@ export default {
|
|
|
546
541
|
},
|
|
547
542
|
});
|
|
548
543
|
},
|
|
549
|
-
false
|
|
544
|
+
false,
|
|
550
545
|
);
|
|
551
546
|
|
|
552
547
|
img.alt = `Style for ${displayName}`;
|
|
@@ -564,9 +559,11 @@ export default {
|
|
|
564
559
|
drawingInfo.renderer.symbol.type === "esriSMS"
|
|
565
560
|
) {
|
|
566
561
|
let img = new Image();
|
|
567
|
-
const outlineColor = drawingInfo.renderer.symbol.outline?.color;
|
|
568
|
-
const outlineWidth = drawingInfo.renderer.symbol.outline?.width ?? 1;
|
|
569
562
|
const fillColor = drawingInfo.renderer.symbol.color;
|
|
563
|
+
const outlineColor =
|
|
564
|
+
drawingInfo.renderer.symbol.outline?.color ?? fillColor;
|
|
565
|
+
const outlineWidth =
|
|
566
|
+
drawingInfo.renderer.symbol.outline?.width ?? 1;
|
|
570
567
|
const size = drawingInfo.renderer.symbol.size;
|
|
571
568
|
|
|
572
569
|
let canvas = document.createElement("canvas");
|
|
@@ -611,73 +608,43 @@ export default {
|
|
|
611
608
|
}
|
|
612
609
|
//___________________________________________________________________________________________________________________________________
|
|
613
610
|
else if (drawingInfo.renderer.uniqueValueInfos) {
|
|
614
|
-
// let canvas = document.createElement("canvas");
|
|
615
|
-
// let ctx = canvas.getContext("2d");
|
|
616
611
|
let result = [];
|
|
617
|
-
|
|
612
|
+
console.log("[legend] esriGeometryPoint uniqueValueInfos count:", drawingInfo.renderer.uniqueValueInfos.length);
|
|
618
613
|
drawingInfo.renderer.uniqueValueInfos.forEach((val) => {
|
|
619
614
|
let label = val.label;
|
|
620
|
-
let wkCanvas;
|
|
621
615
|
let img = new Image();
|
|
622
|
-
img.src = `data:image/png;base64,${val.symbol.imageData}`;
|
|
623
|
-
|
|
624
|
-
// img.addEventListener(
|
|
625
|
-
// "load",
|
|
626
|
-
// function () {
|
|
627
616
|
let canvas = document.createElement("canvas");
|
|
628
617
|
let ctx = canvas.getContext("2d");
|
|
629
|
-
|
|
630
618
|
const labelWidth = Number(ctx.measureText(label).width);
|
|
619
|
+
console.log("[legend] processing val:", label, "symbol type:", val.symbol.type);
|
|
631
620
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
// dispatch({
|
|
656
|
-
// type: "LEGEND_CANVAS_ADDED",
|
|
657
|
-
// payload: {
|
|
658
|
-
// legendCanvases: legendCanvases,
|
|
659
|
-
// loading: false,
|
|
660
|
-
// },
|
|
661
|
-
// });
|
|
662
|
-
// result.push(canvas)
|
|
663
|
-
// },
|
|
664
|
-
// false
|
|
665
|
-
// );
|
|
666
|
-
// img.src = `data:${val.symbol.url};base64,${val.symbol.imageData}`
|
|
667
|
-
// img.src = canvas.toDataURL()
|
|
621
|
+
if (val.symbol.type === "esriPMS") {
|
|
622
|
+
img.src = `data:image/png;base64,${val.symbol.imageData}`;
|
|
623
|
+
canvas.width = Number(val.symbol.width) + labelWidth + 4;
|
|
624
|
+
canvas.height = val.symbol.height;
|
|
625
|
+
ctx.fillStyle = "white";
|
|
626
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
627
|
+
ctx.drawImage(img, 0, 0);
|
|
628
|
+
} else if (val.symbol.type === "esriSMS") {
|
|
629
|
+
const size = val.symbol.size || 10;
|
|
630
|
+
canvas.width = size * 2;
|
|
631
|
+
canvas.height = size * 2;
|
|
632
|
+
ctx.fillStyle = safeRgba(val.symbol.color);
|
|
633
|
+
ctx.beginPath();
|
|
634
|
+
ctx.arc(size, size, size / 1.5, 0, Math.PI * 2);
|
|
635
|
+
ctx.fill();
|
|
636
|
+
if (val.symbol.outline) {
|
|
637
|
+
ctx.strokeStyle = safeRgba(val.symbol.outline.color);
|
|
638
|
+
ctx.lineWidth = val.symbol.outline.width;
|
|
639
|
+
ctx.stroke();
|
|
640
|
+
}
|
|
641
|
+
img.src = canvas.toDataURL();
|
|
642
|
+
console.log("[legend] esriSMS canvas size:", canvas.width, "x", canvas.height, "src length:", img.src.length);
|
|
643
|
+
}
|
|
668
644
|
|
|
669
645
|
img.alt = `Style for ${label}`;
|
|
670
646
|
img.crossOrigin = "anonymous";
|
|
671
647
|
img.title = label;
|
|
672
|
-
// legendLayers[uid] = [img]; //TODO: Update to possibly push multiple images into array
|
|
673
|
-
// images.push(img)
|
|
674
|
-
|
|
675
|
-
// dispatch({
|
|
676
|
-
// type: "LEGEND_LAYERS_UPDATED",
|
|
677
|
-
// payload: {
|
|
678
|
-
// legendLayers: legendLayers,
|
|
679
|
-
// },
|
|
680
|
-
// });
|
|
681
648
|
result.push({
|
|
682
649
|
canvas: canvas,
|
|
683
650
|
image: img,
|
|
@@ -698,12 +665,20 @@ export default {
|
|
|
698
665
|
},
|
|
699
666
|
});
|
|
700
667
|
});
|
|
668
|
+
console.log("[legend] dispatching LEGEND_LAYERS_UPDATED, legendLayers[uid] count:", legendLayers[uid]?.length, "img srcs:", legendLayers[uid]?.map(i => i.src?.substring(0, 30)));
|
|
669
|
+
dispatch({
|
|
670
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
671
|
+
payload: {
|
|
672
|
+
legendLayers: legendLayers,
|
|
673
|
+
loading: false,
|
|
674
|
+
},
|
|
675
|
+
});
|
|
701
676
|
} else if (drawingInfo.renderer.classBreakInfos) {
|
|
702
677
|
drawingInfo.renderer.classBreakInfos.forEach((val) => {
|
|
703
678
|
let img = new Image();
|
|
704
|
-
const outlineColor = val.symbol.outline?.color;
|
|
705
|
-
const outlineWidth = val.symbol.outline?.width ?? 1;
|
|
706
679
|
const fillColor = val.symbol.color;
|
|
680
|
+
const outlineColor = val.symbol.outline?.color ?? fillColor;
|
|
681
|
+
const outlineWidth = val.symbol.outline?.width ?? 1;
|
|
707
682
|
const size = val.symbol.size;
|
|
708
683
|
let canvas = document.createElement("canvas");
|
|
709
684
|
let ctx = canvas.getContext("2d");
|
|
@@ -797,7 +772,7 @@ export default {
|
|
|
797
772
|
},
|
|
798
773
|
});
|
|
799
774
|
},
|
|
800
|
-
false
|
|
775
|
+
false,
|
|
801
776
|
);
|
|
802
777
|
|
|
803
778
|
img.alt = `Style for ${displayName}`;
|
|
@@ -923,7 +898,7 @@ export default {
|
|
|
923
898
|
},
|
|
924
899
|
});
|
|
925
900
|
},
|
|
926
|
-
false
|
|
901
|
+
false,
|
|
927
902
|
);
|
|
928
903
|
let legendParams = `service=WMS&version=1.1.1&request=GetLegendGraphic&format=image/png&sld_version=1.1.0&layer=${lyr}`;
|
|
929
904
|
if (layer.url.indexOf(".map") !== -1) {
|
|
@@ -988,7 +963,7 @@ export default {
|
|
|
988
963
|
},
|
|
989
964
|
});
|
|
990
965
|
},
|
|
991
|
-
false
|
|
966
|
+
false,
|
|
992
967
|
);
|
|
993
968
|
img.src = layer.src;
|
|
994
969
|
img.alt = `Style for ${layer.displayName}`;
|
|
@@ -15,7 +15,7 @@ class LegendItemMultiple extends React.Component {
|
|
|
15
15
|
{typeof image === "string" ? (
|
|
16
16
|
image
|
|
17
17
|
) : (
|
|
18
|
-
<img alt={image.alt} src={image.src}></img>
|
|
18
|
+
<img alt={image.alt} src={image.src} style={{ marginRight: "5px" }}></img>
|
|
19
19
|
)}
|
|
20
20
|
{layer.type === "WMS" ? null : image.title}
|
|
21
21
|
<br></br>
|