Added new funcionality: special events can now be loaded to the table and map, eg. Seeheim-Jugenheim event of May 17th, 2014.
This commit is contained in:
parent
fd135405db
commit
873a21f539
Notes:
subgit
2018-03-07 17:58:56 +01:00
r658 www/trunk
@ -50,13 +50,17 @@ function getGeolocation(id, lat, lng) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Load events using ajax */
|
/* Load events using ajax */
|
||||||
function ajaxLoadEvents(stime, etime) {
|
function ajaxLoadEvents(stime, etime, id) {
|
||||||
|
var mapBounds = map.getBounds();
|
||||||
var request_data = {};
|
var request_data = {};
|
||||||
|
if ( id ) {
|
||||||
|
if ( id == 'bug2014jptq' ) console.log('Loading special event '+id);
|
||||||
|
request_data = { eventid: id };
|
||||||
|
} else {
|
||||||
if ( !stime ) {
|
if ( !stime ) {
|
||||||
stime = new Date();
|
stime = new Date();
|
||||||
stime.setDate(stime.getDate()-config['map']['timespan']);
|
stime.setDate(stime.getDate()-config['map']['timespan']);
|
||||||
};
|
};
|
||||||
var mapBounds = map.getBounds();
|
|
||||||
request_data = {
|
request_data = {
|
||||||
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
||||||
orderby: 'time-asc',
|
orderby: 'time-asc',
|
||||||
@ -69,6 +73,7 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
if ( etime ) {
|
if ( etime ) {
|
||||||
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
|
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
|
||||||
};
|
};
|
||||||
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: config['ajax']['eventURL'],
|
url: config['ajax']['eventURL'],
|
||||||
@ -87,10 +92,12 @@ function ajaxLoadEvents(stime, etime) {
|
|||||||
var type = $(this).find('type').last().text();
|
var type = $(this).find('type').last().text();
|
||||||
var location
|
var location
|
||||||
// get location, try this in order:
|
// get location, try this in order:
|
||||||
// cached value, nominatim lookup, regional map name, or given value
|
// regional map name, given value, cached value, or nominatim lookup
|
||||||
location = geolocationTable[id] || getGeolocation(id, lat, lng) || getLocation(lat, lng)[0] || $(this).find('description > text').text();
|
location = ( getLocation(lat, lng)[0] || $(this).find('description > text').text() );
|
||||||
|
location = ( geolocationTable[id] || getGeolocation(id, lat, lng) );
|
||||||
// create table row: Date, Time, Mag, Location
|
// 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'] ) {
|
if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) {
|
||||||
|
if ( id == 'bug2014jptq' ) console.log('Adding row for special event '+id);
|
||||||
// general event info (1st line)
|
// general event info (1st line)
|
||||||
var row = '<tr class="tablesorter-hasChildRow">'
|
var row = '<tr class="tablesorter-hasChildRow">'
|
||||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||||
|
25
www/map.js
25
www/map.js
@ -42,6 +42,11 @@ function addStationMarker(id, lat, lng, station) {
|
|||||||
|
|
||||||
/* add event marker */
|
/* add event marker */
|
||||||
function addEventMarker(id, lat, lng, mag) {
|
function addEventMarker(id, lat, lng, mag) {
|
||||||
|
if ( id == 'bug2014jptq' ) console.log('Adding marker for special event '+id);
|
||||||
|
if ( eventTable[id] ) {
|
||||||
|
return eventTable[id];
|
||||||
|
console.log('Marker allready exists ID: '+id);
|
||||||
|
} else {
|
||||||
var markerOptions = {
|
var markerOptions = {
|
||||||
gradient: true,
|
gradient: true,
|
||||||
dropShadow: false,
|
dropShadow: false,
|
||||||
@ -58,9 +63,11 @@ function addEventMarker(id, lat, lng, mag) {
|
|||||||
eventTable[id] = marker;
|
eventTable[id] = marker;
|
||||||
return marker;
|
return marker;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/* handle to show events on map */
|
/* handle to show events on map */
|
||||||
function initMapLink() {
|
function initMapLink() {
|
||||||
|
$("#eventstable > tbody > tr > td > a.map-link").off('click');
|
||||||
$("#eventstable > tbody > tr > td > a.map-link").on('click' , function(){
|
$("#eventstable > tbody > tr > td > a.map-link").on('click' , function(){
|
||||||
var highlightStyle = {
|
var highlightStyle = {
|
||||||
color: config['event']['markerColorH'],
|
color: config['event']['markerColorH'],
|
||||||
@ -89,15 +96,15 @@ function initMapLink() {
|
|||||||
if ( $(this).hasClass('selected') ) {
|
if ( $(this).hasClass('selected') ) {
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
$(this).text('Karte');
|
$(this).text('Karte');
|
||||||
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
|
||||||
map.setView(config['map']['centerDefault'], config['map']['zoomDefault']);
|
map.setView(config['map']['centerDefault'], config['map']['zoomDefault']);
|
||||||
|
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
||||||
highlightFirstEvent();
|
highlightFirstEvent();
|
||||||
// unselected -> selected
|
// unselected -> selected
|
||||||
} else {
|
} else {
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
$(this).text('im Fokus (rot)');
|
$(this).text('im Fokus (rot)');
|
||||||
eventTable[$(this).attr('eventid')].setStyle(highlightStyle);
|
|
||||||
map.setView(eventTable[$(this).attr('eventid')].getLatLng(), config['map']['zoomFocus']);
|
map.setView(eventTable[$(this).attr('eventid')].getLatLng(), config['map']['zoomFocus']);
|
||||||
|
eventTable[$(this).attr('eventid')].setStyle(highlightStyle)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
@ -116,6 +123,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// create baselayer
|
// create baselayer
|
||||||
switch ( config['map']['baselayer'] ) {
|
switch ( config['map']['baselayer'] ) {
|
||||||
|
case 'osmde': // add OpenStreetMap.DE tile layer
|
||||||
|
L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
||||||
|
{
|
||||||
|
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
|
||||||
|
}).addTo(map);
|
||||||
|
break;
|
||||||
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
|
case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names)
|
||||||
L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',
|
L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',
|
||||||
{
|
{
|
||||||
@ -123,6 +136,12 @@ $(document).ready(function() {
|
|||||||
maxZoom: 16
|
maxZoom: 16
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
break;
|
break;
|
||||||
|
case 'aerial': // add ESRI WordImagery tile layer
|
||||||
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||||
|
{
|
||||||
|
attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
|
||||||
|
}).addTo(map);
|
||||||
|
break;
|
||||||
case 'mapquestgray': // add MapQuestOSM tile layer
|
case 'mapquestgray': // add MapQuestOSM tile layer
|
||||||
L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
|
L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
|
||||||
{
|
{
|
||||||
@ -150,6 +169,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// load events
|
// load events
|
||||||
ajaxLoadEvents();
|
ajaxLoadEvents();
|
||||||
|
//ajaxLoadEvents([], [], ['bug2014jptq', 'gfz2013yvko']);
|
||||||
|
ajaxLoadEvents([], [], 'bug2014jptq');
|
||||||
toggleFilteredMarkers();
|
toggleFilteredMarkers();
|
||||||
|
|
||||||
// bind popupopen event
|
// bind popupopen event
|
||||||
|
Loading…
Reference in New Issue
Block a user