Created
December 3, 2014 21:21
-
-
Save springmeyer/977443309697c2aa5ad4 to your computer and use it in GitHub Desktop.
example of compiling a test program against mapnik local build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mapnik/image_data.hpp> | |
#include <mapnik/image_data_any.hpp> | |
#include <mapnik/util/variant.hpp> | |
#include <iostream> | |
/* | |
source localize.sh | |
clang++ -o visitor-test visitor-test.cpp -Wpadded \ | |
-isystem /Users/dane/projects/mapnik-packaging/osx/out/build-cpp11-libcpp-x86_64-macosx/include \ | |
`mapnik-config --all-flags` -Ideps -Lsrc -Ideps/agg/include -Iinclude | |
*/ | |
struct tiff_setter : public mapnik::util::static_visitor<> | |
{ | |
tiff_setter(std::string & output) : | |
output_(output) {} | |
template <typename T> | |
void operator() (T const&) const | |
{ | |
output_ += typeid(T).name(); | |
} | |
void operator() (mapnik::image_data_32 const&) const | |
{ | |
output_ += "image_data_32\n"; | |
} | |
private: | |
std::string & output_; | |
}; | |
int main() { | |
std::string output(""); | |
tiff_setter setter(output); | |
mapnik::image_data_32 image(1,1); | |
mapnik::image_data_16 image2(1,1); | |
mapnik::image_data_8 image3(1,1); | |
//mapnik::util::apply_visitor(setter,image); | |
setter(image); | |
setter(image2); | |
std::clog << "output: " << output << "\n"; | |
// mapnik::util::apply_visitor(setter,image); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment