save_map - support nested layers + serialize layer compositing mode

This commit is contained in:
artemp 2017-03-16 12:39:12 +00:00
parent bb19ff948e
commit a9aa1c69b8

View file

@ -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)