fix geometry_to_wkb utility

This commit is contained in:
artemp 2015-03-16 16:14:54 +01:00
parent 5f073ee299
commit 642bdfa78c
2 changed files with 18 additions and 22 deletions

View file

@ -1,12 +1,12 @@
###################################################################### ######################################################################
MAPNIK_INCLUDE_DIR = "/opt/mapnik/include" ; MAPNIK_INCLUDE_DIR = "/Users/artem/Projects/mapnik/include" ;
MAPNIK_LIB_DIR = "/opt/mapnik/lib" ; MAPNIK_LIB_DIR = "/opt/mapnik/lib" ;
BOOST_INCLUDE_DIR = "/opt/boost_1_48_0/include" ; BOOST_INCLUDE_DIR = "/opt/boost/include" ;
ICU_DIR = "/opt/icu" ;
lib mapnik : : <name>mapnik <search>$(MAPNIK_LIB_DIR) ; lib mapnik : : <name>mapnik <search>$(MAPNIK_LIB_DIR) ;
lib icu : : <name>icuuc <search>/usr/local/lib ; lib icu : : <name>icuuc <search>$(ICU_DIR)/lib ;
exe to_wkb : exe to_wkb :
main.cpp main.cpp
@ -15,5 +15,5 @@ exe to_wkb :
: :
<include>$(MAPNIK_INCLUDE_DIR) <include>$(MAPNIK_INCLUDE_DIR)
<include>$(BOOST_INCLUDE_DIR) <include>$(BOOST_INCLUDE_DIR)
<include>$(ICU_DIR)/include
; ;

View file

@ -24,14 +24,14 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <mapnik/geometry.hpp> #include <mapnik/geometry_impl.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/params.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/datasource_cache.hpp> #include <mapnik/datasource_cache.hpp>
#include <mapnik/util/geometry_to_wkb.hpp> #include <mapnik/util/geometry_to_wkb.hpp>
int main (int argc, char ** argv ) int main (int argc, char ** argv )
{ {
@ -81,21 +81,17 @@ int main (int argc, char ** argv )
while(f) while(f)
{ {
std::cerr << *f << std::endl; std::cerr << *f << std::endl;
mapnik::geometry_container const& paths = f->paths(); mapnik::new_geometry::geometry const& geom = f->get_geometry();
for (mapnik::geometry_type const& geom : paths)
{
// NDR // NDR
{ {
mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::util::wkbNDR); mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::wkbNDR);
std::cerr << mapnik::util::to_hex(wkb->buffer(),wkb->size()) << std::endl; std::cerr << mapnik::util::detail::to_hex(wkb->buffer(),wkb->size()) << std::endl;
} }
// XDR // XDR
{ {
mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::util::wkbXDR); mapnik::util::wkb_buffer_ptr wkb = mapnik::util::to_wkb(geom,mapnik::wkbXDR);
std::cerr << mapnik::util::to_hex(wkb->buffer(),wkb->size()) << std::endl; std::cerr << mapnik::util::detail::to_hex(wkb->buffer(),wkb->size()) << std::endl;
} }
}
f = fs->next(); f = fs->next();
} }
} }