Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Remove unneeded utils and vector style warning

ZachTRicee0a1e567be18
diff --git a/web/js/location.js b/web/js/location.js
index 69f139957..0e0ed58eb 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -18,7 +18,6 @@ import { eventsReducerState } from './modules/natural-events/reducers';
import { mapLocationToPaletteState } from './modules/palettes/util';
import { mapLocationToAnimationState } from './modules/animation/util';
import { mapLocationToSidebarState } from './modules/sidebar/util';
-import { mapLocationToVectorStyleState } from './modules/vector-styles/util';
import util from './util/util';
import update from 'immutability-helper';
@@ -69,12 +68,6 @@ export const mapLocationToState = (state, location) => {
state,
config
);
- stateFromLocation = mapLocationToVectorStyleState(
- parameters,
- stateFromLocation,
- state,
- config
- );
// one level deep merge of newState with defaultState
for (var key in stateFromLocation) {
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index cc79f5da6..5678906e3 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -1,14 +1,6 @@
-import update from 'immutability-helper';
import {
- each as lodashEach,
assign as lodashAssign
} from 'lodash';
-import {
- setStyleFunction,
- getCount,
- setRange as setRangeSelector,
- findIndex as findVectorStyleExtremeIndex
-} from './selectors';
export function getVectorStyleAttributeArray(layer) {
var isCustomActive = false;
@@ -39,113 +31,3 @@ export function getVectorStyleAttributeArray(layer) {
});
return attrArray;
}
-
-export function loadVectorStyles(permlinkState, state) {
- var stateArray = [{ stateStr: 'l', groupStr: 'active' }];
- if (permlinkState.l1) {
- stateArray = [
- { stateStr: 'l', groupStr: 'active' },
- { stateStr: 'l1', groupStr: 'activeB' }
- ];
- }
- lodashEach(stateArray, stateObj => {
- lodashEach(state.layers[stateObj.groupStr], function(layerDef) {
- if (layerDef.vectorStyle) {
- var min = [];
- var max = [];
- var count = 0;
- // TODO this try block never works
- if (layerDef.custom && layerDef.custom[0]) {
- let vectorStyleId = layerDef.custom[0];
- try {
- let newVectorStyles = setStyleFunction(
- layerDef,
- vectorStyleId,
- state.vectorStyles.custom,
- stateObj.groupStr,
- state
- );
- state = update(state, {
- vectorStyles: { [stateObj.groupStr]: { $set: newVectorStyles } }
- });
- } catch (error) {
- console.warn(' Invalid vectorStyle: ' + vectorStyleId);
- }
- }
- if (layerDef.min) {
- lodashEach(layerDef.min, function(value, index) {
- try {
- min.push(
- findVectorStyleExtremeIndex(
- layerDef.id,
- 'min',
- value,
- index,
- stateObj.groupStr,
- state
- )
- );
- } catch (error) {
- console.warn('Unable to set min: ' + value);
- }
- });
- }
- if (layerDef.max) {
- lodashEach(layerDef.max, function(value, index) {
- try {
- max.push(
- findVectorStyleExtremeIndex(
- layerDef.id,
- 'max',
- value,
- index,
- stateObj.groupStr,
- state
- )
- );
- } catch (error) {
- console.warn('Unable to set max index: ' + value);
- }
- });
- }
-
- if (min.length > 0 || max.length > 0) {
- count = getCount(layerDef.id, state);
- for (var i = 0; i < count; i++) {
- var vmin = min.length > 0 ? min[i] : undefined;
- var vmax = max.length > 0 ? max[i] : undefined;
- let props = { min: vmin, max: vmax };
- let newVectorStyles = setRangeSelector(
- layerDef.id,
- props,
- i,
- state.vectorStyles[stateObj.groupStr],
- state
- );
- state = update(state, {
- vectorStyles: { [stateObj.groupStr]: { $set: newVectorStyles } }
- });
- }
- }
- }
- });
- });
- return state;
-}
-export function mapLocationToVectorStyleState(
- parameters,
- stateFromLocation,
- state,
- config
-) {
- if (parameters.l1 || parameters.l) {
- stateFromLocation = loadVectorStyles(
- parameters,
- lodashAssign({}, stateFromLocation, {
- vectorStyles: state.vectorStyles,
- config
- })
- );
- }
- return stateFromLocation;
-}