Exemple #1
0
bool placement_finder::collision(const box2d<double> &box, const value_unicode_string &repeat_key, bool line_placement) const
{
    double margin, repeat_distance;
    if (line_placement)
    {
        margin = text_props_->margin * scale_factor_;
        repeat_distance = (text_props_->repeat_distance != 0 ? text_props_->repeat_distance : text_props_->minimum_distance) * scale_factor_;
    }
    else
    {
        margin = (text_props_->margin != 0 ? text_props_->margin : text_props_->minimum_distance) * scale_factor_;
        repeat_distance = text_props_->repeat_distance * scale_factor_;
    }
    return !detector_.extent().intersects(box)
        ||
        (text_props_->avoid_edges && !extent_.contains(box))
        ||
        (text_props_->minimum_padding > 0 &&
         !extent_.contains(box + (scale_factor_ * text_props_->minimum_padding)))
        ||
        (!text_props_->allow_overlap &&
         ((repeat_key.length() == 0 && !detector_.has_placement(box, margin))
          ||
          (repeat_key.length() > 0 && !detector_.has_placement(box, margin, repeat_key, repeat_distance))));
}
bool group_symbolizer_helper::collision(box2d<double> const& box, value_unicode_string const& repeat_key) const
{
    if (!detector_.extent().intersects(box)
            ||
        (text_props_->avoid_edges && !dims_.contains(box))
            ||
        (text_props_->minimum_padding > 0 &&
         !dims_.contains(box + (scale_factor_ * text_props_->minimum_padding)))
            ||
        (!text_props_->allow_overlap &&
            ((repeat_key.length() == 0 && !detector_.has_placement(box, text_props_->margin * scale_factor_))
                ||
             (repeat_key.length() > 0  && !detector_.has_placement(box, text_props_->margin * scale_factor_,
                                                                   repeat_key, text_props_->repeat_distance * scale_factor_))))
        )
    {
        return true;
    }
    return false;
}
Exemple #3
0
 void operator() (value_unicode_string const& val) const
 {
   *tyPtr_  = value_type::unicode_string_type;
   *retPtr_ = val.getBuffer();
   *lenPtr_ = val.length();
 }