style level compositing outside of feature extents in tiled rendering context #1477

Closed
springmeyer opened this Issue Sep 11, 2012 · 3 comments

Comments

Projects
None yet
1 participant
@springmeyer
Member

springmeyer commented Sep 11, 2012

Say you have a polygon that represents an area you wish to clip all visible data to. You can almost achieve this by setting the style level comp-op to dst-in. However, in a tiled rendering context this will break down. The reason is that when a layer returns no features we skip processing it's style such that the style level compositing operation is never triggered.

@springmeyer

This comment has been minimized.

Show comment Hide comment
@springmeyer

springmeyer Sep 11, 2012

Member

Looking tough to fix this due to larger issue of #1479

Member

springmeyer commented Sep 11, 2012

Looking tough to fix this due to larger issue of #1479

@springmeyer

This comment has been minimized.

Show comment Hide comment
@springmeyer

springmeyer Sep 11, 2012

Member

this fixes, if we want to try to support this usecase:

diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp
index cb4479e..942931e 100644
--- a/include/mapnik/feature_style_processor_impl.hpp
+++ b/include/mapnik/feature_style_processor_impl.hpp
@@ -269,7 +269,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
 #if defined(RENDERING_STATS)
         layer_timer.discard();
 #endif
-        return;
+        //return;
     }
     // next try intersection of layer extent back projected into map srs
     else if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext))
@@ -290,7 +290,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
 #if defined(RENDERING_STATS)
         layer_timer.discard();
 #endif
-        return;
+        //return;
     }

     // if we've got this far, now prepare the unbuffered extent
@@ -469,10 +469,8 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
             BOOST_FOREACH (feature_type_style * style, active_styles)
             {
                 featureset_ptr features = ds->features(q);
-                if (features) {
-                    render_style(lay, p, style, style_names[i++],
-                                 features, prj_trans, scale_denom);
-                }
+                render_style(lay, p, style, style_names[i++],
+                             features, prj_trans, scale_denom);
             }
         }
     }
@@ -498,6 +496,12 @@ void feature_style_processor<Processor>::render_style(

     p.start_style_processing(*style);

+    if (!features)
+    {
+        p.end_style_processing(*style);
+        return;
+    }
+
 #if defined(RENDERING_STATS)
     std::ostringstream s1;
     s1 << "rendering style for layer: '" << lay.name()
Member

springmeyer commented Sep 11, 2012

this fixes, if we want to try to support this usecase:

diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp
index cb4479e..942931e 100644
--- a/include/mapnik/feature_style_processor_impl.hpp
+++ b/include/mapnik/feature_style_processor_impl.hpp
@@ -269,7 +269,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
 #if defined(RENDERING_STATS)
         layer_timer.discard();
 #endif
-        return;
+        //return;
     }
     // next try intersection of layer extent back projected into map srs
     else if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext))
@@ -290,7 +290,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
 #if defined(RENDERING_STATS)
         layer_timer.discard();
 #endif
-        return;
+        //return;
     }

     // if we've got this far, now prepare the unbuffered extent
@@ -469,10 +469,8 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
             BOOST_FOREACH (feature_type_style * style, active_styles)
             {
                 featureset_ptr features = ds->features(q);
-                if (features) {
-                    render_style(lay, p, style, style_names[i++],
-                                 features, prj_trans, scale_denom);
-                }
+                render_style(lay, p, style, style_names[i++],
+                             features, prj_trans, scale_denom);
             }
         }
     }
@@ -498,6 +496,12 @@ void feature_style_processor<Processor>::render_style(

     p.start_style_processing(*style);

+    if (!features)
+    {
+        p.end_style_processing(*style);
+        return;
+    }
+
 #if defined(RENDERING_STATS)
     std::ostringstream s1;
     s1 << "rendering style for layer: '" << lay.name()

@springmeyer springmeyer referenced this issue in tilemill-project/tilemill Sep 14, 2012

Closed

mapnik 2.1.1 fixes #1683

@springmeyer

This comment has been minimized.

Show comment Hide comment
@springmeyer

springmeyer Sep 15, 2012

Member

it works!

Member

springmeyer commented Sep 15, 2012

it works!

springmeyer pushed a commit that referenced this issue Oct 16, 2012

PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013

when using style level compositing or image filters still trigger sty…
…le processing callbacks even if we return without querying the data if there are active rules - closes #1477

PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013

herm added a commit that referenced this issue Oct 13, 2013

Merge commit '4f2e1993bf6fb0619f2302289311e9d9a178e3dd' into hb-merge
Resolving conficts in tests later.

* commit '4f2e1993bf6fb0619f2302289311e9d9a178e3dd':
  tests: add a pseudo-tiled test for preventing regression of #1477

Conflicts:
	tests/visual_tests/test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment