Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade mapfile parser #33

Merged
merged 20 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"project": "tsconfig-eslint.json",
"sourceType": "module"
},
"ignorePatterns": [
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: node_js
node_js:
- "10"
- "12"
- "14"
script:
- npm run test -- --coverage
cache:
Expand Down
7 changes: 4 additions & 3 deletions browser-build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports = {
library: "GeoStylerMapfileStyleParser"
},
resolve: {
fallback: {
fs: false,
path: false
},
// Add '.ts' as resolvable extensions.
extensions: [".ts", ".js", ".json"]
},
Expand All @@ -18,9 +22,6 @@ module.exports = {
new TerserPlugin()
]
},
node: {
fs: 'empty' // hack to avoid error in webpack with fs
},
module: {
rules: [
// All files with a '.ts'
Expand Down
17 changes: 8 additions & 9 deletions data/mapfiles/point_scale.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ LAYER
"wms_title" "point_scale"
"wms_srs" "EPSG:4326"
END
MAXSCALEDENOM 160000
MAXSCALEDENOM 320000
CLASS
NAME "Max scale from layer (priority)"
NAME "Max scale from class"
MAXSCALEDENOM 7000
STYLE
MAXSCALEDENOM 7000
SYMBOL "circle"
COLOR 0 0 0
SIZE 24
END
END
CLASS
NAME "Scales from class"
MAXSCALEDENOM 320000
NAME "Max scale from layer, min scale from class"
MINSCALEDENOM 160000
STYLE
SYMBOL "circle"
Expand All @@ -29,15 +28,15 @@ LAYER
END
CLASS
NAME "Max scale from layer"
MINSCALEDENOM 320000
MINSCALEDENOM 160000
STYLE
SYMBOL "circle"
COLOR 0 0 0
SIZE 6
END
END
CLASS
NAME "Scale 0 and max scale from layer (priority)"
NAME "Scale 0 and max scale from class"
MAXSCALEDENOM 0
MINSCALEDENOM 0
STYLE
Expand All @@ -57,9 +56,9 @@ LAYER
END
MINSCALEDENOM 6000
CLASS
NAME "Min scale from layer (priority)"
NAME "Min scale from class"
MINSCALEDENOM 10000
STYLE
MINSCALEDENOM 10000
SYMBOL "circle"
COLOR 0 0 0
SIZE 24
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/line_graphicFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const lineSimpleLine: Style = {
join: 'miter',
graphicFill: {
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#FF0000',
radius: 3.5
}
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/line_graphicStroke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const lineSimpleLine: Style = {
join: 'miter',
graphicStroke: {
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#FF0000',
radius: 3.5
}
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplecross.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimpleCross: Style = {
'name': 'Small populated New Yorks',
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Cross',
'wellKnownName': 'cross',
'color': '#FF0000',
'radius': 5,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplepoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimplePoint: Style = {
name: '',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#00FF00',
radius: 3,
fillOpacity: 0.5,
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplepoint_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const pointSimplePoint: Style = {
},
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Circle',
'wellKnownName': 'circle',
'color': '#FF0000',
'radius': 3,
'strokeColor': '#000000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const pointSimplePoint: Style = {
},
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Circle',
'wellKnownName': 'circle',
'color': '#FF0000',
'radius': 3,
'strokeColor': '#000000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const pointSimplePoint: Style = {
},
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Circle',
'wellKnownName': 'circle',
'color': '#FF0000',
'radius': 3,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplepoint_functionfilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const pointSimplePoint: Style = {
},
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Circle',
'wellKnownName': 'circle',
'color': '#FF0000',
'radius': 3,
'strokeColor': '#000000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const pointSimplePoint: Style = {
'symbolizers': [{
'color': '#FF0000',
'kind': 'Mark',
'wellKnownName': 'Circle',
'wellKnownName': 'circle',
'radius': 3,
'strokeColor': '#000000',
'strokeWidth': 2
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplesquare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimpleSquare: Style = {
'name': 'Small populated New Yorks',
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Square',
'wellKnownName': 'square',
'color': '#FF0000',
'radius': 5,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimpleStar: Style = {
'name': 'Small populated New Yorks',
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Star',
'wellKnownName': 'star',
'color': '#FF0000',
'radius': 5,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simpletriangle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimpleTriangle: Style = {
'name': 'Small populated New Yorks',
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'Triangle',
'wellKnownName': 'triangle',
'color': '#FF0000',
'radius': 5,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/point_simplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointSimpleX: Style = {
'name': 'Small populated New Yorks',
'symbolizers': [{
'kind': 'Mark',
'wellKnownName': 'X',
'wellKnownName': 'x',
'color': '#FF0000',
'radius': 5,
'strokeColor': '#000000',
Expand Down
2 changes: 1 addition & 1 deletion data/styles/exemples/polygon_graphicFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const polygonGraphicFill: Style = {
outlineDasharray: [1, 0],
graphicFill: {
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#FF0000'
}
}]
Expand Down
34 changes: 17 additions & 17 deletions data/styles/point_scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@ import { Style } from 'geostyler-style';
const pointStyle: Style = [{
name: 'point_scale',
rules: [{
name: 'Max scale from layer (priority)',
name: 'Max scale from class',
scaleDenominator: {
max: 160000,
max: 7000,
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 12,
}],
}, {
name: 'Scales from class',
name: 'Max scale from layer, min scale from class',
scaleDenominator: {
max: 320000,
min: 160000,
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 6,
}],
}, {
name: 'Max scale from layer',
scaleDenominator: {
max: 160000,
min: 320000,
max: 320000,
min: 160000,
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 3,
}],
}, {
name: 'Scale 0 and max scale from layer (priority)',
name: 'Scale 0 and max scale from class',
scaleDenominator: {
max: 160000,
max: 0,
min: 0,
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
visibility: false,
radius: 10,
}],
}],
}, {
name: 'point_scale_2',
rules: [{
name: 'Min scale from layer (priority)',
name: 'Min scale from class',
scaleDenominator: {
min: 6000,
min: 10000,
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 12,
}],
Expand All @@ -71,7 +71,7 @@ const pointStyle: Style = [{
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 6,
}],
Expand All @@ -83,7 +83,7 @@ const pointStyle: Style = [{
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
visibility: false,
radius: 3,
}],
Expand All @@ -97,7 +97,7 @@ const pointStyle: Style = [{
},
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#000000',
radius: 12,
}],
Expand Down
8 changes: 4 additions & 4 deletions data/styles/point_simple_many_classes_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pointStyle: Style = {
name: 'Test point 1',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#00FF00',
radius: 7.5
}],
Expand All @@ -19,7 +19,7 @@ const pointStyle: Style = {
name: 'Test point 2',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Triangle',
wellKnownName: 'triangle',
color: '#FF0000',
radius: 5
}],
Expand All @@ -31,7 +31,7 @@ const pointStyle: Style = {
name: 'Test point 3',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Square',
wellKnownName: 'square',
color: '#00FFFF',
radius: 5
}],
Expand All @@ -43,7 +43,7 @@ const pointStyle: Style = {
name: 'Test point 4',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Cross',
wellKnownName: 'cross',
color: '#0000FF',
radius: 5
}],
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_simple_point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pointStyle: Style = {
name: '',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#00FF00',
radius: 7.5
}]
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_simple_rgb_to_hex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pointStyle: Style = {
name: 'Test point',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#00FF00',
radius: 7.5
}]
Expand Down
2 changes: 1 addition & 1 deletion data/styles/point_st_sample_style_tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const pointStyle: Style = {
name: 'Test point',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#00FF00',
radius: 7.5,
rotate: 360,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const pointStyle: Style = {
name: 'Test point',
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle',
wellKnownName: 'circle',
color: '#FF0000',
radius: 5,
rotate: 360,
Expand Down
Loading