mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 05:37:53 +00:00
[NIRVSS] Encode imagery metadata into image file names (#3759)
* [NIRVSS] Encode imagery metadata into image file names * added image name metadata to example.imagery plugin. Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
05f9202fe4
commit
0e80a5b8a0
1
API.md
1
API.md
@ -430,6 +430,7 @@ Known hints:
|
|||||||
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
||||||
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
||||||
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
||||||
|
* `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file.
|
||||||
|
|
||||||
##### The Time Conductor and Telemetry
|
##### The Time Conductor and Telemetry
|
||||||
|
|
||||||
|
@ -50,11 +50,16 @@ define([
|
|||||||
const IMAGE_DELAY = 20000;
|
const IMAGE_DELAY = 20000;
|
||||||
|
|
||||||
function pointForTimestamp(timestamp, name) {
|
function pointForTimestamp(timestamp, name) {
|
||||||
|
const url = IMAGE_SAMPLES[Math.floor(timestamp / IMAGE_DELAY) % IMAGE_SAMPLES.length];
|
||||||
|
const urlItems = url.split('/');
|
||||||
|
const imageDownloadName = `example.imagery.${urlItems[urlItems.length - 1]}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: name,
|
name,
|
||||||
utc: Math.floor(timestamp / IMAGE_DELAY) * IMAGE_DELAY,
|
utc: Math.floor(timestamp / IMAGE_DELAY) * IMAGE_DELAY,
|
||||||
local: Math.floor(timestamp / IMAGE_DELAY) * IMAGE_DELAY,
|
local: Math.floor(timestamp / IMAGE_DELAY) * IMAGE_DELAY,
|
||||||
url: IMAGE_SAMPLES[Math.floor(timestamp / IMAGE_DELAY) % IMAGE_SAMPLES.length]
|
url,
|
||||||
|
imageDownloadName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +144,14 @@ define([
|
|||||||
hints: {
|
hints: {
|
||||||
image: 1
|
image: 1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Image Download Name',
|
||||||
|
key: 'imageDownloadName',
|
||||||
|
format: 'imageDownloadName',
|
||||||
|
hints: {
|
||||||
|
imageDownloadName: 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -134,10 +134,15 @@
|
|||||||
class="c-imagery__thumb c-thumb"
|
class="c-imagery__thumb c-thumb"
|
||||||
:class="{ selected: focusedImageIndex === index && isPaused }"
|
:class="{ selected: focusedImageIndex === index && isPaused }"
|
||||||
@click="setFocusedImage(index, thumbnailClick)"
|
@click="setFocusedImage(index, thumbnailClick)"
|
||||||
|
>
|
||||||
|
<a href=""
|
||||||
|
:download="image.imageDownloadName"
|
||||||
|
@click.prevent
|
||||||
>
|
>
|
||||||
<img class="c-thumb__image"
|
<img class="c-thumb__image"
|
||||||
:src="image.url"
|
:src="image.url"
|
||||||
>
|
>
|
||||||
|
</a>
|
||||||
<div class="c-thumb__timestamp">{{ image.formattedTime }}</div>
|
<div class="c-thumb__timestamp">{{ image.formattedTime }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -218,6 +223,9 @@ export default {
|
|||||||
canTrackDuration() {
|
canTrackDuration() {
|
||||||
return this.openmct.time.clock() && this.timeSystem.isUTCBased;
|
return this.openmct.time.clock() && this.timeSystem.isUTCBased;
|
||||||
},
|
},
|
||||||
|
focusedImageDownloadName() {
|
||||||
|
return this.getImageDownloadName(this.focusedImage);
|
||||||
|
},
|
||||||
isNextDisabled() {
|
isNextDisabled() {
|
||||||
let disabled = false;
|
let disabled = false;
|
||||||
|
|
||||||
@ -345,6 +353,7 @@ export default {
|
|||||||
this.imageHints = { ...this.metadata.valuesForHints(['image'])[0] };
|
this.imageHints = { ...this.metadata.valuesForHints(['image'])[0] };
|
||||||
this.durationFormatter = this.getFormatter(this.timeSystem.durationFormat || DEFAULT_DURATION_FORMATTER);
|
this.durationFormatter = this.getFormatter(this.timeSystem.durationFormat || DEFAULT_DURATION_FORMATTER);
|
||||||
this.imageFormatter = this.openmct.telemetry.getValueFormatter(this.imageHints);
|
this.imageFormatter = this.openmct.telemetry.getValueFormatter(this.imageHints);
|
||||||
|
this.imageDownloadNameHints = { ...this.metadata.valuesForHints(['imageDownloadName'])[0]};
|
||||||
|
|
||||||
// related telemetry keys
|
// related telemetry keys
|
||||||
this.spacecraftPositionKeys = ['positionX', 'positionY', 'positionZ'];
|
this.spacecraftPositionKeys = ['positionX', 'positionY', 'positionZ'];
|
||||||
@ -532,6 +541,15 @@ export default {
|
|||||||
// Replace ISO "T" with a space to allow wrapping
|
// Replace ISO "T" with a space to allow wrapping
|
||||||
return dateTimeStr.replace("T", " ");
|
return dateTimeStr.replace("T", " ");
|
||||||
},
|
},
|
||||||
|
getImageDownloadName(datum) {
|
||||||
|
let imageDownloadName = '';
|
||||||
|
if (datum) {
|
||||||
|
const key = this.imageDownloadNameHints.key;
|
||||||
|
imageDownloadName = datum[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageDownloadName;
|
||||||
|
},
|
||||||
parseTime(datum) {
|
parseTime(datum) {
|
||||||
if (!datum) {
|
if (!datum) {
|
||||||
return;
|
return;
|
||||||
@ -655,6 +673,7 @@ export default {
|
|||||||
image.formattedTime = this.formatTime(datum);
|
image.formattedTime = this.formatTime(datum);
|
||||||
image.url = this.formatImageUrl(datum);
|
image.url = this.formatImageUrl(datum);
|
||||||
image.time = datum[this.timeKey];
|
image.time = datum[this.timeKey];
|
||||||
|
image.imageDownloadName = this.getImageDownloadName(datum);
|
||||||
|
|
||||||
this.imageHistory.push(image);
|
this.imageHistory.push(image);
|
||||||
|
|
||||||
@ -777,6 +796,9 @@ export default {
|
|||||||
this.focusedImageNaturalAspectRatio = undefined;
|
this.focusedImageNaturalAspectRatio = undefined;
|
||||||
|
|
||||||
const img = this.$refs.focusedImage;
|
const img = this.$refs.focusedImage;
|
||||||
|
if (!img) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO - should probably cache this
|
// TODO - should probably cache this
|
||||||
img.addEventListener('load', () => {
|
img.addEventListener('load', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user