Moving the box size to CSS broke `Popup.setSize()`; the function
expects a width for the padding computation. Because this function is
called before the div is added to the DOM, the size can't be
computed.
This reverts commit 134f24480a.
8.6 KiB
Major enhancements
Tile animation
The displaying of tiles can now be animated, using CSS3 transitions. Transitions operate on the opacity property. Here's the CSS rule defined in OpenLayers' default theme:
.olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
People can override this rule to use other transition settings. To remove tile animation entirely use:
.olTileImage {
-webkit-transition: none;
-moz-transition: none;
-o-transition: all 0 none;
transition: none;
}
Behavior Changes from Past Releases
GPX API change
The gpxns API property has been removed. The GPX namespace is now defined in the namespaces property but is not intended to be overriden.
Function return values
Previously a few functions in the library displayed error messages and returned undefined, null or false if the parameters passed in were bad. In 2.12 these functions now just throw an error/exception. People relying on return values to know if a function call is successful may need to change their code. Here are the modified functions:
OpenLayers.Bounds.addthrows aTypeErrorexception ifxoryis nullOpenLayers.LonLat.addthrows aTypeErrorexception iflonorlatis nullOpenLayers.Pixel.addthrows aTypeErrorexception ifxoryis nullOpenLayers.Filter.Comparison.value2regexthrows anErrorexception ifwildcardequals to"."OpenLayers.Layer.PointTrack.addNodesthrows aTypeErrorexception ifendPointisn't actually a pointOpenLayers.Layer.Vector.getFeatureFromEventthrows anErrorexception if the layer has no renderer
Changes in formats WMTSCapabilities and SOSCapabilities
The structure of the object returned by Format.WMTSCapabilities:read and Format.SOSCapabilities:read has slightly changed.
For WMTSCapabilities the GET href used to be made available at operationsMetadata.GetCapabilities.dcp.http.get, the latter is now an array of objects with two properties: url and constrains. People using operationsMetadata.GetCapabilities.dcp.http.get in their applications should certainly use operationsMetadata.GetCapabilities.dcp.http.get[0].url.
Likewise for SOSCapabilities.
Looking at the tests is a good way to understand what the requires changes are. See SOSCapabilities/v1_0_0.html and WMTSCapabilities/v1_0_0.html.
- Trac ticket: http://trac.osgeo.org/openlayers/ticket/3568
- GitHub issue: https://github.com/openlayers/openlayers/pull/40
Rico deprecation
We are deprecating the Rico classes/objects in OpenLayers. This has the following implications:
Popup.AnchoredBubble is deprecated. Its constructor now displays a deprecation message on the console. If you want popups with rounded corners either use Popup.FramedClould, or use Popup.Anchored and round corners using the border-radius CSS property.
The roundedCorner option of Control.LayerSwitcher is deprecated, and it now defaults to false. Setting it to true results in deprecation messages being output on the console. If you still want to set roundedCorner to true (you should not!) you need to make sure that the Rico/Corner.js and Rico/Color.js scripts are loaded in the page. This can be ensured by adding Rico/Corner.js in the build profile. The controls.html example demonstrates how to use border-radius to round corners of a layer switcher:
.olControlLayerSwitcher .layersDiv {
border-radius: 10px 0 0 10px;
}
See more detail in the Rico deprecation pull request.
In future releases we intend to move the Rico and AnchoredBubble code into deprecated.js. You really should consider stop using Rico-based functionalities in your applications.
Changes in Geometry
The base OpenLayers.Geometry class no longer depends on OpenLayers.Format.WKT or OpenLayers.Feature.Vector. If you want to make use of the OpenLayers.Geometry.fromWKT method, you must explicitly include the OpenLayers/Format/WKT.js file in your build.
Without the WKT format included (by default), the OpenLayers.Geometry::toString method now returns "[object Object]." Previously, it returned the Well-Known Text representation of the geometry. To maintain the previous behavior, include the OpenLayers/Format/WKT.js file in your build.
OSM and Bing Layers
Layer.OSM is now defined in its own script file, namely OpenLayers/Layer/OSM.js. So people using Layer.OSM should now include OpenLayers/Layer/OSM.js, as opposed to OpenLayers/Layer/XYZ.js, in their OpenLayers builds. (See https://github.com/openlayers/openlayers/issues/138)
The OpenLayers.Tile.Image class now has a method to get a canvas context for processing tiles. Since both OSM and Bing set Access-Control-Allow-Origin headers for their tiles, it is possible to manipulate a canvas that these tiles were rendered to even if the tiles come from a remote origin. Especially when working with custom OSM tilesets from servers that do not send Access-Control-Allow-Origin headers, it is now necessary to configure the layer with
tileOptions: {crossOriginKeyword: null}
Projection & SphericalMercator
In previous releases, coordinate transforms between EPSG:4326 and EPSG:900913 were defined in the SphericalMercator.js script. In 2.12, these default transforms are included in the Projection.js script. The Projection.js script is included as a dependency in builds with any layer types, so no special build configuration is necessary to get the web mercator transforms.
If you were previously using the OpenLayers.Layer.SphericalMercator.forwardMercator or inverseMercator methods, you may have to explicitly include the SphericalMercator.js script in your build. The Google layer is the only layer that depends on the SphericalMercator mixin. If you are not using the Google layer but want to use the SphericalMercator methods listed above, you have to explicitly include the SphericalMercator.js script in your build.
QueryStringFilter
OpenLayers.Protocol.HTTP no longer requires OpenLayers.Format.QueryStringFilter. It you need this, make sure it is included in your build config file.
Changes in getURLasync
The internal OpenLayers.Layer.getURLasync function now take a bound, a callback and a scope. The function no longer needs update the passed property but simply to return to url.
Deprecated Components
A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate <script> tag after OpenLayers.js).
- OpenLayers.Class.isPrototype
- OpenLayers.Class.create
- OpenLayers.Class.inherit
- OpenLayers.Util.clearArray
- OpenLayers.Util.setOpacity
- OpenLayers.Util.safeStopPropagation
- OpenLayers.Util.getArgs
- OpenLayers.nullHandler
- OpenLayers.loadURL
- OpenLayers.parseXMLString
- OpenLayers.Ajax.* (all methods)
- OpenLayers.Element.hide
- OpenLayers.Element.show
- OpenLayers.Element.getDimensions
- OpenLayers.Tile.prototype.getBoundsFromBaseLayer
- OpenLayers.Control.MouseDefaults
- OpenLayers.Control.MouseToolbar
- OpenLayers.Layer.Grid.prototype.getGridBounds
- OpenLayers.Format.XML.prototype.concatChildValues
- OpenLayers.Layer.WMS.Post
- OpenLayers.Layer.WMS.Untiled
- OpenLayers.Layer.MapServer.Untiled
- OpenLayers.Tile.WFS
- OpenLayers.Feature.WFS
- OpenLayers.Layer.WFS
- OpenLayers.Layer.MultiMap
- OpenLayers.Layer.VirtualEarth
- OpenLayers.Protocol.SQL
- OpenLayers.Protocol.SQL.Gears
- OpenLayers.Layer.Yahoo
- OpenLayers.Layer.GML
- OpenLayers.Geometry.Rectangle
In addition, OpenLayers no longer modifies any native prototypes or objects by default. If you rely on any of the following, you'll need to include deprecated.js explicitly to get the same behavior.
- String.prototype.startsWith
- String.prototype.contains
- String.prototype.trim
- String.prototype.camelize
- Function.prototype.bind
- Function.prototype.bindAsEventListener
- Event.stop