Skip to content

Commit

Permalink
Merge pull request #412 from KaiVolland/allow-overlap
Browse files Browse the repository at this point in the history
Add support for allowOverlap in TextSymbolizer
  • Loading branch information
KaiVolland authored Sep 23, 2021
2 parents 297a960 + 3527094 commit 13ab0d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/OlStyleParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@ export class OlStyleParser implements StyleParser {
* @param {OlStyle} olStyle The OpenLayers Style object
* @return {TextSymbolizer} The GeoStyler-Style TextSymbolizer
*/
getTextSymbolizerFromOlStyle(olStyle: any): TextSymbolizer {
getTextSymbolizerFromOlStyle(olStyle: OlStyle): 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();
const rotation = olTextStyle.getRotation();
const allowOverlap = olTextStyle.getOverflow() ? olTextStyle.getOverflow() : undefined;
const text = olTextStyle.getText();
let fontStyleWeightSize: string;
let fontSizePart: string[];
Expand All @@ -300,6 +301,7 @@ export class OlStyleParser implements StyleParser {
return {
kind: 'Text',
label: text,
allowOverlap,
color: olFillStyle ? OlStyleUtil.getHexColor(olFillStyle.getColor() as string) : undefined,
size: isFinite(fontSize) ? fontSize : undefined,
font: fontFamily,
Expand Down Expand Up @@ -1031,6 +1033,7 @@ export class OlStyleParser implements StyleParser {
OlStyleUtil.getRgbaColor(symbolizer.haloColor, symbolizer.opacity) : symbolizer.haloColor,
width: symbolizer.haloWidth ? symbolizer.haloWidth : 0
}),
overflow: symbolizer.allowOverlap,
offsetX: symbolizer.offset ? symbolizer.offset[0] : 0,
offsetY: symbolizer.offset ? symbolizer.offset[1] : 0,
rotation: symbolizer.rotate ? symbolizer.rotate * Math.PI / 180 : undefined
Expand Down

0 comments on commit 13ab0d5

Please sign in to comment.