Merge branch 'master' into singleTile

This commit is contained in:
Matt Priour
2012-03-08 16:36:41 -06:00
9 changed files with 156 additions and 47 deletions

View File

@@ -56,15 +56,19 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* Constructor: OpenLayers.Bounds * Constructor: OpenLayers.Bounds
* Construct a new bounds object. * Construct a new bounds object. Coordinates can either be passed as four
* arguments, or as a single argument.
* *
* Parameters: * Parameters (four arguments):
* left - {Number} The left bounds of the box. Note that for width * left - {Number} The left bounds of the box. Note that for width
* calculations, this is assumed to be less than the right value. * calculations, this is assumed to be less than the right value.
* bottom - {Number} The bottom bounds of the box. Note that for height * bottom - {Number} The bottom bounds of the box. Note that for height
* calculations, this is assumed to be more than the top value. * calculations, this is assumed to be more than the top value.
* right - {Number} The right bounds. * right - {Number} The right bounds.
* top - {Number} The top bounds. * top - {Number} The top bounds.
*
* Parameters (single argument):
* bounds - {Array(Number)} [left, bottom, right, top]
*/ */
initialize: function(left, bottom, right, top) { initialize: function(left, bottom, right, top) {
if (OpenLayers.Util.isArray(left)) { if (OpenLayers.Util.isArray(left)) {

View File

@@ -27,15 +27,19 @@ OpenLayers.LonLat = OpenLayers.Class({
/** /**
* Constructor: OpenLayers.LonLat * Constructor: OpenLayers.LonLat
* Create a new map location. * Create a new map location. Coordinates can be passed either as two
* arguments, or as a single argument.
* *
* Parameters: * Parameters (two arguments):
* lon - {Number} The x-axis coordinate in map units. If your map is in * lon - {Number} The x-axis coordinate in map units. If your map is in
* a geographic projection, this will be the Longitude. Otherwise, * a geographic projection, this will be the Longitude. Otherwise,
* it will be the x coordinate of the map location in your map units. * it will be the x coordinate of the map location in your map units.
* lat - {Number} The y-axis coordinate in map units. If your map is in * lat - {Number} The y-axis coordinate in map units. If your map is in
* a geographic projection, this will be the Latitude. Otherwise, * a geographic projection, this will be the Latitude. Otherwise,
* it will be the y coordinate of the map location in your map units. * it will be the y coordinate of the map location in your map units.
*
* Parameters (single argument):
* location - {Array(Float)} [lon, lat]
*/ */
initialize: function(lon, lat) { initialize: function(lon, lat) {
if (OpenLayers.Util.isArray(lon)) { if (OpenLayers.Util.isArray(lon)) {

View File

@@ -6,6 +6,9 @@
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Lang.js * @requires OpenLayers/Lang.js
* @requires OpenLayers/Rule.js
* @requires OpenLayers/StyleMap.js
* @requires OpenLayers/Layer/Vector.js
*/ */
/** /**

View File

@@ -87,7 +87,7 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class(
"TextSymbolizer": function(symbolizer) { "TextSymbolizer": function(symbolizer) {
var writers = OpenLayers.Format.SLD.v1_0_0.prototype.writers; var writers = OpenLayers.Format.SLD.v1_0_0.prototype.writers;
var node = writers["sld"]["TextSymbolizer"].apply(this, arguments); var node = writers["sld"]["TextSymbolizer"].apply(this, arguments);
if (symbolizer.externalGraphic || symbolizer.graphicName) { if (symbolizer.graphic !== false && (symbolizer.externalGraphic || symbolizer.graphicName)) {
this.writeNode("Graphic", symbolizer, node); this.writeNode("Graphic", symbolizer, node);
} }
if ("priority" in symbolizer) { if ("priority" in symbolizer) {

View File

@@ -229,7 +229,11 @@ OpenLayers.Layer = OpenLayers.Class({
/** /**
* APIProperty: maxExtent * APIProperty: maxExtent
* {<OpenLayers.Bounds>} The center of these bounds will not stray outside * {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* The maximum extent for the layer. Defaults to null.
*
* The center of these bounds will not stray outside
* of the viewport extent during panning. In addition, if * of the viewport extent during panning. In addition, if
* <displayOutsideMaxExtent> is set to false, data will not be * <displayOutsideMaxExtent> is set to false, data will not be
* requested that falls completely outside of these bounds. * requested that falls completely outside of these bounds.
@@ -238,7 +242,9 @@ OpenLayers.Layer = OpenLayers.Class({
/** /**
* APIProperty: minExtent * APIProperty: minExtent
* {<OpenLayers.Bounds>} * {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* The minimum extent for the layer. Defaults to null.
*/ */
minExtent: null, minExtent: null,

View File

@@ -307,7 +307,9 @@ OpenLayers.Map = OpenLayers.Class({
/** /**
* APIProperty: maxExtent * APIProperty: maxExtent
* {<OpenLayers.Bounds>} The maximum extent for the map. Defaults to the * {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* The maximum extent for the map. Defaults to the
* whole world in decimal degrees (-180, -90, 180, 90). Specify a * whole world in decimal degrees (-180, -90, 180, 90). Specify a
* different extent in the map options if you are not using a geographic * different extent in the map options if you are not using a geographic
* projection and displaying the whole world. To restrict user panning * projection and displaying the whole world. To restrict user panning
@@ -318,13 +320,17 @@ OpenLayers.Map = OpenLayers.Class({
/** /**
* APIProperty: minExtent * APIProperty: minExtent
* {<OpenLayers.Bounds>} * {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* The minimum extent for the map. Defaults to null.
*/ */
minExtent: null, minExtent: null,
/** /**
* APIProperty: restrictedExtent * APIProperty: restrictedExtent
* {<OpenLayers.Bounds>} Limit map navigation to this extent where possible. * {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* Limit map navigation to this extent where possible.
* If a non-null restrictedExtent is set, panning will be restricted * If a non-null restrictedExtent is set, panning will be restricted
* to the given bounds. In addition, zooming to a resolution that * to the given bounds. In addition, zooming to a resolution that
* displays more than the restricted extent will center the map * displays more than the restricted extent will center the map
@@ -436,6 +442,24 @@ OpenLayers.Map = OpenLayers.Class({
* provided or if you intend to call the <render> method later. * provided or if you intend to call the <render> method later.
* options - {Object} Optional object with properties to tag onto the map. * options - {Object} Optional object with properties to tag onto the map.
* *
* Valid options (in addition to the listed API properties):
* center - {<OpenLayers.LonLat>|Array} The default initial center of the map.
* If provided as array, the first value is the x coordinate,
* and the 2nd value is the y coordinate.
* Only specify if <layers> is provided.
* Note that if an ArgParser/Permalink control is present,
* and the querystring contains coordinates, center will be set
* by that, and this option will be ignored.
* zoom - {Number} The initial zoom level for the map. Only specify if
* <layers> is provided.
* Note that if an ArgParser/Permalink control is present,
* and the querystring contains a zoom level, zoom will be set
* by that, and this option will be ignored.
* extent - {<OpenLayers.Bounds>|Array} The initial extent of the map.
* If provided as an array, the array should consist of
* four values (left, bottom, right, top).
* Only specify if <center> and <zoom> are not provided.
*
* Examples: * Examples:
* (code) * (code)
* // create a map with default options in an element with the id "map1" * // create a map with default options in an element with the id "map1"
@@ -443,28 +467,26 @@ OpenLayers.Map = OpenLayers.Class({
* *
* // create a map with non-default options in an element with id "map2" * // create a map with non-default options in an element with id "map2"
* var options = { * var options = {
* projection: "EPSG:3857",
* maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000), * maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000),
* maxResolution: 156543, * center: new OpenLayers.LonLat(-12356463.476333, 5621521.4854095)
* units: 'm',
* projection: "EPSG:41001"
* }; * };
* var map = new OpenLayers.Map("map2", options); * var map = new OpenLayers.Map("map2", options);
* *
* // map with non-default options - same as above but with a single argument * // map with non-default options - same as above but with a single argument,
* // a restricted extent, and using arrays for bounds and center
* var map = new OpenLayers.Map({ * var map = new OpenLayers.Map({
* div: "map_id", * div: "map_id",
* maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000), * projection: "EPSG:3857",
* maxResolution: 156543, * maxExtent: [-18924313.432222, -15538711.094146, 18924313.432222, 15538711.094146],
* units: 'm', * restrictedExtent: [-13358338.893333, -9608371.5085962, 13358338.893333, 9608371.5085962],
* projection: "EPSG:41001" * center: [-12356463.476333, 5621521.4854095]
* }); * });
* *
* // create a map without a reference to a container - call render later * // create a map without a reference to a container - call render later
* var map = new OpenLayers.Map({ * var map = new OpenLayers.Map({
* maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000), * projection: "EPSG:3857",
* maxResolution: 156543, * maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000)
* units: 'm',
* projection: "EPSG:41001"
* }); * });
* (end) * (end)
*/ */
@@ -500,6 +522,9 @@ OpenLayers.Map = OpenLayers.Class({
if (this.maxExtent && !(this.maxExtent instanceof OpenLayers.Bounds)) { if (this.maxExtent && !(this.maxExtent instanceof OpenLayers.Bounds)) {
this.maxExtent = new OpenLayers.Bounds(this.maxExtent); this.maxExtent = new OpenLayers.Bounds(this.maxExtent);
} }
if (this.minExtent && !(this.minExtent instanceof OpenLayers.Bounds)) {
this.minExtent = new OpenLayers.Bounds(this.minExtent);
}
if (this.restrictedExtent && !(this.restrictedExtent instanceof OpenLayers.Bounds)) { if (this.restrictedExtent && !(this.restrictedExtent instanceof OpenLayers.Bounds)) {
this.restrictedExtent = new OpenLayers.Bounds(this.restrictedExtent); this.restrictedExtent = new OpenLayers.Bounds(this.restrictedExtent);
} }
@@ -625,7 +650,7 @@ OpenLayers.Map = OpenLayers.Class({
if (options && options.layers) { if (options && options.layers) {
/** /**
* If you have set options.center, the map center property will be * If you have set options.center, the map center property will be
* set at this point. However, since setCenter has not been caleld, * set at this point. However, since setCenter has not been called,
* addLayers gets confused. So we delete the map center in this * addLayers gets confused. So we delete the map center in this
* case. Because the check below uses options.center, it will * case. Because the check below uses options.center, it will
* be properly set below. * be properly set below.
@@ -1662,7 +1687,9 @@ OpenLayers.Map = OpenLayers.Class({
* Set the map center (and optionally, the zoom level). * Set the map center (and optionally, the zoom level).
* *
* Parameters: * Parameters:
* lonlat - {<OpenLayers.LonLat>} The new center location. * lonlat - {<OpenLayers.LonLat>|Array} The new center location.
* If provided as array, the first value is the x coordinate,
* and the 2nd value is the y coordinate.
* zoom - {Integer} Optional zoom level. * zoom - {Integer} Optional zoom level.
* dragging - {Boolean} Specifies whether or not to trigger * dragging - {Boolean} Specifies whether or not to trigger
* movestart/end events * movestart/end events
@@ -2282,7 +2309,8 @@ OpenLayers.Map = OpenLayers.Class({
* Zoom to the passed in bounds, recenter * Zoom to the passed in bounds, recenter
* *
* Parameters: * Parameters:
* bounds - {<OpenLayers.Bounds>} * bounds - {<OpenLayers.Bounds>|Array} If provided as an array, the array
* should consist of four values (left, bottom, right, top).
* closest - {Boolean} Find the zoom level that most closely fits the * closest - {Boolean} Find the zoom level that most closely fits the
* specified bounds. Note that this may result in a zoom that does * specified bounds. Note that this may result in a zoom that does
* not exactly contain the entire extent. * not exactly contain the entire extent.

View File

@@ -14,7 +14,7 @@
"poly_label.sld" "poly_label.sld"
]; ];
var len = cases.length; var len = cases.length;
t.plan(len); t.plan(len+1);
var format = new OpenLayers.Format.SLD({ var format = new OpenLayers.Format.SLD({
profile: "GeoServer", profile: "GeoServer",
@@ -31,7 +31,11 @@
out = format.write(data); out = format.write(data);
t.xml_eq(out, doc.documentElement, "round-tripped " + c); t.xml_eq(out, doc.documentElement, "round-tripped " + c);
} }
doc = readXML("poly_label.sld");
data = format.read(doc);
data.namedLayers[0].userStyles[0].rules[0].symbolizers[1].graphic = false;
out = format.write(data);
t.xml_eq(out, readXML("poly_label_nographic.sld").documentElement, "If graphic is false no Graphic is outputted");
} }
</script> </script>
@@ -110,5 +114,65 @@
</NamedLayer> </NamedLayer>
</StyledLayerDescriptor> </StyledLayerDescriptor>
--></div> --></div>
<div id="poly_label_nographic.sld"><!--
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Polygon with styled label</Name>
<UserStyle>
<Title>SLD Cook Book: Polygon with styled label</Title>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#40FF40</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#FFFFFF</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">11</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
</Font>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
<CssParameter name="fill-opacity">0.5</CssParameter>
</Fill>
<Priority>
<ogc:PropertyName>population</ogc:PropertyName>
</Priority>
<VendorOption name="autoWrap">60</VendorOption>
<VendorOption name="followLine">true</VendorOption>
<VendorOption name="repeat">300</VendorOption>
<VendorOption name="maxDisplacement">150</VendorOption>
<VendorOption name="forceLeftToRight">false</VendorOption>
<VendorOption name="graphic-margin">3</VendorOption>
<VendorOption name="graphic-resize">stretch</VendorOption>
<VendorOption name="group">yes</VendorOption>
<VendorOption name="spaceAround">10</VendorOption>
<VendorOption name="labelAllGroup">true</VendorOption>
<VendorOption name="maxAngleDelta">15</VendorOption>
<VendorOption name="conflictResolution">false</VendorOption>
<VendorOption name="goodnessOfFit">0.3</VendorOption>
<VendorOption name="polygonAlign">mbr</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
--></div>
</body> </body>
</html> </html>

View File

@@ -230,17 +230,17 @@
layer.deferMoveGriddedTiles = function() { layer.deferMoveGriddedTiles = function() {
log.push("deferMoveGriddedTiles"); log.push("deferMoveGriddedTiles");
origDeferMoveGriddedTiles.apply(this, arguments); origDeferMoveGriddedTiles.apply(this, arguments);
} };
layer.moveGriddedTiles = function() { layer.moveGriddedTiles = function() {
log.push("moveGriddedTiles"); log.push("moveGriddedTiles");
OpenLayers.Layer.WMS.prototype.moveGriddedTiles.apply(this, arguments); OpenLayers.Layer.WMS.prototype.moveGriddedTiles.apply(this, arguments);
} };
map.moveTo([5, 0]); map.moveTo([5, 0]);
t.eq(log[0], "moveGriddedTiles", "deferred after moveTo"); t.eq(log[0], "moveGriddedTiles", "deferred after moveTo");
map.moveTo([0, 0]); map.moveTo([0, 0]);
t.eq(log[1], "moveGriddedTiles", "deferred again after another moveTo"); t.eq(log[1], "moveGriddedTiles", "deferred again after another moveTo");
t.eq(log.length, 2, "no tiles loaded yet"); t.eq(log.length, 2, "no tiles loaded yet");
t.delay_call(0.1, function() { t.delay_call(1, function() {
t.eq(log[2], "deferMoveGriddedTiles", "tiles moved after tileLoadingDelay"); t.eq(log[2], "deferMoveGriddedTiles", "tiles moved after tileLoadingDelay");
}); });

View File

@@ -6,7 +6,7 @@
var geometry = null, node = null; var geometry = null, node = null;
function test_VML_constructor(t) { function test_VML_constructor(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -17,7 +17,7 @@
} }
function test_VML_destroy(t) { function test_VML_destroy(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -43,7 +43,7 @@
} }
function test_VML_setextent(t) { function test_VML_setextent(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -80,7 +80,7 @@
} }
function test_VML_setsize(t) { function test_VML_setsize(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -99,7 +99,7 @@
} }
function test_VML_drawText(t) { function test_VML_drawText(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -128,7 +128,7 @@
} }
function test_VML_drawpoint(t) { function test_VML_drawpoint(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -149,7 +149,7 @@
} }
function test_VML_drawcircle(t) { function test_VML_drawcircle(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -177,7 +177,7 @@
} }
function test_VML_drawGraphic(t) { function test_VML_drawGraphic(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -219,7 +219,7 @@
} }
function test_VML_drawlinestring(t) { function test_VML_drawlinestring(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -239,7 +239,7 @@
} }
function test_VML_drawlinearring(t) { function test_VML_drawlinearring(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -259,7 +259,7 @@
} }
function test_VML_drawline(t) { function test_VML_drawline(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -300,7 +300,7 @@
} }
function test_VML_drawpolygon(t) { function test_VML_drawpolygon(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -331,7 +331,7 @@
} }
function test_VML_drawrectangle(t) { function test_VML_drawrectangle(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -360,7 +360,7 @@
} }
function test_vml_getnodetype(t) { function test_vml_getnodetype(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -376,7 +376,7 @@
} }
function test_vml_importsymbol(t) { function test_vml_importsymbol(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -405,7 +405,7 @@
} }
function test_vml_dashstyle(t) { function test_vml_dashstyle(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }
@@ -422,7 +422,7 @@
} }
function test_vml_moveRoot(t) { function test_vml_moveRoot(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) { if (!OpenLayers.Renderer.VML.prototype.supported() || OpenLayers.Renderer.SVG.prototype.supported()) {
t.plan(0); t.plan(0);
return; return;
} }