@corpsmap/corpsmap 3.0.12 → 3.0.15
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 +369 -218
- package/lib/prod.js +369 -218
- package/package.json +4 -1
- package/src/application-bundles/map-layers-bundle.js +6 -0
- package/src/application-controls/tree-list-folder.js +45 -27
- package/src/core-plugins/add-data/bundle.js +18 -4
- package/src/core-plugins/identify-arcgis-rest/bundle.js +2 -1
- package/src/core-plugins/legend/bundle.js +9 -3
- package/src/core-plugins/print-map/bundle.js +21 -1
- package/src/core-plugins/tree-view/download-bundle.js +2 -2
- package/src/core-plugins/tree-view/layer-subpanel/layer-subpanel.js +9 -1
- package/src/core-plugins/tree-view/tree-list-item-dataset.js +14 -3
- package/src/openlayers-utils/format-utilities.js +13 -0
- package/src/utils/load-plugins.test.js +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corpsmap/corpsmap",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
4
4
|
"description": "CorpsMap as React Components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -58,6 +58,8 @@
|
|
|
58
58
|
"async": "^2.6.1",
|
|
59
59
|
"classnames": "^2.2.5",
|
|
60
60
|
"css": "^2.2.4",
|
|
61
|
+
"decompress": "^4.2.1",
|
|
62
|
+
"extract-files": "^12.0.0",
|
|
61
63
|
"file-saver": "^2.0.2",
|
|
62
64
|
"is-html": "^2.0.0",
|
|
63
65
|
"jspdf": "^1.5.3",
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"money-clip": "^3.0.1",
|
|
69
71
|
"ol": "^6.4.3",
|
|
70
72
|
"ol-esri-style": "^2.0.7",
|
|
73
|
+
"parse2-kmz": "^1.0.5",
|
|
71
74
|
"proj4": "^2.4.4",
|
|
72
75
|
"react-data-grid": "^6.1.0",
|
|
73
76
|
"react-datepicker": "^2.9.6",
|
|
@@ -50,6 +50,9 @@ const createNode = (options, map) => {
|
|
|
50
50
|
favorite: false,
|
|
51
51
|
userDefaultLayer: false,
|
|
52
52
|
selectAllLayers: options.selectAllLayers,
|
|
53
|
+
hoverText: options.hoverText,
|
|
54
|
+
layerDescription: options.layerDescription,
|
|
55
|
+
attributions: options.attributions,
|
|
53
56
|
};
|
|
54
57
|
return node;
|
|
55
58
|
};
|
|
@@ -519,6 +522,9 @@ export default {
|
|
|
519
522
|
const delim = url.indexOf("?") === -1 ? "?" : "&";
|
|
520
523
|
return `${url}${delim}label=true`;
|
|
521
524
|
}
|
|
525
|
+
// if (node.HoverText){
|
|
526
|
+
// set the text popup to the hover text value
|
|
527
|
+
// }
|
|
522
528
|
|
|
523
529
|
if (node.mapLayer) {
|
|
524
530
|
node.labelsOn = labelsOn;
|
|
@@ -1,43 +1,61 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import classnames from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
3
|
|
|
4
4
|
class TreeListFolder extends React.Component {
|
|
5
|
-
render(){
|
|
6
|
-
const { item, collapsed, toggleCollapsed } = this.props;
|
|
5
|
+
render() {
|
|
6
|
+
const { displayName, item, collapsed, toggleCollapsed } = this.props;
|
|
7
|
+
|
|
8
|
+
const testText = "LAYER_X";
|
|
9
|
+
const hoverText = testText ? testText : displayName;
|
|
10
|
+
const { isOver, theme, mapZoom } = this.props;
|
|
11
|
+
|
|
12
|
+
const enabled = item.minzoom <= mapZoom && item.maxzoom >= mapZoom;
|
|
13
|
+
const itemTxtStyle = enabled ? { color: "#666" } : { color: "#bbb" };
|
|
14
|
+
|
|
7
15
|
const iconClass = classnames({
|
|
8
|
-
|
|
16
|
+
mdi: true,
|
|
9
17
|
"mdi-folder-open": !collapsed,
|
|
10
|
-
"mdi-folder": collapsed
|
|
11
|
-
})
|
|
18
|
+
"mdi-folder": collapsed,
|
|
19
|
+
});
|
|
12
20
|
const itemClass = classnames({
|
|
13
|
-
"tree-list-item-hover": false
|
|
14
|
-
})
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
"tree-list-item-hover": false,
|
|
22
|
+
});
|
|
23
|
+
const itemClassTest = classnames({
|
|
24
|
+
"cm-checkbox-inline": true,
|
|
25
|
+
"cm-checkbox-ellipsis": true,
|
|
26
|
+
"tree-list-item-hover": isOver,
|
|
27
|
+
});
|
|
28
|
+
const divStyle = {
|
|
29
|
+
display: "inline-block",
|
|
30
|
+
paddingLeft: "8px",
|
|
31
|
+
};
|
|
19
32
|
const count = item.children.length;
|
|
20
33
|
return (
|
|
21
34
|
<div>
|
|
22
|
-
<i
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
<i
|
|
36
|
+
title="Click to collapse or expand"
|
|
37
|
+
onClick={toggleCollapsed}
|
|
38
|
+
className={iconClass}
|
|
39
|
+
style={{ fontSize: "16px", cursor: "pointer" }}
|
|
40
|
+
></i>
|
|
27
41
|
<span>
|
|
28
|
-
<div
|
|
29
|
-
className={itemClass}
|
|
42
|
+
<div
|
|
43
|
+
className={itemClass}
|
|
30
44
|
style={divStyle}
|
|
31
|
-
onDoubleClick={toggleCollapsed}
|
|
32
|
-
|
|
45
|
+
onDoubleClick={toggleCollapsed}
|
|
46
|
+
>
|
|
47
|
+
{item.displayName}
|
|
33
48
|
</div>
|
|
34
|
-
<span>
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
<span>{" (" + count + ")"}</span>
|
|
50
|
+
<label
|
|
51
|
+
className={itemClassTest}
|
|
52
|
+
title={`${hoverText} ${!enabled ? "- zoom in to enable" : ""}`}
|
|
53
|
+
style={itemTxtStyle}
|
|
54
|
+
></label>
|
|
37
55
|
</span>
|
|
38
56
|
</div>
|
|
39
|
-
)
|
|
57
|
+
);
|
|
40
58
|
}
|
|
41
59
|
}
|
|
42
60
|
|
|
43
|
-
export default TreeListFolder;
|
|
61
|
+
export default TreeListFolder;
|
|
@@ -3,6 +3,8 @@ import GeoJSON from "ol/format/GeoJSON";
|
|
|
3
3
|
import { getLayer } from "../../openlayers-utils/layer-utilities";
|
|
4
4
|
import shp from "shpjs";
|
|
5
5
|
import KMLConvert from "@mapbox/togeojson";
|
|
6
|
+
import extractFiles from "extract-files/extractFiles.mjs";
|
|
7
|
+
import isExtractableFile from "extract-files/isExtractableFile.mjs";
|
|
6
8
|
|
|
7
9
|
export default {
|
|
8
10
|
name: "addData",
|
|
@@ -108,13 +110,25 @@ export default {
|
|
|
108
110
|
console.log(decodedFileInfo);
|
|
109
111
|
|
|
110
112
|
// read in our KML file and then parse it
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
// // convert our kml to geojson and store the results
|
|
113
|
+
// const KMZ = new DOMParser().parseFromString(decodedFileInfo);
|
|
114
|
+
// convert our kml to geojson and store the results
|
|
114
115
|
// const geojson = KMLConvert.kml(parsedKML);
|
|
115
116
|
|
|
117
|
+
// const file1 = new File(["1"], "BuxtonNC.kmz", {
|
|
118
|
+
// type: "text/plain",
|
|
119
|
+
// });
|
|
120
|
+
|
|
121
|
+
// const value = {
|
|
122
|
+
// a: file1,
|
|
123
|
+
// };
|
|
124
|
+
|
|
125
|
+
// const { clone, files } = extractFiles(
|
|
126
|
+
// value,
|
|
127
|
+
// isExtractableFile,
|
|
128
|
+
// "prefix"
|
|
129
|
+
// );
|
|
130
|
+
|
|
116
131
|
// store.doAddDataGeojson(file.name, geojson);
|
|
117
|
-
console.log(parsedKMZ);
|
|
118
132
|
} catch (err) {
|
|
119
133
|
store.doDispatchNotification(err.message || "Error adding data");
|
|
120
134
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import async from "async";
|
|
2
|
+
import formatArcgisrest from "../../openlayers-utils/format-utilities";
|
|
2
3
|
|
|
3
4
|
function formatUrl(options) {
|
|
4
5
|
let url = `${options.root}/identify?`;
|
|
@@ -105,7 +106,7 @@ export default {
|
|
|
105
106
|
type: featureType,
|
|
106
107
|
coordinates: coords,
|
|
107
108
|
},
|
|
108
|
-
properties: feat.attributes,
|
|
109
|
+
properties: formatArcgisrest(feat.attributes),
|
|
109
110
|
};
|
|
110
111
|
}),
|
|
111
112
|
},
|
|
@@ -38,9 +38,11 @@ export default {
|
|
|
38
38
|
let legendCanvases = store.selectLegendCanvases();
|
|
39
39
|
|
|
40
40
|
layers.forEach((lyr) => {
|
|
41
|
-
const { url, type, layerList, uid, displayName } = lyr;
|
|
41
|
+
const { url, type, layerList, uid, displayName, layerDescription, attributions } = lyr;
|
|
42
42
|
legendCanvases[uid] = {
|
|
43
43
|
displayName: displayName,
|
|
44
|
+
layerDescription: layerDescription,
|
|
45
|
+
attributions: attributions,
|
|
44
46
|
canvas: [],
|
|
45
47
|
widths: [],
|
|
46
48
|
heights: [],
|
|
@@ -102,13 +104,15 @@ export default {
|
|
|
102
104
|
});
|
|
103
105
|
},
|
|
104
106
|
doGenerateArcImages: (data, lyr) => ({ dispatch, store }) => {
|
|
105
|
-
const { uid, layerList, displayName } = lyr;
|
|
107
|
+
const { uid, layerList, displayName, layerDescription, attributions } = lyr;
|
|
106
108
|
let legendLayers = store.selectLegendLayers();
|
|
107
109
|
let legendCanvases = store.selectLegendCanvases();
|
|
108
110
|
const activeLayers = layerList.replace(/show:/g, "").split(",").map(Number);
|
|
109
111
|
|
|
110
112
|
legendCanvases[uid] = {
|
|
111
113
|
displayName: displayName,
|
|
114
|
+
layerDescription: layerDescription,
|
|
115
|
+
attributions: attributions,
|
|
112
116
|
canvas: [],
|
|
113
117
|
widths: [],
|
|
114
118
|
heights: [],
|
|
@@ -177,12 +181,14 @@ export default {
|
|
|
177
181
|
},
|
|
178
182
|
|
|
179
183
|
doGenerateEsriImages: (data, lyr) => ({ dispatch, store }) => {
|
|
180
|
-
const { uid, displayName } = lyr;
|
|
184
|
+
const { uid, displayName, layerDescription, attributions } = lyr;
|
|
181
185
|
let legendLayers = store.selectLegendLayers();
|
|
182
186
|
let legendCanvases = store.selectLegendCanvases();
|
|
183
187
|
const drawingInfo = data.drawingInfo;
|
|
184
188
|
legendCanvases[uid] = {
|
|
185
189
|
displayName: displayName,
|
|
190
|
+
layerDescription: layerDescription,
|
|
191
|
+
attributions: attributions,
|
|
186
192
|
canvas: [],
|
|
187
193
|
widths: [],
|
|
188
194
|
heights: [],
|
|
@@ -123,7 +123,7 @@ export default {
|
|
|
123
123
|
Number(
|
|
124
124
|
layerCTX.measureText(legendCanvases[layer.uid].displayName).width
|
|
125
125
|
) + 50;
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
//check if layer has a canvas
|
|
128
128
|
if (legendCanvases[layer.uid].canvas.length) {
|
|
129
129
|
//get largest width
|
|
@@ -150,6 +150,26 @@ export default {
|
|
|
150
150
|
dy += Number(item.height);
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
+
//add layerDescription
|
|
154
|
+
// if(legendCanvases[layer.uid].layerDescription) {
|
|
155
|
+
// dy += 50;
|
|
156
|
+
// layerCTX.font = "bold 12px Arial";
|
|
157
|
+
// layerCTX.fillStyle = "black";
|
|
158
|
+
// layerCTX.fillText("Layer Description: ", 0, dy);
|
|
159
|
+
// dy += 20;
|
|
160
|
+
// layerCTX.fillText(legendCanvases[layer.uid].layerDescription, 0, dy);
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
//add attribution
|
|
164
|
+
if(legendCanvases[layer.uid].attributions) {
|
|
165
|
+
dy += 50;
|
|
166
|
+
layerCTX.font = "bold 12px Arial";
|
|
167
|
+
layerCTX.fillStyle = "black";
|
|
168
|
+
layerCTX.fillText("Credits: ", 0, dy);
|
|
169
|
+
dy += 20;
|
|
170
|
+
layerCTX.fillText(legendCanvases[layer.uid].attributions, 0, dy);
|
|
171
|
+
}
|
|
172
|
+
|
|
153
173
|
canvases.push(layerCanvas);
|
|
154
174
|
} else {
|
|
155
175
|
//set canvas dimensions
|
|
@@ -48,7 +48,7 @@ export const treeViewDownload = {
|
|
|
48
48
|
const format = e.target.value;
|
|
49
49
|
let url = null;
|
|
50
50
|
if (layer.identifyType === "MAP") {
|
|
51
|
-
const params =
|
|
51
|
+
const params = `?&service=WFS&version=1.1.0&request=GetFeature&typeName=${layer.layerList}&outputformat=${format}&outfile=${layer.layerList}`;
|
|
52
52
|
url = `${layer.url}${params}`;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -108,7 +108,7 @@ export const treeViewDownload = {
|
|
|
108
108
|
let url = null;
|
|
109
109
|
switch (layer.identifyType) {
|
|
110
110
|
case "MAP":
|
|
111
|
-
const params =
|
|
111
|
+
const params = `?&service=WFS&version=1.1.0&request=GetFeature&typeName=${layer.layerList}&outputformat=${format}&outfile=${layer.layerList}`;
|
|
112
112
|
url = `${layer.url}${params}`;
|
|
113
113
|
break;
|
|
114
114
|
default:
|
|
@@ -30,7 +30,7 @@ const LayerSubpanel = (props) => {
|
|
|
30
30
|
: false;
|
|
31
31
|
const url =
|
|
32
32
|
treeViewSelectedItem.identifyType == "MAP"
|
|
33
|
-
? `${treeViewSelectedItem.url}
|
|
33
|
+
? `${treeViewSelectedItem.url}?&service=WMS&version=1.3.0&request=GetCapabilities&layers=${treeViewSelectedItem.layerList}&query_layers=${treeViewSelectedItem.layerList}`
|
|
34
34
|
: treeViewSelectedItem.url;
|
|
35
35
|
|
|
36
36
|
return (
|
|
@@ -90,6 +90,14 @@ const LayerSubpanel = (props) => {
|
|
|
90
90
|
<b>Current Zoom:</b> {Math.floor(mapZoom)}{" "}
|
|
91
91
|
</p>
|
|
92
92
|
|
|
93
|
+
<p>
|
|
94
|
+
<b>Credits:</b> {treeViewSelectedItem.attributions}{" "}
|
|
95
|
+
</p>
|
|
96
|
+
|
|
97
|
+
<p>
|
|
98
|
+
<b>Layer Description:</b> {treeViewSelectedItem.layerDescription}{" "}
|
|
99
|
+
</p>
|
|
100
|
+
|
|
93
101
|
{primaryPanelShowFavoritesBtn ? (
|
|
94
102
|
<FavoritesToggle layer={treeViewSelectedItem} />
|
|
95
103
|
) : null}
|
|
@@ -12,9 +12,11 @@ class TreeListItemDataset extends React.Component {
|
|
|
12
12
|
showLegend: false,
|
|
13
13
|
visible: props.item.visible,
|
|
14
14
|
displayName: props.item.displayName,
|
|
15
|
+
hoverText: props.item.hoverText,
|
|
15
16
|
type: props.item.type,
|
|
16
17
|
expanded: false,
|
|
17
18
|
};
|
|
19
|
+
|
|
18
20
|
this.toggleVisible = this.toggleVisible.bind(this);
|
|
19
21
|
this.zoomTo = this.zoomTo.bind(this);
|
|
20
22
|
this.openMetadata = this.openMetadata.bind(this);
|
|
@@ -77,7 +79,16 @@ class TreeListItemDataset extends React.Component {
|
|
|
77
79
|
render() {
|
|
78
80
|
const { item, isOver, theme, mapZoom } = this.props;
|
|
79
81
|
const { expanded } = this.state;
|
|
80
|
-
const {
|
|
82
|
+
const {
|
|
83
|
+
displayName,
|
|
84
|
+
type,
|
|
85
|
+
identifyType,
|
|
86
|
+
favorite,
|
|
87
|
+
userDefaultLayer,
|
|
88
|
+
hoverText,
|
|
89
|
+
} = item;
|
|
90
|
+
|
|
91
|
+
const hoverTextDisplay = hoverText ? hoverText : displayName;
|
|
81
92
|
|
|
82
93
|
if (!item.passFilter) return null;
|
|
83
94
|
|
|
@@ -111,7 +122,7 @@ class TreeListItemDataset extends React.Component {
|
|
|
111
122
|
</span>
|
|
112
123
|
<label
|
|
113
124
|
className={itemClass}
|
|
114
|
-
title={`${
|
|
125
|
+
title={`${hoverTextDisplay} ${!enabled ? "- zoom in to enable" : ""}`}
|
|
115
126
|
style={itemTxtStyle}
|
|
116
127
|
>
|
|
117
128
|
<input
|
|
@@ -135,7 +146,7 @@ class TreeListItemDataset extends React.Component {
|
|
|
135
146
|
title="Layer saved to favorites list"
|
|
136
147
|
/>
|
|
137
148
|
) : null}
|
|
138
|
-
|
|
149
|
+
{userDefaultLayer ? (
|
|
139
150
|
<i
|
|
140
151
|
style={{ fontSize: "11px" }}
|
|
141
152
|
className="mdi mdi-account"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const formatArcgisrest = function (attributes) {
|
|
2
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
3
|
+
const result =
|
|
4
|
+
value.includes("https:") || value.includes("http:") ? value : null;
|
|
5
|
+
|
|
6
|
+
if (result) {
|
|
7
|
+
attributes[key] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return attributes;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default formatArcgisrest;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// import { composeBundles } from 'redux-bundler';
|
|
2
|
+
// import loadPlugins from './load-plugins';
|
|
3
|
+
// import getStore from '../application-bundles';
|
|
4
|
+
// import pluginBundle from '../application-bundles/plugin-bundle';
|
|
5
|
+
|
|
6
|
+
// import addDataButton from '../core-plugins/add-data/add-data-button';
|
|
7
|
+
// import addDataPlugin from '../core-plugins/add-data';
|
|
8
|
+
// import basemapSwitcherPlugin from '../core-plugins/basemap-switcher';
|
|
9
|
+
// import bookmarksPlugin from '../core-plugins/bookmarks';
|
|
10
|
+
// import coordDisplayPlugin from '../core-plugins/coordinate-display';
|
|
11
|
+
// import drawPlugin from '../core-plugins/draw-tools';
|
|
12
|
+
// import geocoderPlugin from '../core-plugins/geocoder';
|
|
13
|
+
// import identifyPlugin from '../core-plugins/identify';
|
|
14
|
+
// import measureToolsPlugin from '../core-plugins/measure-tools';
|
|
15
|
+
// import rotateNorthPlugin from '../core-plugins/rotate-north';
|
|
16
|
+
// import themeSwitcherPlugin from '../core-plugins/theme-switcher';
|
|
17
|
+
// import treeViewPlugin from '../core-plugins/tree-view';
|
|
18
|
+
// import zoomInOutPlugin from '../core-plugins/zoom-in-out';
|
|
19
|
+
// import zoomHomePlugin from '../core-plugins/zoom-home';
|
|
20
|
+
// import zoomToBoxPlugin from '../core-plugins/zoom-to-box';
|
|
21
|
+
// import { extentFromProjection } from 'ol/tilegrid';
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// let store = getStore();
|
|
25
|
+
// let plugins = [addDataPlugin, basemapSwitcherPlugin, bookmarksPlugin, coordDisplayPlugin, drawPlugin,
|
|
26
|
+
// geocoderPlugin, identifyPlugin, measureToolsPlugin, rotateNorthPlugin, themeSwitcherPlugin, treeViewPlugin,
|
|
27
|
+
// zoomInOutPlugin, zoomHomePlugin, zoomToBoxPlugin];
|
|
28
|
+
|
|
29
|
+
// describe('Test loadPlugins', () => {
|
|
30
|
+
// test("should load 16 plugins", () => {
|
|
31
|
+
// // loadPlugins(store, plugins);
|
|
32
|
+
// // expect(store.getState()['plugins']['components'].length).toEqual(16);
|
|
33
|
+
// // expect(store.selectActiveBasemap()).toEqual(0)
|
|
34
|
+
// expect(true).toEqual(true)
|
|
35
|
+
// });
|
|
36
|
+
// });
|