Compare commits
3 Commits
v3.11.2
...
v3.11.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68b19e90e3 | ||
|
|
8e1e58be68 | ||
|
|
28792a6dbc |
@@ -46,12 +46,6 @@ 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`.
|
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
|
### v3.10.0
|
||||||
|
|
||||||
#### `ol.layer.Layer` changes
|
#### `ol.layer.Layer` changes
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
# 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))
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# 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))
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# 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,
|
Note that the page includes a `script` tag referencing the `app.js` file,
|
||||||
which is the file resulting from the compilation.
|
which is the file resuted from the compilation.
|
||||||
|
|
||||||
You are done!
|
You are done!
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,14 @@ var vector = new ol.layer.Vector({
|
|||||||
source: vectorSource
|
source: vectorSource
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Use the "webgl" renderer by default.
|
||||||
|
var renderer = common.getRendererFromQueryString();
|
||||||
|
if (!renderer) {
|
||||||
|
renderer = 'webgl';
|
||||||
|
}
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
renderer: common.getRendererFromQueryString('webgl'),
|
renderer: renderer,
|
||||||
layers: [vector],
|
layers: [vector],
|
||||||
target: document.getElementById('map'),
|
target: document.getElementById('map'),
|
||||||
view: new ol.View({
|
view: new ol.View({
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
var common = {};
|
var common = {};
|
||||||
|
|
||||||
common.getRendererFromQueryString = function(opt_default) {
|
common.getRendererFromQueryString = function() {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
var queryString = location.search.slice(1);
|
var queryString = location.search.slice(1);
|
||||||
var re = /([^&=]+)=([^&]*)/g;
|
var re = /([^&=]+)=([^&]*)/g;
|
||||||
@@ -98,6 +98,6 @@ common.getRendererFromQueryString = function(opt_default) {
|
|||||||
} else if ('renderer' in obj) {
|
} else if ('renderer' in obj) {
|
||||||
return [obj['renderer']];
|
return [obj['renderer']];
|
||||||
} else {
|
} else {
|
||||||
return opt_default;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,16 +53,16 @@ function createMapboxStreetsV6Style() {
|
|||||||
} else if (layer == 'waterway' &&
|
} else if (layer == 'waterway' &&
|
||||||
cls != 'river' && cls != 'stream' && cls != 'canal') {
|
cls != 'river' && cls != 'stream' && cls != 'canal') {
|
||||||
stroke.setColor('#a0c8f0');
|
stroke.setColor('#a0c8f0');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.3);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'waterway' && cls == 'river') {
|
} else if (layer == 'waterway' && cls == 'river') {
|
||||||
stroke.setColor('#a0c8f0');
|
stroke.setColor('#a0c8f0');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'waterway' && (cls == 'stream' ||
|
} else if (layer == 'waterway' && (cls == 'stream' ||
|
||||||
cls == 'canal')) {
|
cls == 'canal')) {
|
||||||
stroke.setColor('#a0c8f0');
|
stroke.setColor('#a0c8f0');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.3);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'water') {
|
} else if (layer == 'water') {
|
||||||
fill.setColor('#a0c8f0');
|
fill.setColor('#a0c8f0');
|
||||||
@@ -73,7 +73,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
} else if (layer == 'aeroway' && geom == 'LineString' &&
|
} else if (layer == 'aeroway' && geom == 'LineString' &&
|
||||||
resolution <= 76.43702828517625) {
|
resolution <= 76.43702828517625) {
|
||||||
stroke.setColor('#f0ede9');
|
stroke.setColor('#f0ede9');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'building') {
|
} else if (layer == 'building') {
|
||||||
fill.setColor('#f2eae2');
|
fill.setColor('#f2eae2');
|
||||||
@@ -82,90 +82,90 @@ function createMapboxStreetsV6Style() {
|
|||||||
styles[length++] = strokedPolygon;
|
styles[length++] = strokedPolygon;
|
||||||
} else if (layer == 'tunnel' && cls == 'motorway_link') {
|
} else if (layer == 'tunnel' && cls == 'motorway_link') {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' && cls == 'service') {
|
} else if (layer == 'tunnel' && cls == 'service') {
|
||||||
stroke.setColor('#cfcdca');
|
stroke.setColor('#cfcdca');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' &&
|
} else if (layer == 'tunnel' &&
|
||||||
(cls == 'street' || cls == 'street_limited')) {
|
(cls == 'street' || cls == 'street_limited')) {
|
||||||
stroke.setColor('#cfcdca');
|
stroke.setColor('#cfcdca');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' && cls == 'main' &&
|
} else if (layer == 'tunnel' && cls == 'main' &&
|
||||||
resolution <= 1222.99245256282) {
|
resolution <= 1222.99245256282) {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' && cls == 'motorway') {
|
} else if (layer == 'tunnel' && cls == 'motorway') {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' && cls == 'path') {
|
} else if (layer == 'tunnel' && cls == 'path') {
|
||||||
stroke.setColor('#cba');
|
stroke.setColor('#cba');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'tunnel' && cls == 'major_rail') {
|
} else if (layer == 'tunnel' && cls == 'major_rail') {
|
||||||
stroke.setColor('#bbb');
|
stroke.setColor('#bbb');
|
||||||
stroke.setWidth(2);
|
stroke.setWidth(1.4);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && cls == 'motorway_link') {
|
} else if (layer == 'road' && cls == 'motorway_link') {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && (cls == 'street' ||
|
} else if (layer == 'road' && (cls == 'street' ||
|
||||||
cls == 'street_limited') && geom == 'LineString') {
|
cls == 'street_limited') && geom == 'LineString') {
|
||||||
stroke.setColor('#cfcdca');
|
stroke.setColor('#cfcdca');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && cls == 'main' &&
|
} else if (layer == 'road' && cls == 'main' &&
|
||||||
resolution <= 1222.99245256282) {
|
resolution <= 1222.99245256282) {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && cls == 'motorway' &&
|
} else if (layer == 'road' && cls == 'motorway' &&
|
||||||
resolution <= 4891.96981025128) {
|
resolution <= 4891.96981025128) {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && cls == 'path') {
|
} else if (layer == 'road' && cls == 'path') {
|
||||||
stroke.setColor('#cba');
|
stroke.setColor('#cba');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'road' && cls == 'major_rail') {
|
} else if (layer == 'road' && cls == 'major_rail') {
|
||||||
stroke.setColor('#bbb');
|
stroke.setColor('#bbb');
|
||||||
stroke.setWidth(2);
|
stroke.setWidth(1.4);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'motorway_link') {
|
} else if (layer == 'bridge' && cls == 'motorway_link') {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'motorway') {
|
} else if (layer == 'bridge' && cls == 'motorway') {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'service') {
|
} else if (layer == 'bridge' && cls == 'service') {
|
||||||
stroke.setColor('#cfcdca');
|
stroke.setColor('#cfcdca');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' &&
|
} else if (layer == 'bridge' &&
|
||||||
(cls == 'street' || cls == 'street_limited')) {
|
(cls == 'street' || cls == 'street_limited')) {
|
||||||
stroke.setColor('#cfcdca');
|
stroke.setColor('#cfcdca');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'main' &&
|
} else if (layer == 'bridge' && cls == 'main' &&
|
||||||
resolution <= 1222.99245256282) {
|
resolution <= 1222.99245256282) {
|
||||||
stroke.setColor('#e9ac77');
|
stroke.setColor('#e9ac77');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'path') {
|
} else if (layer == 'bridge' && cls == 'path') {
|
||||||
stroke.setColor('#cba');
|
stroke.setColor('#cba');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'bridge' && cls == 'major_rail') {
|
} else if (layer == 'bridge' && cls == 'major_rail') {
|
||||||
stroke.setColor('#bbb');
|
stroke.setColor('#bbb');
|
||||||
stroke.setWidth(2);
|
stroke.setWidth(1.4);
|
||||||
styles[length++] = line;
|
styles[length++] = line;
|
||||||
} else if (layer == 'admin' && adminLevel >= 3 && maritime === 0) {
|
} else if (layer == 'admin' && adminLevel >= 3 && maritime === 0) {
|
||||||
stroke.setColor('#9e9cab');
|
stroke.setColor('#9e9cab');
|
||||||
@@ -227,7 +227,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
'italic 11px "Open Sans", "Arial Unicode MS"');
|
'italic 11px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#74aee9');
|
fill.setColor('#74aee9');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(0.75);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'marine_label' && labelrank === 2 &&
|
} else if (layer == 'marine_label' && labelrank === 2 &&
|
||||||
geom == 'Point') {
|
geom == 'Point') {
|
||||||
@@ -236,7 +236,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
'italic 11px "Open Sans", "Arial Unicode MS"');
|
'italic 11px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#74aee9');
|
fill.setColor('#74aee9');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(0.75);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'marine_label' && labelrank === 3 &&
|
} else if (layer == 'marine_label' && labelrank === 3 &&
|
||||||
geom == 'Point') {
|
geom == 'Point') {
|
||||||
@@ -245,7 +245,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
'italic 10px "Open Sans", "Arial Unicode MS"');
|
'italic 10px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#74aee9');
|
fill.setColor('#74aee9');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(0.75);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'marine_label' && labelrank === 4 &&
|
} else if (layer == 'marine_label' && labelrank === 4 &&
|
||||||
geom == 'Point') {
|
geom == 'Point') {
|
||||||
@@ -254,7 +254,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
'italic 9px "Open Sans", "Arial Unicode MS"');
|
'italic 9px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#74aee9');
|
fill.setColor('#74aee9');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(0.75);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'place_label' && type == 'city' &&
|
} else if (layer == 'place_label' && type == 'city' &&
|
||||||
resolution <= 1222.99245256282) {
|
resolution <= 1222.99245256282) {
|
||||||
@@ -262,7 +262,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
text.getText().setFont('11px "Open Sans", "Arial Unicode MS"');
|
text.getText().setFont('11px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#333');
|
fill.setColor('#333');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'place_label' && type == 'town' &&
|
} else if (layer == 'place_label' && type == 'town' &&
|
||||||
resolution <= 305.748113140705) {
|
resolution <= 305.748113140705) {
|
||||||
@@ -270,7 +270,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
text.getText().setFont('9px "Open Sans", "Arial Unicode MS"');
|
text.getText().setFont('9px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#333');
|
fill.setColor('#333');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'place_label' && type == 'village' &&
|
} else if (layer == 'place_label' && type == 'village' &&
|
||||||
resolution <= 38.21851414258813) {
|
resolution <= 38.21851414258813) {
|
||||||
@@ -278,7 +278,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
text.getText().setFont('8px "Open Sans", "Arial Unicode MS"');
|
text.getText().setFont('8px "Open Sans", "Arial Unicode MS"');
|
||||||
fill.setColor('#333');
|
fill.setColor('#333');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'place_label' &&
|
} else if (layer == 'place_label' &&
|
||||||
resolution <= 19.109257071294063 && (type == 'hamlet' ||
|
resolution <= 19.109257071294063 && (type == 'hamlet' ||
|
||||||
@@ -287,7 +287,7 @@ function createMapboxStreetsV6Style() {
|
|||||||
text.getText().setFont('bold 9px "Arial Narrow"');
|
text.getText().setFont('bold 9px "Arial Narrow"');
|
||||||
fill.setColor('#633');
|
fill.setColor('#633');
|
||||||
stroke.setColor('rgba(255,255,255,0.8)');
|
stroke.setColor('rgba(255,255,255,0.8)');
|
||||||
stroke.setWidth(1);
|
stroke.setWidth(1.2);
|
||||||
styles[length++] = text;
|
styles[length++] = text;
|
||||||
} else if (layer == 'poi_label' && resolution <= 19.109257071294063 &&
|
} else if (layer == 'poi_label' && resolution <= 19.109257071294063 &&
|
||||||
scalerank == 1 && maki !== 'marker') {
|
scalerank == 1 && maki !== 'marker') {
|
||||||
|
|||||||
@@ -106,8 +106,14 @@ var vector = new ol.layer.Vector({
|
|||||||
source: vectorSource
|
source: vectorSource
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Use the "webgl" renderer by default.
|
||||||
|
var renderer = common.getRendererFromQueryString();
|
||||||
|
if (!renderer) {
|
||||||
|
renderer = 'webgl';
|
||||||
|
}
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
renderer: common.getRendererFromQueryString('webgl'),
|
renderer: renderer,
|
||||||
layers: [vector],
|
layers: [vector],
|
||||||
target: document.getElementById('map'),
|
target: document.getElementById('map'),
|
||||||
view: new ol.View({
|
view: new ol.View({
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ var common;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string=} opt_default Default renderer.
|
|
||||||
* @return {string} Renderer type.
|
* @return {string} Renderer type.
|
||||||
*/
|
*/
|
||||||
common.getRendererFromQueryString = function(opt_default) {};
|
common.getRendererFromQueryString = function() {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1796,8 +1796,7 @@ olx.format.IGCOptions.prototype.altitudeMode;
|
|||||||
/**
|
/**
|
||||||
* @typedef {{extractStyles: (boolean|undefined),
|
* @typedef {{extractStyles: (boolean|undefined),
|
||||||
* defaultStyle: (Array.<ol.style.Style>|undefined),
|
* defaultStyle: (Array.<ol.style.Style>|undefined),
|
||||||
* showPointNames: (boolean|undefined),
|
* showPointNames: (boolean|undefined)}}
|
||||||
* writeStyles: (boolean|undefined)}}
|
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.format.KMLOptions;
|
olx.format.KMLOptions;
|
||||||
@@ -1827,14 +1826,6 @@ olx.format.KMLOptions.prototype.showPointNames;
|
|||||||
olx.format.KMLOptions.prototype.defaultStyle;
|
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),
|
* @typedef {{featureNS: (Object.<string, string>|string|undefined),
|
||||||
* featureType: (Array.<string>|string|undefined),
|
* featureType: (Array.<string>|string|undefined),
|
||||||
@@ -4793,7 +4784,7 @@ olx.source.ImageWMSOptions.prototype.serverType;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional function to load an image given a URL.
|
* Optional function to load an image given a URL.
|
||||||
* @type {ol.ImageLoadFunctionType|undefined}
|
* @type {ol.TileLoadFunctionType|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.source.ImageWMSOptions.prototype.imageLoadFunction;
|
olx.source.ImageWMSOptions.prototype.imageLoadFunction;
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "openlayers",
|
"name": "openlayers",
|
||||||
"version": "3.11.2",
|
"version": "3.11.0-beta.2",
|
||||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"map",
|
"map",
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
"async": "1.5.0",
|
"async": "1.5.0",
|
||||||
"bluebird": "^3.0.5",
|
"bluebird": "^3.0.5",
|
||||||
"browserify": "12.0.1",
|
"browserify": "12.0.1",
|
||||||
"closure-util": "1.9.0",
|
"closure-util": "1.8.0",
|
||||||
"derequire": "2.0.3",
|
"derequire": "2.0.3",
|
||||||
"fs-extra": "0.26.2",
|
"fs-extra": "0.26.0",
|
||||||
"glob": "5.0.15",
|
"glob": "5.0.15",
|
||||||
"graceful-fs": "4.1.2",
|
"graceful-fs": "4.1.2",
|
||||||
"handlebars": "4.0.4",
|
"handlebars": "4.0.4",
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
"walk": "2.3.9"
|
"walk": "2.3.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"clean-css": "3.4.7",
|
"clean-css": "3.4.6",
|
||||||
"coveralls": "2.11.4",
|
"coveralls": "2.11.4",
|
||||||
"debounce": "^1.0.0",
|
"debounce": "^1.0.0",
|
||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
@@ -60,11 +60,11 @@
|
|||||||
"jquery": "2.1.4",
|
"jquery": "2.1.4",
|
||||||
"jshint": "2.8.0",
|
"jshint": "2.8.0",
|
||||||
"mocha": "2.3.3",
|
"mocha": "2.3.3",
|
||||||
"mocha-phantomjs-core": "^1.3.0",
|
"mocha-phantomjs-core": "^1.2.1",
|
||||||
"mustache": "2.2.0",
|
"mustache": "2.2.0",
|
||||||
"phantomjs": "1.9.18",
|
"phantomjs": "1.9.18",
|
||||||
"proj4": "2.3.12",
|
"proj4": "2.3.12",
|
||||||
"resemblejs": "2.0.1",
|
"resemblejs": "1.3.1",
|
||||||
"sinon": "1.17.2",
|
"sinon": "1.17.2",
|
||||||
"slimerjs-edge": "0.10.0-pre-3",
|
"slimerjs-edge": "0.10.0-pre-3",
|
||||||
"wrench": "1.5.8"
|
"wrench": "1.5.8"
|
||||||
|
|||||||
@@ -839,13 +839,11 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
|||||||
'value should be an ol.Feature');
|
'value should be an ol.Feature');
|
||||||
var geometry = value.getGeometry();
|
var geometry = value.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
if (nodeName) {
|
goog.asserts.assert(ol.xml.isNode(parentNode),
|
||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
'parentNode should be an XML node');
|
||||||
goog.asserts.assert(ol.xml.isNode(parentNode),
|
return ol.xml.createElementNS(parentNode.namespaceURI,
|
||||||
'parentNode should be an XML node');
|
ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]);
|
||||||
return ol.xml.createElementNS(parentNode.namespaceURI, nodeName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -92,13 +92,6 @@ ol.format.KML = function(opt_options) {
|
|||||||
this.extractStyles_ = options.extractStyles !== undefined ?
|
this.extractStyles_ = options.extractStyles !== undefined ?
|
||||||
options.extractStyles : true;
|
options.extractStyles : true;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.writeStyles_ = options.writeStyles !== undefined ?
|
|
||||||
options.writeStyles : true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Object.<string, (Array.<ol.style.Style>|string)>}
|
* @type {Object.<string, (Array.<ol.style.Style>|string)>}
|
||||||
@@ -349,7 +342,11 @@ ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
var nameStyle = new ol.style.Style({
|
var nameStyle = new ol.style.Style({
|
||||||
text: textStyle
|
fill: undefined,
|
||||||
|
image: undefined,
|
||||||
|
text: textStyle,
|
||||||
|
stroke: undefined,
|
||||||
|
zIndex: undefined
|
||||||
});
|
});
|
||||||
return nameStyle;
|
return nameStyle;
|
||||||
};
|
};
|
||||||
@@ -397,7 +394,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
|||||||
if (drawName) {
|
if (drawName) {
|
||||||
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
|
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
|
||||||
name);
|
name);
|
||||||
return style.concat(nameStyle);
|
return [style, nameStyle];
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
@@ -654,9 +651,6 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
(object['scale']);
|
(object['scale']);
|
||||||
if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
|
if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
|
||||||
size = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_;
|
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({
|
var imageStyle = new ol.style.Icon({
|
||||||
@@ -668,7 +662,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
offset: offset,
|
offset: offset,
|
||||||
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
scale: scale,
|
scale: ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ * scale,
|
||||||
size: size,
|
size: size,
|
||||||
src: src
|
src: src
|
||||||
});
|
});
|
||||||
@@ -2179,7 +2173,6 @@ ol.format.KML.writeCoordinatesTextNode_ =
|
|||||||
* @param {Node} node Node.
|
* @param {Node} node Node.
|
||||||
* @param {Array.<ol.Feature>} features Features.
|
* @param {Array.<ol.Feature>} features Features.
|
||||||
* @param {Array.<*>} objectStack Object stack.
|
* @param {Array.<*>} objectStack Object stack.
|
||||||
* @this {ol.format.KML}
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.KML.writeDocument_ = function(node, features, objectStack) {
|
ol.format.KML.writeDocument_ = function(node, features, objectStack) {
|
||||||
@@ -2377,7 +2370,6 @@ ol.format.KML.writeBoundaryIs_ = function(node, linearRing, objectStack) {
|
|||||||
* @param {Node} node Node.
|
* @param {Node} node Node.
|
||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @param {Array.<*>} objectStack Object stack.
|
* @param {Array.<*>} objectStack Object stack.
|
||||||
* @this {ol.format.KML}
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||||
@@ -2390,18 +2382,14 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
|||||||
|
|
||||||
// serialize properties (properties unknown to KML are not serialized)
|
// serialize properties (properties unknown to KML are not serialized)
|
||||||
var properties = feature.getProperties();
|
var properties = feature.getProperties();
|
||||||
|
|
||||||
var styleFunction = feature.getStyleFunction();
|
var styleFunction = feature.getStyleFunction();
|
||||||
if (styleFunction) {
|
if (styleFunction) {
|
||||||
// FIXME the styles returned by the style function are supposed to be
|
// FIXME the styles returned by the style function are supposed to be
|
||||||
// resolution-independent here
|
// resolution-independent here
|
||||||
var styles = styleFunction.call(feature, 0);
|
var styles = styleFunction.call(feature, 0);
|
||||||
if (styles && styles.length > 0) {
|
if (styles && styles.length > 0) {
|
||||||
var style = styles[0];
|
properties['Style'] = styles[0];
|
||||||
if (this.writeStyles_) {
|
var textStyle = styles[0].getText();
|
||||||
properties['Style'] = styles[0];
|
|
||||||
}
|
|
||||||
var textStyle = style.getText();
|
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
properties['name'] = textStyle.getText();
|
properties['name'] = textStyle.getText();
|
||||||
}
|
}
|
||||||
@@ -2512,7 +2500,7 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) {
|
|||||||
var strokeStyle = style.getStroke();
|
var strokeStyle = style.getStroke();
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
var textStyle = style.getText();
|
var textStyle = style.getText();
|
||||||
if (imageStyle instanceof ol.style.Icon) {
|
if (imageStyle) {
|
||||||
properties['IconStyle'] = imageStyle;
|
properties['IconStyle'] = imageStyle;
|
||||||
}
|
}
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
@@ -3004,7 +2992,6 @@ ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) {
|
|||||||
var orderedKeys = ol.format.KML.KML_SEQUENCE_[kml.namespaceURI];
|
var orderedKeys = ol.format.KML.KML_SEQUENCE_[kml.namespaceURI];
|
||||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.KML_SERIALIZERS_,
|
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;
|
return kml;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ goog.require('ol.extent');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.ImageBase}
|
* @extends {ol.ImageBase}
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {number|undefined} resolution Resolution.
|
* @param {Array.<number>|undefined} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||||
* @param {string} src Image source URI.
|
* @param {string} src Image source URI.
|
||||||
@@ -38,7 +38,7 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
|||||||
* @type {Image}
|
* @type {Image}
|
||||||
*/
|
*/
|
||||||
this.image_ = new Image();
|
this.image_ = new Image();
|
||||||
if (crossOrigin !== null) {
|
if (crossOrigin) {
|
||||||
this.image_.crossOrigin = crossOrigin;
|
this.image_.crossOrigin = crossOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,10 @@ ol.Image.prototype.handleImageError_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Image.prototype.handleImageLoad_ = function() {
|
ol.Image.prototype.handleImageLoad_ = function() {
|
||||||
if (this.resolution === undefined) {
|
if (this.resolution === undefined) {
|
||||||
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
this.resolution = [
|
||||||
|
ol.extent.getWidth(this.extent) / this.image_.width,
|
||||||
|
ol.extent.getHeight(this.extent) / this.image_.height
|
||||||
|
];
|
||||||
}
|
}
|
||||||
this.state = ol.ImageState.LOADED;
|
this.state = ol.ImageState.LOADED;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ ol.ImageState = {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {goog.events.EventTarget}
|
* @extends {goog.events.EventTarget}
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {number|undefined} resolution Resolution.
|
* @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} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {ol.ImageState} state State.
|
* @param {ol.ImageState} state State.
|
||||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||||
@@ -53,7 +55,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {number|undefined}
|
* @type {Array.<number>|undefined}
|
||||||
*/
|
*/
|
||||||
this.resolution = resolution;
|
this.resolution = resolution;
|
||||||
|
|
||||||
@@ -107,7 +109,7 @@ ol.ImageBase.prototype.getPixelRatio = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number} Resolution.
|
* @return {Array.<number>} Resolution.
|
||||||
*/
|
*/
|
||||||
ol.ImageBase.prototype.getResolution = function() {
|
ol.ImageBase.prototype.getResolution = function() {
|
||||||
goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set');
|
goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set');
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
|||||||
var state = opt_loader !== undefined ?
|
var state = opt_loader !== undefined ?
|
||||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||||
|
|
||||||
goog.base(this, extent, resolution, pixelRatio, state, attributions);
|
goog.base(this, extent, [resolution, resolution], pixelRatio, state,
|
||||||
|
attributions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
|||||||
* @type {Image}
|
* @type {Image}
|
||||||
*/
|
*/
|
||||||
this.image_ = new Image();
|
this.image_ = new Image();
|
||||||
if (crossOrigin !== null) {
|
if (crossOrigin) {
|
||||||
this.image_.crossOrigin = crossOrigin;
|
this.image_.crossOrigin = crossOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ goog.inherits(ol.interaction.SelectEvent, goog.events.Event);
|
|||||||
* `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
|
* `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
|
||||||
* further feature filter using the `filter` option.
|
* further feature filter using the `filter` option.
|
||||||
*
|
*
|
||||||
* Selected features are added to an internal unmanaged layer.
|
|
||||||
*
|
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {olx.interaction.SelectOptions=} opt_options Options.
|
* @param {olx.interaction.SelectOptions=} opt_options Options.
|
||||||
@@ -237,9 +235,7 @@ ol.interaction.Select.prototype.getFeatures = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the associated {@link ol.layer.Vector vectorlayer} of
|
* Returns the associated {@link ol.layer.Vector vectorlayer} of
|
||||||
* the (last) selected feature. Note that this will not work with any
|
* the (last) selected feature.
|
||||||
* programmatic method like pushing features to
|
|
||||||
* {@link ol.interaction.Select#getFeatures collection}.
|
|
||||||
* @param {ol.Feature|ol.render.Feature} feature Feature
|
* @param {ol.Feature|ol.render.Feature} feature Feature
|
||||||
* @return {ol.layer.Vector} Layer.
|
* @return {ol.layer.Vector} Layer.
|
||||||
* @api
|
* @api
|
||||||
@@ -283,7 +279,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
|
|||||||
* @param {ol.layer.Layer} layer Layer.
|
* @param {ol.layer.Layer} layer Layer.
|
||||||
*/
|
*/
|
||||||
function(feature, layer) {
|
function(feature, layer) {
|
||||||
if (!layer || this.filter_(feature, layer)) {
|
if (this.filter_(feature, layer)) {
|
||||||
selected.push(feature);
|
selected.push(feature);
|
||||||
this.addFeatureLayerAssociation_(feature, layer);
|
this.addFeatureLayerAssociation_(feature, layer);
|
||||||
return !this.multi_;
|
return !this.multi_;
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ goog.require('ol.source.State');
|
|||||||
* Layers group together those properties that pertain to how the data is to be
|
* Layers group together those properties that pertain to how the data is to be
|
||||||
* displayed, irrespective of the source of that data.
|
* 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.
|
* A generic `change` event is fired when the state of the source changes.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|||||||
@@ -599,9 +599,8 @@ ol.Map.prototype.disposeInternal = function() {
|
|||||||
* called with two arguments. The first argument is one
|
* called with two arguments. The first argument is one
|
||||||
* {@link ol.Feature feature} or
|
* {@link ol.Feature feature} or
|
||||||
* {@link ol.render.Feature render feature} at the pixel, the second is
|
* {@link ol.render.Feature render feature} at the pixel, the second is
|
||||||
* the {@link ol.layer.Layer layer} of the feature and will be null for
|
* the {@link ol.layer.Layer layer} of the feature. To stop detection,
|
||||||
* unmanaged layers. To stop detection, callback functions can return a
|
* callback functions can return a truthy value.
|
||||||
* truthy value.
|
|
||||||
* @param {S=} opt_this Value to use as `this` when executing `callback`.
|
* @param {S=} opt_this Value to use as `this` when executing `callback`.
|
||||||
* @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer
|
* @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer
|
||||||
* filter function. The filter function will receive one argument, the
|
* filter function. The filter function will receive one argument, the
|
||||||
|
|||||||
@@ -197,17 +197,12 @@ ol.Object.prototype.notify = function(key, oldValue) {
|
|||||||
* Sets a value.
|
* Sets a value.
|
||||||
* @param {string} key Key name.
|
* @param {string} key Key name.
|
||||||
* @param {*} value Value.
|
* @param {*} value Value.
|
||||||
* @param {boolean=} opt_silent Update without triggering an event.
|
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Object.prototype.set = function(key, value, opt_silent) {
|
ol.Object.prototype.set = function(key, value) {
|
||||||
if (opt_silent) {
|
var oldValue = this.values_[key];
|
||||||
this.values_[key] = value;
|
this.values_[key] = value;
|
||||||
} else {
|
this.notify(key, oldValue);
|
||||||
var oldValue = this.values_[key];
|
|
||||||
this.values_[key] = value;
|
|
||||||
this.notify(key, oldValue);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -215,13 +210,12 @@ ol.Object.prototype.set = function(key, value, opt_silent) {
|
|||||||
* Sets a collection of key-value pairs. Note that this changes any existing
|
* 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).
|
* properties and adds new ones (it does not remove any existing properties).
|
||||||
* @param {Object.<string, *>} values Values.
|
* @param {Object.<string, *>} values Values.
|
||||||
* @param {boolean=} opt_silent Update without triggering an event.
|
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Object.prototype.setProperties = function(values, opt_silent) {
|
ol.Object.prototype.setProperties = function(values) {
|
||||||
var key;
|
var key;
|
||||||
for (key in values) {
|
for (key in values) {
|
||||||
this.set(key, values[key], opt_silent);
|
this.set(key, values[key]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -229,15 +223,12 @@ ol.Object.prototype.setProperties = function(values, opt_silent) {
|
|||||||
/**
|
/**
|
||||||
* Unsets a property.
|
* Unsets a property.
|
||||||
* @param {string} key Key name.
|
* @param {string} key Key name.
|
||||||
* @param {boolean=} opt_silent Unset without triggering an event.
|
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Object.prototype.unset = function(key, opt_silent) {
|
ol.Object.prototype.unset = function(key) {
|
||||||
if (key in this.values_) {
|
if (key in this.values_) {
|
||||||
var oldValue = this.values_[key];
|
var oldValue = this.values_[key];
|
||||||
delete this.values_[key];
|
delete this.values_[key];
|
||||||
if (!opt_silent) {
|
this.notify(key, oldValue);
|
||||||
this.notify(key, oldValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -246,7 +246,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||||
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
||||||
}
|
}
|
||||||
var skipFeatures = !goog.object.isEmpty(skippedFeaturesHash);
|
|
||||||
var i = 0; // instruction index
|
var i = 0; // instruction index
|
||||||
var ii = instructions.length; // end of instructions
|
var ii = instructions.length; // end of instructions
|
||||||
var d = 0; // data index
|
var d = 0; // data index
|
||||||
@@ -260,8 +259,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case ol.render.canvas.Instruction.BEGIN_GEOMETRY:
|
case ol.render.canvas.Instruction.BEGIN_GEOMETRY:
|
||||||
feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]);
|
feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]);
|
||||||
if ((skipFeatures &&
|
var featureUid = goog.getUid(feature).toString();
|
||||||
skippedFeaturesHash[goog.getUid(feature).toString()]) ||
|
if (skippedFeaturesHash[featureUid] !== undefined ||
|
||||||
!feature.getGeometry()) {
|
!feature.getGeometry()) {
|
||||||
i = /** @type {number} */ (instruction[2]);
|
i = /** @type {number} */ (instruction[2]);
|
||||||
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
||||||
@@ -344,8 +343,10 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
context.globalAlpha = alpha * opacity;
|
context.globalAlpha = alpha * opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.drawImage(image, originX, originY, width, height,
|
var w = width - originX;
|
||||||
x, y, width * pixelRatio, height * pixelRatio);
|
var h = height - originY;
|
||||||
|
context.drawImage(image, originX, originY, w, h, x, y,
|
||||||
|
w * pixelRatio, h * pixelRatio);
|
||||||
|
|
||||||
if (opacity != 1) {
|
if (opacity != 1) {
|
||||||
context.globalAlpha = alpha;
|
context.globalAlpha = alpha;
|
||||||
|
|||||||
@@ -193,15 +193,19 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
|||||||
var imageExtent = image.getExtent();
|
var imageExtent = image.getExtent();
|
||||||
var imageResolution = image.getResolution();
|
var imageResolution = image.getResolution();
|
||||||
var imagePixelRatio = image.getPixelRatio();
|
var imagePixelRatio = image.getPixelRatio();
|
||||||
var scale = pixelRatio * imageResolution /
|
var xImageResolution = imageResolution[0];
|
||||||
|
var yImageResolution = imageResolution[1];
|
||||||
|
var xScale = pixelRatio * xImageResolution /
|
||||||
|
(viewResolution * imagePixelRatio);
|
||||||
|
var yScale = pixelRatio * yImageResolution /
|
||||||
(viewResolution * imagePixelRatio);
|
(viewResolution * imagePixelRatio);
|
||||||
ol.vec.Mat4.makeTransform2D(this.imageTransform_,
|
ol.vec.Mat4.makeTransform2D(this.imageTransform_,
|
||||||
pixelRatio * frameState.size[0] / 2,
|
pixelRatio * frameState.size[0] / 2,
|
||||||
pixelRatio * frameState.size[1] / 2,
|
pixelRatio * frameState.size[1] / 2,
|
||||||
scale, scale,
|
xScale, yScale,
|
||||||
viewRotation,
|
viewRotation,
|
||||||
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution,
|
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / xImageResolution,
|
||||||
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution);
|
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / yImageResolution);
|
||||||
this.imageTransformInv_ = null;
|
this.imageTransformInv_ = null;
|
||||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||||
this.updateLogos(frameState, imageSource);
|
this.updateLogos(frameState, imageSource);
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate =
|
|||||||
if (layer.getSource()) {
|
if (layer.getSource()) {
|
||||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||||
layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
|
layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
|
||||||
frameState,
|
frameState, callback, thisArg);
|
||||||
layerState.managed ? callback : forEachFeatureAtCoordinate,
|
|
||||||
thisArg);
|
|
||||||
}
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -116,8 +116,9 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
|||||||
attributions = this.sourceImage_.getAttributions();
|
attributions = this.sourceImage_.getAttributions();
|
||||||
}
|
}
|
||||||
|
|
||||||
goog.base(this, targetExtent, targetResolution, this.sourcePixelRatio_,
|
goog.base(this, targetExtent, [targetResolution, targetResolution],
|
||||||
state, attributions);
|
this.sourcePixelRatio_, state, attributions);
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.reproj.Image, ol.ImageBase);
|
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} width Width of the canvas.
|
||||||
* @param {number} height Height of the canvas.
|
* @param {number} height Height of the canvas.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {number} sourceResolution Source resolution.
|
* @param {Array.<number>} sourceResolution Source resolution.
|
||||||
* @param {ol.Extent} sourceExtent Extent of the data source.
|
* @param {ol.Extent} sourceExtent Extent of the data source.
|
||||||
* @param {number} targetResolution Target resolution.
|
* @param {number} targetResolution Target resolution.
|
||||||
* @param {ol.Extent} targetExtent Target extent.
|
* @param {ol.Extent} targetExtent Target extent.
|
||||||
@@ -124,12 +124,14 @@ ol.reproj.render = function(width, height, pixelRatio,
|
|||||||
|
|
||||||
var canvasWidthInUnits = ol.extent.getWidth(sourceDataExtent);
|
var canvasWidthInUnits = ol.extent.getWidth(sourceDataExtent);
|
||||||
var canvasHeightInUnits = ol.extent.getHeight(sourceDataExtent);
|
var canvasHeightInUnits = ol.extent.getHeight(sourceDataExtent);
|
||||||
|
var sourceResolutionX = sourceResolution[0];
|
||||||
|
var sourceResolutionY = sourceResolution[1];
|
||||||
var stitchContext = ol.dom.createCanvasContext2D(
|
var stitchContext = ol.dom.createCanvasContext2D(
|
||||||
Math.round(pixelRatio * canvasWidthInUnits / sourceResolution),
|
Math.round(pixelRatio * canvasWidthInUnits / sourceResolutionX),
|
||||||
Math.round(pixelRatio * canvasHeightInUnits / sourceResolution));
|
Math.round(pixelRatio * canvasHeightInUnits / sourceResolutionY));
|
||||||
|
|
||||||
stitchContext.scale(pixelRatio / sourceResolution,
|
stitchContext.scale(pixelRatio / sourceResolutionX,
|
||||||
pixelRatio / sourceResolution);
|
pixelRatio / sourceResolutionY);
|
||||||
stitchContext.translate(-sourceDataExtent[0], sourceDataExtent[3]);
|
stitchContext.translate(-sourceDataExtent[0], sourceDataExtent[3]);
|
||||||
|
|
||||||
sources.forEach(function(src, i, arr) {
|
sources.forEach(function(src, i, arr) {
|
||||||
@@ -222,8 +224,8 @@ ol.reproj.render = function(width, height, pixelRatio,
|
|||||||
context.translate(sourceDataExtent[0] - sourceNumericalShiftX,
|
context.translate(sourceDataExtent[0] - sourceNumericalShiftX,
|
||||||
sourceDataExtent[3] - sourceNumericalShiftY);
|
sourceDataExtent[3] - sourceNumericalShiftY);
|
||||||
|
|
||||||
context.scale(sourceResolution / pixelRatio,
|
context.scale(sourceResolutionX / pixelRatio,
|
||||||
-sourceResolution / pixelRatio);
|
-sourceResolutionY / pixelRatio);
|
||||||
|
|
||||||
context.drawImage(stitchContext.canvas, 0, 0);
|
context.drawImage(stitchContext.canvas, 0, 0);
|
||||||
context.restore();
|
context.restore();
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
|||||||
|
|
||||||
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
||||||
this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_,
|
this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_,
|
||||||
sourceResolution, this.sourceTileGrid_.getExtent(),
|
[sourceResolution, sourceResolution], this.sourceTileGrid_.getExtent(),
|
||||||
targetResolution, targetExtent, this.triangulation_, sources,
|
targetResolution, targetExtent, this.triangulation_, sources,
|
||||||
this.renderEdges_);
|
this.renderEdges_);
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ ol.source.ImageMapGuide.prototype.getImageInternal =
|
|||||||
|
|
||||||
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
||||||
if (imageUrl !== undefined) {
|
if (imageUrl !== undefined) {
|
||||||
image = new ol.Image(extent, resolution, pixelRatio,
|
image = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||||
this.getAttributions(), imageUrl, this.crossOrigin_,
|
this.getAttributions(), imageUrl, this.crossOrigin_,
|
||||||
this.imageLoadFunction_);
|
this.imageLoadFunction_);
|
||||||
goog.events.listen(image, goog.events.EventType.CHANGE,
|
goog.events.listen(image, goog.events.EventType.CHANGE,
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ ol.source.ImageStatic = function(options) {
|
|||||||
|
|
||||||
var imageExtent = options.imageExtent;
|
var imageExtent = options.imageExtent;
|
||||||
|
|
||||||
var resolution, resolutions;
|
var xResolution, yResolution, resolutions, imgResolution;
|
||||||
if (options.imageSize !== undefined) {
|
if (options.imageSize !== undefined) {
|
||||||
resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
xResolution = ol.extent.getWidth(imageExtent) / options.imageSize[0];
|
||||||
resolutions = [resolution];
|
yResolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
||||||
|
imgResolution = [xResolution, yResolution];
|
||||||
|
resolutions = [yResolution];
|
||||||
}
|
}
|
||||||
|
|
||||||
var crossOrigin = options.crossOrigin !== undefined ?
|
var crossOrigin = options.crossOrigin !== undefined ?
|
||||||
@@ -50,8 +52,8 @@ ol.source.ImageStatic = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Image}
|
* @type {ol.Image}
|
||||||
*/
|
*/
|
||||||
this.image_ = new ol.Image(imageExtent, resolution, 1, attributions,
|
this.image_ = new ol.Image(imageExtent, imgResolution, 1,
|
||||||
options.url, crossOrigin, imageLoadFunction);
|
attributions, options.url, crossOrigin, imageLoadFunction);
|
||||||
goog.events.listen(this.image_, goog.events.EventType.CHANGE,
|
goog.events.listen(this.image_, goog.events.EventType.CHANGE,
|
||||||
this.handleImageChange, false, this);
|
this.handleImageChange, false, this);
|
||||||
|
|
||||||
|
|||||||
@@ -203,13 +203,21 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
|||||||
var centerY = (extent[1] + extent[3]) / 2;
|
var centerY = (extent[1] + extent[3]) / 2;
|
||||||
|
|
||||||
var imageResolution = resolution / pixelRatio;
|
var imageResolution = resolution / pixelRatio;
|
||||||
var imageWidth = ol.extent.getWidth(extent) / imageResolution;
|
|
||||||
var imageHeight = ol.extent.getHeight(extent) / imageResolution;
|
// 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 image = this.image_;
|
var image = this.image_;
|
||||||
if (image &&
|
if (image &&
|
||||||
this.renderedRevision_ == this.getRevision() &&
|
this.renderedRevision_ == this.getRevision() &&
|
||||||
image.getResolution() == resolution &&
|
image.getResolution()[0] == resolution &&
|
||||||
image.getPixelRatio() == pixelRatio &&
|
image.getPixelRatio() == pixelRatio &&
|
||||||
ol.extent.containsExtent(image.getExtent(), extent)) {
|
ol.extent.containsExtent(image.getExtent(), extent)) {
|
||||||
return image;
|
return image;
|
||||||
@@ -233,13 +241,13 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
|||||||
};
|
};
|
||||||
goog.object.extend(params, this.params_);
|
goog.object.extend(params, this.params_);
|
||||||
|
|
||||||
this.imageSize_[0] = Math.ceil(imageWidth * this.ratio_);
|
this.imageSize_[0] = width;
|
||||||
this.imageSize_[1] = Math.ceil(imageHeight * this.ratio_);
|
this.imageSize_[1] = height;
|
||||||
|
|
||||||
var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio,
|
var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio,
|
||||||
projection, params);
|
projection, params);
|
||||||
|
|
||||||
this.image_ = new ol.Image(extent, resolution, pixelRatio,
|
this.image_ = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||||
this.getAttributions(), url, this.crossOrigin_, this.imageLoadFunction_);
|
this.getAttributions(), url, this.crossOrigin_, this.imageLoadFunction_);
|
||||||
|
|
||||||
this.renderedRevision_ = this.getRevision();
|
this.renderedRevision_ = this.getRevision();
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ ol.source.TileArcGISRest.prototype.getRequestUrl_ =
|
|||||||
pixelRatio, projection, params) {
|
pixelRatio, projection, params) {
|
||||||
|
|
||||||
var urls = this.urls;
|
var urls = this.urls;
|
||||||
if (!urls) {
|
if (urls.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
|
|||||||
pixelRatio, projection, params) {
|
pixelRatio, projection, params) {
|
||||||
|
|
||||||
var urls = this.urls;
|
var urls = this.urls;
|
||||||
if (!urls) {
|
if (urls.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,11 +298,9 @@ ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() {
|
|||||||
var i = 0;
|
var i = 0;
|
||||||
var res = [];
|
var res = [];
|
||||||
|
|
||||||
if (this.urls) {
|
var j, jj;
|
||||||
var j, jj;
|
for (j = 0, jj = this.urls.length; j < jj; ++j) {
|
||||||
for (j = 0, jj = this.urls.length; j < jj; ++j) {
|
res[i++] = this.urls[j];
|
||||||
res[i++] = this.urls[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var key;
|
var key;
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
|
|||||||
*
|
*
|
||||||
* This method is not available when the source is configured with
|
* This method is not available when the source is configured with
|
||||||
* `useSpatialIndex` set to `false`.
|
* `useSpatialIndex` set to `false`.
|
||||||
* @return {!ol.Extent} Extent.
|
* @return {ol.Extent} Extent.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.source.Vector.prototype.getExtent = function() {
|
ol.source.Vector.prototype.getExtent = function() {
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ ol.structs.RBush.prototype.clear = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Extent=} opt_extent Extent.
|
* @param {ol.Extent=} opt_extent Extent.
|
||||||
* @return {!ol.Extent} Extent.
|
* @return {ol.Extent} Extent.
|
||||||
*/
|
*/
|
||||||
ol.structs.RBush.prototype.getExtent = function(opt_extent) {
|
ol.structs.RBush.prototype.getExtent = function(opt_extent) {
|
||||||
// FIXME add getExtent() to rbush
|
// FIXME add getExtent() to rbush
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ ol.style.IconImage_ = function(image, src, size, crossOrigin, imageState) {
|
|||||||
*/
|
*/
|
||||||
this.image_ = !image ? new Image() : image;
|
this.image_ = !image ? new Image() : image;
|
||||||
|
|
||||||
if (crossOrigin !== null) {
|
if (crossOrigin) {
|
||||||
this.image_.crossOrigin = crossOrigin;
|
this.image_.crossOrigin = crossOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,6 @@ ol.style.Text.prototype.setFont = function(font) {
|
|||||||
* Set the x offset.
|
* Set the x offset.
|
||||||
*
|
*
|
||||||
* @param {number} offsetX Horizontal text offset.
|
* @param {number} offsetX Horizontal text offset.
|
||||||
* @api
|
|
||||||
*/
|
*/
|
||||||
ol.style.Text.prototype.setOffsetX = function(offsetX) {
|
ol.style.Text.prototype.setOffsetX = function(offsetX) {
|
||||||
this.offsetX_ = offsetX;
|
this.offsetX_ = offsetX;
|
||||||
@@ -216,7 +215,6 @@ ol.style.Text.prototype.setOffsetX = function(offsetX) {
|
|||||||
* Set the y offset.
|
* Set the y offset.
|
||||||
*
|
*
|
||||||
* @param {number} offsetY Vertical text offset.
|
* @param {number} offsetY Vertical text offset.
|
||||||
* @api
|
|
||||||
*/
|
*/
|
||||||
ol.style.Text.prototype.setOffsetY = function(offsetY) {
|
ol.style.Text.prototype.setOffsetY = function(offsetY) {
|
||||||
this.offsetY_ = offsetY;
|
this.offsetY_ = offsetY;
|
||||||
|
|||||||
@@ -59,20 +59,14 @@ function runTests(includeCoverage, callback) {
|
|||||||
var url = 'http://' + address.address + ':' + address.port;
|
var url = 'http://' + address.address + ':' + address.port;
|
||||||
var args = [
|
var args = [
|
||||||
require.resolve('mocha-phantomjs-core'),
|
require.resolve('mocha-phantomjs-core'),
|
||||||
url + '/test/index.html',
|
url + '/test/index.html'
|
||||||
'spec'
|
|
||||||
];
|
];
|
||||||
var config = {
|
|
||||||
ignoreResourceErrors: true,
|
|
||||||
useColors: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (includeCoverage) {
|
if (includeCoverage) {
|
||||||
config.hooks = path.join(__dirname, '../test/phantom_hooks.js');
|
args.push('spec', '{"hooks": "' +
|
||||||
|
path.join(__dirname, '../test/phantom_hooks.js') + '"}');
|
||||||
}
|
}
|
||||||
|
|
||||||
args.push(JSON.stringify(config));
|
|
||||||
|
|
||||||
var child = spawn(phantomjs.path, args, {stdio: 'inherit'});
|
var child = spawn(phantomjs.path, args, {stdio: 'inherit'});
|
||||||
child.on('exit', function(code) {
|
child.on('exit', function(code) {
|
||||||
callback(code);
|
callback(code);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1337,7 +1337,6 @@ describe('ol.format.KML', function() {
|
|||||||
expect(imageStyle.getOrigin()).to.be(null);
|
expect(imageStyle.getOrigin()).to.be(null);
|
||||||
expect(imageStyle.getRotation()).to.eql(0);
|
expect(imageStyle.getRotation()).to.eql(0);
|
||||||
expect(imageStyle.getSize()).to.be(null);
|
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.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
|
||||||
expect(style.getZIndex()).to.be(undefined);
|
expect(style.getZIndex()).to.be(undefined);
|
||||||
});
|
});
|
||||||
@@ -1349,7 +1348,6 @@ describe('ol.format.KML', function() {
|
|||||||
' <Placemark>' +
|
' <Placemark>' +
|
||||||
' <Style>' +
|
' <Style>' +
|
||||||
' <IconStyle>' +
|
' <IconStyle>' +
|
||||||
' <scale>3.0</scale>' +
|
|
||||||
' <Icon>' +
|
' <Icon>' +
|
||||||
' <href>http://foo.png</href>' +
|
' <href>http://foo.png</href>' +
|
||||||
' <gx:x>24</gx:x>' +
|
' <gx:x>24</gx:x>' +
|
||||||
@@ -1382,7 +1380,6 @@ describe('ol.format.KML', function() {
|
|||||||
expect(imageStyle.getAnchor()).to.eql([24, 36]);
|
expect(imageStyle.getAnchor()).to.eql([24, 36]);
|
||||||
expect(imageStyle.getOrigin()).to.eql([24, 108]);
|
expect(imageStyle.getOrigin()).to.eql([24, 108]);
|
||||||
expect(imageStyle.getRotation()).to.eql(0);
|
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.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
|
||||||
expect(style.getZIndex()).to.be(undefined);
|
expect(style.getZIndex()).to.be(undefined);
|
||||||
});
|
});
|
||||||
@@ -1782,54 +1779,6 @@ describe('ol.format.KML', function() {
|
|||||||
expect(node).to.xmleql(ol.xml.parse(text));
|
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() {
|
it('can write an feature\'s text style', function() {
|
||||||
var style = new ol.style.Style({
|
var style = new ol.style.Style({
|
||||||
text: new ol.style.Text({
|
text: new ol.style.Text({
|
||||||
@@ -2776,7 +2725,6 @@ goog.require('ol.geom.MultiPoint');
|
|||||||
goog.require('ol.geom.MultiPolygon');
|
goog.require('ol.geom.MultiPolygon');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.style.Circle');
|
|
||||||
goog.require('ol.style.Fill');
|
goog.require('ol.style.Fill');
|
||||||
goog.require('ol.style.Icon');
|
goog.require('ol.style.Icon');
|
||||||
goog.require('ol.style.IconOrigin');
|
goog.require('ol.style.IconOrigin');
|
||||||
|
|||||||
@@ -161,29 +161,6 @@ describe('ol.interaction.Select', function() {
|
|||||||
describe('filter features using the filter option', function() {
|
describe('filter features using the filter option', function() {
|
||||||
var select;
|
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() {
|
describe('with multi set to true', function() {
|
||||||
|
|
||||||
it('only selects features that pass the filter', function() {
|
it('only selects features that pass the filter', function() {
|
||||||
|
|||||||
@@ -46,23 +46,13 @@ describe('ol.renderer.canvas.Map', function() {
|
|||||||
document.body.removeChild(target);
|
document.body.removeChild(target);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls callback with layer for managed layers', function() {
|
it('always includes unmanaged 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);
|
layer.setMap(map);
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
var cb = sinon.spy();
|
var cb = sinon.spy();
|
||||||
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
|
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
|
||||||
function() { return false; });
|
function() { return false; });
|
||||||
expect(cb).to.be.called();
|
expect(cb).to.be.called();
|
||||||
expect(cb.firstCall.args[1]).to.be(null);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('filters managed layers', function() {
|
it('filters managed layers', function() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' +
|
|||||||
'ABAAEAAAICRAEAOw==';
|
'ABAAEAAAICRAEAOw==';
|
||||||
|
|
||||||
function itNoPhantom() {
|
function itNoPhantom() {
|
||||||
if (window.checkForMocha) {
|
if (window.initMochaPhantomJS) {
|
||||||
return xit.apply(this, arguments);
|
return xit.apply(this, arguments);
|
||||||
} else {
|
} else {
|
||||||
return it.apply(this, arguments);
|
return it.apply(this, arguments);
|
||||||
|
|||||||
@@ -13,16 +13,6 @@ 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() {
|
describe('#getTile', function() {
|
||||||
|
|
||||||
it('returns a tile with the expected URL', function() {
|
it('returns a tile with the expected URL', function() {
|
||||||
|
|||||||
BIN
test_rendering/spec/ol/data/dem.jpg
Normal file
BIN
test_rendering/spec/ol/data/dem.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
test_rendering/spec/ol/layer/expected/image-canvas-resxy.png
Normal file
BIN
test_rendering/spec/ol/layer/expected/image-canvas-resxy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -4,16 +4,16 @@ describe('ol.rendering.layer.Image', function() {
|
|||||||
|
|
||||||
var target, map;
|
var target, map;
|
||||||
|
|
||||||
function createMap(renderer) {
|
function createMap(renderer, center, zoom) {
|
||||||
target = createMapDiv(50, 50);
|
target = createMapDiv(50, 50);
|
||||||
|
|
||||||
map = new ol.Map({
|
map = new ol.Map({
|
||||||
target: target,
|
target: target,
|
||||||
renderer: renderer,
|
renderer: renderer,
|
||||||
view: new ol.View({
|
view: new ol.View({
|
||||||
center: ol.proj.transform(
|
center: center ? center : ol.proj.transform(
|
||||||
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
|
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 5
|
zoom: zoom ? zoom : 5
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
@@ -82,6 +82,35 @@ 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');
|
goog.require('goog.object');
|
||||||
|
|||||||
BIN
test_rendering/spec/ol/style/expected/icon-canvas-offset.png
Normal file
BIN
test_rendering/spec/ol/style/expected/icon-canvas-offset.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 838 B |
@@ -30,7 +30,7 @@ describe('ol.rendering.style.Icon', function() {
|
|||||||
disposeMap(map);
|
disposeMap(map);
|
||||||
});
|
});
|
||||||
|
|
||||||
function createFeatures(callback) {
|
function createFeatures(callback, offset) {
|
||||||
var feature;
|
var feature;
|
||||||
feature = new ol.Feature({
|
feature = new ol.Feature({
|
||||||
geometry: new ol.geom.Point([0, 0])
|
geometry: new ol.geom.Point([0, 0])
|
||||||
@@ -44,6 +44,7 @@ describe('ol.rendering.style.Icon', function() {
|
|||||||
anchorXUnits: 'fraction',
|
anchorXUnits: 'fraction',
|
||||||
anchorYUnits: 'pixels',
|
anchorYUnits: 'pixels',
|
||||||
opacity: 0.75,
|
opacity: 0.75,
|
||||||
|
offset: offset,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
img: img,
|
img: img,
|
||||||
imgSize: [32, 48]
|
imgSize: [32, 48]
|
||||||
@@ -63,6 +64,14 @@ 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) {
|
it('tests the WebGL renderer', function(done) {
|
||||||
assertWebGL();
|
assertWebGL();
|
||||||
map = createMap('webgl');
|
map = createMap('webgl');
|
||||||
|
|||||||
Reference in New Issue
Block a user