本文整理汇总了C++中mapnik::Map::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::getHeight方法的具体用法?C++ Map::getHeight怎么用?C++ Map::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapnik::Map
的用法示例。
在下文中一共展示了Map::getHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render_to_file2
void render_to_file2(const mapnik::Map& map,
const std::string& filename)
{
mapnik::image_32 image(map.getWidth(),map.getHeight());
render(map,image,0,0);
mapnik::save_to_file(image,filename);
}
示例2: render_to_file2
void render_to_file2(const mapnik::Map& map,const std::string& filename)
{
std::string format = mapnik::guess_type(filename);
if (format == "pdf" || format == "svg" || format =="ps")
{
#if defined(HAVE_CAIRO)
mapnik::save_to_cairo_file(map,filename,format);
#else
throw mapnik::ImageWriterException("Cairo backend not available, cannot write to format: " + format);
#endif
}
else
{
mapnik::Image32 image(map.getWidth(),map.getHeight());
render(map,image,0,0);
mapnik::save_to_file(image,filename);
}
}
示例3: RenderTile
//------------------------------------------------------------------------------
void TileRenderer::RenderTile(std::string tile_uri, mapnik::Map m, int x, int y, int zoom, GoogleProjection tileproj, mapnik::projection prj, bool verbose, bool overrideTile, bool lockEnabled, std::string compositionLayerPath, std::string compositionMode, double compositionAlpha)
{
if(!overrideTile && FileSystem::FileExists(tile_uri))
{
return;
}
else
{
// Calculate pixel positions of bottom-left & top-right
ituple p0(x * 256, (y + 1) * 256);
ituple p1((x + 1) * 256, y * 256);
// Convert to LatLong (EPSG:4326)
dtuple l0 = tileproj.pixel2GeoCoord(p0, zoom);
dtuple l1 = tileproj.pixel2GeoCoord(p1, zoom);
// Convert to map projection (e.g. mercator co-ords EPSG:900913)
dtuple c0(l0.a,l0.b);
dtuple c1(l1.a,l1.b);
prj.forward(c0.a, c0.b);
prj.forward(c1.a, c1.b);
// Bounding box for the tile
#ifndef MAPNIK_2
mapnik::Envelope<double> bbox = mapnik::Envelope<double>(c0.a,c0.b,c1.a,c1.b);
m.resize(256,256);
m.zoomToBox(bbox);
#else
mapnik::box2d<double> bbox(c0.a,c0.b,c1.a,c1.b);
m.resize(256,256);
m.zoom_to_box(bbox);
#endif
m.set_buffer_size(128);
// Render image with default Agg renderer
#ifndef MAPNIK_2
mapnik::Image32 buf(m.getWidth(),m.getHeight());
mapnik::agg_renderer<mapnik::Image32> ren(m,buf);
#else
mapnik::image_32 buf(m.width(), m.height());
mapnik::agg_renderer<mapnik::image_32> ren(m,buf);
#endif
ren.apply();
if(lockEnabled)
{
int lockhandle = FileSystem::Lock(tile_uri);
#ifndef MAPNIK_2
Compose(compositionLayerPath, compositionMode, compositionAlpha, m.getWidth(),m.getHeight(),&buf, zoom, x,y);
mapnik::save_to_file<mapnik::ImageData32>(buf.data(),tile_uri,"png");
#else
Compose(compositionLayerPath, compositionMode, compositionAlpha, m.width(),m.height(),&buf, zoom, x,y);
mapnik::save_to_file<mapnik::image_data_32>(buf.data(),tile_uri,"png");
#endif
FileSystem::Unlock(tile_uri, lockhandle);
}
else
{
#ifndef MAPNIK_2
Compose(compositionLayerPath, compositionMode, compositionAlpha, m.getWidth(),m.getHeight(),&buf, zoom, x,y);
mapnik::save_to_file<mapnik::ImageData32>(buf.data(),tile_uri,"png");
#else
Compose(compositionLayerPath, compositionMode, compositionAlpha, m.width(),m.height(),&buf, zoom, x,y);
mapnik::save_to_file<mapnik::image_data_32>(buf.data(),tile_uri,"png");
#endif
}
}
}