diff --git a/SConstruct b/SConstruct index c954c382d..91c91023e 100644 --- a/SConstruct +++ b/SConstruct @@ -28,7 +28,7 @@ opts.Add(PathOption('AGG_ROOT','agg source root directory','/opt/agg23')) opts.Add(PathOption('FREETYPE2_ROOT','freetype2 root directory','/opt/freetype2')) opts.Add(PathOption('PYTHON_ROOT','python root directory','/opt/python')) opts.Add('PYTHON_VERSION','python version','2.4') -opts.Add(ListOption('DATASOURCES','list of available datasources','postgis',['postgis','shape'])) +opts.Add(ListOption('DATASOURCES','list of available datasources','shape',['postgis','shape','raster'])) opts.Add('POSTGRESQL_ROOT','path to postgresql prefix','/usr/local') platform = ARGUMENTS.get("OS",Platform()) @@ -36,9 +36,9 @@ platform = ARGUMENTS.get("OS",Platform()) build_dir = 'build' build_prefix = build_dir+'/'+str(platform) -cxx = 'g++' +#cxx = 'g++' -env = Environment(CXX=cxx,ENV=os.environ, options=opts) +env = Environment(ENV=os.environ, options=opts) cxx_debug='-Wall -ftemplate-depth-100 -O0 -fno-inline -g -pthread -DDEBUG' cxx_release='-Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -pthread -DNDEBUG' diff --git a/include/feature.hpp b/include/feature.hpp index 698e219b0..4ec93080f 100644 --- a/include/feature.hpp +++ b/include/feature.hpp @@ -86,6 +86,11 @@ namespace mapnik { return raster_; } + void set_raster(raster_type const& raster) + { + raster_=raster; + } + void reserve_props(unsigned n) { props_.reserve(n); diff --git a/include/feature_factory.hpp b/include/feature_factory.hpp new file mode 100644 index 000000000..6b936f69a --- /dev/null +++ b/include/feature_factory.hpp @@ -0,0 +1,37 @@ +/* This file is part of Mapnik (c++ mapping toolkit) + * Copyright (C) 2005 Artem Pavlenko + * + * Mapnik is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//$Id$ + +#ifndef FEATURE_FACTORY_HPP +#define FEATURE_FACTORY_HPP + +#include "feature.hpp" +namespace mapnik +{ + struct feature_factory + { + static Feature* create (int fid) + { + return new Feature(fid); + } + }; +} + + +#endif //FEATURE_FACTORY_HPP diff --git a/include/geometry.hpp b/include/geometry.hpp index 4ece061a0..312514104 100644 --- a/include/geometry.hpp +++ b/include/geometry.hpp @@ -71,7 +71,7 @@ namespace mapnik { cont_.push_back(x,y,SEG_LINETO); } - + template class path_iterator { diff --git a/include/layer.hpp b/include/layer.hpp index 5724c1855..91b5466da 100644 --- a/include/layer.hpp +++ b/include/layer.hpp @@ -65,8 +65,8 @@ namespace mapnik void add_to_selection(ref_ptr& feature) const; std::vector >& selection() const; void clear_selection() const; - const datasource_p& datasource() const; - const Envelope& envelope() const; + datasource_p const& datasource() const; + Envelope const& envelope() const; virtual ~Layer(); private: void swap(const Layer& other); diff --git a/include/map.hpp b/include/map.hpp index 0b62edebf..2089d368d 100644 --- a/include/map.hpp +++ b/include/map.hpp @@ -28,10 +28,10 @@ namespace mapnik class Map { private: - static const int MIN_MAPSIZE=16; - static const int MAX_MAPSIZE=1024; - int width_; - int height_; + static const unsigned MIN_MAPSIZE=16; + static const unsigned MAX_MAPSIZE=1024; + unsigned width_; + unsigned height_; int srid_; Color background_; std::vector layers_; @@ -46,8 +46,11 @@ namespace mapnik void removeLayer(size_t index); void removeLayer(const char* lName); std::vector const& layers() const; - int getWidth() const; - int getHeight() const; + unsigned getWidth() const; + unsigned getHeight() const; + void setWidth(unsigned width); + void setHeight(unsigned height); + void resize(unsigned width,unsigned height); int srid() const; void setBackground(const Color& c); const Color& getBackground() const; diff --git a/include/mapnik.hpp b/include/mapnik.hpp index 0c5e068aa..0c07e7b24 100644 --- a/include/mapnik.hpp +++ b/include/mapnik.hpp @@ -57,6 +57,7 @@ #include "wkb.hpp" #include "map.hpp" #include "feature_type_style.hpp" +#include "feature_factory.hpp" #include "math_expr.hpp" #include "value.hpp" #include "expression.hpp" @@ -73,4 +74,4 @@ namespace mapnik { } -#endif //MAPNIK_HPP +#endif //MAPNIK_HPP diff --git a/include/polygon_symbolizer.hpp b/include/polygon_symbolizer.hpp index d5f4ef645..215a6a6b4 100644 --- a/include/polygon_symbolizer.hpp +++ b/include/polygon_symbolizer.hpp @@ -23,8 +23,6 @@ #include "symbolizer.hpp" #include "image_reader.hpp" -//#include "scanline_aa.hpp" -//#include "line_aa.hpp" #include "agg_basics.h" #include "agg_rendering_buffer.h" #include "agg_rasterizer_scanline_aa.h" @@ -33,6 +31,7 @@ #include "agg_renderer_scanline.h" #include "agg_pixfmt_rgba.h" #include "agg_path_storage.h" +#include "agg_span_allocator.h" #include "agg_span_pattern_rgba.h" namespace mapnik @@ -50,8 +49,6 @@ namespace mapnik void render(geometry_type& geom,Image32& image) const { - //ScanlineRasterizerAA rasterizer(image); - //rasterizer.render(geom,fill_); typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_aa_solid renderer; agg::row_ptr_cache buf(image.raw_data(),image.width(),image.height(), @@ -62,14 +59,14 @@ namespace mapnik double r=fill_.red()/255.0; double g=fill_.green()/255.0; double b=fill_.blue()/255.0; - + double a=fill_.alpha()/255.0; renderer ren(renb); agg::rasterizer_scanline_aa<> ras; agg::scanline_u8 sl; ras.clip_box(0,0,image.width(),image.height()); ras.add_path(geom); - ren.color(agg::rgba(r, g, b, 1.0)); + ren.color(agg::rgba(r, g, b, a)); agg::render_scanlines(ras, sl, ren); } @@ -92,8 +89,6 @@ namespace mapnik try { std::auto_ptr reader(get_image_reader(type,file)); - std::cout<<"image width="<width()<