From 3b96f9939d768fcef2064b004b26e1d8b20e357c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 26 Apr 2018 15:18:14 +0200 Subject: [PATCH 1/4] More cleanup --- .travis.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea30e3b29c90..ee0e19cc5474 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,6 @@ jobs: script: - make eof-newline - make lint - - make check-ngeox - make git-attributes - make check-examples-checker - if [ "`git grep @fileoverview src contribs`" != "" ]; then echo "Using @fileoverview breaks the documentation main page"; false; fi @@ -84,7 +83,6 @@ jobs: - JOB=webpack script: - npm install - - git add -A # for git-attributes - if [ "${TRAVIS_PULL_REQUEST}" == false ]; then export NODE_ENV=prod; else export NODE_ENV=dev; fi - TARGET=ngeo-examples node_modules/.bin/webpack --profile - TARGET=gmf-examples node_modules/.bin/webpack --profile @@ -92,17 +90,8 @@ jobs: - export CHROME_BIN=/opt/google/chrome/chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - - ./node_modules/karma/bin/karma start karma-conf.js --single-run - - make lint - make check-examples-webpack - if [ ${IS_HOME} = TRUE ]; then JOB=publish-examples buildtools/deploy.sh; fi - - gem install jgrep - - export PACKAGE_VERSION=`jgrep --simple=version --input=package.json` - - echo "_auth = ${NPM_AUTH}" > ~/.npmrc - - echo "email = stephane.brunner@camptocamp.com" >> ~/.npmrc - after_success: - - cat .build/coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js - - if [ "${PACKAGE_VERSION}" = "${TRAVIS_TAG}" ]; then npm publish; fi - stage: Build env: From 51002ea5e2c5cbb814a660781c505bd56f258aa9 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 26 Apr 2018 16:31:41 +0200 Subject: [PATCH 2/4] Remove github_versions --- Makefile | 6 +++--- github_versions | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 github_versions diff --git a/Makefile b/Makefile index 1d599896ab20..edb5a5034ec7 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +ANGULAR_VERSION := $(shell grep '"angular"' package.json | cut -d\" -f4) SRC_JS_FILES := $(shell find src -type f -name '*.js') TEST_JS_FILES := $(shell find test -type f -name '*.js') ESLINT_CONFIG_FILES := $(shell find * -not -path 'node_modules/*' -type f -name '.eslintrc*') @@ -669,10 +670,9 @@ contribs/gmf/fonts/fontawesome-webfont.%: node_modules/font-awesome/fonts/fontaw mkdir -p $(dir $@) cp $< $@ - -contribs/gmf/build/angular-locale_%.js: github_versions +contribs/gmf/build/angular-locale_%.js: package.json mkdir -p $(dir $@) - wget -O $@ https://raw.githubusercontent.com/angular/angular.js/`grep ^angular.js= $< | cut -d = -f 2`/src/ngLocale/angular-locale_$*.js + wget -O $@ https://raw.githubusercontent.com/angular/angular.js/v$(ANGULAR_VERSION)/src/ngLocale/angular-locale_$*.js .build/python-venv: mkdir -p $(dir $@) diff --git a/github_versions b/github_versions deleted file mode 100644 index a30f0dc22670..000000000000 --- a/github_versions +++ /dev/null @@ -1 +0,0 @@ -angular.js=704123a From 683ae84f4392ce870b38648a38cb14cc94c195fe Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 26 Apr 2018 16:32:56 +0200 Subject: [PATCH 3/4] Enable again eslint no-unused-vars rule --- .eslintrc-es6.yaml | 2 +- contribs/gmf/test/spec/services/permalinkservice.spec.js | 6 +++--- src/profile/d3Elevation.js | 1 - src/search/createGeoJSONBloodhound.js | 1 - src/search/createLocationSearchBloodhound.js | 1 - src/search/searchDirective.js | 1 - test/spec/services/autoprojection.spec.js | 6 +++--- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.eslintrc-es6.yaml b/.eslintrc-es6.yaml index 3d4c4c46f996..d35675643c07 100644 --- a/.eslintrc-es6.yaml +++ b/.eslintrc-es6.yaml @@ -72,7 +72,7 @@ rules: # http://eslint.org/docs/rules/no-this-before-super no-this-before-super: error - no-unused-vars: warn + no-unused-vars: error # disallow useless computed property keys # http://eslint.org/docs/rules/no-useless-computed-key diff --git a/contribs/gmf/test/spec/services/permalinkservice.spec.js b/contribs/gmf/test/spec/services/permalinkservice.spec.js index f73cc8d3fc29..1c1d419c17e7 100644 --- a/contribs/gmf/test/spec/services/permalinkservice.spec.js +++ b/contribs/gmf/test/spec/services/permalinkservice.spec.js @@ -17,7 +17,7 @@ describe('Permalink service', () => { StateManagerService = _ngeoStateManager_; PermalinkService = _gmfPermalink_; ngeoLocation = _ngeoLocation_; - const map = new olMap({layers: [], view: new olView({projection: olProj.get('EPSG:2056')})}); + const map = new olMap({layers: [], view: new olView({projection: olProj.get(ngeoProjEPSG2056)})}); PermalinkService.setMap(map); // need to work on a clone of themes, because the permalink service // seems to change the original object?! @@ -184,7 +184,7 @@ describe('Permalink service', () => { }); it('accepts flipped coordinates (x/y switched)', () => { - PermalinkService.sourceProjections_ = [olProj.get('EPSG:2056'), olProj.get('EPSG:4326')]; + PermalinkService.sourceProjections_ = [olProj.get(ngeoProjEPSG2056), olProj.get('EPSG:4326')]; StateManagerService.initialState['map_x'] = 46.7685575; StateManagerService.initialState['map_y'] = 6.6144562; const center = PermalinkService.getMapCenter(); @@ -193,7 +193,7 @@ describe('Permalink service', () => { }); it('reprojects the center', () => { - PermalinkService.sourceProjections_ = [olProj.get('EPSG:2056'), olProj.get('EPSG:4326')]; + PermalinkService.sourceProjections_ = [olProj.get(ngeoProjEPSG2056), olProj.get('EPSG:4326')]; StateManagerService.initialState['map_x'] = 6.6144562; StateManagerService.initialState['map_y'] = 46.7685575; const center = PermalinkService.getMapCenter(); diff --git a/src/profile/d3Elevation.js b/src/profile/d3Elevation.js index 5d04878dc022..f60cd3f8a48d 100644 --- a/src/profile/d3Elevation.js +++ b/src/profile/d3Elevation.js @@ -2,7 +2,6 @@ * @module ngeo.profile.d3Elevation */ import googAsserts from 'goog/asserts.js'; -import * as olBase from 'ol/index.js'; import * as olObj from 'ol/obj.js'; import 'd3-transition'; diff --git a/src/search/createGeoJSONBloodhound.js b/src/search/createGeoJSONBloodhound.js index a83a893cc66f..fe81e78e8e3d 100644 --- a/src/search/createGeoJSONBloodhound.js +++ b/src/search/createGeoJSONBloodhound.js @@ -1,7 +1,6 @@ /** * @module ngeo.search.createGeoJSONBloodhound */ -import * as olBase from 'ol/index.js'; import olFormatGeoJSON from 'ol/format/GeoJSON.js'; import * as olObj from 'ol/obj.js'; diff --git a/src/search/createLocationSearchBloodhound.js b/src/search/createLocationSearchBloodhound.js index 58fe2d5f9d9f..feae5d3ae513 100644 --- a/src/search/createLocationSearchBloodhound.js +++ b/src/search/createLocationSearchBloodhound.js @@ -1,7 +1,6 @@ /** * @module ngeo.search.createLocationSearchBloodhound */ -import * as olBase from 'ol/index.js'; import * as olObj from 'ol/obj.js'; import * as olProj from 'ol/proj.js'; diff --git a/src/search/searchDirective.js b/src/search/searchDirective.js index c8edfdf8f3f1..7f2abdec7022 100644 --- a/src/search/searchDirective.js +++ b/src/search/searchDirective.js @@ -1,7 +1,6 @@ /** * @module ngeo.search.searchDirective */ -import * as olBase from 'ol/index.js'; /** * Provides the "ngeoSearch" directive, which uses Twitter's diff --git a/test/spec/services/autoprojection.spec.js b/test/spec/services/autoprojection.spec.js index a86d1987bbe0..d04a2d6406e5 100644 --- a/test/spec/services/autoprojection.spec.js +++ b/test/spec/services/autoprojection.spec.js @@ -37,9 +37,9 @@ describe('ngeo.misc.AutoProjection', () => { it('Try projections', () => { const coordinatesA = [600000, 200000]; const coordinatesB = [8, 47]; - const viewProjection = olProj.get('EPSG:21781'); + const viewProjection = olProj.get(ngeoProjEPSG21781); const extent = viewProjection.getExtent(); - const projections = [olProj.get('EPSG:21781'), olProj.get('EPSG:4326')]; + const projections = [olProj.get(ngeoProjEPSG21781), olProj.get('EPSG:4326')]; let point = ngeoAutoProjection.tryProjections(coordinatesA, extent, viewProjection); @@ -58,7 +58,7 @@ describe('ngeo.misc.AutoProjection', () => { it('Try projections with inversion', () => { const coordinates = [47, 8]; - const viewProjection = olProj.get('EPSG:21781'); + const viewProjection = olProj.get(ngeoProjEPSG21781); const extent = viewProjection.getExtent(); const projections = [olProj.get('EPSG:4326')]; const coordinatesTransformed = olProj.transform(coordinates.reverse(), From 4ea76934c596e6ba2e9466e9cb77309d0b248aeb Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 26 Apr 2018 16:33:17 +0200 Subject: [PATCH 4/4] Port to OL5 master --- package.json | 2 +- src/map/FeatureOverlayMgr.js | 5 +++-- src/map/LayerHelper.js | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 76108bd7d72f..80725ac6c69d 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "moment": "2.22.1", "ol-cesium": "1.36.0", "olcs": "0.0.10", - "openlayers": "https://api.github.com/repos/openlayers/openlayers/tarball/bfae19c7e138533ad0c1a071d8886d55aac9bd35", + "openlayers": "https://api.github.com/repos/openlayers/openlayers/tarball/f284b95cb897b3ce1b49b985b58ebe1ca76be1fe", "phantomjs-polyfill-string-includes": "1.0.0", "phantomjs-prebuilt": "2.1.16", "proj4": "2.4.4", diff --git a/src/map/FeatureOverlayMgr.js b/src/map/FeatureOverlayMgr.js index 47e11b76d908..2c4c267d7e4c 100644 --- a/src/map/FeatureOverlayMgr.js +++ b/src/map/FeatureOverlayMgr.js @@ -7,7 +7,8 @@ import * as olBase from 'ol/index.js'; import olLayerVector from 'ol/layer/Vector.js'; import * as olObj from 'ol/obj.js'; import olSourceVector from 'ol/source/Vector.js'; -import olStyleStyle from 'ol/style/Style.js'; +import olStyleStyle, {toFunction as toStyleFunction} from 'ol/style/Style.js'; + /** * Provides a service that wraps an "unmanaged" vector layer, @@ -155,7 +156,7 @@ exports.prototype.setStyle = function(style, groupIndex) { googAsserts.assert(groupIndex >= 0); googAsserts.assert(groupIndex < this.groups_.length); this.groups_[groupIndex].styleFunction = style === null ? - olStyleStyle.defaultFunction : olStyleStyle.createFunction(style); + olStyleStyle.defaultFunction : toStyleFunction(style); }; diff --git a/src/map/LayerHelper.js b/src/map/LayerHelper.js index 8e1cccbd587e..e81640ecdd20 100644 --- a/src/map/LayerHelper.js +++ b/src/map/LayerHelper.js @@ -10,7 +10,7 @@ import olLayerTile from 'ol/layer/Tile.js'; import * as olObj from 'ol/obj.js'; import olSourceImageWMS from 'ol/source/ImageWMS.js'; import olSourceTileWMS from 'ol/source/TileWMS.js'; -import olSourceWMTS from 'ol/source/WMTS.js'; +import olSourceWMTS, {optionsFromCapabilities} from 'ol/source/WMTS.js'; import * as olUri from 'ol/uri.js'; /** @@ -173,7 +173,7 @@ exports.prototype.createWMTSLayerFromCapabilitites = function(capabilitiesURL, l result = parser.read(response.data); } if (result) { - const options = olSourceWMTS.optionsFromCapabilities(result, { + const options = optionsFromCapabilities(result, { matrixSet: opt_matrixSet, crossOrigin: 'anonymous', layer: layerName @@ -211,7 +211,7 @@ exports.prototype.createWMTSLayerFromCapabilititesObj = function( capabilities, layerCap, opt_dimensions ) { - const options = olSourceWMTS.optionsFromCapabilities(capabilities, { + const options = optionsFromCapabilities(capabilities, { crossOrigin: 'anonymous', layer: layerCap['Identifier'] });