示例#1
0
 void check_my_map() {
     assert(my_range.begin() <= my_range.end());
     for(Flagged_map_t::iterator ci = my_map1.begin(); ci != my_map1.end(); ++ci) {
         RPolygon *rp = ci->p();
         assert(rp->xmax() >= my_range.begin());
         assert(rp->xmin() < my_range.end());
     }
     for(Flagged_map_t::iterator ci = my_map2.begin(); ci != my_map2.end(); ++ci) {
         RPolygon *rp = ci->p();
         assert(rp->xmax() >= my_range.begin());
         assert(rp->xmin() < my_range.end());
     }
 }
示例#2
0
void split_at( Flagged_map_t& in_map, Flagged_map_t &left_out, Flagged_map_t &right_out, const T median) {
    left_out.reserve(in_map.size());
    right_out.reserve(in_map.size());
    for(Flagged_map_t::iterator i = in_map.begin(); i != in_map.end(); ++i ) {
        RPolygon *p = i->p();
        if(p->xmax() < median) {
            // in left map
            left_out.push_back(*i);
        }
        else if(p->xmin() >= median) {
            right_out.push_back(*i);
            // in right map
        }
        else {
            // in both maps.
            left_out.push_back(*i);
            right_out.push_back(RPolygon_flagged(p, true));
        }
    }
}