Changeset 701

Show
Ignore:
Timestamp:
06/29/08 06:40:08 (8 weeks ago)
Author:
artem
Message:

applied font fallbacj patch from Beau Gunderson

Location:
trunk
Files:
1 added
32 modified

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r679 r701  
    4646opts.Add(PathOption('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include')) 
    4747opts.Add(PathOption('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA)) 
    48 opts.Add(PathOption('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include')) 
    49 opts.Add(PathOption('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA)) 
     48opts.Add(PathOption('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/local/include')) 
     49opts.Add(PathOption('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/local/' + LIBDIR_SCHEMA)) 
    5050opts.Add(PathOption('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include')) 
    5151opts.Add(PathOption('TIFF_LIBS', 'Search path for libtiff library files', '/usr/' + LIBDIR_SCHEMA)) 
    5252opts.Add(PathOption('PGSQL_INCLUDES', 'Search path for PostgreSQL include files', '/usr/include')) 
    5353opts.Add(PathOption('PGSQL_LIBS', 'Search path for PostgreSQL library files', '/usr/' + LIBDIR_SCHEMA)) 
    54 opts.Add(PathOption('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/local/include')) 
    55 opts.Add(PathOption('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/local/' + LIBDIR_SCHEMA)) 
     54opts.Add(PathOption('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/opt/proj4/include')) 
     55opts.Add(PathOption('PROJ_LIBS', 'Search path for PROJ.4 library files', '/opt/proj4/' + LIBDIR_SCHEMA)) 
    5656opts.Add(PathOption('GDAL_INCLUDES', 'Search path for GDAL include files', '/usr/include')) 
    5757opts.Add(PathOption('GDAL_LIBS', 'Search path for GDAL library files', '/usr/' + LIBDIR_SCHEMA)) 
    5858opts.Add(PathOption('PYTHON','Python executable', sys.executable)) 
    59 opts.Add(ListOption('INPUT_PLUGINS','Input drivers to include','all',['postgis','shape','raster','gdal'])) 
     59opts.Add(ListOption('INPUT_PLUGINS','Input drivers to include','all',['postgis','shape','raster','gdal','osm'])) 
    6060opts.Add(ListOption('BINDINGS','Language bindings to build','all',['python'])) 
    6161opts.Add(BoolOption('DEBUG', 'Compile a debug version of mapnik', 'False')) 
     
    155155 
    156156BOOST_LIBSHEADERS = [ 
    157     # ['system', 'boost/system/system_error.hpp', True], # uncomment this on Darwin + boost_1_35 
     157    ['system', 'boost/system/system_error.hpp', True], # uncomment this on Darwin + boost_1_35 
    158158    ['filesystem', 'boost/filesystem/operations.hpp', True], 
    159159    ['regex', 'boost/regex.hpp', True], 
     
    179179else: 
    180180    env['BOOST_APPEND']='' 
     181 
    181182     
    182183for count, libinfo in enumerate(BOOST_LIBSHEADERS): 
    183184    if  env['THREADING'] == 'multi' : 
    184         if not conf.CheckLibWithHeader('boost_%s%s%s' % (libinfo[0],env['BOOST_APPEND'],thread_suffix), libinfo[1], 'C++') and libinfo[2] : 
     185        if not conf.CheckLibWithHeader('boost_%s%s%s' % (libinfo[0],thread_suffix,env['BOOST_APPEND']), libinfo[1], 'C++') and libinfo[2] : 
    185186            color_print(1,'Could not find header or shared library for boost %s, exiting!' % libinfo[0]) 
    186187            Exit(1) 
     
    204205 
    205206# Build shapeindex and remove its dependency from the LIBS 
    206 if 'boost_program_options%s%s' % (env['BOOST_APPEND'],thread_suffix) in env['LIBS']: 
     207# if 'boost_program_options%s%s-1_35' % (env['BOOST_APPEND'],thread_suffix) in env['LIBS']: 
     208if 'boost_program_options-mt-1_35' in env['LIBS']: 
    207209    SConscript('utils/shapeindex/SConscript') 
    208     env['LIBS'].remove('boost_program_options%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
     210    env['LIBS'].remove('boost_program_options-mt-1_35') 
    209211 
    210212# Build the input plug-ins 
     213 
    211214if 'postgis' in inputplugins and 'pq' in env['LIBS']: 
    212215    SConscript('plugins/input/postgis/SConscript') 
     
    222225    SConscript('plugins/input/gdal/SConscript') 
    223226 
    224 if 'gigabase' in inputplugins and 'gigabase_r' in env['LIBS']: 
    225     SConscript('plugins/input/gigabase/SConscript') 
     227if 'osm' in inputplugins : 
     228    SConscript('plugins/input/osm/SConscript') 
    226229 
    227230# Build the Python bindings. 
  • trunk/agg/include/agg_config.h

    r525 r701  
    3434// such as blur, image filtering: 
    3535 
    36 #define AGG_RENDERING_BUFFER row_ptr_cache<int8u> 
     36//#define AGG_RENDERING_BUFFER row_ptr_cache<int8u> 
    3737//  
    3838// Provides cheaper creation and destruction (no mem allocs): 
  • trunk/bindings/python/SConscript

    r668 r701  
    4141libraries = ['mapnik','png','jpeg'] 
    4242if env['THREADING'] == 'multi': 
    43     libraries.append('boost_python%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
    44 else : 
    45     libraries.append('boost_python%s' % env['BOOST_APPEND']) 
     43    #libraries.append('boost_python%s%s-1_35' % (env['BOOST_APPEND'],thread_suffix)) 
     44    libraries.append('boost_python%s-1_35' % (thread_suffix)) 
     45#else : 
     46#    libraries.append('boost_python%s' % env['BOOST_APPEND']) 
    4647 
    4748if env['PLATFORM'] == 'Darwin': 
     49    libraries.append(env['LIBS']) 
    4850    libraries.append('icuuc') 
    4951    libraries.append('icudata') 
    50     if env['THREADING'] == 'multi': 
    51         libraries.append('boost_regex%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
    52     else : 
    53         libraries.append('boost_regex%s' % env['BOOST_APPEND']) 
    54     if env['THREADING'] == 'multi': 
    55         libraries.append('boost_thread%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
     52    #if env['THREADING'] == 'multi': 
     53    #    libraries.append('boost_regex%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
     54    #else : 
     55    #    libraries.append('boost_regex%s' % env['BOOST_APPEND']) 
     56     
     57    #if env['THREADING'] == 'multi': 
     58    #    libraries.append('boost_thread%s%s' % (env['BOOST_APPEND'],thread_suffix)) 
    5659    if '-DHAVE_PYCAIRO' in env['CXXFLAGS']: 
    5760        libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')]) 
  • trunk/demo/c++/rundemo.cpp

    r620 r701  
    2929#include <mapnik/font_engine_freetype.hpp> 
    3030#include <mapnik/agg_renderer.hpp> 
     31#include <mapnik/cairo_renderer.hpp> 
    3132#include <mapnik/filter_factory.hpp> 
    3233#include <mapnik/color_factory.hpp> 
     
    5354         
    5455        Map m(800,600); 
    55         m.set_background(color_factory::from_string("white")); 
    5656         
    57         // create styles 
     57        mapnik::load_map(m,"/Users/artem/projects/openstreetmap/mapnik/openstreetmap_kleptog.xml"); 
     58         
     59        m.zoomToBox(Envelope<double>(-762470.6985688356,4004842.088052442,-761928.349698612,4005328.834769584)); 
     60         
     61        //Image32 buf(m.getWidth(),m.getHeight()); 
     62        //agg_renderer<Image32> ren(m,buf); 
     63        //ren.apply(); 
     64         
     65        //save_to_file<ImageData32>(buf.data(),"demo.jpg","jpeg"); 
     66        //save_to_file<ImageData32>(buf.data(),"demo.png","png"); 
     67        //save_to_file<ImageData32>(buf.data(),"demo256.png","png256"); 
     68        //std::cout << "Three maps have been rendered in the current directory:\n" 
     69        //  "- demo.jpg\n" 
     70        //  "- demo.png\n" 
     71        //  "- demo256.png\n" 
     72        //  "Have a look!\n"; 
    5873 
    59         // Provinces (polygon) 
    60         feature_type_style provpoly_style; 
    61         
    62         rule_type provpoly_rule_on; 
    63         provpoly_rule_on.set_filter(create_filter("[NAME_EN] = 'Ontario'")); 
    64         provpoly_rule_on.append(polygon_symbolizer(Color(250, 190, 183))); 
    65         provpoly_style.add_rule(provpoly_rule_on); 
     74        // Cairo renderer 
     75 
     76        // Pdf 
     77        Cairo::RefPtr<Cairo::PdfSurface> pdf = Cairo::PdfSurface::create("mapnik.pdf",m.getWidth(),m.getHeight()); 
     78        mapnik::cairo_renderer<Cairo::Surface> cairo1(m, pdf); 
     79        cairo1.apply(); 
     80        // Svg 
     81        //Cairo::RefPtr<Cairo::SvgSurface> svg = Cairo::SvgSurface::create("demo.svg",m.getWidth(),m.getHeight()); 
     82        //mapnik::cairo_renderer<Cairo::Surface> cairo2(m, svg);   
     83        //cairo2.apply(); 
     84        // Png 
     85        //Cairo::RefPtr<Cairo::ImageSurface> image = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32,m.getWidth(),m.getHeight()); 
     86        //mapnik::cairo_renderer<Cairo::Surface> cairo3(m, image);   
     87        //cairo3.apply(); 
    6688         
    67         rule_type provpoly_rule_qc; 
    68         provpoly_rule_qc.set_filter(create_filter("[NAME_EN] = 'Quebec'")); 
    69         provpoly_rule_qc.append(polygon_symbolizer(Color(217, 235, 203))); 
    70         provpoly_style.add_rule(provpoly_rule_qc); 
     89        //std::string filename = "demo_cairo.png"; 
     90        //image->write_to_png(filename); 
    7191         
    72         m.insert_style("provinces",provpoly_style); 
    73  
    74         // Provinces (polyline) 
    75         feature_type_style provlines_style; 
     92        // Ps 
     93        //Cairo::RefPtr<Cairo::PsSurface> ps = Cairo::PsSurface::create("demo.ps",m.getWidth(),m.getHeight()); 
     94        //mapnik::cairo_renderer<Cairo::Surface> cairo4(m, ps); 
     95        //cairo4.apply(); 
    7696         
    77         stroke provlines_stk (Color(0,0,0),1.0); 
    78         provlines_stk.add_dash(8, 4); 
    79         provlines_stk.add_dash(2, 2); 
    80         provlines_stk.add_dash(2, 2); 
    81          
    82         rule_type provlines_rule; 
    83         provlines_rule.append(line_symbolizer(provlines_stk)); 
    84         provlines_style.add_rule(provlines_rule); 
    85          
    86         m.insert_style("provlines",provlines_style); 
    87          
    88         // Drainage  
    89         feature_type_style qcdrain_style; 
    90          
    91         rule_type qcdrain_rule; 
    92         qcdrain_rule.set_filter(create_filter("[HYC] = 8")); 
    93         qcdrain_rule.append(polygon_symbolizer(Color(153, 204, 255))); 
    94         qcdrain_style.add_rule(qcdrain_rule); 
    95          
    96         m.insert_style("drainage",qcdrain_style); 
    97          
    98         // Roads 3 and 4 (The "grey" roads) 
    99         feature_type_style roads34_style;     
    100         rule_type roads34_rule; 
    101         roads34_rule.set_filter(create_filter("[CLASS] = 3 or [CLASS] = 4")); 
    102         stroke roads34_rule_stk(Color(171,158,137),2.0); 
    103         roads34_rule_stk.set_line_cap(ROUND_CAP); 
    104         roads34_rule_stk.set_line_join(ROUND_JOIN); 
    105         roads34_rule.append(line_symbolizer(roads34_rule_stk)); 
    106         roads34_style.add_rule(roads34_rule); 
    107          
    108         m.insert_style("smallroads",roads34_style); 
    109          
    110  
    111         // Roads 2 (The thin yellow ones) 
    112         feature_type_style roads2_style_1; 
    113         rule_type roads2_rule_1; 
    114         roads2_rule_1.set_filter(create_filter("[CLASS] = 2")); 
    115         stroke roads2_rule_stk_1(Color(171,158,137),4.0); 
    116         roads2_rule_stk_1.set_line_cap(ROUND_CAP); 
    117         roads2_rule_stk_1.set_line_join(ROUND_JOIN); 
    118         roads2_rule_1.append(line_symbolizer(roads2_rule_stk_1)); 
    119         roads2_style_1.add_rule(roads2_rule_1); 
    120          
    121         m.insert_style("road-border", roads2_style_1); 
    122          
    123         feature_type_style roads2_style_2; 
    124         rule_type roads2_rule_2; 
    125         roads2_rule_2.set_filter(create_filter("[CLASS] = 2")); 
    126         stroke roads2_rule_stk_2(Color(255,250,115),2.0); 
    127         roads2_rule_stk_2.set_line_cap(ROUND_CAP); 
    128         roads2_rule_stk_2.set_line_join(ROUND_JOIN); 
    129         roads2_rule_2.append(line_symbolizer(roads2_rule_stk_2)); 
    130         roads2_style_2.add_rule(roads2_rule_2); 
    131          
    132         m.insert_style("road-fill", roads2_style_2); 
    133          
    134         // Roads 1 (The big orange ones, the highways) 
    135         feature_type_style roads1_style_1; 
    136         rule_type roads1_rule_1; 
    137         roads1_rule_1.set_filter(create_filter("[CLASS] = 1")); 
    138         stroke roads1_rule_stk_1(Color(188,149,28),7.0); 
    139         roads1_rule_stk_1.set_line_cap(ROUND_CAP); 
    140         roads1_rule_stk_1.set_line_join(ROUND_JOIN); 
    141         roads1_rule_1.append(line_symbolizer(roads1_rule_stk_1)); 
    142         roads1_style_1.add_rule(roads1_rule_1); 
    143         m.insert_style("highway-border", roads1_style_1); 
    144          
    145         feature_type_style roads1_style_2; 
    146         rule_type roads1_rule_2; 
    147         roads1_rule_2.set_filter(create_filter("[CLASS] = 1")); 
    148         stroke roads1_rule_stk_2(Color(242,191,36),5.0); 
    149         roads1_rule_stk_2.set_line_cap(ROUND_CAP); 
    150         roads1_rule_stk_2.set_line_join(ROUND_JOIN); 
    151         roads1_rule_2.append(line_symbolizer(roads1_rule_stk_2)); 
    152         roads1_style_2.add_rule(roads1_rule_2); 
    153         m.insert_style("highway-fill", roads1_style_2); 
    154          
    155         // Populated Places 
    156          
    157         feature_type_style popplaces_style; 
    158         rule_type popplaces_rule; 
    159         text_symbolizer popplaces_text_symbolizer("GEONAME","DejaVu Sans Book",10,Color(0,0,0)); 
    160         popplaces_text_symbolizer.set_halo_fill(Color(255,255,200)); 
    161         popplaces_text_symbolizer.set_halo_radius(1); 
    162         popplaces_rule.append(popplaces_text_symbolizer); 
    163         popplaces_style.add_rule(popplaces_rule); 
    164          
    165         m.insert_style("popplaces",popplaces_style ); 
    166          
    167         // Layers 
    168         // Provincial  polygons 
    169         { 
    170             parameters p; 
    171             p["type"]="shape"; 
    172             p["file"]="../data/boundaries"; 
    173              
    174             Layer lyr("Provinces");  
    175             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    176             lyr.add_style("provinces");     
    177             m.addLayer(lyr); 
    178         } 
    179          
    180         // Drainage 
    181         { 
    182             parameters p; 
    183             p["type"]="shape"; 
    184             p["file"]="../data/qcdrainage"; 
    185             Layer lyr("Quebec Hydrography"); 
    186             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    187             lyr.add_style("drainage");     
    188             m.addLayer(lyr); 
    189         } 
    190          
    191         { 
    192             parameters p; 
    193             p["type"]="shape"; 
    194             p["file"]="../data/ontdrainage"; 
    195              
    196             Layer lyr("Ontario Hydrography");  
    197             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    198             lyr.add_style("drainage");     
    199             m.addLayer(lyr); 
    200         } 
    201          
    202         // Provincial boundaries 
    203         { 
    204             parameters p; 
    205             p["type"]="shape"; 
    206             p["file"]="../data/boundaries_l"; 
    207             Layer lyr("Provincial borders");  
    208             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    209             lyr.add_style("provlines");     
    210             m.addLayer(lyr); 
    211         } 
    212          
    213         // Roads 
    214         { 
    215             parameters p; 
    216             p["type"]="shape"; 
    217             p["file"]="../data/roads";         
    218             Layer lyr("Roads");  
    219             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    220             lyr.add_style("smallroads"); 
    221             lyr.add_style("road-border"); 
    222             lyr.add_style("road-fill"); 
    223             lyr.add_style("highway-border"); 
    224             lyr.add_style("highway-fill"); 
    225  
    226             m.addLayer(lyr);         
    227         } 
    228         // popplaces 
    229         { 
    230             parameters p; 
    231             p["type"]="shape"; 
    232             p["file"]="../data/popplaces"; 
    233             p["encoding"] = "latin1"; 
    234             Layer lyr("Populated Places"); 
    235             lyr.set_datasource(datasource_cache::instance()->create(p)); 
    236             lyr.add_style("popplaces");     
    237             m.addLayer(lyr); 
    238         } 
    239          
    240         m.zoomToBox(Envelope<double>(1405120.04127408,-247003.813399447, 
    241                                      1706357.31328276,-25098.593149577)); 
    242          
    243         Image32 buf(m.getWidth(),m.getHeight()); 
    244         agg_renderer<Image32> ren(m,buf); 
    245         ren.apply(); 
    246          
    247         save_to_file<ImageData32>(buf.data(),"demo.jpg","jpeg"); 
    248         save_to_file<ImageData32>(buf.data(),"demo.png","png"); 
    249         save_to_file<ImageData32>(buf.data(),"demo256.png","png256"); 
    250         std::cout << "Three maps have been rendered in the current directory:\n" 
    251            "- demo.jpg\n" 
    252            "- demo.png\n" 
    253            "- demo256.png\n" 
    254            "Have a look!\n"; 
    25597    } 
    25698    catch ( const mapnik::config_error & ex ) 
  • trunk/demo/python/rundemo.py

    r666 r701  
    317317images.append('demo.jpg') 
    318318 
     319save_map(m,'map.xml') 
     320 
    319321# Render cairo examples 
    320322try: 
  • trunk/demo/viewer/main.cpp

    r579 r701  
    3636   freetype_engine::register_font("/opt/mapnik/lib/mapnik/fonts/DejaVuSans-Bold.ttf"); 
    3737   freetype_engine::register_font("/opt/mapnik/lib/mapnik/fonts/DejaVuSansMono.ttf"); 
    38      
    39          
     38   freetype_engine::register_font("/System/Library/Fonts/Monaco.dfont"); 
     39   freetype_engine::register_font("/Users/artem/Desktop/japanese.otf"); 
     40   freetype_engine::register_font("/Users/artem/Desktop/IPAfont00201/ipagp.ttf"); 
     41   freetype_engine::register_font("/Users/artem/Desktop/IPAfont00201/ipag.ttf"); 
     42    
    4043   QApplication app( argc, argv );  
    4144   MainWindow window; 
  • trunk/demo/viewer/mainwindow.cpp

    r579 r701  
    9393   connect(slider_,SIGNAL(valueChanged(int)),mapWidget_,SLOT(zoomToLevel(int))); 
    9494   //  
    95    connect(layerTab_,SIGNAL(update_mapwidget()),mapWidget_,SLOT(updateMap())); 
     95   connect(layerTab_,SIGNAL(update_mapwidget()),mapWidget_,SLOT(renderMap())); 
    9696   connect(layerTab_,SIGNAL(layerSelected(int)),  
    9797           mapWidget_,SLOT(layerSelected(int))); 
  • trunk/demo/viewer/mapwidget.cpp

    r544 r701  
    3030#include "mapwidget.hpp" 
    3131#include "info_dialog.hpp" 
     32#include <unicode/unistr.h> 
    3233 
    3334using mapnik::Image32; 
     
    8081   pen_.setCapStyle(Qt::RoundCap); 
    8182   pen_.setJoinStyle(Qt::RoundJoin); 
     83   connect(&thread_, SIGNAL(renderedMap(const QImage &)), 
     84                this, SLOT(updateMap(const QImage &))); 
    8285} 
    8386 
     
    122125   { 
    123126      map_->resize(ev->size().width(),ev->size().height()); 
    124       updateMap(); 
     127      renderMap(); 
    125128   } 
    126129} 
     
    172175                        if (itr->second.to_string().length() > 0) 
    173176                        { 
     177                           UnicodeString unicode = itr->second.to_unicode(); 
    174178                           info.push_back(QPair<QString,QString>(QString(itr->first.c_str()), 
    175                                                                  itr->second.to_string().c_str())); 
     179                                                                 QString((QChar*)unicode.getBuffer(),unicode.length()))); 
    176180                        } 
    177181                     } 
     
    224228   else if (e->button()==Qt::RightButton)  
    225229   {     
    226       //updateMap(); 
     230      //renderMap(); 
    227231   } 
    228232} 
     
    252256            Envelope<double> box = t.backward(Envelope<double>(start_x_,start_y_,end_x_,end_y_)); 
    253257            map_->zoomToBox(box); 
    254             updateMap(); 
     258            renderMap(); 
    255259         } 
    256260      } 
     
    265269            int dy = end_y_ - start_y_; 
    266270            map_->pan(cx - dx ,cy - dy);  
    267             updateMap(); 
     271            renderMap(); 
    268272         } 
    269273      } 
     
    334338   { 
    335339      map_->zoomToBox(bbox); 
    336       updateMap(); 
     340      renderMap(); 
    337341   } 
    338342} 
     
    344348      map_->resize(width(),height()); 
    345349      map_->zoom_all(); 
    346       updateMap(); 
     350      renderMap(); 
    347351   } 
    348352} 
     
    353357   { 
    354358      map_->zoom(0.5); 
    355       updateMap(); 
     359      renderMap(); 
    356360   } 
    357361} 
     
    362366   { 
    363367      map_->zoom(2.0); 
    364       updateMap(); 
     368      renderMap(); 
    365369   } 
    366370} 
     
    373377      double cy = 0.5*map_->getHeight(); 
    374378      map_->pan(int(cx),int(cy - cy*0.25)); 
    375       updateMap(); 
     379      renderMap(); 
    376380   } 
    377381} 
     
    384388      double cy = 0.5*map_->getHeight(); 
    385389      map_->pan(int(cx),int(cy + cy*0.25)); 
    386       updateMap(); 
     390      renderMap(); 
    387391   } 
    388392} 
     
    395399      double cy = 0.5*map_->getHeight(); 
    396400      map_->pan(int(cx - cx * 0.25),int(cy)); 
    397       updateMap(); 
     401      renderMap(); 
    398402   } 
    399403} 
     
    406410      double cy = 0.5*map_->getHeight(); 
    407411      map_->pan(int(cx + cx * 0.25),int(cy));  
    408       updateMap(); 
     412      renderMap(); 
    409413   } 
    410414} 
     
    429433                                   pt.y + 0.5 * height*res); 
    430434      map_->zoomToBox(box); 
    431       updateMap(); 
     435      renderMap(); 
    432436   } 
    433437} 
     
    442446        
    443447 
    444 void MapWidget::updateMap()  
    445 {    
    446    if (map_) 
    447    { 
    448       unsigned width=map_->getWidth(); 
    449       unsigned height=map_->getHeight(); 
    450        
    451       Image32 buf(width,height); 
    452       mapnik::agg_renderer<Image32> ren(*map_,buf); 
    453       ren.apply(); 
    454        
    455       QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32); 
    456       pix_=QPixmap::fromImage(image.rgbSwapped()); 
    457       update(); 
    458       // emit signal to interested widgets 
    459       emit mapViewChanged(); 
    460       std::cout << map_->getCurrentExtent() << "\n"; 
    461    } 
     448void MapWidget::renderMap() 
     449{ 
     450   thread_.render(map_); 
     451} 
     452 
     453void MapWidget::updateMap(QImage const& image)  
     454 
     455   std::cout << "updateMap called \n"; 
     456   pix_ = QPixmap::fromImage(image); 
     457   update(); 
     458   // emit signal to interested widgets 
     459   emit mapViewChanged(); 
     460   std::cout << map_->getCurrentExtent() << "\n"; 
    462461} 
    463462 
  • trunk/demo/viewer/mapwidget.hpp

    r544 r701  
    3232#include <boost/scoped_ptr.hpp> 
    3333#include <mapnik/map.hpp> 
     34#include "renderthread.hpp" 
    3435 
    3536class MapWidget : public QWidget  
     
    5960      QPen pen_; 
    6061      int selectedLayer_; 
     62      RenderThread thread_; 
    6163   public: 
    6264      MapWidget(QWidget *parent=0); 
     
    7375      void panUp(); 
    7476      void panDown(); 
     77      void renderMap(); 
    7578 public slots: 
    7679      void zoomToLevel(int level); 
    77       void updateMap(); 
     80      void updateMap(QImage const&); 
    7881      void layerSelected(int); 
    7982   signals: 
  • trunk/demo/viewer/viewer.pro

    r638