Hillshade selection working

pull/746/head
Piero Toffanin 2019-11-26 13:39:05 -05:00
rodzic 510c177a95
commit d32bd20468
2 zmienionych plików z 32 dodań i 9 usunięć

Wyświetl plik

@ -138,18 +138,21 @@ class Metadata(TaskNestedView):
info = main.metadata(raster_path, pmin=pmin, pmax=pmax, histogram_bins=255, expr=expr) info = main.metadata(raster_path, pmin=pmin, pmax=pmax, histogram_bins=255, expr=expr)
cmap_labels = { cmap_labels = {
'jet_r': 'Jet', "jet_r": "Jet",
"terrain_r": "Terrain", "terrain_r": "Terrain",
"rdylgn": "Index", "gist_earth_r": "Earth",
"spectral_r": "Spectral", "rdylgn": "RdYlGn",
"rdylgn_r": "RdYlGn (Reverse)",
"spectral": "Spectral",
"spectral_r": "Spectral (Reverse)",
"pastel1_r": "Pastel", "pastel1_r": "Pastel",
} }
colormaps = [] colormaps = []
if tile_type in ['dsm', 'dtm']: if tile_type in ['dsm', 'dtm']:
colormaps = ['jet_r', 'terrain_r', 'spectral_r', 'pastel1_r'] colormaps = ['jet_r', 'terrain_r', 'gist_earth_r', 'pastel1_r']
elif formula and bands: elif formula and bands:
colormaps = ['rdylgn'] colormaps = ['rdylgn', 'spectral', 'rdylgn_r', 'spectral_r']
info['algorithms'] = get_algorithm_list(), info['algorithms'] = get_algorithm_list(),
info['filters'] = get_camera_filters_list() info['filters'] = get_camera_filters_list()
@ -231,7 +234,7 @@ class Tiles(TaskNestedView):
if bands == '': bands = None if bands == '': bands = None
if rescale == '': rescale = None if rescale == '': rescale = None
if color_map == '': color_map = None if color_map == '': color_map = None
if hillshade == '': hillshade = None if hillshade == '' or hillshade == '0': hillshade = None
expr = lookup_formula(formula, bands) expr = lookup_formula(formula, bands)

Wyświetl plik

@ -35,7 +35,7 @@ export default class LayersControlLayer extends React.Component {
hillshade: params.hillshade || "", hillshade: params.hillshade || "",
}; };
this.rescale = ""; this.rescale = params.rescale || "";
} }
getLayerUrl = () => { getLayerUrl = () => {
@ -52,6 +52,10 @@ export default class LayersControlLayer extends React.Component {
this.map.removeLayer(layer); this.map.removeLayer(layer);
} }
} }
if (prevState.hillshade !== this.state.hillshade){
this.updateLayer();
}
} }
handleLayerClick = () => { handleLayerClick = () => {
@ -63,6 +67,10 @@ export default class LayersControlLayer extends React.Component {
this.setState({colorMap: e.target.value}); this.setState({colorMap: e.target.value});
} }
handleSelectHillshade = e => {
this.setState({hillshade: e.target.value});
}
updateLayer = () => { updateLayer = () => {
if (this.updateTimer){ if (this.updateTimer){
clearTimeout(this.updateTimer); clearTimeout(this.updateTimer);
@ -81,7 +89,7 @@ export default class LayersControlLayer extends React.Component {
formula, formula,
bands, bands,
hillshade, hillshade,
rescale: encodeURIComponent(this.rescale) rescale: this.rescale
}); });
const { layer } = this.props; const { layer } = this.props;
@ -102,7 +110,7 @@ export default class LayersControlLayer extends React.Component {
} }
render(){ render(){
const { colorMap } = this.state; const { colorMap, hillshade } = this.state;
const { meta, tmeta } = this; const { meta, tmeta } = this;
const { color_maps } = tmeta; const { color_maps } = tmeta;
@ -131,6 +139,18 @@ export default class LayersControlLayer extends React.Component {
</select> </select>
</div> </div>
</div> : ""} </div> : ""}
{hillshade !== "" ?
<div className="row form-group form-inline">
<label className="col-sm-3 control-label">Shading:</label>
<div className="col-sm-9 ">
<select className="form-control" value={hillshade} onChange={this.handleSelectHillshade}>
<option value="0">None</option>
<option value="1">Normal</option>
<option value="3">Extruded</option>
</select>
</div>
</div> : ""}
</div> </div>
: ""} : ""}
</div>); </div>);