Merge of branches/life with trunk.

This commit is contained in:
Kasper D. Fischer 2014-05-11 18:55:45 +00:00
commit 43178d916e
Notes: subgit 2018-03-07 17:58:50 +01:00
r628 www/branches/life
4 changed files with 53 additions and 45 deletions

View File

@ -51,11 +51,6 @@ function getGeolocation(id, lat, lng) {
/* Load events using ajax */
function ajaxLoadEvents(stime, etime) {
var mapBounds = map.getBounds();
var N = mapBounds.getNorth();
var E = mapBounds.getEast();
var S = mapBounds.getSouth();
var W = mapBounds.getWest();
if ( !stime ) {
var stime = new Date();
stime.setDate(stime.getDate()-config['map']['timespan']);
@ -64,13 +59,14 @@ function ajaxLoadEvents(stime, etime) {
var etime = new Date();
etime.setDate(etime.getDate()+1);
};
var mapBounds = map.getBounds();
var request_data = {
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()),
minlat: S-config['map']['latlngDelta'],
maxlat: N+config['map']['latlngDelta'],
minlon: W-config['map']['latlngDelta'],
maxlon: E+config['map']['latlngDelta'],
minlat: mapBounds.getSouth()-config['map']['latlngDelta'],
maxlat: mapBounds.getNorth()+config['map']['latlngDelta'],
minlon: mapBounds.getWest()-config['map']['latlngDelta'],
maxlon: mapBounds.getEast()+config['map']['latlngDelta'],
minmag: config['event']['minMag']-config['event']['minMagDelta'],
};
$.ajax({
@ -89,7 +85,7 @@ function ajaxLoadEvents(stime, etime) {
var evaluationStatus = $(this).find('evaluationStatus').text();
var type = $(this).find('type').last().text();
var location
// try use location with reverse geolocation lookup (nominatim), check cache first
// try to use location with reverse geolocation lookup (nominatim), check cache first
// use getLocation if it fails or description -> text if it also fails
if ( geolocationTable[id] ) {
location = geolocationTable[id];
@ -99,14 +95,28 @@ function ajaxLoadEvents(stime, etime) {
};
// create table row: Date, Time, Mag, Location
if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) {
// general event info (1st line)
var row = '<tr class="tablesorter-hasChildRow">'
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
+ '<td class="utctime-time">'+otime.split('.')[0]+'Z</td>'
+ sprintf('<td class="ar">%.1f</td>', Number(mag))
+ '<td><a href="#" class="toggle" eventid="'+id+'">'+location+'</a><a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
+ '</tr>';
row += '<tr class="tablesorter-childRow">'
// setting up event details (2nd line)
row += '<tr class="tablesorter-childRow event-details">'
+ '<td colspan="4" eventid="'+id+'">Daten werden geladen ...</td></tr>';
// setting up download links (3nd line)
var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id);
var oTime = new Date(otime);
var stime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds());
var etime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds());
console.log(oTime, stime, etime);
var mseedurl = sprintf('%s?net=GE,GR,RN&cha=EH?,HH?&start=%04d-%02d-%02dT%02d:%02d:%02d&end=%04d-%02d-%02dT%02d:%02d:%02d', config['ajax']['mseedURL'], Number(stime.getUTCFullYear()), Number(stime.getUTCMonth())+1, Number(stime.getUTCDate()), Number(stime.getUTCHours()), Number(stime.getUTCMinutes()), Number(stime.getUTCSeconds()), Number(etime.getUTCFullYear()), Number(etime.getUTCMonth())+1, Number(etime.getUTCDate()), Number(etime.getUTCHours()), Number(etime.getUTCMinutes()), Number(etime.getUTCSeconds()));
row += '<tr class="tablesorter-childRow event-download">'
+ '<td colspan="4" eventid="'+id+'">'
+ sprintf('Download <a class="xml-link" target="_blank" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" href="%s">miniSEED</a>', xmlurl, mseedurl)
+ '</td></tr>';
// add row to table
var added = $('#eventstable tbody').append(row);
added.find('.tablesorter-childRow td').hide();
$('#eventstable').find('td.utctime-date').each(function() {
@ -123,6 +133,8 @@ function ajaxLoadEvents(stime, etime) {
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag));
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
+ sprintf('<p>Ereignis: %s</br>', id)
+ sprintf('Type: %s</br>', type)
+ sprintf('Magnitude: %3.1f</br>', Number(mag))
+ sprintf('Ort: %.4f °N, %.4f °O </br>', Number(lat), Number(lng))
+ sprintf('Zeit: <span class="utctime">%sZ</span></p>', otime.split('.')[0], otime.split('.')[0]);
marker.bindPopup(text);
@ -206,7 +218,7 @@ function ajaxLoadEventInfo(id) {
};
});
row = row + '</pre>';
$('#eventstable > tbody > tr.tablesorter-childRow > td[eventid='+id+']').html(row);
$('#eventstable > tbody > tr.event-details > td[eventid='+id+']').html(row);
});
},
complete: function () {
@ -228,7 +240,6 @@ function toggleFilteredMarkers() {
eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: config['event']['markerOpacity']});
};
});
// hide filtered events in map
$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() {
if ( $(this).attr("eventid") ) {
@ -272,7 +283,7 @@ function highlightEvent( id ) {
};
var normalStyle = {
fillColor: config['event']['markerColor'],
color: config['event']['markerColorH']
color: config['event']['markerColor']
};
$("#eventstable > tbody > tr:not(.filtered)").find("a.map-link").each( function() {
if ( $(this).attr("eventid") ) {
@ -320,20 +331,16 @@ $(document).ready(function() {
showProcessing: true,
}
});
// hide child rows
$('#eventstable > tbody > tr.tablesorter-childRow td').hide();
// update map after filtering
$('#eventstable').bind('filterEnd', function(){
toggleFilteredMarkers();
});
// highlight first event
$('#eventstable').bind('sortEnd', function(){
highlightFirstEvent();
});
// show / hide event info
$('#eventstable').delegate('.toggle', 'click' , function(){
// load event details
@ -342,7 +349,6 @@ $(document).ready(function() {
// toggle visibility of selected row
$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow');
// mark currently selected row and remove class selected from all other rows
// hide other rows
$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').addClass('selected-now');
@ -357,12 +363,12 @@ $(document).ready(function() {
var selected = $(this).hasClass('selected');
if ( selected ) {
$(this).removeClass('selected');
highlightFirstEvent();
} else {
$(this).addClass('selected');
highlightEvent($(this).attr('eventid'));
};
});
return false;
});
});

View File

@ -7,42 +7,42 @@
<!-- Style definitions -->
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="main.css" />
<!-- jQuery & jQueryUI -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/cupertino/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/cupertino/jquery-ui.css" />
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<!-- Localtime -->
<script type="text/javascript" src="external/jquery.localtime-0.9.1.min.js"></script>
<!-- Tablesorter: required -->
<link rel="stylesheet" href="external/theme.blue.css">
<script src="external/jquery.tablesorter.min.js"></script>
<!-- script src="external/widget-scroller.js"></script -->
<script src="external/jquery.tablesorter.widgets.min.js"></script>
<script src="external/jquery.tablesorter.pager.min.js"></script>
<link rel="stylesheet" href="external/theme.blue.css"/>
<script type="text/javascript" src="external/jquery.tablesorter.min.js"></script>
<!-- script type="text/javascript" src="external/widget-scroller.js"></script -->
<script type="text/javascript" src="external/jquery.tablesorter.widgets.min.js"></script>
<script type="text/javascript" src="external/jquery.tablesorter.pager.min.js"></script>
<!-- misc functions -->
<script src="misc.js"></script>
<script src="geolocation.js"></script>
<script src="external/sprintf.min.js"></script>
<script type="text/javascript" src="misc.js"></script>
<script type="text/javascript" src="geolocation.js"></script>
<script type="text/javascript" src="external/sprintf.min.js"></script>
<!-- Tablesorter: pager -->
<link rel="stylesheet" href="external/jquery.tablesorter.pager.css">
<script src="external/widget-pager.js"></script>
<script src="events.js"></script>
<link rel="stylesheet" href="external/jquery.tablesorter.pager.css" />
<script type="text/javascript" src="external/widget-pager.js"></script>
<script type="text/javascript" src="events.js"></script>
<!-- Leaflet -->
<link rel="stylesheet" href="external/leaflet.css" />
<script src="external/leaflet.js"></script>
<!-- script src="external/TileLayer.Grayscale.js"></script -->
<script src="map.js"></script>
<script type="text/javascript" src="external/leaflet.js"></script>
<!-- script type="text/javascript" src="external/TileLayer.Grayscale.js"></script -->
<script type="text/javascript" src="map.js"></script>
<!-- Stations -->
<script src="stations.js"></script>
<script type="text/javascript" src="stations.js"></script>
</head>
<body>
@ -72,7 +72,7 @@
</select>
<select class="gotoPage" title="Select page number"></select>
</div>
<table class="tablesorter" id="eventstable" data-sortlist="[[0,0],[1,1],[2,1]]">
<table class="tablesorter" id="eventstable">
<colgroup>
<col width="85" />
<col width="50" />
@ -138,3 +138,4 @@
<div class="rublogo"><img class="rublogo" src="logo_RUB_155x30.png" alt="Ruhr-Universität Bochum" title="Ruhr-Universität Bochum" /></div>
<div id="map" class="map"></div>
</body>
</html>

View File

@ -104,7 +104,7 @@ function initMapLink() {
$(document).ready(function() {
// create a map in the "map" div, set the view to a given place and zoom
map = L.map('map', { zoomControl: false }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
map = L.map('map', { zoomControl: false, worldCopyJump: true }).setView(config['map']['centerDefault'], config['map']['zoomDefault']);
new L.Control.Zoom({ position: 'topright' }).addTo(map);
// add MapQuestOSM tile layer

View File

@ -80,6 +80,7 @@ var config = {
ajax: {
timeout: 150000, // 15 seconds
eventURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query',
mseedURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/dataselect/1/query',
stationURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query',
nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php',
// nominatimURL: '//nominatim.openstreetmap.org/reverse',
@ -91,7 +92,7 @@ var config = {
markerColorH: '#FF0000',
minMag: 1.2,
minMagDelta: 0.1,
typeWhitelist: ['earthquake', 'induced or triggered event', 'quarry blast'],
typeWhitelist: ['earthquake', 'induced or triggered event'],
},
map: {
zoomDefault: 9,