void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_geometries()
{
    bool largest_box_only = false;
    unsigned num_geom = feature_.num_geometries();
    for (unsigned i=0; i<num_geom; ++i)
    {
        geometry_type const& geom = feature_.get_geometry(i);

        // don't bother with empty geometries
        if (geom.size() == 0) continue;
        eGeomType type = geom.type();
        if (type == Polygon)
        {
            largest_box_only = sym_.largest_bbox_only();
            if (sym_.get_minimum_path_length() > 0)
            {
                box2d<double> gbox = t_.forward(geom.envelope(), prj_trans_);
                if (gbox.width() < sym_.get_minimum_path_length())
                {
                    continue;
                }
            }
        }
        // TODO - calculate length here as well
        geometries_to_process_.push_back(const_cast<geometry_type*>(&geom));
    }

    if (largest_box_only)
    {
        geometries_to_process_.sort(largest_bbox_first());
        geo_itr_ = geometries_to_process_.begin();
        geometries_to_process_.erase(++geo_itr_,geometries_to_process_.end());
    }
    geo_itr_ = geometries_to_process_.begin();
}
Exemple #2
0
void base_symbolizer_helper::initialize_geometries()
{
    // FIXME
    bool largest_box_only = get<value_bool>(sym_, keys::largest_box_only, feature_, vars_, false);
    double minimum_path_length = get<value_double>(sym_, keys::minimum_path_length, feature_, vars_, 0);
    for ( auto const& geom :  feature_.paths())
    {
        // don't bother with empty geometries
        if (geom.size() == 0) continue;
        mapnik::geometry_type::types type = geom.type();
        if (type == geometry_type::types::Polygon)
        {
            if (minimum_path_length > 0)
            {
                box2d<double> gbox = t_.forward(geom.envelope(), prj_trans_);
                if (gbox.width() < minimum_path_length)
                {
                    continue;
                }
            }
        }
        // TODO - calculate length here as well
        geometries_to_process_.push_back(const_cast<geometry_type*>(&geom));
    }

    if (largest_box_only)
    {
        geometries_to_process_.sort(largest_bbox_first());
        geo_itr_ = geometries_to_process_.begin();
        geometries_to_process_.erase(++geo_itr_,geometries_to_process_.end());
    }
    geo_itr_ = geometries_to_process_.begin();
}
void base_symbolizer_helper::initialize_geometries() const
{
    bool largest_box_only = text_props_->largest_bbox_only;
    double minimum_path_length = text_props_->minimum_path_length;
    util::apply_visitor(detail::split_multi_geometries<geometry_container_type>
                        (geometries_to_process_, t_, prj_trans_, minimum_path_length ), feature_.get_geometry());
    // FIXME: return early if geometries_to_process_.empty() ?
    if (largest_box_only)
    {
        geometries_to_process_.sort(largest_bbox_first());
        geo_itr_ = geometries_to_process_.begin();
        geometries_to_process_.erase(++geo_itr_, geometries_to_process_.end());
    }
    geo_itr_ = geometries_to_process_.begin();
}