Changeset 725

Show
Ignore:
Timestamp:
07/29/08 19:21:39 (4 months ago)
Author:
tom
Message:

Add support for font sets on shield sumbolizers.

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/mapnik/shield_symbolizer.hpp

    r540 r725  
    4444                      std::string const& type, 
    4545                      unsigned width,unsigned height); 
    46      
     46    shield_symbolizer(std::string const& name, 
     47                      unsigned size, 
     48                      Color const& fill,  
     49                      std::string const& file, 
     50                      std::string const& type, 
     51                      unsigned width,unsigned height); 
    4752  }; 
    4853} 
  • trunk/src/load_map.cpp

    r704 r725  
    801801        { 
    802802            std::string name =  get_attr<string>(sym, "name"); 
    803             std::string face_name =  get_attr<string>(sym, "face_name"); 
     803 
     804            optional<std::string> face_name = 
     805                 get_opt_attr<std::string>(sym, "face_name"); 
     806 
     807            optional<std::string> fontset_name = 
     808                 get_opt_attr<std::string>(sym, "fontset_name"); 
     809 
    804810            unsigned size = get_attr(sym, "size", 10U); 
    805811            Color fill = get_attr(sym, "fill", Color(0,0,0)); 
     
    821827                    } 
    822828                } 
    823                 shield_symbolizer shield_symbol(name,face_name,size,fill, 
     829                shield_symbolizer shield_symbol(name,size,fill, 
    824830                                                image_file,type,width,height); 
    825                  
     831 
     832                if (fontset_name && face_name) 
     833                { 
     834                    throw config_error(std::string("Can't have both face_name and fontset_name")); 
     835                } 
     836                else if (fontset_name) 
     837                { 
     838                    std::map<std::string,FontSet>::const_iterator itr = fontsets_.find(*fontset_name); 
     839                    if (itr != fontsets_.end()) 
     840                    { 
     841                        shield_symbol.set_fontset(itr->second);                 
     842                    } 
     843                } 
     844                else if (face_name) 
     845                { 
     846                    shield_symbol.set_face_name(*face_name);                 
     847                } 
     848                else 
     849                { 
     850                    throw config_error(std::string("Must have face_name or fontset_name")); 
     851                } 
     852 
    826853                // minimum distance between labels 
    827854                optional<unsigned> min_distance =  
  • trunk/src/shield_symbolizer.cpp

    r546 r725  
    4747    { 
    4848    } 
     49 
     50    shield_symbolizer::shield_symbolizer( 
     51                          std::string const& name, 
     52                          unsigned size, 
     53                          Color const& fill,  
     54                          std::string const& file, 
     55                          std::string const& type, 
     56                          unsigned width,unsigned height) 
     57        : text_symbolizer(name, size, fill), 
     58          symbolizer_with_image( file, type, width, height ) 
     59    { 
     60    } 
    4961} 
    5062