From a9aa1c69b8eaff0ba87aad57b1d3d0bc3984f1c8 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 16 Mar 2017 12:39:12 +0000 Subject: [PATCH] save_map - support nested layers + serialize layer compositing mode --- src/save_map.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/save_map.cpp b/src/save_map.cpp index 008658849..f5825ce73 100644 --- a/src/save_map.cpp +++ b/src/save_map.cpp @@ -514,6 +514,17 @@ void serialize_layer( ptree & map_node, layer const& lyr, bool explicit_defaults set_attr( layer_node, "name", lyr.name() ); } + auto const comp_op = lyr.comp_op(); + + if (comp_op) + { + set_attr(layer_node, "comp-op", *comp_op_to_string(*comp_op)); + } + else if (explicit_defaults) + { + set_attr(layer_node, "comp-op", "src-over"); + } + if ( lyr.srs() != "" ) { set_attr( layer_node, "srs", lyr.srs() ); @@ -583,6 +594,12 @@ void serialize_layer( ptree & map_node, layer const& lyr, bool explicit_defaults { serialize_datasource( layer_node, datasource ); } + + // serialize nested layers + for (auto const& child : lyr.layers()) + { + serialize_layer(layer_node, child, explicit_defaults ); + } } void serialize_map(ptree & pt, Map const& map, bool explicit_defaults)