Skip to content

Commit

Permalink
updating default selection, add TVA inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
BryonLewis committed Feb 7, 2025
1 parent 1054b10 commit 1362fcc
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 50 deletions.
95 changes: 47 additions & 48 deletions client/src/components/LayerTypeConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,53 @@ export default defineComponent({
</span>
</v-col>
</v-row>
<v-row
v-if="actionItemVisible.has('selectColor')"
dense
align="center"
justify="center"
>
<v-col cols="2">
<v-tooltip text="Selected Color">
<template #activator="{ props }">
<v-icon
class="pl-3"
v-bind="props"
>
mdi-format-color-highlight
</v-icon>
</template>
</v-tooltip>
</v-col>
<v-col cols="8">
<v-icon @click="updateLayerTypeField('selectColor', !valueDisplayCheckbox('selectColor'))">
{{
valueDisplayCheckbox('selectColor') ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline' }}
</v-icon>
<span class="pl-2">Select Color</span>
</v-col>
<v-col>
<v-menu
:close-on-content-click="false"
offset-y
>
<template #activator="{ props }">
<div
v-if="currentLayerType && currentLayerType.selectColor"
class="color-square"
:style="{ backgroundColor: currentLayerType.selectColor }"
v-bind="props"
/>
</template>
<v-color-picker
v-if="currentLayerType"
mode="hex"
:model-value="currentLayerType.selectColor"
@update:model-value="updateSelectColor('selectColor', $event)"
/>
</v-menu>
</v-col>
</v-row>
<v-row
v-if="actionItemVisible.has('hoverable')"
dense
Expand Down Expand Up @@ -429,54 +476,6 @@ export default defineComponent({
/>
</v-col>
</v-row>

<v-row
v-if="actionItemVisible.has('selectColor')"
dense
align="center"
justify="center"
>
<v-col cols="2">
<v-tooltip text="Selected Color">
<template #activator="{ props }">
<v-icon
class="pl-3"
v-bind="props"
>
mdi-format-color-highlight
</v-icon>
</template>
</v-tooltip>
</v-col>
<v-col cols="8">
<v-icon @click="updateLayerTypeField('selectColor', !valueDisplayCheckbox('selectColor'))">
{{
valueDisplayCheckbox('selectColor') ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline' }}
</v-icon>
<span class="pl-2">Select Color</span>
</v-col>
<v-col>
<v-menu
:close-on-content-click="false"
offset-y
>
<template #activator="{ props }">
<div
v-if="currentLayerType && currentLayerType.selectColor"
class="color-square"
:style="{ backgroundColor: currentLayerType.selectColor }"
v-bind="props"
/>
</template>
<v-color-picker
v-if="currentLayerType"
mode="hex"
:model-value="currentLayerType.selectColor"
@update:model-value="updateSelectColor('selectColor', $event)"
/>
</v-menu>
</v-col>
</v-row>
<v-row
v-if="actionItemVisible.has('color')"
dense
Expand Down
30 changes: 28 additions & 2 deletions sample_data/tva.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
{
"type": "Context",
"name": "Hydro Stations",
"name": "TVA Hydro Stations",
"default_map_center": [
34.8019,
-86.1794
Expand All @@ -78,12 +78,38 @@
{
"path": "./data/tva/hydrostations.geojson",
"url": "https://data.kitware.com/api/v1/file/67a4f4e27dbb9df48b660b37/download",
"name": "TVA Water Boundaries",
"name": "TVA Hydro Stations",
"type": "geojson",
"metadata": {}
}
]
}
]
},
{
"type": "Context",
"name": "Input/Outputs",
"default_map_center": [
34.8019,
-86.1794
],
"default_map_zoom": 6,
"datasets": [
{
"name": "Input/Outputs",
"description": "DIVERS-H Input/Outputs",
"category": "raster",
"metadata": {},
"files": [
{
"path": "./data/tva/atmosperic_input_output.tiff",
"url": "https://data.kitware.com/api/v1/file/67a620ba091a514e82eec87c/download",
"name": "Atm Water Supply 2020-2040 diff",
"type": "tif",
"metadata": {}
}
]
}
]
}
]
12 changes: 12 additions & 0 deletions uvdat/core/tasks/map_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ def calculate_styling(geojson_data, style_options):
updated_style_options['layers']['fill'] = {'enabled': True, 'color': '#888888'}
if has_render_height:
updated_style_options['layers']['fill-extrusion'] = {'enabled': True, 'color': '#CCCCCC'}
# make the largest geometry type single selectable with the selectColor being cyan
enabled = [layer for layer, options in updated_style_options['layers'].items() if options['enabled']]

for layer in ['fill-extrusion', 'fill', 'line']:
if layer in enabled:
updated_style_options['layers'][layer]['selectColor'] = '#00FFFF'
updated_style_options['layers'][layer]['selectable'] = 'singleSelect'
break
if 'circle' in enabled:
updated_style_options['layers']['circle']['selectColor'] = '#00FFFF'
updated_style_options['layers']['circle']['selectable'] = 'singleSelect'

return updated_style_options


Expand Down

0 comments on commit 1362fcc

Please sign in to comment.