From d353ffb8c1291a00d3c2abf0337c1ffd5f1ea0b9 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:32:02 +0100 Subject: [PATCH 1/6] upgrade ol version to 5.3.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ae2de7fa..0212d042 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "lodash": "4.17.11" }, "peerDependencies": { - "ol": "4.6.5" + "ol": "~5.0" }, "scripts": { "build": "tsc -p tsconfig.build.json && npm run build:browser", @@ -59,7 +59,7 @@ "jest": "23.6.0", "jest-preset-typescript": "1.2.0", "np": "3.1.0", - "ol": "4.6.5", + "ol": "5.3.0", "ts-jest": "22.4.6", "tslint": "5.11.0", "typescript": "3.1.2", From f507f31e7687503675b98bcafb566f876beab774 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:32:56 +0100 Subject: [PATCH 2/6] bump to ol5 compatible @terrestris/ol-util version --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 0212d042..2dfeaf2a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "homepage": "https://github.com/terrestris/geostyler-openlayers-parser#readme", "dependencies": { - "@terrestris/ol-util": "0.5.0", + "@terrestris/ol-util": "1.6.0", "geostyler-style": "0.14.2", "lodash": "4.17.11" }, @@ -46,7 +46,6 @@ }, "devDependencies": { "@babel/polyfill": "7.0.0", - "@terrestris/ol-util": "0.5.0", "@types/jest": "23.3.10", "@types/node": "10.12.15", "@types/ol": "4.6.2", From 872c62a26ff753f6e18f680c99724f9314bd5105 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:33:29 +0100 Subject: [PATCH 3/6] remove obsolete @types/ol dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 2dfeaf2a..5f63a776 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "@babel/polyfill": "7.0.0", "@types/jest": "23.3.10", "@types/node": "10.12.15", - "@types/ol": "4.6.2", "awesome-typescript-loader": "4.0.1", "babel-core": "6.26.3", "babel-jest": "23.6.0", From 07e050d9f465f1c94ed5c0cd3305581faf85cca8 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:37:01 +0100 Subject: [PATCH 4/6] adapt ol imports after upgrade to ol v5 --- README.md | 2 +- data/olStyles/line_simpleline.ts | 4 ++-- data/olStyles/multi_simplefillSimpleline.ts | 6 ++--- data/olStyles/multi_simplelineLabel.ts | 10 ++++---- data/olStyles/multi_twoRulesSimplepoint.ts | 6 ++--- data/olStyles/point_icon.ts | 4 ++-- data/olStyles/point_simplebackslash.ts | 6 ++--- data/olStyles/point_simplecarrow.ts | 6 ++--- data/olStyles/point_simplecross.ts | 6 ++--- data/olStyles/point_simpledot.ts | 6 ++--- data/olStyles/point_simplehorline.ts | 6 ++--- data/olStyles/point_simpleoarrow.ts | 6 ++--- data/olStyles/point_simpleplus.ts | 6 ++--- data/olStyles/point_simplepoint.ts | 6 ++--- data/olStyles/point_simpleslash.ts | 6 ++--- data/olStyles/point_simplesquare.ts | 6 ++--- data/olStyles/point_simplestar.ts | 6 ++--- data/olStyles/point_simpletimes.ts | 6 ++--- data/olStyles/point_simpletriangle.ts | 6 ++--- data/olStyles/point_simplevertline.ts | 6 ++--- data/olStyles/point_simplex.ts | 6 ++--- data/olStyles/point_styledLabel_static.ts | 8 +++---- data/olStyles/point_styledlabel.ts | 8 +++---- data/olStyles/polygon_transparentpolygon.ts | 6 ++--- dev-build.config.js | 26 ++++++++++----------- src/OlStyleParser.spec.ts | 16 ++++++------- src/OlStyleParser.ts | 16 ++++++------- src/Util/OlStyleUtil.spec.ts | 6 ++--- 28 files changed, 104 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index 39d7a5aa..65f01c6d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Please provide related issues here https://github.com/terrestris/geostyler/issue ES6: ```js import OpenLayersParser from "geostyler-openlayers-parser"; -import OlLayerVector from "ol/layer/vector"; +import OlLayerVector from "ol/layer/Vector"; const pointSimplePoint = { name: "OL Style", diff --git a/data/olStyles/line_simpleline.ts b/data/olStyles/line_simpleline.ts index 3665d8a6..717f419e 100644 --- a/data/olStyles/line_simpleline.ts +++ b/data/olStyles/line_simpleline.ts @@ -1,5 +1,5 @@ -import OlStyle from 'ol/style/style'; -import OlStyleStroke from 'ol/style/stroke'; +import OlStyle from 'ol/style/Style'; +import OlStyleStroke from 'ol/style/Stroke'; const olSimpleLine = new OlStyle({ stroke: new OlStyleStroke({ diff --git a/data/olStyles/multi_simplefillSimpleline.ts b/data/olStyles/multi_simplefillSimpleline.ts index 4668fe60..9b19bc6c 100644 --- a/data/olStyles/multi_simplefillSimpleline.ts +++ b/data/olStyles/multi_simplefillSimpleline.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleFill = new OlStyle({ fill: new OlStyleFill({ diff --git a/data/olStyles/multi_simplelineLabel.ts b/data/olStyles/multi_simplelineLabel.ts index 143e8131..b0060224 100644 --- a/data/olStyles/multi_simplelineLabel.ts +++ b/data/olStyles/multi_simplelineLabel.ts @@ -1,7 +1,7 @@ -import OlStyle from 'ol/style/style'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleFill from 'ol/style/fill'; -import OlStyleText from 'ol/style/text'; +import OlStyle from 'ol/style/Style'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleFill from 'ol/style/Fill'; +import OlStyleText from 'ol/style/Text'; const olSimpleLine = new OlStyle({ stroke: new OlStyleStroke({ @@ -23,7 +23,7 @@ const olStyledLabel = new OlStyle({ }), offsetX: 0, offsetY: 5 - }) + }) }); export default [olSimpleLine, olStyledLabel]; diff --git a/data/olStyles/multi_twoRulesSimplepoint.ts b/data/olStyles/multi_twoRulesSimplepoint.ts index 08080e37..e66c9579 100644 --- a/data/olStyles/multi_twoRulesSimplepoint.ts +++ b/data/olStyles/multi_twoRulesSimplepoint.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleCircle from 'ol/style/circle'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleCircle from 'ol/style/Circle'; +import OlStyleFill from 'ol/style/Fill'; const olSimplePoint1 = new OlStyle({ image: new OlStyleCircle({ diff --git a/data/olStyles/point_icon.ts b/data/olStyles/point_icon.ts index 81d3dc76..061902ef 100644 --- a/data/olStyles/point_icon.ts +++ b/data/olStyles/point_icon.ts @@ -1,5 +1,5 @@ -import OlStyle from 'ol/style/style'; -import OlStyleIcon from 'ol/style/icon'; +import OlStyle from 'ol/style/Style'; +import OlStyleIcon from 'ol/style/Icon'; const olIconPoint = new OlStyle({ image: new OlStyleIcon({ diff --git a/data/olStyles/point_simplebackslash.ts b/data/olStyles/point_simplebackslash.ts index e2c6faa6..a7bfa594 100644 --- a/data/olStyles/point_simplebackslash.ts +++ b/data/olStyles/point_simplebackslash.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleSlash = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplecarrow.ts b/data/olStyles/point_simplecarrow.ts index 4efbfbd8..fa962220 100644 --- a/data/olStyles/point_simplecarrow.ts +++ b/data/olStyles/point_simplecarrow.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleCarrow = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplecross.ts b/data/olStyles/point_simplecross.ts index 855a8800..6ce072d6 100644 --- a/data/olStyles/point_simplecross.ts +++ b/data/olStyles/point_simplecross.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleCross = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simpledot.ts b/data/olStyles/point_simpledot.ts index 93670fa2..9ecbc514 100644 --- a/data/olStyles/point_simpledot.ts +++ b/data/olStyles/point_simpledot.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleCircle from 'ol/style/circle'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleCircle from 'ol/style/Circle'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleDot = new OlStyle({ image: new OlStyleCircle({ diff --git a/data/olStyles/point_simplehorline.ts b/data/olStyles/point_simplehorline.ts index 4eb7c0df..4f3d4b6f 100644 --- a/data/olStyles/point_simplehorline.ts +++ b/data/olStyles/point_simplehorline.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleHorline = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simpleoarrow.ts b/data/olStyles/point_simpleoarrow.ts index 104066d9..0c345acb 100644 --- a/data/olStyles/point_simpleoarrow.ts +++ b/data/olStyles/point_simpleoarrow.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleOarrow = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simpleplus.ts b/data/olStyles/point_simpleplus.ts index f30acda3..9e9adecb 100644 --- a/data/olStyles/point_simpleplus.ts +++ b/data/olStyles/point_simpleplus.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimplePlus = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplepoint.ts b/data/olStyles/point_simplepoint.ts index 3f27e412..34202af6 100644 --- a/data/olStyles/point_simplepoint.ts +++ b/data/olStyles/point_simplepoint.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleCircle from 'ol/style/circle'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleCircle from 'ol/style/Circle'; +import OlStyleFill from 'ol/style/Fill'; const olSimplePoint = new OlStyle({ image: new OlStyleCircle({ diff --git a/data/olStyles/point_simpleslash.ts b/data/olStyles/point_simpleslash.ts index a0aa60ea..d7844c08 100644 --- a/data/olStyles/point_simpleslash.ts +++ b/data/olStyles/point_simpleslash.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleSlash = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplesquare.ts b/data/olStyles/point_simplesquare.ts index 1f4d62c2..bf94eefb 100644 --- a/data/olStyles/point_simplesquare.ts +++ b/data/olStyles/point_simplesquare.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleSquare = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplestar.ts b/data/olStyles/point_simplestar.ts index 555b0eff..8544ba2a 100644 --- a/data/olStyles/point_simplestar.ts +++ b/data/olStyles/point_simplestar.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleStar = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simpletimes.ts b/data/olStyles/point_simpletimes.ts index 44b07eaa..0e0ee83f 100644 --- a/data/olStyles/point_simpletimes.ts +++ b/data/olStyles/point_simpletimes.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleTimes = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simpletriangle.ts b/data/olStyles/point_simpletriangle.ts index 47892538..164163d2 100644 --- a/data/olStyles/point_simpletriangle.ts +++ b/data/olStyles/point_simpletriangle.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleTriangle = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplevertline.ts b/data/olStyles/point_simplevertline.ts index 102eb062..e17d8b6a 100644 --- a/data/olStyles/point_simplevertline.ts +++ b/data/olStyles/point_simplevertline.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleVertline = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_simplex.ts b/data/olStyles/point_simplex.ts index 809f524f..f0f74aeb 100644 --- a/data/olStyles/point_simplex.ts +++ b/data/olStyles/point_simplex.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlStyleFill from 'ol/style/Fill'; const olSimpleX = new OlStyle({ image: new OlStyleRegularshape({ diff --git a/data/olStyles/point_styledLabel_static.ts b/data/olStyles/point_styledLabel_static.ts index d32b4557..05aa6977 100644 --- a/data/olStyles/point_styledLabel_static.ts +++ b/data/olStyles/point_styledLabel_static.ts @@ -1,7 +1,7 @@ -import OlStyleText from 'ol/style/text'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleFill from 'ol/style/fill'; -import OlStyle from 'ol/style/style'; +import OlStyleText from 'ol/style/Text'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleFill from 'ol/style/Fill'; +import OlStyle from 'ol/style/Style'; const olPointStyledLabel = new OlStyle({ text: new OlStyleText({ diff --git a/data/olStyles/point_styledlabel.ts b/data/olStyles/point_styledlabel.ts index 536a0164..189b2b07 100644 --- a/data/olStyles/point_styledlabel.ts +++ b/data/olStyles/point_styledlabel.ts @@ -1,6 +1,6 @@ -import OlStyleText from 'ol/style/text'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleFill from 'ol/style/fill'; +import OlStyleText from 'ol/style/Text'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleFill from 'ol/style/Fill'; const olPointStyledLabel = (feature: ol.Feature, res: number) => { return new OlStyleText({ @@ -18,7 +18,7 @@ const olPointStyledLabel = (feature: ol.Feature, res: number) => { offsetX: 0, offsetY: 5, rotation: Math.PI / 4 - }); + }); }; export default olPointStyledLabel; diff --git a/data/olStyles/polygon_transparentpolygon.ts b/data/olStyles/polygon_transparentpolygon.ts index 0d1f073f..ca137030 100644 --- a/data/olStyles/polygon_transparentpolygon.ts +++ b/data/olStyles/polygon_transparentpolygon.ts @@ -1,6 +1,6 @@ -import OlStyle from 'ol/style/style'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleFill from 'ol/style/fill'; +import OlStyle from 'ol/style/Style'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleFill from 'ol/style/Fill'; const olPolygonTransparentPolygon = new OlStyle({ stroke: new OlStyleStroke({ diff --git a/dev-build.config.js b/dev-build.config.js index 57501b16..5d5965ad 100644 --- a/dev-build.config.js +++ b/dev-build.config.js @@ -25,20 +25,20 @@ module.exports = { }, externals: [ { - 'ol/style/style': 'ol.style.Style', + 'ol/style/Style': 'ol.style.Style', 'ol/style': 'ol.style', - 'ol/style/image': 'ol.style.Image', - 'ol/style/stroke': 'ol.style.Stroke', - 'ol/style/text': 'ol.style.Text', - 'ol/style/circle': 'ol.style.Circle', - 'ol/style/icon': 'ol.style.Icon', - 'ol/style/regularshape': 'ol.style.RegularShape', - 'ol/style/fill': 'ol.style.Fill', - 'ol/map': 'ol.Map', - 'ol/source/tilewms': 'ol.source.TileWMS', - 'ol/source/imagewms': 'ol.source.ImageWMS', - 'ol/layer/group': 'ol.layer.Group', - 'ol/layer/base': 'ol.layer.Base', + 'ol/style/Image': 'ol.style.Image', + 'ol/style/Stroke': 'ol.style.Stroke', + 'ol/style/Text': 'ol.style.Text', + 'ol/style/Circle': 'ol.style.Circle', + 'ol/style/Icon': 'ol.style.Icon', + 'ol/style/RegularShape': 'ol.style.RegularShape', + 'ol/style/Fill': 'ol.style.Fill', + 'ol/Map': 'ol.Map', + 'ol/source/TileWMS': 'ol.source.TileWMS', + 'ol/source/ImageWMS': 'ol.source.ImageWMS', + 'ol/layer/Group': 'ol.layer.Group', + 'ol/layer/Base': 'ol.layer.Base', 'ol/proj': 'ol.proj' } ], diff --git a/src/OlStyleParser.spec.ts b/src/OlStyleParser.spec.ts index 4c83d2f9..1d54b0ff 100644 --- a/src/OlStyleParser.spec.ts +++ b/src/OlStyleParser.spec.ts @@ -1,10 +1,10 @@ -import OlStyle from 'ol/style/style'; -import OlStyleText from 'ol/style/text'; -import OlStyleFill from 'ol/style/fill'; -import OlStyleCircle from 'ol/style/circle'; -import OlStyleIcon from 'ol/style/icon'; -import OlStyleRegularshape from 'ol/style/regularshape'; -import OlFeature from 'ol/feature'; +import OlStyle from 'ol/style/Style'; +import OlStyleText from 'ol/style/Text'; +import OlStyleFill from 'ol/style/Fill'; +import OlStyleCircle from 'ol/style/Circle'; +import OlStyleIcon from 'ol/style/Icon'; +import OlStyleRegularshape from 'ol/style/RegularShape'; +import OlFeature from 'ol/Feature'; import ol from 'ol'; import OlStyleParser, { OlParserStyleFct } from './OlStyleParser'; @@ -919,7 +919,7 @@ describe('OlStyleParser implements StyleParser', () => { const expecSymb1 = multi_twoRulesSimplepoint.rules[0].symbolizers[0] as MarkSymbolizer; const expecSymb2 = multi_twoRulesSimplepoint.rules[1].symbolizers[0] as MarkSymbolizer; - + const olCircle1 = styles[0].getImage() as OlStyleCircle; expect(olCircle1).toBeDefined(); expect(olCircle1.getRadius()).toBeCloseTo(expecSymb1.radius); diff --git a/src/OlStyleParser.ts b/src/OlStyleParser.ts index 216fbb19..38d3a46d 100644 --- a/src/OlStyleParser.ts +++ b/src/OlStyleParser.ts @@ -14,14 +14,14 @@ import { Operator } from 'geostyler-style'; -import OlStyle from 'ol/style/style'; -import OlStyleImage from 'ol/style/image'; -import OlStyleFill from 'ol/style/fill'; -import OlStyleStroke from 'ol/style/stroke'; -import OlStyleText from 'ol/style/text'; -import OlStyleCircle from 'ol/style/circle'; -import OlStyleIcon from 'ol/style/icon'; -import OlStyleRegularshape from 'ol/style/regularshape'; +import OlStyle from 'ol/style/Style'; +import OlStyleImage from 'ol/style/Image'; +import OlStyleFill from 'ol/style/Fill'; +import OlStyleStroke from 'ol/style/Stroke'; +import OlStyleText from 'ol/style/Text'; +import OlStyleCircle from 'ol/style/Circle'; +import OlStyleIcon from 'ol/style/Icon'; +import OlStyleRegularshape from 'ol/style/RegularShape'; import OlStyleUtil from './Util/OlStyleUtil'; import MapUtil from '@terrestris/ol-util/dist/MapUtil/MapUtil'; diff --git a/src/Util/OlStyleUtil.spec.ts b/src/Util/OlStyleUtil.spec.ts index 15f7b965..dd56ff79 100644 --- a/src/Util/OlStyleUtil.spec.ts +++ b/src/Util/OlStyleUtil.spec.ts @@ -1,10 +1,10 @@ import OlStyleUtil from './OlStyleUtil'; -import OlFeature from 'ol/feature'; -import OlGeomPoint from 'ol/geom/point'; +import OlFeature from 'ol/Feature'; +import OlGeomPoint from 'ol/geom/Point'; import { TextSymbolizer } from 'geostyler-style'; describe('OlStyleUtil', () => { - + it('OlStyleUtil is defined', () => { expect(OlStyleUtil).toBeDefined(); }); From c1bd483747d04d8d35d8b0ff4ea6ce1a82091349 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:39:55 +0100 Subject: [PATCH 5/6] added index.d.ts with missing ts declarations for used ol5 classes --- index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.d.ts b/index.d.ts index 506a7e0c..9cce025e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,2 +1,13 @@ declare module 'geostyler-openlayers-parser'; declare module '@terrestris/ol-util/dist/MapUtil/MapUtil'; + +declare module 'ol/Feature'; +declare module 'ol/geom/Point'; +declare module 'ol/style/Circle'; +declare module 'ol/style/Fill'; +declare module 'ol/style/Icon'; +declare module 'ol/style/Image'; +declare module 'ol/style/RegularShape'; +declare module 'ol/style/Stroke'; +declare module 'ol/style/Style'; +declare module 'ol/style/Text'; From 865fd553f7c2cf9f93b4612b90f02a6dfc451a15 Mon Sep 17 00:00:00 2001 From: arieger Date: Tue, 18 Dec 2018 09:44:27 +0100 Subject: [PATCH 6/6] be less strict due to not existing ol types --- src/OlStyleParser.ts | 78 ++++++++++++++++++------------------ src/Util/OlStyleUtil.spec.ts | 2 +- src/Util/OlStyleUtil.ts | 2 +- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/OlStyleParser.ts b/src/OlStyleParser.ts index 38d3a46d..31df6ba6 100644 --- a/src/OlStyleParser.ts +++ b/src/OlStyleParser.ts @@ -28,7 +28,7 @@ import MapUtil from '@terrestris/ol-util/dist/MapUtil/MapUtil'; import { isNumber } from 'util'; const _get = require('lodash/get'); -export type OlParserStyleFct = ol.StyleFunction & { +export type OlParserStyleFct = Function & { __geoStylerStyle: Style }; @@ -78,11 +78,11 @@ export class OlStyleParser implements StyleParser { * @param {object} olStyle The OpenLayers Style object * @return {PointSymbolizer} The GeoStyler-Style PointSymbolizer */ - getPointSymbolizerFromOlStyle(olStyle: OlStyle): PointSymbolizer { + getPointSymbolizerFromOlStyle(olStyle: any): PointSymbolizer { let pointSymbolizer: PointSymbolizer; if (olStyle.getImage() instanceof this.OlStyleCircleConstructor) { // circle - const olCircleStyle = olStyle.getImage() as OlStyleCircle; + const olCircleStyle = olStyle.getImage(); const olFillStyle = olCircleStyle.getFill(); const olStrokeStyle = olCircleStyle.getStroke(); const circleSymbolizer: MarkSymbolizer = { @@ -98,7 +98,7 @@ export class OlStyleParser implements StyleParser { pointSymbolizer = circleSymbolizer; } else if (olStyle.getImage() instanceof this.OlStyleRegularshapeConstructor) { // square, triangle, star, cross or x - const olRegularStyle = olStyle.getImage() as OlStyleRegularshape; + const olRegularStyle = olStyle.getImage(); const olFillStyle = olRegularStyle.getFill(); const olStrokeStyle = olRegularStyle.getStroke(); const radius = olRegularStyle.getRadius(); @@ -174,7 +174,7 @@ export class OlStyleParser implements StyleParser { pointSymbolizer = markSymbolizer; } else { // icon - const olIconStyle: OlStyleIcon = olStyle.getImage() as OlStyleIcon; + const olIconStyle: any = olStyle.getImage(); let iconSymbolizer: IconSymbolizer = { kind: 'Icon', image: olIconStyle.getSrc() ? olIconStyle.getSrc() : undefined, @@ -194,8 +194,8 @@ export class OlStyleParser implements StyleParser { * @param {object} olStyle The OpenLayers Style object * @return {LineSymbolizer} The GeoStyler-Style LineSymbolizer */ - getLineSymbolizerFromOlStyle(olStyle: OlStyle): LineSymbolizer { - const olStrokeStyle = olStyle.getStroke() as OlStyleStroke; + getLineSymbolizerFromOlStyle(olStyle: any): LineSymbolizer { + const olStrokeStyle = olStyle.getStroke(); return { kind: 'Line', @@ -217,9 +217,9 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle} olStyle The OpenLayers Style object * @return {FillSymbolizer} The GeoStyler-Style FillSymbolizer */ - getFillSymbolizerFromOlStyle(olStyle: OlStyle): FillSymbolizer { - const olFillStyle = olStyle.getFill() as OlStyleFill; - const olStrokeStyle = olStyle.getStroke() as OlStyleStroke; + getFillSymbolizerFromOlStyle(olStyle: any): FillSymbolizer { + const olFillStyle = olStyle.getFill(); + const olStrokeStyle = olStyle.getStroke(); return { kind: 'Fill', @@ -237,10 +237,10 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle} olStyle The OpenLayers Style object * @return {TextSymbolizer} The GeoStyler-Style TextSymbolizer */ - getTextSymbolizerFromOlStyle(olStyle: OlStyle): TextSymbolizer { - const olTextStyle = olStyle.getText() as OlStyleText; - const olFillStyle = olTextStyle.getFill() as OlStyleFill; - const olStrokeStyle = olTextStyle.getStroke() as OlStyleStroke; + getTextSymbolizerFromOlStyle(olStyle: any): TextSymbolizer { + const olTextStyle = olStyle.getText(); + const olFillStyle = olTextStyle.getFill(); + const olStrokeStyle = olTextStyle.getStroke(); const offsetX = olTextStyle.getOffsetX(); const offsetY = olTextStyle.getOffsetY(); const font = olTextStyle.getFont(); @@ -286,9 +286,9 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle} olStyle The OpenLayers Style object * @return {Symbolizer[]} The GeoStyler-Style Symbolizer array */ - getSymbolizersFromOlStyle(olStyles: OlStyle[]): Symbolizer[] { + getSymbolizersFromOlStyle(olStyles: any[]): Symbolizer[] { const symbolizers: Symbolizer[] = []; - olStyles.forEach((olStyle: OlStyle) => { + olStyles.forEach((olStyle: any) => { let symbolizer: Symbolizer; const styleType: StyleType = this.getStyleTypeFromOlStyle(olStyle); switch (styleType) { @@ -320,7 +320,7 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle} olStyle The OpenLayers Style object * @return {Rule} The GeoStyler-Style Rule */ - getRuleFromOlStyle(olStyles: OlStyle|OlStyle[]): Rule { + getRuleFromOlStyle(olStyles: any): Rule { let rule: Rule; let symbolizers: Symbolizer[]; const name = 'OL Style Rule 0'; @@ -344,7 +344,7 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle} olStyle The OpenLayers Style object * @return {Symbolizer} The GeoStyler-Style Symbolizer */ - getStyleTypeFromOlStyle(olStyle: OlStyle): StyleType { + getStyleTypeFromOlStyle(olStyle: any): StyleType { let styleType: StyleType; if (olStyle.getImage() instanceof this.OlStyleImageConstructor) { @@ -368,7 +368,7 @@ export class OlStyleParser implements StyleParser { * @param {object} olStyle The OpenLayers Style object * @return {Style} The GeoStyler-Style Style */ - olStyleToGeoStylerStyle(olStyle: OlStyle|OlStyle[]): Style { + olStyleToGeoStylerStyle(olStyle: any): Style { const name = 'OL Style'; const rule = this.getRuleFromOlStyle(olStyle); return { @@ -386,7 +386,7 @@ export class OlStyleParser implements StyleParser { * @param {OlStyle|OlStyle[]|OlParserStyleFct} olStyle The style to be parsed * @return {Promise} The Promise resolving with the GeoStyler-Style Style */ - readStyle(olStyle: OlStyle|OlStyle[]|OlParserStyleFct): Promise