void feature_style_processor<Processor>::apply(mapnik::layer const& lyr,
                                               std::set<std::string>& names,
                                               double scale_denom)
{
    Processor & p = static_cast<Processor&>(*this);
    p.start_map_processing(m_);
    projection proj(m_.srs(),true);
    if (scale_denom <= 0.0)
        scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
    scale_denom *= p.scale_factor();

    if (lyr.visible(scale_denom))
    {
        apply_to_layer(lyr,
                       p,
                       proj,
                       m_.scale(),
                       scale_denom,
                       m_.width(),
                       m_.height(),
                       m_.get_current_extent(),
                       m_.buffer_size(),
                       names);
    }
    p.end_map_processing(m_);
}
Exemplo n.º 2
0
    void apply()
    {
#ifdef MAPNIK_DEBUG           
        //mapnik::wall_clock_progress_timer t(std::clog, "map rendering took: ");
#endif          
        Processor & p = static_cast<Processor&>(*this);
        p.start_map_processing(m_);
                       
        try
        {
            projection proj(m_.srs()); // map projection

            Map::const_metawriter_iterator metaItr = m_.begin_metawriters();
            Map::const_metawriter_iterator metaItrEnd = m_.end_metawriters();
            for (;metaItr!=metaItrEnd; ++metaItr)
            {
                metaItr->second->set_size(m_.width(), m_.height());
                metaItr->second->set_map_srs(proj);
                metaItr->second->start(m_.metawriter_output_properties);
            }

            double scale_denom = mapnik::scale_denominator(m_,proj.is_geographic());
            scale_denom *= scale_factor_;
#ifdef MAPNIK_DEBUG
            std::clog << "scale denominator = " << scale_denom << "\n";
#endif
            BOOST_FOREACH ( layer const& lyr, m_.layers() )
            {
                if (lyr.isVisible(scale_denom))
                {
                    apply_to_layer(lyr, p, proj, scale_denom);
                }
            }

            metaItr = m_.begin_metawriters();
            for (;metaItr!=metaItrEnd; ++metaItr)
            {
                metaItr->second->stop();
            }
        }
        catch (proj_init_error& ex)
        {
            std::clog << "proj_init_error:" << ex.what() << "\n"; 
        }
        
        p.end_map_processing(m_);
    }   
	void apply()
	{
	    timer clock;
	    Processor & p = static_cast<Processor&>(*this);

	    p.start_map_processing(m_);
	    
	    std::vector<Layer>::const_iterator itr = m_.layers().begin();
	    while (itr != m_.layers().end())
	    {
		if (itr->isVisible(m_.scale()) && 
		    itr->envelope().intersects(m_.getCurrentExtent()))
		{
		    apply_to_layer(*itr,p);
		}
		++itr;
	    }
	    
	    p.end_map_processing(m_);
	    
	    clock.stop();
	    
	}