Show
Ignore:
Timestamp:
07/02/07 09:39:08 (3 years ago)
Author:
vspader
Message:

Added minimum_distance property to text symbolizers. This prevents the same label from appearing within N pixels (across features).
Shield symbolizer is now a subclass of text symbolizer.
Some small improvements to text rendering.
Fixed up placement finder for horizontal placement.
Cleaned up placement finder.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/text_symbolizer.cpp

    r488 r490  
    2323//$Id$ 
    2424 
    25  
     25//stl 
    2626#include <iostream> 
    27  
     27// boost 
     28#include <boost/scoped_ptr.hpp> 
     29//mapnik 
    2830#include <mapnik/text_symbolizer.hpp> 
    2931 
     
    3133{ 
    3234    text_symbolizer::text_symbolizer(std::string const& name, std::string const& face_name, unsigned size,Color const& fill) 
    33         : name_(name), 
     35        : name_(name), 
    3436          face_name_(face_name), 
    35           size_(size), 
     37          size_(size), 
    3638          text_ratio_(0), 
    3739          wrap_width_(0), 
     
    4042          force_odd_labels_(false), 
    4143          max_char_angle_delta_(0), 
    42           fill_(fill), 
    43           halo_fill_(Color(255,255,255)), 
    44           halo_radius_(0), 
    45           label_p_(point_placement), 
    46           anchor_(0.0,0.5), 
    47           displacement_(0.0,0.0), 
     44          fill_(fill), 
     45          halo_fill_(Color(255,255,255)), 
     46          halo_radius_(0), 
     47          label_p_(point_placement), 
     48          anchor_(0.0,0.5), 
     49          displacement_(0.0,0.0), 
    4850          avoid_edges_(false), 
     51          minimum_distance_(0.0), 
    4952          overlap_(false) {} 
    50             
    5153    text_symbolizer::text_symbolizer(text_symbolizer const& rhs) 
    5254        : name_(rhs.name_), 
     
    6668          displacement_(rhs.displacement_), 
    6769          avoid_edges_(rhs.avoid_edges_), 
     70          minimum_distance_(rhs.minimum_distance_), 
    6871          overlap_(rhs.overlap_) {} 
    6972    
     
    8891        displacement_ = other.displacement_;  
    8992        avoid_edges_ = other.avoid_edges_; 
     93        minimum_distance_ = other.minimum_distance_; 
    9094        overlap_ = other.overlap_; 
     95 
    9196        return *this; 
    9297    }  
     
    231236    } 
    232237 
    233    void text_symbolizer::set_allow_overlap(bool overlap) 
    234    { 
    235       overlap_ = overlap; 
    236    } 
     238    double text_symbolizer::get_minimum_distance() const 
     239    { 
     240        return minimum_distance_; 
     241    } 
     242     
     243    void text_symbolizer::set_minimum_distance(double distance) 
     244    { 
     245        minimum_distance_ = distance; 
     246    } 
     247 
     248    void text_symbolizer::set_allow_overlap(bool overlap) 
     249    { 
     250       overlap_ = overlap; 
     251    } 
    237252    
    238    bool text_symbolizer::get_allow_overlap() const 
    239    { 
     253    bool text_symbolizer::get_allow_overlap() const 
     254    { 
    240255      return overlap_; 
    241    } 
     256    } 
    242257}