1.Added support for building on Darwin (Xcode 2.4.1, gcc4.0.1).
Mainly taming gcc4.0.1 (anonymous enum bug) 2.Input plug-ins now have .input extension on all platforms
This commit is contained in:
parent
0b11a73df4
commit
e0d243dcec
39 changed files with 286 additions and 195 deletions
67
SConstruct
67
SConstruct
|
@ -33,7 +33,7 @@ opts.Add(PathOption('BOOST_INCLUDES', 'Search path for boost include files', '/u
|
||||||
opts.Add(PathOption('BOOST_LIBS', 'Search path for boost library files', '/usr/' + LIBDIR_SCHEMA))
|
opts.Add(PathOption('BOOST_LIBS', 'Search path for boost library files', '/usr/' + LIBDIR_SCHEMA))
|
||||||
opts.Add('BOOST_TOOLKIT','Specify boost toolkit e.g. gcc41.','',False)
|
opts.Add('BOOST_TOOLKIT','Specify boost toolkit e.g. gcc41.','',False)
|
||||||
|
|
||||||
opts.Add(PathOption('FREETYPE_CONFIG', 'The path to the freetype-config executable.', '/usr/bin/freetype-config'))
|
opts.Add(PathOption('FREETYPE_CONFIG', 'The path to the freetype-config executable.', '/usr/local/bin/freetype-config'))
|
||||||
opts.Add(PathOption('FRIBIDI_INCLUDES', 'Search path for fribidi include files', '/usr/include'))
|
opts.Add(PathOption('FRIBIDI_INCLUDES', 'Search path for fribidi include files', '/usr/include'))
|
||||||
opts.Add(PathOption('FRIBIDI_LIBS','Search path for fribidi include files','/usr/' + LIBDIR_SCHEMA))
|
opts.Add(PathOption('FRIBIDI_LIBS','Search path for fribidi include files','/usr/' + LIBDIR_SCHEMA))
|
||||||
opts.Add(PathOption('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include'))
|
opts.Add(PathOption('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include'))
|
||||||
|
@ -55,7 +55,8 @@ opts.Add('BIDI', 'BIDI support', '')
|
||||||
|
|
||||||
env = Environment(ENV=os.environ, options=opts)
|
env = Environment(ENV=os.environ, options=opts)
|
||||||
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
||||||
|
env['PLATFORM'] = platform.uname()[0]
|
||||||
|
print "Building on %s ..." % env['PLATFORM']
|
||||||
Help(opts.GenerateHelpText(env))
|
Help(opts.GenerateHelpText(env))
|
||||||
|
|
||||||
conf = Configure(env)
|
conf = Configure(env)
|
||||||
|
@ -107,7 +108,7 @@ if env['BIDI'] : C_LIBSHEADERS.append(['fribidi','fribidi/fribidi.h',True])
|
||||||
|
|
||||||
BOOST_LIBSHEADERS = [
|
BOOST_LIBSHEADERS = [
|
||||||
['thread', 'boost/thread/mutex.hpp', True],
|
['thread', 'boost/thread/mutex.hpp', True],
|
||||||
#['system', 'boost/system/system_error.hpp', True],
|
['system', 'boost/system/system_error.hpp', True],
|
||||||
['filesystem', 'boost/filesystem/operations.hpp', True],
|
['filesystem', 'boost/filesystem/operations.hpp', True],
|
||||||
['regex', 'boost/regex.hpp', True],
|
['regex', 'boost/regex.hpp', True],
|
||||||
['program_options', 'boost/program_options.hpp', False]
|
['program_options', 'boost/program_options.hpp', False]
|
||||||
|
@ -121,10 +122,10 @@ for libinfo in C_LIBSHEADERS:
|
||||||
env['BOOST_APPEND'] = ''
|
env['BOOST_APPEND'] = ''
|
||||||
|
|
||||||
if len(env['BOOST_TOOLKIT']): toolkit = env['BOOST_TOOLKIT']
|
if len(env['BOOST_TOOLKIT']): toolkit = env['BOOST_TOOLKIT']
|
||||||
else: toolkit = env['CC']
|
else: toolkit = '' #toolkit = env['CC']
|
||||||
|
|
||||||
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
|
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
|
||||||
if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++'):
|
if not conf.CheckLibWithHeader('boost_%s%s-mt' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++'):
|
||||||
if not conf.CheckLibWithHeader('boost_%s-%s-mt' % (libinfo[0], toolkit), libinfo[1], 'C++') and libinfo[2] and count == 0:
|
if not conf.CheckLibWithHeader('boost_%s-%s-mt' % (libinfo[0], toolkit), libinfo[1], 'C++') and libinfo[2] and count == 0:
|
||||||
print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
|
print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
@ -137,6 +138,33 @@ inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
|
||||||
|
|
||||||
bindings = [ binding.strip() for binding in Split(env['BINDINGS'])]
|
bindings = [ binding.strip() for binding in Split(env['BINDINGS'])]
|
||||||
|
|
||||||
|
|
||||||
|
# Build agg first, doesn't need anything special
|
||||||
|
|
||||||
|
SConscript('agg/SConscript')
|
||||||
|
|
||||||
|
# Build the core library
|
||||||
|
|
||||||
|
SConscript('src/SConscript')
|
||||||
|
|
||||||
|
# Build shapeindex and remove its dependency from the LIBS
|
||||||
|
|
||||||
|
if 'boost_program_options%s-mt' % env['BOOST_APPEND'] in env['LIBS']:
|
||||||
|
SConscript('utils/shapeindex/SConscript')
|
||||||
|
env['LIBS'].remove('boost_program_options%s-mt' % env['BOOST_APPEND'])
|
||||||
|
|
||||||
|
# Build the input plug-ins
|
||||||
|
|
||||||
|
if 'postgis' in inputplugins and 'pq' in env['LIBS']:
|
||||||
|
SConscript('plugins/input/postgis/SConscript')
|
||||||
|
env['LIBS'].remove('pq')
|
||||||
|
|
||||||
|
if 'shape' in inputplugins:
|
||||||
|
SConscript('plugins/input/shape/SConscript')
|
||||||
|
|
||||||
|
if 'raster' in inputplugins:
|
||||||
|
SConscript('plugins/input/raster/SConscript')
|
||||||
|
|
||||||
# Check out the Python situation
|
# Check out the Python situation
|
||||||
|
|
||||||
if 'python' in env['BINDINGS']:
|
if 'python' in env['BINDINGS']:
|
||||||
|
@ -165,35 +193,10 @@ env = conf.Finish()
|
||||||
# Setup the c++ args for our own codebase
|
# Setup the c++ args for our own codebase
|
||||||
|
|
||||||
if env['DEBUG']:
|
if env['DEBUG']:
|
||||||
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O0 -fno-inline -g -pthread -DDEBUG -DMAPNIK_DEBUG -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
|
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O0 -fno-inline -g -DDEBUG -DMAPNIK_DEBUG -D%s -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL' % env['PLATFORM'].upper() )
|
||||||
else:
|
else:
|
||||||
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -pthread -DNDEBUG -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
|
env.Append(CXXFLAGS = '-ansi -Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -DNDEBUG -D%s -DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL' % env['PLATFORM'].upper())
|
||||||
|
|
||||||
# Build agg first, doesn't need anything special
|
|
||||||
|
|
||||||
SConscript('agg/SConscript')
|
|
||||||
|
|
||||||
# Build shapeindex and remove its dependency from the LIBS
|
|
||||||
|
|
||||||
if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
|
|
||||||
SConscript('utils/shapeindex/SConscript')
|
|
||||||
env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
|
|
||||||
|
|
||||||
# Build the input plug-ins
|
|
||||||
|
|
||||||
if 'postgis' in inputplugins and 'pq' in env['LIBS']:
|
|
||||||
SConscript('plugins/input/postgis/SConscript')
|
|
||||||
env['LIBS'].remove('pq')
|
|
||||||
|
|
||||||
if 'shape' in inputplugins:
|
|
||||||
SConscript('plugins/input/shape/SConscript')
|
|
||||||
|
|
||||||
if 'raster' in inputplugins:
|
|
||||||
SConscript('plugins/input/raster/SConscript')
|
|
||||||
|
|
||||||
# Build the core library
|
|
||||||
|
|
||||||
SConscript('src/SConscript')
|
|
||||||
|
|
||||||
# Install some free default fonts
|
# Install some free default fonts
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,16 @@ prefix = env['PYTHON_PREFIX'] + '/'+ 'lib' + '/python' + env['PYTHON_VERSION'] +
|
||||||
install_prefix = env['DESTDIR'] + '/' + prefix
|
install_prefix = env['DESTDIR'] + '/' + prefix
|
||||||
|
|
||||||
libraries = ['mapnik', 'boost_python%s' % env['BOOST_APPEND']]
|
libraries = ['mapnik', 'boost_python%s' % env['BOOST_APPEND']]
|
||||||
|
|
||||||
|
if env['PLATFORM'] == 'Darwin':
|
||||||
|
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
|
||||||
|
linkflags = '-F/ -framework Python'
|
||||||
|
else :
|
||||||
|
linkflags = ''
|
||||||
|
|
||||||
headers = [env['PYTHON_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] + env['CPPPATH']
|
headers = [env['PYTHON_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] + env['CPPPATH']
|
||||||
|
|
||||||
_mapnik = env.SharedLibrary('_mapnik', glob.glob('*.cpp'), LIBS=libraries, SHLIBPREFIX='', CPPPATH=headers)
|
_mapnik = env.SharedLibrary('_mapnik', glob.glob('*.cpp'), LIBS=libraries, SHLIBPREFIX='', SHLIBSUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
|
||||||
|
|
||||||
paths = """
|
paths = """
|
||||||
mapniklibpath = '%s'
|
mapniklibpath = '%s'
|
||||||
|
|
|
@ -117,10 +117,10 @@ namespace mapnik {
|
||||||
|
|
||||||
inline std::string to_hex_string() const
|
inline std::string to_hex_string() const
|
||||||
{
|
{
|
||||||
return (boost::format("#%1$02x%2$02x%3$02x")
|
return (boost::format("#%1$02x%2$02x%3$02x")
|
||||||
% red()
|
% red()
|
||||||
% green()
|
% green()
|
||||||
% blue() ).str();
|
% blue() ).str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace mapnik {
|
||||||
class MAPNIK_DECL datasource : private boost::noncopyable
|
class MAPNIK_DECL datasource : private boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
enum datasource_t {
|
||||||
Vector,
|
Vector,
|
||||||
Raster
|
Raster
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace mapnik
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::clog;
|
using std::clog;
|
||||||
|
|
||||||
enum {
|
enum eAttributeType {
|
||||||
Integer=1,
|
Integer=1,
|
||||||
Float =2,
|
Float =2,
|
||||||
Double =3,
|
Double =3,
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace mapnik
|
||||||
class node_data
|
class node_data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
enum node_e {
|
||||||
Unknown=0,
|
Unknown=0,
|
||||||
Integer=1,
|
Integer=1,
|
||||||
Real =2,
|
Real =2,
|
||||||
|
|
|
@ -328,8 +328,8 @@ namespace mapnik
|
||||||
FT_Vector start;
|
FT_Vector start;
|
||||||
unsigned height = pixmap_.height();
|
unsigned height = pixmap_.height();
|
||||||
|
|
||||||
start.x = unsigned(x0 * (1 << 6));
|
start.x = x0 * (1 << 6);
|
||||||
start.y = unsigned((height - y0) * (1 << 6));
|
start.y = (height - y0) * (1 << 6);
|
||||||
|
|
||||||
// std::clog << "Render text at: " << x0 << "," << y0 << " " << start.x << "," << start.y << std::endl;
|
// std::clog << "Render text at: " << x0 << "," << y0 << " " << start.x << "," << start.y << std::endl;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <mapnik/geom_util.hpp>
|
#include <mapnik/geom_util.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
enum {
|
enum GeomType {
|
||||||
Point = 1,
|
Point = 1,
|
||||||
LineString = 2,
|
LineString = 2,
|
||||||
Polygon = 3
|
Polygon = 3
|
||||||
|
@ -62,7 +62,7 @@ namespace mapnik {
|
||||||
{
|
{
|
||||||
Envelope<double> result;
|
Envelope<double> result;
|
||||||
double x,y;
|
double x,y;
|
||||||
rewind(0);
|
rewind(0);
|
||||||
for (unsigned i=0;i<num_points();++i)
|
for (unsigned i=0;i<num_points();++i)
|
||||||
{
|
{
|
||||||
vertex(&x,&y);
|
vertex(&x,&y);
|
||||||
|
@ -167,11 +167,12 @@ namespace mapnik {
|
||||||
|
|
||||||
void label_position(double *x, double *y) const
|
void label_position(double *x, double *y) const
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned size = cont_.size();
|
unsigned size = cont_.size();
|
||||||
if (size < 4)
|
if (size < 3)
|
||||||
{
|
{
|
||||||
x=0;y=0;
|
cont_.get_vertex(0,x,y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ai;
|
double ai;
|
||||||
|
@ -184,7 +185,7 @@ namespace mapnik {
|
||||||
double y1 =0;
|
double y1 =0;
|
||||||
|
|
||||||
unsigned i,j;
|
unsigned i,j;
|
||||||
for (i = size-2,j = 0; j < size-1; i = j, ++j)
|
for (i = size-1,j = 0; j < size; i = j, ++j)
|
||||||
{
|
{
|
||||||
cont_.get_vertex(i,&x0,&y0);
|
cont_.get_vertex(i,&x0,&y0);
|
||||||
cont_.get_vertex(j,&x1,&y1);
|
cont_.get_vertex(j,&x1,&y1);
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using boost::int32_t;
|
||||||
|
using boost::uint8_t;
|
||||||
|
|
||||||
#define int2net(A) (int32_t) (((uint32_t) ((uint8_t) (A)[1])) | \
|
#define int2net(A) (int32_t) (((uint32_t) ((uint8_t) (A)[1])) | \
|
||||||
(((uint32_t) ((uint8_t) (A)[0])) << 8))
|
(((uint32_t) ((uint8_t) (A)[0])) << 8))
|
||||||
|
|
||||||
|
|
|
@ -163,14 +163,17 @@ namespace mapnik {
|
||||||
public:
|
public:
|
||||||
explicit transcoder (std::string const& encoding)
|
explicit transcoder (std::string const& encoding)
|
||||||
{
|
{
|
||||||
desc_ = iconv_open("UCS-2",encoding.c_str());
|
//desc_ = iconv_open("UCS-2",encoding.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring transcode(std::string const& input) const
|
std::wstring transcode(std::string const& input) const
|
||||||
{
|
{
|
||||||
|
//return to_unicode(input);
|
||||||
|
return to_unicode(input);
|
||||||
|
/*
|
||||||
std::string buf(input.size() * 2,0);
|
std::string buf(input.size() * 2,0);
|
||||||
size_t inleft = input.size();
|
size_t inleft = input.size();
|
||||||
char * in = const_cast<char*>(input.data());
|
const char * in = input.data();
|
||||||
size_t outleft = buf.size();
|
size_t outleft = buf.size();
|
||||||
char * out = const_cast<char*>(buf.data());
|
char * out = const_cast<char*>(buf.data());
|
||||||
|
|
||||||
|
@ -207,11 +210,12 @@ namespace mapnik {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return unicode;
|
return unicode;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
~transcoder()
|
~transcoder()
|
||||||
{
|
{
|
||||||
iconv_close(desc_);
|
//iconv_close(desc_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -527,14 +527,14 @@ namespace mapnik {
|
||||||
return value(boost::apply_visitor(impl::div<value>(),p1.base_, p2.base_));
|
return value(boost::apply_visitor(impl::div<value>(),p1.base_, p2.base_));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename charT, typename traits>
|
template <typename charT, typename traits>
|
||||||
inline std::basic_ostream<charT,traits>&
|
inline std::basic_ostream<charT,traits>&
|
||||||
operator << (std::basic_ostream<charT,traits>& out,
|
operator << (std::basic_ostream<charT,traits>& out,
|
||||||
value const& v)
|
value const& v)
|
||||||
{
|
{
|
||||||
out << v.to_string();
|
out << v.to_string();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //VALUE_HPP
|
#endif //VALUE_HPP
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
enum {
|
enum CommandType {
|
||||||
SEG_END =0,
|
SEG_END =0,
|
||||||
SEG_MOVETO=1,
|
SEG_MOVETO=1,
|
||||||
SEG_LINETO=2,
|
SEG_LINETO=2,
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace mapnik
|
||||||
{
|
{
|
||||||
typedef typename T::type value_type;
|
typedef typename T::type value_type;
|
||||||
typedef vertex<value_type,2> vertex_type;
|
typedef vertex<value_type,2> vertex_type;
|
||||||
enum {
|
enum block_e {
|
||||||
block_shift = 8,
|
block_shift = 8,
|
||||||
block_size = 1<<block_shift,
|
block_size = 1<<block_shift,
|
||||||
block_mask = block_size - 1,
|
block_mask = block_size - 1,
|
||||||
|
|
|
@ -31,7 +31,13 @@ postgis_src = Split(
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
postgis_inputdriver = env.SharedLibrary('postgis', source=postgis_src, SHLIBPREFIX='', LIBS='pq')
|
libraries = ['pq']
|
||||||
|
|
||||||
|
if env['PLATFORM'] == 'Darwin':
|
||||||
|
libraries.append('mapnik')
|
||||||
|
libraries.append('iconv')
|
||||||
|
|
||||||
|
postgis_inputdriver = env.SharedLibrary('postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries)
|
||||||
|
|
||||||
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', postgis_inputdriver)
|
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', postgis_inputdriver)
|
||||||
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
||||||
|
|
|
@ -32,10 +32,7 @@ extern "C"
|
||||||
|
|
||||||
#include "resultset.hpp"
|
#include "resultset.hpp"
|
||||||
|
|
||||||
using namespace mapnik;
|
|
||||||
|
|
||||||
class ResultSet;
|
class ResultSet;
|
||||||
|
|
||||||
class Connection
|
class Connection
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -32,8 +32,11 @@
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::Pool;
|
||||||
|
using mapnik::singleton;
|
||||||
|
using mapnik::CreateStatic;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
using boost::mutex;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ConnectionCreator
|
class ConnectionCreator
|
||||||
|
|
|
@ -43,6 +43,9 @@ using boost::lexical_cast;
|
||||||
using boost::bad_lexical_cast;
|
using boost::bad_lexical_cast;
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
|
|
||||||
|
using mapnik::PoolGuard;
|
||||||
|
using mapnik::attribute_descriptor;
|
||||||
|
|
||||||
postgis_datasource::postgis_datasource(parameters const& params)
|
postgis_datasource::postgis_datasource(parameters const& params)
|
||||||
: datasource (params),
|
: datasource (params),
|
||||||
table_(params.get("table")),
|
table_(params.get("table")),
|
||||||
|
|
|
@ -29,15 +29,24 @@
|
||||||
#include <mapnik/datasource.hpp>
|
#include <mapnik/datasource.hpp>
|
||||||
#include <mapnik/envelope.hpp>
|
#include <mapnik/envelope.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
|
#include <mapnik/feature_layer_desc.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "connection_manager.hpp"
|
#include "connection_manager.hpp"
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::transcoder;
|
||||||
class mapnik::transcoder;
|
using mapnik::datasource;
|
||||||
|
using mapnik::Envelope;
|
||||||
|
using mapnik::layer_descriptor;
|
||||||
|
using mapnik::featureset_ptr;
|
||||||
|
using mapnik::feature_ptr;
|
||||||
|
using mapnik::query;
|
||||||
|
using mapnik::parameters;
|
||||||
|
using mapnik::coord2d;
|
||||||
|
|
||||||
|
class transcoder;
|
||||||
class postgis_datasource : public datasource
|
class postgis_datasource : public datasource
|
||||||
{
|
{
|
||||||
static const std::string GEOMETRY_COLUMNS;
|
static const std::string GEOMETRY_COLUMNS;
|
||||||
|
@ -69,7 +78,7 @@ class postgis_datasource : public datasource
|
||||||
postgis_datasource& operator=(const postgis_datasource&);
|
postgis_datasource& operator=(const postgis_datasource&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class postgis_featureset : public Featureset
|
class postgis_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<ResultSet> rs_;
|
boost::shared_ptr<ResultSet> rs_;
|
||||||
|
|
|
@ -32,6 +32,10 @@ using boost::lexical_cast;
|
||||||
using boost::bad_lexical_cast;
|
using boost::bad_lexical_cast;
|
||||||
using boost::trim;
|
using boost::trim;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
using mapnik::Feature;
|
||||||
|
using mapnik::geometry_ptr;
|
||||||
|
using mapnik::byte;
|
||||||
|
using mapnik::geometry_utils;
|
||||||
|
|
||||||
postgis_featureset::postgis_featureset(boost::shared_ptr<ResultSet> const& rs,
|
postgis_featureset::postgis_featureset(boost::shared_ptr<ResultSet> const& rs,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
|
@ -48,8 +52,8 @@ feature_ptr postgis_featureset::next()
|
||||||
{
|
{
|
||||||
feature_ptr feature(new Feature(count_));
|
feature_ptr feature(new Feature(count_));
|
||||||
int size=rs_->getFieldLength(0);
|
int size=rs_->getFieldLength(0);
|
||||||
const char *data=rs_->getValue(0);
|
const char *data = rs_->getValue(0);
|
||||||
geometry_ptr geom=geometry_utils::from_wkb(data,size,-1);
|
geometry_ptr geom = geometry_utils::from_wkb(data,size,-1);
|
||||||
totalGeomSize_+=size;
|
totalGeomSize_+=size;
|
||||||
|
|
||||||
if (geom)
|
if (geom)
|
||||||
|
|
|
@ -32,7 +32,11 @@ raster_src = Split(
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
raster_inputdriver = env.SharedLibrary('raster', source=raster_src, SHLIBPREFIX='', LIBS=[])
|
libraries = []
|
||||||
|
if env['PLATFORM'] == 'Darwin':
|
||||||
|
libraries.append('mapnik')
|
||||||
|
|
||||||
|
raster_inputdriver = env.SharedLibrary('raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries)
|
||||||
|
|
||||||
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', raster_inputdriver)
|
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', raster_inputdriver)
|
||||||
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
||||||
|
|
|
@ -30,12 +30,19 @@
|
||||||
|
|
||||||
#include "raster_datasource.hpp"
|
#include "raster_datasource.hpp"
|
||||||
|
|
||||||
|
using mapnik::datasource;
|
||||||
|
using mapnik::parameters;
|
||||||
|
|
||||||
DATASOURCE_PLUGIN(raster_datasource)
|
DATASOURCE_PLUGIN(raster_datasource)
|
||||||
|
|
||||||
using std::clog;
|
using std::clog;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using boost::lexical_cast;
|
using boost::lexical_cast;
|
||||||
using boost::bad_lexical_cast;
|
using boost::bad_lexical_cast;
|
||||||
|
using mapnik::layer_descriptor;
|
||||||
|
using mapnik::featureset_ptr;
|
||||||
|
using mapnik::query;
|
||||||
|
using mapnik::coord2d;
|
||||||
|
|
||||||
raster_datasource::raster_datasource(const parameters& params)
|
raster_datasource::raster_datasource(const parameters& params)
|
||||||
: datasource (params),
|
: datasource (params),
|
||||||
|
|
|
@ -28,30 +28,28 @@
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
#include <mapnik/datasource.hpp>
|
#include <mapnik/datasource.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
class raster_datasource : public mapnik::datasource
|
||||||
|
|
||||||
class raster_datasource : public datasource
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
std::string format_;
|
std::string format_;
|
||||||
mapnik::Envelope<double> extent_;
|
mapnik::Envelope<double> extent_;
|
||||||
layer_descriptor desc_;
|
mapnik::layer_descriptor desc_;
|
||||||
static std::string name_;
|
static std::string name_;
|
||||||
public:
|
public:
|
||||||
raster_datasource(const parameters& params);
|
raster_datasource(const mapnik::parameters& params);
|
||||||
virtual ~raster_datasource();
|
virtual ~raster_datasource();
|
||||||
int type() const;
|
int type() const;
|
||||||
static std::string name();
|
static std::string name();
|
||||||
featureset_ptr features(const query& q) const;
|
mapnik::featureset_ptr features(const mapnik::query& q) const;
|
||||||
featureset_ptr features_at_point(coord2d const& pt) const;
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const;
|
||||||
mapnik::Envelope<double> envelope() const;
|
mapnik::Envelope<double> envelope() const;
|
||||||
layer_descriptor get_descriptor() const;
|
mapnik::layer_descriptor get_descriptor() const;
|
||||||
private:
|
private:
|
||||||
//no copying
|
//no copying
|
||||||
raster_datasource(const raster_datasource&);
|
raster_datasource(const raster_datasource&);
|
||||||
raster_datasource& operator=(const raster_datasource&);
|
raster_datasource& operator=(const raster_datasource&);
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //RASTER_DATASOURCE_H
|
#endif //RASTER_DATASOURCE_H
|
||||||
|
|
|
@ -25,14 +25,22 @@
|
||||||
|
|
||||||
#include "raster_featureset.hpp"
|
#include "raster_featureset.hpp"
|
||||||
|
|
||||||
|
using mapnik::query;
|
||||||
|
using mapnik::CoordTransform;
|
||||||
|
using mapnik::ImageReader;
|
||||||
|
using mapnik::Feature;
|
||||||
|
using mapnik::feature_ptr;
|
||||||
|
using mapnik::ImageData32;
|
||||||
|
using mapnik::raster;
|
||||||
|
|
||||||
template <typename LookupPolicy>
|
template <typename LookupPolicy>
|
||||||
raster_featureset<LookupPolicy>::raster_featureset(LookupPolicy const& policy,
|
raster_featureset<LookupPolicy>::raster_featureset(LookupPolicy const& policy,
|
||||||
query const& q)
|
query const& q)
|
||||||
: policy_(policy),
|
: policy_(policy),
|
||||||
id_(1),
|
id_(1),
|
||||||
extent_(q.get_bbox()),
|
extent_(q.get_bbox()),
|
||||||
curIter_(policy_.query(extent_)),
|
curIter_(policy_.query(extent_)),
|
||||||
endIter_(policy_.end())
|
endIter_(policy_.end())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <typename LookupPolicy>
|
template <typename LookupPolicy>
|
||||||
|
@ -41,35 +49,35 @@ raster_featureset<LookupPolicy>::~raster_featureset() {}
|
||||||
template <typename LookupPolicy>
|
template <typename LookupPolicy>
|
||||||
feature_ptr raster_featureset<LookupPolicy>::next()
|
feature_ptr raster_featureset<LookupPolicy>::next()
|
||||||
{
|
{
|
||||||
if (curIter_!=endIter_)
|
if (curIter_!=endIter_)
|
||||||
{
|
{
|
||||||
feature_ptr feature(new Feature(+id_));
|
feature_ptr feature(new Feature(+id_));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::auto_ptr<ImageReader> reader(get_image_reader(curIter_->format(),curIter_->file()));
|
std::auto_ptr<ImageReader> reader(mapnik::get_image_reader(curIter_->format(),curIter_->file()));
|
||||||
if (reader.get())
|
if (reader.get())
|
||||||
|
{
|
||||||
|
int image_width=reader->width();
|
||||||
|
int image_height=reader->height();
|
||||||
|
if (image_width>0 && image_height>0)
|
||||||
{
|
{
|
||||||
int image_width=reader->width();
|
CoordTransform t(image_width,image_height,curIter_->envelope(),0,0);
|
||||||
int image_height=reader->height();
|
Envelope<double> intersect=extent_.intersect(curIter_->envelope());
|
||||||
if (image_width>0 && image_height>0)
|
Envelope<double> ext=t.forward(intersect);
|
||||||
{
|
|
||||||
CoordTransform t(image_width,image_height,curIter_->envelope(),0,0);
|
|
||||||
Envelope<double> intersect=extent_.intersect(curIter_->envelope());
|
|
||||||
Envelope<double> ext=t.forward(intersect);
|
|
||||||
|
|
||||||
ImageData32 image((int)ext.width(),(int)ext.height());
|
ImageData32 image((int)ext.width(),(int)ext.height());
|
||||||
reader->read((int)ext.minx(),(int)ext.miny(),image);
|
reader->read((int)ext.minx(),(int)ext.miny(),image);
|
||||||
feature->set_raster(raster_ptr(new raster(intersect,image)));
|
feature->set_raster(mapnik::raster_ptr(new raster(intersect,image)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
}
|
||||||
{
|
catch (...)
|
||||||
}
|
{
|
||||||
++curIter_;
|
}
|
||||||
return feature;
|
++curIter_;
|
||||||
}
|
return feature;
|
||||||
return feature_ptr();
|
}
|
||||||
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
template class raster_featureset<single_file_policy>;
|
template class raster_featureset<single_file_policy>;
|
||||||
|
|
|
@ -27,15 +27,13 @@
|
||||||
#include "raster_datasource.hpp"
|
#include "raster_datasource.hpp"
|
||||||
#include "raster_info.hpp"
|
#include "raster_info.hpp"
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class single_file_policy
|
class single_file_policy
|
||||||
{
|
{
|
||||||
raster_info info_;
|
raster_info info_;
|
||||||
public:
|
public:
|
||||||
class const_iterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
enum {start,end};
|
enum iterator_e {start,end};
|
||||||
bool status_;
|
bool status_;
|
||||||
const single_file_policy* p_;
|
const single_file_policy* p_;
|
||||||
public:
|
public:
|
||||||
|
@ -96,18 +94,18 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename LookupPolicy>
|
template <typename LookupPolicy>
|
||||||
class raster_featureset : public Featureset
|
class raster_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
typedef typename LookupPolicy::const_iterator iterator_type;
|
typedef typename LookupPolicy::const_iterator iterator_type;
|
||||||
LookupPolicy policy_;
|
LookupPolicy policy_;
|
||||||
size_t id_;
|
size_t id_;
|
||||||
Envelope<double> extent_;
|
mapnik::Envelope<double> extent_;
|
||||||
iterator_type curIter_;
|
iterator_type curIter_;
|
||||||
iterator_type endIter_;
|
iterator_type endIter_;
|
||||||
public:
|
public:
|
||||||
raster_featureset(LookupPolicy const& policy,query const& q);
|
raster_featureset(LookupPolicy const& policy,mapnik::query const& q);
|
||||||
virtual ~raster_featureset();
|
virtual ~raster_featureset();
|
||||||
feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //RASTER_FEATURESET_HH
|
#endif //RASTER_FEATURESET_HH
|
||||||
|
|
|
@ -37,7 +37,12 @@ shape_src = Split(
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
shape_inputdriver = env.SharedLibrary('shape', source=shape_src, SHLIBPREFIX='', LIBS=[])
|
libraries = []
|
||||||
|
if env['PLATFORM'] == 'Darwin':
|
||||||
|
libraries.append('mapnik')
|
||||||
|
libraries.append('iconv')
|
||||||
|
|
||||||
|
shape_inputdriver = env.SharedLibrary('shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries)
|
||||||
|
|
||||||
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', shape_inputdriver)
|
env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', shape_inputdriver)
|
||||||
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
|
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::transcoder;
|
||||||
|
using mapnik::Feature;
|
||||||
class mapnik::transcoder;
|
class mapnik::transcoder;
|
||||||
|
|
||||||
struct field_descriptor
|
struct field_descriptor
|
||||||
{
|
{
|
||||||
int index_;
|
int index_;
|
||||||
|
|
|
@ -26,11 +26,18 @@
|
||||||
#include <mapnik/geom_util.hpp>
|
#include <mapnik/geom_util.hpp>
|
||||||
#include "shape_featureset.hpp"
|
#include "shape_featureset.hpp"
|
||||||
#include "shape_index_featureset.hpp"
|
#include "shape_index_featureset.hpp"
|
||||||
|
|
||||||
#include "shape.hpp"
|
#include "shape.hpp"
|
||||||
|
|
||||||
DATASOURCE_PLUGIN(shape_datasource)
|
DATASOURCE_PLUGIN(shape_datasource)
|
||||||
|
|
||||||
|
using mapnik::String;
|
||||||
|
using mapnik::Double;
|
||||||
|
using mapnik::Integer;
|
||||||
|
using mapnik::datasource_exception;
|
||||||
|
using mapnik::filter_in_box;
|
||||||
|
using mapnik::filter_at_point;
|
||||||
|
using mapnik::attribute_descriptor;
|
||||||
|
|
||||||
shape_datasource::shape_datasource(const parameters ¶ms)
|
shape_datasource::shape_datasource(const parameters ¶ms)
|
||||||
: datasource (params) ,
|
: datasource (params) ,
|
||||||
shape_name_(params.get("file")),
|
shape_name_(params.get("file")),
|
||||||
|
@ -55,18 +62,18 @@ shape_datasource::shape_datasource(const parameters ¶ms)
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'M':
|
case 'M':
|
||||||
case 'L':
|
case 'L':
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
|
//desc_.add_descriptor(attribute_descriptor(fld_name, String));
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
case 'F':
|
case 'F':
|
||||||
{
|
{
|
||||||
if (fd.dec_>0)
|
if (fd.dec_>0)
|
||||||
{
|
{
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double,false,8));
|
//desc_.add_descriptor(attribute_descriptor(fld_name,Double,false,8));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Integer,false,4));
|
//desc_.add_descriptor(attribute_descriptor(fld_name,Integer,false,4));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +121,7 @@ void shape_datasource::init(shape_io& shape)
|
||||||
#else
|
#else
|
||||||
shape.shp().skip(4);
|
shape.shp().skip(4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
shape.shp().read_envelope(extent_);
|
shape.shp().read_envelope(extent_);
|
||||||
shape.shp().skip(4*8);
|
shape.shp().skip(4*8);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,12 @@
|
||||||
|
|
||||||
#include "shape_io.hpp"
|
#include "shape_io.hpp"
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::datasource;
|
||||||
|
using mapnik::parameters;
|
||||||
|
using mapnik::query;
|
||||||
|
using mapnik::featureset_ptr;
|
||||||
|
using mapnik::layer_descriptor;
|
||||||
|
using mapnik::coord2d;
|
||||||
|
|
||||||
class shape_datasource : public datasource
|
class shape_datasource : public datasource
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,8 @@ shape_featureset<filterT>::shape_featureset(const filterT& filter,
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
feature_ptr shape_featureset<filterT>::next()
|
feature_ptr shape_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
using mapnik::point_impl;
|
||||||
std::streampos pos=shape_.shp().pos();
|
std::streampos pos=shape_.shp().pos();
|
||||||
|
|
||||||
if (pos < std::streampos(file_length_ * 2))
|
if (pos < std::streampos(file_length_ * 2))
|
||||||
|
@ -194,7 +196,7 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
shape_featureset<filterT>::~shape_featureset() {}
|
shape_featureset<filterT>::~shape_featureset() {}
|
||||||
|
|
||||||
template class shape_featureset<filter_in_box>;
|
template class shape_featureset<mapnik::filter_in_box>;
|
||||||
template class shape_featureset<filter_at_point>;
|
template class shape_featureset<mapnik::filter_at_point>;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#include <mapnik/geom_util.hpp>
|
#include <mapnik/geom_util.hpp>
|
||||||
#include "shape.hpp"
|
#include "shape.hpp"
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::Featureset;
|
||||||
|
using mapnik::Envelope;
|
||||||
|
using mapnik::feature_ptr;
|
||||||
|
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
class shape_featureset : public Featureset
|
class shape_featureset : public Featureset
|
||||||
|
|
|
@ -71,12 +71,14 @@ shape_index_featureset<filterT>::shape_index_featureset(const filterT& filter,
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
feature_ptr shape_index_featureset<filterT>::next()
|
feature_ptr shape_index_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
|
using mapnik::feature_factory;
|
||||||
if (itr_!=ids_.end())
|
using mapnik::point_impl;
|
||||||
|
if (itr_!=ids_.end())
|
||||||
{
|
{
|
||||||
int pos=*itr_++;
|
int pos=*itr_++;
|
||||||
shape_.move_to(pos);
|
shape_.move_to(pos);
|
||||||
int type=shape_.type();
|
int type=shape_.type();
|
||||||
|
|
||||||
feature_ptr feature(feature_factory::create(shape_.id_));
|
feature_ptr feature(feature_factory::create(shape_.id_));
|
||||||
|
|
||||||
if (type==shape_io::shape_point)
|
if (type==shape_io::shape_point)
|
||||||
|
@ -198,6 +200,6 @@ feature_ptr shape_index_featureset<filterT>::next()
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
shape_index_featureset<filterT>::~shape_index_featureset() {}
|
shape_index_featureset<filterT>::~shape_index_featureset() {}
|
||||||
|
|
||||||
template class shape_index_featureset<filter_in_box>;
|
template class shape_index_featureset<mapnik::filter_in_box>;
|
||||||
template class shape_index_featureset<filter_at_point>;
|
template class shape_index_featureset<mapnik::filter_at_point>;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "shape.hpp"
|
#include "shape.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
using mapnik::datasource_exception;
|
||||||
const std::string shape_io::SHP = ".shp";
|
const std::string shape_io::SHP = ".shp";
|
||||||
const std::string shape_io::DBF = ".dbf";
|
const std::string shape_io::DBF = ".dbf";
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ dbf_file& shape_io::dbf()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polyline()
|
geometry_ptr shape_io::read_polyline()
|
||||||
{
|
{
|
||||||
|
using mapnik::line_string_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
@ -145,6 +147,7 @@ geometry_ptr shape_io::read_polyline()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polylinem()
|
geometry_ptr shape_io::read_polylinem()
|
||||||
{
|
{
|
||||||
|
using mapnik::line_string_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
@ -207,6 +210,7 @@ geometry_ptr shape_io::read_polylinem()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polylinez()
|
geometry_ptr shape_io::read_polylinez()
|
||||||
{
|
{
|
||||||
|
using mapnik::line_string_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
@ -276,6 +280,7 @@ geometry_ptr shape_io::read_polylinez()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polygon()
|
geometry_ptr shape_io::read_polygon()
|
||||||
{
|
{
|
||||||
|
using mapnik::polygon_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
@ -316,6 +321,7 @@ geometry_ptr shape_io::read_polygon()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polygonm()
|
geometry_ptr shape_io::read_polygonm()
|
||||||
{
|
{
|
||||||
|
using mapnik::polygon_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
@ -364,6 +370,7 @@ geometry_ptr shape_io::read_polygonm()
|
||||||
|
|
||||||
geometry_ptr shape_io::read_polygonz()
|
geometry_ptr shape_io::read_polygonz()
|
||||||
{
|
{
|
||||||
|
using mapnik::polygon_impl;
|
||||||
shape_record record(reclength_*2-36);
|
shape_record record(reclength_*2-36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
int num_parts=record.read_ndr_integer();
|
int num_parts=record.read_ndr_integer();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <mapnik/envelope.hpp>
|
#include <mapnik/envelope.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::Envelope;
|
||||||
|
|
||||||
struct shape_record
|
struct shape_record
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,5 +76,5 @@ void shp_index<filterT>::read_envelope(std::ifstream& file,Envelope<double>& env
|
||||||
file.read(reinterpret_cast<char*>(&envelope),sizeof(envelope));
|
file.read(reinterpret_cast<char*>(&envelope),sizeof(envelope));
|
||||||
}
|
}
|
||||||
|
|
||||||
template class shp_index<filter_in_box>;
|
template class shp_index<mapnik::filter_in_box>;
|
||||||
template class shp_index<filter_at_point>;
|
template class shp_index<mapnik::filter_at_point>;
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#include <mapnik/envelope.hpp>
|
#include <mapnik/envelope.hpp>
|
||||||
#include <mapnik/query.hpp>
|
#include <mapnik/query.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::Envelope;
|
||||||
|
using mapnik::query;
|
||||||
|
|
||||||
template <typename filterT>
|
template <typename filterT>
|
||||||
class shp_index
|
class shp_index
|
||||||
|
|
|
@ -29,7 +29,10 @@ install_prefix = env['DESTDIR'] + '/' + prefix
|
||||||
|
|
||||||
libraries = ['agg'] + env['LIBS']
|
libraries = ['agg'] + env['LIBS']
|
||||||
|
|
||||||
linkflags = '-Wl,-rpath-link,. -Wl,-soname,libmapnik.so'
|
if env['PLATFORM'] == 'Darwin':
|
||||||
|
linkflags = ' '
|
||||||
|
else: # Linux and others
|
||||||
|
linkflags = '-Wl,-rpath-link,. -Wl,-soname,libmapnik.so'
|
||||||
|
|
||||||
source = Split(
|
source = Split(
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace mapnik
|
||||||
{
|
{
|
||||||
if (!is_directory( *itr ) && itr->leaf()[0]!='.')
|
if (!is_directory( *itr ) && itr->leaf()[0]!='.')
|
||||||
{
|
{
|
||||||
lt_dlhandle module=lt_dlopenext(itr->string().c_str());
|
lt_dlhandle module=lt_dlopen(itr->string().c_str());
|
||||||
if (module)
|
if (module)
|
||||||
{
|
{
|
||||||
datasource_name* ds_name =
|
datasource_name* ds_name =
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace mapnik
|
||||||
int tile_width_;
|
int tile_width_;
|
||||||
int tile_height_;
|
int tile_height_;
|
||||||
public:
|
public:
|
||||||
enum {
|
enum TiffType {
|
||||||
generic=1,
|
generic=1,
|
||||||
stripped,
|
stripped,
|
||||||
tiled
|
tiled
|
||||||
|
|
|
@ -21,51 +21,52 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
//$Id: quadtree.hh 17 2005-03-08 23:58:43Z pavlenko $
|
//$Id: quadtree.hh 17 2005-03-08 23:58:43Z pavlenko $
|
||||||
|
|
||||||
#ifndef QUADTREE_HH
|
#ifndef QUADTREE_HPP
|
||||||
#define QUADTREE_HH
|
#define QUADTREE_HPP
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/envelope.hpp>
|
#include <mapnik/envelope.hpp>
|
||||||
|
|
||||||
using namespace mapnik;
|
using mapnik::Envelope;
|
||||||
|
using mapnik::coord2d;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct quadtree_node
|
struct quadtree_node
|
||||||
{
|
{
|
||||||
Envelope<double> ext_;
|
Envelope<double> ext_;
|
||||||
std::vector<T> data_;
|
std::vector<T> data_;
|
||||||
quadtree_node<T>* children_[4];
|
quadtree_node<T>* children_[4];
|
||||||
quadtree_node(const Envelope<double>& ext)
|
quadtree_node(const Envelope<double>& ext)
|
||||||
: ext_(ext),data_()
|
: ext_(ext),data_()
|
||||||
{
|
{
|
||||||
memset(children_,0,sizeof(quadtree_node<T>*)*4);
|
memset(children_,0,sizeof(quadtree_node<T>*)*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
~quadtree_node()
|
~quadtree_node()
|
||||||
{
|
{
|
||||||
for (int i=0;i<4;++i)
|
for (int i=0;i<4;++i)
|
||||||
{
|
{
|
||||||
if (children_[i])
|
if (children_[i])
|
||||||
{
|
{
|
||||||
delete children_[i],children_[i]=0;
|
delete children_[i],children_[i]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int num_subnodes() const
|
int num_subnodes() const
|
||||||
{
|
{
|
||||||
int count=0;
|
int count=0;
|
||||||
for (int i=0;i<4;++i)
|
for (int i=0;i<4;++i)
|
||||||
{
|
{
|
||||||
if (children_[i])
|
if (children_[i])
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -294,4 +295,4 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif //QUADTREE_HH
|
#endif //QUADTREE_HPP
|
||||||
|
|
Loading…
Add table
Reference in a new issue