@corpsmap/corpsmap 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dev.js +45 -18
- package/lib/prod.js +45 -18
- package/package.json +1 -1
- package/src/application-bundles/config-bundle.js +5 -1
- package/src/application-bundles/create-ol-map-bundle.js +26 -8
- package/src/application-bundles/map-view-bundle.js +312 -308
- package/src/application-containers/map.js +5 -3
- package/src/application-exports/map-provider.js +6 -1
- package/src/config/default-config.js +561 -561
- package/src/openlayers-utils/layer-utilities.js +6 -3
package/lib/dev.js
CHANGED
|
@@ -738,20 +738,21 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
738
738
|
value: function componentDidMount() {
|
|
739
739
|
var _this$props = this.props,
|
|
740
740
|
doMapInitialize = _this$props.doMapInitialize,
|
|
741
|
-
viewState = _this$props.viewState
|
|
741
|
+
viewState = _this$props.viewState,
|
|
742
|
+
limitMapExtent = _this$props.limitMapExtent;
|
|
742
743
|
var center = viewState.center,
|
|
743
744
|
zoom = viewState.zoom,
|
|
744
745
|
rotation = viewState.rotation,
|
|
745
746
|
minZoom = viewState.minZoom,
|
|
746
747
|
maxZoom = viewState.maxZoom;
|
|
747
|
-
console.log(center);
|
|
748
748
|
doMapInitialize(this.mapEl, {
|
|
749
749
|
center: center,
|
|
750
750
|
zoom: zoom,
|
|
751
751
|
rotation: rotation,
|
|
752
752
|
minZoom: minZoom,
|
|
753
753
|
maxZoom: maxZoom,
|
|
754
|
-
layers: []
|
|
754
|
+
layers: [],
|
|
755
|
+
limitMapExtent: limitMapExtent
|
|
755
756
|
}); // doAddMapDragDropListeners(this.mapEl);
|
|
756
757
|
}
|
|
757
758
|
}, {
|
|
@@ -784,7 +785,7 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
784
785
|
return Map;
|
|
785
786
|
}(React$1__default.Component);
|
|
786
787
|
|
|
787
|
-
var Map$2 = connect('doMapInitialize', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
|
|
788
|
+
var Map$2 = connect('doMapInitialize', 'selectLimitMapExtent', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
|
|
788
789
|
|
|
789
790
|
var NorthRegion = /*#__PURE__*/function (_React$Component) {
|
|
790
791
|
_inherits(NorthRegion, _React$Component);
|
|
@@ -4574,6 +4575,9 @@ var configBundle = {
|
|
|
4574
4575
|
},
|
|
4575
4576
|
selectDefaultLayers: function selectDefaultLayers(state) {
|
|
4576
4577
|
return state.config["default"].datasets;
|
|
4578
|
+
},
|
|
4579
|
+
selectLimitMapExtent: function selectLimitMapExtent(state) {
|
|
4580
|
+
return state.config["default"].limitMapExtent;
|
|
4577
4581
|
}
|
|
4578
4582
|
};
|
|
4579
4583
|
|
|
@@ -65287,7 +65291,8 @@ function getXyzSource(options) {
|
|
|
65287
65291
|
maxZoom: options.maxzoom,
|
|
65288
65292
|
minZoom: options.minzoom,
|
|
65289
65293
|
url: url,
|
|
65290
|
-
crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
|
|
65294
|
+
crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
|
|
65295
|
+
// Line may no longer be needed.
|
|
65291
65296
|
// wrapX: false,
|
|
65292
65297
|
|
|
65293
65298
|
});
|
|
@@ -65383,7 +65388,8 @@ function getEsriVectorSource(options) {
|
|
|
65383
65388
|
}
|
|
65384
65389
|
|
|
65385
65390
|
function getTileLayer(options, source) {
|
|
65386
|
-
// CWBI-13636 Prevent horizontal wrapping.
|
|
65391
|
+
// CWBI-13636 Prevent horizontal wrapping.
|
|
65392
|
+
// Line may no longer be needed.
|
|
65387
65393
|
// source.wrapX = false;
|
|
65388
65394
|
return new TileLayer({
|
|
65389
65395
|
source: source,
|
|
@@ -65396,7 +65402,8 @@ function getTileLayer(options, source) {
|
|
|
65396
65402
|
}
|
|
65397
65403
|
|
|
65398
65404
|
function getImageLayer(options, source) {
|
|
65399
|
-
// CWBI-13636 Prevent horizontal wrapping.
|
|
65405
|
+
// CWBI-13636 Prevent horizontal wrapping.
|
|
65406
|
+
// Line may no longer be needed.
|
|
65400
65407
|
// source.wrapX = false;
|
|
65401
65408
|
return new ImageLayer({
|
|
65402
65409
|
source: source,
|
|
@@ -79004,7 +79011,8 @@ var createOlMapBundle = (function (opts) {
|
|
|
79004
79011
|
rotation: 0,
|
|
79005
79012
|
minZoom: 0,
|
|
79006
79013
|
maxZoom: 22,
|
|
79007
|
-
addons: {}
|
|
79014
|
+
addons: {},
|
|
79015
|
+
limitMapExtent: false
|
|
79008
79016
|
};
|
|
79009
79017
|
var config = Object.assign({}, defaults, opts);
|
|
79010
79018
|
return Object.assign({}, {
|
|
@@ -79020,6 +79028,7 @@ var createOlMapBundle = (function (opts) {
|
|
|
79020
79028
|
rotation: config.rotation,
|
|
79021
79029
|
minZoom: config.minZoom,
|
|
79022
79030
|
maxZoom: config.maxZoom,
|
|
79031
|
+
limitMapExtent: config.limitMapExtent,
|
|
79023
79032
|
shouldInitialize: false,
|
|
79024
79033
|
shouldResetViewState: false,
|
|
79025
79034
|
shouldUpdateViewState: false
|
|
@@ -79054,24 +79063,28 @@ var createOlMapBundle = (function (opts) {
|
|
|
79054
79063
|
var dispatch = _ref2.dispatch,
|
|
79055
79064
|
store = _ref2.store;
|
|
79056
79065
|
var geoProjection = store.selectMapGeoProjection();
|
|
79057
|
-
var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
|
|
79058
|
-
// const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
|
|
79066
|
+
var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
|
|
79059
79067
|
|
|
79068
|
+
var limitMapExtent = opts.hasOwnProperty("limitMapExtent") ? opts.limitMapExtent : null;
|
|
79069
|
+
var extent = limitMapExtent ? transformExtent([-180, -85, 180, 85], geoProjection, webProjection) : null;
|
|
79060
79070
|
var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
|
|
79061
79071
|
var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
|
|
79062
79072
|
var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
|
|
79063
79073
|
var minZoom = opts.hasOwnProperty("minZoom") ? opts.minZoom : store.selectMapMinZoom();
|
|
79064
79074
|
var maxZoom = opts.hasOwnProperty("maxZoom") ? opts.maxZoom : store.selectMapMaxZoom();
|
|
79065
79075
|
console.log("setting up at", opts.center, center);
|
|
79066
|
-
var
|
|
79076
|
+
var viewParams = {
|
|
79067
79077
|
center: transform(center, geoProjection, webProjection),
|
|
79068
79078
|
zoom: zoom,
|
|
79069
79079
|
rotation: rotation,
|
|
79070
79080
|
minZoom: minZoom,
|
|
79071
|
-
maxZoom: maxZoom
|
|
79072
|
-
|
|
79081
|
+
maxZoom: maxZoom
|
|
79082
|
+
}; // CWBI-13636 Limit Map Extent
|
|
79073
79083
|
|
|
79074
|
-
|
|
79084
|
+
if (extent) {
|
|
79085
|
+
viewParams.extent = extent;
|
|
79086
|
+
}
|
|
79087
|
+
var view = new View(viewParams);
|
|
79075
79088
|
var map = new Map$3({
|
|
79076
79089
|
controls: [new ScaleLine({
|
|
79077
79090
|
units: "us"
|
|
@@ -79181,6 +79194,12 @@ var createOlMapBundle = (function (opts) {
|
|
|
79181
79194
|
});
|
|
79182
79195
|
};
|
|
79183
79196
|
},
|
|
79197
|
+
// doLimitMapExtent: (value) => ({ dispatch, store }) => {
|
|
79198
|
+
// dispatch({
|
|
79199
|
+
// type: "MAP_SET_LIMIT_EXTENT",
|
|
79200
|
+
// payload: { limitExtent: value, shouldResetViewState: true },
|
|
79201
|
+
// });
|
|
79202
|
+
// },
|
|
79184
79203
|
selectMap: function selectMap(state) {
|
|
79185
79204
|
return state.map.map;
|
|
79186
79205
|
},
|
|
@@ -104870,7 +104889,9 @@ var mapViewBundle = {
|
|
|
104870
104889
|
action: null,
|
|
104871
104890
|
updating: false,
|
|
104872
104891
|
listening: false,
|
|
104873
|
-
shouldUpdateZoom: false
|
|
104892
|
+
shouldUpdateZoom: false // horse: true,
|
|
104893
|
+
// limitMapExtent: true,
|
|
104894
|
+
|
|
104874
104895
|
};
|
|
104875
104896
|
return function () {
|
|
104876
104897
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialData;
|
|
@@ -104942,7 +104963,8 @@ var mapViewBundle = {
|
|
|
104942
104963
|
pitch: 0,
|
|
104943
104964
|
roll: 0,
|
|
104944
104965
|
minZoom: d.minzoom ? d.minzoom : 0,
|
|
104945
|
-
maxZoom: d.maxzoom ? d.maxzoom : 22
|
|
104966
|
+
maxZoom: d.maxzoom ? d.maxzoom : 22 // limitMapExtent: d.limitMapExtent ? d.limitMapExtent : false,
|
|
104967
|
+
|
|
104946
104968
|
};
|
|
104947
104969
|
dispatch({
|
|
104948
104970
|
type: "VIEW_SET_DEFAULTS",
|
|
@@ -106485,7 +106507,7 @@ var config = {
|
|
|
106485
106507
|
};
|
|
106486
106508
|
|
|
106487
106509
|
var name = "@corpsmap/corpsmap";
|
|
106488
|
-
var version$1 = "3.1.
|
|
106510
|
+
var version$1 = "3.1.3";
|
|
106489
106511
|
var description = "CorpsMap as React Components";
|
|
106490
106512
|
var main = "index.js";
|
|
106491
106513
|
var scripts = {
|
|
@@ -106638,7 +106660,8 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
106638
106660
|
height = _this$props.height,
|
|
106639
106661
|
theme = _this$props.theme,
|
|
106640
106662
|
themeNavSize = _this$props.themeNavSize,
|
|
106641
|
-
basemaps = _this$props.basemaps
|
|
106663
|
+
basemaps = _this$props.basemaps,
|
|
106664
|
+
limitMapExtent = _this$props.limitMapExtent;
|
|
106642
106665
|
cache.getAll().then(function (initialData) {
|
|
106643
106666
|
initialData.config = {
|
|
106644
106667
|
"default": Object.assign({}, config, mapConfig)
|
|
@@ -106666,6 +106689,10 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
106666
106689
|
};
|
|
106667
106690
|
}
|
|
106668
106691
|
|
|
106692
|
+
if (limitMapExtent) {
|
|
106693
|
+
initialData.config["default"].limitMapExtent = limitMapExtent;
|
|
106694
|
+
}
|
|
106695
|
+
|
|
106669
106696
|
var store = getStore(initialData);
|
|
106670
106697
|
loadPlugins(store, plugins);
|
|
106671
106698
|
window.internalStore = store;
|
package/lib/prod.js
CHANGED
|
@@ -738,20 +738,21 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
738
738
|
value: function componentDidMount() {
|
|
739
739
|
var _this$props = this.props,
|
|
740
740
|
doMapInitialize = _this$props.doMapInitialize,
|
|
741
|
-
viewState = _this$props.viewState
|
|
741
|
+
viewState = _this$props.viewState,
|
|
742
|
+
limitMapExtent = _this$props.limitMapExtent;
|
|
742
743
|
var center = viewState.center,
|
|
743
744
|
zoom = viewState.zoom,
|
|
744
745
|
rotation = viewState.rotation,
|
|
745
746
|
minZoom = viewState.minZoom,
|
|
746
747
|
maxZoom = viewState.maxZoom;
|
|
747
|
-
console.log(center);
|
|
748
748
|
doMapInitialize(this.mapEl, {
|
|
749
749
|
center: center,
|
|
750
750
|
zoom: zoom,
|
|
751
751
|
rotation: rotation,
|
|
752
752
|
minZoom: minZoom,
|
|
753
753
|
maxZoom: maxZoom,
|
|
754
|
-
layers: []
|
|
754
|
+
layers: [],
|
|
755
|
+
limitMapExtent: limitMapExtent
|
|
755
756
|
}); // doAddMapDragDropListeners(this.mapEl);
|
|
756
757
|
}
|
|
757
758
|
}, {
|
|
@@ -784,7 +785,7 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
784
785
|
return Map;
|
|
785
786
|
}(React$1__default.Component);
|
|
786
787
|
|
|
787
|
-
var Map$2 = connect('doMapInitialize', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
|
|
788
|
+
var Map$2 = connect('doMapInitialize', 'selectLimitMapExtent', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
|
|
788
789
|
|
|
789
790
|
var NorthRegion = /*#__PURE__*/function (_React$Component) {
|
|
790
791
|
_inherits(NorthRegion, _React$Component);
|
|
@@ -4488,6 +4489,9 @@ var configBundle = {
|
|
|
4488
4489
|
},
|
|
4489
4490
|
selectDefaultLayers: function selectDefaultLayers(state) {
|
|
4490
4491
|
return state.config["default"].datasets;
|
|
4492
|
+
},
|
|
4493
|
+
selectLimitMapExtent: function selectLimitMapExtent(state) {
|
|
4494
|
+
return state.config["default"].limitMapExtent;
|
|
4491
4495
|
}
|
|
4492
4496
|
};
|
|
4493
4497
|
|
|
@@ -65201,7 +65205,8 @@ function getXyzSource(options) {
|
|
|
65201
65205
|
maxZoom: options.maxzoom,
|
|
65202
65206
|
minZoom: options.minzoom,
|
|
65203
65207
|
url: url,
|
|
65204
|
-
crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
|
|
65208
|
+
crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
|
|
65209
|
+
// Line may no longer be needed.
|
|
65205
65210
|
// wrapX: false,
|
|
65206
65211
|
|
|
65207
65212
|
});
|
|
@@ -65297,7 +65302,8 @@ function getEsriVectorSource(options) {
|
|
|
65297
65302
|
}
|
|
65298
65303
|
|
|
65299
65304
|
function getTileLayer(options, source) {
|
|
65300
|
-
// CWBI-13636 Prevent horizontal wrapping.
|
|
65305
|
+
// CWBI-13636 Prevent horizontal wrapping.
|
|
65306
|
+
// Line may no longer be needed.
|
|
65301
65307
|
// source.wrapX = false;
|
|
65302
65308
|
return new TileLayer({
|
|
65303
65309
|
source: source,
|
|
@@ -65310,7 +65316,8 @@ function getTileLayer(options, source) {
|
|
|
65310
65316
|
}
|
|
65311
65317
|
|
|
65312
65318
|
function getImageLayer(options, source) {
|
|
65313
|
-
// CWBI-13636 Prevent horizontal wrapping.
|
|
65319
|
+
// CWBI-13636 Prevent horizontal wrapping.
|
|
65320
|
+
// Line may no longer be needed.
|
|
65314
65321
|
// source.wrapX = false;
|
|
65315
65322
|
return new ImageLayer({
|
|
65316
65323
|
source: source,
|
|
@@ -78918,7 +78925,8 @@ var createOlMapBundle = (function (opts) {
|
|
|
78918
78925
|
rotation: 0,
|
|
78919
78926
|
minZoom: 0,
|
|
78920
78927
|
maxZoom: 22,
|
|
78921
|
-
addons: {}
|
|
78928
|
+
addons: {},
|
|
78929
|
+
limitMapExtent: false
|
|
78922
78930
|
};
|
|
78923
78931
|
var config = Object.assign({}, defaults, opts);
|
|
78924
78932
|
return Object.assign({}, {
|
|
@@ -78934,6 +78942,7 @@ var createOlMapBundle = (function (opts) {
|
|
|
78934
78942
|
rotation: config.rotation,
|
|
78935
78943
|
minZoom: config.minZoom,
|
|
78936
78944
|
maxZoom: config.maxZoom,
|
|
78945
|
+
limitMapExtent: config.limitMapExtent,
|
|
78937
78946
|
shouldInitialize: false,
|
|
78938
78947
|
shouldResetViewState: false,
|
|
78939
78948
|
shouldUpdateViewState: false
|
|
@@ -78968,24 +78977,28 @@ var createOlMapBundle = (function (opts) {
|
|
|
78968
78977
|
var dispatch = _ref2.dispatch,
|
|
78969
78978
|
store = _ref2.store;
|
|
78970
78979
|
var geoProjection = store.selectMapGeoProjection();
|
|
78971
|
-
var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
|
|
78972
|
-
// const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
|
|
78980
|
+
var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
|
|
78973
78981
|
|
|
78982
|
+
var limitMapExtent = opts.hasOwnProperty("limitMapExtent") ? opts.limitMapExtent : null;
|
|
78983
|
+
var extent = limitMapExtent ? transformExtent([-180, -85, 180, 85], geoProjection, webProjection) : null;
|
|
78974
78984
|
var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
|
|
78975
78985
|
var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
|
|
78976
78986
|
var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
|
|
78977
78987
|
var minZoom = opts.hasOwnProperty("minZoom") ? opts.minZoom : store.selectMapMinZoom();
|
|
78978
78988
|
var maxZoom = opts.hasOwnProperty("maxZoom") ? opts.maxZoom : store.selectMapMaxZoom();
|
|
78979
78989
|
console.log("setting up at", opts.center, center);
|
|
78980
|
-
var
|
|
78990
|
+
var viewParams = {
|
|
78981
78991
|
center: transform(center, geoProjection, webProjection),
|
|
78982
78992
|
zoom: zoom,
|
|
78983
78993
|
rotation: rotation,
|
|
78984
78994
|
minZoom: minZoom,
|
|
78985
|
-
maxZoom: maxZoom
|
|
78986
|
-
|
|
78995
|
+
maxZoom: maxZoom
|
|
78996
|
+
}; // CWBI-13636 Limit Map Extent
|
|
78987
78997
|
|
|
78988
|
-
|
|
78998
|
+
if (extent) {
|
|
78999
|
+
viewParams.extent = extent;
|
|
79000
|
+
}
|
|
79001
|
+
var view = new View(viewParams);
|
|
78989
79002
|
var map = new Map$3({
|
|
78990
79003
|
controls: [new ScaleLine({
|
|
78991
79004
|
units: "us"
|
|
@@ -79095,6 +79108,12 @@ var createOlMapBundle = (function (opts) {
|
|
|
79095
79108
|
});
|
|
79096
79109
|
};
|
|
79097
79110
|
},
|
|
79111
|
+
// doLimitMapExtent: (value) => ({ dispatch, store }) => {
|
|
79112
|
+
// dispatch({
|
|
79113
|
+
// type: "MAP_SET_LIMIT_EXTENT",
|
|
79114
|
+
// payload: { limitExtent: value, shouldResetViewState: true },
|
|
79115
|
+
// });
|
|
79116
|
+
// },
|
|
79098
79117
|
selectMap: function selectMap(state) {
|
|
79099
79118
|
return state.map.map;
|
|
79100
79119
|
},
|
|
@@ -104784,7 +104803,9 @@ var mapViewBundle = {
|
|
|
104784
104803
|
action: null,
|
|
104785
104804
|
updating: false,
|
|
104786
104805
|
listening: false,
|
|
104787
|
-
shouldUpdateZoom: false
|
|
104806
|
+
shouldUpdateZoom: false // horse: true,
|
|
104807
|
+
// limitMapExtent: true,
|
|
104808
|
+
|
|
104788
104809
|
};
|
|
104789
104810
|
return function () {
|
|
104790
104811
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialData;
|
|
@@ -104856,7 +104877,8 @@ var mapViewBundle = {
|
|
|
104856
104877
|
pitch: 0,
|
|
104857
104878
|
roll: 0,
|
|
104858
104879
|
minZoom: d.minzoom ? d.minzoom : 0,
|
|
104859
|
-
maxZoom: d.maxzoom ? d.maxzoom : 22
|
|
104880
|
+
maxZoom: d.maxzoom ? d.maxzoom : 22 // limitMapExtent: d.limitMapExtent ? d.limitMapExtent : false,
|
|
104881
|
+
|
|
104860
104882
|
};
|
|
104861
104883
|
dispatch({
|
|
104862
104884
|
type: "VIEW_SET_DEFAULTS",
|
|
@@ -106399,7 +106421,7 @@ var config = {
|
|
|
106399
106421
|
};
|
|
106400
106422
|
|
|
106401
106423
|
var name = "@corpsmap/corpsmap";
|
|
106402
|
-
var version$1 = "3.1.
|
|
106424
|
+
var version$1 = "3.1.3";
|
|
106403
106425
|
var description = "CorpsMap as React Components";
|
|
106404
106426
|
var main = "index.js";
|
|
106405
106427
|
var scripts = {
|
|
@@ -106552,7 +106574,8 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
106552
106574
|
height = _this$props.height,
|
|
106553
106575
|
theme = _this$props.theme,
|
|
106554
106576
|
themeNavSize = _this$props.themeNavSize,
|
|
106555
|
-
basemaps = _this$props.basemaps
|
|
106577
|
+
basemaps = _this$props.basemaps,
|
|
106578
|
+
limitMapExtent = _this$props.limitMapExtent;
|
|
106556
106579
|
cache.getAll().then(function (initialData) {
|
|
106557
106580
|
initialData.config = {
|
|
106558
106581
|
"default": Object.assign({}, config, mapConfig)
|
|
@@ -106580,6 +106603,10 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
106580
106603
|
};
|
|
106581
106604
|
}
|
|
106582
106605
|
|
|
106606
|
+
if (limitMapExtent) {
|
|
106607
|
+
initialData.config["default"].limitMapExtent = limitMapExtent;
|
|
106608
|
+
}
|
|
106609
|
+
|
|
106583
106610
|
var store = getStore(initialData);
|
|
106584
106611
|
loadPlugins(store, plugins);
|
|
106585
106612
|
window.internalStore = store;
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ export default {
|
|
|
6
6
|
const initialData = {
|
|
7
7
|
default:{}
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
return (state = initialData, { type, payload }) => {
|
|
11
10
|
return state;
|
|
12
11
|
}
|
|
@@ -26,5 +25,10 @@ export default {
|
|
|
26
25
|
|
|
27
26
|
selectDefaultLayers: (state) => {
|
|
28
27
|
return state.config.default.datasets;
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
selectLimitMapExtent: (state) => {
|
|
31
|
+
return state.config.default.limitMapExtent;
|
|
29
32
|
}
|
|
33
|
+
|
|
30
34
|
}
|
|
@@ -16,8 +16,9 @@ export default (opts) => {
|
|
|
16
16
|
minZoom: 0,
|
|
17
17
|
maxZoom: 22,
|
|
18
18
|
addons: {},
|
|
19
|
+
limitMapExtent: false,
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
const config = Object.assign({}, defaults, opts);
|
|
22
23
|
|
|
23
24
|
return Object.assign(
|
|
@@ -36,6 +37,7 @@ export default (opts) => {
|
|
|
36
37
|
rotation: config.rotation,
|
|
37
38
|
minZoom: config.minZoom,
|
|
38
39
|
maxZoom: config.maxZoom,
|
|
40
|
+
limitMapExtent: config.limitMapExtent,
|
|
39
41
|
shouldInitialize: false,
|
|
40
42
|
shouldResetViewState: false,
|
|
41
43
|
shouldUpdateViewState: false,
|
|
@@ -63,8 +65,13 @@ export default (opts) => {
|
|
|
63
65
|
doMapInitialize: (el, opts) => ({ dispatch, store }) => {
|
|
64
66
|
const geoProjection = store.selectMapGeoProjection();
|
|
65
67
|
const webProjection = store.selectMapWebProjection();
|
|
66
|
-
// CWBI-13636 Limit Map Extent
|
|
67
|
-
|
|
68
|
+
// CWBI-13636 Limit Map Extent
|
|
69
|
+
const limitMapExtent = opts.hasOwnProperty("limitMapExtent")
|
|
70
|
+
? opts.limitMapExtent
|
|
71
|
+
: null;
|
|
72
|
+
const extent = limitMapExtent
|
|
73
|
+
? transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
|
|
74
|
+
: null;
|
|
68
75
|
const center = opts.hasOwnProperty("center")
|
|
69
76
|
? opts.center
|
|
70
77
|
: store.selectMapCenter();
|
|
@@ -81,17 +88,21 @@ export default (opts) => {
|
|
|
81
88
|
? opts.maxZoom
|
|
82
89
|
: store.selectMapMaxZoom();
|
|
83
90
|
|
|
91
|
+
|
|
84
92
|
console.log("setting up at", opts.center, center);
|
|
85
93
|
|
|
86
|
-
const
|
|
94
|
+
const viewParams = {
|
|
87
95
|
center: transform(center, geoProjection, webProjection),
|
|
88
96
|
zoom: zoom,
|
|
89
97
|
rotation: rotation,
|
|
90
98
|
minZoom: minZoom,
|
|
91
99
|
maxZoom: maxZoom,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// CWBI-13636 Limit Map Extent
|
|
103
|
+
if (extent) { viewParams.extent = extent };
|
|
104
|
+
|
|
105
|
+
const view = new View(viewParams);
|
|
95
106
|
|
|
96
107
|
const map = new olMap({
|
|
97
108
|
controls: [new ScaleBar({ units: "us" })],
|
|
@@ -169,7 +180,7 @@ export default (opts) => {
|
|
|
169
180
|
200
|
|
170
181
|
);
|
|
171
182
|
},
|
|
172
|
-
|
|
183
|
+
|
|
173
184
|
doMapZoomTo: (lonLat, z) => ({ store }) => {
|
|
174
185
|
const map = store.selectMap();
|
|
175
186
|
const view = map.getView();
|
|
@@ -179,6 +190,13 @@ export default (opts) => {
|
|
|
179
190
|
});
|
|
180
191
|
},
|
|
181
192
|
|
|
193
|
+
// doLimitMapExtent: (value) => ({ dispatch, store }) => {
|
|
194
|
+
// dispatch({
|
|
195
|
+
// type: "MAP_SET_LIMIT_EXTENT",
|
|
196
|
+
// payload: { limitExtent: value, shouldResetViewState: true },
|
|
197
|
+
// });
|
|
198
|
+
// },
|
|
199
|
+
|
|
182
200
|
selectMap: (state) => {
|
|
183
201
|
return state.map.map;
|
|
184
202
|
},
|