body {
/*Account for the height of the navbar component*/
padding-top: 3.5rem;
}
/*Sets the size and style of the globe container*/
.globe {
width: 100%;
height: calc(100vh - 3.5rem);
background-color: black;
}
/*Sets the position of a container displayed over the globe container*/
.globe-overlay {
position: absolute;
width: 100%;
top: 3.5rem;
}
Sets the background color of Cards displayed over the globe .globe-card {
background: rgba(255, 255, 255, 0.7);
}
/*When the modal fills the screen it has no margin on top and bottom*/
/*Centers the modal*/
.modal-dialog {
margin: 0 auto;
}
/*Sets the maximum height of the entire modal to 100% of the screen height*/
.modal-content {
max-height: 100vh;
}
/*Sets the maximum height of the modal body to 90% of the screen height*/
.modal-body {
max-height: 90vh;
}
/*Sets the height of a modal's canvas to 30% or 200px*/
.modal-body-canvas {
max-height: 200px;
height: 30vh;
}
/*Sets the height of a modal's canvas to 60% minus the height of a footer*/
.modal-body-table {
max-height: calc(60vh - 71px);
overflow-y: auto;
}
/* Prevents an element, like a <div/> from consuming user input */
.noninteractive {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
pointer-events: none;
}
/* Allows an element to receive user input */
/* Useful if a parent element is using .noniteractive */
.interactive {
-webkit-touch-callout: auto !important;
-webkit-user-select: auto !important;
-khtml-user-select: auto !important;
-moz-user-select: auto !important;
-ms-user-select: auto !important;
-o-user-select: auto !important;
pointer-events: auto !important;
}
JavaScript
$(document).ready(function() {
"use strict";
/**
* The Globe encapsulates the WorldWindow object (wwd) and provides application
* specific logic for interacting with layers.
* @param {String} canvasId The ID of the canvas element that will host the globe
* @returns {Globe}
*/
class Globe {
constructor(canvasId) {
// Create a WorldWindow globe on the specified HTML5 canvas
this.wwd = new WorldWind.WorldWindow(canvasId);
// Holds the next unique id to be assigned to a layer
this.nextLayerId = 1;
// Add a BMNGOneImageLayer background layer. We're overriding the default
// minimum altitude of the BMNGOneImageLayer so this layer always available.
this.addLayer(new WorldWind.BMNGOneImageLayer(), {
category: "background",
minActiveAltitude: 0
});
}
/**
* Adds a layer to the globe. Applies the optional options' properties to the
* layer, and assigns the layer a unique ID and category.
* @param {WorldWind.Layer} layer
* @param {Object|null} options E.g., {category: "base", enabled: true}
*/
addLayer(layer, options) {
// Copy all properties defined on the options object to the layer
if (options) {
for (let prop in options) {
if (!options.hasOwnProperty(prop)) {
continue; // skip inherited props
}
layer[prop] = options[prop];
}
}
// Assign a default category property if not already assigned
if (typeof layer.category === 'undefined') {
layer.category = 'overlay'; // the default category
}
// Assign a unique layer ID to ease layer management
layer.uniqueId = this.nextLayerId++;
// Add the layer to the globe
this.wwd.addLayer(layer);
}
/**
* Returns a new array of layers in the given category.
* @param {String} category E.g., "base", "overlay" or "setting".
* @returns {Array}
*/
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.