@corpsmap/corpsmap 3.2.76 → 3.2.78
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/.babelrc +10 -2
- package/lib/dev.js +58298 -58392
- package/lib/prod.js +43837 -43931
- package/package.json +22 -18
- package/src/application-bundles/api-bundle.js +34 -32
- package/src/application-bundles/map-layers-bundle.js +38 -33
- package/src/application-bundles/notification-bundle.js +35 -31
- package/src/application-bundles/south-region-bundle.js +48 -41
- package/src/application-bundles-old/ui-bundle.js +239 -179
- package/src/core-plugins/coordinate-display/bundle.js +189 -166
- package/src/core-plugins/basemap-switcher/basemap-switcher-list-item copy.js +0 -59
|
@@ -44,186 +44,209 @@ export default {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
doCoordsInitialize:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
doCoordsInitialize:
|
|
48
|
+
() =>
|
|
49
|
+
({ dispatch, store }) => {
|
|
50
|
+
dispatch({
|
|
51
|
+
type: "COORD_INITIALIZE_START",
|
|
52
|
+
payload: {
|
|
53
|
+
_shouldInitialize: false,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
const map = store.selectMap();
|
|
58
|
+
map.on("pointermove", throttle(store.doCoordsPointerMove, 200));
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
doCoordsPointerMove:
|
|
63
|
-
e
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const coord = e.coordinate;
|
|
68
|
-
const projected = transform(coord, "EPSG:3857", displayProjection);
|
|
69
|
-
const X = Math.round(projected[0] * 10000) / 10000;
|
|
70
|
-
const Y = Math.round(projected[1] * 10000) / 10000;
|
|
71
|
-
|
|
72
|
-
dispatch({
|
|
73
|
-
type: "COORD_POSITION_UPDATE",
|
|
74
|
-
payload: {
|
|
75
|
-
values: { X, Y },
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
doRenderCoordsOverlay: (center, coords) => ({ dispatch, store }) => {
|
|
80
|
-
const map = store.selectMap();
|
|
81
|
-
const hasCoordsOverlay = store.selectCoordsOverlay();
|
|
82
|
-
|
|
83
|
-
if (hasCoordsOverlay) {
|
|
84
|
-
store.doClearCoordOverlay(hasCoordsOverlay);
|
|
85
|
-
}
|
|
86
|
-
//generate overlay
|
|
87
|
-
const el = document.createElement("div");
|
|
88
|
-
const overlay = new Overlay({
|
|
89
|
-
element: el,
|
|
90
|
-
positioning: "bottom-center",
|
|
91
|
-
offset: [0, -10],
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
//add overlay to map
|
|
95
|
-
map.addOverlay(overlay);
|
|
96
|
-
ReactDOM.render(
|
|
97
|
-
<Popup
|
|
98
|
-
overlay={overlay}
|
|
99
|
-
coords={coords}
|
|
100
|
-
map={map}
|
|
101
|
-
onClear={store.doClearPopup}
|
|
102
|
-
/>,
|
|
103
|
-
el
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
overlay.setPosition(center);
|
|
107
|
-
dispatch({ type: "COORD_OVERLAY_RENDERED", payload: { overlay: overlay } });
|
|
108
|
-
},
|
|
109
|
-
doClearPopup: (e, overlay) => ({ store }) => {
|
|
110
|
-
console.log(e);
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
e.stopPropagation();
|
|
113
|
-
store.doClearCoordOverlay(overlay);
|
|
114
|
-
},
|
|
115
|
-
doClearCoordOverlay: (overlay) => ({ dispatch, store }) => {
|
|
116
|
-
const map = store.selectMap();
|
|
117
|
-
overlay.setPosition(undefined);
|
|
118
|
-
const el = overlay.getElement();
|
|
119
|
-
el.parentNode.removeChild(el);
|
|
120
|
-
map.removeOverlay(overlay);
|
|
121
|
-
dispatch({ type: "COORD_OVERLAY_REMOVED", payload: { overlay: null } });
|
|
122
|
-
},
|
|
123
|
-
doStartCoordCopy: () => ({ dispatch, store }) => {
|
|
124
|
-
const map = store.selectMap();
|
|
125
|
-
store.doSetCursor("crosshair");
|
|
126
|
-
|
|
127
|
-
//Parent container for coord copy.
|
|
128
|
-
const container = document.createElement("div");
|
|
129
|
-
container.id = "cm-copy-coords";
|
|
130
|
-
document.body.appendChild(container);
|
|
131
|
-
|
|
132
|
-
dispatch({
|
|
133
|
-
type: "COORD_COPY_ACTIVE",
|
|
134
|
-
payload: {
|
|
135
|
-
copyActive: true,
|
|
136
|
-
container: container,
|
|
137
|
-
notification: {
|
|
138
|
-
message: "Click on map to copy coordinates.",
|
|
139
|
-
level: "info",
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
});
|
|
60
|
+
dispatch({
|
|
61
|
+
type: "COORD_INITIALIZE_FINISH",
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
doCoordsPointerMove:
|
|
65
|
+
(e) =>
|
|
66
|
+
({ dispatch, store }) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
e.stopPropagation();
|
|
143
69
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const projected = transform(coord, "EPSG:3857", displayProjection);
|
|
155
|
-
const x = Math.round(projected[0] * 10000) / 10000;
|
|
156
|
-
const y = Math.round(projected[1] * 10000) / 10000;
|
|
157
|
-
|
|
158
|
-
//Add temp input node to use execCommand.
|
|
159
|
-
const valueEl = document.createElement("input");
|
|
160
|
-
copyContainer.appendChild(valueEl);
|
|
161
|
-
valueEl.value = `${x}, ${y}`;
|
|
162
|
-
valueEl.select();
|
|
163
|
-
document.execCommand("copy");
|
|
164
|
-
|
|
165
|
-
store.doStopCoordCopy(x, y);
|
|
166
|
-
},
|
|
167
|
-
doStopCoordCopy: (x, y) => ({ dispatch, store }) => {
|
|
168
|
-
const copyContainer = store.selectCoordsContainer();
|
|
169
|
-
const msg = `Copied ${x}, ${y} to the clipboard.`;
|
|
170
|
-
store.doSetCursor("default");
|
|
171
|
-
|
|
172
|
-
dispatch({
|
|
173
|
-
type: "COORD_COPIED",
|
|
174
|
-
payload: {
|
|
175
|
-
copyActive: false,
|
|
176
|
-
container: null,
|
|
177
|
-
notification: {
|
|
178
|
-
title: "Coordinate Display",
|
|
179
|
-
message: msg,
|
|
180
|
-
level: "info",
|
|
70
|
+
const displayProjection = store.selectDisplayProjection();
|
|
71
|
+
const coord = e.coordinate;
|
|
72
|
+
const projected = transform(coord, "EPSG:3857", displayProjection);
|
|
73
|
+
const X = Math.round(projected[0] * 10000) / 10000;
|
|
74
|
+
const Y = Math.round(projected[1] * 10000) / 10000;
|
|
75
|
+
|
|
76
|
+
dispatch({
|
|
77
|
+
type: "COORD_POSITION_UPDATE",
|
|
78
|
+
payload: {
|
|
79
|
+
values: { X, Y },
|
|
181
80
|
},
|
|
182
|
-
}
|
|
183
|
-
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
doRenderCoordsOverlay:
|
|
84
|
+
(center, coords) =>
|
|
85
|
+
({ dispatch, store }) => {
|
|
86
|
+
const map = store.selectMap();
|
|
87
|
+
const hasCoordsOverlay = store.selectCoordsOverlay();
|
|
184
88
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
89
|
+
if (hasCoordsOverlay) {
|
|
90
|
+
store.doClearCoordOverlay(hasCoordsOverlay);
|
|
91
|
+
}
|
|
92
|
+
//generate overlay
|
|
93
|
+
const el = document.createElement("div");
|
|
94
|
+
const overlay = new Overlay({
|
|
95
|
+
element: el,
|
|
96
|
+
positioning: "bottom-center",
|
|
97
|
+
offset: [0, -10],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
//add overlay to map
|
|
101
|
+
map.addOverlay(overlay);
|
|
102
|
+
ReactDOM.render(
|
|
103
|
+
<Popup
|
|
104
|
+
overlay={overlay}
|
|
105
|
+
coords={coords}
|
|
106
|
+
map={map}
|
|
107
|
+
onClear={store.doClearPopup}
|
|
108
|
+
/>,
|
|
109
|
+
el
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
overlay.setPosition(center);
|
|
113
|
+
dispatch({
|
|
114
|
+
type: "COORD_OVERLAY_RENDERED",
|
|
115
|
+
payload: { overlay: overlay },
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
doClearPopup:
|
|
119
|
+
(e, overlay) =>
|
|
120
|
+
({ store }) => {
|
|
121
|
+
console.log(e);
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
store.doClearCoordOverlay(overlay);
|
|
125
|
+
},
|
|
126
|
+
doClearCoordOverlay:
|
|
127
|
+
(overlay) =>
|
|
128
|
+
({ dispatch, store }) => {
|
|
129
|
+
const map = store.selectMap();
|
|
130
|
+
overlay.setPosition(undefined);
|
|
131
|
+
const el = overlay.getElement();
|
|
132
|
+
el.parentNode.removeChild(el);
|
|
133
|
+
map.removeOverlay(overlay);
|
|
134
|
+
dispatch({ type: "COORD_OVERLAY_REMOVED", payload: { overlay: null } });
|
|
135
|
+
},
|
|
136
|
+
doStartCoordCopy:
|
|
137
|
+
() =>
|
|
138
|
+
({ dispatch, store }) => {
|
|
139
|
+
const map = store.selectMap();
|
|
140
|
+
store.doSetCursor("crosshair");
|
|
141
|
+
|
|
142
|
+
//Parent container for coord copy.
|
|
143
|
+
const container = document.createElement("div");
|
|
144
|
+
container.id = "cm-copy-coords";
|
|
145
|
+
document.body.appendChild(container);
|
|
146
|
+
|
|
147
|
+
dispatch({
|
|
148
|
+
type: "COORD_COPY_ACTIVE",
|
|
149
|
+
payload: {
|
|
150
|
+
copyActive: true,
|
|
151
|
+
container: container,
|
|
152
|
+
notification: {
|
|
153
|
+
message: "Click on map to copy coordinates.",
|
|
154
|
+
level: "info",
|
|
155
|
+
},
|
|
199
156
|
},
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
//listen once for click event
|
|
160
|
+
map.once("singleclick", store.doCoordCopy);
|
|
161
|
+
},
|
|
162
|
+
doCoordCopy:
|
|
163
|
+
(e) =>
|
|
164
|
+
({ dispatch, store }) => {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
e.stopPropagation();
|
|
167
|
+
|
|
168
|
+
const copyContainer = store.selectCoordsContainer();
|
|
169
|
+
const displayProjection = store.selectDisplayProjection();
|
|
170
|
+
const coord = e.coordinate;
|
|
171
|
+
const projected = transform(coord, "EPSG:3857", displayProjection);
|
|
172
|
+
const x = Math.round(projected[0] * 10000) / 10000;
|
|
173
|
+
const y = Math.round(projected[1] * 10000) / 10000;
|
|
174
|
+
|
|
175
|
+
//Add temp input node to use execCommand.
|
|
176
|
+
const valueEl = document.createElement("input");
|
|
177
|
+
copyContainer.appendChild(valueEl);
|
|
178
|
+
valueEl.value = `${x}, ${y}`;
|
|
179
|
+
valueEl.select();
|
|
180
|
+
document.execCommand("copy");
|
|
181
|
+
|
|
182
|
+
store.doStopCoordCopy(x, y);
|
|
183
|
+
},
|
|
184
|
+
doStopCoordCopy:
|
|
185
|
+
(x, y) =>
|
|
186
|
+
({ dispatch, store }) => {
|
|
187
|
+
const copyContainer = store.selectCoordsContainer();
|
|
188
|
+
const msg = `Copied ${x}, ${y} to the clipboard.`;
|
|
189
|
+
store.doSetCursor("default");
|
|
208
190
|
|
|
209
|
-
if (isNaN(x) || isNaN(y)) {
|
|
210
191
|
dispatch({
|
|
211
|
-
type: "
|
|
192
|
+
type: "COORD_COPIED",
|
|
212
193
|
payload: {
|
|
194
|
+
copyActive: false,
|
|
195
|
+
container: null,
|
|
213
196
|
notification: {
|
|
214
197
|
title: "Coordinate Display",
|
|
215
|
-
message:
|
|
216
|
-
level: "
|
|
198
|
+
message: msg,
|
|
199
|
+
level: "info",
|
|
217
200
|
},
|
|
218
201
|
},
|
|
219
202
|
});
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
store.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
203
|
+
|
|
204
|
+
copyContainer.remove(); //remove dynamically created node.
|
|
205
|
+
store.doBasicToolbarDeactivate(); //close tool after copy.
|
|
206
|
+
},
|
|
207
|
+
doUpdateCoordInput:
|
|
208
|
+
(e, label) =>
|
|
209
|
+
({ dispatch, store }) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
const latLonInput = store.selectCoordsLatLonInput();
|
|
213
|
+
|
|
214
|
+
dispatch({
|
|
215
|
+
type: "COORD_INPUT_UPDATED",
|
|
216
|
+
payload: {
|
|
217
|
+
latLonInput: {
|
|
218
|
+
...latLonInput,
|
|
219
|
+
[`${label}`]: e.currentTarget.value,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
doCoordZoomTo:
|
|
225
|
+
() =>
|
|
226
|
+
({ dispatch, store }) => {
|
|
227
|
+
const latLonInput = store.selectCoordsLatLonInput();
|
|
228
|
+
const displayProjection = store.selectDisplayProjection();
|
|
229
|
+
const x = Number(latLonInput.X);
|
|
230
|
+
const y = Number(latLonInput.Y);
|
|
231
|
+
|
|
232
|
+
if (isNaN(x) || isNaN(y)) {
|
|
233
|
+
dispatch({
|
|
234
|
+
type: "COORD_INPUT_INVALID",
|
|
235
|
+
payload: {
|
|
236
|
+
notification: {
|
|
237
|
+
title: "Coordinate Display",
|
|
238
|
+
message: "Enter valid number.",
|
|
239
|
+
level: "danger",
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
} else {
|
|
244
|
+
const center = transform([x, y], displayProjection, "EPSG:3857");
|
|
245
|
+
store.doRenderCoordsOverlay(center, { x, y });
|
|
246
|
+
store.doZoomToLocation(center, 13);
|
|
247
|
+
store.doBasicToolbarDeactivate();
|
|
248
|
+
}
|
|
249
|
+
},
|
|
227
250
|
selectCoordsValues: (state) => {
|
|
228
251
|
return state.coordinateDisplay.values;
|
|
229
252
|
},
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { connect } from 'redux-bundler-react';
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class BasemapItem extends React.Component {
|
|
7
|
-
handleClick = () => {
|
|
8
|
-
const { idx, doChangeBasemap } = this.props;
|
|
9
|
-
doChangeBasemap(idx);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
render() {
|
|
13
|
-
const { active, basemap, basemapImages, theme } = this.props;
|
|
14
|
-
let tileurl = basemap.url.replace(/{[a-z]-[a-z]}/gi, "a");
|
|
15
|
-
tileurl = tileurl.replace("{z}", "12");
|
|
16
|
-
tileurl = tileurl.replace("{x}", "1206");
|
|
17
|
-
tileurl = tileurl.replace("{y}", "1539");
|
|
18
|
-
|
|
19
|
-
const itemClass = classnames({
|
|
20
|
-
"cm-list-group-item": true,
|
|
21
|
-
"pointer": true,
|
|
22
|
-
[theme]: active
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
let basemapUI = null;
|
|
26
|
-
//looking to set src.
|
|
27
|
-
basemapImages.every((imageID) =>{
|
|
28
|
-
if( basemap.id === imageID){
|
|
29
|
-
console.log(basemap.id)
|
|
30
|
-
basemapUI =
|
|
31
|
-
(<li onClick={this.handleClick} className={itemClass} title={basemap.name}>
|
|
32
|
-
<div className="overflow-ellipsis">
|
|
33
|
-
<img src={basemap.altImage} width="40" height="40" alt={`Basemap tile for ${basemap.name}`} />
|
|
34
|
-
<span style={{marginLeft:'10px'}}>{basemap.name}</span>
|
|
35
|
-
</div>
|
|
36
|
-
</li>)
|
|
37
|
-
return false
|
|
38
|
-
}else{
|
|
39
|
-
basemapUI = (
|
|
40
|
-
<li onClick={this.handleClick} className={itemClass} title={basemap.name}>
|
|
41
|
-
<div className="overflow-ellipsis">
|
|
42
|
-
<img src={tileurl} width="40" height="40" alt={`Basemap tile for ${basemap.name}`} />
|
|
43
|
-
<span style={{marginLeft:'10px'}}>{basemap.name}</span>
|
|
44
|
-
</div>
|
|
45
|
-
</li>
|
|
46
|
-
);
|
|
47
|
-
return true
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return basemapUI
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default connect(
|
|
55
|
-
'selectTheme',
|
|
56
|
-
'doChangeBasemap',
|
|
57
|
-
'selectBasemapImages',
|
|
58
|
-
BasemapItem
|
|
59
|
-
);
|