Skip to content

GeoExt v4.0.0

Choose a tag to compare

@simonseyock simonseyock released this 28 May 14:55
· 102 commits to master since this release

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.Vector with an ol.source.Vector
    with a ol.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-legacy and include the
    ol.js and ol.css files 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_this arguments. This not only true for .on and .un but also for forEachFeatureAtPixel and similar methods. If you do not call un on the method
    you can simply use .bind on the call. It you want to unbind the listener, either store a bound version of the listener
    or store the listenerKey returned by on and usw ol.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.Attribution class 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
});

CHANGES

  • Enforce collections for feature store. (#686)
  • Update openlayers to v6.5.0 (#651)

v3.4.0...v4.0.0