Commit 78af3a54 by Corey Koval

Fixed Caching, made sliders touch friendly.

parent 265a2e15
......@@ -20,6 +20,8 @@ from czml3.properties import Position, Polyline, PolylineOutlineMaterial, Color,
from multiprocessing import Process, Queue
from bottle import route, run, request, get, post, put, response, redirect, template, static_file
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
DBSCAN_Q = Queue()
DBSCAN_WAIT_Q = Queue()
DATABASE_EDIT_Q = Queue()
......@@ -502,7 +504,8 @@ def write_czml(best_point, all_the_points, ellipsedata):
ellipse={**ellipse_properties, **ellipse_info},
position={"cartographicDegrees": [ x[3], x[4], 0 ]}))
output = Document([top] + best_point_packets + all_point_packets + ellipse_packets)
output = json.dumps(json.loads(str(Document([top] + best_point_packets + all_point_packets + ellipse_packets))),
separators=(',', ':'))
return output
......@@ -511,7 +514,7 @@ def write_czml(best_point, all_the_points, ellipsedata):
###############################################
@get('/receivers.czml')
def write_rx_czml():
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate')
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
height = 50
receiver_point_packets = []
lob_packets = []
......@@ -635,7 +638,7 @@ def clear(debugging):
###############################################
@route('/static/<filepath:path>', name='static')
def server_static(filepath):
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate')
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
return static_file(filepath, root='./static')
###############################################
......@@ -646,7 +649,7 @@ def server_static(filepath):
@get('/index')
@get('/cesium')
def cesium():
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate')
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
with open('accesstoken.txt', "r") as tokenfile:
access_token = tokenfile.read().replace('\n', '')
return template('cesium.tpl',
......@@ -706,7 +709,7 @@ def rx_params():
###############################################
@get('/output.czml')
def tx_czml_out():
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate')
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
output = write_czml(*process_data(database_name))
return str(output)
......
......@@ -20,17 +20,12 @@
</div>
<script>
// // Update Map every n milliseconds
// var rxRefreshRate = 5000;
// var autoRxRefresh = setInterval(function () { reloadRX(); }, rxRefreshRate);
var transmittersDataSource = new Cesium.CzmlDataSource;
var receiversDataSource = new Cesium.CzmlDataSource;
var aoiDataSource = new Cesium.CzmlDataSource;
// Your access token can be found at: https://cesium.com/ion/tokens.
Cesium.Ion.defaultAccessToken = '{{access_token}}';
// var hpr = new Cesium.HeadingPitchRange(0, 40, 0)
var viewer = new Cesium.Viewer('cesiumContainer', {
// terrainProvider: Cesium.createWorldTerrain(),
homeButton: false,
......@@ -39,8 +34,8 @@
var clock = new Cesium.Clock({
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER
});
viewer.clock.shouldAnimate = true;
// var hpr = new Cesium.HeadingPitchRange(0.0, 1.57, 5000.0);
viewer.zoomTo(loadAllCzml());
var scene = viewer.scene;
......@@ -51,7 +46,6 @@
var handler;
var cartesian;
var cartographic
// var center_cartesian;
var rad_cartesian;
var center_lat;
var center_lon;
......@@ -202,9 +196,10 @@
function loadTxCzml() {
transmittersDataSource.load('/output.czml');
viewer.dataSources.add(transmittersDataSource);
// console.log("Loaded CZML");
return transmittersDataSource;
Cesium.when(transmittersDataSource, function(dataSource1){
viewer.dataSources.add(dataSource1);
return dataSource1;
});
}
function loadRxCzml() {
......@@ -221,12 +216,11 @@
return aoiDataSource;
}
function loadAllCzml() {
loadTxCzml();
loadAoiCzml();
let zoom = loadRxCzml();
return zoom;
let rx = loadRxCzml();
let aoi = loadAoiCzml();
let tx = loadTxCzml();
return rx;
}
function clearOld() {
......@@ -376,25 +370,25 @@
epsslider.oninput = function() {
epsoutput.innerHTML = this.value;
}
epsslider.onmouseup = function() {
epsslider.onpointerup = function() {
updateParams("eps="+this.value);
}
powerslider.oninput = function() {
poweroutput.innerHTML = this.value;
}
powerslider.onmouseup = function() {
powerslider.onpointerup = function() {
updateParams("minpower="+this.value);
}
confslider.oninput = function() {
confoutput.innerHTML = this.value;
}
confslider.onmouseup = function() {
confslider.onpointerup = function() {
updateParams("minconf="+this.value);
}
minpointslider.oninput = function() {
minpointoutput.innerHTML = this.value;
}
minpointslider.onmouseup = function() {
minpointslider.onpointerup = function() {
updateParams("minpts="+this.value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment