diff --git a/build/build.py b/build/build.py index 0ca2a74a0e..da539a29ab 100755 --- a/build/build.py +++ b/build/build.py @@ -60,6 +60,15 @@ def build(config_file = None, output_file = None, options = None): print "\nAbnormal termination." sys.exit("ERROR: %s" % E) + if options.amdname: + options.amdname = "'" + options.amdname + "'," + else: + options.amdname = "" + + if options.amd == 'pre': + print "\nAdding AMD function." + merged = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, merged) + print "Compressing using %s" % use_compressor if use_compressor == "jsmin": minimized = jsmin.jsmin(merged) @@ -101,6 +110,14 @@ def build(config_file = None, output_file = None, options = None): else: # fallback minimized = merged + if options.amd == 'post': + print "\nAdding AMD function." + minimized = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, minimized) + + if options.status: + print "\nAdding status file." + minimized = "// status: " + file(options.status).read() + minimized + print "\nAdding license file." minimized = file("license.txt").read() + minimized @@ -111,7 +128,10 @@ def build(config_file = None, output_file = None, options = None): if __name__ == '__main__': opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'") - opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin', 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin") + opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin' (default), 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin") + opt.add_option("-s", "--status", dest="status", help="name of a file whose contents will be added as a comment at the front of the output file. For example, when building from a git repo, you can save the output of 'git describe --tags' in this file. Default is no file.", default=False) + opt.add_option("--amd", dest="amd", help="output should be AMD module; wrap merged files in define function; can be either 'pre' (before compilation) or 'post' (after compilation). Wrapping the OpenLayers var in a function means the filesize can be reduced by the closure compiler using 'pre', but be aware that a few functions depend on the OpenLayers variable being present. Either option can be used with jsmin or minimize compression. Default false, not AMD.", default=False) + opt.add_option("--amdname", dest="amdname", help="only useful with amd option. Name of AMD module. Default no name, anonymous module.", default=False) (options, args) = opt.parse_args() if not len(args): build(options=options) diff --git a/examples/fullScreen.js b/examples/fullScreen.js index dc8ed19d1a..754cabfadd 100644 --- a/examples/fullScreen.js +++ b/examples/fullScreen.js @@ -8,10 +8,12 @@ var map = new OpenLayers.Map({ div: "map", layers: [ new OpenLayers.Layer.XYZ("OSM (with buffer)", urls, { - transitionEffect: "resize", buffer: 2, sphericalMercator: true + transitionEffect: "resize", buffer: 2, sphericalMercator: true, + attribution: "Data CC-By-SA by OpenStreetMap" }), new OpenLayers.Layer.XYZ("OSM (without buffer)", urls, { - transitionEffect: "resize", buffer: 0, sphericalMercator: true + transitionEffect: "resize", buffer: 0, sphericalMercator: true, + attribution: "Data CC-By-SA by OpenStreetMap" }) ], controls: [ diff --git a/examples/kml-pointtrack.js b/examples/kml-pointtrack.js index 47836f25fd..7d48ce360f 100644 --- a/examples/kml-pointtrack.js +++ b/examples/kml-pointtrack.js @@ -29,12 +29,13 @@ function init() { var fid, points = [], feature; for (var i=0, len=e.features.length; iMapQuest ", + attribution: "Data, imagery and map information provided by MapQuest, Open Street Map and contributors, CC-BY-SA ", transitionEffect: "resize" } ), @@ -24,7 +24,7 @@ var map = new OpenLayers.Map({ "http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png" ], { - attribution: "Tiles Courtesy of MapQuest ", + attribution: "Tiles Courtesy of MapQuest. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency. ", transitionEffect: "resize" } ) @@ -33,4 +33,4 @@ var map = new OpenLayers.Map({ zoom: 1 }); -map.addControl(new OpenLayers.Control.LayerSwitcher()); \ No newline at end of file +map.addControl(new OpenLayers.Control.LayerSwitcher()); diff --git a/examples/mobile-drawing.html b/examples/mobile-drawing.html index 6a91152b89..0cb9c529f1 100644 --- a/examples/mobile-drawing.html +++ b/examples/mobile-drawing.html @@ -5,7 +5,7 @@ - + diff --git a/examples/mobile-jq.html b/examples/mobile-jq.html index 470fd39d5d..5e16caaa68 100644 --- a/examples/mobile-jq.html +++ b/examples/mobile-jq.html @@ -8,7 +8,7 @@ - + diff --git a/examples/mobile-layers.html b/examples/mobile-layers.html index dcb27645f9..d25867477a 100644 --- a/examples/mobile-layers.html +++ b/examples/mobile-layers.html @@ -5,7 +5,7 @@ - + + image/png + + Time + 20090101 + 20090101 + + + 21781 + + + + + 21781 + urn:ogc:def:crs:EPSG::21781 + + 0 + 14285750.5715 + 420000.0 350000.0 + 256 + 256 + 1 + 1 + + + 8 + 7142875.28575 + 420000.0 350000.0 + 256 + 256 + 1 + 1 + + + 12 + 3571437.64288 + 420000.0 350000.0 + 256 + 256 + 2 + 2 + + + + + +--> + +
+ +
+ diff --git a/tests/Format/WPSDescribeProcess.html b/tests/Format/WPSDescribeProcess.html index c411f6267b..f52fd21372 100644 --- a/tests/Format/WPSDescribeProcess.html +++ b/tests/Format/WPSDescribeProcess.html @@ -4,7 +4,7 @@ diff --git a/tests/Projection.html b/tests/Projection.html index 236871ab76..5864be5347 100644 --- a/tests/Projection.html +++ b/tests/Projection.html @@ -44,7 +44,7 @@ // conditionally mock up proj4js var hasProj = !!window.Proj4js; if (!hasProj) { - window.Proj4js = true; + window.Proj4js = {}; } proj1.proj = {defData: "+title= WGS84 +foo=bar +x=0"}; proj2.proj = {defData: "+title=FOO +foo=bar +x=0", srsCode: "FOO"}; diff --git a/tests/Strategy/BBOX.html b/tests/Strategy/BBOX.html index 4194b59175..b89e5568cf 100644 --- a/tests/Strategy/BBOX.html +++ b/tests/Strategy/BBOX.html @@ -112,43 +112,46 @@ function test_events(t) { - t.plan(3); - var log = { - loadstart: 0, - loadend: 0 - }; + t.plan(6); + + var log = []; + + var response = new OpenLayers.Protocol.Response(); var map = new OpenLayers.Map("map"); var layer = new OpenLayers.Layer.Vector(null, { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol({ read: function(config) { - config.callback.call(config.scope, {}); + config.callback.call(config.scope, response); } }), isBaseLayer: true, eventListeners: { - loadstart: function() { - ++log.loadstart; + loadstart: function(event) { + log.push(event); }, - loadend: function() { - ++log.loadend; + loadend: function(event) { + log.push(event); } } }); map.addLayer(layer); map.zoomToMaxExtent(); + + t.eq(log.length, 2, "2 events logged"); + t.eq(log[0].type, "loadstart", "loadstart first"); + t.eq(log[1].type, "loadend", "loadend second"); + t.ok(log[1].response == response, "loadend includes response"); - t.eq(log.loadstart, 1, "loadstart triggered"); - t.eq(log.loadend, 1, "loadend triggered"); - - log = {}; + var calls = []; layer.protocol.read = function(obj) { - log.obj = obj; + calls.push(obj); } layer.refresh({force: true, whee: 'chicken'}); - t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly."); + t.eq(calls.length, 1, "1 call to read"); + t.eq(calls[0].whee, "chicken", "properties passed to read"); map.destroy(); diff --git a/tests/Strategy/Fixed.html b/tests/Strategy/Fixed.html index 209d8daab6..2f9f5b3adc 100644 --- a/tests/Strategy/Fixed.html +++ b/tests/Strategy/Fixed.html @@ -62,44 +62,47 @@ function test_events(t) { - t.plan(3); + t.plan(6); - var log = { - loadstart: 0, - loadend: 0 - }; + var log = []; + + var response = new OpenLayers.Protocol.Response(); var map = new OpenLayers.Map("map"); var layer = new OpenLayers.Layer.Vector(null, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol({ read: function(config) { - config.callback.call(config.scope, {}); + config.callback.call(config.scope, response); } }), isBaseLayer: true, eventListeners: { - loadstart: function() { - ++log.loadstart; + loadstart: function(event) { + log.push(event); }, - loadend: function() { - ++log.loadend; + loadend: function(event) { + log.push(event); } } }); map.addLayer(layer); map.zoomToMaxExtent(); + + t.eq(log.length, 2, "2 events logged"); + t.eq(log[0].type, "loadstart", "loadstart first"); + t.eq(log[1].type, "loadend", "loadend second"); + t.ok(log[1].response == response, "loadend includes response"); - t.eq(log.loadstart, 1, "loadstart triggered"); - t.eq(log.loadend, 1, "loadend triggered"); - var log = {}; + var calls = []; layer.protocol.read = function(obj) { - log.obj = obj; + calls.push(obj); } layer.refresh({whee: 'chicken'}); - t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly."); + t.eq(calls.length, 1, "1 call to read"); + t.eq(calls[0].whee, "chicken", "properties passed to read"); map.destroy(); diff --git a/tests/Util/vendorPrefix.html b/tests/Util/vendorPrefix.html new file mode 100644 index 0000000000..924ae09c38 --- /dev/null +++ b/tests/Util/vendorPrefix.html @@ -0,0 +1,117 @@ + + + + vendorPrefix.js Tests + + + + + + + \ No newline at end of file diff --git a/tests/list-tests.html b/tests/list-tests.html index 3c484bceaa..a019fd7e01 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -46,13 +46,10 @@
  • Control/UTFGrid.html
  • Control/WMSGetFeatureInfo.html
  • Control/WMTSGetFeatureInfo.html
  • -
  • Control/Pan.html
  • Control/PanPanel.html
  • Control/SLDSelect.html
  • Control/Zoom.html
  • -
  • Control/ZoomIn.html
  • -
  • Control/ZoomOut.html
  • -
  • Control/ZoomToMaxExtent.html
  • +
  • Control/ZoomBox.html
  • Events.html
  • Events/buttonclick.html
  • Extras.html
  • @@ -234,6 +231,7 @@
  • Tween.html
  • Kinetic.html
  • Util.html
  • +
  • Util/vendorPrefix.html
  • deprecated/Ajax.html
  • deprecated/Util.html
  • deprecated/BaseTypes/Class.html
  • @@ -251,4 +249,4 @@
  • deprecated/Renderer/SVG2.html
  • deprecated/Layer/Yahoo.html
  • deprecated/Tile/WFS.html
  • - + \ No newline at end of file diff --git a/tests/manual/map-events.html b/tests/manual/map-events.html new file mode 100644 index 0000000000..3695e82da4 --- /dev/null +++ b/tests/manual/map-events.html @@ -0,0 +1,38 @@ + + + + + + + map.div Events Acceptance Test + + + + + + +

    map.div Events Acceptance Test

    + +
    + +

    Test 1 : mousedown the map; an alert must be displayed.

    + + diff --git a/tests/manual/rendered-dimensions.html b/tests/manual/rendered-dimensions.html index 41b0fcf4d4..71025afef8 100644 --- a/tests/manual/rendered-dimensions.html +++ b/tests/manual/rendered-dimensions.html @@ -39,10 +39,64 @@ function run() { else { out.innerHTML += "
    height Fail: " + size + ", " + height; } + + // To use the same syntax as in "\tests" + var t = {eq: function(a, b, msg) { + if (a == b) { + out.innerHTML += "
    ok " + msg; + } + else { + out.innerHTML += "
    Fail (" + a + " not eq " + b + "): " + msg + ""; + } + } + }; + var text = (new Array(10)).join("foo foo foo
    "), + content = "
    " + text + "
    "; + var testName, + finalSize, + initialSize = OpenLayers.Util.getRenderedDimensions(content, null); + // containerElement option on absolute position with width and height + testName = "Absolute with w&h: "; + var optionAbsDiv ={ + containerElement: document.getElementById("absoluteDiv") + }; + finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv); + t.eq(finalSize.w, initialSize.w, + testName + "initial width " + initialSize.w + "px is maintained"); + t.eq(finalSize.h, initialSize.h, + testName + "initial height " + initialSize.h + "px is maintained"); + testName = "Absolute with w&h (set height): "; + finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv); + t.eq(finalSize.h, 15, testName + "got the fixed height to 15px"); + t.eq(finalSize.w, initialSize.w, + testName + "initial width " + initialSize.w + "px is maintained"); + testName = "Absolute with w&h (set width): "; + finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv); + t.eq(finalSize.w, 20, testName + "got the fixed width to 20px"); + // containerElement option on absolute position without width and height + testName = "Absolute without w&h: "; + var optionAbsDiv00 ={ + containerElement: document.getElementById("absoluteDiv00") + }; + finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00); + t.eq(finalSize.w, initialSize.w, + testName + "initial width " + initialSize.w + "px is maintained"); + t.eq(finalSize.h, initialSize.h, + testName + "initial height " + initialSize.h + "px is maintained"); + testName = "Absolute without w&h (set height): "; + finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00); + t.eq(finalSize.h, 15, testName + "got the fixed height to 15px"); + t.eq(finalSize.w, initialSize.w, + testName + "initial width " + initialSize.w + "px is maintained"); + testName = "Absolute without w&h (set width): "; + finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00); + t.eq(finalSize.w, 20, testName + "got the fixed width to 20px"); }
    +
    +
    diff --git a/examples/style.mobile.css b/theme/default/style.mobile.css similarity index 74% rename from examples/style.mobile.css rename to theme/default/style.mobile.css index 6854e32fe1..2d4d39257a 100644 --- a/examples/style.mobile.css +++ b/theme/default/style.mobile.css @@ -49,3 +49,15 @@ div.olControlZoom a:hover { -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } +/* Enable 3d acceleration when operating on tiles, this is + known to yield better performance on IOS Safari. + http://osgeo-org.1803224.n2.nabble.com/Harware-accelerated-CSS3-animations-for-iOS-td6255560.html + + It also prevents tile blinking effects in iOS 5. + See https://github.com/openlayers/openlayers/issues/511 +*/ +@media (-webkit-transform-3d) { +img.olTileImage { + -webkit-transform: translate3d(0, 0, 0); +} +} diff --git a/tools/release.sh b/tools/release.sh index a7a182f39b..125065b0da 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,5 +1,28 @@ #!/bin/sh +# +# +# Usage: +# $ ./release.sh +# +# Example: +# $ ./release.sh 2.12-rc7 +# +# This script should be run on the www.openlayers.org server. +# +# What the script does: +# +# 1. Download release tarball from from GitHub. +# 2. Create builds using the Closure Compiler. +# 3. Run the exampleparser.py script to create the examples index. +# 4. Run csstidy for each CSS file in theme/default. +# 5. Publish builds and resources on api.openlayers.org. +# 6. Build the API docs. +# 7. Create release archives +# 8. Make the release archives available on openlayers.org/downloads. +# +# + VERSION=$1 wget -c http://closure-compiler.googlecode.com/files/compiler-latest.zip @@ -17,20 +40,19 @@ mv ../../compiler.jar ../tools/closure-compiler.jar ./build.py -c none full OpenLayers.debug.js ./build.py -c none mobile OpenLayers.mobile.debug.js ./build.py -c none light OpenLayers.light.debug.js -cp OpenLayers.js .. -cp OpenLayers.*.js .. +mv OpenLayers*.js ../ rm ../tools/closure-compiler.jar cd .. cd tools python exampleparser.py cd .. -for i in google ie6-style style; do +for i in google ie6-style style style.mobile; do csstidy theme/default/$i.css --template=highest theme/default/$i.tidy.css done -mkdir doc/devdocs -mkdir doc/apidocs +mkdir -p doc/devdocs +mkdir -p doc/apidocs rm tools/*.pyc mkdir -p /osgeo/openlayers/sites/openlayers.org/api/$VERSION