diff --git a/web/client/components/print/MapPreview.jsx b/web/client/components/print/MapPreview.jsx
index e0027e65aa..9db58d0332 100644
--- a/web/client/components/print/MapPreview.jsx
+++ b/web/client/components/print/MapPreview.jsx
@@ -87,18 +87,20 @@ class MapPreview extends React.Component {
})
});
};
-
- renderLayerContent = (layer) => {
+ renderLayerContent = (layer, projection) => {
if (layer.features && layer.type === "vector") {
return layer.features.map( (feature) => {
return (
+ layerStyle={layer.style}
+ style={ feature.style || layer.style || null }
+ properties={feature.properties}/>
);
});
}
@@ -132,7 +134,7 @@ class MapPreview extends React.Component {
{this.props.layers.map((layer, index) =>
(
- {this.renderLayerContent(layer)}
+ {this.renderLayerContent(layer, projection)}
)
)}
diff --git a/web/client/utils/PrintUtils.js b/web/client/utils/PrintUtils.js
index a1e91237b1..527faca410 100644
--- a/web/client/utils/PrintUtils.js
+++ b/web/client/utils/PrintUtils.js
@@ -326,8 +326,12 @@ const PrintUtils = {
})
}
},
+ rgbaTorgb: (rgba = "") => {
+ return rgba.indexOf("rgba") !== -1 ? `rgb${rgba.slice(rgba.indexOf("("), rgba.lastIndexOf(","))})` : rgba;
+ },
/**
* Useful for print (Or generic Openlayers 2 conversion style)
+ * http://dev.openlayers.org/docs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector.OpenLayers.Feature.Vector.style
*/
toOpenLayers2Style: function(layer, style) {
if (!style) {
@@ -335,14 +339,14 @@ const PrintUtils = {
}
// commented the available options.
return {
- "fillColor": style.fillColor,
+ "fillColor": PrintUtils.rgbaTorgb(style.fillColor),
"fillOpacity": style.fillOpacity,
// "rotation": "30",
"externalGraphic": style.iconUrl,
// "graphicName": "circle",
// "graphicOpacity": 0.4,
"pointRadius": style.radius,
- "strokeColor": style.color,
+ "strokeColor": PrintUtils.rgbaTorgb(style.fillColor),
"strokeOpacity": style.opacity,
"strokeWidth": style.weight
// "strokeLinecap": "round",
diff --git a/web/client/utils/__tests__/PrintUtils-test.js b/web/client/utils/__tests__/PrintUtils-test.js
index 0afa1d2360..39da2c95ad 100644
--- a/web/client/utils/__tests__/PrintUtils-test.js
+++ b/web/client/utils/__tests__/PrintUtils-test.js
@@ -190,4 +190,9 @@ describe('PrintUtils', () => {
expect(printSpec.dpi).toBe(96);
expect(printSpec.layers.length).toBe(1);
});
+ it('from rgba to rgb', () => {
+ const rgb = PrintUtils.rgbaTorgb("rgba(255, 255, 255, 0.1)");
+ expect(rgb).toExist();
+ expect(rgb).toBe("rgb(255, 255, 255)");
+ });
});