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/include/mapnik/placement_finder.hpp

    r478 r490  
    5050         typedef  coord_transform2<CoordTransform,geometry_type> path_type; 
    5151          
    52          //For shields 
    53          placement(string_info *info_,  
    54                    CoordTransform *ctrans_,  
    55                    const proj_transform *proj_trans_,  
    56                    geometry_ptr geom_,  
    57                    std::pair<double, double> dimensions_); 
    58      
    59          //For text 
     52         template <typename SymbolizerT> 
    6053         placement(string_info *info_,  
    6154                   CoordTransform *ctrans_,  
    6255                   const proj_transform *proj_trans_,  
    6356                   geometry_ptr geom_, 
    64                    position const& displacement, 
    65                    label_placement_e placement_); 
     57                   SymbolizerT sym); 
    6658          
    6759         ~placement(); 
    6860         
     61         //helpers 
     62         std::pair<double, double> get_position_at_distance(double target_distance); 
     63         double get_total_distance(); 
     64         void clear_envelopes(); 
     65     
    6966         unsigned path_size() const; 
     67 
    7068         string_info *info; 
    7169     
    7270         CoordTransform *ctrans; 
    7371         const proj_transform *proj_trans; 
     72         geometry_ptr geom; 
     73         path_type shape_path; 
    7474 
    75          geometry_ptr geom; 
     75         double total_distance_; //cache for distance 
     76     
    7677         position displacement_; 
    7778         label_placement_e label_placement; 
    78          std::pair<double, double> dimensions; 
    7979 
    80          bool has_dimensions; 
    81      
    82          path_type shape_path; 
    8380         std::queue< Envelope<double> > envelopes; 
    8481     
     
    8885         // caching output 
    8986         placement_element current_placement; 
    90      
    91          //helpers 
    92          std::pair<double, double> get_position_at_distance(double target_distance); 
    93          double get_total_distance(); 
    94          void clear_envelopes(); 
    95      
    96          double total_distance_; //cache for distance 
    9787     
    9888         int wrap_width; 
     
    10494 
    10595         double max_char_angle_delta; 
     96         double minimum_distance; 
    10697     
    10798         bool avoid_edges; 
     99 
     100         bool has_dimensions; 
     101         std::pair<double, double> dimensions; 
    108102   }; 
    109103 
     
    116110         //e is the dimensions of the map, buffer is the buffer used for collission detection. 
    117111         placement_finder(DetectorT & detector,Envelope<double> const& e); 
    118          bool find_placements(placement *p); 
     112         void find_placements(placement *p); 
    119113         void clear(); 
    120114          
     
    124118         bool build_path_follow(placement *p, double target_distance); 
    125119         bool build_path_horizontal(placement *p, double target_distance); 
     120         std::vector<double> get_ideal_placements(placement *p); 
    126121         void update_detector(placement *p); 
     122         DetectorT & detector_; 
    127123         Envelope<double> dimensions_; 
    128          DetectorT & detector_; 
    129124   };   
    130125}