qgis/qwc2-demo-app

Export Selection to redlining

Opened this issue · 2 comments

Actually it's possible to export selection to file/clipboard.

Wouldn't it be nice to be able to export the current selection to a redlining layer, in order to let user modify some elements before printing/export to image.

It may be added as a new button in this section ?
image

Yes why not, potentially one could add a "Add to redlining layer" button where one can pick an existing layer or a create a new one.

Hello @manisandro,

I made a custom exporter (using js/IdentifyExtensions.js) for our own needs regarding this issue.

export const customExporters = [
    {
        id: "exportEdition",
        title: "Dessin",
        export: function(features) {
            Object.keys(features).forEach(key => {
                let data = features[key];
                const layer = {
                    id: "dessin",
                    role: LayerRole.USERLAYER,
                    title:"Dessin",
                };
                const layerFeatures = [];
                if (Array.isArray(data)) {
                    data.forEach(item => {
                            if (item.geometry) {
                                item.crs = item.crs;
                                item.styleName = 'default';
                                item.styleOptions = {
                                    fillColor:  [242, 151, 84, 0.30],
                                    strokeColor: [242, 151, 84, 0.75],
                                    strokeWidth: 2,
                                    strokeDash: []
                                };
                                layerFeatures.push(item);
                            }
                    });
                }
                window.qwc2.addLayerFeatures(layer, layerFeatures, false)
            });
        }
    }
];

Would it be interesting for you if I modified it a little to integrate it into the default exporters?
Regards, Clément.