Skip to content

Commit

Permalink
Merge pull request #31 from geoblocks/text-symbolizer
Browse files Browse the repository at this point in the history
Add Text customizer.
  • Loading branch information
ismailsunni authored Apr 30, 2024
2 parents b5248dd + 34361f4 commit a29da75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/BaseCustomizer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import type {Geometry} from 'ol/geom.js';
import type {State} from 'ol/layer/Layer.js';
import type {WMTS, TileWMS} from 'ol/source.js';
import type {Image, Stroke} from 'ol/style.js';
import type {MFPWmsLayer, MFPSymbolizerLine, MFPSymbolizerPoint, MFPWmtsLayer} from './types';
import type {Image, Stroke, Text} from 'ol/style.js';
import type {
MFPWmsLayer,
MFPSymbolizerLine,
MFPSymbolizerPoint,
MFPWmtsLayer,
MFPSymbolizerText,
} from './types';
import type {Feature as GeoJSONFeature} from 'geojson';

/**
Expand Down Expand Up @@ -71,6 +77,14 @@ export default class BaseCustomizer {
*/
point(layerState: State, symbolizer: MFPSymbolizerPoint, image: Image) {}

/**
* Can be used to manipulate the text symbolizers
* @param layerState
* @param symbolizer
* @param text
*/
text(layerState: State, symbolizer: MFPSymbolizerText, text: Text) {}

/**
* Can be used to manipulate a converted WMTS layer
* @param layerState
Expand Down
1 change: 1 addition & 0 deletions src/VectorEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ export default class VectorEncoder {
symbolizer.haloRadius = strokeWidth;
}
}
this.customizer_.text(this.layerState_, symbolizer, textStyle);
symbolizers.push(symbolizer);
}
}
Expand Down

0 comments on commit a29da75

Please sign in to comment.