Comments (14)
Seems I missed this in review. The history says that you contributed this code Could you make a PR for this?
Done: #156
Rather trivial change, I've made it while trying to find root cause for this issue (and forgot about it).
from gwt-ol.
@gkresic Thanks for reporting. Which version of gwt-ol and OpenLayers you are using?
from gwt-ol.
gwt-ol locally built from master branch, OpenLayers is 5.3.0.
from gwt-ol.
Forgot to mention: in HEAD-SNAPSHOT in master, there is currently version of ol.FeatureAtPixelOptions.setLayerFilter
that accepts ol.layer.Vector
instead of ol.layer.Layer
. However, according to OL docs (and common sense), it should accept ol.layer.Layer
. However, as I said, none of that versions works correctly in GWT 2.9.
from gwt-ol.
@gkresic I will have a look. Please note that gwt-ol currently doesn't support GWT 2.9 because GWT 2.9 uses new versions of jsinterop.base (1.0.0) and elemental2 (1.0.0) which are not compatible with GWT 2.8 and older jsinterop.base and elemental2 versions. So you can't have a version that supports both. Because of this I will create a branch for 2.9.0 support. You have to switch then. Please note that this is also true for other libs which uses elemental2 and jsinterop.base.
from gwt-ol.
Forgot to mention: in HEAD-SNAPSHOT in master, there is currently version of
ol.FeatureAtPixelOptions.setLayerFilter
that acceptsol.layer.Vector
instead ofol.layer.Layer
. However, according to OL docs (and common sense), it should acceptol.layer.Layer
.
Seems I missed this in review. The history says that you contributed this code
from gwt-ol.
I will have a look. Please note that gwt-ol currently doesn't support GWT 2.9 because GWT 2.9 uses new versions of jsinterop.base (1.0.0) and elemental2 (1.0.0) which are not compatible with GWT 2.8 and older jsinterop.base and elemental2 versions. So you can't have a version that supports both. Because of this I will create a branch for 2.9.0 support. You have to switch then. Please note that this is also true for other libs which uses elemental2 and jsinterop.base.
Is there any changelog for backward-incompatible changes between:
elemental2-1.0.0-RC1 (GWT 2.8.2) -> elemental2 1.0.0 (GWT 2.9.0)
jsinterop-annotations-1.0.2 (GWT 2.8.2) -> jsinterop-annotations 2.0.0 (GWT 2.9.0)
I may try to resolve conflicting changes, but would appreciate any starting pointers.
BTW, this problem with CCE and derived classes is so far only problem I've experienced when switching to GWT 2.9. However, I'm using only small portion of gwt-ol and I didn't test in details.
from gwt-ol.
@gkresic I have created a working gwt-ol branch for GWT 2.9. There are not that much changes. If you like to switch to 2.9 you can now build it locally.
I tried to reproduce the CCE and after some investigations I am sure that this is the same cause like in #154 . The type info (@api
) of ol.layer.Layer
is missing in OpenLayers in the mentioned versions. If you try to cast to an object to ol.layer.Layer
or a subtype (ol.layer.Vector
) the CCE occures. Casting to ol.layer.Base
is working for example.
Interesting fact: #154 is manifesting in both GWT 2.8.2 and 2.9, but this one is problem only in 2.9.
I guess you are mistaken. I can reproduce this behaviour in 2.8.2 and 2.9. Could you recheck this?
The remaining questions is how to handle this issue because type issues restrict the usage. An idea is to change the type to ol.layer.Base in the filter and the function with a comment that this is a workaround for an OpenLayers bug and that it is solved in newer versions.
from gwt-ol.
Interesting fact: #154 is manifesting in both GWT 2.8.2 and 2.9, but this one is problem only in 2.9.
I guess you are mistaken. I can reproduce this behaviour in 2.8.2 and 2.9. Could you recheck this?
Yes, I confirm there is a scenario in which behavior changes between GWT 2.8.2 and 2.9.0, but it's probably related to upgraded JDT compiler in GWT 2.9, because there it fails as it should while GWT 2.8.2 silently allow this obviously illegal behavior.
Steps to reproduce:
- revert
ol.FeatureAtPixelOptions.[get|set]LayerFilter
to useol.layer.Vector
instead ofol.layer.Layer
- set layer filter using lambda
Second step is important - if you set layer filter using method reference, it fails in both versions of GWT, but lambda version fails only in GWT 2.9.
Code:
ol.Pixel pixel = ...
ol.Map map = ...
ol.FeatureAtPixelOptions options = new ol.FeatureAtPixelOptions();
options.setHitTolerance(10);
options.setLayerFilter(layer -> true);
map.forEachFeatureAtPixel(pixel, (feature, layer) -> false, options);
from gwt-ol.
The remaining questions is how to handle this issue because type issues restrict the usage. An idea is to change the type to ol.layer.Base in the filter and the function with a comment that this is a workaround for an OpenLayers bug and that it is solved in newer versions.
Ideal solution would be to switch to OpenLayers 6, but guessing from a separate branch that option is not available yet. Meanwhile, I've created PR (#158) which uses ol.layer.Base
as you suggested because I can't think of a better solution, either.
from gwt-ol.
I could create a release for OL6. Maybe it's time to switch master to OL6 and keep a branch for older versions. I think the type bug is a good reason for going foward. WDYT?
from gwt-ol.
I could create a release for OL6. Maybe it's time to switch master to OL6 and keep a branch for older versions. I think the type bug is a good reason for going foward. WDYT?
If support for OpenLayer 6 is adequate, I can't see a reason not to switch to it, together with migration to GWT 2.9 as a dependency.
from gwt-ol.
If support for OpenLayer 6 is adequate, I can't see a reason not to switch to it, together with migration to GWT 2.9 as a dependency.
The ol6 branch is working fine except of unit tests because old JSUnit version causes problems with new browser apis. I would prefer to first release a version based on GWT 2.8 because I suppose that there are a lot of users which won't update to 2.9 in the near future.
from gwt-ol.
The ol6 branch is working fine except of unit tests because old JSUnit version causes problems with new browser apis.
Also the JsUnit tests work right now. See https://travis-ci.org/github/TDesjardins/gwt-ol/builds/699610983
from gwt-ol.
Related Issues (20)
- Broken relationship between ol.layer.Layer and ol.layer.Vector HOT 3
- Add GWT 2.9 support HOT 2
- Migrate from RawGit to jsDelivr
- Compile fails if OpenLayers dependencies are injected by GWT HOT 12
- Add support for method forEachLayerAtPixel
- undesired flickering effect changing external image on Vector layer HOT 4
- Support for functions in ol.style.Style HOT 5
- Add declutter support
- Extract base vector layer
- Add css classname to layer options
- how to smoothly transition from an image to another in a vector layer HOT 5
- Add function param support in interaction select options
- Add WKB-format support
- Add method extend for collection HOT 1
- Add method foreach for collection
- Add method getPointerCount to Pointer interaction
- Add Kinetic
- Add missing properties to FullScreen options HOT 1
- Update download links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt-ol.