annotate war/scripts/sti/STICore.js @ 8:16d70389b24a

mc git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@89 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
date Thu, 30 Aug 2012 14:44:38 +0000
parents 4fb15c3e0e89
children e7595fbda9fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
1 /**
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
2 * defines the core component of the Spatio Temporal Interface
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
3 *
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
4 * @constructor
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
5 */
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
6 function STICore(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
7
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
8 this.map;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
9 this.timeplot;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
10
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
11 this.refining;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
12 this.individualDataSet;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
13
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
14 this.takeTime;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
15
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
16 this.history;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
17 this.historyIndex;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
18 this.lockScreenContainer;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
19
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
20 this.initialize();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
21 this.blocked = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
22
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
23 };
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
24
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
25 STICore.prototype = {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
26
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
27 blockUI: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
28 this.blocked = true;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
29 fullscreen.addFullscreen(fullscreen.loaderContent());
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
30 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
31
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
32 unblockUI: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
33 this.blocked = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
34 setTimeout( function(){ if( !this.blocked ){ setDefinedBounds(); } }, 150 );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
35 fullscreen.removeFullscreen();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
36 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
37
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
38 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
39 * refines the given data by creating a new history entry
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
40 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
41 refine: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
42 if (this.refining > -2) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
43 var contains = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
44 var newDataSets = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
45 var oldDataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
46 for (var i = 0; i < oldDataSets.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
47 var dataSet = oldDataSets[i].copy();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
48 dataSet.source = oldDataSets[i].source;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
49 for (var j = 0; j < oldDataSets[i].objects.length; j++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
50 if ( oldDataSets[i].objects[j].percentage == 1 || this.refining > -1 && this.refining != i ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
51 dataSet.addObject( oldDataSets[i].objects[j] );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
52 contains = true;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
53 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
54 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
55 newDataSets.push(dataSet);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
56 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
57 if (contains) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
58 this.addHistoryEntry( new HistoryEntry(newDataSets) );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
59 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
60 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
61 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
62 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
63 alert("Your Selection contains no elements!");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
64 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
65 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
66 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
67 alert("For Refining choose an Area on the map or a Range on the Timeplot!");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
68 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
69 return -1;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
70 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
71
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
72 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
73 * refines the given data by creating a new history entry
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
74 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
75 refineByTime: function(minTime,maxTime){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
76 var minDate = new Date(parseInt(minTime));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
77 var maxDate = new Date(parseInt(maxTime));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
78 if( this.timeplot.eds.minDate.getTime() == minDate.getTime() &&
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
79 this.timeplot.eds.maxDate.getTime() == maxDate.getTime() ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
80 return;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
81 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
82 var newDataSets = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
83 var oldDataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
84 for (var i = 0; i < oldDataSets.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
85 var dataSet = oldDataSets[i].copy();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
86 dataSet.source = oldDataSets[i].source;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
87 for (var j = 0; j < oldDataSets[i].objects.length; j++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
88 var o = oldDataSets[i].objects[j];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
89 if( o.inTime(minDate,maxDate) ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
90 dataSet.addObject( o );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
91 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
92 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
93 newDataSets.push(dataSet);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
94 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
95 this.addHistoryEntry( new HistoryEntry(newDataSets) );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
96 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
97 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
98 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
99
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
100 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
101 * refines a given dataset by a given text snippet
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
102 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
103 refineByText: function(text,index){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
104 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
105 var dataset = this.history[this.historyIndex].dataSets[index];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
106 for (var i = 0; i < dataset.objects.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
107 var e = dataset.objects[i];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
108 if( e.name.toLowerCase().indexOf(text.toLowerCase()) != -1 ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
109 e.setPercentage(1);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
110 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
111 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
112 this.updateMapAndTimeAndTable(index);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
113 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
114
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
115 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
116 * adds selected elements of a specific dataset as a new dataset
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
117 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
118 * @param {int}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
119 * id the id of the dataset
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
120 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
121 storeSelected: function(id){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
122 var dataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
123 if( dataSets.length == 4 ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
124 alert( "The maximum number of 4 parallel datasets is reached!" );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
125 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
126 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
127 var dataSet = dataSets[id].copy();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
128 var contains = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
129 for (var j = 0; j < dataSets[id].objects.length; j++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
130 if ( dataSets[id].objects[j].percentage == 1 ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
131 dataSet.addObject( dataSets[id].objects[j] );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
132 contains = true;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
133 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
134 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
135 if (contains) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
136 this.addDataSet(dataSet);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
137 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
138 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
139 alert("Your Selection contains no elements!");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
140 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
141 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
142 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
143
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
144 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
145 * Adds a dataset to the actual history entry
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
146 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
147 addDataSet: function( dataSet ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
148 var oldDataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
149 var newDataSets = oldDataSets.concat(dataSet);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
150 this.addHistoryEntry(new HistoryEntry(newDataSets));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
151 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
152 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
153 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
154
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
155 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
156 * Sets the widgets for the core component
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
157 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
158 * @param {STIMap}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
159 * map the javascript object of the map widget
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
160 * @param {STITimeplot}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
161 * plot the javascript object of the timeplot widget
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
162 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
163 setElements: function(map, timeplot){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
164 this.map = map;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
165 this.timeplot = timeplot;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
166 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
167
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
168 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
169 * initializes the core component for the Spatio Temporal Interface. here,
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
170 * the handling of the search interface is defined (including undo, refine
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
171 * and clear selection button). furthermore, the elements (map, timeplot,
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
172 * tables) are instanciated.
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
173 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
174 initialize: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
175
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
176 var context = this;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
177 this.takeTime = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
178 this.props = new STIProps();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
179
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
180 this.history = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
181
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
182 this.history.push( new HistoryEntry([]) );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
183 this.historyIndex = 0;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
184
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
185 var Unselectable = {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
186 enable: function(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
187 var e = e ? e : window.event;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
188 if (e.button != 1) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
189 if (e.target) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
190 var targer = e.target;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
191 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
192 else
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
193 if (e.srcElement) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
194 var targer = e.srcElement;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
195 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
196 if( targer.tagName == undefined ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
197 return false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
198 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
199 var targetTag = targer.tagName.toLowerCase();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
200 if ((targetTag != "input") && (targetTag != "textarea")) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
201 return false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
202 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
203 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
204 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
205 disable: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
206 return true;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
207 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
208 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
209
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
210 if (typeof(document.onselectstart) != "type filter textundefined") {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
211 document.onselectstart = Unselectable.enable;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
212 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
213 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
214 document.onmousedown = Unselectable.enable;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
215 document.onmouseup = Unselectable.disable;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
216 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
217
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
218 this.sources = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
219 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
220 var jsonString = this.getFileString("datasources.json");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
221 this.sources = eval('(' + jsonString + ')');
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
222 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
223 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
224 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
225
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
226 this.lockScreenContainer = document.createElement("div");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
227 this.lockScreenContainer.setAttribute('class','lockScreenContainer');
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
228 document.getElementsByTagName("body")[0].appendChild(this.lockScreenContainer);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
229
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
230 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
231
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
232 getFileString: function(url){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
233 var xmlhttp = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
234 if (!xmlhttp)
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
235 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
236 xmlhttp = new XMLHttpRequest();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
237 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
238 catch (e) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
239 xmlhttp = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
240 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
241 if (typeof ActiveXObject != "undefined") {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
242 if (!xmlhttp)
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
243 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
244 xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
245 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
246 catch (e) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
247 xmlhttp = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
248 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
249 if (!xmlhttp)
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
250 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
251 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
252 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
253 catch (e) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
254 xmlhttp = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
255 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
256 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
257 xmlhttp.open('GET', url, false);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
258 xmlhttp.send("");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
259 return xmlhttp.responseText;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
260 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
261
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
262 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
263 * constructs an url to a dynamic datasource with the specific user input as
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
264 * attribute
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
265 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
266 * @param {int}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
267 * ds the datasource index
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
268 * @param {String}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
269 * input the user input
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
270 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
271 retrieveKml: function(ds,input){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
272 var url = this.sources[ds].url;
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
273 // var tags = input.replace(/[^a-zA-Z0-9]/g,",");
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
274 // url += tags;
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
275 url += input;
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
276
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
277 /* test for csv flag in request parameters (see datasources.json) */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
278 var beginCsv = url.indexOf("csv=true");
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
279 if (beginCsv != -1) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
280 /* remove "csv=true" from request parameters */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
281 url = url.substr(0, beginCsv) + url.substr(beginCsv + 9);
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
282 /* convert csv to kml */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
283 this.parseCsv(url,input,ds);
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
284 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
285 else {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
286 /* parse kml */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
287 this.parseKml(url,input,ds);
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
288 }
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
289 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
290
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
291 parseIt: function(xml,term,ds){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
292 var getTimeData = function( timeString ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
293 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
294 var bc = false;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
295 if( timeString.startsWith("-") ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
296 bc = true;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
297 timeString = timeString.substring(1);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
298 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
299 var timeSplit = timeString.split("T");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
300 var timeData = timeSplit[0].split("-");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
301 for (var i = 0; i < timeData.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
302 parseInt(timeData[i]);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
303 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
304 if( bc ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
305 timeData[0] = "-"+timeData[0];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
306 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
307 if (timeSplit.length == 1) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
308 return timeData;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
309 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
310 var dayData;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
311 if (timeSplit[1].indexOf("Z") != -1) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
312 dayData = timeSplit[1].substring(0, timeSplit[1].indexOf("Z") - 1).split(":");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
313 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
314 else {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
315 dayData = timeSplit[1].substring(0, timeSplit[1].indexOf("+") - 1).split(":");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
316 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
317 for (var i = 0; i < timeData.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
318 parseInt(dayData[i]);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
319 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
320 return timeData.concat(dayData);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
321 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
322 catch (exception) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
323 return null;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
324 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
325 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
326
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
327 var time = SimileAjax.DateTime;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
328 var newObjects = new Array();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
329 var elements = xml.getElementsByTagName("Placemark");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
330 var granularity = 0;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
331
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
332 if( elements.length == 0 ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
333 this.unblockUI();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
334 return;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
335 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
336
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
337 for (var i = 0; i < elements.length; i++) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
338
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
339 var placemark = elements[i];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
340 var name, description, place, timeData, coordinates, timeStamp, timeSpan, g;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
341
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
342 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
343 name = placemark.getElementsByTagName("name")[0].childNodes[0].nodeValue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
344 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
345 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
346 name = "";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
347 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
348
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
349 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
350 description = placemark.getElementsByTagName("description")[0].childNodes[0].nodeValue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
351 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
352 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
353 description = "";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
354 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
355
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
356 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
357 place = placemark.getElementsByTagName("address")[0].childNodes[0].nodeValue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
358 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
359 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
360 place = "";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
361 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
362
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
363 var getDate = function(timeData){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
364 var date;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
365 if (timeData.length == 6) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
366 g = time.SECOND;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
367 date = new Date(Date.UTC(timeData[0], timeData[1]-1, timeData[2], timeData[3], timeData[4], timeData[5]));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
368 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
369 else if (timeData.length == 3) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
370 g = time.DAY;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
371 date = new Date(Date.UTC(timeData[0], timeData[1]-1, timeData[2]));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
372 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
373 else if (timeData.length == 2) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
374 g = time.MONTH;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
375 date = new Date(Date.UTC(timeData[0], timeData[1]-1, 1));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
376 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
377 else if (timeData.length == 1) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
378 g = time.YEAR;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
379 date = new Date(Date.UTC(timeData[0], 0, 1));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
380 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
381 if (granularity < g) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
382 granularity = g;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
383 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
384 if( timeData[0] && timeData[0] < 100 ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
385 date.setFullYear(timeData[0]);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
386 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
387 return date;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
388 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
389
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
390 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
391 timeData = getTimeData( placemark.getElementsByTagName("TimeStamp")[0].getElementsByTagName("when")[0].childNodes[0].nodeValue );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
392 if( timeData != null ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
393 timeStamp = getDate(timeData);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
394 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
395 if( timeStamp == undefined ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
396 continue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
397 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
398 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
399 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
400 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
401 timeStamp = undefined;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
402 var timeSpanTag = placemark.getElementsByTagName("TimeSpan")[0];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
403 var timeDataStart = getTimeData( timeSpanTag.getElementsByTagName("begin")[0].childNodes[0].nodeValue );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
404 var startTime = getDate(timeDataStart);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
405 var timeDataEnd = getTimeData( timeSpanTag.getElementsByTagName("end")[0].childNodes[0].nodeValue );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
406 var endTime = getDate(timeDataEnd);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
407 timeSpan = { start: startTime, end: endTime };
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
408 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
409 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
410 continue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
411 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
412 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
413
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
414 try {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
415 coordinates = placemark.getElementsByTagName("Point")[0].getElementsByTagName("coordinates")[0].childNodes[0].nodeValue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
416 var lonlat = coordinates.split(",");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
417 if( lonlat[0] == "" || lonlat[1] == "" || isNaN(lonlat[0]) || isNaN(lonlat[1]) ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
418 continue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
419 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
420 newObjects.push(new DataObject(name, description, place, timeStamp, timeSpan, g, lonlat[0], lonlat[1]));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
421 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
422 catch(e){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
423 continue;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
424 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
425
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
426 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
427 var dataset = new DataSet( newObjects, term, granularity );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
428 dataset.source = ds;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
429 var core = this;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
430 var status = document.getElementById("statusText");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
431 status.innerHTML = "Space & Time Aggregation ...";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
432 setTimeout( function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
433 core.addDataSet( dataset );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
434 core.unblockUI();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
435 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
436 1 );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
437 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
438
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
439 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
440 * parses the kml-file which includes the results for a given search request
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
441 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
442 * @param {File}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
443 * kmlFile
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
444 * @param {String}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
445 * term the term identifier for the resulting dataset
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
446 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
447 parseKml: function(kmlFile,term,ds){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
448 var core = this;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
449 if( this.blocked ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
450 setTimeout( function(){ core.parseKml(kmlFile,term,ds); }, 100 );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
451 return;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
452 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
453 core.blockUI();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
454 $.ajax({
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
455 url: kmlFile,
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
456 dataType: "xml",
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
457 beforeSend: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
458 var status = document.getElementById("statusText");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
459 status.innerHTML = "Retrieving Data ...";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
460 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
461 success: function(xml){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
462 var status = document.getElementById("statusText");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
463 status.innerHTML = "Parsing Data ...";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
464 setTimeout( function(){ core.parseIt(xml,term,ds); }, 1 );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
465 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
466 });
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
467 },
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
468
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
469 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
470 * converts the csv-file, then parses the kml-file which includes the
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
471 * results for a given search request
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
472 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
473 * @param {File}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
474 * csvFile
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
475 * @param {String}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
476 * term the term identifier for the resulting dataset
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
477 */
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
478 parseCsv: function(csvFile,term,ds){
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
479 var core = this;
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
480 if( this.blocked ){
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
481 setTimeout( function(){ core.parseCsv(csvFile,term,ds); }, 100 );
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
482 return;
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
483 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
484 core.blockUI();
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
485 $.ajax({
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
486 url: csvFile,
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
487 dataType: "text",
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
488 beforeSend: function(){
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
489 var status = document.getElementById("statusText");
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
490 status.innerHTML = "Retrieving Data ...";
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
491 },
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
492 success: function(text){
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
493 var status = document.getElementById("statusText");
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
494 status.innerHTML = "Converting CSV to KML ...";
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
495 /* convert here from csv to kml */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
496 var kmlString = '<?xml version="1.0" standalone="yes"?>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
497 kmlString += '<kml xmlns="http://www.opengis.com/kml/ext/2.2">\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
498 kmlString += '\t<Folder>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
499 /* define expected csv table headers (first line) */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
500 var expectedHeaders = new Array("Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end");
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
501 /* convert csv string to array of arrays using ucsv library */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
502 var csvArray = CSV.csvToArray(text);
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
503 /* get real used table headers from csv file (first line) */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
504 var usedHeaders = csvArray[0];
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
505 /* loop outer array, begin with second line */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
506 for (var i = 1; i < csvArray.length; i++) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
507 var innerArray = csvArray[i];
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
508 kmlString += '\t\t<Placemark>\n';
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
509 /* declare few variables */
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
510 var timespanBegin = "";
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
511 var timespanEnd = "";
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
512 var longitude = "";
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
513 var latitude = "";
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
514 /* loop inner array */
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
515 for (var j = 0; j < innerArray.length; j++) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
516 /* Name */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
517 if (usedHeaders[j] == expectedHeaders[0]) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
518 kmlString += '\t\t\t<name>' + innerArray[j] + '</name>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
519 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
520 /* Address */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
521 if (usedHeaders[j] == expectedHeaders[1]) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
522 kmlString += '\t\t\t<address>' + innerArray[j] + '</address>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
523 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
524 /* Description */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
525 if (usedHeaders[j] == expectedHeaders[2]) {
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
526 kmlString += '\t\t\t<description>' + innerArray[j] + '</description>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
527 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
528 /* TimeStamp */
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
529 if (usedHeaders[j] == expectedHeaders[5]) {
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
530 kmlString += '\t\t\t<TimeStamp>\n' +
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
531 '\t\t\t\t<when>' + innerArray[j] + '</when>\n' +
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
532 '\t\t\t</TimeStamp>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
533 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
534 /* TimeSpan:begin */
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
535 if (usedHeaders[j] == expectedHeaders[6]) {
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
536 timespanBegin = innerArray[i];
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
537 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
538 /* TimeSpan:end */
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
539 if (usedHeaders[j] == expectedHeaders[7]) {
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
540 timespanBegin = innerArray[i];
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
541 }
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
542 /* Longitude */
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
543 if (usedHeaders[j] == expectedHeaders[3]) {
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
544 longitude = innerArray[j];
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
545 }
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
546 /* Latitude */
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
547 if (usedHeaders[j] == expectedHeaders[4]) {
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
548 latitude = innerArray[j];
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
549 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
550 }
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
551 /* set timespan:begin und timespan:end */
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
552 kmlString += '\t\t\t<TimeSpan>\n' +
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
553 '\t\t\t\t<begin>' + timespanBegin + '</begin>\n' +
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
554 '\t\t\t\t<end>' + timespanEnd + '</end>\n' +
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
555 '\t\t\t</TimeSpan>\n';
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
556 /* set longitude and latitude */
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
557 kmlString += '\t\t\t<Point>\n' +
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
558 '\t\t\t\t<coordinates>' +
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
559 longitude +',' + latitude +
8
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 7
diff changeset
560 '</coordinates>\n' +
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 7
diff changeset
561 '\t\t\t</Point>\n';
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
562 /* end Placemark */
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
563 kmlString += '\t\t</Placemark>\n';
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
564 }
6
7bf904a68ce7 - fixed xml creation bug
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 4
diff changeset
565 kmlString += '\t</Folder>\n';
7bf904a68ce7 - fixed xml creation bug
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 4
diff changeset
566 kmlString += '</kml>\n';
7bf904a68ce7 - fixed xml creation bug
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 4
diff changeset
567 console.log("kmlstring="+kmlString);
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
568 /* convert string to xml */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
569 var kmlXml = $.parseXML(kmlString);
6
7bf904a68ce7 - fixed xml creation bug
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 4
diff changeset
570 console.log(kmlXml);
4
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
571 /* pares the converted kml data */
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
572 var status = document.getElementById("statusText");
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
573 status.innerHTML = "Parsing Data ...";
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
574 setTimeout( function(){ core.parseIt(kmlXml,term,ds); }, 1 );
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
575 }
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
576 });
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
577 },
517a6422d1bd done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 3
diff changeset
578
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
579 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
580 * updates the timeplot and table element. its called from the STIMap
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
581 * object, when objects on the map had been selected by featureSelect or
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
582 * polygon.
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
583 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
584 * @param {boolean}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
585 * hover true, if there was a hover selection
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
586 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
587 updateTimeAndTable: function(hover){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
588 updateTables(hover);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
589 this.timeplot.polesBySlices();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
590 this.refining = -1;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
591 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
592
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
593 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
594 * updates the map, timeplot and table element. its called from the STITable
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
595 * object, when a text selection has been done
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
596 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
597 updateMapAndTimeAndTable: function(index){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
598 updateTables(hover);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
599 this.timeplot.polesBySlices();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
600 this.map.updateMap();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
601 this.refining = index;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
602 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
603
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
604 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
605 * updates the timeplot and map element. its called from the STITable
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
606 * object, when objects in one of the tables had been selected.
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
607 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
608 updateTimeAndMap: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
609 this.map.updateMap();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
610 this.timeplot.polesBySlices();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
611 this.refining = -1;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
612 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
613
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
614 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
615 * updates the table and map element. its called from the STITimeplot
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
616 * object, when objects in the timeplot had been selected by timestamp or
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
617 * -range.
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
618 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
619 * @param {boolean}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
620 * hover true, if there was a hover selection
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
621 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
622 updateTableAndMap: function(hover){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
623 updateTables(hover);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
624 this.map.updateMap();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
625 this.refining = -1;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
626 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
627
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
628 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
629 * initializes the sti components (map, timeplot, table) depending on the
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
630 * top masks of the data sets. its called after a new search was performed,
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
631 * refining or undo button had been clicked
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
632 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
633 initElements: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
634 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
635 var dataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
636 var granularity = 0;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
637 for( var i=0; i<dataSets.length; i++ ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
638 if( dataSets[i].maxGranularity > granularity ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
639 granularity = dataSets[i].maxGranularity;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
640 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
641 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
642 this.timeplot.initTimeplot(dataSets, granularity);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
643 this.map.initObjectLayer(dataSets);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
644 initTables();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
645 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
646
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
647 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
648 * deletes a data set with specific index
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
649 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
650 * @param {int}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
651 * index the index of the data set to delete
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
652 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
653 deleteDataSet: function(index){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
654 var color = colors[index];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
655 colors.splice(index, 1);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
656 var oldDataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
657 var newDataSets = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
658 for( var i=0; i<oldDataSets.length; i++ ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
659 if( i != index ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
660 newDataSets.push( oldDataSets[i] );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
661 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
662 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
663 colors.splice( newDataSets.length, 0, color );
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
664 this.addHistoryEntry(new HistoryEntry(newDataSets));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
665 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
666 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
667 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
668
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
669 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
670 * Switches to another history entry with the given index
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
671 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
672 * @param {int}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
673 * index the index of the history entry to load
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
674 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
675 switchThroughHistory: function( index ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
676 this.historyIndex = index;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
677 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
678 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
679
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
680 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
681 * Adds a new history entry containing actual datasets
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
682 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
683 * @param {HistoryEntry}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
684 * historyEntry the history entry to add
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
685 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
686 addHistoryEntry: function( historyEntry ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
687 this.history = this.history.slice(0,this.historyIndex+1);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
688 this.history.push(historyEntry);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
689 this.historyIndex = this.history.length - 1;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
690 addHistoryItem(this.historyIndex);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
691 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
692
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
693 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
694 * adds an element to the user individual data set
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
695 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
696 * @param {DataObject}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
697 * object the data object to add
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
698 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
699 addElement: function(object){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
700 if (this.individualDataSet == null) {
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
701 this.individualDataSet = new DataSet([], "individual", 0);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
702 var oldDataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
703 var newDataSets = oldDataSets.concat(this.individualDataSet);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
704 this.addHistoryEntry(new HistoryEntry(newDataSets));
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
705 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
706 this.individualDataSet.addObject(object);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
707 this.initElements();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
708 this.reset();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
709 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
710
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
711 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
712 * resets the core within all elements and data objects to
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
713 * non-selection-status
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
714 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
715 reset: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
716 this.refining = -2;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
717 var dataSets = this.history[this.historyIndex].dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
718 for (var i = 0; i < dataSets.length; i++){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
719 for (var j = 0; j < dataSets[i].objects.length; j++){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
720 dataSets[i].objects[j].setPercentage(0);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
721 dataSets[i].objects[j].setHover(false);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
722 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
723 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
724 this.timeplot.resetTimeplot();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
725 this.map.resetMap();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
726 updateTables(false);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
727 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
728
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
729 /**
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
730 * Security hover unselection of elements if browser events got stucked
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
731 */
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
732 undoHover: function(update){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
733
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
734 this.map.hoverUnselect();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
735 this.timeplot.hoverUnselect(update);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
736 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
737
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
738 createLink: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
739 var c = this.map.openlayersMap.getCenter();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
740 var map = this.map.openlayersMap.baseLayer.id;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
741 var mapCenter = { lon: c.lon, lat: c.lat };
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
742 var mapZoom = this.map.openlayersMap.getZoom();
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
743 var data = [];
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
744 // store complete history in data --> flow of history events
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
745 // history event can be: loading/deleting dataset, refinement by
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
746 // timerange/polygon at specific zoom level/point at specific zoom
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
747 // level, a loaded link history (this)
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
748 // flag for the ability to display stored history or not
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
749 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
750
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
751 lockScreen: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
752 this.lockScreenContainer.style.visibility = "visible";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
753 this.lockScreenContainer.style.height = getDocHeight()+"px";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
754 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
755
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
756 lockScreenMessage: function(div){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
757 this.lockScreenContainer.innerHTML = "";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
758 var lockScreenDiv = document.createElement("div");
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
759 lockScreenDiv.setAttribute('class','lockScreen');
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
760 this.lockScreenContainer.appendChild(lockScreenDiv);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
761 this.lockScreenContainer.appendChild(div);
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
762 },
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
763
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
764 unlockScreen: function(){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
765 this.lockScreenContainer.style.visibility = "hidden";
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
766 }
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
767
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
768 };
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
769
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
770 /**
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
771 * defines a history entry
7
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
772 *
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
773 * @param {DataSet[]}
4fb15c3e0e89 - added some robustness: timespan and longitude/latitude values must not be ordered anymore.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents: 6
diff changeset
774 * dataSets the datasets of this history entry
3
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
775 *
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
776 * @constructor
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
777 */
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
778 function HistoryEntry( dataSets ){
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
779 this.dataSets = dataSets;
cf06b77a8bbd Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff changeset
780 };