Skip to content

Commit

Permalink
Also show measurement labels in height profile print map
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Mar 11, 2024
1 parent d406bd7 commit b13b4ac
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions plugins/HeightProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,30 @@ class HeightProfilePrintDialog_ extends React.PureComponent {
}
};
refreshImage = () => {
const geom = {
coordinates: this.props.measurement.coordinates,
type: 'LineString'
};
const styleOptions = {
strokeColor: [255, 0, 0, 1],
strokeWidth: 4
const measurement = this.props.measurement;
const layer = {
type: 'vector',
opacity: 255,
features: [
{
type: 'Feature',
geometry: {
coordinates: measurement.coordinates,
type: 'LineString'
},
styleOptions: {
strokeColor: [255, 0, 0, 1],
strokeWidth: 4
},
properties: {
segment_labels: measurement.segment_lengths.map(length => MeasureUtils.formatMeasurement(length, false, measurement.lenUnit))
}
}
]
};

const exportParams = LayerUtils.collectPrintParams(this.props.layers, this.props.theme, this.state.scale, this.props.map.projection, true, false);
const mapCrs = this.props.map.projection;
const exportParams = LayerUtils.collectPrintParams(this.props.layers, this.props.theme, this.state.scale, mapCrs, true, false);
const highlightParams = VectorLayerUtils.createPrintHighlighParams([layer], mapCrs);
const imageParams = {
SERVICE: 'WMS',
VERSION: '1.3.0',
Expand All @@ -142,8 +156,14 @@ class HeightProfilePrintDialog_ extends React.PureComponent {
BBOX: this.props.map.bbox.bounds,
WIDTH: this.props.map.size.width,
HEIGHT: this.props.map.size.height,
HIGHLIGHT_GEOM: VectorLayerUtils.geoJSONGeomToWkt(geom, this.props.map.projection === "EPSG:4326" ? 4 : 2),
HIGHLIGHT_SYMBOL: VectorLayerUtils.createSld('LineString', 'default', styleOptions, 255),
HIGHLIGHT_GEOM: highlightParams.geoms.join(";"),
HIGHLIGHT_SYMBOL: highlightParams.styles.join(";"),
HIGHLIGHT_LABELSTRING: highlightParams.labels.join(";"),
HIGHLIGHT_LABELCOLOR: highlightParams.labelFillColors.join(";"),
HIGHLIGHT_LABELBUFFERCOLOR: highlightParams.labelOutlineColors.join(";"),
HIGHLIGHT_LABELBUFFERSIZE: highlightParams.labelOutlineSizes.join(";"),
HIGHLIGHT_LABELSIZE: highlightParams.labelSizes.join(";"),
HIGHLIGHT_LABEL_DISTANCE: highlightParams.labelDist.join(";"),
csrf_token: MiscUtils.getCsrfToken(),
...exportParams
};
Expand Down

0 comments on commit b13b4ac

Please sign in to comment.