earthtrek-core
Version:
Global Nominee NASA Space Apps Challenge 2017 Buenos Aires - Global Finalist (Best Use of Data) NASA Space Apps Challenge 2017 - 1D, 2D, 3D, Go! Challenge
80 lines (65 loc) • 6.56 kB
JavaScript
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* @class EarthTrekRightToolbar
* @module EarthTrek
* @author SATrek
* @author Alejandro Sanchez <alejandro.sanchez.trek@gmail.com>
* @description EarthTrek - 23 JUN 2017.
*/
var _earthtrekCore = require('../earthtrek-core');
var _earthtrekUtils = require('../utils/earthtrek-utils');
var _earthtrekUtils2 = _interopRequireDefault(_earthtrekUtils);
require('../../css/right-toolbar.css');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EarthTrekRightToolbar = function () {
function EarthTrekRightToolbar() {
_classCallCheck(this, EarthTrekRightToolbar);
}
_createClass(EarthTrekRightToolbar, null, [{
key: 'add',
/**
* Add Icon to the right toolbar
* @param className
* @param selected
*/
value: function add(className, selected, callback) {
var iconButton = document.createElement('button');
/* $(iconButton).append('<i class="fa fa-tag" aria-hidden="true"></i>');*/
$(iconButton).addClass('cesium-toolbar-button cesium-button');
$(iconButton).addClass(className);
if (selected == true) {
$(iconButton).addClass('selected');
}
if (callback != undefined) {
$(iconButton).click(function (e) {
callback(iconButton);
});
}
$('.cesium-viewer-toolbar').append(iconButton);
}
/**
* Add Layer
* @param layer
* @param className
* @param selected
*/
}, {
key: 'addToogleLayer',
value: function addToogleLayer(layer, className, selected) {
layer.time = _earthtrekUtils2.default.getCurrentIsoDate();
(0, _earthtrekCore.earthTrekInstance)().getLayers().add(layer);
EarthTrekRightToolbar.add(className, selected, function (iconButton) {
(0, _earthtrekCore.earthTrekInstance)().getLayers().toggle(layer, function (show) {
if (show == true) {
$(iconButton).addClass('selected');
} else {
$(iconButton).removeClass('selected');
}
});
});
}
}]);
return EarthTrekRightToolbar;
}();
module.exports = EarthTrekRightToolbar;