本文整理汇总了C++中mapnik::Map::srs方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::srs方法的具体用法?C++ Map::srs怎么用?C++ Map::srs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapnik::Map
的用法示例。
在下文中一共展示了Map::srs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: map
#include <string>
#include <fstream>
#include <streambuf>
// libprotobuf
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include "vector_tile.pb.h"
#pragma GCC diagnostic pop
TEST_CASE("pbf vector tile input")
{
unsigned tile_size = 4096;
mapnik::Map map(256,256,"+init=epsg:3857");
mapnik::layer lyr("layer",map.srs());
lyr.set_datasource(testing::build_ds(0,0));
map.add_layer(lyr);
mapnik::vector_tile_impl::processor ren(map);
mapnik::vector_tile_impl::tile out_tile = ren.create_tile(0,0,0,tile_size);
CHECK(out_tile.is_painted() == true);
CHECK(out_tile.is_empty() == false);
vector_tile::Tile tile;
tile.ParseFromString(out_tile.get_buffer());
// serialize to message
std::string buffer;
CHECK(tile.SerializeToString(&buffer));
CHECK(147 == buffer.size());
// now create new objects
mapnik::Map map2(256,256,"+init=epsg:3857");
vector_tile::Tile tile2;
示例2: main
//.........这里部分代码省略.........
std::string plugin_path = mapnik_dir + "input/debug/";
std::cout << "..set plugin-path to "<<plugin_path<<"\n"<< std::flush;
#else
std::string plugin_path = mapnik_dir + "input/release/";
std::cout << "..set plugin-path to "<<plugin_path<<"\n"<< std::flush;
#endif
datasource_cache::instance()->register_datasources(plugin_path.c_str());
std::string font_dir = mapnik_dir + "fonts/dejavu-fonts-ttf-2.30/ttf/";
{
std::cout << "..looking for DejaVuSans fonts in... " << font_dir << "\n"<< std::flush;
}
if (boost::filesystem3::exists( font_dir ) )
{
boost::filesystem3::directory_iterator end_itr; // default construction yields past-the-end
for ( boost::filesystem3::directory_iterator itr( font_dir );
itr != end_itr;
++itr )
{
if (!boost::filesystem3::is_directory(itr->status()) )
{
freetype_engine::register_font(itr->path().string());
}
}
std::cout << "....Ok!\n" << std::flush;
} else { std::cout << "....#Error# Font directory not found!\n" << std::flush; }
//---------------------------------------------------------------------------
// -- Generate map container
g_map.set_background(color_factory::from_string("white"));
std::cout << "..loading map file \"" << map_file << "\".....";
load_map(g_map,map_file);
std::cout << "....Ok!\n" << std::flush;
g_mapnikProj = projection(g_map.srs());
//---------------------------------------------------------------------------
// -- Create outputpath
if(!FileSystem::DirExists(output_path))
FileSystem::makedir(output_path);
bool bDone = false;
//---------------------------------------------------------------------------
// -- performance measurement
int tileCount = 0;
int currentJobQueueSize = 0;
clock_t t_0, t_1;
t_0 = clock();
while (!bDone)
{
if (rank == 0)
{
std::vector<SJob> vJobs;
GenerateRenderJobs(totalnodes*queueSize, vJobs);
currentJobQueueSize = vJobs.size();
tileCount += currentJobQueueSize;
if (vJobs.size() == 0) // no more jobs
{
bDone = true;
t_1 = clock();
double time=(double(t_1-t_0)/double(CLOCKS_PER_SEC));
double tps = tileCount/time;
std::cout << ">>> Finished rendering " << tileCount << " tiles at " << tps << " tiles per second! TOTAL TIME: " << time << "<<<\n" << std::flush;
}
else
{
jobmgr.AddJobs(vJobs);
}
}