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

Add WellKnownName's to support extra styles from QGIS #828

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 19 additions & 12 deletions data/olStyles/function_boolean.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import OlStyle from 'ol/style/Style';
import OlStyleCircle from 'ol/style/Circle';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg } from '../../src/Util/OlSvgPoints';

let svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 20
});

export const olBoolean1 = new OlStyle({
image: new OlStyleCircle({
radius: 10,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 12
});

export const olBoolean2 = new OlStyle({
image: new OlStyleCircle({
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});
44 changes: 27 additions & 17 deletions data/olStyles/function_case.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
import OlStyle from 'ol/style/Style';
import OlStyleCircle from 'ol/style/Circle';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg } from '../../src/Util/OlSvgPoints';

let svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 4
});

export const olCase1 = new OlStyle({
image: new OlStyleCircle({
radius: 2,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 10
});

export const olCase2 = new OlStyle({
image: new OlStyleCircle({
radius: 5,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 20
});

export const olCase3 = new OlStyle({
image: new OlStyleCircle({
radius: 10,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});
24 changes: 11 additions & 13 deletions data/olStyles/function_markSymbolizer.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleStroke from 'ol/style/Stroke';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg } from '../../src/Util/OlSvgPoints';

let svg = getShapeSvg('cross', {
stroke: '#FF0000',
dimensions: Math.PI * 2
});

const olFunctionMark = new OlStyle({
image: new OlStyleRegularshape({
points: 4,
radius: Math.PI,
radius2: 0,
fill: new OlStyleFill({
color: '#FF0000'
}),
stroke: new OlStyleStroke({
color: '#000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
31 changes: 19 additions & 12 deletions data/olStyles/multi_twoRulesSimplepoint.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import OlStyle from 'ol/style/Style';
import OlStyleCircle from 'ol/style/Circle';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg } from '../../src/Util/OlSvgPoints';

let svg = getShapeSvg('circle', {
fill: '#FF0000',
dimensions: 12
});

const olSimplePoint1 = new OlStyle({
image: new OlStyleCircle({
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

svg = getShapeSvg('circle', {
fill: '#FF1111',
dimensions: 8
});

const olSimplePoint2 = new OlStyle({
image: new OlStyleCircle({
radius: 4,
fill: new OlStyleFill({
color: '#FF1111'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
26 changes: 15 additions & 11 deletions data/olStyles/point_simplebackslash.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const olSimpleSlash = new OlStyle({
image: new OlStyleRegularshape({
points: 2,
angle: 2 * Math.PI - (Math.PI / 4),
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
const shape = removeDuplicateShapes('shape://backslash');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimpleBackSlash = new OlStyle({
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

export default olSimpleSlash;
export default olSimpleBackSlash;
22 changes: 13 additions & 9 deletions data/olStyles/point_simplecarrow.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('shape://carrow');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimpleCarrow = new OlStyle({
image: new OlStyleRegularshape({
points: 3,
angle: Math.PI / 2,
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
22 changes: 13 additions & 9 deletions data/olStyles/point_simplecross.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('cross');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimpleCross = new OlStyle({
image: new OlStyleRegularshape({
points: 4,
radius: 6,
radius2: 0,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
20 changes: 13 additions & 7 deletions data/olStyles/point_simpledot.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleCircle from 'ol/style/Circle';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('shape://dot');

const svg = getShapeSvg(shape, {
fill: '#FF0000',
dimensions: 12
});

const olSimpleDot = new OlStyle({
image: new OlStyleCircle({
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
22 changes: 13 additions & 9 deletions data/olStyles/point_simplehorline.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('shape://horline');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimpleHorline = new OlStyle({
image: new OlStyleRegularshape({
points: 2,
angle: Math.PI / 2,
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
22 changes: 13 additions & 9 deletions data/olStyles/point_simpleoarrow.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleRegularshape from 'ol/style/RegularShape';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('shape://oarrow');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimpleOarrow = new OlStyle({
image: new OlStyleRegularshape({
points: 3,
angle: Math.PI / 2,
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
})
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous'
})
});

Expand Down
20 changes: 13 additions & 7 deletions data/olStyles/point_simpleoffset.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import OlStyle from 'ol/style/Style';
import OlStyleCircle from 'ol/style/Circle';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';
import OlStyleUtil from '../../src/Util/OlStyleUtil';
import { getShapeSvg, removeDuplicateShapes } from '../../src/Util/OlSvgPoints';

const shape = removeDuplicateShapes('circle');

const svg = getShapeSvg(shape, {
stroke: '#FF0000',
dimensions: 12
});

const olSimplePoint = new OlStyle({
image: new OlStyleCircle({
radius: 6,
fill: new OlStyleFill({
color: '#FF0000'
}),
image: new OlStyleIcon({
src: OlStyleUtil.getEncodedSvg(svg),
crossOrigin: 'anonymous',
displacement: [1,1]
})
});
Expand Down
Loading