Last active
May 31, 2016 21:37
-
-
Save dotspencer/b48805b06e0ff6260ce83966e05eb2cc to your computer and use it in GitHub Desktop.
Arcgis map animator for Forge map
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
var map = esri.Map("map_canvas3d"); |
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
// ==UserScript== | |
// @name Arcgis Map Animator | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match http://utahdnr.maps.arcgis.com/apps/CEWebViewer/viewer.html?3dWebScene=1212104536624cdea8e4b19d3f42b3e8 | |
// @grant none | |
// ==/UserScript== | |
var secondsPerLayer = 5; | |
var layerOrder = [6, // Land Surface | |
8, // Surface Labels | |
4, // Existing Wells | |
3, // FORGE Project Boundary | |
9, // Under Labels | |
0, // Granite Surface | |
2, // Opal Mountain Fault | |
1, // 175 Subsurface | |
5 // Proposed Deep Well | |
]; | |
var standardTime = 3; | |
var layerTime = [1, // Land Surface | |
0, // Surface Labels | |
standardTime, // Existing Wells | |
standardTime, // FORGE Project Boundary | |
standardTime, // Under Labels | |
standardTime, // Granite Surface | |
standardTime, // Opal Mountain Fault | |
standardTime, // 175 Subsurface | |
standardTime // Proposed Deep Well | |
]; | |
var currentIndex = 0; | |
var time = secondsPerLayer * 1000; | |
function main(){ | |
var buttons = document.getElementsByClassName('icon_visible'); | |
var nav = document.getElementById('nav'); | |
nav.style.opacity = "0"; | |
// Turn off all layers | |
for(var i = 0; i < buttons.length - 1; i++){ | |
buttons[i].click(); | |
} | |
// Sets the timeout for each button | |
for(var i = 0; i < layerOrder.length; i++){ | |
//alert(i); | |
set(buttons, i); | |
} | |
console.log(buttons); | |
} | |
function set(buttons, index){ | |
var order = layerOrder[index]; | |
//alert("Index: " + index + "\nOrder: " + order); | |
setTimeout(function(){ | |
buttons[order].click(); | |
console.log("clicked " + order); | |
}, getTime(index)); | |
} | |
function getTime(index){ | |
var totalTime = 0; | |
for(i = 0; i <= index; i++){ | |
totalTime += layerTime[i]; | |
} | |
return totalTime * 1000; | |
} | |
function starter(){ | |
//document.getElementById('loader').style.display = "none"; | |
var interval = setInterval(function(){ | |
var buttons = document.getElementsByClassName('icon_visible'); | |
if(buttons.length > 0){ | |
clearInterval(interval); | |
main(); | |
} | |
}, 500); | |
} | |
window.onload = starter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment