From: Nick Doiron Date: Wed, 4 May 2011 21:55:04 +0000 (-0300) Subject: Updated repo so OpenMaps plugin can be updated X-Git-Tag: v0.6~14^2^2~2^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=038479094a75d337c5c573371846c019829828f8;p=popcorn-js.git Updated repo so OpenMaps plugin can be updated --- diff --git a/plugins/openmap/popcorn.openmap.html b/plugins/openmap/popcorn.openmap.html index c88b9b1..6b25b2e 100644 --- a/plugins/openmap/popcorn.openmap.html +++ b/plugins/openmap/popcorn.openmap.html @@ -31,7 +31,7 @@ location: "Cambridge, MA", icon: "http://google-maps-icons.googlecode.com/files/vegetarian.png", text: "Clickable markers", - size: 10 + size: 10 }, { lat: 42.358544, @@ -66,11 +66,11 @@ + type='video/mp4;' codecs="avc1, mp4a"'> + type='video/ogg;' codecs="theora, vorbis"'>

Your user agent does not support the HTML5 Video element.

diff --git a/plugins/openmap/popcorn.openmap.js b/plugins/openmap/popcorn.openmap.js index 988354e..2853e99 100644 --- a/plugins/openmap/popcorn.openmap.js +++ b/plugins/openmap/popcorn.openmap.js @@ -4,13 +4,13 @@ var openmapCallback; /** * openmap popcorn plug-in - * Adds an OpenLayers + OpenStreetMap map to the target div centered on the location specified by the user + * Adds an OpenLayers map and open map tiles (OpenStreetMap [default], NASA WorldWind, or USGS Topographic) * Based on the googlemap popcorn plug-in. No StreetView support * Options parameter will need a start, end, target, type, zoom, lat and lng * -Start is the time that you want this plug-in to execute * -End is the time that you want this plug-in to stop executing * -Target is the id of the DOM element that you want the map to appear in. This element must be in the DOM - * -Type [optional] either: ROADMAP (OpenStreetMap), SATELLITE (NASA WorldWind / LandSat), or TERRAIN (USGS) + * -Type [optional] either: ROADMAP (OpenStreetMap), SATELLITE (NASA WorldWind / LandSat), or TERRAIN (USGS). ROADMAP/OpenStreetMap is the default. * -Zoom [optional] defaults to 2 * -Lat and Lng are the coordinates of the map if location is not named * -Location is a name of a place to center the map, geocoded to coordinates using TinyGeocoder.com @@ -41,9 +41,18 @@ var openmapCallback; _mapFired = false, _mapLoaded = false; + // insert openlayers api script once + if ( !_mapFired ) { + _mapFired = true; + Popcorn.getScript('http://openlayers.org/api/OpenLayers.js', + function() { + _mapLoaded = true; + } ); + } + Popcorn.plugin( "openmap" , function( options ){ var newdiv, - map, + map, centerlonlat, projection, displayProjection, @@ -51,15 +60,6 @@ var openmapCallback; selectControl, popup; - // insert openlayers api script once - if ( !_mapFired ) { - _mapFired = true; - Popcorn.getScript('http://openlayers.org/api/OpenLayers.js', - function() { - _mapLoaded = true; - } ); - } - // create a new div within the target div // this is later passed on to the maps api newdiv = document.createElement( 'div' ); @@ -91,18 +91,10 @@ var openmapCallback; } else { centerlonlat = new OpenLayers.LonLat( options.lng, options.lat ); } - if( options.type == "ROADMAP" ) { - // add OpenStreetMap layer - projection = new OpenLayers.Projection( 'EPSG:900913' ); - displayProjection = new OpenLayers.Projection( 'EPSG:4326' ); - centerlonlat = centerlonlat.transform( displayProjection, projection ); - map = new OpenLayers.Map( { div: newdiv, projection: projection, "displayProjection": displayProjection } ); - var osm = new OpenLayers.Layer.OSM(); - map.addLayer( osm ); - } - else if( options.type == "SATELLITE" ) { + options.type = options.type || "ROADMAP"; + if( options.type == "SATELLITE" ) { // add NASA WorldWind / LANDSAT map - map = new OpenLayers.Map( { div: newdiv, "maxResolution": 0.28125, tileSize: new OpenLayers.Size( 512, 512 ) } ); + map = new OpenLayers.Map( { div: newdiv, "maxResolution": .28125, tileSize: new OpenLayers.Size( 512, 512 ) } ); var worldwind = new OpenLayers.Layer.WorldWind( "LANDSAT", "http://worldwind25.arc.nasa.gov/tile/tile.aspx", 2.25, 4, { T: "105" } ); map.addLayer( worldwind ); displayProjection = new OpenLayers.Projection( "EPSG:4326" ); @@ -116,7 +108,18 @@ var openmapCallback; var relief = new OpenLayers.Layer.WMS( "USGS Terraserver", "http://terraserver-usa.org/ogcmap.ashx?", { layers: 'DRG' } ); map.addLayer( relief ); } - map.div.style.display = "none"; + else { + // add OpenStreetMap layer + projection = new OpenLayers.Projection( 'EPSG:900913' ); + displayProjection = new OpenLayers.Projection( 'EPSG:4326' ); + centerlonlat = centerlonlat.transform( displayProjection, projection ); + map = new OpenLayers.Map( { div: newdiv, projection: projection, "displayProjection": displayProjection } ); + var osm = new OpenLayers.Layer.OSM(); + map.addLayer( osm ); + } + if( map ) { + map.div.style.display = "none"; + } } }; isGeoReady(); diff --git a/plugins/openmap/popcorn.openmap.unit.html b/plugins/openmap/popcorn.openmap.unit.html index 0df8f2b..32e9d0b 100644 --- a/plugins/openmap/popcorn.openmap.unit.html +++ b/plugins/openmap/popcorn.openmap.unit.html @@ -6,7 +6,7 @@ @@ -29,11 +29,11 @@ + type='video/mp4;' codecs="avc1, mp4a"'> + type='video/ogg;' codecs="theora, vorbis"'>

Your user agent does not support the HTML5 Video element.

@@ -41,5 +41,6 @@
+
diff --git a/plugins/openmap/popcorn.openmap.unit.js b/plugins/openmap/popcorn.openmap.unit.js index 2be25a2..ffb93b0 100644 --- a/plugins/openmap/popcorn.openmap.unit.js +++ b/plugins/openmap/popcorn.openmap.unit.js @@ -1,7 +1,7 @@ test("Popcorn OpenMap Plugin", function () { var popped = Popcorn("#video"), - expects = 12, + expects = 14, count = 0, mapInterval, mapInterval2, @@ -57,6 +57,14 @@ test("Popcorn OpenMap Plugin", function () { lng: -78.968525, zoom: 14 } ) + .openmap( { + start: 0, + end: 5, + target: 'map4', + lat: 40.943926, + lng: -78.968525, + zoom: "14" + } ) .volume(0) .play(); @@ -89,13 +97,23 @@ test("Popcorn OpenMap Plugin", function () { clearInterval( mapInterval3 ); } } ); - mapInterval4 = popped.exec( 6, function() { + mapInterval4 = popped.exec( 4, function() { + if( popped.currentTime() > 3 && popped.currentTime() <= 5 ) { + ok (document.getElementById('actualmap4'), "Fourth map is on the page" ); + plus(); + equals (document.getElementById('actualmap4').offsetParent.id, "map4", "Fourth map is inside the 'map4' div" ); + plus(); + clearInterval( mapInterval4 ); + } + } ); + mapInterval5 = popped.exec( 6, function() { if( popped.currentTime() > 5 ) { ok (document.getElementById('actualmap2').style.display === "none" && document.getElementById('actualmap3').style.display === "none" && + document.getElementById('actualmap4').style.display === "none" && document.getElementById('actualmap1').style.display === "none", "All three maps are no longer visible" ); plus(); - clearInterval( mapInterval4 ); + clearInterval( mapInterval5 ); } } ); } ); \ No newline at end of file diff --git a/plugins/openmap/readme.txt b/plugins/openmap/readme.txt deleted file mode 100644 index aaf8ded..0000000 --- a/plugins/openmap/readme.txt +++ /dev/null @@ -1,47 +0,0 @@ -## What is Popcorn.js? ## -An open source JavaScript library which connects and synchronizes the