2015-06-09 22:24:29 +00:00
|
|
|
/*****************************************************************************
|
2017-04-05 21:35:12 +00:00
|
|
|
* Open MCT, Copyright (c) 2014-2017, United States Government
|
2015-06-09 22:24:29 +00:00
|
|
|
* as represented by the Administrator of the National Aeronautics and Space
|
|
|
|
* Administration. All rights reserved.
|
|
|
|
*
|
2016-07-12 23:21:58 +00:00
|
|
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
2015-06-09 22:24:29 +00:00
|
|
|
* "License"); you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
2016-07-12 23:21:58 +00:00
|
|
|
* Open MCT includes source code licensed under additional open source
|
2015-06-09 22:24:29 +00:00
|
|
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
|
|
* this source code distribution or the Licensing information page available
|
|
|
|
* at runtime from the About dialog for additional information.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-05-22 21:40:35 +00:00
|
|
|
define([
|
2015-06-09 22:24:29 +00:00
|
|
|
|
2017-05-22 21:40:35 +00:00
|
|
|
], function(
|
|
|
|
|
|
|
|
) {
|
|
|
|
function ImageryPlugin() {
|
|
|
|
|
|
|
|
var IMAGE_SAMPLES = [
|
2017-03-27 00:52:14 +00:00
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18733.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18734.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18735.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18736.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18737.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18738.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18739.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18740.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18741.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18742.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18743.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18744.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18745.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18746.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18747.jpg",
|
|
|
|
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
|
2017-05-22 21:40:35 +00:00
|
|
|
];
|
2017-03-27 00:52:14 +00:00
|
|
|
|
2017-05-22 21:40:35 +00:00
|
|
|
return function install(openmct) {
|
|
|
|
openmct.types.addType('example.imagery', {
|
|
|
|
key: 'example.imagery',
|
|
|
|
name: 'Example Imagery',
|
|
|
|
cssClass: 'icon-image',
|
|
|
|
description: 'For development use. Creates example imagery ' +
|
|
|
|
'data that mimics a live imagery stream.',
|
|
|
|
creatable: true,
|
|
|
|
initialize: function (object) {
|
|
|
|
object.telemetry = {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
name: 'Time',
|
2017-05-23 01:30:01 +00:00
|
|
|
key: 'utc',
|
2017-05-22 21:40:35 +00:00
|
|
|
format: 'utc',
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Image',
|
|
|
|
key: 'url',
|
|
|
|
format: 'image',
|
2017-05-23 01:30:01 +00:00
|
|
|
hints: {
|
|
|
|
image: 1
|
|
|
|
}
|
2017-05-22 21:40:35 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 22:24:29 +00:00
|
|
|
});
|
|
|
|
|
2017-05-22 21:40:35 +00:00
|
|
|
openmct.telemetry.addProvider({
|
|
|
|
supportsSubscribe: function (domainObject) {
|
|
|
|
return domainObject.type === 'example.imagery';
|
2015-06-09 22:24:29 +00:00
|
|
|
},
|
2017-05-22 21:40:35 +00:00
|
|
|
subscribe: function (domainObject, callback) {
|
|
|
|
var index = 0,
|
|
|
|
end = IMAGE_SAMPLES.length,
|
|
|
|
interval;
|
|
|
|
|
|
|
|
interval = setInterval(function () {
|
|
|
|
if (index >= end) {
|
|
|
|
index = 0;
|
|
|
|
}
|
|
|
|
callback({
|
2017-05-23 01:30:01 +00:00
|
|
|
utc: Date.now(),
|
2017-05-22 21:40:35 +00:00
|
|
|
url: IMAGE_SAMPLES[index]
|
|
|
|
});
|
|
|
|
index += 1;
|
2017-06-21 20:56:18 +00:00
|
|
|
}, 5000);
|
2015-06-09 22:24:29 +00:00
|
|
|
|
2017-05-22 21:40:35 +00:00
|
|
|
return function (interval) {
|
|
|
|
clearInterval(interval);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2015-06-09 22:24:29 +00:00
|
|
|
}
|
2017-05-22 21:40:35 +00:00
|
|
|
|
|
|
|
return ImageryPlugin;
|
|
|
|
});
|