Mercurial > hg > STI-GWT
changeset 4:517a6422d1bd
done all the GeoBrowser changes
- image changed
- background gradient darkened
- added csv compatibility
- added ucsv library
- maybe more minor changes
git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@48 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author | StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b> |
---|---|
date | Fri, 20 Jul 2012 10:14:57 +0000 |
parents | cf06b77a8bbd |
children | 272b1b18e635 |
files | .gitignore README src/econnect/wp3_3/client/core/ApplicationConstants.properties src/econnect/wp3_3/client/core/ApplicationGrid.java war/Sti.html war/datasources.json war/layers.xml war/scripts/sti/STICore.js war/scripts/sti/STIMap.js |
diffstat | 9 files changed, 260 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/.gitignore Tue Jul 17 13:34:40 2012 +0000 +++ b/.gitignore Fri Jul 20 10:14:57 2012 +0000 @@ -1,3 +1,5 @@ /.classpath /.project /.settings +/build +/e4d.war
--- a/README Tue Jul 17 13:34:40 2012 +0000 +++ b/README Fri Jul 20 10:14:57 2012 +0000 @@ -1,7 +1,8 @@ Europeana.4D GWT Implementation *Building* -To build the GWT based implementation just run ant in the root folder (the directory where this file lives in). +To build the GWT based implementation just run ant in the root folder (the +directory where this file lives in). $ ant @@ -14,3 +15,7 @@ $ ant war +2012-07-17 (fu) + +This is the DARIAH GeoBrowser using the e4D, branched from revision 19384 of +the e4D repository: https://www.europeanalabs.eu/svn/contrib/sti/branches/sti-gwt
--- a/src/econnect/wp3_3/client/core/ApplicationConstants.properties Tue Jul 17 13:34:40 2012 +0000 +++ b/src/econnect/wp3_3/client/core/ApplicationConstants.properties Fri Jul 20 10:14:57 2012 +0000 @@ -29,7 +29,8 @@ pauseEnabled = images/pause_2.png pauseDisabled = images/pause_0.png deleteImage = images/delete.png -logoImage = images/e4D.png +#logoImage = images/e4D.png +logoImage = images/DARIAH.png historyImage = images/history_0.png historyOverImage = images/history_1.png openImage = images/open_1.png
--- a/src/econnect/wp3_3/client/core/ApplicationGrid.java Tue Jul 17 13:34:40 2012 +0000 +++ b/src/econnect/wp3_3/client/core/ApplicationGrid.java Fri Jul 20 10:14:57 2012 +0000 @@ -428,8 +428,8 @@ RootPanel.get().setWidgetPosition(this.logo,(docWidth-width)/2-40,8); Grid linkList = new Grid(1,7); - HTML informationLink = new HTML(" Information"); - informationLink.setTitle("Information"); + HTML informationLink = new HTML(" e4D - Info"); + informationLink.setTitle("e4D - Info"); informationLink.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event) { Window.open("http://wp1187670.wp212.webpack.hosteurope.de/e4d/?page_id=2", "_blank", "");
--- a/war/Sti.html Tue Jul 17 13:34:40 2012 +0000 +++ b/war/Sti.html Fri Jul 20 10:14:57 2012 +0000 @@ -10,57 +10,37 @@ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> - <title>Spatio-Temporal Interface</title> + <title>DARIAH GeoBrowser – Spatio-Temporal Interface</title> - <script type="text/javascript" language="javascript" src="sti/sti.nocache.js"></script> - + <script type="text/javascript" language="javascript" src="sti/sti.nocache.js"></script> <script src="scripts/jQuery/jquery-1.5.1.js"></script> - <script src="scripts/blockUI/FullscreenWindow.js"> - </script> - - <script src="scripts/Timeplot/timeplot-complete.js"> - </script> - - <link type="text/css" rel="stylesheet" href="Sti.css"> + <script src="scripts/blockUI/FullscreenWindow.js"></script> + <script src="scripts/Timeplot/timeplot-complete.js"></script> + <link type="text/css" rel="stylesheet" href="Sti.css"> <link type="text/css" rel="stylesheet" href="scripts/OpenLayers/theme/default/style.css"> - <script src="scripts/sti/timeplot-modify.js"> - </script> - <script src="scripts/sti/properties.js"> - </script> - <script src="scripts/sti/STIProps.js"> - </script> - <script src="scripts/sliderCombined.js"></script> + <script src="scripts/sti/timeplot-modify.js"></script> + <script src="scripts/sti/properties.js"></script> + <script src="scripts/sti/STIProps.js"></script> + <script src="scripts/sliderCombined.js"></script> - <!--[if IE]><script type="text/javascript" src="scripts/libs/lib/excanvas.js"></script><![endif]--> + <!--[if IE]><script type="text/javascript" src="scripts/libs/lib/excanvas.js"></script><![endif]--> - <script src="scripts/sti/STIMap.js"> - </script> - <script src="scripts/sti/STITimeplot.js"> - </script> - <script src="scripts/sti/STITutorial.js"> - </script> - <script src="scripts/sti/STICore.js"> - </script> - <script src="scripts/sti/DataObject.js"> - </script> - <script src="scripts/sti/DataSet.js"> - </script> - <script src="scripts/sti/ExtendedDataSource.js"> - </script> - <script src="scripts/sti/ExtendedSimileTimeDate.js"> - </script> - <script src="scripts/sti/PointObject.js"> - </script> - <script src="scripts/sti/clustering.js"> - </script> - <script src="scripts/sti/kruskal.js"> - </script> - <script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script> - <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA9fk2zbuNVVuEn15Psaq2PBQA5iru8D4oAiKqp2IsPj83TmCfmhQjfU_nwc4KUXaEdhRYIuef-uZlxw" type="text/javascript"> - </script> - <script src="scripts/OpenLayers/OpenLayers.js"></script> - </script> + <script src="scripts/sti/STIMap.js"></script> + <script src="scripts/sti/STITimeplot.js"></script> + <script src="scripts/sti/STITutorial.js"></script> + <script src="scripts/sti/STICore.js"></script> + <script src="scripts/sti/DataObject.js"></script> + <script src="scripts/sti/DataSet.js"></script> + <script src="scripts/sti/ExtendedDataSource.js"></script> + <script src="scripts/sti/ExtendedSimileTimeDate.js"></script> + <script src="scripts/sti/PointObject.js"></script> + <script src="scripts/sti/clustering.js"></script> + <script src="scripts/sti/kruskal.js"></script> + <script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script> + <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=AIzaSyCHBMq6Ndi9Kcq5w9jwP9DWKJlxRuIPQmI" type="text/javascript"></script> + <script src="scripts/OpenLayers/OpenLayers.js"></script> + <script src="scripts/ucsv/ucsv-1.1.0-min.js"></script> </head> <!-- -->
--- a/war/datasources.json Tue Jul 17 13:34:40 2012 +0000 +++ b/war/datasources.json Fri Jul 20 10:14:57 2012 +0000 @@ -1,152 +1,160 @@ [ { - "label" : "Static Data", - "categories" : [ + "label": "Static Data", + "categories": [ { "category": "WebOPAC Goettingen", "items": [ { - "label" : "Franz Kafka", - "url" : "data/kafka.kml" + "label": "Franz Kafka", + "url": "data/kafka.kml" }, { - "label" : "Friedrich Schiller", - "url" : "data/schiller.kml" + "label": "Friedrich Schiller", + "url": "data/schiller.kml" }, { - "label" : "Gotthold Ephraim Lessing", - "url" : "data/lessing.kml" + "label": "Gotthold Ephraim Lessing", + "url": "data/lessing.kml" }, { - "label" : "Heinrich Boell", - "url" : "data/boell.kml" + "label": "Heinrich Boell", + "url": "data/boell.kml" }, { - "label" : "Heinrich Heine", - "url" : "data/heine.kml" + "label": "Heinrich Heine", + "url": "data/heine.kml" }, { - "label" : "Johann Wolfgang von Goethe", - "url" : "data/goethe.kml" + "label": "Johann Wolfgang von Goethe", + "url": "data/goethe.kml" }, { - "label" : "William Shakespeare", - "url" : "data/shakespeare.kml" - } - ] + "label": "William Shakespeare", + "url": "data/shakespeare.kml" + } + ] }, { "category": "Static Flickr Data", "items": [ { - "label" : "Tsunami", - "url" : "data/flickr/Tsunami.kml" + "label": "Tsunami", + "url": "data/flickr/Tsunami.kml" }, { - "label" : "Volcano", - "url" : "data/flickr/Volcano.kml" + "label": "Volcano", + "url": "data/flickr/Volcano.kml" }, { - "label" : "Earthquake", - "url" : "data/flickr/Earthquake.kml" + "label": "Earthquake", + "url": "data/flickr/Earthquake.kml" }, { - "label" : "U2", - "url" : "data/flickr/U2.kml" + "label": "U2", + "url": "data/flickr/U2.kml" }, { - "label" : "Muse", - "url" : "data/flickr/Muse.kml" + "label": "Muse", + "url": "data/flickr/Muse.kml" } - ] + ] }, { "category": "Political Data", "items": [ { - "label" : "Guardian Afghanistan war logs", - "url" : "data/afghanevents1_type-category.kml" + "label": "Guardian Afghanistan war logs", + "url": "data/afghanevents1_type-category.kml" }, { - "label" : "Guardian Afghanistan IED attacks", - "url" : "data/explodedied_category.kml" + "label": "Guardian Afghanistan IED attacks", + "url": "data/explodedied_category.kml" }, { - "label" : "Armed Conflicts from 1945-2008", - "url" : "data/conflicts.kml" + "label": "Armed Conflicts from 1945-2008", + "url": "data/conflicts.kml" }, { - "label" : "Casualties of radical right-wing crimes", - "url" : "data/rechtegewalt.kml" + "label": "Casualties of radical right-wing crimes", + "url": "data/rechtegewalt.kml" } - ] + ] }, { "category": "Internet Movie Database", "items": [ { - "label" : "Top 5000", - "url" : "data/imdb/imdb_best5000.kml" + "label": "Top 5000", + "url": "data/imdb/imdb_best5000.kml" }, { - "label" : "Flop 5000", - "url" : "data/imdb/imdb_worst5000.kml" - } - ] + "label": "Flop 5000", + "url": "data/imdb/imdb_worst5000.kml" + } + ] }, { "category": "DBPedia Queries", "items": [ { - "label" : "Museums", - "url" : "data/dbpedia/museum.kml" + "label": "Museums", + "url": "data/dbpedia/museum.kml" }, { - "label" : "Football World Cup Winners", - "url" : "data/dbpedia/WorldCupWinners.kml" + "label": "Football World Cup Winners", + "url": "data/dbpedia/WorldCupWinners.kml" + }, + { + "label": "Football European Cup Winners", + "url": "data/dbpedia/EuropeanCupWinners.kml" }, { - "label" : "Football European Cup Winners", - "url" : "data/dbpedia/EuropeanCupWinners.kml" + "label": "Manchester United players", + "url": "data/dbpedia/ManU.kml" }, { - "label" : "Manchester United players", - "url" : "data/dbpedia/ManU.kml" + "label": "Chelsea FC players", + "url": "data/dbpedia/Chelsea.kml" }, { - "label" : "Chelsea FC players", - "url" : "data/dbpedia/Chelsea.kml" + "label": "FC Liverpool players", + "url": "data/dbpedia/Liverpool.kml" }, { - "label" : "FC Liverpool players", - "url" : "data/dbpedia/Liverpool.kml" + "label": "Real Madrid players", + "url": "data/dbpedia/Real.kml" }, { - "label" : "Real Madrid players", - "url" : "data/dbpedia/Real.kml" - }, - { - "label" : "FC Barcelona players", - "url" : "data/dbpedia/Barca.kml" + "label": "FC Barcelona players", + "url": "data/dbpedia/Barca.kml" }, { - "label" : "FC Bayern Muenchen players", - "url" : "data/dbpedia/FCBayern.kml" + "label": "FC Bayern Muenchen players", + "url": "data/dbpedia/FCBayern.kml" } - ] + ] } - ] + ] + }, + { + "label": "KML File URL", + "url": "/tpp/req?url=" }, - { - "label" : "KML File URL", - "url" : "/tpp/req?url=" + { + "label": "KMZ File URL", + "url": "/tpp/req?kmz=true&url=" + }, + { + "label": "CSV File URL", + "url": "/tpp/req?csv=true&url=" }, - { - "label" : "Europeana", - "url" : "/tpp/req?url=http://europeana.eu/portal/search.kml?query=" + { + "label": "Europeana", + "url": "/tpp/req?url=http://europeana.eu/portal/search.kml?query=" }, - { - "label" : "Flickr", - "url" : "/FlickrService/flickr-service?places=false&tags=" + { + "label": "Flickr", + "url": "/FlickrService/flickr-service?places=false&tags=" } -] +] \ No newline at end of file
--- a/war/layers.xml Tue Jul 17 13:34:40 2012 +0000 +++ b/war/layers.xml Fri Jul 20 10:14:57 2012 +0000 @@ -2,7 +2,7 @@ <wms> <name id="name">Contemporary Map</name> <server id="server">/geoserver/wms</server> - <layer id="layer">historic:world</layer> + <layer id="layer">historic:cntry1994</layer> <format id="format">image/png</format> <transparency id="transparency">true</transparency> </wms> @@ -56,6 +56,13 @@ <transparency id="transparency">true</transparency> </wms> <wms> + <name id="name">Historical Map of 1715</name> + <server id="server">/geoserver/wms</server> + <layer id="layer">historic:cntry1715</layer> + <format id="format">image/png</format> + <transparency id="transparency">true</transparency> + </wms> + <wms> <name id="name">Historical Map of 1650</name> <server id="server">/geoserver/wms</server> <layer id="layer">historic:cntry1650</layer> @@ -126,6 +133,13 @@ <transparency id="transparency">true</transparency> </wms> <wms> + <name id="name">Historical Map of 323 BC</name> + <server id="server">/geoserver/wms</server> + <layer id="layer">historic:cntry323bc</layer> + <format id="format">image/png</format> + <transparency id="transparency">true</transparency> + </wms> + <wms> <name id="name">Historical Map of 500 BC</name> <server id="server">/geoserver/wms</server> <layer id="layer">historic:cntry500bc</layer> @@ -139,4 +153,11 @@ <format id="format">image/png</format> <transparency id="transparency">true</transparency> </wms> + <wms> + <name id="name">Historical Map of 2000 BC</name> + <server id="server">/geoserver/wms</server> + <layer id="layer">historic:cntry2000bc</layer> + <format id="format">image/png</format> + <transparency id="transparency">true</transparency> + </wms> </layers>
--- a/war/scripts/sti/STICore.js Tue Jul 17 13:34:40 2012 +0000 +++ b/war/scripts/sti/STICore.js Fri Jul 20 10:14:57 2012 +0000 @@ -264,7 +264,19 @@ // var tags = input.replace(/[^a-zA-Z0-9]/g,","); // url += tags; url += input; - this.parseKml(url,input,ds); + + /* test for csv flag in request parameters (see datasources.json) */ + var beginCsv = url.indexOf("csv=true"); + if (beginCsv != -1) { + /* remove "csv=true" from request parameters */ + url = url.substr(0, beginCsv) + url.substr(beginCsv + 9); + /* convert csv to kml */ + this.parseCsv(url,input,ds); + } + else { + /* parse kml */ + this.parseKml(url,input,ds); + } }, parseIt: function(xml,term,ds){ @@ -441,7 +453,102 @@ } }); }, - + + /** + * converts the csv-file, then parses the kml-file which includes the + * results for a given search request + * @param {File} csvFile + * @param {String} term the term identifier for the resulting dataset + */ + parseCsv: function(csvFile,term,ds){ + var core = this; + if( this.blocked ){ + setTimeout( function(){ core.parseCsv(csvFile,term,ds); }, 100 ); + return; + } + core.blockUI(); + $.ajax({ + url: csvFile, + dataType: "text", + beforeSend: function(){ + var status = document.getElementById("statusText"); + status.innerHTML = "Retrieving Data ..."; + }, + success: function(text){ + var status = document.getElementById("statusText"); + status.innerHTML = "Converting CSV to KML ..."; + /* convert here from csv to kml */ + var kmlString = '<?xml version="1.0" standalone="yes"?>\n'; + kmlString += '<kml xmlns="http://www.opengis.com/kml/ext/2.2">\n'; + kmlString += '\t<Folder>\n'; + /* define expected csv table headers (first line) */ + var expectedHeaders = new Array("Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end"); + /* convert csv string to array of arrays using ucsv library */ + var csvArray = CSV.csvToArray(text); + /* get real used table headers from csv file (first line) */ + var usedHeaders = csvArray[0]; + /* loop outer array, begin with second line */ + for (var i = 1; i < csvArray.length; i++) { + var innerArray = csvArray[i]; + kmlString += '\t\t<Placemark>\n'; + /* loop inner array */ + for (var j = 0; j < innerArray.length; j++) { + /* Name */ + if (usedHeaders[j] == expectedHeaders[0]) { + kmlString += '\t\t\t<name>' + innerArray[j] + '</name>\n'; + } + /* Address */ + if (usedHeaders[j] == expectedHeaders[1]) { + kmlString += '\t\t\t<address>' + innerArray[j] + '</address>\n'; + } + /* Description */ + if (usedHeaders[j] == expectedHeaders[2]) { + kmlString += '\t\t\t<description>' + innerArray[j] + '</description>\n'; + } + /* TimeStamp */ + if (usedHeaders[j] == expectedHeaders[5] && innerArray[j] != null) { + kmlString += '\t\t\t<TimeStamp>\n' + + '\t\t\t\t<when>' + innerArray[j] + '</when>\n' + + '\t\t\t</TimeStamp>\n'; + } + /* TimeSpan:begin */ + if (usedHeaders[j] == expectedHeaders[6] && innerArray[j] != null) { + kmlString += '\t\t\t<TimeSpan>\n' + + '\t\t\t\t<begin>' + innerArray[j] + '</begin>\n'; + } + /* TimeSpan:end */ + if (usedHeaders[j] == expectedHeaders[7] && innerArray[j] != null) { + kmlString += '\t\t\t\t<end>' + innerArray[j] + '</end>\n' + + '\t\t\t</TimeSpan>\n'; + } + /* Longitude */ + if (usedHeaders[j] == expectedHeaders[3]) { + kmlString += '\t\t\t<Point>\n' + + '\t\t\t\t<coordinates>' + innerArray[j]; + } + /* Latitude */ + if (usedHeaders[j] == expectedHeaders[4]) { + kmlString += ',' + innerArray[j] + + '</coordinates>\n' + + '\t\t\t</Point>\n'; + } + } + kmlString += '\t\t</Placemark>\n'; + } + kmlString += '\t<Folder>\n'; + kmlString += '<kml>\n'; + //console.log("kmlstring="+kmlString); + /* convert string to xml */ + var kmlXml = $.parseXML(kmlString); + //console.log(kmlXml); + /* pares the converted kml data */ + var status = document.getElementById("statusText"); + status.innerHTML = "Parsing Data ..."; + setTimeout( function(){ core.parseIt(kmlXml,term,ds); }, 1 ); + } + }); + }, + /** * updates the timeplot and table element. * its called from the STIMap object, when objects on the map had been selected by featureSelect or polygon.
--- a/war/scripts/sti/STIMap.js Tue Jul 17 13:34:40 2012 +0000 +++ b/war/scripts/sti/STIMap.js Fri Jul 20 10:14:57 2012 +0000 @@ -655,12 +655,11 @@ this.baseLayers.push( new OpenLayers.Layer.VirtualEarth("Bing Aerial", { type: VEMapStyle.Aerial, 'sphericalMercator': true } ) ); this.baseLayers.push( new OpenLayers.Layer.VirtualEarth("Bing Hybrid", { type: VEMapStyle.Hybrid, 'sphericalMercator': true } ) ); } - /* + /* Was commented out, no idea, why? */ if( this.core.props.osmMaps ){ this.baseLayers.push( new OpenLayers.Layer.OSM( 'Open Street Map' ) ); this.baseLayers.push( new OpenLayers.Layer.OSM( 'OSM Tiles@Home', 'http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png' ) ); } - */ }, /** @@ -680,8 +679,13 @@ cv = G_vmlCanvasManager.initElement(cv); var ctx = cv.getContext('2d'); var gradient = ctx.createLinearGradient(0, 0, 0, cv.height); - gradient.addColorStop(0, '#8bafd8'); - gradient.addColorStop(1, '#355272'); + /* OLD GRADIENTS */ + /* gradient.addColorStop(0, '#8bafd8'); + * gradient.addColorStop(1, '#355272'); + */ + /* new gradients: dark DARIAH theme (2012-07-19 SUBGOE Stefan E. Funk) */ + gradient.addColorStop(0, '#68635d'); + gradient.addColorStop(1, '#46413a'); ctx.fillStyle = gradient; ctx.fillRect(0, 0, cv.width, cv.height); },