Interactive interface for browsing global, full-resolution satellite imagery
Output custom vector styles and legends into sidebar settings
ZachTRice2c88c1da7028
diff --git a/config/default/common/vectorstyles/OrbitTracks_Calipso_Ascending.json b/config/default/common/vectorstyles/OrbitTracks_Calipso_Ascending.jsonindex 958cabb20..d10bbd743 100644--- a/config/default/common/vectorstyles/OrbitTracks_Calipso_Ascending.json+++ b/config/default/common/vectorstyles/OrbitTracks_Calipso_Ascending.json@@ -12,6 +12,7 @@"layers": [{"id": "OrbitTracks_Calipso_Ascending",+ "source-description": "Default","source": "OrbitTracks_Calipso_Ascending","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -22,6 +23,7 @@},{"id": "OrbitTracks_Calipso_Ascending",+ "source-description": "Default","source": "OrbitTracks_Calipso_Ascending","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -32,6 +34,7 @@},{"id": "OrbitTracks_Calipso_Ascending",+ "source-description": "Default","source": "OrbitTracks_Calipso_Ascending","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -51,6 +54,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow1",+ "source-description": "yellow 1","source": "OrbitTracks_Calipso_Ascending_yellow1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -61,6 +65,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow1",+ "source-description": "yellow 1","source": "OrbitTracks_Calipso_Ascending_yellow1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -71,6 +76,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow1",+ "source-description": "yellow 1","source": "OrbitTracks_Calipso_Ascending_yellow1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -90,6 +96,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow2",+ "source-description": "yellow 2","source": "OrbitTracks_Calipso_Ascending_yellow2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -100,6 +107,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow2",+ "source-description": "yellow 2","source": "OrbitTracks_Calipso_Ascending_yellow2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -110,6 +118,7 @@},{"id": "OrbitTracks_Calipso_Ascending_yellow2",+ "source-description": "yellow 2","source": "OrbitTracks_Calipso_Ascending_yellow2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -129,6 +138,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange1",+ "source-description": "orange 1","source": "OrbitTracks_Calipso_Ascending_orange1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -139,6 +149,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange1",+ "source-description": "orange 1","source": "OrbitTracks_Calipso_Ascending_orange1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -149,6 +160,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange1",+ "source-description": "orange 1","source": "OrbitTracks_Calipso_Ascending_orange1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -168,6 +180,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange2",+ "source-description": "orange 2","source": "OrbitTracks_Calipso_Ascending_orange2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -178,6 +191,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange2",+ "source-description": "orange 2","source": "OrbitTracks_Calipso_Ascending_orange2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -188,6 +202,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange2",+ "source-description": "orange 2","source": "OrbitTracks_Calipso_Ascending_orange2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -207,6 +222,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange3",+ "source-description": "orange 3","source": "OrbitTracks_Calipso_Ascending_orange3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -217,6 +233,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange3",+ "source-description": "orange 3","source": "OrbitTracks_Calipso_Ascending_orange3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -227,6 +244,7 @@},{"id": "OrbitTracks_Calipso_Ascending_orange3",+ "source-description": "orange 3","source": "OrbitTracks_Calipso_Ascending_orange3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -246,6 +264,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red1",+ "source-description": "red 1","source": "OrbitTracks_Calipso_Ascending_red1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -256,6 +275,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red1",+ "source-description": "red 1","source": "OrbitTracks_Calipso_Ascending_red1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -266,6 +286,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red1",+ "source-description": "red 1","source": "OrbitTracks_Calipso_Ascending_red1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -285,6 +306,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red2",+ "source-description": "red 2","source": "OrbitTracks_Calipso_Ascending_red2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -295,6 +317,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red2",+ "source-description": "red 2","source": "OrbitTracks_Calipso_Ascending_red2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -305,6 +328,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red2",+ "source-description": "red 2","source": "OrbitTracks_Calipso_Ascending_red2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -324,6 +348,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red3",+ "source-description": "red 3","source": "OrbitTracks_Calipso_Ascending_red3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -334,6 +359,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red3",+ "source-description": "red 3","source": "OrbitTracks_Calipso_Ascending_red3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -344,6 +370,7 @@},{"id": "OrbitTracks_Calipso_Ascending_red3",+ "source-description": "red 3","source": "OrbitTracks_Calipso_Ascending_red3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -363,6 +390,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink1",+ "source-description": "pink 1","source": "OrbitTracks_Calipso_Ascending_pink1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -373,6 +401,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink1",+ "source-description": "pink 1","source": "OrbitTracks_Calipso_Ascending_pink1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -383,6 +412,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink1",+ "source-description": "pink 1","source": "OrbitTracks_Calipso_Ascending_pink1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -402,6 +432,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink2",+ "source-description": "pink 2","source": "OrbitTracks_Calipso_Ascending_pink2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -412,6 +443,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink2",+ "source-description": "pink 2","source": "OrbitTracks_Calipso_Ascending_pink2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -422,6 +454,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink2",+ "source-description": "pink 2","source": "OrbitTracks_Calipso_Ascending_pink2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -441,6 +474,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink3",+ "source-description": "pink 3","source": "OrbitTracks_Calipso_Ascending_pink3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -451,6 +485,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink3",+ "source-description": "pink 3","source": "OrbitTracks_Calipso_Ascending_pink3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -461,6 +496,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink3",+ "source-description": "pink 3","source": "OrbitTracks_Calipso_Ascending_pink3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -480,6 +516,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink4",+ "source-description": "pink 4","source": "OrbitTracks_Calipso_Ascending_pink4","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -490,6 +527,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink4",+ "source-description": "pink 4","source": "OrbitTracks_Calipso_Ascending_pink4","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -500,6 +538,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink4",+ "source-description": "pink 4","source": "OrbitTracks_Calipso_Ascending_pink4","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -519,6 +558,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink5",+ "source-description": "pink 5","source": "OrbitTracks_Calipso_Ascending_pink5","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -529,6 +569,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink5",+ "source-description": "pink 5","source": "OrbitTracks_Calipso_Ascending_pink5","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -539,6 +580,7 @@},{"id": "OrbitTracks_Calipso_Ascending_pink5",+ "source-description": "pink 5","source": "OrbitTracks_Calipso_Ascending_pink5","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -558,6 +600,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple1",+ "source-description": "purple 1","source": "OrbitTracks_Calipso_Ascending_purple1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -568,6 +611,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple1",+ "source-description": "purple 1","source": "OrbitTracks_Calipso_Ascending_purple1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -578,6 +622,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple1",+ "source-description": "purple 1","source": "OrbitTracks_Calipso_Ascending_purple1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -597,6 +642,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple2",+ "source-description": "purple 2","source": "OrbitTracks_Calipso_Ascending_purple2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -607,6 +653,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple2",+ "source-description": "purple 2","source": "OrbitTracks_Calipso_Ascending_purple2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -617,6 +664,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple2",+ "source-description": "purple 2","source": "OrbitTracks_Calipso_Ascending_purple2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -636,6 +684,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple3",+ "source-description": "purple 3","source": "OrbitTracks_Calipso_Ascending_purple3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -646,6 +695,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple3",+ "source-description": "purple 3","source": "OrbitTracks_Calipso_Ascending_purple3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -656,6 +706,7 @@},{"id": "OrbitTracks_Calipso_Ascending_purple3",+ "source-description": "purple 3","source": "OrbitTracks_Calipso_Ascending_purple3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -675,6 +726,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue1",+ "source-description": "blue 1","source": "OrbitTracks_Calipso_Ascending_blue1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -685,6 +737,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue1",+ "source-description": "blue 1","source": "OrbitTracks_Calipso_Ascending_blue1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -695,6 +748,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue1",+ "source-description": "blue 1","source": "OrbitTracks_Calipso_Ascending_blue1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -714,6 +768,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue2",+ "source-description": "blue 2","source": "OrbitTracks_Calipso_Ascending_blue2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -724,6 +779,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue2",+ "source-description": "blue 2","source": "OrbitTracks_Calipso_Ascending_blue2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -734,6 +790,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue2",+ "source-description": "blue 2","source": "OrbitTracks_Calipso_Ascending_blue2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -753,6 +810,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue3",+ "source-description": "blue 3","source": "OrbitTracks_Calipso_Ascending_blue3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -763,6 +821,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue3",+ "source-description": "blue 3","source": "OrbitTracks_Calipso_Ascending_blue3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -773,6 +832,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue3",+ "source-description": "blue 3","source": "OrbitTracks_Calipso_Ascending_blue3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -792,6 +852,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue4",+ "source-description": "blue 4","source": "OrbitTracks_Calipso_Ascending_blue4","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -802,6 +863,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue4",+ "source-description": "blue 4","source": "OrbitTracks_Calipso_Ascending_blue4","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -812,6 +874,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue4",+ "source-description": "blue 4","source": "OrbitTracks_Calipso_Ascending_blue4","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -831,6 +894,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue5",+ "source-description": "blue 5","source": "OrbitTracks_Calipso_Ascending_blue5","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -841,6 +905,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue5",+ "source-description": "blue 5","source": "OrbitTracks_Calipso_Ascending_blue5","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -851,6 +916,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue5",+ "source-description": "blue 5","source": "OrbitTracks_Calipso_Ascending_blue5","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -870,6 +936,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue6",+ "source-description": "blue 6","source": "OrbitTracks_Calipso_Ascending_blue6","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -880,6 +947,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue6",+ "source-description": "blue 6","source": "OrbitTracks_Calipso_Ascending_blue6","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -890,6 +958,7 @@},{"id": "OrbitTracks_Calipso_Ascending_blue6",+ "source-description": "blue 6","source": "OrbitTracks_Calipso_Ascending_blue6","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -909,6 +978,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown1",+ "source-description": "brown 1","source": "OrbitTracks_Calipso_Ascending_brown1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -919,6 +989,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown1",+ "source-description": "brown 1","source": "OrbitTracks_Calipso_Ascending_brown1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -929,6 +1000,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown1",+ "source-description": "brown 1","source": "OrbitTracks_Calipso_Ascending_brown1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -948,6 +1020,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown2",+ "source-description": "brown 2","source": "OrbitTracks_Calipso_Ascending_brown2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -958,6 +1031,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown2",+ "source-description": "brown 2","source": "OrbitTracks_Calipso_Ascending_brown2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -968,6 +1042,7 @@},{"id": "OrbitTracks_Calipso_Ascending_brown2",+ "source-description": "brown 2","source": "OrbitTracks_Calipso_Ascending_brown2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -987,6 +1062,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green1",+ "source-description": "green 1","source": "OrbitTracks_Calipso_Ascending_green1","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -997,6 +1073,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green1",+ "source-description": "green 1","source": "OrbitTracks_Calipso_Ascending_green1","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -1007,6 +1084,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green1",+ "source-description": "green 1","source": "OrbitTracks_Calipso_Ascending_green1","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -1026,6 +1104,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green2",+ "source-description": "green 2","source": "OrbitTracks_Calipso_Ascending_green2","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -1036,6 +1115,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green2",+ "source-description": "green 2","source": "OrbitTracks_Calipso_Ascending_green2","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -1046,6 +1126,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green2",+ "source-description": "green 2","source": "OrbitTracks_Calipso_Ascending_green2","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",@@ -1065,6 +1146,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green3",+ "source-description": "green 3","source": "OrbitTracks_Calipso_Ascending_green3","source-layer": "OrbitTracks_Calipso_Ascending","type": "line",@@ -1075,6 +1157,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green3",+ "source-description": "green 3","source": "OrbitTracks_Calipso_Ascending_green3","source-layer": "OrbitTracks_Calipso_Ascending","type": "circle",@@ -1085,6 +1168,7 @@},{"id": "OrbitTracks_Calipso_Ascending_green3",+ "source-description": "green 3","source": "OrbitTracks_Calipso_Ascending_green3","source-layer": "OrbitTracks_Calipso_Ascending","type": "symbol",diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.jsindex 3fec1aa14..afe728a73 100644--- a/web/js/components/layer/settings/settings.js+++ b/web/js/components/layer/settings/settings.js@@ -214,7 +214,8 @@ class LayerSettings extends React.Component {const {setFilterRange,groupName,- layer+ layer,+ vectorStyles} = this.props;// const vectorStyle = getVectorStyle(layer.id, 0);const max = 100; // Placeholder@@ -236,11 +237,12 @@ class LayerSettings extends React.Component {index={0}/><VectorStyle- setStyle={''}- clearStyle={''}- activeVectorStyle={'default_style'}+ setStyle={setStyle}+ clearStyle={clearStyle}+ activeVectorStyle={layer.id}layer={layer}index={0}+ vectorStyles={vectorStyles}/></React.Fragment>);@@ -306,7 +308,8 @@ function mapStateToProps(state, ownProps) {},getVectorStyle: (layerId, index) => {return getVectorStyle(layerId, index, groupName, state);- }+ },+ vectorStyles: config.vectorStyles};}const mapDispatchToProps = dispatch => ({diff --git a/web/js/components/layer/settings/vector-style.js b/web/js/components/layer/settings/vector-style.jsindex 7218a1e94..4b6bfd1c4 100644--- a/web/js/components/layer/settings/vector-style.js+++ b/web/js/components/layer/settings/vector-style.js@@ -1,7 +1,5 @@import React from 'react';import PropTypes from 'prop-types';-import lodashIndexOf from 'lodash/indexOf';-import util from '../../../util/util';import Scrollbar from '../../util/scrollbar';class VectorStyleSelect extends React.Component {@@ -12,21 +10,6 @@ class VectorStyleSelect extends React.Component {};}- /**- * Render default legend option- */- renderDefault() {- const { layer, index, getDefaultLegend } = this.props;- const { activeVectorStyle } = this.state;- // const legend = getDefaultLegend(layer.id, index);-- return this.renderSelectorItemSingle(- undefined, // should pass vectorStyles here- 'default_style',- 'Default',- activeVectorStyle === 'default_style'- );- }/*** Pass palette to model after selection* @param {String} id | custom VectorStyle Id@@ -38,7 +21,7 @@ class VectorStyleSelect extends React.Component {// it looks more natural to make this async// instead of waitingsetTimeout(function() {- if (id === 'default_style') {+ if (id === layer) {clearStyle(layer.id, index);} else {setStyle(layer.id, id, index);@@ -50,29 +33,17 @@ class VectorStyleSelect extends React.Component {* Apply logic to render correct palette selection* @param {String} id | Legend Id*/- // customLegend(id) {- // const {- // getDefaultLegend,- // getCustomVectorStyle,- // layer,- // index- // // palettesTranslate- // } = this.props;- // const { activeVectorStyle } = this.state;- // var source = getDefaultLegend(layer.id, index);- // var target = getCustomVectorStyle(id);- // var targetType =- // target.colors.length === 1 ? 'classification' : 'continuous';+ customLegend(styleLayerObject) {+ const { activeVectorStyle } = this.state;+ var description = styleLayerObject['source-description'] || styleLayerObject.id;- // if (source.type === 'classification' && targetType === 'classification') {- // return this.renderSelectorItemSingle(- // target,- // id,- // target.name,- // activeVectorStyle === target.id- // );- // }- // }+ return this.renderSelectorItemSingle(+ styleLayerObject,+ styleLayerObject.id,+ description,+ activeVectorStyle === styleLayerObject.id+ );+ }/*** Render classification customs when there is only one@@ -83,9 +54,9 @@ class VectorStyleSelect extends React.Component {* @param {Boolean} isSelected | is this colormap active*/renderSelectorItemSingle(vectorStyle, id, description, isSelected) {- // const color = palette.classes- // ? palette.classes.colors[0]- // : palette.colors[0];+ const color = vectorStyle.paint+ ? vectorStyle.paint['line-color'] || vectorStyle.paint['circle-color']+ : 'rgb(255, 255, 255)';const caseDefaultClassName ='wv-palette-selector-row wv-checkbox wv-checkbox-round gray ';const checkedClassName = isSelected ? 'checked' : '';@@ -100,6 +71,7 @@ class VectorStyleSelect extends React.Component {<label htmlFor={'wv-palette-radio-' + id}><spanclassName="wv-palettes-class"+ style={{ backgroundColor: color }}> </span>@@ -109,8 +81,17 @@ class VectorStyleSelect extends React.Component {);}render() {- const { index } = this.props;+ const { index, vectorStyles, layer } = this.props;+ var vectorStyleId = layer.vectorStyle.id;+ var vectorStyle = vectorStyles[vectorStyleId];+ var vectorStyleLayers = vectorStyle['layers'];+ var uniqueStyleLayers = vectorStyleLayers.filter(function (a) {+ if (!this[a.id]) {+ this[a.id] = true;+ return true;+ }+ }, Object.create(null));return (<divclassName="wv-palette-selector settings-component noselect"@@ -118,8 +99,15 @@ class VectorStyleSelect extends React.Component {><h2 className="wv-header">Vector Style</h2><Scrollbar style={{ maxHeight: '200px' }}>- {this.renderDefault()}- {/* Output Color Selects Here */}+ {uniqueStyleLayers.map(styleLayerObject => {+ // console.log(styleLayerObject);+ // if (lodashIndexOf(recommended, styleLayerObject) < 0) {+ if (styleLayerObject && styleLayerObject) {+ var item = this.customLegend(styleLayerObject);+ return item;+ }+ // }+ })}</Scrollbar></div>);@@ -133,10 +121,11 @@ VectorStyleSelect.propTypes = {paletteOrder: PropTypes.array,palettesTranslate: PropTypes.func,getDefaultLegend: PropTypes.func,- // getCustomVectorStyle: PropTypes.func,+ getCustomVectorStyle: PropTypes.func,canvas: PropTypes.object,checkerBoard: PropTypes.object,- activeVectorStyle: PropTypes.string+ activeVectorStyle: PropTypes.string,+ vectorStyles: PropTypes.object};export default VectorStyleSelect;diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.jsindex e824aaf70..64472bbd3 100644--- a/web/js/map/layerbuilder.js+++ b/web/js/map/layerbuilder.js@@ -302,6 +302,7 @@ export function mapLayerBuilder(models, config, cache, mapUi, store) {* @returns {object} OpenLayers Vector layer*/var createLayerVector = function(def, options, day, state) {+ console.log(config);const { proj, compare } = state;var date, urlParameters, extent, source, matrixSet, matrixIds, start;const selectedProj = proj.selected;diff --git a/web/js/modules/vector-styles/actions.js b/web/js/modules/vector-styles/actions.jsindex 913f94097..0692572fa 100644--- a/web/js/modules/vector-styles/actions.js+++ b/web/js/modules/vector-styles/actions.js@@ -68,6 +68,7 @@ export function setFilterRange(layerId, props, index, groupName) {* @param {String} groupName | layer group string*/export function setStyle(layerId, vectorStyleId, index, groupName) {+ // console.log(layerId, vectorStyleId, index, groupName);return (dispatch, getState) => {const state = getState();const newActiveVectorStylesObj = setCustomSelector(@@ -95,6 +96,7 @@ export function setStyle(layerId, vectorStyleId, index, groupName) {* @param {String} groupName | layer group string*/export function clearStyle(layerId, index, groupName) {+ console.log(layerId, index, groupName)return (dispatch, getState) => {const { vectorStyles } = getState();const newActiveVectorStylesObj = clearCustomSelector(diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.jsindex 45a42b2ef..e8e7d868c 100644--- a/web/js/modules/vector-styles/selectors.js+++ b/web/js/modules/vector-styles/selectors.js@@ -2,7 +2,7 @@ import {get as lodashGet,isUndefined as lodashIsUndefined,each as lodashEach,- parseInt as lodashParseInt,+ // parseInt as lodashParseInt,cloneDeep as lodashCloneDeep} from 'lodash';import { getMinValue, getMaxValue } from './util';@@ -63,114 +63,114 @@ export function getCount(layerId, state) {// }// return vectorStyle;// }-var useLookup = function(layerId, vectorStylesObj, state) {- var use = false;- var active = vectorStylesObj[layerId].maps;+// var useLookup = function(layerId, vectorStylesObj, state) {+// var use = false;+// var active = vectorStylesObj[layerId].maps;- lodashEach(active, function(vectorStyle, index) {- if (vectorStyle.custom) {- use = true;- return false;- }- var rendered = getRenderedVectorStyle(layerId, index, state);- if (vectorStyle.type !== 'classification') {- if (vectorStyle.min <= 0) {- delete vectorStyle.min;- }- if (vectorStyle.max >= rendered.entries.values.length) {- delete vectorStyle.max;- }- if (!lodashIsUndefined(vectorStyle.min) || !lodashIsUndefined(vectorStyle.max)) {- use = true;- return false;- }- }- });- return use;-};+// lodashEach(active, function(vectorStyle, index) {+// if (vectorStyle.custom) {+// use = true;+// return false;+// }+// var rendered = getRenderedVectorStyle(layerId, index, state);+// if (vectorStyle.type !== 'classification') {+// if (vectorStyle.min <= 0) {+// delete vectorStyle.min;+// }+// if (vectorStyle.max >= rendered.entries.values.length) {+// delete vectorStyle.max;+// }+// if (!lodashIsUndefined(vectorStyle.min) || !lodashIsUndefined(vectorStyle.max)) {+// use = true;+// return false;+// }+// }+// });+// return use;+// };// Looks up options/colormaps/layer.xml colormap entryexport function getLookup(layerId, groupstr, state) {groupstr = groupstr || state.compare.activeString;return state.vectorStyles[groupstr][layerId].lookup;}-var updateLookup = function(layerId, vectorStylesObj, state) {- let newVectorStyles = vectorStylesObj;- if (!useLookup(layerId, newVectorStyles, state)) {- delete newVectorStyles[layerId];- return newVectorStyles;- }- var lookup = {};- var active = newVectorStyles[layerId].maps;- lodashEach(active, function(vectorStyle, index) {- var oldLegend = vectorStyle.legend;- var entries = vectorStyle.entries;- var legend = {- colors: [],- minLabel: oldLegend.minLabel,- maxLabel: oldLegend.maxLabel,- tooltips: oldLegend.tooltips,- units: oldLegend.units,- type: entries.type,- title: entries.title,- id: oldLegend.id- };- var source = entries.colors;- var target = vectorStyle.custom- ? getCustomVectorStyle(vectorStyle.custom, state.vectorStyles.custom).colors- : source;+// var updateLookup = function(layerId, vectorStylesObj, state) {+// let newVectorStyles = vectorStylesObj;+// if (!useLookup(layerId, newVectorStyles, state)) {+// delete newVectorStyles[layerId];+// return newVectorStyles;+// }+// var lookup = {};+// var active = newVectorStyles[layerId].maps;+// lodashEach(active, function(vectorStyle, index) {+// var oldLegend = vectorStyle.legend;+// var entries = vectorStyle.entries;+// var legend = {+// colors: [],+// minLabel: oldLegend.minLabel,+// maxLabel: oldLegend.maxLabel,+// tooltips: oldLegend.tooltips,+// units: oldLegend.units,+// type: entries.type,+// title: entries.title,+// id: oldLegend.id+// };+// var source = entries.colors;+// var target = vectorStyle.custom+// ? getCustomVectorStyle(vectorStyle.custom, state.vectorStyles.custom).colors+// : source;- var min = vectorStyle.min || 0;- var max = vectorStyle.max || source.length;+// var min = vectorStyle.min || 0;+// var max = vectorStyle.max || source.length;- var sourceCount = source.length;- var targetCount = target.length;- lodashEach(source, function(color, index) {- var targetColor;- if (index < min || index > max) {- targetColor = '00000000';- } else {- var sourcePercent, targetIndex;- if (vectorStyle.squash) {- sourcePercent = (index - min) / (max - min);- if (index === max) {- sourcePercent = 1.0;- }- targetIndex = Math.floor(sourcePercent * targetCount);- if (targetIndex >= targetCount) {- targetIndex = targetCount - 1;- }- } else {- sourcePercent = index / sourceCount;- targetIndex = Math.floor(sourcePercent * targetCount);- }- targetColor = target[targetIndex];- }- legend.colors.push(targetColor);- var lookupSource =- lodashParseInt(color.substring(0, 2), 16) +- ',' +- lodashParseInt(color.substring(2, 4), 16) +- ',' +- lodashParseInt(color.substring(4, 6), 16) +- ',' +- lodashParseInt(color.substring(6, 8), 16);- var lookupTarget = {- r: lodashParseInt(targetColor.substring(0, 2), 16),- g: lodashParseInt(targetColor.substring(2, 4), 16),- b: lodashParseInt(targetColor.substring(4, 6), 16),- a: lodashParseInt(targetColor.substring(6, 8), 16)- };- lookup[lookupSource] = lookupTarget;- });+// var sourceCount = source.length;+// var targetCount = target.length;+// lodashEach(source, function(color, index) {+// var targetColor;+// if (index < min || index > max) {+// targetColor = '00000000';+// } else {+// var sourcePercent, targetIndex;+// if (vectorStyle.squash) {+// sourcePercent = (index - min) / (max - min);+// if (index === max) {+// sourcePercent = 1.0;+// }+// targetIndex = Math.floor(sourcePercent * targetCount);+// if (targetIndex >= targetCount) {+// targetIndex = targetCount - 1;+// }+// } else {+// sourcePercent = index / sourceCount;+// targetIndex = Math.floor(sourcePercent * targetCount);+// }+// targetColor = target[targetIndex];+// }+// legend.colors.push(targetColor);+// var lookupSource =+// lodashParseInt(color.substring(0, 2), 16) ++// ',' ++// lodashParseInt(color.substring(2, 4), 16) ++// ',' ++// lodashParseInt(color.substring(4, 6), 16) ++// ',' ++// lodashParseInt(color.substring(6, 8), 16);+// var lookupTarget = {+// r: lodashParseInt(targetColor.substring(0, 2), 16),+// g: lodashParseInt(targetColor.substring(2, 4), 16),+// b: lodashParseInt(targetColor.substring(4, 6), 16),+// a: lodashParseInt(targetColor.substring(6, 8), 16)+// };+// lookup[lookupSource] = lookupTarget;+// });- newVectorStyles = update(newVectorStyles, {- [layerId]: {- maps: { [index]: { legend: { $set: legend } } }- }- });- });- return update(newVectorStyles, { [layerId]: { lookup: { $set: lookup } } });-};+// newVectorStyles = update(newVectorStyles, {+// [layerId]: {+// maps: { [index]: { legend: { $set: legend } } }+// }+// });+// });+// return update(newVectorStyles, { [layerId]: { lookup: { $set: lookup } } });+// };export function findIndex(layerId, type, value, index, groupStr, state) {index = index || 0;@@ -191,6 +191,7 @@ export function findIndex(layerId, type, value, index, groupStr, state) {return result;}export function setCustomSelector(layerId, vectorStyleId, index, groupName, state) {+ console.log(layerId, vectorStyleId, index, groupName, state);const { config, vectorStyles } = state;if (!config.layers[layerId]) {throw new Error('Invalid layer: ' + layerId);@@ -203,7 +204,7 @@ export function setCustomSelector(layerId, vectorStyleId, index, groupName, statreturn;}vectorStyle.custom = vectorStyleId;- return updateLookup(layerId, newVectorStyles, state);+ // return updateLookup(layerId, newVectorStyles, state);}export function getKey(layerId, groupStr, state) {groupStr = groupStr || state.compare.activeString;@@ -233,8 +234,8 @@ export function isActive(layerId, group, state) {export function setRange(layerId, props, index, vectorStyles, state) {let min = props.min;let max = props.max;- let squash = props.squash;- let newVectorStyles = prepare(layerId, vectorStyles, state);+ // let squash = props.squash;+ // let newVectorStyles = prepare(layerId, vectorStyles, state);index = lodashIsUndefined(index) ? 0 : index;if (min === 0) {min = undefined;@@ -249,21 +250,21 @@ export function setRange(layerId, props, index, vectorStyles, state) {}// Merge custom vectorStyle props with correct colormap- newVectorStyles = update(newVectorStyles, {- [layerId]: {- maps: {- [index]: {- $merge: {- max,- min,- squash- }- }- }- }- });+ // newVectorStyles = update(newVectorStyles, {+ // [layerId]: {+ // maps: {+ // [index]: {+ // $merge: {+ // max,+ // min,+ // squash+ // }+ // }+ // }+ // }+ // });- return updateLookup(layerId, newVectorStyles, state);+ // return updateLookup(layerId, newVectorStyles, state);}export function clearCustomSelector(layerId, index, vectorStyles) {index = lodashIsUndefined(index) ? 0 : index;