forked from simwrapper/simwrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Add AequilibraE support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
0da2c8e
Initial commit, re-target npm deploy and change tagline
tomstephen bcf3f60
Stop the deploy command trying (and failing) to set relative paths. D…
tomstephen 4111886
misc splash page reformatting
tomstephen 64aeb01
add aeq plugin, copied from xml viewer
tomstephen 3bf93e2
Add to plugin repo
tomstephen 92ac3d9
Flesh out reader.vue, add file system to extend http fs
tomstephen bfcfeb9
Clean up sqlite calls
tomstephen 002d84c
update templates, config access, add yaml parsing, etc
tomstephen 60dfa8f
Successfully reading tables from spatialite database
tomstephen ab746f9
remove comment
tomstephen 5630df1
Complete architecture for dashboards etc
tomstephen fbe8332
refine dashboard functionality
tomstephen 3ff2fd3
Remote hosted demo
tomstephen fc324e9
hit s3 bucket files, not the aws console
tomstephen 8e9823f
Extend file system to support S3
tomstephen dbf1a86
Drop custom map component, use the existing one
tomstephen cddbb9e
.
tomstephen 2f3f9cc
Trim comments
tomstephen d9ab411
Refactor
tomstephen 61ea651
Add style by param
tomstephen 165746b
Map centering and zoom
tomstephen ad6bb26
Adds ability to join another (results) database
tomstephen 0b5490c
many small fixes
tomstephen 56caa30
Revert irrelevant changes
tomstephen 10b294a
Dont track changes to package-lock.json, bloating PR
tomstephen ca717dc
Did that last one wrong
tomstephen 3ac4c54
Revert changes to scripts in package.json
tomstephen c499cad
drop erroneous notes
tomstephen 935ac4c
Refactor of styling
tomstephen 37cac33
stop tracking changes on package-lock.json
tomstephen dd767fe
.
tomstephen acfe7dd
Scaling by meters/pixels options
tomstephen ef9e36a
Main .vue refactor
tomstephen ab5b885
tweaks
tomstephen 37c5383
Add dataRange to colours
tomstephen 7ea39c7
Add ability to filter sql query from yaml
tomstephen b632dc3
Fix map resize bug
tomstephen 16bbdd8
Manually defined legends
tomstephen b6896dc
.
tomstephen ead28f1
Fix S3 support for panels opening webworkers
tomstephen 5031d56
revert changes to tile.vue
tomstephen 5994627
Remove localhost from datasources on splash
tomstephen 97e5c7a
add manual linewidths to styling
tomstephen 4472d1f
Fix basemap and uncolour tiles
tomstephen 8eb53a0
style tweaking in tile panel, plotly now supports fixed axis
tomstephen 5e3ccbe
Meter or pixels for radius units
tomstephen 23f42c3
Removed dark-matter, use internal options
tomstephen 04d1677
Linting
tomstephen 808e3cb
Drop dark matter
tomstephen 0d843d7
rounding out styling, more careful loading and memory management, doc…
tomstephen b20fbeb
Cleaning, add sqlfilter to joined db
tomstephen 6a3811b
cache database loading
tomstephen e7b334d
Refactoring
tomstephen ea2de21
Compacting code
tomstephen 12d362d
Apply suggestions from code review
tomstephen afda3d1
Refactor aequlibrae plugin to sqlite-map to generalise
tomstephen 5aca220
resolve merge
tomstephen d260879
sqlite-map: avoid caching remote DBs; clear join-data cache and expor…
tomstephen 1528703
sqlite-map: re-enable DB caching for all paths; deck: honor initialVi…
tomstephen 7cc344f
revert: undo DeckMapComponent.vue edits (restore previous behavior)
tomstephen 8c1c7bc
refactoring, fixes to zoom. Issue with caching
tomstephen 69a3fea
More refactoring
tomstephen 5660709
Init. commit adding POLARIS features
tomstephen 39ccaf5
Drop polaris again, extend db.ts for some better generality
tomstephen 2367e05
Tom/extend tile panel (#4)
tomstephen 174abfd
Revert erroneous changes
tomstephen 60e3568
Cleaning, renaming
tomstephen cad550a
Refactoring sqlite-map, mostly styling
tomstephen 2a651de
.
tomstephen 4eb8fcc
Linting
tomstephen 6318a64
Move docs out of comments
tomstephen 1d94c35
rename to aequilibrae-map
tomstephen 4d78432
Tidy, replace filesystem with default
tomstephen 29781ab
Rename map 'readers' to 'mapComponents'
tomstephen ec15521
Fix legend
tomstephen 38dce3f
Refactor
tomstephen cdddcbf
.
tomstephen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <template lang="pug"> | ||
| aeq-reader.aeq-panel( | ||
| :root="fileSystemConfig.slug" | ||
| :subfolder="subfolder" | ||
| :config="config" | ||
| :thumbnail="false" | ||
| @isLoaded="isLoaded" | ||
| @error="$emit('error', $event)" | ||
| ) | ||
|
|
||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { defineComponent } from 'vue' | ||
| import type { PropType } from 'vue' | ||
|
|
||
| import AeqReader from '@/plugins/aequilibrae-map/AequilibraEMapComponent.vue' | ||
|
|
||
| export default defineComponent({ | ||
| name: 'AequilibraEMapPanel', | ||
| components: { AeqReader }, | ||
| props: { | ||
| config: Object, | ||
| datamanager: Object, | ||
| fileSystemConfig: Object, | ||
| subfolder: String, | ||
| yamlConfig: String, | ||
| }, | ||
| methods: { | ||
| isLoaded() { | ||
| this.$emit('isLoaded') | ||
| }, | ||
| }, | ||
| }) | ||
| </script> | ||
|
|
||
| <style scoped lang="scss"> | ||
| @import '@/styles.scss'; | ||
|
|
||
| .aeq-panel { | ||
| position: absolute; | ||
| top: 0; | ||
| bottom: 0; | ||
| left: 0; | ||
| right: 0; | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,10 +1,14 @@ | ||||
| <template lang="pug"> | ||||
| .content | ||||
| .tiles-container(v-if="imagesAreLoaded") | ||||
| .tile(v-for="(value, index) in this.dataSet.data" v-bind:style="{ 'background-color': colors[index % colors.length]}" @click="") | ||||
| .tile( | ||||
| v-for="(value, index) in this.dataSet.data" | ||||
| :style="getTileStyle(index)" | ||||
| @click="" | ||||
| ) | ||||
| a(:href="value[urlIndex]" target="_blank" :class="{ 'is-not-clickable': !value[urlIndex] }") | ||||
| p.tile-title {{ value[tileNameIndex] }} | ||||
| p.tile-value {{ value[tileValueIndex] }} | ||||
| p.tile-title(:style="{ color: tileTextColor }") {{ value[tileNameIndex] }} | ||||
| p.tile-value(:style="{ color: tileTextColor }") {{ value[tileValueIndex] }} | ||||
| .tile-image(v-if="value[tileImageIndex] != undefined && checkIfItIsACustomIcon(value[tileImageIndex])" :style="{'background': base64Images[index], 'background-size': 'contain'}") | ||||
| img.tile-image(v-else-if="value[tileImageIndex] != undefined && checkIfIconIsInAssetsFolder(value[tileImageIndex])" v-bind:src="getLocalImage(value[tileImageIndex].trim())" :style="{'background': ''}") | ||||
| font-awesome-icon.tile-image(v-else-if="value[tileImageIndex] != undefined" :icon="value[tileImageIndex].trim()" size="2xl" :style="{'background': '', 'color': 'black'}") | ||||
|
|
@@ -22,9 +26,53 @@ import HTTPFileSystem from '@/js/HTTPFileSystem' | |||
| import globalStore from '@/store' | ||||
| import { arrayBufferToBase64 } from '@/js/util' | ||||
| import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | ||||
| import { openDb } from '@/plugins/sqlite-map/db' | ||||
| import { initSql } from '@/plugins/sqlite-map/loader' | ||||
| import { loadDbWithCache } from '@/plugins/sqlite-map/helpers' | ||||
|
|
||||
| const BASE_URL = import.meta.env.BASE_URL | ||||
|
|
||||
| // color palette options | ||||
| const PALETTE_PASTEL = [ | ||||
| '#F08080', // Light coral pink | ||||
| '#FFB6C1', // Pale pink | ||||
| '#FFDAB9', // peach | ||||
| '#FFECB3', // cream yellow | ||||
| '#B0E0E6', // light blue | ||||
| '#98FB98', // light green | ||||
| '#FFD700', // golden yellow | ||||
| '#FFA07A', // salmon pink | ||||
| '#E0FFFF', // light turquoise | ||||
| '#FFDAB9', // pink | ||||
| '#FFC0CB', // pink | ||||
| '#FFA500', // orange | ||||
| '#FF8C00', // dark orange | ||||
| '#FF7F50', // coral red | ||||
| '#FFE4B5', // papaya | ||||
| '#ADD8E6', // light blue | ||||
| '#90EE90', // light green | ||||
| '#FFD700', // golden yellow | ||||
| '#FFC0CB', // pink | ||||
| '#FFA500', // Orange | ||||
| ] | ||||
|
|
||||
| const PALETTE_VIVID = [ | ||||
| '#FF006E', // Vivid Pink | ||||
| '#FB5607', // Vivid Orange | ||||
| '#FFBE0B', // Vivid Yellow | ||||
| '#8338EC', // Vivid Purple | ||||
| '#3A86FF', // Vivid Blue | ||||
| '#06FFA5', // Vivid Green | ||||
| '#FF4365', // Vivid Red | ||||
| '#00D9FF', // Vivid Cyan | ||||
| '#FF1493', // Vivid Deep Pink | ||||
| '#FF8C00', // Vivid Deep Orange | ||||
| ] | ||||
|
|
||||
| const PALETTE_MONOCHROME = [ | ||||
| '#f7f7fe', // Light gray | ||||
| ] | ||||
|
|
||||
| export default defineComponent({ | ||||
| name: 'Tile', | ||||
| components: { FontAwesomeIcon }, | ||||
|
|
@@ -44,29 +92,9 @@ export default defineComponent({ | |||
| // dataSet is either x,y or allRows[] | ||||
| dataSet: {} as { data?: any; x?: any[]; y?: any[]; allRows?: any }, | ||||
| YAMLrequirementsOverview: { dataset: '' }, | ||||
| colors: [ | ||||
| '#F08080', // Light coral pink | ||||
| '#FFB6C1', // Pale pink | ||||
| '#FFDAB9', // peach | ||||
| '#FFECB3', // cream yellow | ||||
| '#B0E0E6', // light blue | ||||
| '#98FB98', // light green | ||||
| '#FFD700', // golden yellow | ||||
| '#FFA07A', // salmon pink | ||||
| '#E0FFFF', // light turquoise | ||||
| '#FFDAB9', // pink | ||||
| '#FFC0CB', // pink | ||||
| '#FFA500', // orange | ||||
| '#FF8C00', // dark orange | ||||
| '#FF7F50', // coral red | ||||
| '#FFE4B5', // papaya | ||||
| '#ADD8E6', // light blue | ||||
| '#90EE90', // light green | ||||
| '#FFD700', // golden yellow | ||||
| '#FFC0CB', // pink | ||||
| '#FFA500', // Orange | ||||
| ], | ||||
| colors: PALETTE_PASTEL, | ||||
| colorsD3: [ | ||||
| // TODO: remove? Is this being used? | ||||
| '#1F77B4', | ||||
| '#FF7F0E', | ||||
| '#2CA02C', | ||||
|
|
@@ -117,10 +145,29 @@ export default defineComponent({ | |||
| fileApi(): HTTPFileSystem { | ||||
| return new HTTPFileSystem(this.fileSystemConfig, globalStore) | ||||
| }, | ||||
| tileBorderColor(): string { | ||||
| return this.globalState.isDarkMode ? '#fff' : '#000' | ||||
| }, | ||||
| tileTextColor(): string { | ||||
| return this.globalState.isDarkMode ? '#fff' : '#363636' | ||||
| }, | ||||
| }, | ||||
| async mounted() { | ||||
| this.dataSet = await this.loadFile() | ||||
| this.validateDataSet() | ||||
| // Set color palette from config if specified, otherwise default to pastel | ||||
| if (this.config.colors) { | ||||
| const paletteKey = this.config.colors.toLowerCase() | ||||
| if (paletteKey === 'vivid') { | ||||
| this.colors = PALETTE_VIVID | ||||
| } else if (paletteKey === 'monochrome') { | ||||
| this.colors = PALETTE_MONOCHROME | ||||
| } else { | ||||
| // Default to pastel for any other value or unrecognized palette | ||||
| this.colors = PALETTE_PASTEL | ||||
| } | ||||
| } | ||||
|
|
||||
| this.dataSet = await this.buildDataset() | ||||
| // this.validateDataSet() | ||||
| await this.loadImages() | ||||
| this.$emit('isLoaded') | ||||
| console.log(this.dataSet) | ||||
|
|
@@ -191,6 +238,79 @@ export default defineComponent({ | |||
| return [] | ||||
| }, | ||||
|
|
||||
| async getDataFromSQLQuery( | ||||
| database: string, | ||||
| query: string, | ||||
| singleValue = true, | ||||
| titleColumn = 'metric', | ||||
| valueColumn = 'value' | ||||
| ) { | ||||
| try { | ||||
| const trimmedQuery = query.trim() | ||||
| // open a sqlite connection | ||||
| const spl = await initSql() | ||||
| // connect to database | ||||
| const db = await loadDbWithCache(spl, this.fileApi, openDb, database) | ||||
| // run query and return result | ||||
| if (singleValue) { | ||||
| const queryResult = await db.exec(trimmedQuery).get.first | ||||
| return queryResult | ||||
| } else { | ||||
| const queryResult = await db.exec(trimmedQuery).get.objs | ||||
| const results = [] | ||||
| for (const obj of queryResult) { | ||||
| results.push([obj[titleColumn], obj[valueColumn]]) // table columns default to 'metric' and 'value' | ||||
| } | ||||
| return results | ||||
| } | ||||
| } catch (e) { | ||||
| console.error('' + e) | ||||
| this.$emit('error', 'Error querying database: ' + database) | ||||
| } | ||||
| return { data: [] } | ||||
| }, | ||||
|
|
||||
| async buildDataset() { | ||||
| // Datasets can be defined in a handful of ways. | ||||
| // If `dataset` value is a string, it's a .csv to load. | ||||
| if (typeof this.config.dataset === 'string') { | ||||
| return await this.loadFile() | ||||
| } | ||||
| // It can be database & sql query | ||||
| if (this.config.dataset.database && this.config.dataset.query) { | ||||
| return { | ||||
| data: await this.getDataFromSQLQuery( | ||||
| this.config.dataset.database, | ||||
| this.config.dataset.query, | ||||
| false, | ||||
| this.config.dataset.titleCol || 'metric', | ||||
| this.config.dataset.valueCol || 'value' | ||||
| ), | ||||
| } | ||||
| } | ||||
| // Otherwise it's a list of key-value pairs. | ||||
| // Values can either be static or be a database & sql query returning a single value. | ||||
| if (Array.isArray(this.config.dataset)) { | ||||
| const data: any[] = await Promise.all( | ||||
| this.config.dataset.map(async (item: any) => { | ||||
| const key = item.key | ||||
| const row: any[] = [] | ||||
| row.push(key) | ||||
| // if the database/query are defined | ||||
| if (item.value?.database && item.value?.query) { | ||||
| const result = await this.getDataFromSQLQuery(item.value.database, item.value.query) | ||||
| row.push(result) | ||||
| } else { | ||||
| // otherwise it's a static value | ||||
| row.push(item.value) | ||||
| } | ||||
| return row | ||||
| }) | ||||
| ) | ||||
| return { data: data } | ||||
| } | ||||
| }, | ||||
|
|
||||
| validateYAML() { | ||||
| for (const key in this.YAMLrequirementsOverview) { | ||||
| if (key in this.config === false) { | ||||
|
|
@@ -227,6 +347,14 @@ export default defineComponent({ | |||
| } | ||||
| return false | ||||
| }, | ||||
|
|
||||
| getTileStyle(index: number) { | ||||
| return { | ||||
| 'background-color': this.colors[index % this.colors.length], | ||||
| border: '1px solid ' + this.tileBorderColor, | ||||
| color: this.tileTextColor, | ||||
| } | ||||
| }, | ||||
| }, | ||||
| }) | ||||
| </script> | ||||
|
|
@@ -277,13 +405,13 @@ export default defineComponent({ | |||
| padding: 20px; | ||||
| min-width: 250px; | ||||
| font-family: $fancyFont; | ||||
| border-color: v-bind(tileBorderColor); | ||||
| } | ||||
|
|
||||
| .tile .tile-value { | ||||
| font-size: 2rem; | ||||
| font-size: 3rem; | ||||
| font-weight: bold; | ||||
| width: 100%; | ||||
| color: #363636; // var(--text) but always the color from the light mode. | ||||
| grid-column-start: 2; | ||||
| grid-column-end: 4; | ||||
| text-align: center; | ||||
|
|
@@ -292,10 +420,9 @@ export default defineComponent({ | |||
|
|
||||
| .tile .tile-title { | ||||
| width: 100%; | ||||
| font-size: 1.4rem; | ||||
| height: 5rem; | ||||
| font-size: 2.5rem; | ||||
| // height: 3.5rem; | ||||
|
||||
| // height: 3.5rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.