diff --git a/data/qmls/line_simple.qml b/data/qmls/line_simple.qml index 3f6eff71..5cd81b2e 100644 --- a/data/qmls/line_simple.qml +++ b/data/qmls/line_simple.qml @@ -1,5 +1,5 @@ - + @@ -7,15 +7,35 @@ - - - - - - - - - + diff --git a/data/qmls/no_symbolizer.qml b/data/qmls/no_symbolizer.qml index 554c0244..2a64766d 100644 --- a/data/qmls/no_symbolizer.qml +++ b/data/qmls/no_symbolizer.qml @@ -1,4 +1,7 @@ - - + + + 0 + 0 + 1 diff --git a/data/qmls/point_categories.qml b/data/qmls/point_categories.qml index d07ad43e..7e77c349 100644 --- a/data/qmls/point_categories.qml +++ b/data/qmls/point_categories.qml @@ -1,163 +1,215 @@ - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - + 0 + 0 + 0 diff --git a/data/qmls/point_external_graphic.qml b/data/qmls/point_external_graphic.qml index b5f29d82..674651b3 100644 --- a/data/qmls/point_external_graphic.qml +++ b/data/qmls/point_external_graphic.qml @@ -1,20 +1,51 @@ - - + + - + - - - - - - - - + + + + + + + + + + 0 + 0 + 0 diff --git a/data/qmls/point_label.qml b/data/qmls/point_label.qml index b2518c97..ce7a23a6 100644 --- a/data/qmls/point_label.qml +++ b/data/qmls/point_label.qml @@ -1,14 +1,7 @@ - - - - - - - - - - - - + + + 0 + 0 + 0 diff --git a/data/qmls/point_multiple_symbols.qml b/data/qmls/point_multiple_symbols.qml index def659e7..8406eb14 100644 --- a/data/qmls/point_multiple_symbols.qml +++ b/data/qmls/point_multiple_symbols.qml @@ -1,38 +1,82 @@ - - + + - + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - + + + + + + 0 + 0 + 0 diff --git a/data/qmls/point_ranges.qml b/data/qmls/point_ranges.qml index f0b7bfcc..31eaabc1 100644 --- a/data/qmls/point_ranges.qml +++ b/data/qmls/point_ranges.qml @@ -1,201 +1,273 @@ - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - + - - + + + + + + + - + 0 + 0 + 0 diff --git a/data/qmls/point_rules.qml b/data/qmls/point_rules.qml index 015197ee..05ac68a3 100644 --- a/data/qmls/point_rules.qml +++ b/data/qmls/point_rules.qml @@ -1,57 +1,132 @@ - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + 0 diff --git a/data/qmls/point_simple.qml b/data/qmls/point_simple.qml index cdf96047..ac956ba3 100644 --- a/data/qmls/point_simple.qml +++ b/data/qmls/point_simple.qml @@ -1,25 +1,52 @@ - - + + - + - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + 0 diff --git a/data/qmls/polygon_simple.qml b/data/qmls/polygon_simple.qml index 1522635f..035ad7a6 100644 --- a/data/qmls/polygon_simple.qml +++ b/data/qmls/polygon_simple.qml @@ -1,23 +1,44 @@ - - + + - + - - - - - - - - - - - + + + + + + + + + + 0 + 0 + 2 diff --git a/data/qmls/polygon_simple_nostyle.qml b/data/qmls/polygon_simple_nostyle.qml index 1af90a75..45be6999 100644 --- a/data/qmls/polygon_simple_nostyle.qml +++ b/data/qmls/polygon_simple_nostyle.qml @@ -1,23 +1,44 @@ - - + + - + - - - - - - - - - - - + + + + + + + + + + 0 + 0 + 2 diff --git a/data/qmls/text_text_buffer.qml b/data/qmls/text_text_buffer.qml index f1e57608..ce7a23a6 100644 --- a/data/qmls/text_text_buffer.qml +++ b/data/qmls/text_text_buffer.qml @@ -1,15 +1,7 @@ - - - - - - - - - - - - - + + + 0 + 0 + 0 diff --git a/data/qmls_old/line_simple.qml b/data/qmls_old/line_simple.qml new file mode 100644 index 00000000..3f6eff71 --- /dev/null +++ b/data/qmls_old/line_simple.qml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/no_symbolizer.qml b/data/qmls_old/no_symbolizer.qml new file mode 100644 index 00000000..554c0244 --- /dev/null +++ b/data/qmls_old/no_symbolizer.qml @@ -0,0 +1,4 @@ + + + + diff --git a/data/qmls_old/point_categories.qml b/data/qmls_old/point_categories.qml new file mode 100644 index 00000000..d07ad43e --- /dev/null +++ b/data/qmls_old/point_categories.qml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_external_graphic.qml b/data/qmls_old/point_external_graphic.qml new file mode 100644 index 00000000..b5f29d82 --- /dev/null +++ b/data/qmls_old/point_external_graphic.qml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_label.qml b/data/qmls_old/point_label.qml new file mode 100644 index 00000000..b2518c97 --- /dev/null +++ b/data/qmls_old/point_label.qml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_multiple_symbols.qml b/data/qmls_old/point_multiple_symbols.qml new file mode 100644 index 00000000..def659e7 --- /dev/null +++ b/data/qmls_old/point_multiple_symbols.qml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_ranges.qml b/data/qmls_old/point_ranges.qml new file mode 100644 index 00000000..f0b7bfcc --- /dev/null +++ b/data/qmls_old/point_ranges.qml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_rules.qml b/data/qmls_old/point_rules.qml new file mode 100644 index 00000000..015197ee --- /dev/null +++ b/data/qmls_old/point_rules.qml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/point_simple.qml b/data/qmls_old/point_simple.qml new file mode 100644 index 00000000..cdf96047 --- /dev/null +++ b/data/qmls_old/point_simple.qml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/polygon_simple.qml b/data/qmls_old/polygon_simple.qml new file mode 100644 index 00000000..1522635f --- /dev/null +++ b/data/qmls_old/polygon_simple.qml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/polygon_simple_nostyle.qml b/data/qmls_old/polygon_simple_nostyle.qml new file mode 100644 index 00000000..1af90a75 --- /dev/null +++ b/data/qmls_old/polygon_simple_nostyle.qml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/qmls_old/text_text_buffer.qml b/data/qmls_old/text_text_buffer.qml new file mode 100644 index 00000000..f1e57608 --- /dev/null +++ b/data/qmls_old/text_text_buffer.qml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/data/styles/line_simple.ts b/data/styles/line_simple.ts index 62724d6a..09fe7cca 100644 --- a/data/styles/line_simple.ts +++ b/data/styles/line_simple.ts @@ -6,10 +6,10 @@ const pointSimple: Style = { name: 'QGIS Simple Symbol', symbolizers: [{ kind: 'Line', + cap: 'square', color: '#FF00FF', width: 3, dasharray: [12, 12], - cap: 'square', join: 'round', perpendicularOffset: 2, opacity: 1 diff --git a/src/QGISStyleParser.ts b/src/QGISStyleParser.ts index 09922c06..ea6113fd 100644 --- a/src/QGISStyleParser.ts +++ b/src/QGISStyleParser.ts @@ -49,6 +49,13 @@ type QmlProp = { }; }; +type QmlOption = { + $: { + name: string; + value: string; + }; +}; + type QmlRule = { $: { filter?: string; @@ -173,11 +180,16 @@ export class QGISStyleParser implements StyleParser { */ qmlSymbolizerLayerPropsToObject(qmlSymbolizer: any) { const qmlMarkerProps: any = {}; - qmlSymbolizer.prop.forEach((prop: QmlProp) => { - const key = prop.$.k; - const value = prop.$.v; + qmlSymbolizer.Option[0].Option.forEach((option: QmlOption) => { + const key = option.$.name; + const value = option.$.value; qmlMarkerProps[key] = value; }); + // qmlSymbolizer.prop.forEach((prop: QmlProp) => { + // const key = prop.$.k; + // const value = prop.$.v; + // qmlMarkerProps[key] = value; + // }); return qmlMarkerProps; } @@ -809,7 +821,13 @@ export class QGISStyleParser implements StyleParser { $: { class: 'SimpleLine' }, - prop: this.propsObjectToQmlSymbolProps(qmlProps) + // QGIS Styles are from 228 nested inside a parent Option tag + Option: { + $: { + type: 'Map' + }, + Option: this.propsObjectToQmlSymbolProps(qmlProps) + } }; } @@ -841,7 +859,7 @@ export class QGISStyleParser implements StyleParser { $: { class: 'SimpleFill' }, - prop: this.propsObjectToQmlSymbolProps(qmlProps) + Option: this.propsObjectToQmlSymbolProps(qmlProps) }; } @@ -891,7 +909,7 @@ export class QGISStyleParser implements StyleParser { $: { class: 'SvgMarker' }, - prop: this.propsObjectToQmlSymbolProps(qmlProps) + Option: this.propsObjectToQmlSymbolProps(qmlProps) }; } @@ -929,7 +947,7 @@ export class QGISStyleParser implements StyleParser { $: { class: 'SimpleMarker' }, - prop: this.propsObjectToQmlSymbolProps(qmlProps) + Option: this.propsObjectToQmlSymbolProps(qmlProps) }; } @@ -937,16 +955,16 @@ export class QGISStyleParser implements StyleParser { * * @param properties */ - propsObjectToQmlSymbolProps(properties: any): QmlProp[] { + propsObjectToQmlSymbolProps(properties: any): QmlOption[] { return Object.keys(properties).map(k => { const v = properties[k]; return { $: { - k, - v + value: v, + name: k } }; - }).filter(s => s.$.v !== undefined); + }).filter(s => s.$.value !== undefined); } /** @@ -962,7 +980,9 @@ export class QGISStyleParser implements StyleParser { if (rules.length > 0 || symbols.length > 0) { return { qgis: { - $: {}, + $: { + styleCategories: 'Symbology' + }, 'renderer-v2': [{ $: { type