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