Mercurial > hg > STI-GWT
annotate war/scripts/sti/STICore.js @ 87:593cfbd58c3e trimmed_data
CSV conversion: place name, address and descrption in CDATA blocks (prevents bugs with special characters as < etc.)
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 07 Mar 2013 14:56:13 +0100 |
parents | ed444173aef0 |
children |
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 |
75
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
226 this.overlays = []; |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
227 try { |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
228 var jsonString = this.getFileString("overlaysources.json"); |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
229 this.overlays = eval('(' + jsonString + ')'); |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
230 } |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
231 catch(e){ |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
232 } |
d69066d16e45
load overlays from data-file
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
73
diff
changeset
|
233 |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
234 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
|
235 this.lockScreenContainer.setAttribute('class','lockScreenContainer'); |
18
60d50ef2261f
move lockscreen-container below mainContainer
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
236 document.getElementById("mainContainer").appendChild(this.lockScreenContainer); |
3
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 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
239 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
240 getFileString: function(url){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
241 var xmlhttp = false; |
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 XMLHttpRequest(); |
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 (typeof ActiveXObject != "undefined") { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
250 if (!xmlhttp) |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
251 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
252 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
|
253 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
254 catch (e) { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
255 xmlhttp = false; |
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 if (!xmlhttp) |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
258 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
259 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
|
260 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
261 catch (e) { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
262 xmlhttp = false; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
263 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
264 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
265 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
|
266 xmlhttp.send(""); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
267 return xmlhttp.responseText; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
268 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
269 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
270 /** |
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
|
271 * 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
|
272 * 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
|
273 * |
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 * @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
|
275 * 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
|
276 * @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
|
277 * 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
|
278 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
279 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
|
280 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
|
281 // 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
|
282 // url += tags; |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
283 url += input; |
4
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 /* 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
|
286 var beginCsv = url.indexOf("csv=true"); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
287 if (beginCsv != -1) { |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
288 /* remove "csv=true" from request parameters */ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
289 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
|
290 /* convert csv to kml */ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
291 this.parseCsv(url,input,ds); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
292 } |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
293 else { |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
294 /* parse kml */ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
295 this.parseKml(url,input,ds); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
296 } |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
297 }, |
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 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
|
300 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
|
301 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
302 var bc = false; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
303 if( timeString.startsWith("-") ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
304 bc = true; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
305 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
|
306 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
307 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
|
308 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
|
309 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
|
310 parseInt(timeData[i]); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
311 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
312 if( bc ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
313 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
|
314 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
315 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
|
316 return timeData; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
317 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
318 var dayData; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
319 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
|
320 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
|
321 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
322 else { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
323 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
|
324 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
325 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
|
326 parseInt(dayData[i]); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
327 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
328 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
|
329 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
330 catch (exception) { |
60
6f2d2b6f969a
Fix KML parser alerts
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
33
diff
changeset
|
331 alert("\""+timeString+"\" is no valid time/date"); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
332 return null; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
333 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
334 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
335 |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
336 var core = this; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
337 |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
338 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
|
339 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
|
340 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
|
341 var granularity = 0; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
342 |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
343 if( elements.length == 0 ){ |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
344 this.unblockUI(); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
345 return; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
346 } |
73
02cdf454d94b
only create XLMSerializer once per dataset parsing
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
72
diff
changeset
|
347 |
02cdf454d94b
only create XLMSerializer once per dataset parsing
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
72
diff
changeset
|
348 var xmlSerializer = new XMLSerializer(); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
349 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
350 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
|
351 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
352 var placemark = elements[i]; |
68
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
353 var name, description, descriptionData, place, timeData, coordinates, timeStamp, timeSpan, g; |
29
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
354 |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
355 try{ |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
356 var nameElement = placemark.getElementsByTagName("name"); |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
357 if ( (nameElement != null) && (nameElement.length > 0) && (nameElement[0].childNodes.length > 0) ){ |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
358 name = nameElement[0].childNodes[0].nodeValue; |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
359 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
360 else { |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
361 name = ""; |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
362 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
363 } catch(e) { |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
364 name = ""; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
365 } |
29
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
366 |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
367 try{ |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
368 var descriptionElement = placemark.getElementsByTagName("description"); |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
369 if ( (descriptionElement != null) && (descriptionElement.length > 0) && (descriptionElement[0].childNodes.length > 0) ){ |
68
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
370 |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
371 description = $(descriptionElement).text(); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
372 |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
373 //check whether the description element contains a table |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
374 //if yes, this data will be loaded as separate columns |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
375 try{ |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
376 //cleanWhitespace removes non-sense text-nodes (space, tab) |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
377 //and is an addition to jquery defined in Sti.html |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
378 var descriptionDocument = $($.parseXML(description)).cleanWhitespace(); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
379 |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
380 descriptionData = new Object(); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
381 |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
382 $(descriptionDocument).find("tr").each( |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
383 function() { |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
384 var isHeader = true; |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
385 var lastHeader = ""; |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
386 |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
387 $(this).find("td").each( |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
388 function() { |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
389 if (isHeader) { |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
390 lastHeader = $(this).text(); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
391 isHeader = false; |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
392 } else { |
71
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
393 var value = ""; |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
394 |
72
4d3df00f5b98
added comments for HTML content in cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
71
diff
changeset
|
395 //if this td contains HTML, serialize all |
4d3df00f5b98
added comments for HTML content in cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
71
diff
changeset
|
396 //it's children (the "content"!) |
71
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
397 $(this).children().each( |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
398 function() { |
73
02cdf454d94b
only create XLMSerializer once per dataset parsing
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
72
diff
changeset
|
399 value += xmlSerializer.serializeToString(this); |
71
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
400 } |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
401 ); |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
402 |
72
4d3df00f5b98
added comments for HTML content in cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
71
diff
changeset
|
403 //no HTML content (or no content at all) |
71
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
404 if (value.length == 0) |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
405 value = $(this).text(); |
a610b45d0f90
Allow HTML in all Cells
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
406 |
70
e6b72868e395
Allow more than one field of the same name (append the content)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
68
diff
changeset
|
407 if (descriptionData[lastHeader] != null) |
e6b72868e395
Allow more than one field of the same name (append the content)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
68
diff
changeset
|
408 //append if a field occures more than once |
e6b72868e395
Allow more than one field of the same name (append the content)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
68
diff
changeset
|
409 descriptionData[lastHeader] += "\n" + value; |
e6b72868e395
Allow more than one field of the same name (append the content)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
68
diff
changeset
|
410 else |
e6b72868e395
Allow more than one field of the same name (append the content)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
68
diff
changeset
|
411 descriptionData[lastHeader] = value; |
68
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
412 isHeader = true; |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
413 } |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
414 } |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
415 ) |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
416 } |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
417 ); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
418 } catch(e) { |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
419 //Description is either no HTML or no table |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
420 alert(e); |
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
421 } |
29
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
422 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
423 else { |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
424 description = ""; |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
425 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
426 } catch(e) { |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
427 description = ""; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
428 } |
29
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
429 |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
430 try{ |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
431 var placeElement = placemark.getElementsByTagName("address"); |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
432 if ( (placeElement != null) && (placeElement.length > 0) && (placeElement[0].childNodes.length > 0) ){ |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
433 place = placeElement[0].childNodes[0].nodeValue; |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
434 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
435 else { |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
436 place = ""; |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
437 } |
4711c4ab0c23
Improved robustness of KML parsing (with Firefox and probably other browsers a missing node can lead to a NullPointerException that will not be catched by the try/catch)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
18
diff
changeset
|
438 } catch(e) { |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
439 place = ""; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
440 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
441 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
442 var getDate = function(timeData){ |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
443 try { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
444 var date; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
445 if (timeData.length == 6) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
446 g = time.SECOND; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
447 date = new Date(Date.UTC(timeData[0], timeData[1]-1, timeData[2], timeData[3], timeData[4], timeData[5])); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
448 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
449 else if (timeData.length == 3) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
450 g = time.DAY; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
451 date = new Date(Date.UTC(timeData[0], timeData[1]-1, timeData[2])); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
452 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
453 else if (timeData.length == 2) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
454 g = time.MONTH; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
455 date = new Date(Date.UTC(timeData[0], timeData[1]-1, 1)); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
456 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
457 else if (timeData.length == 1) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
458 g = time.YEAR; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
459 date = new Date(Date.UTC(timeData[0], 0, 1)); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
460 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
461 if (granularity < g) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
462 granularity = g; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
463 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
464 if( timeData[0] && timeData[0] < 100 ){ |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
465 date.setFullYear(timeData[0]); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
466 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
467 return date; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
468 } catch (e) { |
60
6f2d2b6f969a
Fix KML parser alerts
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
33
diff
changeset
|
469 alert("\""+timeData+"\" is no valid time/date"); |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
470 return null; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
471 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
472 } |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
473 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
474 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
475 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
|
476 if( timeData != null ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
477 timeStamp = getDate(timeData); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
478 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
479 if( timeStamp == undefined ){ |
66
c7df41c5de53
Alerts on missing time/spatial information
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
60
diff
changeset
|
480 alert("No valid timestamp or timespan information for element " + i + "."); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
481 continue; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
482 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
483 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
484 catch(e){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
485 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
486 timeStamp = undefined; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
487 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
|
488 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
494 catch(e){ |
60
6f2d2b6f969a
Fix KML parser alerts
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
33
diff
changeset
|
495 alert("No valid timestamp or timespan information for element " + i + "."); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
496 continue; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
497 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
498 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
499 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
500 try { |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
501 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
|
502 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
|
503 if( lonlat[0] == "" || lonlat[1] == "" || isNaN(lonlat[0]) || isNaN(lonlat[1]) ){ |
66
c7df41c5de53
Alerts on missing time/spatial information
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
60
diff
changeset
|
504 alert("No valid coordinate information for element " + i + "."); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
505 continue; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
506 } |
68
8b58d9bc0bb6
add functionality for additional tabular data from the description field (work in progress)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
507 newObjects.push(new DataObject(name, description, place, timeStamp, timeSpan, g, lonlat[0], lonlat[1], descriptionData)); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
508 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
509 catch(e){ |
60
6f2d2b6f969a
Fix KML parser alerts
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
33
diff
changeset
|
510 alert("No valid coordinate information for element " + i + "."); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
511 continue; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
512 } |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
513 } |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
514 |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
515 var dataset = new DataSet( newObjects, term, granularity ); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
516 dataset.source = ds; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
517 var status = document.getElementById("statusText"); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
518 status.innerHTML = "Space & Time Aggregation ..."; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
519 setTimeout( function(){ |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
520 core.addDataSet( dataset ); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
521 core.unblockUI(); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
522 }, |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
523 1 ); |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
524 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
525 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
526 /** |
32
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
527 * retrieves and loads a kml-file from the local system |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
528 * |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
529 * @param {int} |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
530 * ds the datasource index |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
531 * @param {File} |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
532 * file the file that the user selected |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
533 */ |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
534 retrieveLocalKml: function(ds,filename){ |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
535 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
536 var core = this; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
537 if( this.blocked ){ |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
538 setTimeout( function(){ core.retrieveLocalKml(ds,filename); }, 100 ); |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
539 return; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
540 } |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
541 core.blockUI(); |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
542 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
543 var status = document.getElementById("statusText"); |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
544 status.innerHTML = "Retrieving Data ..."; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
545 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
546 var filelist = $('#localKMLFileChooser').get(0).files; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
547 if (filelist.length > 0){ |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
548 var file = filelist[0]; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
549 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
550 var reader = new FileReader(); |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
551 |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
552 reader.onloadend = (function(theFile) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
553 return function(e) { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
554 status.innerHTML = "Parsing Data ..."; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
555 |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
556 var localkmlDoc; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
557 try { |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
558 localkmlDoc = $.parseXML(reader.result); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
559 } catch (e) { |
60
6f2d2b6f969a
Fix KML parser alerts
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
33
diff
changeset
|
560 alert("KML file is not valid XML. Please check opening/closing tags and check the spelling."); |
33
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
561 |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
562 core.unblockUI(); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
563 |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
564 return; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
565 } |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
566 |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
567 setTimeout( function(){ core.parseIt(localkmlDoc,filename,ds); }, 1 ); |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
568 }; |
24c45a9048f2
corrected FileReader usage (onloaded callback) for local KML support
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
32
diff
changeset
|
569 })(file); |
32
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
570 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
571 reader.readAsText(file); |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
572 } |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
573 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
574 return; |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
575 }, |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
576 |
f635bbdc6a03
local KML display (beta)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
29
diff
changeset
|
577 /** |
86
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
578 * retrieves and loads a CSV-file from the local system |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
579 * |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
580 * @param {int} |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
581 * ds the datasource index |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
582 * @param {File} |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
583 * file the file that the user selected |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
584 */ |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
585 retrieveLocalCsv: function(ds,filename){ |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
586 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
587 var core = this; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
588 if( this.blocked ){ |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
589 setTimeout( function(){ core.retrieveLocalCsv(ds,filename); }, 100 ); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
590 return; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
591 } |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
592 core.blockUI(); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
593 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
594 var status = document.getElementById("statusText"); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
595 status.innerHTML = "Retrieving Data ..."; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
596 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
597 var filelist = $('#localCSVFileChooser').get(0).files; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
598 if (filelist.length > 0){ |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
599 var file = filelist[0]; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
600 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
601 var reader = new FileReader(); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
602 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
603 reader.onloadend = (function(theFile) { |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
604 return function(e) { |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
605 status.innerHTML = "Parsing Data ..."; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
606 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
607 var kmlText = core.convertCsv(reader.result); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
608 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
609 var localkmlDoc; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
610 try { |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
611 localkmlDoc = $.parseXML(kmlText); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
612 } catch (e) { |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
613 alert("KML file is not valid XML. Please check opening/closing tags and check the spelling."); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
614 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
615 core.unblockUI(); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
616 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
617 return; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
618 } |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
619 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
620 setTimeout( function(){ core.parseIt(localkmlDoc,filename,ds); }, 1 ); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
621 }; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
622 })(file); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
623 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
624 reader.readAsText(file); |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
625 } |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
626 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
627 return; |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
628 }, |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
629 |
ed444173aef0
local CSV loading
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
85
diff
changeset
|
630 /** |
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
|
631 * 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
|
632 * |
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
|
633 * @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
|
634 * 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
|
635 * @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
|
636 * 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
|
637 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
638 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
|
639 var core = this; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
640 if( this.blocked ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
641 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
|
642 return; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
643 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
644 core.blockUI(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
645 $.ajax({ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
646 url: kmlFile, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
647 dataType: "xml", |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
648 beforeSend: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
649 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
|
650 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
|
651 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
652 success: function(xml){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
653 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
|
654 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
|
655 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
|
656 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
657 }); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
658 }, |
4
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
659 |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
660 /** |
85
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
661 * converts the csv-file to a kml-file |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
662 * |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
663 * @param {String} |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
664 * text |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
665 */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
666 convertCsv: function(text){ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
667 |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
668 var status = document.getElementById("statusText"); |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
669 status.innerHTML = "Converting CSV to KML ..."; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
670 /* convert here from csv to kml */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
671 var kmlString = '<?xml version="1.0" standalone="yes"?>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
672 kmlString += '<kml xmlns="http://www.opengis.com/kml/ext/2.2">\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
673 kmlString += '\t<Folder>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
674 /* define expected csv table headers (first line) */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
675 var expectedHeaders = new Array("Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end"); |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
676 /* convert csv string to array of arrays using ucsv library */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
677 var csvArray = CSV.csvToArray(text); |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
678 /* get real used table headers from csv file (first line) */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
679 var usedHeaders = csvArray[0]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
680 /* loop outer array, begin with second line */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
681 for (var i = 1; i < csvArray.length; i++) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
682 var innerArray = csvArray[i]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
683 kmlString += '\t\t<Placemark>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
684 /* declare few variables */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
685 var timespanBegin = ""; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
686 var timespanEnd = ""; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
687 var longitude = ""; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
688 var latitude = ""; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
689 /* loop inner array */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
690 for (var j = 0; j < innerArray.length; j++) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
691 /* Name */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
692 if (usedHeaders[j] == expectedHeaders[0]) { |
87
593cfbd58c3e
CSV conversion: place name, address and descrption in CDATA blocks (prevents bugs with special characters as < etc.)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
693 kmlString += '\t\t\t<name><![CDATA[' + innerArray[j] + ']]></name>\n'; |
85
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
694 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
695 /* Address */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
696 if (usedHeaders[j] == expectedHeaders[1]) { |
87
593cfbd58c3e
CSV conversion: place name, address and descrption in CDATA blocks (prevents bugs with special characters as < etc.)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
697 kmlString += '\t\t\t<address><![CDATA[' + innerArray[j] + ']]></address>\n'; |
85
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
698 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
699 /* Description */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
700 if (usedHeaders[j] == expectedHeaders[2]) { |
87
593cfbd58c3e
CSV conversion: place name, address and descrption in CDATA blocks (prevents bugs with special characters as < etc.)
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
701 kmlString += '\t\t\t<description><![CDATA[' + innerArray[j] + ']]></description>\n'; |
85
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
702 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
703 /* TimeStamp */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
704 if (usedHeaders[j] == expectedHeaders[5]) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
705 kmlString += '\t\t\t<TimeStamp>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
706 '\t\t\t\t<when>' + innerArray[j] + '</when>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
707 '\t\t\t</TimeStamp>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
708 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
709 /* TimeSpan:begin */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
710 if (usedHeaders[j] == expectedHeaders[6]) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
711 timespanBegin = innerArray[j]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
712 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
713 /* TimeSpan:end */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
714 if (usedHeaders[j] == expectedHeaders[7]) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
715 timespanEnd = innerArray[j]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
716 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
717 /* Longitude */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
718 if (usedHeaders[j] == expectedHeaders[3]) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
719 longitude = innerArray[j]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
720 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
721 /* Latitude */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
722 if (usedHeaders[j] == expectedHeaders[4]) { |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
723 latitude = innerArray[j]; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
724 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
725 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
726 /* set timespan:begin und timespan:end */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
727 kmlString += '\t\t\t<TimeSpan>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
728 '\t\t\t\t<begin>' + timespanBegin + '</begin>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
729 '\t\t\t\t<end>' + timespanEnd + '</end>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
730 '\t\t\t</TimeSpan>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
731 /* set longitude and latitude */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
732 kmlString += '\t\t\t<Point>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
733 '\t\t\t\t<coordinates>' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
734 longitude +',' + latitude + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
735 '</coordinates>\n' + |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
736 '\t\t\t</Point>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
737 /* end Placemark */ |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
738 kmlString += '\t\t</Placemark>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
739 } |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
740 kmlString += '\t</Folder>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
741 kmlString += '</kml>\n'; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
742 |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
743 return kmlString; |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
744 }, |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
745 |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
746 /** |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
747 * loads the csv-file |
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
|
748 * |
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
|
749 * @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
|
750 * 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
|
751 * @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
|
752 * 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
|
753 */ |
4
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
754 parseCsv: function(csvFile,term,ds){ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
755 var core = this; |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
756 if( this.blocked ){ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
757 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
|
758 return; |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
759 } |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
760 core.blockUI(); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
761 $.ajax({ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
762 url: csvFile, |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
763 dataType: "text", |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
764 beforeSend: function(){ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
765 var status = document.getElementById("statusText"); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
766 status.innerHTML = "Retrieving Data ..."; |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
767 }, |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
768 success: function(text){ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
769 var status = document.getElementById("statusText"); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
770 status.innerHTML = "Converting CSV to KML ..."; |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
771 /* convert here from csv to kml */ |
85
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
772 var kmlString = convertCsv(text); |
108c853e0900
CSV to KML conversion moved to seperate function
Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
parents:
75
diff
changeset
|
773 |
4
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
774 /* convert string to xml */ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
775 var kmlXml = $.parseXML(kmlString); |
6
7bf904a68ce7
- fixed xml creation bug
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
4
diff
changeset
|
776 console.log(kmlXml); |
4
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
777 /* pares the converted kml data */ |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
778 var status = document.getElementById("statusText"); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
779 status.innerHTML = "Parsing Data ..."; |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
780 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
|
781 } |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
782 }); |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
783 }, |
517a6422d1bd
done all the GeoBrowser changes
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
3
diff
changeset
|
784 |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
785 /** |
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
|
786 * 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
|
787 * 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
|
788 * 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
|
789 * |
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
|
790 * @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
|
791 * 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
|
792 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
793 updateTimeAndTable: function(hover){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
794 updateTables(hover); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
795 this.timeplot.polesBySlices(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
796 this.refining = -1; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
797 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
798 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
799 /** |
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
|
800 * 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
|
801 * 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
|
802 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
803 updateMapAndTimeAndTable: function(index){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
804 updateTables(hover); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
805 this.timeplot.polesBySlices(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
806 this.map.updateMap(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
807 this.refining = index; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
808 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
809 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
810 /** |
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
|
811 * 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
|
812 * 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
|
813 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
814 updateTimeAndMap: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
815 this.map.updateMap(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
816 this.timeplot.polesBySlices(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
817 this.refining = -1; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
818 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
819 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
820 /** |
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
|
821 * 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
|
822 * 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
|
823 * -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
|
824 * |
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
|
825 * @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
|
826 * 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
|
827 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
828 updateTableAndMap: function(hover){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
829 updateTables(hover); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
830 this.map.updateMap(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
831 this.refining = -1; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
832 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
833 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
834 /** |
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
|
835 * 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
|
836 * 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
|
837 * 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
|
838 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
839 initElements: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
840 this.reset(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
841 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
|
842 var granularity = 0; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
843 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
|
844 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
|
845 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
|
846 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
847 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
848 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
|
849 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
|
850 initTables(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
851 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
852 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
853 /** |
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
|
854 * 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
|
855 * |
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
|
856 * @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
|
857 * 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
|
858 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
859 deleteDataSet: function(index){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
860 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
|
861 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
|
862 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
|
863 var newDataSets = []; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
864 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
|
865 if( i != index ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
866 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
|
867 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
868 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
869 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
|
870 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
|
871 this.initElements(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
872 this.reset(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
873 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
874 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
875 /** |
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
|
876 * 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
|
877 * |
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
|
878 * @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
|
879 * 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
|
880 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
881 switchThroughHistory: function( index ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
882 this.historyIndex = index; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
883 this.initElements(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
884 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
885 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
886 /** |
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
|
887 * 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
|
888 * |
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
|
889 * @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
|
890 * 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
|
891 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
892 addHistoryEntry: function( historyEntry ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
893 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
|
894 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
|
895 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
|
896 addHistoryItem(this.historyIndex); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
897 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
898 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
899 /** |
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
|
900 * 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
|
901 * |
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
|
902 * @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
|
903 * 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
|
904 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
905 addElement: function(object){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
906 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
|
907 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
|
908 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
|
909 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
|
910 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
|
911 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
912 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
|
913 this.initElements(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
914 this.reset(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
915 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
916 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
917 /** |
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
|
918 * 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
|
919 * 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
|
920 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
921 reset: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
922 this.refining = -2; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
923 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
|
924 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
|
925 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
|
926 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
|
927 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
|
928 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
929 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
930 this.timeplot.resetTimeplot(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
931 this.map.resetMap(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
932 updateTables(false); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
933 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
934 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
935 /** |
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
|
936 * 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
|
937 */ |
3
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
938 undoHover: function(update){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
939 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
940 this.map.hoverUnselect(); |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
941 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
|
942 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
943 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
944 createLink: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
945 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
|
946 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
|
947 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
|
948 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
|
949 var data = []; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
950 // 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
|
951 // 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
|
952 // 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
|
953 // 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
|
954 // 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
|
955 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
956 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
957 lockScreen: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
958 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
|
959 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
|
960 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
961 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
962 lockScreenMessage: function(div){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
963 this.lockScreenContainer.innerHTML = ""; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
964 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
|
965 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
|
966 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
|
967 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
|
968 }, |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
969 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
970 unlockScreen: function(){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
971 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
|
972 } |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
973 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
974 }; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
975 |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
976 /** |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
977 * 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
|
978 * |
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
|
979 * @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
|
980 * 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
|
981 * |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
982 * @constructor |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
983 */ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
984 function HistoryEntry( dataSets ){ |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
985 this.dataSets = dataSets; |
cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
parents:
diff
changeset
|
986 }; |