@corpsmap/corpsmap 3.2.96 → 3.2.98
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/dist/corpsmap.es.js +34436 -34129
- package/dist/corpsmap.umd.js +149 -149
- package/package.json +12 -2
- package/src/App.css +42 -0
- package/src/App.jsx +12 -0
- package/src/application-bundles/_create-container-bundle.js +102 -0
- package/src/application-bundles/api-bundle.js +76 -0
- package/src/application-bundles/basic-toolbar-bundle.js +57 -0
- package/src/application-bundles/config-bundle.js +38 -0
- package/src/application-bundles/create-ol-map-bundle.jsx +278 -0
- package/src/application-bundles/export-bundle.js +125 -0
- package/src/application-bundles/identify-bundle.js +119 -0
- package/src/application-bundles/index.js +53 -0
- package/src/application-bundles/map-basemap-bundle.js +73 -0
- package/src/application-bundles/map-core-bundle.js +25 -0
- package/src/application-bundles/map-drawing-bundle.js +120 -0
- package/src/application-bundles/map-interaction-bundle.js +50 -0
- package/src/application-bundles/map-layers-bundle.js +816 -0
- package/src/application-bundles/map-proj-bundle.js +144 -0
- package/src/application-bundles/map-view-bundle.jsx +334 -0
- package/src/application-bundles/modal-window-bundle.js +5 -0
- package/src/application-bundles/notification-bundle.js +56 -0
- package/src/application-bundles/plugin-bundle.js +180 -0
- package/src/application-bundles/primary-panel-bundle.js +85 -0
- package/src/application-bundles/search-bundle.js +122 -0
- package/src/application-bundles/south-region-bundle.js +96 -0
- package/src/application-bundles/theme-bundle.js +45 -0
- package/src/application-bundles/vertical-layout-bundle.js +88 -0
- package/src/application-bundles/viewport-bundle.js +43 -0
- package/src/application-bundles/window-location-bundle.js +90 -0
- package/src/application-bundles-old/auth-bundle.js +130 -0
- package/src/application-bundles-old/config-bundle.js +29 -0
- package/src/application-bundles-old/ui-bundle.js +406 -0
- package/src/application-containers/basic-toolbar.jsx +24 -0
- package/src/application-containers/corpsmap.jsx +91 -0
- package/src/application-containers/left-sidebar.jsx +43 -0
- package/src/application-containers/lower-right-toolbar.jsx +29 -0
- package/src/application-containers/map.jsx +57 -0
- package/src/application-containers/modal-window.jsx +34 -0
- package/src/application-containers/north-region.jsx +26 -0
- package/src/application-containers/notification-pane.jsx +37 -0
- package/src/application-containers/notification-quadrant.jsx +20 -0
- package/src/application-containers/notification.jsx +91 -0
- package/src/application-containers/primary-panel.jsx +94 -0
- package/src/application-containers/right-sidebar.jsx +44 -0
- package/src/application-containers/south-region-tab.jsx +60 -0
- package/src/application-containers/south-region.jsx +75 -0
- package/src/application-containers/upper-right-toolbar.jsx +28 -0
- package/src/application-controls/basic-toolbar-button.jsx +124 -0
- package/src/application-controls/basic-toolbar-menu-divider.jsx +11 -0
- package/src/application-controls/basic-toolbar-menu-item.jsx +91 -0
- package/src/application-controls/basic-toolbar-menu-up.jsx +13 -0
- package/src/application-controls/basic-toolbar-menu.jsx +13 -0
- package/src/application-controls/basic-toolbar-submenu.jsx +14 -0
- package/src/application-controls/index.jsx +35 -0
- package/src/application-controls/loading-indicator.jsx +19 -0
- package/src/application-controls/search-input.jsx +55 -0
- package/src/application-controls/search-results-list-item.jsx +50 -0
- package/src/application-controls/search-results-list.jsx +19 -0
- package/src/application-controls/sidebar-button.jsx +69 -0
- package/src/application-controls/sidebar-panel-opener.jsx +63 -0
- package/src/application-controls/tree-list-folder.jsx +46 -0
- package/src/application-controls/tree-list-item.jsx +83 -0
- package/src/application-controls/tree-list.jsx +35 -0
- package/src/application-controls/tree-view.jsx +42 -0
- package/src/application-exports/map-provider.jsx +122 -0
- package/src/assets/react.svg +1 -0
- package/src/config/default-config.js +593 -0
- package/src/core-plugins/add-data/add-data-button.jsx +34 -0
- package/src/core-plugins/add-data/add-geojson.jsx +47 -0
- package/src/core-plugins/add-data/add-kmlfile.jsx +46 -0
- package/src/core-plugins/add-data/add-shapefile.jsx +47 -0
- package/src/core-plugins/add-data/bundle.js +226 -0
- package/src/core-plugins/add-data/index.js +15 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-button.jsx +18 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-list-item.jsx +48 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-list.jsx +37 -0
- package/src/core-plugins/basemap-switcher/index.js +13 -0
- package/src/core-plugins/bookmarks/bookmark-button.jsx +18 -0
- package/src/core-plugins/bookmarks/bookmark-list-item.jsx +79 -0
- package/src/core-plugins/bookmarks/bookmark-list.jsx +31 -0
- package/src/core-plugins/bookmarks/bookmark-panel.jsx +191 -0
- package/src/core-plugins/bookmarks/bundle.js +92 -0
- package/src/core-plugins/bookmarks/index.js +15 -0
- package/src/core-plugins/catalog/bundle.js +109 -0
- package/src/core-plugins/catalog/catalog-button.jsx +33 -0
- package/src/core-plugins/catalog/catalog-error-item.jsx +14 -0
- package/src/core-plugins/catalog/catalog-list-item-loader.jsx +12 -0
- package/src/core-plugins/catalog/catalog-list-item.jsx +118 -0
- package/src/core-plugins/catalog/catalog-list.jsx +78 -0
- package/src/core-plugins/catalog/catalog-modal-window.jsx +100 -0
- package/src/core-plugins/catalog/index.js +15 -0
- package/src/core-plugins/change-log/bundle.js +180 -0
- package/src/core-plugins/change-log/change-log-button.jsx +40 -0
- package/src/core-plugins/change-log/change-log-modal.jsx +190 -0
- package/src/core-plugins/change-log/index.js +15 -0
- package/src/core-plugins/change-log/select-district.jsx +73 -0
- package/src/core-plugins/contact-form/bundle.js +239 -0
- package/src/core-plugins/contact-form/index.js +17 -0
- package/src/core-plugins/contact-form/question-button.jsx +36 -0
- package/src/core-plugins/contact-form/question-modal.jsx +215 -0
- package/src/core-plugins/coordinate-display/bundle.jsx +269 -0
- package/src/core-plugins/coordinate-display/coordinate-display-bar.jsx +66 -0
- package/src/core-plugins/coordinate-display/coordinate-display-proj-item.jsx +60 -0
- package/src/core-plugins/coordinate-display/coordinate-display-settings.jsx +173 -0
- package/src/core-plugins/coordinate-display/coordinate-interaction-bar.jsx +60 -0
- package/src/core-plugins/coordinate-display/coordinate-lat-lon-input.jsx +35 -0
- package/src/core-plugins/coordinate-display/coordinate-popup.jsx +27 -0
- package/src/core-plugins/coordinate-display/index.js +20 -0
- package/src/core-plugins/draw-tools/create-draw-bundle.js +242 -0
- package/src/core-plugins/draw-tools/draw-button.jsx +204 -0
- package/src/core-plugins/draw-tools/draw-label-bundle.js +116 -0
- package/src/core-plugins/draw-tools/draw-modify-bundle.js +156 -0
- package/src/core-plugins/draw-tools/draw-save-bundle.jsx +181 -0
- package/src/core-plugins/draw-tools/draw-styles.js +110 -0
- package/src/core-plugins/draw-tools/draw-tool-item.jsx +67 -0
- package/src/core-plugins/draw-tools/index.js +34 -0
- package/src/core-plugins/draw-tools-old/create-draw-bundle.js +222 -0
- package/src/core-plugins/draw-tools-old/draw-button.js +189 -0
- package/src/core-plugins/draw-tools-old/draw-label-bundle.js +116 -0
- package/src/core-plugins/draw-tools-old/draw-modify-bundle.js +156 -0
- package/src/core-plugins/draw-tools-old/draw-styles.js +110 -0
- package/src/core-plugins/draw-tools-old/draw-tool-item.js +67 -0
- package/src/core-plugins/draw-tools-old/index.js +32 -0
- package/src/core-plugins/editor/bundle.js +472 -0
- package/src/core-plugins/editor/date-editor.js +63 -0
- package/src/core-plugins/editor/date-formatter.js +17 -0
- package/src/core-plugins/editor/editor-base.js +29 -0
- package/src/core-plugins/editor/editor-button.js +224 -0
- package/src/core-plugins/editor/editor-table.js +151 -0
- package/src/core-plugins/editor/index.js +15 -0
- package/src/core-plugins/editor/number-editor.js +57 -0
- package/src/core-plugins/editor/string-editor.js +42 -0
- package/src/core-plugins/geocoder/bundle.jsx +186 -0
- package/src/core-plugins/geocoder/index.js +15 -0
- package/src/core-plugins/geocoder/overlay.jsx +30 -0
- package/src/core-plugins/geocoder/search-bar.js copy.save +123 -0
- package/src/core-plugins/geocoder/search-bar.jsx +121 -0
- package/src/core-plugins/identify/bundle.jsx +709 -0
- package/src/core-plugins/identify/identify-buffer-section.jsx +52 -0
- package/src/core-plugins/identify/identify-buffer-settings.jsx +48 -0
- package/src/core-plugins/identify/identify-button.jsx +100 -0
- package/src/core-plugins/identify/identify-details-table.jsx +121 -0
- package/src/core-plugins/identify/identify-details.js +69 -0
- package/src/core-plugins/identify/identify-popup.jsx +136 -0
- package/src/core-plugins/identify/identify-sidebar-list-item.jsx +106 -0
- package/src/core-plugins/identify/identify-sidebar-list.jsx +63 -0
- package/src/core-plugins/identify/identify-sidebar.jsx +103 -0
- package/src/core-plugins/identify/identify-table-cell.jsx +49 -0
- package/src/core-plugins/identify/identify-table.jsx +319 -0
- package/src/core-plugins/identify/index.js +27 -0
- package/src/core-plugins/identify/listeners/arcgis.js +158 -0
- package/src/core-plugins/identify/listeners/geojson.jsx +164 -0
- package/src/core-plugins/identify/listeners/raster.js +89 -0
- package/src/core-plugins/identify/listeners/vector.jsx +106 -0
- package/src/core-plugins/identify-arcgis-rest/bundle.js +169 -0
- package/src/core-plugins/identify-arcgis-rest/index.js +10 -0
- package/src/core-plugins/identify-cm/bundle.js +82 -0
- package/src/core-plugins/identify-cm/index.js +10 -0
- package/src/core-plugins/identify-geojson/bundle.js +164 -0
- package/src/core-plugins/identify-geojson/index.js +10 -0
- package/src/core-plugins/identify-raster/bundle.js +89 -0
- package/src/core-plugins/identify-raster/index.js +10 -0
- package/src/core-plugins/identify-vector/bundle.jsx +135 -0
- package/src/core-plugins/identify-vector/index.js +10 -0
- package/src/core-plugins/identify-wms/bundle.js +138 -0
- package/src/core-plugins/identify-wms/index.js +10 -0
- package/src/core-plugins/legend/bundle.js +1044 -0
- package/src/core-plugins/legend/index.js +17 -0
- package/src/core-plugins/legend/legend-button.jsx +18 -0
- package/src/core-plugins/legend/legend-header.jsx +43 -0
- package/src/core-plugins/legend/legend-item-multiple.jsx +32 -0
- package/src/core-plugins/legend/legend-item.jsx +20 -0
- package/src/core-plugins/legend/legend-panel.jsx +73 -0
- package/src/core-plugins/login/index.js +13 -0
- package/src/core-plugins/login/login-button.jsx +49 -0
- package/src/core-plugins/map-loading-indicator/bundle.js +31 -0
- package/src/core-plugins/map-loading-indicator/index.js +17 -0
- package/src/core-plugins/map-loading-indicator/loading-indicator.jsx +30 -0
- package/src/core-plugins/measure-tools/bundle.js +286 -0
- package/src/core-plugins/measure-tools/index.js +15 -0
- package/src/core-plugins/measure-tools/measure-options.jsx +89 -0
- package/src/core-plugins/measure-tools/measure-tools-button.jsx +129 -0
- package/src/core-plugins/measure-tools/measure-utils.js +76 -0
- package/src/core-plugins/permalink/bundle.js +57 -0
- package/src/core-plugins/permalink/index.js +15 -0
- package/src/core-plugins/permalink/permalink-button.jsx +38 -0
- package/src/core-plugins/permalink/permalink-modal.jsx +67 -0
- package/src/core-plugins/print-map/bundle.jsx +316 -0
- package/src/core-plugins/print-map/button.jsx +17 -0
- package/src/core-plugins/print-map/index.js +17 -0
- package/src/core-plugins/resources/bundle.js +96 -0
- package/src/core-plugins/resources/index.js +15 -0
- package/src/core-plugins/resources/resources-button.jsx +40 -0
- package/src/core-plugins/resources/resources-modal.jsx +151 -0
- package/src/core-plugins/rotate-north/index.js +13 -0
- package/src/core-plugins/rotate-north/rotate-north-button.jsx +38 -0
- package/src/core-plugins/theme-switcher/bundle.js +16 -0
- package/src/core-plugins/theme-switcher/index.js +15 -0
- package/src/core-plugins/theme-switcher/theme-list-item.jsx +25 -0
- package/src/core-plugins/theme-switcher/theme-list.jsx +28 -0
- package/src/core-plugins/theme-switcher/theme-switcher-button.jsx +18 -0
- package/src/core-plugins/theme-switcher/themes.js +121 -0
- package/src/core-plugins/three-d/index.js +13 -0
- package/src/core-plugins/three-d/three-d-button.jsx +44 -0
- package/src/core-plugins/tree-view/boundary-drop-target.jsx +42 -0
- package/src/core-plugins/tree-view/bundle.js +513 -0
- package/src/core-plugins/tree-view/dataset-info-modal.jsx +141 -0
- package/src/core-plugins/tree-view/dataset-legend.jsx +122 -0
- package/src/core-plugins/tree-view/defaults-container.jsx +27 -0
- package/src/core-plugins/tree-view/download-bundle.js +156 -0
- package/src/core-plugins/tree-view/favorites-container.jsx +27 -0
- package/src/core-plugins/tree-view/index.js +25 -0
- package/src/core-plugins/tree-view/layer-subpanel/defaults-toggle.jsx +28 -0
- package/src/core-plugins/tree-view/layer-subpanel/download-layer.jsx +54 -0
- package/src/core-plugins/tree-view/layer-subpanel/favorites-toggle.jsx +28 -0
- package/src/core-plugins/tree-view/layer-subpanel/label-toggle.jsx +39 -0
- package/src/core-plugins/tree-view/layer-subpanel/layer-subpanel.jsx +179 -0
- package/src/core-plugins/tree-view/layer-subpanel/natick-rgb-options.jsx +66 -0
- package/src/core-plugins/tree-view/layer-subpanel/natick-rgb.jsx +112 -0
- package/src/core-plugins/tree-view/layer-subpanel/opacity-slider.jsx +51 -0
- package/src/core-plugins/tree-view/layer-subpanel/remove-layer.jsx +75 -0
- package/src/core-plugins/tree-view/tree-list-container.jsx +22 -0
- package/src/core-plugins/tree-view/tree-list-item-dataset.jsx +174 -0
- package/src/core-plugins/tree-view/tree-list-item-folder.jsx +161 -0
- package/src/core-plugins/tree-view/tree-list-item.jsx +35 -0
- package/src/core-plugins/tree-view/tree-list.jsx +37 -0
- package/src/core-plugins/tree-view/tree-view-button.jsx +18 -0
- package/src/core-plugins/tree-view/tree-view-panel.jsx +139 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/add-all.jsx +28 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/defaults.jsx +40 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/favorites.jsx +40 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/remove-all.jsx +28 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/toggle-expand.jsx +47 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/toggle-filter.jsx +39 -0
- package/src/core-plugins/vector-search/bundle.js +96 -0
- package/src/core-plugins/vector-search/index.js +10 -0
- package/src/core-plugins/zoom-home/bundle.js +77 -0
- package/src/core-plugins/zoom-home/index.js +19 -0
- package/src/core-plugins/zoom-home/zoom-home-button.jsx +57 -0
- package/src/core-plugins/zoom-in-out/index.js +23 -0
- package/src/core-plugins/zoom-in-out/zoom-in-button.jsx +28 -0
- package/src/core-plugins/zoom-in-out/zoom-out-button.jsx +28 -0
- package/src/core-plugins/zoom-level/bundle.js +35 -0
- package/src/core-plugins/zoom-level/index.js +17 -0
- package/src/core-plugins/zoom-level/zoom-indicator.jsx +34 -0
- package/src/core-plugins/zoom-to-box/bundle.js +80 -0
- package/src/core-plugins/zoom-to-box/index.jsx +15 -0
- package/src/core-plugins/zoom-to-box/zoom-to-box-button.jsx +53 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-paper.css +7606 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-paper.min.css +8083 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-simplex.min.css +7328 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css +587 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css.map +1 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css +6 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css.map +1 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.css +7137 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.css.map +142 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.min.css +7132 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.min.css.map +143 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/src/css/_deprecated_bootstrap/js/bootstrap.js +2377 -0
- package/src/css/_deprecated_bootstrap/js/bootstrap.min.js +7 -0
- package/src/css/_deprecated_bootstrap/js/npm.js +13 -0
- package/src/css/_deprecated_maki/css/maki.css +304 -0
- package/src/css/_deprecated_maki/fonts/maki.eot +0 -0
- package/src/css/_deprecated_maki/fonts/maki.svg +98 -0
- package/src/css/_deprecated_maki/fonts/maki.ttf +0 -0
- package/src/css/_deprecated_maki/fonts/maki.woff +0 -0
- package/src/css/bg-colors.css +121 -0
- package/src/css/cm-icons/css/cm-icons.css +90 -0
- package/src/css/cm-icons/fonts/cm.eot +0 -0
- package/src/css/cm-icons/fonts/cm.svg +27 -0
- package/src/css/cm-icons/fonts/cm.ttf +0 -0
- package/src/css/cm-icons/fonts/cm.woff +0 -0
- package/src/css/corpsmap-namespaced.css +9505 -0
- package/src/css/corpsmap.css +10178 -0
- package/src/css/loading-indicator.css +109 -0
- package/src/css/mapskin/OFL.txt +94 -0
- package/src/css/mapskin/css/mapskin.css +815 -0
- package/src/css/mapskin/css/mapskin.min.css +8 -0
- package/src/css/mapskin/fonts/mapskin.eot +0 -0
- package/src/css/mapskin/fonts/mapskin.svg +282 -0
- package/src/css/mapskin/fonts/mapskin.ttf +0 -0
- package/src/css/mapskin/fonts/mapskin.woff +0 -0
- package/src/css/mdi/.github/ISSUE_TEMPLATE.md +3 -0
- package/src/css/mdi/README.md +24 -0
- package/src/css/mdi/bower.json +22 -0
- package/src/css/mdi/css/materialdesignicons.css +18654 -0
- package/src/css/mdi/css/materialdesignicons.css.map +16 -0
- package/src/css/mdi/css/materialdesignicons.min.css +3 -0
- package/src/css/mdi/css/materialdesignicons.min.css.map +16 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.eot +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.ttf +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.woff +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.woff2 +0 -0
- package/src/css/mdi/license.md +97 -0
- package/src/css/mdi/package.json +37 -0
- package/src/css/mdi/preview.html +717 -0
- package/src/css/mdi/scss/_animated.scss +27 -0
- package/src/css/mdi/scss/_core.scss +10 -0
- package/src/css/mdi/scss/_extras.scss +65 -0
- package/src/css/mdi/scss/_functions.scss +20 -0
- package/src/css/mdi/scss/_icons.scss +10 -0
- package/src/css/mdi/scss/_path.scss +10 -0
- package/src/css/mdi/scss/_variables.scss +4606 -0
- package/src/css/mdi/scss/materialdesignicons.scss +8 -0
- package/src/css/navigation.css +174 -0
- package/src/css/parse-css.js +26 -0
- package/src/css/reset.css +48 -0
- package/src/index.css +68 -0
- package/src/index.jsx +113 -0
- package/src/main.jsx +3 -0
- package/src/openlayers-utils/format-utilities.js +178 -0
- package/src/openlayers-utils/interaction-creator.js +31 -0
- package/src/openlayers-utils/layer-utilities.js +309 -0
- package/src/openlayers-utils/map-utils.js +25 -0
- package/src/openlayers-utils/resource-utilities.js +38 -0
- package/src/openlayers-utils/vector-style.js +131 -0
- package/src/utils/cache.js +6 -0
- package/src/utils/check-webgl.js +6 -0
- package/src/utils/error-boundary.js +26 -0
- package/src/utils/load-plugins.js +32 -0
- package/src/utils/load-plugins.test.js +36 -0
- package/src/utils/plugin-region.jsx +26 -0
- package/src/utils/redux-bundler-react.jsx +69 -0
- package/src/utils/scale-to-zoom-level.js +37 -0
- package/src/utils/vector-styles.js +7 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
import { getLayer } from "../openlayers-utils/layer-utilities";
|
|
2
|
+
// import v4 from "uuid/v4";
|
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
|
4
|
+
import { createSelector } from "redux-bundler";
|
|
5
|
+
import scaleToMapZoom from "../utils/scale-to-zoom-level";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Private methods basically
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const createNode = (options, map) => {
|
|
12
|
+
if (!options.type) options.type = options.serviceType || "Folder";
|
|
13
|
+
|
|
14
|
+
if (!options.uid) options.uid = uuidv4();
|
|
15
|
+
|
|
16
|
+
if (!options.minzoom) options.minzoom = scaleToMapZoom(options.maxscale, 0);
|
|
17
|
+
if (!options.maxzoom) options.maxzoom = scaleToMapZoom(options.minscale, 20);
|
|
18
|
+
|
|
19
|
+
const node = {
|
|
20
|
+
id: options.id,
|
|
21
|
+
teamDatasetId: options.teamDatasetId,
|
|
22
|
+
uid: options.uid,
|
|
23
|
+
parent: null,
|
|
24
|
+
children: [],
|
|
25
|
+
root: options.root || false,
|
|
26
|
+
leaf: options.type !== "Folder",
|
|
27
|
+
collapsed: options.collapsed || true,
|
|
28
|
+
visible: options.visible || false,
|
|
29
|
+
sortOrder: options.layerOrder || 0,
|
|
30
|
+
displayName: options.displayName,
|
|
31
|
+
type: options.type,
|
|
32
|
+
geometryType: options.geometryType,
|
|
33
|
+
layerList: options.layerList,
|
|
34
|
+
mapLayer:
|
|
35
|
+
options.type !== "Folder"
|
|
36
|
+
? options.mapLayer || getLayer(options, null, map)
|
|
37
|
+
: null,
|
|
38
|
+
labelsOn: options.labelsOn ? options.labelsOn : !!options.labelDefault,
|
|
39
|
+
labelDefault: !!options.labelDefault,
|
|
40
|
+
labelEnabled: !!options.labelEnabled,
|
|
41
|
+
url: options.url,
|
|
42
|
+
info: options.info,
|
|
43
|
+
identifyType: options.identifyType,
|
|
44
|
+
identifyFields: options.identifyFields,
|
|
45
|
+
identifyRenameColums: options.identifyRenameColums,
|
|
46
|
+
identifyFormatColumns: options.identifyFormatColumns,
|
|
47
|
+
legend: options.legend,
|
|
48
|
+
legendOverride: !!options.legendOverride,
|
|
49
|
+
passFilter: true,
|
|
50
|
+
zoomTo: !!options.zoomTo,
|
|
51
|
+
minzoom: options.minzoom,
|
|
52
|
+
maxzoom: options.maxzoom,
|
|
53
|
+
styleFn: options.styleFn,
|
|
54
|
+
favorite: false,
|
|
55
|
+
userDefaultLayer: false,
|
|
56
|
+
selectAllLayers: options.selectAllLayers,
|
|
57
|
+
layerDescription: options.layerDescription,
|
|
58
|
+
attributions: options.attributions,
|
|
59
|
+
moreInfo: options.moreInfo,
|
|
60
|
+
resourceDownload: options.resourceDownload,
|
|
61
|
+
hoverText: options.hoverText,
|
|
62
|
+
folderHoverText: options.folderHoverText,
|
|
63
|
+
folderURL: options.folderURL,
|
|
64
|
+
groupTag: options.groupTag,
|
|
65
|
+
layerFunction: options.layerFunction,
|
|
66
|
+
layerParams: options.layerParams,
|
|
67
|
+
};
|
|
68
|
+
return node;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const isParentOf = (queryNode, destNode) => {
|
|
72
|
+
let ancestors = [];
|
|
73
|
+
function familyTree(node) {
|
|
74
|
+
if (node.parent) {
|
|
75
|
+
ancestors.push(node.parent);
|
|
76
|
+
familyTree(node.parent);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
familyTree(destNode);
|
|
80
|
+
return ancestors.indexOf(queryNode) !== -1;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const removeFromParent = (node) => {
|
|
84
|
+
const parent = node.parent;
|
|
85
|
+
const idx = parent.children.indexOf(node);
|
|
86
|
+
parent.children.splice(idx, 1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const insertNodeAt = (node, parent, idx) => {
|
|
90
|
+
node.parent = parent;
|
|
91
|
+
parent.children.splice(idx, 0, node);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Start store bundle config
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
defaultParentUid: null,
|
|
100
|
+
name: "layers",
|
|
101
|
+
|
|
102
|
+
getReducer() {
|
|
103
|
+
const initialData = {
|
|
104
|
+
appTime: null,
|
|
105
|
+
layers: {},
|
|
106
|
+
idMap: {},
|
|
107
|
+
resetNeeded: false,
|
|
108
|
+
filterString: "",
|
|
109
|
+
showFilter: false,
|
|
110
|
+
favoriteLayers: [],
|
|
111
|
+
userDefaultLayers: [],
|
|
112
|
+
overrideSortLayerOrder: false,
|
|
113
|
+
sortOrderStatus: false,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return (state = initialData, { type, payload }) => {
|
|
117
|
+
if (type === "LAYERS_LIST_UPDATED") {
|
|
118
|
+
return Object.assign({}, state, {
|
|
119
|
+
appTime: new Date(),
|
|
120
|
+
layers: payload,
|
|
121
|
+
resetNeeded: true,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (type === "LAYERS_IDMAP_UPDATED") {
|
|
126
|
+
return Object.assign({}, state, {
|
|
127
|
+
appTime: new Date(),
|
|
128
|
+
idMap: payload,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (type === "LAYERS_ORDER_UPDATED") {
|
|
133
|
+
return Object.assign({}, state, {
|
|
134
|
+
resetNeeded: false,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (type === "LAYERS_ORDER_OVERRIDE_SORT_ORDER") {
|
|
139
|
+
return Object.assign({}, state, payload);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (type === "LAYERS_TOGGLE_FILTER") {
|
|
143
|
+
return Object.assign({}, state, payload);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (type === "LAYERS_FILTER_CHANGED") {
|
|
147
|
+
return Object.assign({}, state, payload);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (type === "LAYERS_FAVORITES_LIST_UPDATED") {
|
|
151
|
+
return Object.assign({}, state, payload);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (type === "LAYERS_USER_DEFAULT_LAYERS_LIST_UPDATED") {
|
|
155
|
+
return Object.assign({}, state, payload);
|
|
156
|
+
}
|
|
157
|
+
if (type === "SORT_ORDER_NOW_SHOWING") {
|
|
158
|
+
return Object.assign({}, state, payload);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return state;
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
doLayersToggleFilter:
|
|
166
|
+
(showFilter) =>
|
|
167
|
+
({ dispatch }) => {
|
|
168
|
+
dispatch({
|
|
169
|
+
type: "LAYERS_TOGGLE_FILTER",
|
|
170
|
+
payload: {
|
|
171
|
+
showFilter: showFilter,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
doLayersUpdateFilter:
|
|
177
|
+
(filterString) =>
|
|
178
|
+
({ dispatch, store }) => {
|
|
179
|
+
const layers = store.selectLayers();
|
|
180
|
+
//const filter = new RegExp(filterString, "ig");
|
|
181
|
+
|
|
182
|
+
function matchDownstream(n) {
|
|
183
|
+
n.passFilter = true;
|
|
184
|
+
if (n.children && n.children.length) {
|
|
185
|
+
n.children.forEach(matchDownstream);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function matchUpstream(n) {
|
|
190
|
+
n.passFilter = true;
|
|
191
|
+
if (!!filterString) n.collapsed = false;
|
|
192
|
+
if (n.parent) {
|
|
193
|
+
matchUpstream(n.parent);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
Object.keys(layers).forEach((uid) => {
|
|
198
|
+
const lyr = layers[uid];
|
|
199
|
+
lyr.passFilter = false;
|
|
200
|
+
const hasString =
|
|
201
|
+
lyr.displayName.toUpperCase().indexOf(filterString.toUpperCase()) !==
|
|
202
|
+
-1;
|
|
203
|
+
|
|
204
|
+
if (lyr.groupTag && lyr.groupTag.length > 0) {
|
|
205
|
+
lyr.groupTag.forEach((tag) => {
|
|
206
|
+
const hasTag =
|
|
207
|
+
tag &&
|
|
208
|
+
tag.toUpperCase().indexOf(filterString.toUpperCase()) !== -1;
|
|
209
|
+
if (hasTag) {
|
|
210
|
+
lyr.passFilter = true;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (hasString) {
|
|
216
|
+
lyr.passFilter = true;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
Object.keys(layers).forEach((uid) => {
|
|
221
|
+
const lyr = layers[uid];
|
|
222
|
+
if (lyr.passFilter) {
|
|
223
|
+
matchDownstream(lyr);
|
|
224
|
+
matchUpstream(lyr);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
console.log("filtered layers", layers);
|
|
228
|
+
|
|
229
|
+
dispatch({
|
|
230
|
+
type: "LAYERS_FILTER_CHANGED",
|
|
231
|
+
payload: {
|
|
232
|
+
filterString: filterString,
|
|
233
|
+
layers: Object.assign({}, layers),
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
doAddLayer:
|
|
239
|
+
(options) =>
|
|
240
|
+
({ dispatch, store }) => {
|
|
241
|
+
const layers = store.selectLayers();
|
|
242
|
+
const idMap = store.selectIdMap();
|
|
243
|
+
const map = store.selectMap();
|
|
244
|
+
|
|
245
|
+
const node = createNode(options, map);
|
|
246
|
+
|
|
247
|
+
if (options.id) {
|
|
248
|
+
const newIdMap = Object.assign({}, idMap, {
|
|
249
|
+
[options.id]: node.uid,
|
|
250
|
+
});
|
|
251
|
+
dispatch({ type: "LAYERS_IDMAP_UPDATED", payload: newIdMap });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (options.parentUid) {
|
|
255
|
+
const parent = layers[options.parentUid];
|
|
256
|
+
node.parent = parent;
|
|
257
|
+
parent.children.push(node);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (node.mapLayer) {
|
|
261
|
+
map.addLayer(node.mapLayer);
|
|
262
|
+
console.log("tried to add layer with zoomto = ", node.zoomTo);
|
|
263
|
+
if (node.zoomTo) {
|
|
264
|
+
const src = node.mapLayer.getSource();
|
|
265
|
+
map.getView().fit(src.getExtent());
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const newLayers = Object.assign({}, layers, {
|
|
270
|
+
[node.uid]: node,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
dispatch({ type: "LAYERS_LIST_UPDATED", payload: newLayers });
|
|
274
|
+
},
|
|
275
|
+
doActivateUserDefaultLayers:
|
|
276
|
+
() =>
|
|
277
|
+
({ dispatch, store }) => {
|
|
278
|
+
const userDefaultLayers = store.selectUserDefaultLayers();
|
|
279
|
+
const layers = store.selectLayers();
|
|
280
|
+
userDefaultLayers.forEach((lyr) => {
|
|
281
|
+
const node = layers[lyr.uid];
|
|
282
|
+
if (node && node.mapLayer) {
|
|
283
|
+
node.visible = true;
|
|
284
|
+
node.mapLayer.setVisible(true);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
dispatch({
|
|
289
|
+
type: "LAYERS_LIST_UPDATED",
|
|
290
|
+
payload: Object.assign({}, layers),
|
|
291
|
+
});
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
doAddLayersBulk:
|
|
295
|
+
(optionsCollection) =>
|
|
296
|
+
({ dispatch, store }) => {
|
|
297
|
+
const root = store.selectTreeRootNode();
|
|
298
|
+
const layers = store.selectLayers();
|
|
299
|
+
const idMap = store.selectIdMap();
|
|
300
|
+
const map = store.selectMap();
|
|
301
|
+
|
|
302
|
+
for (var i = 0; i < optionsCollection.length; i++) {
|
|
303
|
+
const options = optionsCollection[i];
|
|
304
|
+
if (!options || !options.id) break;
|
|
305
|
+
const node = createNode(options, map);
|
|
306
|
+
idMap[options.id] = node.uid;
|
|
307
|
+
layers[node.uid] = node;
|
|
308
|
+
|
|
309
|
+
if (node.mapLayer && map) {
|
|
310
|
+
map.addLayer(node.mapLayer);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
dispatch({
|
|
314
|
+
type: "LAYERS_IDMAP_UPDATED",
|
|
315
|
+
payload: Object.assign({}, idMap),
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
for (var i = 0; i < optionsCollection.length; i++) {
|
|
319
|
+
const options = optionsCollection[i];
|
|
320
|
+
if (!options || !options.id) break;
|
|
321
|
+
let node = layers[idMap[options.id]];
|
|
322
|
+
let parent;
|
|
323
|
+
if (!options.parentId) {
|
|
324
|
+
parent = root;
|
|
325
|
+
} else {
|
|
326
|
+
parent = layers[idMap[options.parentId]];
|
|
327
|
+
}
|
|
328
|
+
if (parent && parent.hasOwnProperty("uid")) {
|
|
329
|
+
node.parent = parent;
|
|
330
|
+
parent.children.push(node);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
dispatch({
|
|
335
|
+
type: "LAYERS_LIST_UPDATED",
|
|
336
|
+
payload: Object.assign({}, layers),
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
doTreeInsertAfter:
|
|
341
|
+
(nodeId, destId) =>
|
|
342
|
+
({ dispatch, store }) => {
|
|
343
|
+
const layers = store.selectLayers();
|
|
344
|
+
const node = layers[nodeId];
|
|
345
|
+
const destNode = layers[destId];
|
|
346
|
+
if (!isParentOf(node, destNode)) {
|
|
347
|
+
removeFromParent(node);
|
|
348
|
+
const parent = destNode.parent;
|
|
349
|
+
const idx = parent.children.indexOf(destNode) + 1;
|
|
350
|
+
insertNodeAt(node, parent, idx);
|
|
351
|
+
}
|
|
352
|
+
dispatch({
|
|
353
|
+
type: "LAYERS_LIST_UPDATED",
|
|
354
|
+
payload: Object.assign({}, layers),
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
doTreeInsertBefore:
|
|
359
|
+
(nodeId, destId) =>
|
|
360
|
+
({ dispatch, store }) => {
|
|
361
|
+
const layers = store.selectLayers();
|
|
362
|
+
const node = layers[nodeId];
|
|
363
|
+
const destNode = layers[destId];
|
|
364
|
+
if (!isParentOf(node, destNode)) {
|
|
365
|
+
removeFromParent(node);
|
|
366
|
+
const parent = destNode.parent;
|
|
367
|
+
const idx = parent.children.indexOf(destNode);
|
|
368
|
+
insertNodeAt(node, parent, idx);
|
|
369
|
+
}
|
|
370
|
+
dispatch({
|
|
371
|
+
type: "LAYERS_LIST_UPDATED",
|
|
372
|
+
payload: Object.assign({}, layers),
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
doTreeInsertChild:
|
|
377
|
+
(nodeId, destId) =>
|
|
378
|
+
({ dispatch, store }) => {
|
|
379
|
+
const layers = store.selectLayers();
|
|
380
|
+
const node = layers[nodeId];
|
|
381
|
+
const destNode = layers[destId];
|
|
382
|
+
if (!isParentOf(node, destNode)) {
|
|
383
|
+
removeFromParent(node);
|
|
384
|
+
const parent = destNode;
|
|
385
|
+
insertNodeAt(node, parent, parent.children.length);
|
|
386
|
+
}
|
|
387
|
+
dispatch({
|
|
388
|
+
type: "LAYERS_LIST_UPDATED",
|
|
389
|
+
payload: Object.assign({}, layers),
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
doTreeMerge:
|
|
394
|
+
(nodeId, destId) =>
|
|
395
|
+
({ dispatch, store }) => {
|
|
396
|
+
const layers = store.selectLayers();
|
|
397
|
+
const node = layers[nodeId];
|
|
398
|
+
const destNode = layers[destId];
|
|
399
|
+
|
|
400
|
+
if (!isParentOf(node, destNode)) {
|
|
401
|
+
const parent = destNode.parent;
|
|
402
|
+
const idx = parent.children.indexOf(destNode);
|
|
403
|
+
|
|
404
|
+
removeFromParent(node);
|
|
405
|
+
|
|
406
|
+
const newFolder = createNode(
|
|
407
|
+
{
|
|
408
|
+
root: false,
|
|
409
|
+
leaf: false,
|
|
410
|
+
teamDatasetId: null,
|
|
411
|
+
collapsed: false,
|
|
412
|
+
visible: false,
|
|
413
|
+
sortOrder: 0,
|
|
414
|
+
displayName: "New Folder",
|
|
415
|
+
type: "Folder",
|
|
416
|
+
},
|
|
417
|
+
map
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
node.parent = newFolder;
|
|
421
|
+
destNode.parent = newFolder;
|
|
422
|
+
|
|
423
|
+
newFolder.children.push(destNode);
|
|
424
|
+
newFolder.children.push(node);
|
|
425
|
+
newFolder.parent = parent;
|
|
426
|
+
parent.children.splice(idx, 1, newFolder);
|
|
427
|
+
}
|
|
428
|
+
dispatch({
|
|
429
|
+
type: "LAYERS_LIST_UPDATED",
|
|
430
|
+
payload: Object.assign({}, layers),
|
|
431
|
+
});
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
doTreeRemove:
|
|
435
|
+
(nodeId) =>
|
|
436
|
+
({ dispatch, store }) => {
|
|
437
|
+
const map = store.selectMap();
|
|
438
|
+
const layers = store.selectLayers();
|
|
439
|
+
const node = layers[nodeId];
|
|
440
|
+
function rm(n) {
|
|
441
|
+
if (n) {
|
|
442
|
+
if (n.children && n.children.length) {
|
|
443
|
+
n.children.forEach(function (c) {
|
|
444
|
+
rm(c);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
if (n.mapLayer) {
|
|
448
|
+
map.removeLayer(n.mapLayer);
|
|
449
|
+
}
|
|
450
|
+
removeFromParent(n);
|
|
451
|
+
delete layers[n.uid];
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
rm(node);
|
|
455
|
+
dispatch({
|
|
456
|
+
type: "LAYERS_LIST_UPDATED",
|
|
457
|
+
payload: Object.assign({}, layers),
|
|
458
|
+
});
|
|
459
|
+
dispatch({ type: "LAYER_REMOVED", payload: { uid: nodeId } });
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
doTreeUpdate:
|
|
463
|
+
(nodeId, updateObj) =>
|
|
464
|
+
({ dispatch, store }) => {
|
|
465
|
+
const layers = store.selectLayers();
|
|
466
|
+
const node = layers[nodeId];
|
|
467
|
+
Object.keys(updateObj).forEach((key) => {
|
|
468
|
+
if (key !== "uid") {
|
|
469
|
+
node[key] = updateObj[key];
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
dispatch({
|
|
473
|
+
type: "LAYERS_LIST_UPDATED",
|
|
474
|
+
payload: Object.assign({}, layers),
|
|
475
|
+
});
|
|
476
|
+
},
|
|
477
|
+
|
|
478
|
+
doTreeSetCollapsedAll:
|
|
479
|
+
(nodeId, collapsed) =>
|
|
480
|
+
({ dispatch, store }) => {
|
|
481
|
+
const layers = store.selectLayers();
|
|
482
|
+
const node = layers[nodeId];
|
|
483
|
+
function setCollapsedDownstream(n) {
|
|
484
|
+
n.collapsed = collapsed;
|
|
485
|
+
if (n.children.length > 0) {
|
|
486
|
+
n.children.forEach(setCollapsedDownstream);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
setCollapsedDownstream(node);
|
|
490
|
+
dispatch({
|
|
491
|
+
type: "LAYERS_LIST_UPDATED",
|
|
492
|
+
payload: Object.assign({}, layers),
|
|
493
|
+
});
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
doTreeSetCollapsed:
|
|
497
|
+
(nodeId, collapsed) =>
|
|
498
|
+
({ dispatch, store }) => {
|
|
499
|
+
const layers = store.selectLayers();
|
|
500
|
+
const node = layers[nodeId];
|
|
501
|
+
node.collapsed = collapsed;
|
|
502
|
+
dispatch({
|
|
503
|
+
type: "LAYERS_LIST_UPDATED",
|
|
504
|
+
payload: Object.assign({}, layers),
|
|
505
|
+
});
|
|
506
|
+
},
|
|
507
|
+
|
|
508
|
+
doTreeSetVisibleAll:
|
|
509
|
+
(nodeId, visible) =>
|
|
510
|
+
({ dispatch, store }) => {
|
|
511
|
+
const layers = store.selectLayers();
|
|
512
|
+
const node = layers[nodeId];
|
|
513
|
+
function setVisibleDownstream(n) {
|
|
514
|
+
if (n.mapLayer) {
|
|
515
|
+
n.mapLayer.setVisible(visible);
|
|
516
|
+
n.visible = visible;
|
|
517
|
+
}
|
|
518
|
+
if (n.children.length > 0) {
|
|
519
|
+
n.children.forEach(setVisibleDownstream);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
setVisibleDownstream(node);
|
|
523
|
+
dispatch({
|
|
524
|
+
type: "LAYERS_LIST_UPDATED",
|
|
525
|
+
payload: Object.assign({}, layers),
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
doLayerSetVisible:
|
|
530
|
+
(nodeId, visible) =>
|
|
531
|
+
({ dispatch, store }) => {
|
|
532
|
+
const layers = store.selectLayers();
|
|
533
|
+
const node = layers[nodeId];
|
|
534
|
+
if (node.mapLayer) {
|
|
535
|
+
node.visible = visible;
|
|
536
|
+
node.mapLayer.setVisible(visible);
|
|
537
|
+
}
|
|
538
|
+
dispatch({
|
|
539
|
+
type: "LAYERS_LIST_UPDATED",
|
|
540
|
+
payload: Object.assign({}, layers),
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
if (node.visible && node.layerFunction && node.layerParams) {
|
|
544
|
+
const params = node.layerParams;
|
|
545
|
+
const layerFunction = node.layerFunction;
|
|
546
|
+
const storeFunction = store[layerFunction];
|
|
547
|
+
if (storeFunction) {
|
|
548
|
+
storeFunction(params);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
|
|
553
|
+
doLayerSetLabels:
|
|
554
|
+
(nodeId, labelsOn) =>
|
|
555
|
+
({ dispatch, store }) => {
|
|
556
|
+
const layers = store.selectLayers();
|
|
557
|
+
const node = layers[nodeId];
|
|
558
|
+
|
|
559
|
+
function formatLabeledUrl(url) {
|
|
560
|
+
const delim = url.indexOf("?") === -1 ? "?" : "&";
|
|
561
|
+
return `${url}${delim}label=true`;
|
|
562
|
+
}
|
|
563
|
+
// if (node.HoverText){
|
|
564
|
+
// set the text popup to the hover text value
|
|
565
|
+
// }
|
|
566
|
+
|
|
567
|
+
if (node.mapLayer) {
|
|
568
|
+
node.labelsOn = labelsOn;
|
|
569
|
+
const src = node.mapLayer.getSource();
|
|
570
|
+
const urls = src.getUrls();
|
|
571
|
+
const newUrls = urls.map((url) => {
|
|
572
|
+
return !labelsOn ? node.url : formatLabeledUrl(node.url);
|
|
573
|
+
});
|
|
574
|
+
src.setUrls(newUrls);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
dispatch({
|
|
578
|
+
type: "LAYERS_LIST_UPDATED",
|
|
579
|
+
payload: Object.assign({}, layers),
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
|
|
583
|
+
doLayerSetLayerOrder:
|
|
584
|
+
(nodeId, sortOrder) =>
|
|
585
|
+
({ dispatch, store }) => {
|
|
586
|
+
const layers = store.selectLayers();
|
|
587
|
+
const node = layers[nodeId];
|
|
588
|
+
if (node.mapLayer) {
|
|
589
|
+
node.sortOrder = sortOrder;
|
|
590
|
+
node.mapLayer.setZIndex(sortOrder);
|
|
591
|
+
}
|
|
592
|
+
dispatch({
|
|
593
|
+
type: "LAYERS_LIST_UPDATED",
|
|
594
|
+
payload: Object.assign({}, layers),
|
|
595
|
+
});
|
|
596
|
+
},
|
|
597
|
+
|
|
598
|
+
doLayerSetOpactiy:
|
|
599
|
+
(nodeId, opacity) =>
|
|
600
|
+
({ dispatch, store }) => {
|
|
601
|
+
const layers = store.selectLayers();
|
|
602
|
+
const node = layers[nodeId];
|
|
603
|
+
if (node.mapLayer) node.mapLayer.setOpacity(opacity);
|
|
604
|
+
dispatch({
|
|
605
|
+
type: "LAYERS_LIST_UPDATED",
|
|
606
|
+
payload: Object.assign({}, layers),
|
|
607
|
+
});
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
doUpdateLayerOrder:
|
|
611
|
+
() =>
|
|
612
|
+
({ dispatch, store }) => {
|
|
613
|
+
const root = store.selectTreeRootNode();
|
|
614
|
+
const overrideSortOrder = store.selectOverrideSortOrder();
|
|
615
|
+
let o = 999;
|
|
616
|
+
function setOrder(node) {
|
|
617
|
+
let sortOrder = o--;
|
|
618
|
+
if (node.mapLayer) {
|
|
619
|
+
if (overrideSortOrder) {
|
|
620
|
+
node.mapLayer.setZIndex(node.sortOrder);
|
|
621
|
+
} else {
|
|
622
|
+
node.sortOrder = sortOrder;
|
|
623
|
+
node.mapLayer.setZIndex(sortOrder);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (node.children) {
|
|
627
|
+
node.children.forEach(setOrder);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
setOrder(root);
|
|
631
|
+
dispatch({ type: "LAYERS_ORDER_UPDATED" });
|
|
632
|
+
},
|
|
633
|
+
doUpdateFavoriteLayers:
|
|
634
|
+
(type, lyr) =>
|
|
635
|
+
({ dispatch, store }) => {
|
|
636
|
+
const favoriteLayers = store.selectFavoriteLayers();
|
|
637
|
+
const layers = store.selectLayers();
|
|
638
|
+
const node = layers[lyr.uid];
|
|
639
|
+
|
|
640
|
+
if (type === "add") {
|
|
641
|
+
favoriteLayers.push(node);
|
|
642
|
+
} else {
|
|
643
|
+
// remove layer from list
|
|
644
|
+
const lyrIdx = favoriteLayers.findIndex(function (item) {
|
|
645
|
+
return item.uid === lyr.uid;
|
|
646
|
+
});
|
|
647
|
+
if (lyrIdx !== -1) {
|
|
648
|
+
favoriteLayers.splice(lyrIdx, 1);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
dispatch({
|
|
653
|
+
type: "LAYERS_FAVORITES_LIST_UPDATED",
|
|
654
|
+
payload: {
|
|
655
|
+
favoriteLayers: favoriteLayers,
|
|
656
|
+
},
|
|
657
|
+
});
|
|
658
|
+
},
|
|
659
|
+
doLayerSetFavorite:
|
|
660
|
+
(nodeId, favorite) =>
|
|
661
|
+
({ dispatch, store }) => {
|
|
662
|
+
const layers = store.selectLayers();
|
|
663
|
+
const node = layers[nodeId];
|
|
664
|
+
node.favorite = favorite;
|
|
665
|
+
|
|
666
|
+
dispatch({
|
|
667
|
+
type: "LAYERS_LIST_UPDATED",
|
|
668
|
+
payload: Object.assign({}, layers),
|
|
669
|
+
});
|
|
670
|
+
},
|
|
671
|
+
|
|
672
|
+
doUpdateUserDefaultLayers:
|
|
673
|
+
(type, lyr) =>
|
|
674
|
+
({ dispatch, store }) => {
|
|
675
|
+
const userDefaultLayers = store.selectUserDefaultLayers();
|
|
676
|
+
const layers = store.selectLayers();
|
|
677
|
+
const node = layers[lyr.uid];
|
|
678
|
+
|
|
679
|
+
if (type === "add") {
|
|
680
|
+
userDefaultLayers.push(node);
|
|
681
|
+
} else {
|
|
682
|
+
const lyrIdx = userDefaultLayers.findIndex(function (item) {
|
|
683
|
+
return item.uid === lyr.uid;
|
|
684
|
+
});
|
|
685
|
+
if (lyrIdx !== -1) {
|
|
686
|
+
userDefaultLayers.splice(lyrIdx, 1);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
dispatch({
|
|
691
|
+
type: "LAYERS_USER_DEFAULT_LAYERS_LIST_UPDATED",
|
|
692
|
+
payload: {
|
|
693
|
+
userDefaultLayers: userDefaultLayers,
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
},
|
|
697
|
+
|
|
698
|
+
doLayerSetUserDefaultLayers:
|
|
699
|
+
(nodeId, userDefaultLayer) =>
|
|
700
|
+
({ dispatch, store }) => {
|
|
701
|
+
const layers = store.selectLayers();
|
|
702
|
+
const node = layers[nodeId];
|
|
703
|
+
node.userDefaultLayer = userDefaultLayer;
|
|
704
|
+
|
|
705
|
+
dispatch({
|
|
706
|
+
type: "LAYERS_LIST_UPDATED",
|
|
707
|
+
payload: Object.assign({}, layers),
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
|
|
711
|
+
doOverrideSortOrder:
|
|
712
|
+
(setting) =>
|
|
713
|
+
({ dispatch }) => {
|
|
714
|
+
dispatch({
|
|
715
|
+
type: "LAYERS_ORDER_OVERRIDE_SORT_ORDER",
|
|
716
|
+
payload: {
|
|
717
|
+
overrideSortLayerOrder: setting,
|
|
718
|
+
},
|
|
719
|
+
});
|
|
720
|
+
},
|
|
721
|
+
doShowLayerSortOrder:
|
|
722
|
+
(bool) =>
|
|
723
|
+
({ dispatch }) => {
|
|
724
|
+
if (bool) {
|
|
725
|
+
dispatch({
|
|
726
|
+
type: "SORT_ORDER_NOW_SHOWING",
|
|
727
|
+
payload: {
|
|
728
|
+
sortOrderStatus: true,
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
selectSortOrderStatus: (state) => {
|
|
734
|
+
return state.layers.sortOrderStatus;
|
|
735
|
+
},
|
|
736
|
+
selectFavoriteLayers: (state) => {
|
|
737
|
+
return state.layers.favoriteLayers;
|
|
738
|
+
},
|
|
739
|
+
|
|
740
|
+
selectUserDefaultLayers: (state) => {
|
|
741
|
+
return state.layers.userDefaultLayers;
|
|
742
|
+
},
|
|
743
|
+
|
|
744
|
+
selectLayers: (state) => {
|
|
745
|
+
return state.layers.layers;
|
|
746
|
+
},
|
|
747
|
+
|
|
748
|
+
selectIdMap: (state) => {
|
|
749
|
+
return state.layers.idMap;
|
|
750
|
+
},
|
|
751
|
+
|
|
752
|
+
selectUidMap: createSelector("selectLayers", (layers) => {
|
|
753
|
+
const uidMap = {};
|
|
754
|
+
Object.keys(layers).forEach((key) => {
|
|
755
|
+
if (layers[key]) {
|
|
756
|
+
uidMap[key] = layers[key].displayName;
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
return uidMap;
|
|
760
|
+
}),
|
|
761
|
+
|
|
762
|
+
selectCmLayers: createSelector("selectLayers", (layers) => {
|
|
763
|
+
const cmLayers = [];
|
|
764
|
+
Object.keys(layers).forEach((key) => {
|
|
765
|
+
if (layers[key] && layers[key].teamDatasetId)
|
|
766
|
+
cmLayers.push(layers[key].teamDatasetId);
|
|
767
|
+
});
|
|
768
|
+
return cmLayers;
|
|
769
|
+
}),
|
|
770
|
+
|
|
771
|
+
selectVisibleLayers: createSelector("selectLayers", (layers) => {
|
|
772
|
+
const visibleLayers = [];
|
|
773
|
+
Object.keys(layers).forEach((key) => {
|
|
774
|
+
if (layers[key] && layers[key].visible) visibleLayers.push(layers[key]);
|
|
775
|
+
});
|
|
776
|
+
return visibleLayers;
|
|
777
|
+
}),
|
|
778
|
+
|
|
779
|
+
selectVisibleCmLayers: createSelector("selectLayers", (layers) => {
|
|
780
|
+
const visibleCmLayers = [];
|
|
781
|
+
Object.keys(layers).forEach((key) => {
|
|
782
|
+
if (layers[key] && layers[key].teamDatasetId && layers[key].visible)
|
|
783
|
+
visibleCmLayers.push(layers[key].teamDatasetId);
|
|
784
|
+
});
|
|
785
|
+
return visibleCmLayers;
|
|
786
|
+
}),
|
|
787
|
+
|
|
788
|
+
selectCmLayerNames: createSelector("selectLayers", (layers) => {
|
|
789
|
+
const lyrNames = [];
|
|
790
|
+
Object.keys(layers).forEach((key) => {
|
|
791
|
+
if (layers[key] && layers[key].teamDatasetId)
|
|
792
|
+
lyrNames.push({
|
|
793
|
+
teamDatasetId: layers[key].teamDatasetId,
|
|
794
|
+
displayName: layers[key].displayName,
|
|
795
|
+
});
|
|
796
|
+
});
|
|
797
|
+
return lyrNames;
|
|
798
|
+
}),
|
|
799
|
+
|
|
800
|
+
selectLayerFilterString: (state) => {
|
|
801
|
+
return state.layers.filterString;
|
|
802
|
+
},
|
|
803
|
+
|
|
804
|
+
selectLayerShowFilter: (state) => {
|
|
805
|
+
return state.layers.showFilter;
|
|
806
|
+
},
|
|
807
|
+
|
|
808
|
+
selectOverrideSortOrder: (state) => {
|
|
809
|
+
return state.layers.overrideSortLayerOrder;
|
|
810
|
+
},
|
|
811
|
+
|
|
812
|
+
reactResetSortOrder: (state) => {
|
|
813
|
+
if (state.layers.resetNeeded)
|
|
814
|
+
return { actionCreator: "doUpdateLayerOrder" };
|
|
815
|
+
},
|
|
816
|
+
};
|