Merge branch 'master' into harfbuzz
This commit is contained in:
commit
fa62234179
6 changed files with 71 additions and 30 deletions
|
@ -8,6 +8,8 @@ For a complete change history, see the git log.
|
||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
|
- Allow style level compositing operations to work outside of featureset extents across tiled requests (#1477)
|
||||||
|
|
||||||
- Support for encoding `literal` postgres types as strings 69fb17cd3/#1466
|
- Support for encoding `literal` postgres types as strings 69fb17cd3/#1466
|
||||||
|
|
||||||
- Fixed zoom_all behavior when Map maximum-extent is provided. Previously maximum-extent was used outright but
|
- Fixed zoom_all behavior when Map maximum-extent is provided. Previously maximum-extent was used outright but
|
||||||
|
|
|
@ -698,8 +698,8 @@ class _TextSymbolizer(TextSymbolizer,_injector):
|
||||||
if isinstance(self.properties.format_tree, FormattingText):
|
if isinstance(self.properties.format_tree, FormattingText):
|
||||||
return self.properties.format_tree.text
|
return self.properties.format_tree.text
|
||||||
else:
|
else:
|
||||||
return None # This text symbolizer is using complex formatting features.
|
|
||||||
# There is no single expression which could be returned as name
|
# There is no single expression which could be returned as name
|
||||||
|
raise RuntimeError("TextSymbolizer uses complex formatting features, but old compatibility interface is used to access it. Use self.properties.format_tree instead.")
|
||||||
|
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, name):
|
def name(self, name):
|
||||||
|
|
|
@ -256,6 +256,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
|
|
||||||
box2d<double> layer_ext = lay.envelope();
|
box2d<double> layer_ext = lay.envelope();
|
||||||
bool fw_success = false;
|
bool fw_success = false;
|
||||||
|
bool early_return = false;
|
||||||
|
|
||||||
// first, try intersection of map extent forward projected into layer srs
|
// first, try intersection of map extent forward projected into layer srs
|
||||||
if (prj_trans.forward(buffered_query_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext))
|
if (prj_trans.forward(buffered_query_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext))
|
||||||
|
@ -266,10 +267,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
// if no intersection and projections are also equal, early return
|
// if no intersection and projections are also equal, early return
|
||||||
else if (prj_trans.equal())
|
else if (prj_trans.equal())
|
||||||
{
|
{
|
||||||
#if defined(RENDERING_STATS)
|
early_return = true;
|
||||||
layer_timer.discard();
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// next try intersection of layer extent back projected into map srs
|
// 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))
|
else if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext))
|
||||||
|
@ -278,7 +276,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
// forward project layer extent back into native projection
|
// forward project layer extent back into native projection
|
||||||
if (! prj_trans.forward(layer_ext, PROJ_ENVELOPE_POINTS))
|
if (! prj_trans.forward(layer_ext, PROJ_ENVELOPE_POINTS))
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(feature_style_processor)
|
MAPNIK_LOG_ERROR(feature_style_processor)
|
||||||
<< "feature_style_processor: Layer=" << lay.name()
|
<< "feature_style_processor: Layer=" << lay.name()
|
||||||
<< " extent=" << layer_ext << " in map projection "
|
<< " extent=" << layer_ext << " in map projection "
|
||||||
<< " did not reproject properly back to layer projection";
|
<< " did not reproject properly back to layer projection";
|
||||||
|
@ -287,6 +285,31 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if no intersection then nothing to do for layer
|
// if no intersection then nothing to do for layer
|
||||||
|
early_return = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (early_return)
|
||||||
|
{
|
||||||
|
// check for styles needing compositing operations applied
|
||||||
|
// https://github.com/mapnik/mapnik/issues/1477
|
||||||
|
BOOST_FOREACH(std::string const& style_name, style_names)
|
||||||
|
{
|
||||||
|
boost::optional<feature_type_style const&> style=m_.find_style(style_name);
|
||||||
|
if (!style)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (style->comp_op() || style->image_filters().size() > 0)
|
||||||
|
{
|
||||||
|
if (style->active(scale_denom))
|
||||||
|
{
|
||||||
|
std::clog << "triggering\n";
|
||||||
|
// trigger any needed compositing ops
|
||||||
|
p.start_style_processing(*style);
|
||||||
|
p.end_style_processing(*style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#if defined(RENDERING_STATS)
|
#if defined(RENDERING_STATS)
|
||||||
layer_timer.discard();
|
layer_timer.discard();
|
||||||
#endif
|
#endif
|
||||||
|
@ -344,9 +367,8 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<rule>& rules=(*style).get_rules();
|
std::vector<rule> const& rules=(*style).get_rules();
|
||||||
bool active_rules=false;
|
bool active_rules=false;
|
||||||
|
|
||||||
BOOST_FOREACH(rule const& r, rules)
|
BOOST_FOREACH(rule const& r, rules)
|
||||||
{
|
{
|
||||||
if (r.active(scale_denom))
|
if (r.active(scale_denom))
|
||||||
|
@ -444,16 +466,16 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
}
|
}
|
||||||
else if (cache_features)
|
else if (cache_features)
|
||||||
{
|
{
|
||||||
|
memory_datasource cache;
|
||||||
featureset_ptr features = ds->features(q);
|
featureset_ptr features = ds->features(q);
|
||||||
if (features) {
|
if (features) {
|
||||||
// Cache all features into the memory_datasource before rendering.
|
// Cache all features into the memory_datasource before rendering.
|
||||||
memory_datasource cache;
|
|
||||||
feature_ptr feature;
|
feature_ptr feature;
|
||||||
while ((feature = features->next()))
|
while ((feature = features->next()))
|
||||||
{
|
{
|
||||||
cache.push(feature);
|
cache.push(feature);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
BOOST_FOREACH (feature_type_style * style, active_styles)
|
BOOST_FOREACH (feature_type_style * style, active_styles)
|
||||||
{
|
{
|
||||||
|
@ -461,18 +483,14 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
cache.features(q), prj_trans, scale_denom);
|
cache.features(q), prj_trans, scale_denom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// We only have a single style and no grouping.
|
// We only have a single style and no grouping.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
BOOST_FOREACH (feature_type_style * style, active_styles)
|
BOOST_FOREACH (feature_type_style * style, active_styles)
|
||||||
{
|
{
|
||||||
featureset_ptr features = ds->features(q);
|
|
||||||
if (features) {
|
|
||||||
render_style(lay, p, style, style_names[i++],
|
render_style(lay, p, style, style_names[i++],
|
||||||
features, prj_trans, scale_denom);
|
ds->features(q), prj_trans, scale_denom);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,8 +513,12 @@ void feature_style_processor<Processor>::render_style(
|
||||||
proj_transform const& prj_trans,
|
proj_transform const& prj_trans,
|
||||||
double scale_denom)
|
double scale_denom)
|
||||||
{
|
{
|
||||||
|
|
||||||
p.start_style_processing(*style);
|
p.start_style_processing(*style);
|
||||||
|
if (!features)
|
||||||
|
{
|
||||||
|
p.end_style_processing(*style);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(RENDERING_STATS)
|
#if defined(RENDERING_STATS)
|
||||||
std::ostringstream s1;
|
std::ostringstream s1;
|
||||||
|
|
|
@ -72,17 +72,17 @@ public:
|
||||||
feature_type_style& operator=(feature_type_style const& rhs);
|
feature_type_style& operator=(feature_type_style const& rhs);
|
||||||
|
|
||||||
void add_rule(rule const& rule);
|
void add_rule(rule const& rule);
|
||||||
|
|
||||||
rules const& get_rules() const;
|
rules const& get_rules() const;
|
||||||
rule_ptrs const& get_if_rules(double scale_denom);
|
rule_ptrs const& get_if_rules(double scale_denom);
|
||||||
rule_ptrs const& get_else_rules(double scale_denom);
|
rule_ptrs const& get_else_rules(double scale_denom);
|
||||||
rule_ptrs const& get_also_rules(double scale_denom);
|
rule_ptrs const& get_also_rules(double scale_denom);
|
||||||
|
|
||||||
rules& get_rules_nonconst();
|
rules& get_rules_nonconst();
|
||||||
|
|
||||||
void set_filter_mode(filter_mode_e mode);
|
bool active(double scale_denom) const;
|
||||||
|
|
||||||
|
void set_filter_mode(filter_mode_e mode);
|
||||||
filter_mode_e get_filter_mode() const;
|
filter_mode_e get_filter_mode() const;
|
||||||
|
|
||||||
// filters
|
// filters
|
||||||
std::vector<filter::filter_type> const& image_filters() const;
|
std::vector<filter::filter_type> const& image_filters() const;
|
||||||
std::vector<filter::filter_type> & image_filters();
|
std::vector<filter::filter_type> & image_filters();
|
||||||
|
|
|
@ -339,10 +339,12 @@ void sqlite_datasource::bind() const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "Sqlite Plugin: key_field is empty for "
|
s << "Sqlite Plugin: could not generate spatial index"
|
||||||
<< geometry_field_
|
<< " for table '" << geometry_table_ << "'"
|
||||||
<< " and "
|
<< " as no primary key can be detected."
|
||||||
<< geometry_table_;
|
<< " You should either declare an INTEGER PRIMARY KEY"
|
||||||
|
<< " or set the 'key_field' option to force a"
|
||||||
|
<< " given field to be used as the primary key";
|
||||||
throw datasource_exception(s.str());
|
throw datasource_exception(s.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include <mapnik/feature_type_style.hpp>
|
#include <mapnik/feature_type_style.hpp>
|
||||||
|
|
||||||
|
// boost
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -89,6 +92,18 @@ rules& feature_type_style::get_rules_nonconst()
|
||||||
return rules_;
|
return rules_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool feature_type_style::active(double scale_denom) const
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(rule const& r, rules_)
|
||||||
|
{
|
||||||
|
if (r.active(scale_denom))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void feature_type_style::set_filter_mode(filter_mode_e mode)
|
void feature_type_style::set_filter_mode(filter_mode_e mode)
|
||||||
{
|
{
|
||||||
filter_mode_ = mode;
|
filter_mode_ = mode;
|
||||||
|
|
Loading…
Reference in a new issue