GeoExt v4.0.0
This release updates the OpenLayers version to 6.5.0 and is the first version to use semantic versioning in GeoExt.
A step-by-step guide to update an application that uses geoext can be found here: https://github.com/terrestris/BasiGX/wiki/Update-application-to-ol-6.5.0,-geoext-4.0.0,-BasiGX-3.0.0
BREAKING CHANGES
- If a features store is configured with a layer this layer needs to be an
ol.layer.Vectorwith anol.source.Vector
with aol.Collection. That means, if you used it like this before, it will now throw an Error:
Ext.create('GeoExt.data.store.Features', {
layer: new ol.layer.Vector({
source: new ol.source.Vector()
})
});If you change it to the following code it will work and keep the elements of the store, and the layer in sync.
Ext.create('GeoExt.data.store.Features', {
layer: new ol.layer.Vector({
source: new ol.source.Vector({
features: new ol.Collection()
})
})
});- The OpenLayers version was updated to v6.5.0. To use this version run
npm i @geoext/openlayers-legacyand include the
ol.jsandol.cssfiles from there. - Due to the OpenLayers update the OverviewMap no longer can use the same layers as the main map and always has to be
provided own layers. - One of the bigger changes in OpenLayers is the removal of
opt_thisarguments. This not only true for.onand.unbut also forforEachFeatureAtPixeland similar methods. If you do not callunon the method
you can simply use.bindon the call. It you want to unbind the listener, either store a bound version of the listener
or store the listenerKey returned byonand uswol.Observable.unByKey.
Example 1 (un is not used):
map.on('moveend', this.doSomething, this);becomes:
map.on('moveend', this.doSomething.bind(this));Example 2 (un is used):
Ext.define('SomeClass', {
method1: function () {
map.on('moveend', this.doSomething, this);
},
method2: function () {
map.un('moveend', this.doSomething, this);
}
});becomes:
Ext.define('SomeClass', {
constructor: function () {
this.doSomething = this.doSomething.bind(this); // store a bound version of the method
this.callParent(arguments); // call parent afterwards in case the parent constructor calls method1 or method2
},
method1: function () {
map.on('moveend', this.doSomething);
},
method2: function () {
map.un('moveend', this.doSomething);
}
});- Note that the
ol.Attributionclass has been removed and can be replaced by simple html text
new ol.source.Vector({
attributions: [new ol.Attribution({
html: '© notice'
}]
});becomes:
new ol.source.Vector({
attributions: '© notice' // array is optional
});- The above are only some of the major changes. It is important to also check the OpenLayers update notes on
v5.0.0andv6.0.0: