コード例 #1
0
    bool has_placement(box2d<double> const& box, double minimum_distance, mapnik::value_unicode_string const& text, double repeat_distance)
    {
        box2d<double> const& minimum_box = (minimum_distance > 0
                                               ? box2d<double>(box.minx() - minimum_distance, box.miny() - minimum_distance,
                                                               box.maxx() + minimum_distance, box.maxy() + minimum_distance)
                                               : box);

        box2d<double> const& repeat_box = (repeat_distance > 0
                                               ? box2d<double>(box.minx() - repeat_distance, box.miny() - repeat_distance,
                                                               box.maxx() + repeat_distance, box.maxy() + repeat_distance)
                                               : box);

        tree_t::query_iterator itr = tree_.query_in_box(repeat_distance > minimum_distance ? repeat_box : minimum_box);
        tree_t::query_iterator end = tree_.query_end();

        for ( ;itr != end; ++itr)
        {
            if (itr->box.intersects(minimum_box) || (text == itr->text && itr->box.intersects(repeat_box)))
            {
                return false;
            }
        }

        return true;
    }
コード例 #2
0
    bool has_placement(box2d<double> const& box, double margin, mapnik::value_unicode_string const& text, double repeat_distance)
    {
        // Don't bother with any of the repeat checking unless the repeat distance is greater than the margin
        if (repeat_distance <= margin) {
            return has_placement(box, margin);
        }

        box2d<double> repeat_box(box.minx() - repeat_distance, box.miny() - repeat_distance,
                                 box.maxx() + repeat_distance, box.maxy() + repeat_distance);

        box2d<double> const& margin_box = (margin > 0
                                               ? box2d<double>(box.minx() - margin, box.miny() - margin,
                                                               box.maxx() + margin, box.maxy() + margin)
                                               : box);

        tree_t::query_iterator tree_itr = tree_.query_in_box(repeat_box);
        tree_t::query_iterator tree_end = tree_.query_end();

        for ( ;tree_itr != tree_end; ++tree_itr)
        {
            if (tree_itr->get().box.intersects(margin_box) || (text == tree_itr->get().text && tree_itr->get().box.intersects(repeat_box)))
            {
                return false;
            }
        }

        return true;
    }
コード例 #3
0
 bool has_placement(box2d<double> const& box)
 {
     tree_t::query_iterator itr = tree_.query_in_box(box);
     tree_t::query_iterator end = tree_.query_end();
     for ( ;itr != end; ++itr)
     {
         if (itr->intersects(box)) return false;
     }
     tree_.insert(box,box);
     return true;
 }
コード例 #4
0
    bool has_placement(box2d<double> const& box)
    {
        tree_t::query_iterator tree_itr = tree_.query_in_box(box);
        tree_t::query_iterator tree_end = tree_.query_end();

        for ( ;tree_itr != tree_end; ++tree_itr)
        {
            if (tree_itr->get().box.intersects(box)) return false;
        }

        return true;
    }
コード例 #5
0
 bool has_placement(Envelope<double> const& box)
 {
     tree_t::query_iterator itr = tree_.query_in_box(box);
     tree_t::query_iterator end = tree_.query_end();
     
     for ( ;itr != end; ++itr)
     {
       if (itr->intersects(box))
       {
           return false;
       }
     }
     
     return true;
 }
コード例 #6
0
    bool has_point_placement(box2d<double> const& box, double distance)
    {
        box2d<double> bigger_box(box.minx() - distance, box.miny() - distance, box.maxx() + distance, box.maxy() + distance);
        tree_t::query_iterator itr = tree_.query_in_box(bigger_box);
        tree_t::query_iterator end = tree_.query_end();

        for ( ;itr != end; ++itr)
        {
            if (itr->box.intersects(bigger_box))
            {
                return false;
            }
        }

        return true;
    }
コード例 #7
0
    bool has_placement(box2d<double> const& box, mapnik::value_unicode_string const& text, double distance)
    {
        box2d<double> bigger_box(box.minx() - distance, box.miny() - distance, box.maxx() + distance, box.maxy() + distance);
        tree_t::query_iterator itr = tree_.query_in_box(bigger_box);
        tree_t::query_iterator end = tree_.query_end();

        for ( ;itr != end; ++itr)
        {
            if (itr->box.intersects(box) || (text == itr->text && itr->box.intersects(bigger_box)))
            {
                return false;
            }
        }

        return true;
    }
コード例 #8
0
    bool has_placement(box2d<double> const& box, double minimum_distance)
    {
        box2d<double> const& minimum_box = (minimum_distance > 0
                                               ? box2d<double>(box.minx() - minimum_distance, box.miny() - minimum_distance,
                                                               box.maxx() + minimum_distance, box.maxy() + minimum_distance)
                                               : box);

        tree_t::query_iterator itr = tree_.query_in_box(minimum_box);
        tree_t::query_iterator end = tree_.query_end();

        for (;itr != end; ++itr)
        {
            if (itr->box.intersects(minimum_box))
            {
                return false;
            }
        }
        return true;
    }
コード例 #9
0
    bool has_placement(box2d<double> const& box, double margin)
    {
        box2d<double> const& margin_box = (margin > 0
                                               ? box2d<double>(box.minx() - margin, box.miny() - margin,
                                                               box.maxx() + margin, box.maxy() + margin)
                                               : box);

        tree_t::query_iterator tree_itr = tree_.query_in_box(margin_box);
        tree_t::query_iterator tree_end = tree_.query_end();

        for (;tree_itr != tree_end; ++tree_itr)
        {
            if (tree_itr->get().box.intersects(margin_box))
            {
                return false;
            }
        }
        return true;
    }
コード例 #10
0
 query_iterator begin() { return tree_.query_in_box(extent()); }