Compare commits
62 Commits
v3.11.0-be
...
v3.11.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb5607544c | ||
|
|
4999c792f1 | ||
|
|
5af338f92b | ||
|
|
071aad4815 | ||
|
|
a43cca7720 | ||
|
|
4c19e13bf6 | ||
|
|
1c6a56f781 | ||
|
|
3aabc44746 | ||
|
|
b426fa5509 | ||
|
|
70d376f215 | ||
|
|
c5f4710b8d | ||
|
|
14338e9c16 | ||
|
|
ce5ab5b59c | ||
|
|
bb5377fb8c | ||
|
|
657af1983d | ||
|
|
ab7e608129 | ||
|
|
0c2c058534 | ||
|
|
a9987de308 | ||
|
|
c02fdf2393 | ||
|
|
ca50e9e5b7 | ||
|
|
069a81db74 | ||
|
|
df460d2ed1 | ||
|
|
b29b969cfe | ||
|
|
a020251f69 | ||
|
|
b2292cc6fd | ||
|
|
647c1a6351 | ||
|
|
bfbb802b85 | ||
|
|
a446147902 | ||
|
|
d968f32456 | ||
|
|
1aea2c2b0c | ||
|
|
5b817f3146 | ||
|
|
a58f66a9a9 | ||
|
|
8e15f80d7a | ||
|
|
a35b3a5f52 | ||
|
|
9cf26f1fac | ||
|
|
fadf63cbd0 | ||
|
|
daa970fe4c | ||
|
|
3254e08785 | ||
|
|
544f951c14 | ||
|
|
08a640b793 | ||
|
|
d29f3b9068 | ||
|
|
d68991e982 | ||
|
|
5c536aafc7 | ||
|
|
757d46541c | ||
|
|
dc3bf0d04b | ||
|
|
9cde0ab860 | ||
|
|
bb00f4dafd | ||
|
|
16670e4015 | ||
|
|
4b85dd89a5 | ||
|
|
71f7c70279 | ||
|
|
2d24c8942e | ||
|
|
d24dcc7753 | ||
|
|
bea1501bb7 | ||
|
|
5751d342ff | ||
|
|
8514a85353 | ||
|
|
ad85e0e98d | ||
|
|
66a99dd6c4 | ||
|
|
eb762b6f4a | ||
|
|
14a1add08d | ||
|
|
cbd1aee0cc | ||
|
|
135d66dac7 | ||
|
|
3f30072de5 |
@@ -46,6 +46,12 @@ but with additional css:
|
||||
|
||||
With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`.
|
||||
|
||||
#### `ol.Map#forEachFeatureAtPixel` changes for unmanaged layers
|
||||
|
||||
`ol.Map#forEachFeatureAtPixel` will still be called for unmanaged layers, but the 2nd argument to the callback function will be `null` instead of a reference to the unmanaged layer. This brings back the behavior of the abandoned `ol.FeatureOverlay` that was replaced by unmanaged layers.
|
||||
|
||||
If you are affected by this change, please change your unmanaged layer to a regular layer by using e.g. `ol.Map#addLayer` instead of `ol.layer.Layer#setMap`.
|
||||
|
||||
### v3.10.0
|
||||
|
||||
#### `ol.layer.Layer` changes
|
||||
|
||||
136
changelog/v3.11.0.md
Normal file
136
changelog/v3.11.0.md
Normal file
@@ -0,0 +1,136 @@
|
||||
# v3.11.0
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.11.0 release includes features and fixes from 73 pull requests since the v3.10.1 release. New features and improvements include:
|
||||
|
||||
* Support for raster reprojection - load raster sources in one projection and view them in another.
|
||||
* Support for Mapbox Vector Tiles!
|
||||
* Improved KML support, GeoJSON & TopoJSON fixes, and much more. See below for the full list.
|
||||
|
||||
## Upgrade notes
|
||||
|
||||
#### `ol.format.KML` changes
|
||||
|
||||
KML icons are scaled 50% so that the rendering better matches Google Earth rendering.
|
||||
|
||||
If a KML placemark has a name and is a point, an `ol.style.Text` is created with the name displayed to the right of the icon (if there is an icon).
|
||||
This can be controlled with the showPointNames option which defaults to true.
|
||||
|
||||
To disable rendering of the point names for placemarks, use the option:
|
||||
new ol.format.KML({ showPointNames: false });
|
||||
|
||||
#### `ol.interaction.DragBox` and `ol.interaction.DragZoom` changes
|
||||
|
||||
Styling is no longer done with `ol.Style`, but with pure CSS. The `style` constructor option is no longer required, and no longer available. Instead, there is a `className` option for the CSS selector. The default for `ol.interaction.DragBox` is `ol-dragbox`, and `ol.interaction.DragZoom` uses `ol-dragzoom`. If you previously had
|
||||
```js
|
||||
new ol.interaction.DragZoom({
|
||||
style: new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'red',
|
||||
width: 3
|
||||
}),
|
||||
fill: new ol.style.Fill({
|
||||
color: [255, 255, 255, 0.4]
|
||||
})
|
||||
})
|
||||
});
|
||||
```
|
||||
you'll now just need
|
||||
```js
|
||||
new ol.interaction.DragZoom();
|
||||
```
|
||||
but with additional css:
|
||||
```css
|
||||
.ol-dragzoom {
|
||||
border-color: red;
|
||||
border-width: 3px;
|
||||
background-color: rgba(255,255,255,0.4);
|
||||
}
|
||||
```
|
||||
|
||||
#### Removal of `ol.source.TileVector`
|
||||
|
||||
With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`.
|
||||
|
||||
#### `ol.Map#forEachFeatureAtPixel` changes for unmanaged layers
|
||||
|
||||
`ol.Map#forEachFeatureAtPixel` will still be called for unmanaged layers, but the 2nd argument to the callback function will be `null` instead of a reference to the unmanaged layer. This brings back the behavior of the abandoned `ol.FeatureOverlay` that was replaced by unmanaged layers.
|
||||
|
||||
If you are affected by this change, please change your unmanaged layer to a regular layer by using e.g. `ol.Map#addLayer` instead of `ol.layer.Layer#setMap`.
|
||||
|
||||
## Full list of changes
|
||||
|
||||
* [#4394](https://github.com/openlayers/ol3/pull/4394) - Allow ol.Object property update without notification. ([@DavidHequet](https://github.com/DavidHequet))
|
||||
* [#4395](https://github.com/openlayers/ol3/pull/4395) - Flag ol.style.Text setOffsetX and Y as @api. ([@adube](https://github.com/adube))
|
||||
* [#4393](https://github.com/openlayers/ol3/pull/4393) - Faster vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4392](https://github.com/openlayers/ol3/pull/4392) - Update clean-css to version 3.4.7 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4391](https://github.com/openlayers/ol3/pull/4391) - Pass null as forEachFeatureAtPixel layer arg for unmanaged layers ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4390](https://github.com/openlayers/ol3/pull/4390) - Fix usage of mocha-phantomjs-core after update ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4387](https://github.com/openlayers/ol3/pull/4387) - Add default argument to getRendererFromQueryString ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4376](https://github.com/openlayers/ol3/pull/4376) - Make KML format ignore image styles that aren't icons ([@elemoine](https://github.com/elemoine))
|
||||
* [#4385](https://github.com/openlayers/ol3/pull/4385) - Don't transform the scale specified by the user ([@oterral](https://github.com/oterral))
|
||||
* [#4388](https://github.com/openlayers/ol3/pull/4388) - Quick-fix running tests with PhantomJS ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4378](https://github.com/openlayers/ol3/pull/4378) - Add a writeStyles option to KML format ([@elemoine](https://github.com/elemoine))
|
||||
* [#4375](https://github.com/openlayers/ol3/pull/4375) - Fixed documentation typo (ol.source.ImageWMS) ([@simonseyock](https://github.com/simonseyock))
|
||||
* [#4371](https://github.com/openlayers/ol3/pull/4371) - Fix typo in closure compilation tutorial ([@dtreiter](https://github.com/dtreiter))
|
||||
* [#4370](https://github.com/openlayers/ol3/pull/4370) - Improve ol.interaction.Select#getLayer documentation. ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4365](https://github.com/openlayers/ol3/pull/4365) - Update fs-extra to version 0.26.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4366](https://github.com/openlayers/ol3/pull/4366) - Update resemblejs to version 2.0.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4368](https://github.com/openlayers/ol3/pull/4368) - Append KML placemark text style to existing styles ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4361](https://github.com/openlayers/ol3/pull/4361) - Make GPX format not fail on unsupported geometries ([@elemoine](https://github.com/elemoine))
|
||||
* [#4360](https://github.com/openlayers/ol3/pull/4360) - Update getExtent return value jsdoc tag ([@fredj](https://github.com/fredj))
|
||||
* [#4359](https://github.com/openlayers/ol3/pull/4359) - Update closure-util to version 1.9.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4357](https://github.com/openlayers/ol3/pull/4357) - Update all dependencies. ([@openlayers](https://github.com/openlayers))
|
||||
* [#4356](https://github.com/openlayers/ol3/pull/4356) - Update Metalsmith and layouts plugin. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4355](https://github.com/openlayers/ol3/pull/4355) - Update PhantomJS. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4353](https://github.com/openlayers/ol3/pull/4353) - Resolve path to jsdoc-fork. ([@tschaub](https://github.com/tschaub))
|
||||
* [#3627](https://github.com/openlayers/ol3/pull/3627) - Make package.json compatible for npm frontend use. ([@ThomasG77](https://github.com/ThomasG77))
|
||||
* [#4163](https://github.com/openlayers/ol3/pull/4163) - Fixes for building with Node 4.x. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4347](https://github.com/openlayers/ol3/pull/4347) - Use require.resolve() to find jsdoc. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4291](https://github.com/openlayers/ol3/pull/4291) - Add 'Move a feature along a line' example. ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4344](https://github.com/openlayers/ol3/pull/4344) - Allow different resolutions in x and y direction for ol.source.ImageStatic ([@bartvde](https://github.com/bartvde))
|
||||
* [#4339](https://github.com/openlayers/ol3/pull/4339) - Make sure drawImage width and height are not too big ([@bartvde](https://github.com/bartvde))
|
||||
* [#4334](https://github.com/openlayers/ol3/pull/4334) - Check view extent within image extent ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4332](https://github.com/openlayers/ol3/pull/4332) - Fix write out GeoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
|
||||
* [#4331](https://github.com/openlayers/ol3/pull/4331) - Allow TopoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
|
||||
* [#4330](https://github.com/openlayers/ol3/pull/4330) - ol.format.TopoJSON is read only, update the jsdoc ([@openlayers](https://github.com/openlayers))
|
||||
* [#4327](https://github.com/openlayers/ol3/pull/4327) - Allow GeoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
|
||||
* [#4219](https://github.com/openlayers/ol3/pull/4219) - Support tiled vector data and Mapbox vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4322](https://github.com/openlayers/ol3/pull/4322) - Add wrapX override support for ol.source.Cluster ([@FRizZL](https://github.com/FRizZL))
|
||||
* [#4316](https://github.com/openlayers/ol3/pull/4316) - Render name labels if the geometry is a point in KML format (@tamarmot) ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4313](https://github.com/openlayers/ol3/pull/4313) - Align logos nicely with attribution text ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4297](https://github.com/openlayers/ol3/pull/4297) - Create standalone versions of ol.ext packages ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4302](https://github.com/openlayers/ol3/pull/4302) - scale icons by 0.5 so they are not huge ([@tamarmot](https://github.com/tamarmot))
|
||||
* [#4301](https://github.com/openlayers/ol3/pull/4301) - Remove jshint -W069 tags in source code ([@fredj](https://github.com/fredj))
|
||||
* [#4273](https://github.com/openlayers/ol3/pull/4273) - Expand docs on ol.source url prop. ([@Barryrowe](https://github.com/Barryrowe))
|
||||
* [#4293](https://github.com/openlayers/ol3/pull/4293) - Refine the pull request process ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4289](https://github.com/openlayers/ol3/pull/4289) - Restrict maxZoom of the static-image example ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4275](https://github.com/openlayers/ol3/pull/4275) - Fix ol.events.condition.mouseOnly parameter type ([@fredj](https://github.com/fredj))
|
||||
* [#4248](https://github.com/openlayers/ol3/pull/4248) - Use Math.cosh of ES6/2015 if available ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4286](https://github.com/openlayers/ol3/pull/4286) - Add a color manipulation example. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4122](https://github.com/openlayers/ol3/pull/4122) - Raster reprojection ([@klokantech](https://github.com/klokantech))
|
||||
* [#4283](https://github.com/openlayers/ol3/pull/4283) - Flag ol.tilegrid.TileGrid getTileCoordExtent as @api ([@adube](https://github.com/adube))
|
||||
* [#4280](https://github.com/openlayers/ol3/pull/4280) - Use overlay container instead of viewport for ol.render.Box ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4278](https://github.com/openlayers/ol3/pull/4278) - Use DOM instead of map canvas for ol.render.Box ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4277](https://github.com/openlayers/ol3/pull/4277) - Improve the box select example ([@fredj](https://github.com/fredj))
|
||||
* [#4276](https://github.com/openlayers/ol3/pull/4276) - Better ol.events.condition.platformModifierKeyOnly documentation ([@fredj](https://github.com/fredj))
|
||||
* [#4102](https://github.com/openlayers/ol3/pull/4102) - Export ol.Observable#dispatchEvent function ([@fredj](https://github.com/fredj))
|
||||
* [#4261](https://github.com/openlayers/ol3/pull/4261) - ol.events.condition.mouseOnly may be wrong ([@fredj](https://github.com/fredj))
|
||||
* [#4269](https://github.com/openlayers/ol3/pull/4269) - Fix Zoom control duration option - allow `0` as value ([@adube](https://github.com/adube))
|
||||
* [#4268](https://github.com/openlayers/ol3/pull/4268) - Add method for retrieving ol.Overlay by id ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4257](https://github.com/openlayers/ol3/pull/4257) - Remove unused ol.math-methods ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4270](https://github.com/openlayers/ol3/pull/4270) - Fix Keyboard zoom interation options ([@adube](https://github.com/adube))
|
||||
* [#4272](https://github.com/openlayers/ol3/pull/4272) - Allow the DragZoom interaction created in defaults to use zoomDuration option. ([@adube](https://github.com/adube))
|
||||
* [#4271](https://github.com/openlayers/ol3/pull/4271) - Fix DragZoom interaction duration, allow `0` value ([@adube](https://github.com/adube))
|
||||
* [#4267](https://github.com/openlayers/ol3/pull/4267) - Example usability improvements ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4263](https://github.com/openlayers/ol3/pull/4263) - Add back CSSProperties.prototype.touchAction extern ([@fredj](https://github.com/fredj))
|
||||
* [#4259](https://github.com/openlayers/ol3/pull/4259) - Remove use of toDegrees/toRadians util functions ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4258](https://github.com/openlayers/ol3/pull/4258) - Remove usage of goog.dom.TagName enum ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4255](https://github.com/openlayers/ol3/pull/4255) - Fix zoom slider width for retina displays ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4249](https://github.com/openlayers/ol3/pull/4249) - Make whole example box clickable ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4045](https://github.com/openlayers/ol3/pull/4045) - Add parser for dimension property from WMTS Capabilities.xml ([@Jenselme](https://github.com/Jenselme))
|
||||
* [#4161](https://github.com/openlayers/ol3/pull/4161) - Add `translatestart`, `translateend` and `translating` events to `ol.interaction.Translate` ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4186](https://github.com/openlayers/ol3/pull/4186) - Do not export ol.webgl.Context ([@elemoine](https://github.com/elemoine))
|
||||
* [#4239](https://github.com/openlayers/ol3/pull/4239) - Changing highlighted to highlight ([@austinkeeley](https://github.com/austinkeeley))
|
||||
* [#3727](https://github.com/openlayers/ol3/pull/3727) - Added getOverviewMap getter method in overviewmapcontrol.js ([@bogdanvaduva](https://github.com/bogdanvaduva))
|
||||
11
changelog/v3.11.1.md
Normal file
11
changelog/v3.11.1.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# v3.11.1
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.11.1 release is a patch release that addresses a few regressions in the v3.11.0 release. See the [v3.11.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.11.0) for details on upgrading from v3.10.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4413](https://github.com/openlayers/ol3/pull/4413) - Revert "Merge pull request #4339 from bartvde/issue-4337" ([@bartvde](https://github.com/bartvde))
|
||||
* [#4412](https://github.com/openlayers/ol3/pull/4412) - Revert "Merge pull request #4344 from bartvde/issue-2844" ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4408](https://github.com/openlayers/ol3/pull/4408) - Use ratio when calculating ImageWMS width and height ([@ahocevar](https://github.com/ahocevar))
|
||||
11
changelog/v3.11.2.md
Normal file
11
changelog/v3.11.2.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# v3.11.2
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.11.2 release is a patch release that addresses a few regressions in the v3.11.1 release. See the [v3.11.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.11.0) for details on upgrading from v3.10.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4450](https://github.com/openlayers/ol3/pull/4450) - Fix select interaction regression caused by #4391 ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4448](https://github.com/openlayers/ol3/pull/4448) - Check ol.source.UrlTile#urls property for null value ([@fredj](https://github.com/fredj))
|
||||
* [#4439](https://github.com/openlayers/ol3/pull/4439) - Allow '' for crossOrigin (as Anonymous alias) ([@ahocevar](https://github.com/ahocevar))
|
||||
@@ -312,7 +312,7 @@ directory:
|
||||
```
|
||||
|
||||
Note that the page includes a `script` tag referencing the `app.js` file,
|
||||
which is the file resuted from the compilation.
|
||||
which is the file resulting from the compilation.
|
||||
|
||||
You are done!
|
||||
|
||||
|
||||
@@ -78,14 +78,8 @@ var vector = new ol.layer.Vector({
|
||||
source: vectorSource
|
||||
});
|
||||
|
||||
// Use the "webgl" renderer by default.
|
||||
var renderer = common.getRendererFromQueryString();
|
||||
if (!renderer) {
|
||||
renderer = 'webgl';
|
||||
}
|
||||
|
||||
var map = new ol.Map({
|
||||
renderer: renderer,
|
||||
renderer: common.getRendererFromQueryString('webgl'),
|
||||
layers: [vector],
|
||||
target: document.getElementById('map'),
|
||||
view: new ol.View({
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
var common = {};
|
||||
|
||||
common.getRendererFromQueryString = function() {
|
||||
common.getRendererFromQueryString = function(opt_default) {
|
||||
var obj = {};
|
||||
var queryString = location.search.slice(1);
|
||||
var re = /([^&=]+)=([^&]*)/g;
|
||||
@@ -98,6 +98,6 @@ common.getRendererFromQueryString = function() {
|
||||
} else if ('renderer' in obj) {
|
||||
return [obj['renderer']];
|
||||
} else {
|
||||
return undefined;
|
||||
return opt_default;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,16 +53,16 @@ function createMapboxStreetsV6Style() {
|
||||
} else if (layer == 'waterway' &&
|
||||
cls != 'river' && cls != 'stream' && cls != 'canal') {
|
||||
stroke.setColor('#a0c8f0');
|
||||
stroke.setWidth(1.3);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'waterway' && cls == 'river') {
|
||||
stroke.setColor('#a0c8f0');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'waterway' && (cls == 'stream' ||
|
||||
cls == 'canal')) {
|
||||
stroke.setColor('#a0c8f0');
|
||||
stroke.setWidth(1.3);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'water') {
|
||||
fill.setColor('#a0c8f0');
|
||||
@@ -73,7 +73,7 @@ function createMapboxStreetsV6Style() {
|
||||
} else if (layer == 'aeroway' && geom == 'LineString' &&
|
||||
resolution <= 76.43702828517625) {
|
||||
stroke.setColor('#f0ede9');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'building') {
|
||||
fill.setColor('#f2eae2');
|
||||
@@ -82,90 +82,90 @@ function createMapboxStreetsV6Style() {
|
||||
styles[length++] = strokedPolygon;
|
||||
} else if (layer == 'tunnel' && cls == 'motorway_link') {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' && cls == 'service') {
|
||||
stroke.setColor('#cfcdca');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' &&
|
||||
(cls == 'street' || cls == 'street_limited')) {
|
||||
stroke.setColor('#cfcdca');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' && cls == 'main' &&
|
||||
resolution <= 1222.99245256282) {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' && cls == 'motorway') {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' && cls == 'path') {
|
||||
stroke.setColor('#cba');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'tunnel' && cls == 'major_rail') {
|
||||
stroke.setColor('#bbb');
|
||||
stroke.setWidth(1.4);
|
||||
stroke.setWidth(2);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && cls == 'motorway_link') {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && (cls == 'street' ||
|
||||
cls == 'street_limited') && geom == 'LineString') {
|
||||
stroke.setColor('#cfcdca');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && cls == 'main' &&
|
||||
resolution <= 1222.99245256282) {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && cls == 'motorway' &&
|
||||
resolution <= 4891.96981025128) {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && cls == 'path') {
|
||||
stroke.setColor('#cba');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'road' && cls == 'major_rail') {
|
||||
stroke.setColor('#bbb');
|
||||
stroke.setWidth(1.4);
|
||||
stroke.setWidth(2);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'motorway_link') {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'motorway') {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'service') {
|
||||
stroke.setColor('#cfcdca');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' &&
|
||||
(cls == 'street' || cls == 'street_limited')) {
|
||||
stroke.setColor('#cfcdca');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'main' &&
|
||||
resolution <= 1222.99245256282) {
|
||||
stroke.setColor('#e9ac77');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'path') {
|
||||
stroke.setColor('#cba');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'bridge' && cls == 'major_rail') {
|
||||
stroke.setColor('#bbb');
|
||||
stroke.setWidth(1.4);
|
||||
stroke.setWidth(2);
|
||||
styles[length++] = line;
|
||||
} else if (layer == 'admin' && adminLevel >= 3 && maritime === 0) {
|
||||
stroke.setColor('#9e9cab');
|
||||
@@ -227,7 +227,7 @@ function createMapboxStreetsV6Style() {
|
||||
'italic 11px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#74aee9');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(0.75);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'marine_label' && labelrank === 2 &&
|
||||
geom == 'Point') {
|
||||
@@ -236,7 +236,7 @@ function createMapboxStreetsV6Style() {
|
||||
'italic 11px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#74aee9');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(0.75);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'marine_label' && labelrank === 3 &&
|
||||
geom == 'Point') {
|
||||
@@ -245,7 +245,7 @@ function createMapboxStreetsV6Style() {
|
||||
'italic 10px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#74aee9');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(0.75);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'marine_label' && labelrank === 4 &&
|
||||
geom == 'Point') {
|
||||
@@ -254,7 +254,7 @@ function createMapboxStreetsV6Style() {
|
||||
'italic 9px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#74aee9');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(0.75);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'place_label' && type == 'city' &&
|
||||
resolution <= 1222.99245256282) {
|
||||
@@ -262,7 +262,7 @@ function createMapboxStreetsV6Style() {
|
||||
text.getText().setFont('11px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#333');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'place_label' && type == 'town' &&
|
||||
resolution <= 305.748113140705) {
|
||||
@@ -270,7 +270,7 @@ function createMapboxStreetsV6Style() {
|
||||
text.getText().setFont('9px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#333');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'place_label' && type == 'village' &&
|
||||
resolution <= 38.21851414258813) {
|
||||
@@ -278,7 +278,7 @@ function createMapboxStreetsV6Style() {
|
||||
text.getText().setFont('8px "Open Sans", "Arial Unicode MS"');
|
||||
fill.setColor('#333');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'place_label' &&
|
||||
resolution <= 19.109257071294063 && (type == 'hamlet' ||
|
||||
@@ -287,7 +287,7 @@ function createMapboxStreetsV6Style() {
|
||||
text.getText().setFont('bold 9px "Arial Narrow"');
|
||||
fill.setColor('#633');
|
||||
stroke.setColor('rgba(255,255,255,0.8)');
|
||||
stroke.setWidth(1.2);
|
||||
stroke.setWidth(1);
|
||||
styles[length++] = text;
|
||||
} else if (layer == 'poi_label' && resolution <= 19.109257071294063 &&
|
||||
scalerank == 1 && maki !== 'marker') {
|
||||
|
||||
@@ -106,14 +106,8 @@ var vector = new ol.layer.Vector({
|
||||
source: vectorSource
|
||||
});
|
||||
|
||||
// Use the "webgl" renderer by default.
|
||||
var renderer = common.getRendererFromQueryString();
|
||||
if (!renderer) {
|
||||
renderer = 'webgl';
|
||||
}
|
||||
|
||||
var map = new ol.Map({
|
||||
renderer: renderer,
|
||||
renderer: common.getRendererFromQueryString('webgl'),
|
||||
layers: [vector],
|
||||
target: document.getElementById('map'),
|
||||
view: new ol.View({
|
||||
|
||||
@@ -6,9 +6,10 @@ var common;
|
||||
|
||||
|
||||
/**
|
||||
* @param {string=} opt_default Default renderer.
|
||||
* @return {string} Renderer type.
|
||||
*/
|
||||
common.getRendererFromQueryString = function() {};
|
||||
common.getRendererFromQueryString = function(opt_default) {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1796,7 +1796,8 @@ olx.format.IGCOptions.prototype.altitudeMode;
|
||||
/**
|
||||
* @typedef {{extractStyles: (boolean|undefined),
|
||||
* defaultStyle: (Array.<ol.style.Style>|undefined),
|
||||
* showPointNames: (boolean|undefined)}}
|
||||
* showPointNames: (boolean|undefined),
|
||||
* writeStyles: (boolean|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
olx.format.KMLOptions;
|
||||
@@ -1826,6 +1827,14 @@ olx.format.KMLOptions.prototype.showPointNames;
|
||||
olx.format.KMLOptions.prototype.defaultStyle;
|
||||
|
||||
|
||||
/**
|
||||
* Write styles into KML. Default is `true`.
|
||||
* @type {boolean|undefined}
|
||||
* @api stable
|
||||
*/
|
||||
olx.format.KMLOptions.prototype.writeStyles;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{featureNS: (Object.<string, string>|string|undefined),
|
||||
* featureType: (Array.<string>|string|undefined),
|
||||
@@ -4784,7 +4793,7 @@ olx.source.ImageWMSOptions.prototype.serverType;
|
||||
|
||||
/**
|
||||
* Optional function to load an image given a URL.
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @type {ol.ImageLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.ImageWMSOptions.prototype.imageLoadFunction;
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openlayers",
|
||||
"version": "3.11.0-beta.2",
|
||||
"version": "3.11.2",
|
||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||
"keywords": [
|
||||
"map",
|
||||
@@ -32,9 +32,9 @@
|
||||
"async": "1.5.0",
|
||||
"bluebird": "^3.0.5",
|
||||
"browserify": "12.0.1",
|
||||
"closure-util": "1.8.0",
|
||||
"closure-util": "1.9.0",
|
||||
"derequire": "2.0.3",
|
||||
"fs-extra": "0.26.0",
|
||||
"fs-extra": "0.26.2",
|
||||
"glob": "5.0.15",
|
||||
"graceful-fs": "4.1.2",
|
||||
"handlebars": "4.0.4",
|
||||
@@ -51,7 +51,7 @@
|
||||
"walk": "2.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"clean-css": "3.4.6",
|
||||
"clean-css": "3.4.7",
|
||||
"coveralls": "2.11.4",
|
||||
"debounce": "^1.0.0",
|
||||
"expect.js": "0.3.1",
|
||||
@@ -60,11 +60,11 @@
|
||||
"jquery": "2.1.4",
|
||||
"jshint": "2.8.0",
|
||||
"mocha": "2.3.3",
|
||||
"mocha-phantomjs-core": "^1.2.1",
|
||||
"mocha-phantomjs-core": "^1.3.0",
|
||||
"mustache": "2.2.0",
|
||||
"phantomjs": "1.9.18",
|
||||
"proj4": "2.3.12",
|
||||
"resemblejs": "1.3.1",
|
||||
"resemblejs": "2.0.1",
|
||||
"sinon": "1.17.2",
|
||||
"slimerjs-edge": "0.10.0-pre-3",
|
||||
"wrench": "1.5.8"
|
||||
|
||||
@@ -839,11 +839,13 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
'value should be an ol.Feature');
|
||||
var geometry = value.getGeometry();
|
||||
if (geometry) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
goog.asserts.assert(ol.xml.isNode(parentNode),
|
||||
'parentNode should be an XML node');
|
||||
return ol.xml.createElementNS(parentNode.namespaceURI,
|
||||
ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]);
|
||||
var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
|
||||
if (nodeName) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
goog.asserts.assert(ol.xml.isNode(parentNode),
|
||||
'parentNode should be an XML node');
|
||||
return ol.xml.createElementNS(parentNode.namespaceURI, nodeName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -92,6 +92,13 @@ ol.format.KML = function(opt_options) {
|
||||
this.extractStyles_ = options.extractStyles !== undefined ?
|
||||
options.extractStyles : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.writeStyles_ = options.writeStyles !== undefined ?
|
||||
options.writeStyles : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<string, (Array.<ol.style.Style>|string)>}
|
||||
@@ -342,11 +349,7 @@ ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
|
||||
});
|
||||
}
|
||||
var nameStyle = new ol.style.Style({
|
||||
fill: undefined,
|
||||
image: undefined,
|
||||
text: textStyle,
|
||||
stroke: undefined,
|
||||
zIndex: undefined
|
||||
text: textStyle
|
||||
});
|
||||
return nameStyle;
|
||||
};
|
||||
@@ -394,7 +397,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
||||
if (drawName) {
|
||||
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
|
||||
name);
|
||||
return [style, nameStyle];
|
||||
return style.concat(nameStyle);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
@@ -651,6 +654,9 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
||||
(object['scale']);
|
||||
if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
|
||||
size = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_;
|
||||
if (scale === undefined) {
|
||||
scale = ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_;
|
||||
}
|
||||
}
|
||||
|
||||
var imageStyle = new ol.style.Icon({
|
||||
@@ -662,7 +668,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
||||
offset: offset,
|
||||
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
||||
rotation: rotation,
|
||||
scale: ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ * scale,
|
||||
scale: scale,
|
||||
size: size,
|
||||
src: src
|
||||
});
|
||||
@@ -2173,6 +2179,7 @@ ol.format.KML.writeCoordinatesTextNode_ =
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @this {ol.format.KML}
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.writeDocument_ = function(node, features, objectStack) {
|
||||
@@ -2370,6 +2377,7 @@ ol.format.KML.writeBoundaryIs_ = function(node, linearRing, objectStack) {
|
||||
* @param {Node} node Node.
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @this {ol.format.KML}
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
@@ -2382,14 +2390,18 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
|
||||
// serialize properties (properties unknown to KML are not serialized)
|
||||
var properties = feature.getProperties();
|
||||
|
||||
var styleFunction = feature.getStyleFunction();
|
||||
if (styleFunction) {
|
||||
// FIXME the styles returned by the style function are supposed to be
|
||||
// resolution-independent here
|
||||
var styles = styleFunction.call(feature, 0);
|
||||
if (styles && styles.length > 0) {
|
||||
properties['Style'] = styles[0];
|
||||
var textStyle = styles[0].getText();
|
||||
var style = styles[0];
|
||||
if (this.writeStyles_) {
|
||||
properties['Style'] = styles[0];
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (textStyle) {
|
||||
properties['name'] = textStyle.getText();
|
||||
}
|
||||
@@ -2500,7 +2512,7 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) {
|
||||
var strokeStyle = style.getStroke();
|
||||
var imageStyle = style.getImage();
|
||||
var textStyle = style.getText();
|
||||
if (imageStyle) {
|
||||
if (imageStyle instanceof ol.style.Icon) {
|
||||
properties['IconStyle'] = imageStyle;
|
||||
}
|
||||
if (textStyle) {
|
||||
@@ -2992,6 +3004,7 @@ ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
var orderedKeys = ol.format.KML.KML_SEQUENCE_[kml.namespaceURI];
|
||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.KML_SERIALIZERS_,
|
||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, [opt_options], orderedKeys);
|
||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, [opt_options], orderedKeys,
|
||||
this);
|
||||
return kml;
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ goog.require('ol.extent');
|
||||
* @constructor
|
||||
* @extends {ol.ImageBase}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {Array.<number>|undefined} resolution Resolution.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
* @param {string} src Image source URI.
|
||||
@@ -38,7 +38,7 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
||||
* @type {Image}
|
||||
*/
|
||||
this.image_ = new Image();
|
||||
if (crossOrigin) {
|
||||
if (crossOrigin !== null) {
|
||||
this.image_.crossOrigin = crossOrigin;
|
||||
}
|
||||
|
||||
@@ -114,10 +114,7 @@ ol.Image.prototype.handleImageError_ = function() {
|
||||
*/
|
||||
ol.Image.prototype.handleImageLoad_ = function() {
|
||||
if (this.resolution === undefined) {
|
||||
this.resolution = [
|
||||
ol.extent.getWidth(this.extent) / this.image_.width,
|
||||
ol.extent.getHeight(this.extent) / this.image_.height
|
||||
];
|
||||
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
||||
}
|
||||
this.state = ol.ImageState.LOADED;
|
||||
this.unlistenImage_();
|
||||
|
||||
@@ -24,9 +24,7 @@ ol.ImageState = {
|
||||
* @constructor
|
||||
* @extends {goog.events.EventTarget}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {Array.<number>|undefined} resolution Resolution, first value
|
||||
* is the resolution in the x direction, second value is the resolution
|
||||
* in the y direction.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.ImageState} state State.
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
@@ -55,7 +53,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {Array.<number>|undefined}
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.resolution = resolution;
|
||||
|
||||
@@ -109,7 +107,7 @@ ol.ImageBase.prototype.getPixelRatio = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<number>} Resolution.
|
||||
* @return {number} Resolution.
|
||||
*/
|
||||
ol.ImageBase.prototype.getResolution = function() {
|
||||
goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set');
|
||||
|
||||
@@ -30,8 +30,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
||||
var state = opt_loader !== undefined ?
|
||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||
|
||||
goog.base(this, extent, [resolution, resolution], pixelRatio, state,
|
||||
attributions);
|
||||
goog.base(this, extent, resolution, pixelRatio, state, attributions);
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -37,7 +37,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
||||
* @type {Image}
|
||||
*/
|
||||
this.image_ = new Image();
|
||||
if (crossOrigin) {
|
||||
if (crossOrigin !== null) {
|
||||
this.image_.crossOrigin = crossOrigin;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,8 @@ goog.inherits(ol.interaction.SelectEvent, goog.events.Event);
|
||||
* `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
|
||||
* further feature filter using the `filter` option.
|
||||
*
|
||||
* Selected features are added to an internal unmanaged layer.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Interaction}
|
||||
* @param {olx.interaction.SelectOptions=} opt_options Options.
|
||||
@@ -235,7 +237,9 @@ ol.interaction.Select.prototype.getFeatures = function() {
|
||||
|
||||
/**
|
||||
* Returns the associated {@link ol.layer.Vector vectorlayer} of
|
||||
* the (last) selected feature.
|
||||
* the (last) selected feature. Note that this will not work with any
|
||||
* programmatic method like pushing features to
|
||||
* {@link ol.interaction.Select#getFeatures collection}.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature
|
||||
* @return {ol.layer.Vector} Layer.
|
||||
* @api
|
||||
@@ -279,7 +283,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
|
||||
* @param {ol.layer.Layer} layer Layer.
|
||||
*/
|
||||
function(feature, layer) {
|
||||
if (this.filter_(feature, layer)) {
|
||||
if (!layer || this.filter_(feature, layer)) {
|
||||
selected.push(feature);
|
||||
this.addFeatureLayerAssociation_(feature, layer);
|
||||
return !this.multi_;
|
||||
|
||||
@@ -20,6 +20,11 @@ goog.require('ol.source.State');
|
||||
* Layers group together those properties that pertain to how the data is to be
|
||||
* displayed, irrespective of the source of that data.
|
||||
*
|
||||
* Layers are usually added to a map with {@link ol.Map#addLayer}. Components
|
||||
* like {@link ol.interaction.Select} use unmanaged layers internally. These
|
||||
* unmanaged layers are associated with the map using
|
||||
* {@link ol.layer.Layer#setMap} instead.
|
||||
*
|
||||
* A generic `change` event is fired when the state of the source changes.
|
||||
*
|
||||
* @constructor
|
||||
|
||||
@@ -599,8 +599,9 @@ ol.Map.prototype.disposeInternal = function() {
|
||||
* called with two arguments. The first argument is one
|
||||
* {@link ol.Feature feature} or
|
||||
* {@link ol.render.Feature render feature} at the pixel, the second is
|
||||
* the {@link ol.layer.Layer layer} of the feature. To stop detection,
|
||||
* callback functions can return a truthy value.
|
||||
* the {@link ol.layer.Layer layer} of the feature and will be null for
|
||||
* unmanaged layers. To stop detection, callback functions can return a
|
||||
* truthy value.
|
||||
* @param {S=} opt_this Value to use as `this` when executing `callback`.
|
||||
* @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer
|
||||
* filter function. The filter function will receive one argument, the
|
||||
|
||||
@@ -197,12 +197,17 @@ ol.Object.prototype.notify = function(key, oldValue) {
|
||||
* Sets a value.
|
||||
* @param {string} key Key name.
|
||||
* @param {*} value Value.
|
||||
* @param {boolean=} opt_silent Update without triggering an event.
|
||||
* @api stable
|
||||
*/
|
||||
ol.Object.prototype.set = function(key, value) {
|
||||
var oldValue = this.values_[key];
|
||||
this.values_[key] = value;
|
||||
this.notify(key, oldValue);
|
||||
ol.Object.prototype.set = function(key, value, opt_silent) {
|
||||
if (opt_silent) {
|
||||
this.values_[key] = value;
|
||||
} else {
|
||||
var oldValue = this.values_[key];
|
||||
this.values_[key] = value;
|
||||
this.notify(key, oldValue);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -210,12 +215,13 @@ ol.Object.prototype.set = function(key, value) {
|
||||
* Sets a collection of key-value pairs. Note that this changes any existing
|
||||
* properties and adds new ones (it does not remove any existing properties).
|
||||
* @param {Object.<string, *>} values Values.
|
||||
* @param {boolean=} opt_silent Update without triggering an event.
|
||||
* @api stable
|
||||
*/
|
||||
ol.Object.prototype.setProperties = function(values) {
|
||||
ol.Object.prototype.setProperties = function(values, opt_silent) {
|
||||
var key;
|
||||
for (key in values) {
|
||||
this.set(key, values[key]);
|
||||
this.set(key, values[key], opt_silent);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -223,12 +229,15 @@ ol.Object.prototype.setProperties = function(values) {
|
||||
/**
|
||||
* Unsets a property.
|
||||
* @param {string} key Key name.
|
||||
* @param {boolean=} opt_silent Unset without triggering an event.
|
||||
* @api stable
|
||||
*/
|
||||
ol.Object.prototype.unset = function(key) {
|
||||
ol.Object.prototype.unset = function(key, opt_silent) {
|
||||
if (key in this.values_) {
|
||||
var oldValue = this.values_[key];
|
||||
delete this.values_[key];
|
||||
this.notify(key, oldValue);
|
||||
if (!opt_silent) {
|
||||
this.notify(key, oldValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -246,6 +246,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
||||
}
|
||||
var skipFeatures = !goog.object.isEmpty(skippedFeaturesHash);
|
||||
var i = 0; // instruction index
|
||||
var ii = instructions.length; // end of instructions
|
||||
var d = 0; // data index
|
||||
@@ -259,8 +260,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
switch (type) {
|
||||
case ol.render.canvas.Instruction.BEGIN_GEOMETRY:
|
||||
feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]);
|
||||
var featureUid = goog.getUid(feature).toString();
|
||||
if (skippedFeaturesHash[featureUid] !== undefined ||
|
||||
if ((skipFeatures &&
|
||||
skippedFeaturesHash[goog.getUid(feature).toString()]) ||
|
||||
!feature.getGeometry()) {
|
||||
i = /** @type {number} */ (instruction[2]);
|
||||
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
||||
@@ -343,10 +344,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
context.globalAlpha = alpha * opacity;
|
||||
}
|
||||
|
||||
var w = width - originX;
|
||||
var h = height - originY;
|
||||
context.drawImage(image, originX, originY, w, h, x, y,
|
||||
w * pixelRatio, h * pixelRatio);
|
||||
context.drawImage(image, originX, originY, width, height,
|
||||
x, y, width * pixelRatio, height * pixelRatio);
|
||||
|
||||
if (opacity != 1) {
|
||||
context.globalAlpha = alpha;
|
||||
|
||||
@@ -193,19 +193,15 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
||||
var imageExtent = image.getExtent();
|
||||
var imageResolution = image.getResolution();
|
||||
var imagePixelRatio = image.getPixelRatio();
|
||||
var xImageResolution = imageResolution[0];
|
||||
var yImageResolution = imageResolution[1];
|
||||
var xScale = pixelRatio * xImageResolution /
|
||||
(viewResolution * imagePixelRatio);
|
||||
var yScale = pixelRatio * yImageResolution /
|
||||
var scale = pixelRatio * imageResolution /
|
||||
(viewResolution * imagePixelRatio);
|
||||
ol.vec.Mat4.makeTransform2D(this.imageTransform_,
|
||||
pixelRatio * frameState.size[0] / 2,
|
||||
pixelRatio * frameState.size[1] / 2,
|
||||
xScale, yScale,
|
||||
scale, scale,
|
||||
viewRotation,
|
||||
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / xImageResolution,
|
||||
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / yImageResolution);
|
||||
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution,
|
||||
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution);
|
||||
this.imageTransformInv_ = null;
|
||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||
this.updateLogos(frameState, imageSource);
|
||||
|
||||
@@ -174,7 +174,9 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate =
|
||||
if (layer.getSource()) {
|
||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||
layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
|
||||
frameState, callback, thisArg);
|
||||
frameState,
|
||||
layerState.managed ? callback : forEachFeatureAtCoordinate,
|
||||
thisArg);
|
||||
}
|
||||
if (result) {
|
||||
return result;
|
||||
|
||||
@@ -116,9 +116,8 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
||||
attributions = this.sourceImage_.getAttributions();
|
||||
}
|
||||
|
||||
goog.base(this, targetExtent, [targetResolution, targetResolution],
|
||||
this.sourcePixelRatio_, state, attributions);
|
||||
|
||||
goog.base(this, targetExtent, targetResolution, this.sourcePixelRatio_,
|
||||
state, attributions);
|
||||
};
|
||||
goog.inherits(ol.reproj.Image, ol.ImageBase);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ ol.reproj.enlargeClipPoint_ = function(centroidX, centroidY, x, y) {
|
||||
* @param {number} width Width of the canvas.
|
||||
* @param {number} height Height of the canvas.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {Array.<number>} sourceResolution Source resolution.
|
||||
* @param {number} sourceResolution Source resolution.
|
||||
* @param {ol.Extent} sourceExtent Extent of the data source.
|
||||
* @param {number} targetResolution Target resolution.
|
||||
* @param {ol.Extent} targetExtent Target extent.
|
||||
@@ -124,14 +124,12 @@ ol.reproj.render = function(width, height, pixelRatio,
|
||||
|
||||
var canvasWidthInUnits = ol.extent.getWidth(sourceDataExtent);
|
||||
var canvasHeightInUnits = ol.extent.getHeight(sourceDataExtent);
|
||||
var sourceResolutionX = sourceResolution[0];
|
||||
var sourceResolutionY = sourceResolution[1];
|
||||
var stitchContext = ol.dom.createCanvasContext2D(
|
||||
Math.round(pixelRatio * canvasWidthInUnits / sourceResolutionX),
|
||||
Math.round(pixelRatio * canvasHeightInUnits / sourceResolutionY));
|
||||
Math.round(pixelRatio * canvasWidthInUnits / sourceResolution),
|
||||
Math.round(pixelRatio * canvasHeightInUnits / sourceResolution));
|
||||
|
||||
stitchContext.scale(pixelRatio / sourceResolutionX,
|
||||
pixelRatio / sourceResolutionY);
|
||||
stitchContext.scale(pixelRatio / sourceResolution,
|
||||
pixelRatio / sourceResolution);
|
||||
stitchContext.translate(-sourceDataExtent[0], sourceDataExtent[3]);
|
||||
|
||||
sources.forEach(function(src, i, arr) {
|
||||
@@ -224,8 +222,8 @@ ol.reproj.render = function(width, height, pixelRatio,
|
||||
context.translate(sourceDataExtent[0] - sourceNumericalShiftX,
|
||||
sourceDataExtent[3] - sourceNumericalShiftY);
|
||||
|
||||
context.scale(sourceResolutionX / pixelRatio,
|
||||
-sourceResolutionY / pixelRatio);
|
||||
context.scale(sourceResolution / pixelRatio,
|
||||
-sourceResolution / pixelRatio);
|
||||
|
||||
context.drawImage(stitchContext.canvas, 0, 0);
|
||||
context.restore();
|
||||
|
||||
@@ -258,7 +258,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
||||
|
||||
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
||||
this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_,
|
||||
[sourceResolution, sourceResolution], this.sourceTileGrid_.getExtent(),
|
||||
sourceResolution, this.sourceTileGrid_.getExtent(),
|
||||
targetResolution, targetExtent, this.triangulation_, sources,
|
||||
this.renderEdges_);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ ol.source.ImageMapGuide.prototype.getImageInternal =
|
||||
|
||||
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
||||
if (imageUrl !== undefined) {
|
||||
image = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||
image = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), imageUrl, this.crossOrigin_,
|
||||
this.imageLoadFunction_);
|
||||
goog.events.listen(image, goog.events.EventType.CHANGE,
|
||||
|
||||
@@ -26,12 +26,10 @@ ol.source.ImageStatic = function(options) {
|
||||
|
||||
var imageExtent = options.imageExtent;
|
||||
|
||||
var xResolution, yResolution, resolutions, imgResolution;
|
||||
var resolution, resolutions;
|
||||
if (options.imageSize !== undefined) {
|
||||
xResolution = ol.extent.getWidth(imageExtent) / options.imageSize[0];
|
||||
yResolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
||||
imgResolution = [xResolution, yResolution];
|
||||
resolutions = [yResolution];
|
||||
resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
||||
resolutions = [resolution];
|
||||
}
|
||||
|
||||
var crossOrigin = options.crossOrigin !== undefined ?
|
||||
@@ -52,8 +50,8 @@ ol.source.ImageStatic = function(options) {
|
||||
* @private
|
||||
* @type {ol.Image}
|
||||
*/
|
||||
this.image_ = new ol.Image(imageExtent, imgResolution, 1,
|
||||
attributions, options.url, crossOrigin, imageLoadFunction);
|
||||
this.image_ = new ol.Image(imageExtent, resolution, 1, attributions,
|
||||
options.url, crossOrigin, imageLoadFunction);
|
||||
goog.events.listen(this.image_, goog.events.EventType.CHANGE,
|
||||
this.handleImageChange, false, this);
|
||||
|
||||
|
||||
@@ -203,21 +203,13 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
var centerY = (extent[1] + extent[3]) / 2;
|
||||
|
||||
var imageResolution = resolution / pixelRatio;
|
||||
|
||||
// Compute an integer width and height.
|
||||
var width = Math.ceil(ol.extent.getWidth(extent) / imageResolution);
|
||||
var height = Math.ceil(ol.extent.getHeight(extent) / imageResolution);
|
||||
|
||||
// Modify the extent to match the integer width and height.
|
||||
extent[0] = centerX - imageResolution * width / 2;
|
||||
extent[2] = centerX + imageResolution * width / 2;
|
||||
extent[1] = centerY - imageResolution * height / 2;
|
||||
extent[3] = centerY + imageResolution * height / 2;
|
||||
var imageWidth = ol.extent.getWidth(extent) / imageResolution;
|
||||
var imageHeight = ol.extent.getHeight(extent) / imageResolution;
|
||||
|
||||
var image = this.image_;
|
||||
if (image &&
|
||||
this.renderedRevision_ == this.getRevision() &&
|
||||
image.getResolution()[0] == resolution &&
|
||||
image.getResolution() == resolution &&
|
||||
image.getPixelRatio() == pixelRatio &&
|
||||
ol.extent.containsExtent(image.getExtent(), extent)) {
|
||||
return image;
|
||||
@@ -241,13 +233,13 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
};
|
||||
goog.object.extend(params, this.params_);
|
||||
|
||||
this.imageSize_[0] = width;
|
||||
this.imageSize_[1] = height;
|
||||
this.imageSize_[0] = Math.ceil(imageWidth * this.ratio_);
|
||||
this.imageSize_[1] = Math.ceil(imageHeight * this.ratio_);
|
||||
|
||||
var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio,
|
||||
projection, params);
|
||||
|
||||
this.image_ = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||
this.image_ = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), url, this.crossOrigin_, this.imageLoadFunction_);
|
||||
|
||||
this.renderedRevision_ = this.getRevision();
|
||||
|
||||
@@ -91,7 +91,7 @@ ol.source.TileArcGISRest.prototype.getRequestUrl_ =
|
||||
pixelRatio, projection, params) {
|
||||
|
||||
var urls = this.urls;
|
||||
if (urls.length === 0) {
|
||||
if (!urls) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
|
||||
pixelRatio, projection, params) {
|
||||
|
||||
var urls = this.urls;
|
||||
if (urls.length === 0) {
|
||||
if (!urls) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -298,9 +298,11 @@ ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() {
|
||||
var i = 0;
|
||||
var res = [];
|
||||
|
||||
var j, jj;
|
||||
for (j = 0, jj = this.urls.length; j < jj; ++j) {
|
||||
res[i++] = this.urls[j];
|
||||
if (this.urls) {
|
||||
var j, jj;
|
||||
for (j = 0, jj = this.urls.length; j < jj; ++j) {
|
||||
res[i++] = this.urls[j];
|
||||
}
|
||||
}
|
||||
|
||||
var key;
|
||||
|
||||
@@ -659,7 +659,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
|
||||
*
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @return {ol.Extent} Extent.
|
||||
* @return {!ol.Extent} Extent.
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.Vector.prototype.getExtent = function() {
|
||||
|
||||
@@ -253,7 +253,7 @@ ol.structs.RBush.prototype.clear = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.Extent=} opt_extent Extent.
|
||||
* @return {ol.Extent} Extent.
|
||||
* @return {!ol.Extent} Extent.
|
||||
*/
|
||||
ol.structs.RBush.prototype.getExtent = function(opt_extent) {
|
||||
// FIXME add getExtent() to rbush
|
||||
|
||||
@@ -392,7 +392,7 @@ ol.style.IconImage_ = function(image, src, size, crossOrigin, imageState) {
|
||||
*/
|
||||
this.image_ = !image ? new Image() : image;
|
||||
|
||||
if (crossOrigin) {
|
||||
if (crossOrigin !== null) {
|
||||
this.image_.crossOrigin = crossOrigin;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ ol.style.Text.prototype.setFont = function(font) {
|
||||
* Set the x offset.
|
||||
*
|
||||
* @param {number} offsetX Horizontal text offset.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Text.prototype.setOffsetX = function(offsetX) {
|
||||
this.offsetX_ = offsetX;
|
||||
@@ -215,6 +216,7 @@ ol.style.Text.prototype.setOffsetX = function(offsetX) {
|
||||
* Set the y offset.
|
||||
*
|
||||
* @param {number} offsetY Vertical text offset.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Text.prototype.setOffsetY = function(offsetY) {
|
||||
this.offsetY_ = offsetY;
|
||||
|
||||
@@ -59,14 +59,20 @@ function runTests(includeCoverage, callback) {
|
||||
var url = 'http://' + address.address + ':' + address.port;
|
||||
var args = [
|
||||
require.resolve('mocha-phantomjs-core'),
|
||||
url + '/test/index.html'
|
||||
url + '/test/index.html',
|
||||
'spec'
|
||||
];
|
||||
var config = {
|
||||
ignoreResourceErrors: true,
|
||||
useColors: true,
|
||||
};
|
||||
|
||||
if (includeCoverage) {
|
||||
args.push('spec', '{"hooks": "' +
|
||||
path.join(__dirname, '../test/phantom_hooks.js') + '"}');
|
||||
config.hooks = path.join(__dirname, '../test/phantom_hooks.js');
|
||||
}
|
||||
|
||||
args.push(JSON.stringify(config));
|
||||
|
||||
var child = spawn(phantomjs.path, args, {stdio: 'inherit'});
|
||||
child.on('exit', function(code) {
|
||||
callback(code);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1337,6 +1337,7 @@ describe('ol.format.KML', function() {
|
||||
expect(imageStyle.getOrigin()).to.be(null);
|
||||
expect(imageStyle.getRotation()).to.eql(0);
|
||||
expect(imageStyle.getSize()).to.be(null);
|
||||
expect(imageStyle.getScale()).to.be(1);
|
||||
expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
|
||||
expect(style.getZIndex()).to.be(undefined);
|
||||
});
|
||||
@@ -1348,6 +1349,7 @@ describe('ol.format.KML', function() {
|
||||
' <Placemark>' +
|
||||
' <Style>' +
|
||||
' <IconStyle>' +
|
||||
' <scale>3.0</scale>' +
|
||||
' <Icon>' +
|
||||
' <href>http://foo.png</href>' +
|
||||
' <gx:x>24</gx:x>' +
|
||||
@@ -1380,6 +1382,7 @@ describe('ol.format.KML', function() {
|
||||
expect(imageStyle.getAnchor()).to.eql([24, 36]);
|
||||
expect(imageStyle.getOrigin()).to.eql([24, 108]);
|
||||
expect(imageStyle.getRotation()).to.eql(0);
|
||||
expect(imageStyle.getScale()).to.eql(Math.sqrt(3));
|
||||
expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
|
||||
expect(style.getZIndex()).to.be(undefined);
|
||||
});
|
||||
@@ -1779,6 +1782,54 @@ describe('ol.format.KML', function() {
|
||||
expect(node).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
|
||||
it('does not write styles when writeStyles option is false', function() {
|
||||
format = new ol.format.KML({writeStyles: false});
|
||||
var style = new ol.style.Style({
|
||||
image: new ol.style.Icon({
|
||||
src: 'http://foo.png'
|
||||
})
|
||||
});
|
||||
var feature = new ol.Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
|
||||
it('skips image styles that are not icon styles', function() {
|
||||
var style = new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
radius: 4,
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgb(12, 34, 223)'
|
||||
})
|
||||
})
|
||||
});
|
||||
var feature = new ol.Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark>' +
|
||||
' <Style>' +
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
|
||||
it('can write an feature\'s text style', function() {
|
||||
var style = new ol.style.Style({
|
||||
text: new ol.style.Text({
|
||||
@@ -2725,6 +2776,7 @@ goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.style.Circle');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Icon');
|
||||
goog.require('ol.style.IconOrigin');
|
||||
|
||||
@@ -161,6 +161,29 @@ describe('ol.interaction.Select', function() {
|
||||
describe('filter features using the filter option', function() {
|
||||
var select;
|
||||
|
||||
describe('with unmanaged layers', function() {
|
||||
it('does not call filter for unmanaged layers', function() {
|
||||
var spy = sinon.spy();
|
||||
var select = new ol.interaction.Select({
|
||||
multi: false,
|
||||
filter: spy
|
||||
});
|
||||
map.addInteraction(select);
|
||||
var feature = new ol.Feature(
|
||||
new ol.geom.Polygon([[[0, 0], [0, 40], [40, 40], [40, 0]]]));
|
||||
var unmanaged = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: [feature]
|
||||
})
|
||||
});
|
||||
unmanaged.setMap(map);
|
||||
map.renderSync();
|
||||
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
|
||||
expect(spy.getCalls().length).to.be(0);
|
||||
unmanaged.setMap(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with multi set to true', function() {
|
||||
|
||||
it('only selects features that pass the filter', function() {
|
||||
|
||||
@@ -46,13 +46,23 @@ describe('ol.renderer.canvas.Map', function() {
|
||||
document.body.removeChild(target);
|
||||
});
|
||||
|
||||
it('always includes unmanaged layers', function() {
|
||||
it('calls callback with layer for managed layers', function() {
|
||||
map.addLayer(layer);
|
||||
map.renderSync();
|
||||
var cb = sinon.spy();
|
||||
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb);
|
||||
expect(cb).to.be.called();
|
||||
expect(cb.firstCall.args[1]).to.be(layer);
|
||||
});
|
||||
|
||||
it('includes unmanaged layers, but calls callback with null', function() {
|
||||
layer.setMap(map);
|
||||
map.renderSync();
|
||||
var cb = sinon.spy();
|
||||
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
|
||||
function() { return false; });
|
||||
expect(cb).to.be.called();
|
||||
expect(cb.firstCall.args[1]).to.be(null);
|
||||
});
|
||||
|
||||
it('filters managed layers', function() {
|
||||
|
||||
@@ -10,7 +10,7 @@ var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' +
|
||||
'ABAAEAAAICRAEAOw==';
|
||||
|
||||
function itNoPhantom() {
|
||||
if (window.initMochaPhantomJS) {
|
||||
if (window.checkForMocha) {
|
||||
return xit.apply(this, arguments);
|
||||
} else {
|
||||
return it.apply(this, arguments);
|
||||
|
||||
@@ -13,6 +13,16 @@ describe('ol.source.TileWMS', function() {
|
||||
};
|
||||
});
|
||||
|
||||
describe('constructor', function() {
|
||||
it('can be constructed without url or urls params', function() {
|
||||
var source = new ol.source.TileWMS({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: ol.tilegrid.createXYZ({maxZoom: 6})
|
||||
});
|
||||
expect(source).to.be.an(ol.source.TileWMS);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getTile', function() {
|
||||
|
||||
it('returns a tile with the expected URL', function() {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -4,16 +4,16 @@ describe('ol.rendering.layer.Image', function() {
|
||||
|
||||
var target, map;
|
||||
|
||||
function createMap(renderer, center, zoom) {
|
||||
function createMap(renderer) {
|
||||
target = createMapDiv(50, 50);
|
||||
|
||||
map = new ol.Map({
|
||||
target: target,
|
||||
renderer: renderer,
|
||||
view: new ol.View({
|
||||
center: center ? center : ol.proj.transform(
|
||||
center: ol.proj.transform(
|
||||
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: zoom ? zoom : 5
|
||||
zoom: 5
|
||||
})
|
||||
});
|
||||
return map;
|
||||
@@ -82,35 +82,6 @@ describe('ol.rendering.layer.Image', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('single image layer with different x and y resolutions', function() {
|
||||
var source;
|
||||
|
||||
beforeEach(function() {
|
||||
source = new ol.source.ImageStatic({
|
||||
url: 'spec/ol/data/dem.jpg',
|
||||
projection: ol.proj.get('EPSG:3857'),
|
||||
alwaysInRange: true,
|
||||
imageSize: [373, 350],
|
||||
imageExtent: [2077922.782144, 5744637.392734, 2082074.999150,
|
||||
5750225.419064]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
disposeMap(map);
|
||||
});
|
||||
|
||||
it('tests the canvas renderer', function(done) {
|
||||
map = createMap('canvas', [2080687.2732495, 5747435.594262], 10);
|
||||
waitForImages([source], {}, function() {
|
||||
expectResemble(map, 'spec/ol/layer/expected/image-canvas-resxy.png',
|
||||
IMAGE_TOLERANCE, done);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('goog.object');
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 838 B |
@@ -30,7 +30,7 @@ describe('ol.rendering.style.Icon', function() {
|
||||
disposeMap(map);
|
||||
});
|
||||
|
||||
function createFeatures(callback, offset) {
|
||||
function createFeatures(callback) {
|
||||
var feature;
|
||||
feature = new ol.Feature({
|
||||
geometry: new ol.geom.Point([0, 0])
|
||||
@@ -44,7 +44,6 @@ describe('ol.rendering.style.Icon', function() {
|
||||
anchorXUnits: 'fraction',
|
||||
anchorYUnits: 'pixels',
|
||||
opacity: 0.75,
|
||||
offset: offset,
|
||||
scale: 0.5,
|
||||
img: img,
|
||||
imgSize: [32, 48]
|
||||
@@ -64,14 +63,6 @@ describe('ol.rendering.style.Icon', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('tests the canvas renderer with an offset', function(done) {
|
||||
map = createMap('canvas');
|
||||
createFeatures(function() {
|
||||
expectResemble(map, 'spec/ol/style/expected/icon-canvas-offset.png',
|
||||
IMAGE_TOLERANCE, done);
|
||||
}, [10, 10]);
|
||||
});
|
||||
|
||||
it('tests the WebGL renderer', function(done) {
|
||||
assertWebGL();
|
||||
map = createMap('webgl');
|
||||
|
||||
Reference in New Issue
Block a user