+ fix naming style in mapnik::Map

This commit is contained in:
Artem Pavlenko 2010-06-25 15:23:35 +00:00
parent 2fbc476d19
commit 9b3809443c
13 changed files with 78 additions and 78 deletions

View file

@ -45,14 +45,14 @@ struct map_pickle_suite : boost::python::pickle_suite
static boost::python::tuple
getinitargs(const Map& m)
{
return boost::python::make_tuple(m.getWidth(),m.getHeight(),m.srs());
return boost::python::make_tuple(m.width(),m.height(),m.srs());
}
static boost::python::tuple
getstate(const Map& m)
{
boost::python::list l;
for (unsigned i=0;i<m.layerCount();++i)
for (unsigned i=0;i<m.layer_count();++i)
{
l.append(m.getLayer(i));
}
@ -68,7 +68,7 @@ struct map_pickle_suite : boost::python::pickle_suite
s.append(style_pair);
}
return boost::python::make_tuple(m.getCurrentExtent(),m.background(),l,s);
return boost::python::make_tuple(m.get_current_extent(),m.background(),l,s);
}
static void
@ -85,7 +85,7 @@ struct map_pickle_suite : boost::python::pickle_suite
}
box2d<double> ext = extract<box2d<double> >(state[0]);
m.zoomToBox(ext);
m.zoom_to_box(ext);
if (state[1])
{
color bg = extract<color>(state[1]);
@ -193,7 +193,7 @@ void export_map()
)
.def("envelope",
make_function(&Map::getCurrentExtent,
make_function(&Map::get_current_extent,
return_value_policy<copy_const_reference>()),
"Return the Map box2d object\n"
"and print the string representation\n"
@ -219,7 +219,7 @@ void export_map()
"<mapnik._mapnik.Style object at 0x654f0>\n"
)
.def("get_aspect_fix_mode",&Map::getAspectFixMode,
.def("get_aspect_fix_mode",&Map::get_aspect_fix_mode,
"Get aspect fix mode.\n"
"Usage:\n"
"\n"
@ -341,7 +341,7 @@ void export_map()
">>> m.zoom_all()\n"
)
.def("zoom_to_box",&Map::zoomToBox,
.def("zoom_to_box",&Map::zoom_to_box,
"Set the geographical extent of the map\n"
"by specifying a Mapnik box2d.\n"
"\n"
@ -351,8 +351,8 @@ void export_map()
)
.add_property("aspect_fix_mode",
&Map::getAspectFixMode,
&Map::setAspectFixMode,
&Map::get_aspect_fix_mode,
&Map::set_aspect_fix_mode,
"Get/Set aspect fix mode.\n"
"Usage:\n"
"\n"
@ -382,8 +382,8 @@ void export_map()
)
.add_property("height",
&Map::getHeight,
&Map::setHeight,
&Map::height,
&Map::set_height,
"Get/Set the height of the map in pixels.\n"
"Minimum settable size is 16 pixels.\n"
"\n"
@ -428,8 +428,8 @@ void export_map()
)
.add_property("width",
&Map::getWidth,
&Map::setWidth,
&Map::width,
&Map::set_width,
"Get/Set the width of the map in pixels.\n"
"Minimum settable size is 16 pixels.\n"
"\n"

View file

@ -193,7 +193,7 @@ void render_to_file1(const mapnik::Map& map,
}
else
{
mapnik::image_32 image(map.getWidth(),map.getHeight());
mapnik::image_32 image(map.width(),map.height());
render(map,image,1.0,0,0);
mapnik::save_to_file(image,filename,format);
}
@ -212,7 +212,7 @@ void render_to_file2(const mapnik::Map& map,const std::string& filename)
}
else
{
mapnik::image_32 image(map.getWidth(),map.getHeight());
mapnik::image_32 image(map.width(),map.height());
render(map,image,1.0,0,0);
mapnik::save_to_file(image,filename);
}

View file

@ -243,10 +243,10 @@ int main ( int argc , char** argv)
m.addLayer(lyr);
}
m.zoomToBox(box2d<double>(1405120.04127408,-247003.813399447,
m.zoom_to_box(box2d<double>(1405120.04127408,-247003.813399447,
1706357.31328276,-25098.593149577));
image_32 buf(m.getWidth(),m.getHeight());
image_32 buf(m.width(),m.height());
agg_renderer<image_32> ren(m,buf);
ren.apply();
@ -262,7 +262,7 @@ int main ( int argc , char** argv)
#if defined(HAVE_CAIRO)
Cairo::RefPtr<Cairo::ImageSurface> image_surface;
image_surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, m.getWidth(),m.getHeight());
image_surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, m.width(),m.height());
cairo_renderer<Cairo::Surface> png_render(m, image_surface);
png_render.apply();
image_surface->write_to_png("cairo-demo.png");
@ -271,11 +271,11 @@ int main ( int argc , char** argv)
save_to_file(im, "cairo-demo256.png","png256");
Cairo::RefPtr<Cairo::Surface> surface;
surface = Cairo::PdfSurface::create("cairo-demo.pdf", m.getWidth(),m.getHeight());
surface = Cairo::PdfSurface::create("cairo-demo.pdf", m.width(),m.height());
cairo_renderer<Cairo::Surface> pdf_render(m, surface);
pdf_render.apply();
surface = Cairo::SvgSurface::create("cairo-demo.svg", m.getWidth(),m.getHeight());
surface = Cairo::SvgSurface::create("cairo-demo.svg", m.width(),m.height());
cairo_renderer<Cairo::Surface> svg_render(m, surface);
svg_render.apply();

View file

@ -143,7 +143,7 @@ void MainWindow::reload()
if (!filename_.isEmpty())
{
mapnik::box2d<double> bbox = mapWidget_->getMap()->getCurrentExtent();
mapnik::box2d<double> bbox = mapWidget_->getMap()->get_current_extent();
load_map_file(filename_);
mapWidget_->zoomToBox(bbox);
setWindowTitle(tr("%1 - *Reloaded*").arg(filename_));
@ -403,7 +403,7 @@ void MainWindow::zoom_all()
if (map_ptr)
{
map_ptr->zoom_all();
mapnik::box2d<double> const& ext = map_ptr->getCurrentExtent();
mapnik::box2d<double> const& ext = map_ptr->get_current_extent();
mapWidget_->zoomToBox(ext);
}
}

View file

@ -145,9 +145,9 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
projection map_proj(map_->srs()); // map projection
double scale_denom = scale_denominator(*map_,map_proj.is_geographic());
CoordTransform t(map_->getWidth(),map_->getHeight(),map_->getCurrentExtent());
CoordTransform t(map_->width(),map_->height(),map_->get_current_extent());
for (unsigned index = 0; index < map_->layerCount();++index)
for (unsigned index = 0; index < map_->layer_count();++index)
{
if (int(index) != selectedLayer_) continue;
@ -250,9 +250,9 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
drag_=false;
if (map_)
{
CoordTransform t(map_->getWidth(),map_->getHeight(),map_->getCurrentExtent());
CoordTransform t(map_->width(),map_->height(),map_->get_current_extent());
box2d<double> box = t.backward(box2d<double>(start_x_,start_y_,end_x_,end_y_));
map_->zoomToBox(box);
map_->zoom_to_box(box);
updateMap();
}
}
@ -261,8 +261,8 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
drag_=false;
if (map_)
{
int cx = int(0.5 * map_->getWidth());
int cy = int(0.5 * map_->getHeight());
int cx = int(0.5 * map_->width());
int cy = int(0.5 * map_->height());
int dx = end_x_ - start_x_;
int dy = end_y_ - start_y_;
map_->pan(cx - dx ,cy - dy);
@ -337,7 +337,7 @@ void MapWidget::zoomToBox(mapnik::box2d<double> const& bbox)
{
if (map_)
{
map_->zoomToBox(bbox);
map_->zoom_to_box(bbox);
updateMap();
}
}
@ -374,8 +374,8 @@ void MapWidget::panUp()
{
if (map_)
{
double cx = 0.5*map_->getWidth();
double cy = 0.5*map_->getHeight();
double cx = 0.5*map_->width();
double cy = 0.5*map_->height();
map_->pan(int(cx),int(cy - cy*0.25));
updateMap();
}
@ -385,8 +385,8 @@ void MapWidget::panDown()
{
if (map_)
{
double cx = 0.5*map_->getWidth();
double cy = 0.5*map_->getHeight();
double cx = 0.5*map_->width();
double cy = 0.5*map_->height();
map_->pan(int(cx),int(cy + cy*0.25));
updateMap();
}
@ -396,8 +396,8 @@ void MapWidget::panLeft()
{
if (map_)
{
double cx = 0.5*map_->getWidth();
double cy = 0.5*map_->getHeight();
double cx = 0.5*map_->width();
double cy = 0.5*map_->height();
map_->pan(int(cx - cx * 0.25),int(cy));
updateMap();
}
@ -407,8 +407,8 @@ void MapWidget::panRight()
{
if (map_)
{
double cx = 0.5*map_->getWidth();
double cy = 0.5*map_->getHeight();
double cx = 0.5*map_->width();
double cy = 0.5*map_->height();
map_->pan(int(cx + cx * 0.25),int(cy));
updateMap();
}
@ -421,9 +421,9 @@ void MapWidget::zoomToLevel(int level)
{
double scale_denom = scales[level];
std::cerr << "scale denominator = " << scale_denom << "\n";
mapnik::box2d<double> ext = map_->getCurrentExtent();
double width = static_cast<double>(map_->getWidth());
double height= static_cast<double>(map_->getHeight());
mapnik::box2d<double> ext = map_->get_current_extent();
double width = static_cast<double>(map_->width());
double height= static_cast<double>(map_->height());
mapnik::coord2d pt = ext.center();
double res = scale_denom * 0.00028;
@ -432,7 +432,7 @@ void MapWidget::zoomToLevel(int level)
pt.y - 0.5 * height*res,
pt.x + 0.5 * width * res,
pt.y + 0.5 * height*res);
map_->zoomToBox(box);
map_->zoom_to_box(box);
updateMap();
}
}
@ -454,8 +454,8 @@ void MapWidget::updateMap()
{
if (map_)
{
unsigned width=map_->getWidth();
unsigned height=map_->getHeight();
unsigned width=map_->width();
unsigned height=map_->height();
image_32 buf(width,height);
@ -472,7 +472,7 @@ void MapWidget::updateMap()
projection prj(map_->srs()); // map projection
box2d<double> ext = map_->getCurrentExtent();
box2d<double> ext = map_->get_current_extent();
double x0 = ext.minx();
double y0 = ext.miny();
double x1 = ext.maxx();

View file

@ -149,7 +149,7 @@ private:
prj_trans.forward(lx1,ly1,lz1);
box2d<double> bbox(lx0,ly0,lx1,ly1);
query::resolution_type res(m_.getWidth()/m_.getCurrentExtent().width(),m_.getHeight()/m_.getCurrentExtent().height());
query::resolution_type res(m_.width()/m_.get_current_extent().width(),m_.height()/m_.get_current_extent().height());
query q(bbox,res,scale_denom); //BBOX query
std::vector<std::string> const& style_names = lay.styles();

View file

@ -190,7 +190,7 @@ public:
/*! \brief Get number of all layers.
*/
size_t layerCount() const;
size_t layer_count() const;
/*! \brief Add a layer to the map.
* @param l The layer to add.
@ -230,19 +230,19 @@ public:
/*! \brief Get map width.
*/
unsigned getWidth() const;
unsigned width() const;
/*! \brief Get map height.
*/
unsigned getHeight() const;
unsigned height() const;
/*! \brief Set map width.
*/
void setWidth(unsigned width);
void set_width(unsigned width);
/*! \brief Set map height.
*/
void setHeight(unsigned height);
void set_height(unsigned height);
/*! \brief Resize the map.
*/
@ -290,7 +290,7 @@ public:
* Aspect is handled automatic if not fitting to width/height.
* @param box The bounding box where to zoom.
*/
void zoomToBox(const box2d<double>& box);
void zoom_to_box(const box2d<double>& box);
/*! \brief Zoom the map to show all data.
*/
@ -303,7 +303,7 @@ public:
/*! \brief Get current bounding box.
* @return The current bounding box.
*/
const box2d<double>& getCurrentExtent() const;
const box2d<double>& get_current_extent() const;
/*! \brief Get current buffered bounding box.
* @return The current buffered bounding box.
@ -347,8 +347,8 @@ public:
~Map();
inline void setAspectFixMode(aspect_fix_mode afm) { aspectFixMode_ = afm; }
inline aspect_fix_mode getAspectFixMode() const { return aspectFixMode_; }
inline void set_aspect_fix_mode(aspect_fix_mode afm) { aspectFixMode_ = afm; }
inline aspect_fix_mode get_aspect_fix_mode() const { return aspectFixMode_; }
private:
void fixAspectRatio();

View file

@ -236,7 +236,7 @@ void MapSource::generateMaps()
cerr<<"x: " << tileX << " y: " << tileY
<<" z: " << z << endl;
image_32 buf(m.getWidth(),m.getHeight());
image_32 buf(m.width(),m.height());
double metres_w =( (tileX*256.0) *
metres_per_pixel ) -
20037814.088;
@ -252,7 +252,7 @@ void MapSource::generateMaps()
metres_e+32*metres_per_pixel,
metres_n+32*metres_per_pixel);
m.zoomToBox(bb);
m.zoom_to_box(bb);
agg_renderer<image_32> r(m,buf);
r.apply();
@ -302,8 +302,8 @@ void MapSource::generateMaps()
box2d<double> bb =
box2d<double>(bottomL_LL.x,bottomL_LL.y,
topR_LL.x,topR_LL.y);
m.zoomToBox(bb);
image_32 buf (m.getWidth(), m.getHeight());
m.zoom_to_box(bb);
image_32 buf (m.width(), m.height());
agg_renderer<image_32> r(m,buf);
r.apply();
@ -314,7 +314,7 @@ void MapSource::generateMaps()
void MapSource::setOSMLayers(Map& m, const parameters &p)
{
parameters q;
for(int count=0; count<m.layerCount(); count++)
for(int count=0; count<m.layer_count(); count++)
{
q = m.getLayer(count).datasource()->params();
if(boost::get<std::string>(q["type"])=="osm")

View file

@ -36,7 +36,7 @@ int main(int argc,char *argv[])
parameters p;
p["type"] = "osm";
p["file"] = argv[6];
for(int count=0; count<m.layerCount(); count++)
for(int count=0; count<m.layer_count(); count++)
{
parameters q = m.getLayer(count).datasource()->params();
m.getLayer(count).set_datasource(datasource_cache::instance()->
@ -47,9 +47,9 @@ int main(int argc,char *argv[])
box2d<double> bbox (atof(argv[2]),atof(argv[3]),
atof(argv[4]),atof(argv[5]));
m.zoomToBox(bbox);
m.zoom_to_box(bbox);
image_32 buf (m.getWidth(), m.getHeight());
image_32 buf (m.width(), m.height());
agg_renderer<image_32> r(m,buf);
r.apply();

View file

@ -114,10 +114,10 @@ agg_renderer<T>::agg_renderer(Map const& m, T & pixmap, double scale_factor, uns
width_(pixmap_.width()),
height_(pixmap_.height()),
scale_factor_(scale_factor),
t_(m.getWidth(),m.getHeight(),m.getCurrentExtent(),offset_x,offset_y),
t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y),
font_engine_(),
font_manager_(font_engine_),
detector_(box2d<double>(-m.buffer_size(), -m.buffer_size(), m.getWidth() + m.buffer_size() ,m.getHeight() + m.buffer_size())),
detector_(box2d<double>(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size())),
ras_ptr(new rasterizer)
{
boost::optional<color> bg = m.background();
@ -135,7 +135,7 @@ void agg_renderer<T>::start_map_processing(Map const& map)
{
#ifdef MAPNIK_DEBUG
std::clog << "start map processing bbox="
<< map.getCurrentExtent() << "\n";
<< map.get_current_extent() << "\n";
#endif
ras_ptr->clip_box(0,0,width_,height_);
}

View file

@ -479,11 +479,11 @@ private:
cairo_renderer_base::cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, unsigned offset_x, unsigned offset_y)
: m_(m),
context_(context),
t_(m.getWidth(),m.getHeight(),m.getCurrentExtent(),offset_x,offset_y),
t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y),
font_engine_(new freetype_engine()),
font_manager_(*font_engine_),
face_manager_(font_engine_,font_manager_),
detector_(box2d<double>(-m.buffer_size() ,-m.buffer_size() , m.getWidth() + m.buffer_size() ,m.getHeight() + m.buffer_size()))
detector_(box2d<double>(-m.buffer_size() ,-m.buffer_size() , m.width() + m.buffer_size() ,m.height() + m.buffer_size()))
{
#ifdef MAPNIK_DEBUG
std::clog << "scale=" << m.scale() << "\n";
@ -510,7 +510,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
{
#ifdef MAPNIK_DEBUG
std::clog << "start map processing bbox="
<< map.getCurrentExtent() << "\n";
<< map.get_current_extent() << "\n";
#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)

View file

@ -209,8 +209,8 @@ void save_to_cairo_file(mapnik::Map const& map,
if (file)
{
Cairo::RefPtr<Cairo::Surface> surface;
unsigned width = map.getWidth();
unsigned height = map.getHeight();
unsigned width = map.width();
unsigned height = map.height();
if (type == "pdf")
surface = Cairo::PdfSurface::create(filename,width,height);
else if (type == "svg")

View file

@ -159,7 +159,7 @@ boost::optional<feature_type_style const&> Map::find_style(std::string const& na
return boost::optional<feature_type_style const&>() ;
}
size_t Map::layerCount() const
size_t Map::layer_count() const
{
return layers_.size();
}
@ -199,17 +199,17 @@ std::vector<layer> & Map::layers()
return layers_;
}
unsigned Map::getWidth() const
unsigned Map::width() const
{
return width_;
}
unsigned Map::getHeight() const
unsigned Map::height() const
{
return height_;
}
void Map::setWidth(unsigned width)
void Map::set_width(unsigned width)
{
if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE)
{
@ -218,7 +218,7 @@ void Map::setWidth(unsigned width)
}
}
void Map::setHeight(unsigned height)
void Map::set_height(unsigned height)
{
if (height >= MIN_MAPSIZE && height <= MAX_MAPSIZE)
{
@ -321,7 +321,7 @@ void Map::zoom_all()
}
++itr;
}
zoomToBox(ext);
zoom_to_box(ext);
}
catch (proj_init_error & ex)
{
@ -329,7 +329,7 @@ void Map::zoom_all()
}
}
void Map::zoomToBox(const box2d<double> &box)
void Map::zoom_to_box(const box2d<double> &box)
{
currentExtent_=box;
fixAspectRatio();
@ -388,7 +388,7 @@ void Map::fixAspectRatio()
}
}
const box2d<double>& Map::getCurrentExtent() const
const box2d<double>& Map::get_current_extent() const
{
return currentExtent_;
}