@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,1044 @@
|
|
|
1
|
+
import xhr from "xhr";
|
|
2
|
+
import flatten from "lodash/flatten";
|
|
3
|
+
//import { Style, Fill, Stroke } from "ol/style";
|
|
4
|
+
let req = null;
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: "legend",
|
|
8
|
+
|
|
9
|
+
getReducer: () => {
|
|
10
|
+
const initialData = {
|
|
11
|
+
_shouldGetLegends: false,
|
|
12
|
+
legendLayers: {},
|
|
13
|
+
legendCanvases: {},
|
|
14
|
+
loading: false,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (state = initialData, { type, payload }) => {
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "LAYERS_ORDER_UPDATED":
|
|
20
|
+
return Object.assign({}, state, {
|
|
21
|
+
_shouldGetLegends: true,
|
|
22
|
+
});
|
|
23
|
+
case "LEGEND_FETCH_START":
|
|
24
|
+
case "LEGEND_LAYERS_UPDATED":
|
|
25
|
+
case "LEGEND_LAYERS_UPDATE_ERROR":
|
|
26
|
+
case "LEGEND_HAS_NO_VISIBLE_LAYERS":
|
|
27
|
+
case "LEGEND_LOADED":
|
|
28
|
+
case "LEGEND_CANVAS_ADDED":
|
|
29
|
+
return Object.assign({}, state, payload);
|
|
30
|
+
default:
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
doFetchLegendInfo:
|
|
36
|
+
(layers) =>
|
|
37
|
+
({ dispatch, store }) => {
|
|
38
|
+
if (req) req.abort();
|
|
39
|
+
let legendLayers = store.selectLegendLayers();
|
|
40
|
+
let legendCanvases = store.selectLegendCanvases();
|
|
41
|
+
|
|
42
|
+
layers.forEach((lyr) => {
|
|
43
|
+
const {
|
|
44
|
+
url,
|
|
45
|
+
type,
|
|
46
|
+
layerList,
|
|
47
|
+
uid,
|
|
48
|
+
displayName,
|
|
49
|
+
layerDescription,
|
|
50
|
+
attributions,
|
|
51
|
+
legendOverride,
|
|
52
|
+
} = lyr;
|
|
53
|
+
legendCanvases[uid] = {
|
|
54
|
+
displayName: displayName,
|
|
55
|
+
layerDescription: layerDescription,
|
|
56
|
+
attributions: attributions,
|
|
57
|
+
canvas: [],
|
|
58
|
+
widths: [],
|
|
59
|
+
heights: [],
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
let src = url;
|
|
63
|
+
switch (type) {
|
|
64
|
+
case "ArcGIS":
|
|
65
|
+
src = `${src}/legend?f=pjson`;
|
|
66
|
+
break;
|
|
67
|
+
case "ArcGISImage":
|
|
68
|
+
src = `${src}/legend?bandIds=&renderingRule=&f=pjson`;
|
|
69
|
+
break;
|
|
70
|
+
case "EsriFeatureService":
|
|
71
|
+
if (legendOverride === true) {
|
|
72
|
+
src = `${src}/legend?f=pjson`;
|
|
73
|
+
} else {
|
|
74
|
+
src = `${src}/${layerList}?f=pjson`;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
req = xhr.get(src, (err, response, body) => {
|
|
81
|
+
if (err || response.statusCode !== 200) {
|
|
82
|
+
legendLayers[uid] = ["Legend not available!"];
|
|
83
|
+
|
|
84
|
+
dispatch({
|
|
85
|
+
type: "LEGEND_LAYERS_UPDATE_ERROR",
|
|
86
|
+
payload: {
|
|
87
|
+
legendLayers: legendLayers,
|
|
88
|
+
legendCanvases: legendCanvases,
|
|
89
|
+
loading: false,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
try {
|
|
94
|
+
const data = JSON.parse(body);
|
|
95
|
+
console.log(data);
|
|
96
|
+
if (type === "EsriFeatureService") {
|
|
97
|
+
if (legendOverride === true) {
|
|
98
|
+
store.doGenerateArcImages(data, lyr);
|
|
99
|
+
} else {
|
|
100
|
+
store.doGenerateEsriImages(data, lyr);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
store.doGenerateArcImages(data, lyr);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.log(err);
|
|
107
|
+
legendLayers[uid] = ["Legend not available!"];
|
|
108
|
+
|
|
109
|
+
dispatch({
|
|
110
|
+
type: "LEGEND_LAYERS_UPDATE_ERROR",
|
|
111
|
+
payload: {
|
|
112
|
+
legendLayers: legendLayers,
|
|
113
|
+
legendCanvases: legendCanvases,
|
|
114
|
+
loading: false,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// timeout after 60s.
|
|
122
|
+
req.timeout = 60000;
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
doGenerateArcImages:
|
|
126
|
+
(data, lyr) =>
|
|
127
|
+
({ dispatch, store }) => {
|
|
128
|
+
const { uid, layerList, displayName, layerDescription, attributions } =
|
|
129
|
+
lyr;
|
|
130
|
+
let legendLayers = store.selectLegendLayers();
|
|
131
|
+
let legendCanvases = store.selectLegendCanvases();
|
|
132
|
+
const activeLayers = layerList
|
|
133
|
+
.replace(/show:/g, "")
|
|
134
|
+
.split(",")
|
|
135
|
+
.map(Number);
|
|
136
|
+
|
|
137
|
+
legendCanvases[uid] = {
|
|
138
|
+
displayName: displayName,
|
|
139
|
+
layerDescription: layerDescription,
|
|
140
|
+
attributions: attributions,
|
|
141
|
+
canvas: [],
|
|
142
|
+
widths: [],
|
|
143
|
+
heights: [],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const legends = data.layers.filter((item) => {
|
|
147
|
+
return activeLayers.indexOf(item.layerId) !== -1;
|
|
148
|
+
});
|
|
149
|
+
const items = legends.map((legendLyr) => {
|
|
150
|
+
return legendLyr.legend.map((legend) => {
|
|
151
|
+
let img = new Image();
|
|
152
|
+
img.addEventListener(
|
|
153
|
+
"load",
|
|
154
|
+
function () {
|
|
155
|
+
let canvas = document.createElement("canvas");
|
|
156
|
+
let ctx = canvas.getContext("2d");
|
|
157
|
+
const labelWidth = Number(ctx.measureText(legend.label).width);
|
|
158
|
+
|
|
159
|
+
//set canvas width & height
|
|
160
|
+
canvas.width = Number(legend.width) + labelWidth + 4;
|
|
161
|
+
canvas.height = legend.height;
|
|
162
|
+
|
|
163
|
+
//store width & height for larger canvas calculation
|
|
164
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
165
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
166
|
+
|
|
167
|
+
//set background
|
|
168
|
+
ctx.fillStyle = "white";
|
|
169
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
170
|
+
|
|
171
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
172
|
+
|
|
173
|
+
//add label to the right of image
|
|
174
|
+
ctx.font = "10px Arial";
|
|
175
|
+
ctx.fillStyle = "black";
|
|
176
|
+
ctx.fillText(legend.label, legend.width + 2, legend.height / 2);
|
|
177
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
178
|
+
|
|
179
|
+
dispatch({
|
|
180
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
181
|
+
payload: {
|
|
182
|
+
legendCanvases: legendCanvases,
|
|
183
|
+
loading: false,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
false
|
|
188
|
+
);
|
|
189
|
+
img.src = `data:${legend.contentType};base64,${legend.imageData}`;
|
|
190
|
+
img.alt = `Style for ${legend.label}`;
|
|
191
|
+
img.crossOrigin = "anonymous";
|
|
192
|
+
img.title = legend.label;
|
|
193
|
+
|
|
194
|
+
return img;
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
legendLayers[uid] = flatten(items);
|
|
198
|
+
|
|
199
|
+
dispatch({
|
|
200
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
201
|
+
payload: {
|
|
202
|
+
legendLayers: legendLayers,
|
|
203
|
+
loading: false,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
doGenerateEsriImages:
|
|
209
|
+
(data, lyr) =>
|
|
210
|
+
({ dispatch, store }) => {
|
|
211
|
+
const { uid, displayName, layerDescription, attributions } = lyr;
|
|
212
|
+
let legendLayers = store.selectLegendLayers();
|
|
213
|
+
let legendCanvases = store.selectLegendCanvases();
|
|
214
|
+
const drawingInfo = data.drawingInfo;
|
|
215
|
+
legendCanvases[uid] = {
|
|
216
|
+
displayName: displayName,
|
|
217
|
+
layerDescription: layerDescription,
|
|
218
|
+
attributions: attributions,
|
|
219
|
+
canvas: [],
|
|
220
|
+
widths: [],
|
|
221
|
+
heights: [],
|
|
222
|
+
};
|
|
223
|
+
legendLayers[uid] = [];
|
|
224
|
+
//TODO Logic below is needs to include other Esri styles.
|
|
225
|
+
console.log(drawingInfo.renderer);
|
|
226
|
+
console.log(drawingInfo.renderer.symbol);
|
|
227
|
+
// debugger;
|
|
228
|
+
switch (data.geometryType) {
|
|
229
|
+
case "esriGeometryPolygon":
|
|
230
|
+
if (
|
|
231
|
+
drawingInfo.renderer.symbol &&
|
|
232
|
+
drawingInfo.renderer.symbol.type === "esriSFS" &&
|
|
233
|
+
drawingInfo.renderer.symbol.style === "esriSFSSolid"
|
|
234
|
+
) {
|
|
235
|
+
let img = new Image();
|
|
236
|
+
const outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
237
|
+
const fillColor = drawingInfo.renderer.symbol.color;
|
|
238
|
+
|
|
239
|
+
let canvas = document.createElement("canvas");
|
|
240
|
+
let ctx = canvas.getContext("2d");
|
|
241
|
+
|
|
242
|
+
canvas.width = 20;
|
|
243
|
+
canvas.height = 20;
|
|
244
|
+
|
|
245
|
+
//store width & height for larger canvas calculation
|
|
246
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
247
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
248
|
+
|
|
249
|
+
// Draw polygon
|
|
250
|
+
ctx.beginPath();
|
|
251
|
+
ctx.lineWidth = "2";
|
|
252
|
+
ctx.strokeStyle = outlineColor
|
|
253
|
+
? `rgba(${outlineColor.join()})`
|
|
254
|
+
: null;
|
|
255
|
+
ctx.rect(0, 0, 20, 20);
|
|
256
|
+
ctx.stroke();
|
|
257
|
+
ctx.fillStyle = fillColor ? `rgba(${fillColor.join()})` : null;
|
|
258
|
+
ctx.fillRect(1, 1, 18, 18);
|
|
259
|
+
|
|
260
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
261
|
+
img.alt = `Style for ${displayName}`;
|
|
262
|
+
img.crossOrigin = "anonymous";
|
|
263
|
+
|
|
264
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
265
|
+
dispatch({
|
|
266
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
267
|
+
payload: {
|
|
268
|
+
legendCanvases: legendCanvases,
|
|
269
|
+
loading: false,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
legendLayers[uid].push(img);
|
|
274
|
+
dispatch({
|
|
275
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
276
|
+
payload: {
|
|
277
|
+
legendLayers: legendLayers,
|
|
278
|
+
loading: false,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
} else if (
|
|
282
|
+
drawingInfo.renderer.symbol &&
|
|
283
|
+
drawingInfo.renderer.symbol.type === "esriSFS" &&
|
|
284
|
+
drawingInfo.renderer.symbol.style === "esriSFSBackwardDiagonal"
|
|
285
|
+
) {
|
|
286
|
+
let img = new Image();
|
|
287
|
+
const outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
288
|
+
const fillColor = drawingInfo.renderer.symbol.color;
|
|
289
|
+
|
|
290
|
+
let canvas = document.createElement("canvas");
|
|
291
|
+
let ctx = canvas.getContext("2d");
|
|
292
|
+
|
|
293
|
+
canvas.width = 20;
|
|
294
|
+
canvas.height = 20;
|
|
295
|
+
|
|
296
|
+
//store width & height for larger canvas calculation
|
|
297
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
298
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
299
|
+
|
|
300
|
+
// // Draw polygon
|
|
301
|
+
ctx.beginPath();
|
|
302
|
+
ctx.moveTo(0, 10);
|
|
303
|
+
ctx.lineTo(10, 0);
|
|
304
|
+
ctx.moveTo(0, 20);
|
|
305
|
+
ctx.lineTo(20, 0);
|
|
306
|
+
ctx.moveTo(10, 20);
|
|
307
|
+
ctx.lineTo(20, 10);
|
|
308
|
+
ctx.lineWidth = "2";
|
|
309
|
+
ctx.strokeStyle = `rgba(${outlineColor.join()})`;
|
|
310
|
+
ctx.rect(0, 0, 20, 20);
|
|
311
|
+
ctx.stroke();
|
|
312
|
+
|
|
313
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
314
|
+
img.alt = `Style for ${displayName}`;
|
|
315
|
+
img.crossOrigin = "anonymous";
|
|
316
|
+
|
|
317
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
318
|
+
dispatch({
|
|
319
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
320
|
+
payload: {
|
|
321
|
+
legendCanvases: legendCanvases,
|
|
322
|
+
loading: false,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
legendLayers[uid].push(img);
|
|
327
|
+
dispatch({
|
|
328
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
329
|
+
payload: {
|
|
330
|
+
legendLayers: legendLayers,
|
|
331
|
+
loading: false,
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
//____________________________________________________________________________________________________________________________________
|
|
336
|
+
else if (
|
|
337
|
+
drawingInfo.renderer.type === "uniqueValue" &&
|
|
338
|
+
drawingInfo.renderer.uniqueValueInfos
|
|
339
|
+
) {
|
|
340
|
+
// Compare
|
|
341
|
+
drawingInfo.renderer.uniqueValueInfos.forEach((val) => {
|
|
342
|
+
let img = new Image();
|
|
343
|
+
console.log(val.value);
|
|
344
|
+
if (val.value === "BOEM") {
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const fillColor = val.symbol.color;
|
|
348
|
+
const outlineColor =
|
|
349
|
+
val.symbol.outline && val.symbol.outline.color
|
|
350
|
+
? val.symbol.outline.color
|
|
351
|
+
: fillColor;
|
|
352
|
+
|
|
353
|
+
let canvas = document.createElement("canvas");
|
|
354
|
+
let ctx = canvas.getContext("2d");
|
|
355
|
+
const labelWidth = Number(ctx.measureText(val.label).width);
|
|
356
|
+
|
|
357
|
+
//set canvas width & height
|
|
358
|
+
canvas.width = 20 + labelWidth + 4;
|
|
359
|
+
canvas.height = 20;
|
|
360
|
+
|
|
361
|
+
//store width & height for larger canvas calculation
|
|
362
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
363
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
364
|
+
|
|
365
|
+
// Draw polygon
|
|
366
|
+
ctx.beginPath();
|
|
367
|
+
ctx.lineWidth = "2";
|
|
368
|
+
ctx.strokeStyle = `rgba(${outlineColor.join()})`;
|
|
369
|
+
ctx.rect(0, 0, 20, 20);
|
|
370
|
+
ctx.stroke();
|
|
371
|
+
ctx.fillStyle = `rgba(${fillColor.join()})`;
|
|
372
|
+
ctx.fillRect(1, 1, 18, 18);
|
|
373
|
+
|
|
374
|
+
//add label to the right of image
|
|
375
|
+
ctx.font = "10px Arial";
|
|
376
|
+
ctx.fillStyle = "black";
|
|
377
|
+
ctx.fillText(val.label, 22, canvas.height / 2);
|
|
378
|
+
|
|
379
|
+
//set img attributes
|
|
380
|
+
img.src = canvas.toDataURL();
|
|
381
|
+
img.alt = `Style for ${displayName}`;
|
|
382
|
+
img.crossOrigin = "anonymous";
|
|
383
|
+
|
|
384
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
385
|
+
dispatch({
|
|
386
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
387
|
+
payload: {
|
|
388
|
+
legendCanvases: legendCanvases,
|
|
389
|
+
loading: false,
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
legendLayers[uid].push(img);
|
|
394
|
+
});
|
|
395
|
+
dispatch({
|
|
396
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
397
|
+
payload: {
|
|
398
|
+
legendLayers: legendLayers,
|
|
399
|
+
loading: false,
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
break;
|
|
404
|
+
case "esriGeometryPolyline":
|
|
405
|
+
if (
|
|
406
|
+
drawingInfo.renderer.symbol &&
|
|
407
|
+
drawingInfo.renderer.symbol.type === "esriSLS" &&
|
|
408
|
+
drawingInfo.renderer.symbol.style === "esriSLSSolid"
|
|
409
|
+
) {
|
|
410
|
+
let img = new Image();
|
|
411
|
+
let canvas = document.createElement("canvas");
|
|
412
|
+
let ctx = canvas.getContext("2d");
|
|
413
|
+
const lineColor = drawingInfo.renderer.symbol.color;
|
|
414
|
+
|
|
415
|
+
canvas.width = 20;
|
|
416
|
+
canvas.height = 20;
|
|
417
|
+
|
|
418
|
+
//store width & height for larger canvas calculation
|
|
419
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
420
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
421
|
+
|
|
422
|
+
// Draw line
|
|
423
|
+
ctx.beginPath();
|
|
424
|
+
ctx.strokeStyle = `rgba(${lineColor.join()})`;
|
|
425
|
+
ctx.moveTo(0, 0);
|
|
426
|
+
ctx.lineTo(20, 20);
|
|
427
|
+
ctx.stroke();
|
|
428
|
+
|
|
429
|
+
//set img attributes
|
|
430
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
431
|
+
img.alt = `Style for ${displayName}`;
|
|
432
|
+
img.crossOrigin = "anonymous";
|
|
433
|
+
|
|
434
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
435
|
+
dispatch({
|
|
436
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
437
|
+
payload: {
|
|
438
|
+
legendCanvases: legendCanvases,
|
|
439
|
+
loading: false,
|
|
440
|
+
},
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
legendLayers[uid].push(img);
|
|
444
|
+
dispatch({
|
|
445
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
446
|
+
payload: {
|
|
447
|
+
legendLayers: legendLayers,
|
|
448
|
+
loading: false,
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
} else if (
|
|
452
|
+
drawingInfo.renderer.type === "uniqueValue" &&
|
|
453
|
+
drawingInfo.renderer.uniqueValueInfos
|
|
454
|
+
) {
|
|
455
|
+
drawingInfo.renderer.uniqueValueInfos.forEach((val) => {
|
|
456
|
+
let img = new Image();
|
|
457
|
+
|
|
458
|
+
let canvas = document.createElement("canvas");
|
|
459
|
+
let ctx = canvas.getContext("2d");
|
|
460
|
+
const labelWidth = Number(ctx.measureText(val.label).width);
|
|
461
|
+
const lineColor = val.symbol.color;
|
|
462
|
+
|
|
463
|
+
//set canvas width & height
|
|
464
|
+
canvas.width = 20 + labelWidth + 4;
|
|
465
|
+
canvas.height = 20;
|
|
466
|
+
|
|
467
|
+
//store width & height for larger canvas calculation
|
|
468
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
469
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
470
|
+
|
|
471
|
+
// Draw line
|
|
472
|
+
ctx.beginPath();
|
|
473
|
+
ctx.strokeStyle = `rgba(${lineColor.join()})`;
|
|
474
|
+
ctx.moveTo(0, 0);
|
|
475
|
+
ctx.lineTo(20, 20);
|
|
476
|
+
ctx.stroke();
|
|
477
|
+
|
|
478
|
+
//add label to the right of image
|
|
479
|
+
ctx.font = "10px Arial";
|
|
480
|
+
ctx.fillStyle = "black";
|
|
481
|
+
ctx.fillText(val.label, 22, canvas.height / 2);
|
|
482
|
+
|
|
483
|
+
//set img attributes
|
|
484
|
+
img.src = canvas.toDataURL();
|
|
485
|
+
img.alt = `Style for ${displayName}`;
|
|
486
|
+
img.crossOrigin = "anonymous";
|
|
487
|
+
|
|
488
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
489
|
+
dispatch({
|
|
490
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
491
|
+
payload: {
|
|
492
|
+
legendCanvases: legendCanvases,
|
|
493
|
+
loading: false,
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
legendLayers[uid].push(img);
|
|
498
|
+
});
|
|
499
|
+
dispatch({
|
|
500
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
501
|
+
payload: {
|
|
502
|
+
legendLayers: legendLayers,
|
|
503
|
+
loading: false,
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
break;
|
|
508
|
+
case "esriGeometryPoint":
|
|
509
|
+
if (
|
|
510
|
+
drawingInfo.renderer.symbol &&
|
|
511
|
+
drawingInfo.renderer.symbol.type === "esriPMS"
|
|
512
|
+
) {
|
|
513
|
+
let img = new Image();
|
|
514
|
+
img.src = `data:image/png;base64,${data.drawingInfo.renderer.symbol.imageData}`;
|
|
515
|
+
img.addEventListener(
|
|
516
|
+
"load",
|
|
517
|
+
function () {
|
|
518
|
+
let canvas = document.createElement("canvas");
|
|
519
|
+
let ctx = canvas.getContext("2d");
|
|
520
|
+
|
|
521
|
+
canvas.width = drawingInfo.renderer.symbol.width;
|
|
522
|
+
canvas.height = drawingInfo.renderer.symbol.height;
|
|
523
|
+
|
|
524
|
+
//store width & height for larger canvas calculation
|
|
525
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
526
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
527
|
+
|
|
528
|
+
//set background
|
|
529
|
+
ctx.fillStyle = "white";
|
|
530
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
531
|
+
|
|
532
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
533
|
+
|
|
534
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
535
|
+
|
|
536
|
+
dispatch({
|
|
537
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
538
|
+
payload: {
|
|
539
|
+
legendCanvases: legendCanvases,
|
|
540
|
+
loading: false,
|
|
541
|
+
},
|
|
542
|
+
});
|
|
543
|
+
},
|
|
544
|
+
false
|
|
545
|
+
);
|
|
546
|
+
|
|
547
|
+
img.alt = `Style for ${displayName}`;
|
|
548
|
+
img.crossOrigin = "anonymous";
|
|
549
|
+
legendLayers[uid] = [img]; //TODO: Update to possibly push multiple images into array
|
|
550
|
+
dispatch({
|
|
551
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
552
|
+
payload: {
|
|
553
|
+
legendLayers: legendLayers,
|
|
554
|
+
loading: false,
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
} else if (
|
|
558
|
+
drawingInfo.renderer.symbol &&
|
|
559
|
+
drawingInfo.renderer.symbol.type === "esriSMS"
|
|
560
|
+
) {
|
|
561
|
+
let img = new Image();
|
|
562
|
+
const outlineColor = drawingInfo.renderer.symbol.outline.color;
|
|
563
|
+
const outlineWidth = drawingInfo.renderer.symbol.outline.width;
|
|
564
|
+
const fillColor = drawingInfo.renderer.symbol.color;
|
|
565
|
+
const size = drawingInfo.renderer.symbol.size;
|
|
566
|
+
|
|
567
|
+
let canvas = document.createElement("canvas");
|
|
568
|
+
let ctx = canvas.getContext("2d");
|
|
569
|
+
|
|
570
|
+
canvas.width = 20;
|
|
571
|
+
canvas.height = 20;
|
|
572
|
+
|
|
573
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
574
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
575
|
+
|
|
576
|
+
// circle
|
|
577
|
+
ctx.beginPath();
|
|
578
|
+
ctx.strokeStyle = `rgba(${outlineColor.join()})`;
|
|
579
|
+
ctx.lineWidth = outlineWidth;
|
|
580
|
+
ctx.arc(size, size, size / 1.5, 0, Math.PI * 2);
|
|
581
|
+
ctx.fillStyle = `rgba(${fillColor.join()})`;
|
|
582
|
+
ctx.fill();
|
|
583
|
+
ctx.stroke();
|
|
584
|
+
|
|
585
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
586
|
+
img.alt = `Style for ${displayName}`;
|
|
587
|
+
img.crossOrigin = "anonymous";
|
|
588
|
+
|
|
589
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
590
|
+
dispatch({
|
|
591
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
592
|
+
payload: {
|
|
593
|
+
legendCanvases: legendCanvases,
|
|
594
|
+
loading: false,
|
|
595
|
+
},
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
legendLayers[uid].push(img);
|
|
599
|
+
dispatch({
|
|
600
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
601
|
+
payload: {
|
|
602
|
+
legendLayers: legendLayers,
|
|
603
|
+
loading: false,
|
|
604
|
+
},
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
//___________________________________________________________________________________________________________________________________
|
|
608
|
+
else if (drawingInfo.renderer.uniqueValueInfos) {
|
|
609
|
+
// let canvas = document.createElement("canvas");
|
|
610
|
+
// let ctx = canvas.getContext("2d");
|
|
611
|
+
let result = [];
|
|
612
|
+
let images = [];
|
|
613
|
+
drawingInfo.renderer.uniqueValueInfos.forEach((val) => {
|
|
614
|
+
let label = val.label;
|
|
615
|
+
let wkCanvas;
|
|
616
|
+
let img = new Image();
|
|
617
|
+
img.src = `data:image/png;base64,${val.symbol.imageData}`;
|
|
618
|
+
|
|
619
|
+
// img.addEventListener(
|
|
620
|
+
// "load",
|
|
621
|
+
// function () {
|
|
622
|
+
let canvas = document.createElement("canvas");
|
|
623
|
+
let ctx = canvas.getContext("2d");
|
|
624
|
+
|
|
625
|
+
const labelWidth = Number(ctx.measureText(label).width);
|
|
626
|
+
|
|
627
|
+
//set canvas width & height
|
|
628
|
+
canvas.width = Number(val.symbol.width) + labelWidth + 4;
|
|
629
|
+
canvas.height = val.symbol.height;
|
|
630
|
+
|
|
631
|
+
//store width & height for larger canvas calculation
|
|
632
|
+
// legendCanvases[uid].widths.push(canvas.width);
|
|
633
|
+
// legendCanvases[uid].heights.push(canvas.height);
|
|
634
|
+
|
|
635
|
+
//set background
|
|
636
|
+
ctx.fillStyle = "white";
|
|
637
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
638
|
+
// // ctx.putImageData(val.symbol.imageData, 0,0)
|
|
639
|
+
|
|
640
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
641
|
+
|
|
642
|
+
// //add label to the right of image
|
|
643
|
+
// ctx.font = "10px Arial";
|
|
644
|
+
// ctx.fillStyle = "black";
|
|
645
|
+
|
|
646
|
+
// ctx.fillText(label, canvas.width + 2, canvas.height / 2);
|
|
647
|
+
|
|
648
|
+
// legendCanvases[uid].canvas.push(canvas);
|
|
649
|
+
|
|
650
|
+
// dispatch({
|
|
651
|
+
// type: "LEGEND_CANVAS_ADDED",
|
|
652
|
+
// payload: {
|
|
653
|
+
// legendCanvases: legendCanvases,
|
|
654
|
+
// loading: false,
|
|
655
|
+
// },
|
|
656
|
+
// });
|
|
657
|
+
// result.push(canvas)
|
|
658
|
+
// },
|
|
659
|
+
// false
|
|
660
|
+
// );
|
|
661
|
+
// img.src = `data:${val.symbol.url};base64,${val.symbol.imageData}`
|
|
662
|
+
// img.src = canvas.toDataURL()
|
|
663
|
+
|
|
664
|
+
img.alt = `Style for ${label}`;
|
|
665
|
+
img.crossOrigin = "anonymous";
|
|
666
|
+
img.title = label;
|
|
667
|
+
// legendLayers[uid] = [img]; //TODO: Update to possibly push multiple images into array
|
|
668
|
+
// images.push(img)
|
|
669
|
+
|
|
670
|
+
// dispatch({
|
|
671
|
+
// type: "LEGEND_LAYERS_UPDATED",
|
|
672
|
+
// payload: {
|
|
673
|
+
// legendLayers: legendLayers,
|
|
674
|
+
// },
|
|
675
|
+
// });
|
|
676
|
+
result.push({
|
|
677
|
+
canvas: canvas,
|
|
678
|
+
image: img,
|
|
679
|
+
});
|
|
680
|
+
});
|
|
681
|
+
result.forEach((item) => {
|
|
682
|
+
item.image.alt = `Style for ${lyr.displayName}`;
|
|
683
|
+
legendCanvases[lyr.uid].widths.push(item.canvas.width);
|
|
684
|
+
legendCanvases[lyr.uid].heights.push(item.canvas.height);
|
|
685
|
+
legendCanvases[lyr.uid].canvas.push(item.canvas);
|
|
686
|
+
legendLayers[lyr.uid].push(item.image);
|
|
687
|
+
|
|
688
|
+
dispatch({
|
|
689
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
690
|
+
payload: {
|
|
691
|
+
legendCanvases: legendCanvases,
|
|
692
|
+
loading: false,
|
|
693
|
+
},
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
} else if (drawingInfo.renderer.classBreakInfos) {
|
|
697
|
+
drawingInfo.renderer.classBreakInfos.forEach((val) => {
|
|
698
|
+
let img = new Image();
|
|
699
|
+
const outlineColor = val.symbol.outline.color;
|
|
700
|
+
const outlineWidth = val.symbol.outline.width;
|
|
701
|
+
const fillColor = val.symbol.color;
|
|
702
|
+
const size = val.symbol.size;
|
|
703
|
+
let canvas = document.createElement("canvas");
|
|
704
|
+
let ctx = canvas.getContext("2d");
|
|
705
|
+
|
|
706
|
+
canvas.width = 20 * 2.5;
|
|
707
|
+
canvas.height = 20;
|
|
708
|
+
|
|
709
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
710
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
711
|
+
|
|
712
|
+
//text
|
|
713
|
+
ctx.font = "11px Arial";
|
|
714
|
+
ctx.fillText(val.label, size * 3, size * 2, 30);
|
|
715
|
+
|
|
716
|
+
// circle
|
|
717
|
+
ctx.beginPath();
|
|
718
|
+
ctx.strokeStyle = `rgba(${outlineColor.join()})`;
|
|
719
|
+
ctx.lineWidth = outlineWidth;
|
|
720
|
+
ctx.arc(size, size * 1.5, size / 1.5, 0, Math.PI * 2);
|
|
721
|
+
ctx.fillStyle = `rgba(${fillColor.join()})`;
|
|
722
|
+
ctx.fill();
|
|
723
|
+
ctx.stroke();
|
|
724
|
+
|
|
725
|
+
img.src = canvas.toDataURL(); //set src using data URI from canvas
|
|
726
|
+
img.alt = `Style for ${displayName}`;
|
|
727
|
+
img.crossOrigin = "anonymous";
|
|
728
|
+
|
|
729
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
730
|
+
dispatch({
|
|
731
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
732
|
+
payload: {
|
|
733
|
+
legendCanvases: legendCanvases,
|
|
734
|
+
loading: false,
|
|
735
|
+
},
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
legendLayers[uid].push(img);
|
|
739
|
+
dispatch({
|
|
740
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
741
|
+
payload: {
|
|
742
|
+
legendLayers: legendLayers,
|
|
743
|
+
loading: false,
|
|
744
|
+
},
|
|
745
|
+
});
|
|
746
|
+
});
|
|
747
|
+
} else {
|
|
748
|
+
legendLayers[uid] = ["Legend not available!"];
|
|
749
|
+
dispatch({
|
|
750
|
+
type: "LEGEND_LAYERS_UPDATE_ERROR",
|
|
751
|
+
payload: {
|
|
752
|
+
legendLayers: legendLayers,
|
|
753
|
+
legendCanvases: legendCanvases,
|
|
754
|
+
loading: false,
|
|
755
|
+
},
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
break;
|
|
759
|
+
case "esriGeometryMultipoint":
|
|
760
|
+
if (
|
|
761
|
+
drawingInfo.renderer.symbol &&
|
|
762
|
+
drawingInfo.renderer.symbol.type === "esriPMS"
|
|
763
|
+
) {
|
|
764
|
+
let img = new Image();
|
|
765
|
+
img.src = `data:image/png;base64,${data.drawingInfo.renderer.symbol.imageData}`;
|
|
766
|
+
img.addEventListener(
|
|
767
|
+
"load",
|
|
768
|
+
function () {
|
|
769
|
+
let canvas = document.createElement("canvas");
|
|
770
|
+
let ctx = canvas.getContext("2d");
|
|
771
|
+
|
|
772
|
+
canvas.width = drawingInfo.renderer.symbol.width;
|
|
773
|
+
canvas.height = drawingInfo.renderer.symbol.height;
|
|
774
|
+
|
|
775
|
+
//store width & height for larger canvas calculation
|
|
776
|
+
legendCanvases[uid].widths.push(canvas.width);
|
|
777
|
+
legendCanvases[uid].heights.push(canvas.height);
|
|
778
|
+
|
|
779
|
+
//set background
|
|
780
|
+
ctx.fillStyle = "white";
|
|
781
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
782
|
+
|
|
783
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
784
|
+
|
|
785
|
+
legendCanvases[uid].canvas.push(canvas);
|
|
786
|
+
|
|
787
|
+
dispatch({
|
|
788
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
789
|
+
payload: {
|
|
790
|
+
legendCanvases: legendCanvases,
|
|
791
|
+
loading: false,
|
|
792
|
+
},
|
|
793
|
+
});
|
|
794
|
+
},
|
|
795
|
+
false
|
|
796
|
+
);
|
|
797
|
+
|
|
798
|
+
img.alt = `Style for ${displayName}`;
|
|
799
|
+
img.crossOrigin = "anonymous";
|
|
800
|
+
legendLayers[uid] = [img]; //TODO: Update to possibly push multiple images into array
|
|
801
|
+
dispatch({
|
|
802
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
803
|
+
payload: {
|
|
804
|
+
legendLayers: legendLayers,
|
|
805
|
+
loading: false,
|
|
806
|
+
},
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
break;
|
|
810
|
+
|
|
811
|
+
default:
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
doFetchLegendImages:
|
|
816
|
+
() =>
|
|
817
|
+
({ dispatch, store }) => {
|
|
818
|
+
dispatch({
|
|
819
|
+
type: "LEGEND_FETCH_START",
|
|
820
|
+
payload: {
|
|
821
|
+
_shouldGetLegends: false,
|
|
822
|
+
loading: true,
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
const visibleLayers = store.selectVisibleLayers();
|
|
827
|
+
let legendLayers = store.selectLegendLayers();
|
|
828
|
+
let legendCanvases = store.selectLegendCanvases();
|
|
829
|
+
let queuedLayers = [];
|
|
830
|
+
|
|
831
|
+
visibleLayers.forEach((layer) => {
|
|
832
|
+
//check if layer already added legendLayers object.
|
|
833
|
+
if (!legendLayers.hasOwnProperty(layer.uid)) {
|
|
834
|
+
switch (layer.type) {
|
|
835
|
+
case "ArcGIS":
|
|
836
|
+
case "ArcGISImage":
|
|
837
|
+
case "EsriFeatureService":
|
|
838
|
+
if (layer.styleFn && layer.type === "EsriFeatureService") {
|
|
839
|
+
legendCanvases[layer.uid] = {
|
|
840
|
+
displayName: layer.displayName,
|
|
841
|
+
layerDescription: layer.layerDescription,
|
|
842
|
+
attributions: layer.attributions,
|
|
843
|
+
canvas: [],
|
|
844
|
+
widths: [],
|
|
845
|
+
heights: [],
|
|
846
|
+
};
|
|
847
|
+
legendLayers[layer.uid] = [];
|
|
848
|
+
|
|
849
|
+
//Get canvases and images for legend
|
|
850
|
+
let legendFunction = eval(layer.styleFn)[1];
|
|
851
|
+
let legendItems = legendFunction();
|
|
852
|
+
|
|
853
|
+
legendItems.forEach((item) => {
|
|
854
|
+
item.image.alt = `Style for ${layer.displayName}`;
|
|
855
|
+
legendCanvases[layer.uid].widths.push(item.canvas.width);
|
|
856
|
+
legendCanvases[layer.uid].heights.push(item.canvas.height);
|
|
857
|
+
legendCanvases[layer.uid].canvas.push(item.canvas);
|
|
858
|
+
legendLayers[layer.uid].push(item.image);
|
|
859
|
+
|
|
860
|
+
dispatch({
|
|
861
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
862
|
+
payload: {
|
|
863
|
+
legendCanvases: legendCanvases,
|
|
864
|
+
loading: false,
|
|
865
|
+
},
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
dispatch({
|
|
870
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
871
|
+
payload: {
|
|
872
|
+
legendLayers: legendLayers,
|
|
873
|
+
},
|
|
874
|
+
});
|
|
875
|
+
} else {
|
|
876
|
+
queuedLayers.push(layer);
|
|
877
|
+
}
|
|
878
|
+
break;
|
|
879
|
+
case "WMS":
|
|
880
|
+
legendCanvases[layer.uid] = {
|
|
881
|
+
displayName: layer.displayName,
|
|
882
|
+
attributions: layer.attributions,
|
|
883
|
+
layerDescription: layer.layerDescription,
|
|
884
|
+
canvas: [],
|
|
885
|
+
widths: [],
|
|
886
|
+
heights: [],
|
|
887
|
+
};
|
|
888
|
+
let activeLayers = layer.layerList.replace(/ /g, "").split(",");
|
|
889
|
+
const images = activeLayers.map((lyr, i) => {
|
|
890
|
+
let img = new Image();
|
|
891
|
+
img.addEventListener(
|
|
892
|
+
"load",
|
|
893
|
+
function () {
|
|
894
|
+
let canvas = document.createElement("canvas");
|
|
895
|
+
let ctx = canvas.getContext("2d");
|
|
896
|
+
|
|
897
|
+
//set canvas width & height
|
|
898
|
+
canvas.width = Number(img.width) + 2;
|
|
899
|
+
canvas.height = img.height;
|
|
900
|
+
|
|
901
|
+
//store width & height for larger canvas calculation
|
|
902
|
+
legendCanvases[layer.uid].widths.push(canvas.width);
|
|
903
|
+
legendCanvases[layer.uid].heights.push(canvas.height);
|
|
904
|
+
|
|
905
|
+
//set background
|
|
906
|
+
ctx.fillStyle = "white";
|
|
907
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
908
|
+
|
|
909
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
910
|
+
|
|
911
|
+
legendCanvases[layer.uid].canvas.push(canvas);
|
|
912
|
+
|
|
913
|
+
dispatch({
|
|
914
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
915
|
+
payload: {
|
|
916
|
+
legendCanvases: legendCanvases,
|
|
917
|
+
loading: false,
|
|
918
|
+
},
|
|
919
|
+
});
|
|
920
|
+
},
|
|
921
|
+
false
|
|
922
|
+
);
|
|
923
|
+
let legendParams = `service=WMS&version=1.1.1&request=GetLegendGraphic&format=image/png&sld_version=1.1.0&layer=${lyr}`;
|
|
924
|
+
if (layer.url.indexOf(".map") !== -1) {
|
|
925
|
+
img.src = `${layer.url}&${legendParams}`;
|
|
926
|
+
} else {
|
|
927
|
+
img.src = `${layer.url}?${legendParams}`;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
img.alt = `Style for ${layer.displayName}`;
|
|
931
|
+
img.crossOrigin = "anonymous";
|
|
932
|
+
|
|
933
|
+
return img;
|
|
934
|
+
});
|
|
935
|
+
legendLayers[layer.uid] = images;
|
|
936
|
+
|
|
937
|
+
dispatch({
|
|
938
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
939
|
+
payload: {
|
|
940
|
+
legendLayers: legendLayers,
|
|
941
|
+
},
|
|
942
|
+
});
|
|
943
|
+
break;
|
|
944
|
+
case "LocalVector":
|
|
945
|
+
default:
|
|
946
|
+
legendCanvases[layer.uid] = {
|
|
947
|
+
displayName: layer.displayName,
|
|
948
|
+
layerDescription: layer.layerDescription,
|
|
949
|
+
attributions: layer.attributions,
|
|
950
|
+
canvas: [],
|
|
951
|
+
widths: [],
|
|
952
|
+
heights: [],
|
|
953
|
+
};
|
|
954
|
+
if (layer.src) {
|
|
955
|
+
let img = new Image();
|
|
956
|
+
img.addEventListener(
|
|
957
|
+
"load",
|
|
958
|
+
function () {
|
|
959
|
+
let canvas = document.createElement("canvas");
|
|
960
|
+
let ctx = canvas.getContext("2d");
|
|
961
|
+
|
|
962
|
+
//set canvas width & height
|
|
963
|
+
canvas.width = Number(img.width) + 2;
|
|
964
|
+
canvas.height = img.height;
|
|
965
|
+
|
|
966
|
+
//store width & height for larger canvas calculation
|
|
967
|
+
legendCanvases[layer.uid].widths.push(canvas.width);
|
|
968
|
+
legendCanvases[layer.uid].heights.push(canvas.height);
|
|
969
|
+
|
|
970
|
+
//set background
|
|
971
|
+
ctx.fillStyle = "white";
|
|
972
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
973
|
+
|
|
974
|
+
ctx.drawImage(img, 0, 0); //add image to canvas
|
|
975
|
+
|
|
976
|
+
legendCanvases[layer.uid].canvas.push(canvas);
|
|
977
|
+
|
|
978
|
+
dispatch({
|
|
979
|
+
type: "LEGEND_CANVAS_ADDED",
|
|
980
|
+
payload: {
|
|
981
|
+
legendCanvases: legendCanvases,
|
|
982
|
+
loading: false,
|
|
983
|
+
},
|
|
984
|
+
});
|
|
985
|
+
},
|
|
986
|
+
false
|
|
987
|
+
);
|
|
988
|
+
img.src = layer.src;
|
|
989
|
+
img.alt = `Style for ${layer.displayName}`;
|
|
990
|
+
img.crossOrigin = "anonymous";
|
|
991
|
+
legendLayers[layer.uid] = [img];
|
|
992
|
+
dispatch({
|
|
993
|
+
type: "LEGEND_LAYERS_UPDATED",
|
|
994
|
+
payload: {
|
|
995
|
+
legendLayers: legendLayers,
|
|
996
|
+
},
|
|
997
|
+
});
|
|
998
|
+
} else {
|
|
999
|
+
legendLayers[layer.uid] = ["Legend not available!"];
|
|
1000
|
+
dispatch({
|
|
1001
|
+
type: "LEGEND_LAYERS_UPDATE_ERROR",
|
|
1002
|
+
payload: {
|
|
1003
|
+
legendLayers: legendLayers,
|
|
1004
|
+
legendCanvases: legendCanvases,
|
|
1005
|
+
loading: false,
|
|
1006
|
+
},
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
} else {
|
|
1012
|
+
dispatch({
|
|
1013
|
+
type: "LEGEND_LOADED",
|
|
1014
|
+
payload: {
|
|
1015
|
+
loading: false,
|
|
1016
|
+
},
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
if (queuedLayers.length) store.doFetchLegendInfo(queuedLayers);
|
|
1022
|
+
if (!visibleLayers.length) {
|
|
1023
|
+
dispatch({
|
|
1024
|
+
type: "LEGEND_HAS_NO_VISIBLE_LAYERS",
|
|
1025
|
+
payload: {
|
|
1026
|
+
loading: false,
|
|
1027
|
+
},
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
selectLegendLayers: (state) => {
|
|
1032
|
+
return state.legend.legendLayers;
|
|
1033
|
+
},
|
|
1034
|
+
selectLegendCanvases: (state) => {
|
|
1035
|
+
return state.legend.legendCanvases;
|
|
1036
|
+
},
|
|
1037
|
+
selectLegendLoading: (state) => {
|
|
1038
|
+
return state.legend.loading;
|
|
1039
|
+
},
|
|
1040
|
+
reactLegendShouldGetLegend: (state) => {
|
|
1041
|
+
if (state.legend._shouldGetLegends)
|
|
1042
|
+
return { actionCreator: "doFetchLegendImages" };
|
|
1043
|
+
},
|
|
1044
|
+
};
|