1. hit_test implementation for geometry objects:

bool hit_test(double x, double y, double tol);
       
2. added image_view(unsigned x, unsigned y, unsigned width, unsigned height)
   allowing to select region from image data e.g (in Python):

    im = Image(2048,2048)
    view = im.view(0,0,256,256)
    save_to_file(filename,type, view)
    
3. changed envelope method to return vy value in datasource classes

4. features_at_point impl for shape and postgis plug-ins
This commit is contained in:
Artem Pavlenko 2006-11-25 11:02:59 +00:00
parent a6994cfc45
commit f1393cc019
28 changed files with 363 additions and 125 deletions

View file

@ -75,8 +75,8 @@ void export_datasource()
class_<datasource,boost::shared_ptr<datasource>,
boost::noncopyable>("Datasource",no_init)
.def("envelope",&datasource::envelope,
return_value_policy<copy_const_reference>())
.def("envelope",&datasource::envelope)
.def("descriptor",&datasource::get_descriptor) //todo
.def("features",&datasource::features)
.def("params",&datasource::params,return_value_policy<copy_const_reference>(),
"The configuration parameters of the data source. "

View file

@ -39,8 +39,9 @@ void export_image()
{
using namespace boost::python;
class_<Image32>("Image","This class represents a 32 bit image.",init<int,int>())
.def("width",&Image32::width)
.def("height",&Image32::height)
.def("width",&Image32::width)
.def("height",&Image32::height)
.def("view",&Image32::get_view)
.add_property("background",make_function
(&Image32::getBackground,return_value_policy<copy_const_reference>()),
&Image32::setBackground, "The background color of the image.")

View file

@ -0,0 +1,45 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#include <boost/python.hpp>
//#include <boost/python/module.hpp>
//#include <boost/python/def.hpp>
//#include <mapnik/graphics.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/image_view.hpp>
using mapnik::ImageData32;
using mapnik::image_view;
using mapnik::save_to_file;
void export_image_view()
{
using namespace boost::python;
class_<image_view<ImageData32> >("ImageView","A view into an image.",no_init)
.def("width",&image_view<ImageData32>::width)
.def("height",&image_view<ImageData32>::height)
;
def("save_to_file",save_to_file<image_view<ImageData32> >);
}

View file

@ -78,6 +78,9 @@ struct map_pickle_suite : boost::python::pickle_suite
}
};
std::vector<Layer>& (Map::*layers_nonconst)() = &Map::layers;
std::vector<Layer> const& (Map::*layers_const)() const = &Map::layers;
void export_map()
{
using namespace boost::python;
@ -108,7 +111,7 @@ void export_map()
.def("append_style",&Map::insert_style)
.def("remove_style",&Map::remove_style)
.add_property("layers",make_function
(&Map::layers,return_value_policy<reference_existing_object>()),
(layers_nonconst,return_value_policy<reference_existing_object>()),
"Get the list of layers in this map.")
.def("find_style",&Map::find_style,return_value_policy<copy_const_reference>())
.def_pickle(map_pickle_suite())

View file

@ -32,6 +32,7 @@ void export_parameters();
void export_envelope();
void export_query();
void export_image();
void export_image_view();
void export_map();
void export_python();
void export_filter();
@ -96,6 +97,7 @@ BOOST_PYTHON_MODULE(_mapnik)
export_color();
export_envelope();
export_image();
export_image_view();
export_filter();
export_rule();
export_style();

View file

@ -46,8 +46,8 @@ namespace mapnik {
virtual feature_ptr next()=0;
virtual ~Featureset() {};
};
typedef boost::shared_ptr<Featureset> featureset_ptr;
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
class MAPNIK_DECL datasource_exception : public std::exception
{
@ -84,8 +84,8 @@ namespace mapnik {
virtual int type() const=0;
virtual featureset_ptr features(const query& q) const=0;
virtual featureset_ptr features_at_point(coord2d const& pt) const=0;
virtual Envelope<double> const& envelope() const=0;
virtual layer_descriptor const& get_descriptor() const=0;
virtual Envelope<double> envelope() const=0;
virtual layer_descriptor get_descriptor() const=0;
virtual ~datasource() {};
};
@ -103,7 +103,7 @@ namespace mapnik {
}
};
typedef boost::shared_ptr<datasource> datasource_p;
typedef boost::shared_ptr<datasource> datasource_ptr;
#define DATASOURCE_PLUGIN(classname) \

View file

@ -34,7 +34,6 @@
namespace mapnik
{
template <typename T>
bool clip_test(T p,T q,double& tmin,double& tmax)
{
@ -117,14 +116,6 @@ namespace mapnik
return inside;
}
#define TOL 0.00001
/*
(Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
s = -----------------------------
L^2
*/
inline bool point_in_circle(double x,double y,double cx,double cy,double r)
{
double dx = x - cx;
@ -133,40 +124,75 @@ namespace mapnik
return (d2 <= r * r);
}
inline bool point_on_segment(double x,double y,double x0,double y0,double x1,double y1)
{
template <typename T>
inline T sqr(T x)
{
return x * x;
}
inline double distance2(double x0,double y0,double x1,double y1)
{
double dx = x1 - x0;
double dy = y1 - y0;
if ( fabs(dx) > TOL || fabs(dy) > TOL )
return sqr(dx) + sqr(dy);
}
inline double distance(double x0,double y0, double x1,double y1)
{
return sqrt(distance2(x0,y0,x1,y1));
}
inline double point_to_segment_distance(double x, double y,
double ax, double ay,
double bx, double by)
{
double len2 = distance2(ax,ay,bx,by);
if (len2 < 1e-7)
{
double s = (y0 - y) * dx - (x0 - x) * dy;
return ( fabs (s) < TOL ) ;
}
return false;
return distance(x,y,ax,ay);
}
double r = ((x - ax)*(bx - ax) + (y - ay)*(by -ay))/len2;
if ( r < 0 )
{
return distance(x,y,ax,ay);
}
else if (r > 1)
{
return distance(x,y,bx,by);
}
double s = ((ay - y)*(bx - ax) - (ax - x)*(by - ay))/len2;
return fabs(s) * sqrt(len2);
}
inline bool point_on_segment2(double x,double y,double x0,double y0,double x1,double y1)
{
double d = sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
double d0 = sqrt ((x0 - x) * (x0 - x) + (y0 - y) * (y0 - y));
double d1 = sqrt ((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
double d2 = d0 + d1;
return ( d2 - d < 0.01);
template <typename Iter>
inline bool point_on_path(double x,double y,Iter start,Iter end, double tol)
{
double x0=boost::get<0>(*start);
double y0=boost::get<1>(*start);
double x1,y1;
while (++start!=end)
{
if ( boost::get<2>(*start) == SEG_MOVETO)
{
x0 = boost::get<0>(*start);
y0 = boost::get<1>(*start);
continue;
}
x1=boost::get<0>(*start);
y1=boost::get<1>(*start);
double distance = point_to_segment_distance(x,y,x0,y0,x1,y1);
if (distance < tol)
return true;
x0=x1;
y0=y1;
}
return false;
}
#undef TOL
template <typename Iter>
inline bool point_on_path(double x,double y,Iter start,Iter end)
{
return false;
}
template <typename Iter>
inline bool point_on_points (double x,double y,Iter start,Iter end)
{
return false;
}
// filters
struct filter_in_box
{
Envelope<double> box_;
@ -191,4 +217,4 @@ namespace mapnik
};
}
#endif //GEOM_UTIL_HPP
#endif //GEOM_UTIL_HPP

View file

@ -76,9 +76,9 @@ namespace mapnik {
}
return result;
}
virtual int type() const=0;
virtual bool hit_test(value_type x,value_type y) const=0;
virtual bool hit_test(value_type x,value_type y, double tol) const=0;
virtual void label_position(double *x, double *y) const=0;
virtual void move_to(value_type x,value_type y)=0;
virtual void line_to(value_type x,value_type y)=0;
@ -134,10 +134,11 @@ namespace mapnik {
void rewind(unsigned ) {}
bool hit_test(value_type x,value_type y) const
bool hit_test(value_type x,value_type y, double tol) const
{
return false;
return point_in_circle(pt_.x,pt_.y, x,y,tol);
}
void set_capacity(size_t) {}
virtual ~point() {}
};
@ -227,7 +228,7 @@ namespace mapnik {
itr_=0;
}
bool hit_test(value_type x,value_type y) const
bool hit_test(value_type x,value_type y, double) const
{
return point_inside_path(x,y,cont_.begin(),cont_.end());
}
@ -239,7 +240,7 @@ namespace mapnik {
virtual ~polygon() {}
};
template <typename T, template <typename> class Container=vertex_vector>
template <typename T, template <typename> class Container=vertex_vector2>
class line_string : public geometry<T>
{
typedef geometry<T> geometry_base;
@ -337,9 +338,9 @@ namespace mapnik {
itr_=0;
}
bool hit_test(value_type x,value_type y) const
bool hit_test(value_type x,value_type y, double tol) const
{
return false;
return point_on_path(x,y,cont_.begin(),cont_.end(),tol);
}
void set_capacity(size_t size)

View file

@ -33,6 +33,7 @@
#include <mapnik/gamma.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/envelope.hpp>
#include <mapnik/image_view.hpp>
namespace mapnik
{
@ -45,9 +46,9 @@ namespace mapnik
ImageData32 data_;
public:
Image32(int width,int height);
Image32(const Image32& rhs);
Image32(Image32 const& rhs);
~Image32();
void setBackground(const Color& background);
void setBackground(Color const& background);
const Color& getBackground() const;
const ImageData32& data() const;
@ -65,10 +66,16 @@ namespace mapnik
{
return data_.getBytes();
}
inline image_view<ImageData32> get_view(unsigned x,unsigned y, unsigned w,unsigned h)
{
return image_view<ImageData32>(x,y,w,h,data_);
}
void saveToFile(const std::string& file,const std::string& format="auto");
private:
private:
inline bool checkBounds(unsigned x, unsigned y) const
{
return (x < width_ && y < height_);

View file

@ -31,12 +31,9 @@ namespace mapnik
{
template <class T> class ImageData
{
private:
const unsigned width_;
const unsigned height_;
T *pData_;
ImageData& operator=(const ImageData&);
public:
typedef T pixel_type;
ImageData(unsigned width,unsigned height)
: width_(width),
height_(height),
@ -119,6 +116,12 @@ namespace mapnik
{
::operator delete(pData_),pData_=0;
}
private:
const unsigned width_;
const unsigned height_;
T *pData_;
ImageData& operator=(const ImageData&);
};

View file

@ -31,21 +31,21 @@
#include <mapnik/config.hpp>
#include <mapnik/graphics.hpp>
namespace mapnik
{
class MAPNIK_DECL ImageUtils
{
public:
static void save_to_file(const std::string& filename,
const std::string& type,
const Image32& image);
private:
static void save_as_png(const std::string& filename,
const Image32& image);
static void save_as_jpeg(const std::string& filename,
int quality,
const Image32& image);
};
namespace mapnik {
template <typename T>
void save_to_file(std::string const& filename,
std::string const& type,
T const& image);
template <typename T>
void save_as_png(std::string const& filename,
Image32 const& image);
template <typename T>
void save_as_jpeg(std::string const& filename,
int quality,
T const& image);
template <typename T>
double distance(T x0,T y0,T x1,T y1)

View file

@ -0,0 +1,102 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#ifndef IMAGE_VIEW_HPP
#define IMAGE_VIEW_HPP
namespace mapnik {
template <typename T>
class image_view
{
typedef typename T::pixel_type pixel_type;
public:
image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data)
: x_(x),
y_(y),
width_(width),
height_(height),
data_(data)
{
if (x_ >= data_.width()) x_=data_.width()-1;
if (y_ >= data_.height()) x_=data_.height()-1;
if (x_ + width_ > data_.width()) width_= data_.width() - x_;
if (y_ + height_ > data_.height()) height_= data_.height() - y_;
}
~image_view() {}
image_view(image_view<T> const& rhs)
: x_(rhs.x_),
y_(rhs.y_),
width_(rhs.width_),
height_(rhs.height_),
data_(rhs.data_) {}
image_view<T> & operator=(image_view<T> const& rhs)
{
if (&rhs==this) return *this;
x_ = rhs.x_;
y_ = rhs.y_;
width_ = rhs.width_;
height_ = rhs.height_;
data_ = rhs.data_;
}
inline unsigned x() const
{
return x_;
}
inline unsigned y() const
{
return y_;
}
inline unsigned width() const
{
return width_;
}
inline unsigned height() const
{
return height_;
}
inline const pixel_type* getRow(unsigned row) const
{
return data_.getRow(row + y_) + x_;
}
private:
unsigned x_;
unsigned y_;
unsigned width_;
unsigned height_;
T const& data_;
};
}
#endif // IMAGE_VIEW_HPP

View file

@ -46,7 +46,7 @@ namespace mapnik
bool selectable_;
std::vector<std::string> styles_;
std::string selection_style_;
datasource_p ds_;
datasource_ptr ds_;
mutable std::vector<boost::shared_ptr<Feature> > selection_;
@ -79,8 +79,8 @@ namespace mapnik
void add_to_selection(boost::shared_ptr<Feature>& feature) const;
std::vector<boost::shared_ptr<Feature> >& selection() const;
void clear_selection() const;
void set_datasource(datasource_p const& ds);
datasource_p datasource() const;
void set_datasource(datasource_ptr const& ds);
datasource_ptr datasource() const;
Envelope<double> envelope() const;
~Layer();
private:

View file

@ -60,6 +60,7 @@ namespace mapnik
Layer& getLayer(size_t index);
void removeLayer(size_t index);
std::vector<Layer> const& layers() const;
std::vector<Layer> & layers();
void remove_all();
unsigned getWidth() const;
unsigned getHeight() const;
@ -77,6 +78,7 @@ namespace mapnik
void pan_and_zoom(int x,int y,double zoom);
const Envelope<double>& getCurrentExtent() const;
double scale() const;
CoordTransform view_transform() const;
~Map();
private:
void fixAspectRatio();

View file

@ -171,7 +171,7 @@ int postgis_datasource::type() const
return type_;
}
layer_descriptor const& postgis_datasource::get_descriptor() const
layer_descriptor postgis_datasource::get_descriptor() const
{
return desc_;
}
@ -231,7 +231,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const
return featureset_ptr();
}
const Envelope<double>& postgis_datasource::envelope() const
Envelope<double> postgis_datasource::envelope() const
{
return extent_;
}

View file

@ -57,8 +57,8 @@ public:
int type() const;
featureset_ptr features(const query& q) const;
featureset_ptr features_at_point(coord2d const& pt) const;
mapnik::Envelope<double> const& envelope() const;
layer_descriptor const& get_descriptor() const;
mapnik::Envelope<double> envelope() const;
layer_descriptor get_descriptor() const;
postgis_datasource(const parameters &params);
~postgis_datasource();
private:

View file

@ -74,12 +74,12 @@ std::string raster_datasource::name()
return name_;
}
const mapnik::Envelope<double>& raster_datasource::envelope() const
mapnik::Envelope<double> raster_datasource::envelope() const
{
return extent_;
}
layer_descriptor const& raster_datasource::get_descriptor() const
layer_descriptor raster_datasource::get_descriptor() const
{
return desc_;
}

View file

@ -45,8 +45,8 @@ public:
static std::string name();
featureset_ptr features(const query& q) const;
featureset_ptr features_at_point(coord2d const& pt) const;
mapnik::Envelope<double> const& envelope() const;
layer_descriptor const& get_descriptor() const;
mapnik::Envelope<double> envelope() const;
layer_descriptor get_descriptor() const;
private:
//no copying
raster_datasource(const raster_datasource&);

View file

@ -136,7 +136,7 @@ int shape_datasource::type() const
return type_;
}
layer_descriptor const& shape_datasource::get_descriptor() const
layer_descriptor shape_datasource::get_descriptor() const
{
return desc_;
}
@ -154,16 +154,41 @@ featureset_ptr shape_datasource::features(const query& q) const
return featureset_ptr
(new shape_index_featureset<filter_in_box>(filter,shape_name_,q.property_names()));
}
return featureset_ptr
(new shape_featureset<filter_in_box>(filter,shape_name_,q.property_names(),file_length_));
else
{
return featureset_ptr
(new shape_featureset<filter_in_box>(filter,shape_name_,q.property_names(),file_length_));
}
}
featureset_ptr shape_datasource::features_at_point(coord2d const& pt) const
{
return featureset_ptr();
filter_at_point filter(pt);
// collect all attribute names
std::vector<attribute_descriptor> const& desc_vector = desc_.get_descriptors();
std::vector<attribute_descriptor>::const_iterator itr = desc_vector.begin();
std::vector<attribute_descriptor>::const_iterator end = desc_vector.end();
std::set<std::string> names;
while (itr != end)
{
names.insert(itr->get_name());
++itr;
}
if (indexed_)
{
return featureset_ptr
(new shape_index_featureset<filter_at_point>(filter,shape_name_,names));
}
else
{
return featureset_ptr
(new shape_featureset<filter_at_point>(filter,shape_name_,names,file_length_));
}
}
const Envelope<double>& shape_datasource::envelope() const
Envelope<double> shape_datasource::envelope() const
{
return extent_;
}

View file

@ -37,13 +37,13 @@ class MAPNIK_DECL shape_datasource : public datasource
public:
shape_datasource(const parameters &params);
virtual ~shape_datasource();
int type() const;
static std::string name();
featureset_ptr features(const query& q) const;
featureset_ptr features_at_point(coord2d const& pt) const;
const Envelope<double>& envelope() const;
layer_descriptor const& get_descriptor() const;
Envelope<double> envelope() const;
layer_descriptor get_descriptor() const;
private:
shape_datasource(const shape_datasource&);
shape_datasource& operator=(const shape_datasource&);
@ -52,7 +52,7 @@ private:
std::string shape_name_;
int type_;
long file_length_;
mapnik::Envelope<double> extent_;
Envelope<double> extent_;
bool indexed_;
layer_descriptor desc_;
static std::string name_;

View file

@ -191,3 +191,5 @@ template <typename filterT>
shape_featureset<filterT>::~shape_featureset() {}
template class shape_featureset<filter_in_box>;
template class shape_featureset<filter_at_point>;

View file

@ -197,4 +197,5 @@ template <typename filterT>
shape_index_featureset<filterT>::~shape_index_featureset() {}
template class shape_index_featureset<filter_in_box>;
template class shape_index_featureset<filter_at_point>;

View file

@ -419,7 +419,7 @@ namespace mapnik
Feature const& feature,
proj_transform const& prj_trans)
{
typedef coord_transform2<CoordTransform,geometry_type> path_type;
typedef coord_transform2<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base;
typedef agg::wrap_mode_repeat wrap_x_type;
typedef agg::wrap_mode_repeat wrap_y_type;

View file

@ -48,9 +48,9 @@ namespace mapnik
std::map<string,boost::shared_ptr<PluginInfo> > datasource_cache::plugins_;
bool datasource_cache::registered_=false;
datasource_p datasource_cache::create(const parameters& params)
datasource_ptr datasource_cache::create(const parameters& params)
{
datasource_p ds;
datasource_ptr ds;
try
{
const std::string type=params.get("type");
@ -67,7 +67,7 @@ namespace mapnik
}
else
{
ds=datasource_p(create_datasource(params),datasource_deleter());
ds=datasource_ptr(create_datasource(params),datasource_deleter());
}
}
else

View file

@ -63,6 +63,6 @@ namespace mapnik
void Image32::saveToFile(const std::string& file,const std::string& format)
{
//TODO: image writer factory
ImageUtils::save_to_file(file,format,*this);
save_to_file(file,format,data_);
}
}

View file

@ -28,6 +28,7 @@
#include <mapnik/graphics.hpp>
#include <mapnik/memory.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/image_view.hpp>
// jpeg png
extern "C"
{
@ -37,9 +38,7 @@ extern "C"
namespace mapnik
{
//use memory manager for mem allocation in libpng
png_voidp malloc_fn(png_structp png_ptr,png_size_t size)
{
return Object::operator new(size);
@ -48,10 +47,11 @@ namespace mapnik
{
Object::operator delete(ptr);
}
//
void ImageUtils::save_to_file(const std::string& filename,
const std::string& type,
const Image32& image)
template <typename T>
void save_to_file(std::string const& filename,
std::string const& type,
T const& image)
{
//all that should go into image_writer factory
if (type=="png")
@ -63,8 +63,9 @@ namespace mapnik
save_as_jpeg(filename,85,image);
}
}
void ImageUtils::save_as_png(const std::string& filename,const Image32& image)
template <typename T>
void save_as_png(std::string const& filename, T const& image)
{
FILE *fp=fopen(filename.c_str(), "wb");
if (!fp) return;
@ -105,20 +106,18 @@ namespace mapnik
PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
png_write_info(png_ptr, info_ptr);
const ImageData32& imageData=image.data();
for (unsigned i=0;i<image.height();i++)
{
png_write_row(png_ptr,(png_bytep)imageData.getRow(i));
png_write_row(png_ptr,(png_bytep)image.getRow(i));
}
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
}
void ImageUtils::save_as_jpeg(const std::string& filename,int quality, const Image32& image)
template <typename T>
void save_as_jpeg(std::string const& filename,int quality, T const& image)
{
FILE *fp=fopen(filename.c_str(), "wb");
if (!fp) return;
@ -140,10 +139,10 @@ namespace mapnik
jpeg_start_compress(&cinfo, 1);
JSAMPROW row_pointer[1];
JSAMPLE* row=new JSAMPLE[width*3];
const ImageData32& imageData=image.data();
while (cinfo.next_scanline < cinfo.image_height)
{
const unsigned* imageRow=imageData.getRow(cinfo.next_scanline);
const unsigned* imageRow=image.getRow(cinfo.next_scanline);
int index=0;
for (int i=0;i<width;++i)
{
@ -158,5 +157,14 @@ namespace mapnik
jpeg_finish_compress(&cinfo);
fclose(fp);
jpeg_destroy_compress(&cinfo);
}
}
template void save_to_file<ImageData32>(std::string const&,
std::string const& ,
ImageData32 const&);
template void save_to_file<image_view<ImageData32> > (std::string const&,
std::string const& ,
image_view<ImageData32> const&);
}

View file

@ -186,12 +186,12 @@ namespace mapnik
return selectable_;
}
datasource_p Layer::datasource() const
datasource_ptr Layer::datasource() const
{
return ds_;
}
void Layer::set_datasource(datasource_p const& ds)
void Layer::set_datasource(datasource_ptr const& ds)
{
ds_ = ds;
}

View file

@ -124,7 +124,12 @@ namespace mapnik
{
return layers_;
}
std::vector<Layer> & Map::layers()
{
return layers_;
}
unsigned Map::getWidth() const
{
return width_;
@ -295,6 +300,11 @@ namespace mapnik
return currentExtent_.width()/width_;
return currentExtent_.width();
}
CoordTransform Map::view_transform() const
{
return CoordTransform(width_,height_,currentExtent_);
}
Map::~Map() {}
}