@corpsmap/corpsmap 3.2.35 → 3.2.38
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/lib/dev.js +110 -5
- package/lib/prod.js +110 -5
- package/package.json +1 -1
- package/src/core-plugins/legend/bundle.js +115 -13
- package/src/openlayers-utils/format-utilities.js +141 -138
package/lib/dev.js
CHANGED
|
@@ -106568,7 +106568,7 @@ var config = {
|
|
|
106568
106568
|
};
|
|
106569
106569
|
|
|
106570
106570
|
var name = "@corpsmap/corpsmap";
|
|
106571
|
-
var version$1 = "3.2.
|
|
106571
|
+
var version$1 = "3.2.38";
|
|
106572
106572
|
var description = "CorpsMap as React Components";
|
|
106573
106573
|
var main = "index.js";
|
|
106574
106574
|
var scripts = {
|
|
@@ -132987,6 +132987,10 @@ var formatColumns = function formatColumns(value, formatType) {
|
|
|
132987
132987
|
}
|
|
132988
132988
|
|
|
132989
132989
|
if (formatType === "UNIXDATE") {
|
|
132990
|
+
if (value === null || value === "null") {
|
|
132991
|
+
return null;
|
|
132992
|
+
}
|
|
132993
|
+
|
|
132990
132994
|
var unixTimestamp = value;
|
|
132991
132995
|
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132992
132996
|
|
|
@@ -159417,6 +159421,7 @@ var bundle$8 = {
|
|
|
159417
159421
|
break;
|
|
159418
159422
|
|
|
159419
159423
|
case "EsriFeatureService":
|
|
159424
|
+
// debugger
|
|
159420
159425
|
if (legendOverride === true) {
|
|
159421
159426
|
src = "".concat(src, "/legend?f=pjson");
|
|
159422
159427
|
} else {
|
|
@@ -159449,6 +159454,7 @@ var bundle$8 = {
|
|
|
159449
159454
|
if (legendOverride === true) {
|
|
159450
159455
|
store.doGenerateArcImages(data, lyr);
|
|
159451
159456
|
} else {
|
|
159457
|
+
// debugger
|
|
159452
159458
|
store.doGenerateEsriImages(data, lyr);
|
|
159453
159459
|
}
|
|
159454
159460
|
} else {
|
|
@@ -159571,6 +159577,7 @@ var bundle$8 = {
|
|
|
159571
159577
|
switch (data.geometryType) {
|
|
159572
159578
|
case "esriGeometryPolygon":
|
|
159573
159579
|
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSSolid") {
|
|
159580
|
+
// debugger
|
|
159574
159581
|
var img = new Image();
|
|
159575
159582
|
var outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
159576
159583
|
var fillColor = drawingInfo.renderer.symbol.color;
|
|
@@ -159609,8 +159616,7 @@ var bundle$8 = {
|
|
|
159609
159616
|
loading: false
|
|
159610
159617
|
}
|
|
159611
159618
|
});
|
|
159612
|
-
}
|
|
159613
|
-
else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal") {
|
|
159619
|
+
} else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal") {
|
|
159614
159620
|
// debugger
|
|
159615
159621
|
var _img = new Image();
|
|
159616
159622
|
|
|
@@ -159670,10 +159676,15 @@ var bundle$8 = {
|
|
|
159670
159676
|
});
|
|
159671
159677
|
} //____________________________________________________________________________________________________________________________________
|
|
159672
159678
|
else if (drawingInfo.renderer.type === "uniqueValue" && drawingInfo.renderer.uniqueValueInfos) {
|
|
159679
|
+
// Compare
|
|
159673
159680
|
drawingInfo.renderer.uniqueValueInfos.forEach(function (val) {
|
|
159674
159681
|
var img = new Image();
|
|
159675
|
-
|
|
159682
|
+
console.log(val.value);
|
|
159683
|
+
|
|
159684
|
+
if (val.value === 'BOEM') ;
|
|
159685
|
+
|
|
159676
159686
|
var fillColor = val.symbol.color;
|
|
159687
|
+
var outlineColor = val.symbol.outline && val.symbol.outline.color ? val.symbol.outline.color : fillColor;
|
|
159677
159688
|
var canvas = document.createElement("canvas");
|
|
159678
159689
|
var ctx = canvas.getContext("2d");
|
|
159679
159690
|
var labelWidth = Number(ctx.measureText(val.label).width); //set canvas width & height
|
|
@@ -159816,6 +159827,7 @@ var bundle$8 = {
|
|
|
159816
159827
|
|
|
159817
159828
|
case "esriGeometryPoint":
|
|
159818
159829
|
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
159830
|
+
// debugger
|
|
159819
159831
|
var _img3 = new Image();
|
|
159820
159832
|
|
|
159821
159833
|
_img3.src = "data:image/png;base64,".concat(data.drawingInfo.renderer.symbol.imageData);
|
|
@@ -159850,7 +159862,8 @@ var bundle$8 = {
|
|
|
159850
159862
|
dispatch({
|
|
159851
159863
|
type: "LEGEND_LAYERS_UPDATED",
|
|
159852
159864
|
payload: {
|
|
159853
|
-
legendLayers: legendLayers
|
|
159865
|
+
legendLayers: legendLayers,
|
|
159866
|
+
loading: false
|
|
159854
159867
|
}
|
|
159855
159868
|
});
|
|
159856
159869
|
} else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSMS") {
|
|
@@ -159978,6 +159991,52 @@ var bundle$8 = {
|
|
|
159978
159991
|
}
|
|
159979
159992
|
});
|
|
159980
159993
|
});
|
|
159994
|
+
} else if (drawingInfo.renderer.classBreakInfos) {
|
|
159995
|
+
drawingInfo.renderer.classBreakInfos.forEach(function (val) {
|
|
159996
|
+
var img = new Image();
|
|
159997
|
+
var outlineColor = val.symbol.outline.color;
|
|
159998
|
+
var outlineWidth = val.symbol.outline.width;
|
|
159999
|
+
var fillColor = val.symbol.color;
|
|
160000
|
+
var size = val.symbol.size;
|
|
160001
|
+
var canvas = document.createElement("canvas");
|
|
160002
|
+
var ctx = canvas.getContext("2d");
|
|
160003
|
+
canvas.width = 20 * 2.5;
|
|
160004
|
+
canvas.height = 20;
|
|
160005
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
160006
|
+
legendCanvases[uid].heights.push(canvas.height); //text
|
|
160007
|
+
|
|
160008
|
+
ctx.font = "11px Arial";
|
|
160009
|
+
ctx.fillText(val.label, size * 3, size * 2, 30); // circle
|
|
160010
|
+
|
|
160011
|
+
ctx.beginPath();
|
|
160012
|
+
ctx.strokeStyle = "rgba(".concat(outlineColor.join(), ")");
|
|
160013
|
+
ctx.lineWidth = outlineWidth;
|
|
160014
|
+
ctx.arc(size, size * 1.5, size / 1.5, 0, Math.PI * 2);
|
|
160015
|
+
ctx.fillStyle = "rgba(".concat(fillColor.join(), ")");
|
|
160016
|
+
ctx.fill();
|
|
160017
|
+
ctx.stroke();
|
|
160018
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
160019
|
+
|
|
160020
|
+
img.alt = "Style for ".concat(displayName);
|
|
160021
|
+
img.crossOrigin = "anonymous"; // debugger
|
|
160022
|
+
|
|
160023
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
160024
|
+
dispatch({
|
|
160025
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
160026
|
+
payload: {
|
|
160027
|
+
legendCanvases: legendCanvases,
|
|
160028
|
+
loading: false
|
|
160029
|
+
}
|
|
160030
|
+
});
|
|
160031
|
+
legendLayers[uid].push(img);
|
|
160032
|
+
dispatch({
|
|
160033
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
160034
|
+
payload: {
|
|
160035
|
+
legendLayers: legendLayers,
|
|
160036
|
+
loading: false
|
|
160037
|
+
}
|
|
160038
|
+
});
|
|
160039
|
+
});
|
|
159981
160040
|
} else {
|
|
159982
160041
|
legendLayers[uid] = ["Legend not available!"];
|
|
159983
160042
|
dispatch({
|
|
@@ -159990,6 +160049,52 @@ var bundle$8 = {
|
|
|
159990
160049
|
});
|
|
159991
160050
|
}
|
|
159992
160051
|
|
|
160052
|
+
break;
|
|
160053
|
+
|
|
160054
|
+
case "esriGeometryMultipoint":
|
|
160055
|
+
// debugger
|
|
160056
|
+
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
160057
|
+
// debugger
|
|
160058
|
+
var _img5 = new Image();
|
|
160059
|
+
|
|
160060
|
+
_img5.src = "data:image/png;base64,".concat(data.drawingInfo.renderer.symbol.imageData);
|
|
160061
|
+
|
|
160062
|
+
_img5.addEventListener("load", function () {
|
|
160063
|
+
var canvas = document.createElement("canvas");
|
|
160064
|
+
var ctx = canvas.getContext("2d");
|
|
160065
|
+
canvas.width = drawingInfo.renderer.symbol.width;
|
|
160066
|
+
canvas.height = drawingInfo.renderer.symbol.height; //store width & height for larger canvas calculation
|
|
160067
|
+
|
|
160068
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
160069
|
+
legendCanvases[uid].heights.push(canvas.height); //set background
|
|
160070
|
+
|
|
160071
|
+
ctx.fillStyle = "white";
|
|
160072
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
160073
|
+
ctx.drawImage(_img5, 0, 0); //add image to canvas
|
|
160074
|
+
|
|
160075
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
160076
|
+
dispatch({
|
|
160077
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
160078
|
+
payload: {
|
|
160079
|
+
legendCanvases: legendCanvases,
|
|
160080
|
+
loading: false
|
|
160081
|
+
}
|
|
160082
|
+
});
|
|
160083
|
+
}, false);
|
|
160084
|
+
|
|
160085
|
+
_img5.alt = "Style for ".concat(displayName);
|
|
160086
|
+
_img5.crossOrigin = "anonymous";
|
|
160087
|
+
legendLayers[uid] = [_img5]; //TODO: Update to possibly push multiple images into array
|
|
160088
|
+
|
|
160089
|
+
dispatch({
|
|
160090
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
160091
|
+
payload: {
|
|
160092
|
+
legendLayers: legendLayers,
|
|
160093
|
+
loading: false
|
|
160094
|
+
}
|
|
160095
|
+
});
|
|
160096
|
+
}
|
|
160097
|
+
|
|
159993
160098
|
break;
|
|
159994
160099
|
}
|
|
159995
160100
|
};
|
package/lib/prod.js
CHANGED
|
@@ -106482,7 +106482,7 @@ var config = {
|
|
|
106482
106482
|
};
|
|
106483
106483
|
|
|
106484
106484
|
var name = "@corpsmap/corpsmap";
|
|
106485
|
-
var version$1 = "3.2.
|
|
106485
|
+
var version$1 = "3.2.38";
|
|
106486
106486
|
var description = "CorpsMap as React Components";
|
|
106487
106487
|
var main = "index.js";
|
|
106488
106488
|
var scripts = {
|
|
@@ -132901,6 +132901,10 @@ var formatColumns = function formatColumns(value, formatType) {
|
|
|
132901
132901
|
}
|
|
132902
132902
|
|
|
132903
132903
|
if (formatType === "UNIXDATE") {
|
|
132904
|
+
if (value === null || value === "null") {
|
|
132905
|
+
return null;
|
|
132906
|
+
}
|
|
132907
|
+
|
|
132904
132908
|
var unixTimestamp = value;
|
|
132905
132909
|
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132906
132910
|
|
|
@@ -159331,6 +159335,7 @@ var bundle$8 = {
|
|
|
159331
159335
|
break;
|
|
159332
159336
|
|
|
159333
159337
|
case "EsriFeatureService":
|
|
159338
|
+
// debugger
|
|
159334
159339
|
if (legendOverride === true) {
|
|
159335
159340
|
src = "".concat(src, "/legend?f=pjson");
|
|
159336
159341
|
} else {
|
|
@@ -159363,6 +159368,7 @@ var bundle$8 = {
|
|
|
159363
159368
|
if (legendOverride === true) {
|
|
159364
159369
|
store.doGenerateArcImages(data, lyr);
|
|
159365
159370
|
} else {
|
|
159371
|
+
// debugger
|
|
159366
159372
|
store.doGenerateEsriImages(data, lyr);
|
|
159367
159373
|
}
|
|
159368
159374
|
} else {
|
|
@@ -159485,6 +159491,7 @@ var bundle$8 = {
|
|
|
159485
159491
|
switch (data.geometryType) {
|
|
159486
159492
|
case "esriGeometryPolygon":
|
|
159487
159493
|
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSSolid") {
|
|
159494
|
+
// debugger
|
|
159488
159495
|
var img = new Image();
|
|
159489
159496
|
var outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
159490
159497
|
var fillColor = drawingInfo.renderer.symbol.color;
|
|
@@ -159523,8 +159530,7 @@ var bundle$8 = {
|
|
|
159523
159530
|
loading: false
|
|
159524
159531
|
}
|
|
159525
159532
|
});
|
|
159526
|
-
}
|
|
159527
|
-
else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal") {
|
|
159533
|
+
} else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSFS" && drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal") {
|
|
159528
159534
|
// debugger
|
|
159529
159535
|
var _img = new Image();
|
|
159530
159536
|
|
|
@@ -159584,10 +159590,15 @@ var bundle$8 = {
|
|
|
159584
159590
|
});
|
|
159585
159591
|
} //____________________________________________________________________________________________________________________________________
|
|
159586
159592
|
else if (drawingInfo.renderer.type === "uniqueValue" && drawingInfo.renderer.uniqueValueInfos) {
|
|
159593
|
+
// Compare
|
|
159587
159594
|
drawingInfo.renderer.uniqueValueInfos.forEach(function (val) {
|
|
159588
159595
|
var img = new Image();
|
|
159589
|
-
|
|
159596
|
+
console.log(val.value);
|
|
159597
|
+
|
|
159598
|
+
if (val.value === 'BOEM') ;
|
|
159599
|
+
|
|
159590
159600
|
var fillColor = val.symbol.color;
|
|
159601
|
+
var outlineColor = val.symbol.outline && val.symbol.outline.color ? val.symbol.outline.color : fillColor;
|
|
159591
159602
|
var canvas = document.createElement("canvas");
|
|
159592
159603
|
var ctx = canvas.getContext("2d");
|
|
159593
159604
|
var labelWidth = Number(ctx.measureText(val.label).width); //set canvas width & height
|
|
@@ -159730,6 +159741,7 @@ var bundle$8 = {
|
|
|
159730
159741
|
|
|
159731
159742
|
case "esriGeometryPoint":
|
|
159732
159743
|
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
159744
|
+
// debugger
|
|
159733
159745
|
var _img3 = new Image();
|
|
159734
159746
|
|
|
159735
159747
|
_img3.src = "data:image/png;base64,".concat(data.drawingInfo.renderer.symbol.imageData);
|
|
@@ -159764,7 +159776,8 @@ var bundle$8 = {
|
|
|
159764
159776
|
dispatch({
|
|
159765
159777
|
type: "LEGEND_LAYERS_UPDATED",
|
|
159766
159778
|
payload: {
|
|
159767
|
-
legendLayers: legendLayers
|
|
159779
|
+
legendLayers: legendLayers,
|
|
159780
|
+
loading: false
|
|
159768
159781
|
}
|
|
159769
159782
|
});
|
|
159770
159783
|
} else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSMS") {
|
|
@@ -159892,6 +159905,52 @@ var bundle$8 = {
|
|
|
159892
159905
|
}
|
|
159893
159906
|
});
|
|
159894
159907
|
});
|
|
159908
|
+
} else if (drawingInfo.renderer.classBreakInfos) {
|
|
159909
|
+
drawingInfo.renderer.classBreakInfos.forEach(function (val) {
|
|
159910
|
+
var img = new Image();
|
|
159911
|
+
var outlineColor = val.symbol.outline.color;
|
|
159912
|
+
var outlineWidth = val.symbol.outline.width;
|
|
159913
|
+
var fillColor = val.symbol.color;
|
|
159914
|
+
var size = val.symbol.size;
|
|
159915
|
+
var canvas = document.createElement("canvas");
|
|
159916
|
+
var ctx = canvas.getContext("2d");
|
|
159917
|
+
canvas.width = 20 * 2.5;
|
|
159918
|
+
canvas.height = 20;
|
|
159919
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
159920
|
+
legendCanvases[uid].heights.push(canvas.height); //text
|
|
159921
|
+
|
|
159922
|
+
ctx.font = "11px Arial";
|
|
159923
|
+
ctx.fillText(val.label, size * 3, size * 2, 30); // circle
|
|
159924
|
+
|
|
159925
|
+
ctx.beginPath();
|
|
159926
|
+
ctx.strokeStyle = "rgba(".concat(outlineColor.join(), ")");
|
|
159927
|
+
ctx.lineWidth = outlineWidth;
|
|
159928
|
+
ctx.arc(size, size * 1.5, size / 1.5, 0, Math.PI * 2);
|
|
159929
|
+
ctx.fillStyle = "rgba(".concat(fillColor.join(), ")");
|
|
159930
|
+
ctx.fill();
|
|
159931
|
+
ctx.stroke();
|
|
159932
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
159933
|
+
|
|
159934
|
+
img.alt = "Style for ".concat(displayName);
|
|
159935
|
+
img.crossOrigin = "anonymous"; // debugger
|
|
159936
|
+
|
|
159937
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
159938
|
+
dispatch({
|
|
159939
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
159940
|
+
payload: {
|
|
159941
|
+
legendCanvases: legendCanvases,
|
|
159942
|
+
loading: false
|
|
159943
|
+
}
|
|
159944
|
+
});
|
|
159945
|
+
legendLayers[uid].push(img);
|
|
159946
|
+
dispatch({
|
|
159947
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
159948
|
+
payload: {
|
|
159949
|
+
legendLayers: legendLayers,
|
|
159950
|
+
loading: false
|
|
159951
|
+
}
|
|
159952
|
+
});
|
|
159953
|
+
});
|
|
159895
159954
|
} else {
|
|
159896
159955
|
legendLayers[uid] = ["Legend not available!"];
|
|
159897
159956
|
dispatch({
|
|
@@ -159904,6 +159963,52 @@ var bundle$8 = {
|
|
|
159904
159963
|
});
|
|
159905
159964
|
}
|
|
159906
159965
|
|
|
159966
|
+
break;
|
|
159967
|
+
|
|
159968
|
+
case "esriGeometryMultipoint":
|
|
159969
|
+
// debugger
|
|
159970
|
+
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
159971
|
+
// debugger
|
|
159972
|
+
var _img5 = new Image();
|
|
159973
|
+
|
|
159974
|
+
_img5.src = "data:image/png;base64,".concat(data.drawingInfo.renderer.symbol.imageData);
|
|
159975
|
+
|
|
159976
|
+
_img5.addEventListener("load", function () {
|
|
159977
|
+
var canvas = document.createElement("canvas");
|
|
159978
|
+
var ctx = canvas.getContext("2d");
|
|
159979
|
+
canvas.width = drawingInfo.renderer.symbol.width;
|
|
159980
|
+
canvas.height = drawingInfo.renderer.symbol.height; //store width & height for larger canvas calculation
|
|
159981
|
+
|
|
159982
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
159983
|
+
legendCanvases[uid].heights.push(canvas.height); //set background
|
|
159984
|
+
|
|
159985
|
+
ctx.fillStyle = "white";
|
|
159986
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
159987
|
+
ctx.drawImage(_img5, 0, 0); //add image to canvas
|
|
159988
|
+
|
|
159989
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
159990
|
+
dispatch({
|
|
159991
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
159992
|
+
payload: {
|
|
159993
|
+
legendCanvases: legendCanvases,
|
|
159994
|
+
loading: false
|
|
159995
|
+
}
|
|
159996
|
+
});
|
|
159997
|
+
}, false);
|
|
159998
|
+
|
|
159999
|
+
_img5.alt = "Style for ".concat(displayName);
|
|
160000
|
+
_img5.crossOrigin = "anonymous";
|
|
160001
|
+
legendLayers[uid] = [_img5]; //TODO: Update to possibly push multiple images into array
|
|
160002
|
+
|
|
160003
|
+
dispatch({
|
|
160004
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
160005
|
+
payload: {
|
|
160006
|
+
legendLayers: legendLayers,
|
|
160007
|
+
loading: false
|
|
160008
|
+
}
|
|
160009
|
+
});
|
|
160010
|
+
}
|
|
160011
|
+
|
|
159907
160012
|
break;
|
|
159908
160013
|
}
|
|
159909
160014
|
};
|
package/package.json
CHANGED
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
src = `${src}/legend?bandIds=&renderingRule=&f=pjson`;
|
|
59
59
|
break;
|
|
60
60
|
case "EsriFeatureService":
|
|
61
|
+
// debugger
|
|
61
62
|
if (legendOverride === true) {
|
|
62
63
|
src = `${src}/legend?f=pjson`;
|
|
63
64
|
}
|
|
@@ -91,6 +92,7 @@ export default {
|
|
|
91
92
|
if (legendOverride === true) {
|
|
92
93
|
store.doGenerateArcImages(data, lyr);
|
|
93
94
|
} else {
|
|
95
|
+
// debugger
|
|
94
96
|
store.doGenerateEsriImages(data, lyr);
|
|
95
97
|
}
|
|
96
98
|
} else {
|
|
@@ -218,6 +220,7 @@ export default {
|
|
|
218
220
|
drawingInfo.renderer.symbol.type === "esriSFS" &&
|
|
219
221
|
drawingInfo.renderer.symbol.style === "esriSFSSolid"
|
|
220
222
|
) {
|
|
223
|
+
// debugger
|
|
221
224
|
let img = new Image();
|
|
222
225
|
const outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
223
226
|
const fillColor = drawingInfo.renderer.symbol.color;
|
|
@@ -264,7 +267,6 @@ export default {
|
|
|
264
267
|
},
|
|
265
268
|
});
|
|
266
269
|
}
|
|
267
|
-
//__________________________________________________________________________________________________________________________________
|
|
268
270
|
else if(
|
|
269
271
|
drawingInfo.renderer.symbol &&
|
|
270
272
|
drawingInfo.renderer.symbol.type === "esriSFS" &&
|
|
@@ -326,10 +328,17 @@ export default {
|
|
|
326
328
|
drawingInfo.renderer.type === "uniqueValue" &&
|
|
327
329
|
drawingInfo.renderer.uniqueValueInfos
|
|
328
330
|
) {
|
|
331
|
+
// Compare
|
|
329
332
|
drawingInfo.renderer.uniqueValueInfos.forEach((val) => {
|
|
330
333
|
let img = new Image();
|
|
331
|
-
|
|
334
|
+
console.log(val.value)
|
|
335
|
+
if (val.value === 'BOEM') {
|
|
336
|
+
// debugger
|
|
337
|
+
}
|
|
338
|
+
|
|
332
339
|
const fillColor = val.symbol.color;
|
|
340
|
+
const outlineColor = val.symbol.outline && val.symbol.outline.color ? val.symbol.outline.color : fillColor;
|
|
341
|
+
|
|
333
342
|
|
|
334
343
|
let canvas = document.createElement("canvas");
|
|
335
344
|
let ctx = canvas.getContext("2d");
|
|
@@ -488,6 +497,7 @@ export default {
|
|
|
488
497
|
break;
|
|
489
498
|
case "esriGeometryPoint":
|
|
490
499
|
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
500
|
+
// debugger
|
|
491
501
|
let img = new Image();
|
|
492
502
|
img.src = `data:image/png;base64,${data.drawingInfo.renderer.symbol.imageData}`;
|
|
493
503
|
img.addEventListener(
|
|
@@ -529,6 +539,7 @@ export default {
|
|
|
529
539
|
type: "LEGEND_LAYERS_UPDATED",
|
|
530
540
|
payload: {
|
|
531
541
|
legendLayers: legendLayers,
|
|
542
|
+
loading: false,
|
|
532
543
|
},
|
|
533
544
|
});
|
|
534
545
|
} else if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriSMS") {
|
|
@@ -655,36 +666,76 @@ export default {
|
|
|
655
666
|
|
|
656
667
|
});
|
|
657
668
|
result.forEach((item) => {
|
|
658
|
-
|
|
659
669
|
item.image.alt = `Style for ${lyr.displayName}`;
|
|
660
|
-
|
|
661
670
|
legendCanvases[lyr.uid].widths.push(item.canvas.width);
|
|
662
|
-
|
|
663
671
|
legendCanvases[lyr.uid].heights.push(item.canvas.height);
|
|
664
|
-
|
|
665
672
|
legendCanvases[lyr.uid].canvas.push(item.canvas);
|
|
666
|
-
|
|
667
673
|
legendLayers[lyr.uid].push(item.image);
|
|
668
674
|
|
|
675
|
+
dispatch({
|
|
676
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
677
|
+
payload: {
|
|
678
|
+
legendCanvases: legendCanvases,
|
|
679
|
+
loading: false,
|
|
680
|
+
},
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
else if (drawingInfo.renderer.classBreakInfos){
|
|
686
|
+
drawingInfo.renderer.classBreakInfos.forEach((val) => {
|
|
687
|
+
let img = new Image();
|
|
688
|
+
const outlineColor = val.symbol.outline.color;
|
|
689
|
+
const outlineWidth = val.symbol.outline.width;
|
|
690
|
+
const fillColor = val.symbol.color;
|
|
691
|
+
const size = val.symbol.size;
|
|
692
|
+
let canvas = document.createElement("canvas");
|
|
693
|
+
let ctx = canvas.getContext("2d");
|
|
669
694
|
|
|
695
|
+
canvas.width = 20 * 2.5;
|
|
696
|
+
canvas.height = 20;
|
|
670
697
|
|
|
671
|
-
|
|
698
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
699
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
700
|
+
|
|
701
|
+
//text
|
|
702
|
+
ctx.font = "11px Arial";
|
|
703
|
+
ctx.fillText(val.label ,size * 3 , size * 2 , 30);
|
|
672
704
|
|
|
673
|
-
|
|
705
|
+
// circle
|
|
706
|
+
ctx.beginPath();
|
|
707
|
+
ctx.strokeStyle = `rgba(${outlineColor.join()})`;
|
|
708
|
+
ctx.lineWidth = outlineWidth;
|
|
709
|
+
ctx.arc(size, size * 1.5, size/1.5, 0, Math.PI * 2);
|
|
710
|
+
ctx.fillStyle = `rgba(${fillColor.join()})`;
|
|
711
|
+
ctx.fill();
|
|
712
|
+
ctx.stroke();
|
|
674
713
|
|
|
675
|
-
|
|
714
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
715
|
+
img.alt = `Style for ${displayName}`;
|
|
716
|
+
img.crossOrigin = "anonymous";
|
|
717
|
+
// debugger
|
|
676
718
|
|
|
719
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
720
|
+
dispatch({
|
|
721
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
722
|
+
payload: {
|
|
677
723
|
legendCanvases: legendCanvases,
|
|
678
|
-
|
|
679
724
|
loading: false,
|
|
680
|
-
|
|
681
725
|
},
|
|
726
|
+
});
|
|
682
727
|
|
|
728
|
+
legendLayers[uid].push(img);
|
|
729
|
+
dispatch({
|
|
730
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
731
|
+
payload: {
|
|
732
|
+
legendLayers: legendLayers,
|
|
733
|
+
loading: false,
|
|
734
|
+
},
|
|
683
735
|
});
|
|
684
736
|
});
|
|
685
737
|
}
|
|
686
738
|
else {
|
|
687
|
-
|
|
688
739
|
legendLayers[uid] = ["Legend not available!"];
|
|
689
740
|
dispatch({
|
|
690
741
|
type: "LEGEND_LAYERS_UPDATE_ERROR",
|
|
@@ -696,6 +747,57 @@ export default {
|
|
|
696
747
|
});
|
|
697
748
|
}
|
|
698
749
|
break;
|
|
750
|
+
case "esriGeometryMultipoint" :
|
|
751
|
+
// debugger
|
|
752
|
+
if (drawingInfo.renderer.symbol && drawingInfo.renderer.symbol.type === "esriPMS") {
|
|
753
|
+
// debugger
|
|
754
|
+
let img = new Image();
|
|
755
|
+
img.src = `data:image/png;base64,${data.drawingInfo.renderer.symbol.imageData}`;
|
|
756
|
+
img.addEventListener(
|
|
757
|
+
"load",
|
|
758
|
+
function () {
|
|
759
|
+
let canvas = document.createElement("canvas");
|
|
760
|
+
let ctx = canvas.getContext("2d");
|
|
761
|
+
|
|
762
|
+
canvas.width = drawingInfo.renderer.symbol.width;
|
|
763
|
+
canvas.height = drawingInfo.renderer.symbol.height;
|
|
764
|
+
|
|
765
|
+
//store width & height for larger canvas calculation
|
|
766
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
767
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
768
|
+
|
|
769
|
+
//set background
|
|
770
|
+
ctx.fillStyle = "white";
|
|
771
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
772
|
+
|
|
773
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
774
|
+
|
|
775
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
776
|
+
|
|
777
|
+
dispatch({
|
|
778
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
779
|
+
payload: {
|
|
780
|
+
legendCanvases: legendCanvases,
|
|
781
|
+
loading: false,
|
|
782
|
+
},
|
|
783
|
+
});
|
|
784
|
+
},
|
|
785
|
+
false
|
|
786
|
+
);
|
|
787
|
+
|
|
788
|
+
img.alt = `Style for ${displayName}`;
|
|
789
|
+
img.crossOrigin = "anonymous";
|
|
790
|
+
legendLayers[uid] = [img]; //TODO: Update to possibly push multiple images into array
|
|
791
|
+
dispatch({
|
|
792
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
793
|
+
payload: {
|
|
794
|
+
legendLayers: legendLayers,
|
|
795
|
+
loading: false,
|
|
796
|
+
},
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
break;
|
|
800
|
+
|
|
699
801
|
default:
|
|
700
802
|
break;
|
|
701
803
|
}
|
|
@@ -1,139 +1,142 @@
|
|
|
1
|
-
const formatArcgisrest = function (attributes) {
|
|
2
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
3
|
-
const result =
|
|
4
|
-
String(value).includes("https:") || String(value).includes("http:")
|
|
5
|
-
? value
|
|
6
|
-
: null;
|
|
7
|
-
|
|
8
|
-
if (result) {
|
|
9
|
-
attributes[key] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return attributes;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const formatArcgisVector = function (results) {
|
|
16
|
-
results.map((feat) => {
|
|
17
|
-
for (const [key, value] of Object.entries(feat.properties)) {
|
|
18
|
-
const result =
|
|
19
|
-
String(value).includes("https:") || String(value).includes("http:")
|
|
20
|
-
? value
|
|
21
|
-
: null;
|
|
22
|
-
|
|
23
|
-
if (result) {
|
|
24
|
-
feat.properties[
|
|
25
|
-
key
|
|
26
|
-
] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
27
|
-
}
|
|
28
|
-
// Format UNIX Date
|
|
29
|
-
|
|
30
|
-
// if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
31
|
-
// const unixTimestamp = feat.properties[key];
|
|
32
|
-
// const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
33
|
-
// const dateObject = new Date(milliseconds);
|
|
34
|
-
// feat.properties[key] = dateObject.toLocaleString();
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return results;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const identifyColumnsArcgisrest = function (data, excludedColumns) {
|
|
43
|
-
data.results.forEach((result) => {
|
|
44
|
-
if(result.attributes){
|
|
45
|
-
excludedColumns.forEach((column) => {
|
|
46
|
-
delete result.attributes[column];
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return result.attributes;
|
|
50
|
-
});
|
|
51
|
-
return data;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const identifyExcludeColumnsArcgisvector = function (data, excludedColumns) {
|
|
55
|
-
data.forEach((feature) => {
|
|
56
|
-
if(feature.properties){
|
|
57
|
-
excludedColumns.forEach((column) => {
|
|
58
|
-
delete feature.properties[column];
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return feature.properties
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return data;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const identifyIncludeColumnsArcgisvector = function (data, identifyFields) {
|
|
68
|
-
data.forEach((feature) => {
|
|
69
|
-
console.log(feature, feature.properties)
|
|
70
|
-
if(feature.properties){
|
|
71
|
-
for (const [key, value] of Object.entries(feature.properties)) {
|
|
72
|
-
let reducedProperties = {};
|
|
73
|
-
identifyFields.forEach((property) => {
|
|
74
|
-
if (feature.properties[property]) {
|
|
75
|
-
reducedProperties[property] =
|
|
76
|
-
feature.properties[property];
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
feature.properties = reducedProperties;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
return data;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const identifyRenameColumnsArcgisvector = function (data, identifyRenameColums) {
|
|
88
|
-
|
|
89
|
-
data.forEach((feature) => {
|
|
90
|
-
if(feature.properties){
|
|
91
|
-
let wkData = {};
|
|
92
|
-
for (const [featureKey, featureValue] of Object.entries(feature.properties)) {
|
|
93
|
-
for (const [key, value] of Object.entries(identifyRenameColums)){
|
|
94
|
-
if (featureKey === key) {
|
|
95
|
-
// feature.properties[value] = feature.properties[featureKey];
|
|
96
|
-
wkData[value] = feature.properties[featureKey];
|
|
97
|
-
delete feature.properties[featureKey];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
feature.properties = Object.assign(wkData, feature.properties)
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
return data;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const identifyFormatColumnsArcgisvector = function (data, identifyFormatColumns) {
|
|
109
|
-
data.forEach((feature) => {
|
|
110
|
-
if(feature.properties){
|
|
111
|
-
for (const [key, value] of Object.entries(identifyFormatColumns)){
|
|
112
|
-
console.log(key, value);
|
|
113
|
-
if(feature.properties.hasOwnProperty(key)){
|
|
114
|
-
feature.properties[key] = formatColumns(feature.properties[key], value)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
return data;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const formatColumns = function (value, formatType) {
|
|
124
|
-
if (formatType === "PERCENT") {
|
|
125
|
-
value = (value * 100).toFixed(0) + '%'
|
|
126
|
-
}
|
|
127
|
-
if (formatType === "BOOLEAN") {
|
|
128
|
-
value = value === 0 ? "No" : "Yes"
|
|
129
|
-
}
|
|
130
|
-
if (formatType === "UNIXDATE") {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
1
|
+
const formatArcgisrest = function (attributes) {
|
|
2
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
3
|
+
const result =
|
|
4
|
+
String(value).includes("https:") || String(value).includes("http:")
|
|
5
|
+
? value
|
|
6
|
+
: null;
|
|
7
|
+
|
|
8
|
+
if (result) {
|
|
9
|
+
attributes[key] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return attributes;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const formatArcgisVector = function (results) {
|
|
16
|
+
results.map((feat) => {
|
|
17
|
+
for (const [key, value] of Object.entries(feat.properties)) {
|
|
18
|
+
const result =
|
|
19
|
+
String(value).includes("https:") || String(value).includes("http:")
|
|
20
|
+
? value
|
|
21
|
+
: null;
|
|
22
|
+
|
|
23
|
+
if (result) {
|
|
24
|
+
feat.properties[
|
|
25
|
+
key
|
|
26
|
+
] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
27
|
+
}
|
|
28
|
+
// Format UNIX Date
|
|
29
|
+
|
|
30
|
+
// if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
31
|
+
// const unixTimestamp = feat.properties[key];
|
|
32
|
+
// const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
33
|
+
// const dateObject = new Date(milliseconds);
|
|
34
|
+
// feat.properties[key] = dateObject.toLocaleString();
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return results;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const identifyColumnsArcgisrest = function (data, excludedColumns) {
|
|
43
|
+
data.results.forEach((result) => {
|
|
44
|
+
if(result.attributes){
|
|
45
|
+
excludedColumns.forEach((column) => {
|
|
46
|
+
delete result.attributes[column];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return result.attributes;
|
|
50
|
+
});
|
|
51
|
+
return data;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const identifyExcludeColumnsArcgisvector = function (data, excludedColumns) {
|
|
55
|
+
data.forEach((feature) => {
|
|
56
|
+
if(feature.properties){
|
|
57
|
+
excludedColumns.forEach((column) => {
|
|
58
|
+
delete feature.properties[column];
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return feature.properties
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const identifyIncludeColumnsArcgisvector = function (data, identifyFields) {
|
|
68
|
+
data.forEach((feature) => {
|
|
69
|
+
console.log(feature, feature.properties)
|
|
70
|
+
if(feature.properties){
|
|
71
|
+
for (const [key, value] of Object.entries(feature.properties)) {
|
|
72
|
+
let reducedProperties = {};
|
|
73
|
+
identifyFields.forEach((property) => {
|
|
74
|
+
if (feature.properties[property]) {
|
|
75
|
+
reducedProperties[property] =
|
|
76
|
+
feature.properties[property];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
feature.properties = reducedProperties;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return data;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const identifyRenameColumnsArcgisvector = function (data, identifyRenameColums) {
|
|
88
|
+
|
|
89
|
+
data.forEach((feature) => {
|
|
90
|
+
if(feature.properties){
|
|
91
|
+
let wkData = {};
|
|
92
|
+
for (const [featureKey, featureValue] of Object.entries(feature.properties)) {
|
|
93
|
+
for (const [key, value] of Object.entries(identifyRenameColums)){
|
|
94
|
+
if (featureKey === key) {
|
|
95
|
+
// feature.properties[value] = feature.properties[featureKey];
|
|
96
|
+
wkData[value] = feature.properties[featureKey];
|
|
97
|
+
delete feature.properties[featureKey];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
feature.properties = Object.assign(wkData, feature.properties)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return data;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const identifyFormatColumnsArcgisvector = function (data, identifyFormatColumns) {
|
|
109
|
+
data.forEach((feature) => {
|
|
110
|
+
if(feature.properties){
|
|
111
|
+
for (const [key, value] of Object.entries(identifyFormatColumns)){
|
|
112
|
+
console.log(key, value);
|
|
113
|
+
if(feature.properties.hasOwnProperty(key)){
|
|
114
|
+
feature.properties[key] = formatColumns(feature.properties[key], value)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return data;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const formatColumns = function (value, formatType) {
|
|
124
|
+
if (formatType === "PERCENT") {
|
|
125
|
+
value = (value * 100).toFixed(0) + '%'
|
|
126
|
+
}
|
|
127
|
+
if (formatType === "BOOLEAN") {
|
|
128
|
+
value = value === 0 ? "No" : "Yes"
|
|
129
|
+
}
|
|
130
|
+
if (formatType === "UNIXDATE") {
|
|
131
|
+
if (value === null || value === "null") {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const unixTimestamp = value;
|
|
135
|
+
const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
136
|
+
const dateObject = new Date(milliseconds);
|
|
137
|
+
value = dateObject.toLocaleString();
|
|
138
|
+
}
|
|
139
|
+
return value;
|
|
140
|
+
};
|
|
141
|
+
|
|
139
142
|
export { formatArcgisVector, formatArcgisrest, identifyColumnsArcgisrest, identifyExcludeColumnsArcgisvector, identifyIncludeColumnsArcgisvector, identifyRenameColumnsArcgisvector, identifyFormatColumnsArcgisvector };
|