@corpsmap/corpsmap 3.0.12 → 3.0.13
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 +266 -212
- package/lib/prod.js +266 -212
- package/package.json +4 -1
- package/src/application-bundles/map-layers-bundle.js +4 -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/tree-view/download-bundle.js +2 -2
- package/src/core-plugins/tree-view/layer-subpanel/layer-subpanel.js +1 -1
- package/src/core-plugins/tree-view/tree-list-item-dataset.js +14 -3
- 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.13",
|
|
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,7 @@ const createNode = (options, map) => {
|
|
|
50
50
|
favorite: false,
|
|
51
51
|
userDefaultLayer: false,
|
|
52
52
|
selectAllLayers: options.selectAllLayers,
|
|
53
|
+
hoverText: options.hoverText,
|
|
53
54
|
};
|
|
54
55
|
return node;
|
|
55
56
|
};
|
|
@@ -519,6 +520,9 @@ export default {
|
|
|
519
520
|
const delim = url.indexOf("?") === -1 ? "?" : "&";
|
|
520
521
|
return `${url}${delim}label=true`;
|
|
521
522
|
}
|
|
523
|
+
// if (node.HoverText){
|
|
524
|
+
// set the text popup to the hover text value
|
|
525
|
+
// }
|
|
522
526
|
|
|
523
527
|
if (node.mapLayer) {
|
|
524
528
|
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
|
}
|
|
@@ -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 (
|
|
@@ -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,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
|
+
// });
|