Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
877128d5ec | ||
|
9280dd8b45 | ||
|
492db7232f | ||
|
fca7b80942 | ||
|
fc1c3fd1a4 |
23 changed files with 243 additions and 410 deletions
68
SConstruct
68
SConstruct
|
@ -87,7 +87,6 @@ pretty_dep_names = {
|
||||||
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option',
|
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option',
|
||||||
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
||||||
'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
||||||
'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.',
|
|
||||||
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
||||||
'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)'
|
'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)'
|
||||||
}
|
}
|
||||||
|
@ -919,35 +918,6 @@ int main()
|
||||||
color_print(1,'\nFound insufficient icu version... %s' % result)
|
color_print(1,'\nFound insufficient icu version... %s' % result)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def boost_regex_has_icu(context):
|
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
|
||||||
context.env.AppendUnique(LIBS='icudata')
|
|
||||||
ret = context.TryRun("""
|
|
||||||
|
|
||||||
#include <boost/regex/icu.hpp>
|
|
||||||
#include <unicode/unistr.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
U_NAMESPACE_QUALIFIER UnicodeString ustr;
|
|
||||||
try {
|
|
||||||
boost::u32regex pattern = boost::make_u32regex(ustr);
|
|
||||||
}
|
|
||||||
// an exception is fine, still indicates support is
|
|
||||||
// likely compiled into regex
|
|
||||||
catch (...) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
""", '.cpp')
|
|
||||||
context.Message('Checking if boost_regex was built with ICU unicode support... ')
|
|
||||||
context.Result(ret[0])
|
|
||||||
if ret[0]:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def sqlite_has_rtree(context, silent=False):
|
def sqlite_has_rtree(context, silent=False):
|
||||||
""" check an sqlite3 install has rtree support.
|
""" check an sqlite3 install has rtree support.
|
||||||
|
|
||||||
|
@ -994,6 +964,30 @@ int main()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def supports_cxx11(context,silent=False):
|
||||||
|
ret = context.TryRun("""
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
""", '.cpp')
|
||||||
|
if not silent:
|
||||||
|
context.Message('Checking if compiler (%s) supports -std=c++11 flag... ' % context.env.get('CXX','CXX'))
|
||||||
|
if silent:
|
||||||
|
context.did_show_result=1
|
||||||
|
context.Result(ret[0])
|
||||||
|
if ret[0]:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
conf_tests = { 'prioritize_paths' : prioritize_paths,
|
conf_tests = { 'prioritize_paths' : prioritize_paths,
|
||||||
'CheckPKGConfig' : CheckPKGConfig,
|
'CheckPKGConfig' : CheckPKGConfig,
|
||||||
'CheckPKG' : CheckPKG,
|
'CheckPKG' : CheckPKG,
|
||||||
|
@ -1009,8 +1003,8 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
|
||||||
'get_pkg_lib' : get_pkg_lib,
|
'get_pkg_lib' : get_pkg_lib,
|
||||||
'rollback_option' : rollback_option,
|
'rollback_option' : rollback_option,
|
||||||
'icu_at_least_four_two' : icu_at_least_four_two,
|
'icu_at_least_four_two' : icu_at_least_four_two,
|
||||||
'boost_regex_has_icu' : boost_regex_has_icu,
|
|
||||||
'sqlite_has_rtree' : sqlite_has_rtree,
|
'sqlite_has_rtree' : sqlite_has_rtree,
|
||||||
|
'supports_cxx11' : supports_cxx11,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1121,7 +1115,6 @@ if not preconfigured:
|
||||||
if env['SYSTEM_FONTS']:
|
if env['SYSTEM_FONTS']:
|
||||||
if not os.path.isdir(env['SYSTEM_FONTS']):
|
if not os.path.isdir(env['SYSTEM_FONTS']):
|
||||||
color_print(1,'Warning: Directory specified for SYSTEM_FONTS does not exist!')
|
color_print(1,'Warning: Directory specified for SYSTEM_FONTS does not exist!')
|
||||||
#### Libraries and headers dependency checks ####
|
|
||||||
|
|
||||||
# Set up for libraries and headers dependency checks
|
# Set up for libraries and headers dependency checks
|
||||||
env['CPPPATH'] = ['#include', '#']
|
env['CPPPATH'] = ['#include', '#']
|
||||||
|
@ -1259,6 +1252,11 @@ if not preconfigured:
|
||||||
if env['PRIORITIZE_LINKING']:
|
if env['PRIORITIZE_LINKING']:
|
||||||
conf.prioritize_paths(silent=True)
|
conf.prioritize_paths(silent=True)
|
||||||
|
|
||||||
|
# test for C++11 support, which is required
|
||||||
|
if not conf.supports_cxx11():
|
||||||
|
color_print(1,"C++ compiler does not support C++11 standard, which is required. Please use Mapnik 2.x instead of 3.x as an alternative")
|
||||||
|
Exit(1)
|
||||||
|
|
||||||
if not env['HOST']:
|
if not env['HOST']:
|
||||||
for libname, headers, required, lang in REQUIRED_LIBSHEADERS:
|
for libname, headers, required, lang in REQUIRED_LIBSHEADERS:
|
||||||
if not conf.CheckLibWithHeader(libname, headers, lang):
|
if not conf.CheckLibWithHeader(libname, headers, lang):
|
||||||
|
@ -1299,7 +1297,6 @@ if not preconfigured:
|
||||||
BOOST_LIBSHEADERS = [
|
BOOST_LIBSHEADERS = [
|
||||||
['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],
|
|
||||||
['program_options', 'boost/program_options.hpp', False]
|
['program_options', 'boost/program_options.hpp', False]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1342,11 +1339,6 @@ if not preconfigured:
|
||||||
# we need libicui18n if using static boost libraries, so it is
|
# we need libicui18n if using static boost libraries, so it is
|
||||||
# important to try this check with the library linked
|
# important to try this check with the library linked
|
||||||
env.AppendUnique(LIBS='icui18n')
|
env.AppendUnique(LIBS='icui18n')
|
||||||
if conf.boost_regex_has_icu():
|
|
||||||
# TODO - should avoid having this be globally defined...
|
|
||||||
env.Append(CPPDEFINES = '-DBOOST_REGEX_HAS_ICU')
|
|
||||||
else:
|
|
||||||
env['SKIPPED_DEPS'].append('boost_regex_icu')
|
|
||||||
|
|
||||||
for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS:
|
for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS:
|
||||||
if not env['HOST']:
|
if not env['HOST']:
|
||||||
|
|
|
@ -100,9 +100,7 @@ struct parameters_pickle_suite : boost::python::pickle_suite
|
||||||
}
|
}
|
||||||
else if (ex3.check())
|
else if (ex3.check())
|
||||||
{
|
{
|
||||||
std::string buffer;
|
p[key] = ex3();
|
||||||
mapnik::to_utf8(ex3(),buffer);
|
|
||||||
p[key] = buffer;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -178,20 +176,13 @@ mapnik::value_holder get_param(mapnik::parameter const& p, int index)
|
||||||
|
|
||||||
std::shared_ptr<mapnik::parameter> create_parameter(mapnik::value_unicode_string const& key, mapnik::value_holder const& value)
|
std::shared_ptr<mapnik::parameter> create_parameter(mapnik::value_unicode_string const& key, mapnik::value_holder const& value)
|
||||||
{
|
{
|
||||||
std::string key_utf8;
|
return std::make_shared<mapnik::parameter>(key,value);
|
||||||
mapnik::to_utf8(key, key_utf8);
|
|
||||||
return std::make_shared<mapnik::parameter>(key_utf8,value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed for Python_Unicode to std::string (utf8) conversion
|
// needed for Python_Unicode to std::string (utf8) conversion --- FIXME!!
|
||||||
|
|
||||||
std::shared_ptr<mapnik::parameter> create_parameter_from_string(mapnik::value_unicode_string const& key, mapnik::value_unicode_string const& ustr)
|
std::shared_ptr<mapnik::parameter> create_parameter_from_string(mapnik::value_unicode_string const& key, mapnik::value_unicode_string const& ustr)
|
||||||
{
|
{
|
||||||
std::string key_utf8;
|
return std::make_shared<mapnik::parameter>(key, ustr);
|
||||||
std::string ustr_utf8;
|
|
||||||
mapnik::to_utf8(key, key_utf8);
|
|
||||||
mapnik::to_utf8(ustr,ustr_utf8);
|
|
||||||
return std::make_shared<mapnik::parameter>(key_utf8, ustr_utf8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_parameters()
|
void export_parameters()
|
||||||
|
|
|
@ -48,16 +48,16 @@ namespace boost { namespace python {
|
||||||
return ::PyBool_FromLong(val);
|
return ::PyBool_FromLong(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject * operator() (std::string const& s) const
|
// PyObject * operator() (std::string const& s) const
|
||||||
{
|
// {
|
||||||
return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
// return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
PyObject * operator() (mapnik::value_unicode_string const& s) const
|
PyObject * operator() (mapnik::value_unicode_string const& s) const
|
||||||
{
|
{
|
||||||
std::string buffer;
|
//std::string buffer;
|
||||||
mapnik::to_utf8(s,buffer);
|
//mapnik::to_utf8(s,buffer);
|
||||||
return ::PyUnicode_DecodeUTF8(buffer.c_str(),implicit_cast<ssize_t>(buffer.length()),0);
|
return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject * operator() (mapnik::value_null const& /*s*/) const
|
PyObject * operator() (mapnik::value_null const& /*s*/) const
|
||||||
|
|
91
deps/agg/include/agg_basics.h
vendored
91
deps/agg/include/agg_basics.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -25,25 +25,25 @@
|
||||||
#else
|
#else
|
||||||
namespace agg
|
namespace agg
|
||||||
{
|
{
|
||||||
// The policy of all AGG containers and memory allocation strategy
|
// The policy of all AGG containers and memory allocation strategy
|
||||||
// in general is that no allocated data requires explicit construction.
|
// in general is that no allocated data requires explicit construction.
|
||||||
// It means that the allocator can be really simple; you can even
|
// It means that the allocator can be really simple; you can even
|
||||||
// replace new/delete to malloc/free. The constructors and destructors
|
// replace new/delete to malloc/free. The constructors and destructors
|
||||||
// won't be called in this case, however everything will remain working.
|
// won't be called in this case, however everything will remain working.
|
||||||
// The second argument of deallocate() is the size of the allocated
|
// The second argument of deallocate() is the size of the allocated
|
||||||
// block. You can use this information if you wish.
|
// block. You can use this information if you wish.
|
||||||
//------------------------------------------------------------pod_allocator
|
//------------------------------------------------------------pod_allocator
|
||||||
template<class T> struct pod_allocator
|
template<class T> struct pod_allocator
|
||||||
{
|
{
|
||||||
//static T* allocate(unsigned num) { return static_cast<T*>(::operator new(sizeof(T)*num));}
|
//static T* allocate(unsigned num) { return static_cast<T*>(::operator new(sizeof(T)*num));}
|
||||||
//static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;}
|
//static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;}
|
||||||
static T* allocate(unsigned num) { return new T [num]; }
|
static T* allocate(unsigned num) { return new T [num]; }
|
||||||
static void deallocate(T* ptr, unsigned) { delete [] ptr; }
|
static void deallocate(T* ptr, unsigned) { delete [] ptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Single object allocator. It's also can be replaced with your custom
|
// Single object allocator. It's also can be replaced with your custom
|
||||||
// allocator. The difference is that it can only allocate a single
|
// allocator. The difference is that it can only allocate a single
|
||||||
// object and the constructor and destructor must be called.
|
// object and the constructor and destructor must be called.
|
||||||
// In AGG there is no need to allocate an array of objects with
|
// In AGG there is no need to allocate an array of objects with
|
||||||
// calling their constructors (only single ones). So that, if you
|
// calling their constructors (only single ones). So that, if you
|
||||||
// replace these new/delete to malloc/free make sure that the in-place
|
// replace these new/delete to malloc/free make sure that the in-place
|
||||||
|
@ -205,7 +205,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
AGG_INLINE static unsigned mul(unsigned a, unsigned b)
|
AGG_INLINE static unsigned mul(unsigned a, unsigned b)
|
||||||
{
|
{
|
||||||
register unsigned q = a * b + (1 << (Shift-1));
|
unsigned q = a * b + (1 << (Shift-1));
|
||||||
return (q + (q >> Shift)) >> Shift;
|
return (q + (q >> Shift)) >> Shift;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -215,23 +215,23 @@ namespace agg
|
||||||
enum cover_scale_e
|
enum cover_scale_e
|
||||||
{
|
{
|
||||||
cover_shift = 8, //----cover_shift
|
cover_shift = 8, //----cover_shift
|
||||||
cover_size = 1 << cover_shift, //----cover_size
|
cover_size = 1 << cover_shift, //----cover_size
|
||||||
cover_mask = cover_size - 1, //----cover_mask
|
cover_mask = cover_size - 1, //----cover_mask
|
||||||
cover_none = 0, //----cover_none
|
cover_none = 0, //----cover_none
|
||||||
cover_full = cover_mask //----cover_full
|
cover_full = cover_mask //----cover_full
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------poly_subpixel_scale_e
|
//----------------------------------------------------poly_subpixel_scale_e
|
||||||
// These constants determine the subpixel accuracy, to be more precise,
|
// These constants determine the subpixel accuracy, to be more precise,
|
||||||
// the number of bits of the fractional part of the coordinates.
|
// the number of bits of the fractional part of the coordinates.
|
||||||
// The possible coordinate capacity in bits can be calculated by formula:
|
// The possible coordinate capacity in bits can be calculated by formula:
|
||||||
// sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and
|
// sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and
|
||||||
// 8-bits fractional part the capacity is 24 bits.
|
// 8-bits fractional part the capacity is 24 bits.
|
||||||
enum poly_subpixel_scale_e
|
enum poly_subpixel_scale_e
|
||||||
{
|
{
|
||||||
poly_subpixel_shift = 8, //----poly_subpixel_shift
|
poly_subpixel_shift = 8, //----poly_subpixel_shift
|
||||||
poly_subpixel_scale = 1<<poly_subpixel_shift, //----poly_subpixel_scale
|
poly_subpixel_scale = 1<<poly_subpixel_shift, //----poly_subpixel_scale
|
||||||
poly_subpixel_mask = poly_subpixel_scale-1 //----poly_subpixel_mask
|
poly_subpixel_mask = poly_subpixel_scale-1 //----poly_subpixel_mask
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------filling_rule_e
|
//----------------------------------------------------------filling_rule_e
|
||||||
|
@ -255,7 +255,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
return rad * 180.0 / pi;
|
return rad * 180.0 / pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------rect_base
|
//----------------------------------------------------------------rect_base
|
||||||
template<class T> struct rect_base
|
template<class T> struct rect_base
|
||||||
{
|
{
|
||||||
|
@ -267,9 +267,9 @@ namespace agg
|
||||||
rect_base(T x1_, T y1_, T x2_, T y2_) :
|
rect_base(T x1_, T y1_, T x2_, T y2_) :
|
||||||
x1(x1_), y1(y1_), x2(x2_), y2(y2_) {}
|
x1(x1_), y1(y1_), x2(x2_), y2(y2_) {}
|
||||||
|
|
||||||
void init(T x1_, T y1_, T x2_, T y2_)
|
void init(T x1_, T y1_, T x2_, T y2_)
|
||||||
{
|
{
|
||||||
x1 = x1_; y1 = y1_; x2 = x2_; y2 = y2_;
|
x1 = x1_; y1 = y1_; x2 = x2_; y2 = y2_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const self_type& normalize()
|
const self_type& normalize()
|
||||||
|
@ -301,17 +301,17 @@ namespace agg
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------intersect_rectangles
|
//-----------------------------------------------------intersect_rectangles
|
||||||
template<class Rect>
|
template<class Rect>
|
||||||
inline Rect intersect_rectangles(const Rect& r1, const Rect& r2)
|
inline Rect intersect_rectangles(const Rect& r1, const Rect& r2)
|
||||||
{
|
{
|
||||||
Rect r = r1;
|
Rect r = r1;
|
||||||
|
|
||||||
// First process x2,y2 because the other order
|
// First process x2,y2 because the other order
|
||||||
// results in Internal Compiler Error under
|
// results in Internal Compiler Error under
|
||||||
// Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in
|
// Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in
|
||||||
// case of "Maximize Speed" optimization option.
|
// case of "Maximize Speed" optimization option.
|
||||||
//-----------------
|
//-----------------
|
||||||
if(r.x2 > r2.x2) r.x2 = r2.x2;
|
if(r.x2 > r2.x2) r.x2 = r2.x2;
|
||||||
if(r.y2 > r2.y2) r.y2 = r2.y2;
|
if(r.y2 > r2.y2) r.y2 = r2.y2;
|
||||||
if(r.x1 < r2.x1) r.x1 = r2.x1;
|
if(r.x1 < r2.x1) r.x1 = r2.x1;
|
||||||
if(r.y1 < r2.y1) r.y1 = r2.y1;
|
if(r.y1 < r2.y1) r.y1 = r2.y1;
|
||||||
|
@ -320,7 +320,7 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------unite_rectangles
|
//---------------------------------------------------------unite_rectangles
|
||||||
template<class Rect>
|
template<class Rect>
|
||||||
inline Rect unite_rectangles(const Rect& r1, const Rect& r2)
|
inline Rect unite_rectangles(const Rect& r1, const Rect& r2)
|
||||||
{
|
{
|
||||||
Rect r = r1;
|
Rect r = r1;
|
||||||
|
@ -338,26 +338,26 @@ namespace agg
|
||||||
//---------------------------------------------------------path_commands_e
|
//---------------------------------------------------------path_commands_e
|
||||||
enum path_commands_e
|
enum path_commands_e
|
||||||
{
|
{
|
||||||
path_cmd_stop = 0, //----path_cmd_stop
|
path_cmd_stop = 0, //----path_cmd_stop
|
||||||
path_cmd_move_to = 1, //----path_cmd_move_to
|
path_cmd_move_to = 1, //----path_cmd_move_to
|
||||||
path_cmd_line_to = 2, //----path_cmd_line_to
|
path_cmd_line_to = 2, //----path_cmd_line_to
|
||||||
path_cmd_curve3 = 3, //----path_cmd_curve3
|
path_cmd_curve3 = 3, //----path_cmd_curve3
|
||||||
path_cmd_curve4 = 4, //----path_cmd_curve4
|
path_cmd_curve4 = 4, //----path_cmd_curve4
|
||||||
path_cmd_curveN = 5, //----path_cmd_curveN
|
path_cmd_curveN = 5, //----path_cmd_curveN
|
||||||
path_cmd_catrom = 6, //----path_cmd_catrom
|
path_cmd_catrom = 6, //----path_cmd_catrom
|
||||||
path_cmd_ubspline = 7, //----path_cmd_ubspline
|
path_cmd_ubspline = 7, //----path_cmd_ubspline
|
||||||
path_cmd_end_poly = 0x0F, //----path_cmd_end_poly
|
path_cmd_end_poly = 0x0F, //----path_cmd_end_poly
|
||||||
path_cmd_mask = 0x0F //----path_cmd_mask
|
path_cmd_mask = 0x0F //----path_cmd_mask
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------path_flags_e
|
//------------------------------------------------------------path_flags_e
|
||||||
enum path_flags_e
|
enum path_flags_e
|
||||||
{
|
{
|
||||||
path_flags_none = 0, //----path_flags_none
|
path_flags_none = 0, //----path_flags_none
|
||||||
path_flags_ccw = 0x10, //----path_flags_ccw
|
path_flags_ccw = 0x10, //----path_flags_ccw
|
||||||
path_flags_cw = 0x20, //----path_flags_cw
|
path_flags_cw = 0x20, //----path_flags_cw
|
||||||
path_flags_close = 0x40, //----path_flags_close
|
path_flags_close = 0x40, //----path_flags_close
|
||||||
path_flags_mask = 0xF0 //----path_flags_mask
|
path_flags_mask = 0xF0 //----path_flags_mask
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------is_vertex
|
//---------------------------------------------------------------is_vertex
|
||||||
|
@ -374,7 +374,7 @@ namespace agg
|
||||||
|
|
||||||
//-----------------------------------------------------------------is_stop
|
//-----------------------------------------------------------------is_stop
|
||||||
inline bool is_stop(unsigned c)
|
inline bool is_stop(unsigned c)
|
||||||
{
|
{
|
||||||
return c == path_cmd_stop;
|
return c == path_cmd_stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ namespace agg
|
||||||
inline bool is_close(unsigned c)
|
inline bool is_close(unsigned c)
|
||||||
{
|
{
|
||||||
return (c & ~(path_flags_cw | path_flags_ccw)) ==
|
return (c & ~(path_flags_cw | path_flags_ccw)) ==
|
||||||
(path_cmd_end_poly | path_flags_close);
|
(path_cmd_end_poly | path_flags_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------is_next_poly
|
//------------------------------------------------------------is_next_poly
|
||||||
|
@ -442,19 +442,19 @@ namespace agg
|
||||||
//-------------------------------------------------------------is_oriented
|
//-------------------------------------------------------------is_oriented
|
||||||
inline bool is_oriented(unsigned c)
|
inline bool is_oriented(unsigned c)
|
||||||
{
|
{
|
||||||
return (c & (path_flags_cw | path_flags_ccw)) != 0;
|
return (c & (path_flags_cw | path_flags_ccw)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------is_closed
|
//---------------------------------------------------------------is_closed
|
||||||
inline bool is_closed(unsigned c)
|
inline bool is_closed(unsigned c)
|
||||||
{
|
{
|
||||||
return (c & path_flags_close) != 0;
|
return (c & path_flags_close) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------get_close_flag
|
//----------------------------------------------------------get_close_flag
|
||||||
inline unsigned get_close_flag(unsigned c)
|
inline unsigned get_close_flag(unsigned c)
|
||||||
{
|
{
|
||||||
return c & path_flags_close;
|
return c & path_flags_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------clear_orientation
|
//-------------------------------------------------------clear_orientation
|
||||||
|
@ -515,7 +515,7 @@ namespace agg
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
const T* ptr;
|
const T* ptr;
|
||||||
const_row_info() {}
|
const_row_info() {}
|
||||||
const_row_info(int x1_, int x2_, const T* ptr_) :
|
const_row_info(int x1_, int x2_, const T* ptr_) :
|
||||||
x1(x1_), x2(x2_), ptr(ptr_) {}
|
x1(x1_), x2(x2_), ptr(ptr_) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -529,4 +529,3 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
62
deps/agg/include/agg_image_accessors.h
vendored
62
deps/agg/include/agg_image_accessors.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -32,8 +32,8 @@ namespace agg
|
||||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||||
|
|
||||||
image_accessor_clip() {}
|
image_accessor_clip() {}
|
||||||
explicit image_accessor_clip(const pixfmt_type& pixf,
|
explicit image_accessor_clip(const pixfmt_type& pixf,
|
||||||
const color_type& bk) :
|
const color_type& bk) :
|
||||||
m_pixf(&pixf)
|
m_pixf(&pixf)
|
||||||
{
|
{
|
||||||
pixfmt_type::make_pix(m_bk_buf, bk);
|
pixfmt_type::make_pix(m_bk_buf, bk);
|
||||||
|
@ -85,7 +85,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
++m_y;
|
++m_y;
|
||||||
m_x = m_x0;
|
m_x = m_x0;
|
||||||
if(m_pix_ptr &&
|
if(m_pix_ptr &&
|
||||||
m_y >= 0 && m_y < (int)m_pixf->height())
|
m_y >= 0 && m_y < (int)m_pixf->height())
|
||||||
{
|
{
|
||||||
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
||||||
|
@ -115,8 +115,8 @@ namespace agg
|
||||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||||
|
|
||||||
image_accessor_no_clip() {}
|
image_accessor_no_clip() {}
|
||||||
explicit image_accessor_no_clip(const pixfmt_type& pixf) :
|
explicit image_accessor_no_clip(const pixfmt_type& pixf) :
|
||||||
m_pixf(&pixf)
|
m_pixf(&pixf)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void attach(const pixfmt_type& pixf)
|
void attach(const pixfmt_type& pixf)
|
||||||
|
@ -162,8 +162,8 @@ namespace agg
|
||||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||||
|
|
||||||
image_accessor_clone() {}
|
image_accessor_clone() {}
|
||||||
explicit image_accessor_clone(const pixfmt_type& pixf) :
|
explicit image_accessor_clone(const pixfmt_type& pixf) :
|
||||||
m_pixf(&pixf)
|
m_pixf(&pixf)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void attach(const pixfmt_type& pixf)
|
void attach(const pixfmt_type& pixf)
|
||||||
|
@ -174,8 +174,8 @@ namespace agg
|
||||||
private:
|
private:
|
||||||
AGG_INLINE const int8u* pixel() const
|
AGG_INLINE const int8u* pixel() const
|
||||||
{
|
{
|
||||||
register int x = m_x;
|
int x = m_x;
|
||||||
register int y = m_y;
|
int y = m_y;
|
||||||
if(x < 0) x = 0;
|
if(x < 0) x = 0;
|
||||||
if(y < 0) y = 0;
|
if(y < 0) y = 0;
|
||||||
if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1;
|
if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1;
|
||||||
|
@ -208,7 +208,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
++m_y;
|
++m_y;
|
||||||
m_x = m_x0;
|
m_x = m_x0;
|
||||||
if(m_pix_ptr &&
|
if(m_pix_ptr &&
|
||||||
m_y >= 0 && m_y < (int)m_pixf->height())
|
m_y >= 0 && m_y < (int)m_pixf->height())
|
||||||
{
|
{
|
||||||
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y);
|
||||||
|
@ -238,9 +238,9 @@ namespace agg
|
||||||
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
enum pix_width_e { pix_width = pixfmt_type::pix_width };
|
||||||
|
|
||||||
image_accessor_wrap() {}
|
image_accessor_wrap() {}
|
||||||
explicit image_accessor_wrap(const pixfmt_type& pixf) :
|
explicit image_accessor_wrap(const pixfmt_type& pixf) :
|
||||||
m_pixf(&pixf),
|
m_pixf(&pixf),
|
||||||
m_wrap_x(pixf.width()),
|
m_wrap_x(pixf.width()),
|
||||||
m_wrap_y(pixf.height())
|
m_wrap_y(pixf.height())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -284,15 +284,15 @@ namespace agg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wrap_mode_repeat() {}
|
wrap_mode_repeat() {}
|
||||||
wrap_mode_repeat(unsigned size) :
|
wrap_mode_repeat(unsigned size) :
|
||||||
m_size(size),
|
m_size(size),
|
||||||
m_add(size * (0x3FFFFFFF / size)),
|
m_add(size * (0x3FFFFFFF / size)),
|
||||||
m_value(0)
|
m_value(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
return m_value = (unsigned(v) + m_add) % m_size;
|
return m_value = (unsigned(v) + m_add) % m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
AGG_INLINE unsigned operator++ ()
|
AGG_INLINE unsigned operator++ ()
|
||||||
|
@ -320,7 +320,7 @@ namespace agg
|
||||||
m_mask >>= 1;
|
m_mask >>= 1;
|
||||||
}
|
}
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
return m_value = unsigned(v) & m_mask;
|
return m_value = unsigned(v) & m_mask;
|
||||||
}
|
}
|
||||||
AGG_INLINE unsigned operator++ ()
|
AGG_INLINE unsigned operator++ ()
|
||||||
|
@ -347,8 +347,8 @@ namespace agg
|
||||||
m_value(0)
|
m_value(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
if(m_mask) return m_value = unsigned(v) & m_mask;
|
if(m_mask) return m_value = unsigned(v) & m_mask;
|
||||||
return m_value = (unsigned(v) + m_add) % m_size;
|
return m_value = (unsigned(v) + m_add) % m_size;
|
||||||
}
|
}
|
||||||
|
@ -372,15 +372,15 @@ namespace agg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wrap_mode_reflect() {}
|
wrap_mode_reflect() {}
|
||||||
wrap_mode_reflect(unsigned size) :
|
wrap_mode_reflect(unsigned size) :
|
||||||
m_size(size),
|
m_size(size),
|
||||||
m_size2(size * 2),
|
m_size2(size * 2),
|
||||||
m_add(m_size2 * (0x3FFFFFFF / m_size2)),
|
m_add(m_size2 * (0x3FFFFFFF / m_size2)),
|
||||||
m_value(0)
|
m_value(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
m_value = (unsigned(v) + m_add) % m_size2;
|
m_value = (unsigned(v) + m_add) % m_size2;
|
||||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||||
return m_value;
|
return m_value;
|
||||||
|
@ -411,14 +411,14 @@ namespace agg
|
||||||
{
|
{
|
||||||
m_mask = 1;
|
m_mask = 1;
|
||||||
m_size = 1;
|
m_size = 1;
|
||||||
while(m_mask < size)
|
while(m_mask < size)
|
||||||
{
|
{
|
||||||
m_mask = (m_mask << 1) | 1;
|
m_mask = (m_mask << 1) | 1;
|
||||||
m_size <<= 1;
|
m_size <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
m_value = unsigned(v) & m_mask;
|
m_value = unsigned(v) & m_mask;
|
||||||
if(m_value >= m_size) return m_mask - m_value;
|
if(m_value >= m_size) return m_mask - m_value;
|
||||||
return m_value;
|
return m_value;
|
||||||
|
@ -451,12 +451,12 @@ namespace agg
|
||||||
m_value(0)
|
m_value(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AGG_INLINE unsigned operator() (int v)
|
AGG_INLINE unsigned operator() (int v)
|
||||||
{
|
{
|
||||||
m_value = m_mask ? unsigned(v) & m_mask :
|
m_value = m_mask ? unsigned(v) & m_mask :
|
||||||
(unsigned(v) + m_add) % m_size2;
|
(unsigned(v) + m_add) % m_size2;
|
||||||
if(m_value >= m_size) return m_size2 - m_value - 1;
|
if(m_value >= m_size) return m_size2 - m_value - 1;
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
AGG_INLINE unsigned operator++ ()
|
AGG_INLINE unsigned operator++ ()
|
||||||
{
|
{
|
||||||
|
|
143
deps/agg/include/agg_trans_affine.h
vendored
143
deps/agg/include/agg_trans_affine.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -24,39 +24,39 @@
|
||||||
|
|
||||||
namespace agg
|
namespace agg
|
||||||
{
|
{
|
||||||
const double affine_epsilon = 1e-14;
|
const double affine_epsilon = 1e-14;
|
||||||
|
|
||||||
//============================================================trans_affine
|
//============================================================trans_affine
|
||||||
//
|
//
|
||||||
// See Implementation agg_trans_affine.cpp
|
// See Implementation agg_trans_affine.cpp
|
||||||
//
|
//
|
||||||
// Affine transformation are linear transformations in Cartesian coordinates
|
// Affine transformation are linear transformations in Cartesian coordinates
|
||||||
// (strictly speaking not only in Cartesian, but for the beginning we will
|
// (strictly speaking not only in Cartesian, but for the beginning we will
|
||||||
// think so). They are rotation, scaling, translation and skewing.
|
// think so). They are rotation, scaling, translation and skewing.
|
||||||
// After any affine transformation a line segment remains a line segment
|
// After any affine transformation a line segment remains a line segment
|
||||||
// and it will never become a curve.
|
// and it will never become a curve.
|
||||||
//
|
//
|
||||||
// There will be no math about matrix calculations, since it has been
|
// There will be no math about matrix calculations, since it has been
|
||||||
// described many times. Ask yourself a very simple question:
|
// described many times. Ask yourself a very simple question:
|
||||||
// "why do we need to understand and use some matrix stuff instead of just
|
// "why do we need to understand and use some matrix stuff instead of just
|
||||||
// rotating, scaling and so on". The answers are:
|
// rotating, scaling and so on". The answers are:
|
||||||
//
|
//
|
||||||
// 1. Any combination of transformations can be done by only 4 multiplications
|
// 1. Any combination of transformations can be done by only 4 multiplications
|
||||||
// and 4 additions in floating point.
|
// and 4 additions in floating point.
|
||||||
// 2. One matrix transformation is equivalent to the number of consecutive
|
// 2. One matrix transformation is equivalent to the number of consecutive
|
||||||
// discrete transformations, i.e. the matrix "accumulates" all transformations
|
// discrete transformations, i.e. the matrix "accumulates" all transformations
|
||||||
// in the order of their settings. Suppose we have 4 transformations:
|
// in the order of their settings. Suppose we have 4 transformations:
|
||||||
// * rotate by 30 degrees,
|
// * rotate by 30 degrees,
|
||||||
// * scale X to 2.0,
|
// * scale X to 2.0,
|
||||||
// * scale Y to 1.5,
|
// * scale Y to 1.5,
|
||||||
// * move to (100, 100).
|
// * move to (100, 100).
|
||||||
// The result will depend on the order of these transformations,
|
// The result will depend on the order of these transformations,
|
||||||
// and the advantage of matrix is that the sequence of discret calls:
|
// and the advantage of matrix is that the sequence of discret calls:
|
||||||
// rotate(30), scaleX(2.0), scaleY(1.5), move(100,100)
|
// rotate(30), scaleX(2.0), scaleY(1.5), move(100,100)
|
||||||
// will have exactly the same result as the following matrix transformations:
|
// will have exactly the same result as the following matrix transformations:
|
||||||
//
|
//
|
||||||
// affine_matrix m;
|
// affine_matrix m;
|
||||||
// m *= rotate_matrix(30);
|
// m *= rotate_matrix(30);
|
||||||
// m *= scaleX_matrix(2.0);
|
// m *= scaleX_matrix(2.0);
|
||||||
// m *= scaleY_matrix(1.5);
|
// m *= scaleY_matrix(1.5);
|
||||||
// m *= move_matrix(100,100);
|
// m *= move_matrix(100,100);
|
||||||
|
@ -64,7 +64,7 @@ namespace agg
|
||||||
// m.transform_my_point_at_last(x, y);
|
// m.transform_my_point_at_last(x, y);
|
||||||
//
|
//
|
||||||
// What is the good of it? In real life we will set-up the matrix only once
|
// What is the good of it? In real life we will set-up the matrix only once
|
||||||
// and then transform many points, let alone the convenience to set any
|
// and then transform many points, let alone the convenience to set any
|
||||||
// combination of transformations.
|
// combination of transformations.
|
||||||
//
|
//
|
||||||
// So, how to use it? Very easy - literally as it's shown above. Not quite,
|
// So, how to use it? Very easy - literally as it's shown above. Not quite,
|
||||||
|
@ -77,9 +77,9 @@ namespace agg
|
||||||
// m.transform(&x, &y);
|
// m.transform(&x, &y);
|
||||||
//
|
//
|
||||||
// The affine matrix is all you need to perform any linear transformation,
|
// The affine matrix is all you need to perform any linear transformation,
|
||||||
// but all transformations have origin point (0,0). It means that we need to
|
// but all transformations have origin point (0,0). It means that we need to
|
||||||
// use 2 translations if we want to rotate someting around (100,100):
|
// use 2 translations if we want to rotate someting around (100,100):
|
||||||
//
|
//
|
||||||
// m *= agg::trans_affine_translation(-100.0, -100.0); // move to (0,0)
|
// m *= agg::trans_affine_translation(-100.0, -100.0); // move to (0,0)
|
||||||
// m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // rotate
|
// m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // rotate
|
||||||
// m *= agg::trans_affine_translation(100.0, 100.0); // move back to (100,100)
|
// m *= agg::trans_affine_translation(100.0, 100.0); // move back to (100,100)
|
||||||
|
@ -96,7 +96,7 @@ namespace agg
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Custom matrix. Usually used in derived classes
|
// Custom matrix. Usually used in derived classes
|
||||||
trans_affine(double v0, double v1, double v2,
|
trans_affine(double v0, double v1, double v2,
|
||||||
double v3, double v4, double v5) :
|
double v3, double v4, double v5) :
|
||||||
sx(v0), shy(v1), shx(v2), sy(v3), tx(v4), ty(v5)
|
sx(v0), shy(v1), shx(v2), sy(v3), tx(v4), ty(v5)
|
||||||
{}
|
{}
|
||||||
|
@ -107,14 +107,14 @@ namespace agg
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Rectangle to a parallelogram.
|
// Rectangle to a parallelogram.
|
||||||
trans_affine(double x1, double y1, double x2, double y2,
|
trans_affine(double x1, double y1, double x2, double y2,
|
||||||
const double* parl)
|
const double* parl)
|
||||||
{
|
{
|
||||||
rect_to_parl(x1, y1, x2, y2, parl);
|
rect_to_parl(x1, y1, x2, y2, parl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parallelogram to a rectangle.
|
// Parallelogram to a rectangle.
|
||||||
trans_affine(const double* parl,
|
trans_affine(const double* parl,
|
||||||
double x1, double y1, double x2, double y2)
|
double x1, double y1, double x2, double y2)
|
||||||
{
|
{
|
||||||
parl_to_rect(parl, x1, y1, x2, y2);
|
parl_to_rect(parl, x1, y1, x2, y2);
|
||||||
|
@ -127,25 +127,25 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------- Parellelogram transformations
|
//---------------------------------- Parellelogram transformations
|
||||||
// transform a parallelogram to another one. Src and dst are
|
// transform a parallelogram to another one. Src and dst are
|
||||||
// pointers to arrays of three points (double[6], x1,y1,...) that
|
// pointers to arrays of three points (double[6], x1,y1,...) that
|
||||||
// identify three corners of the parallelograms assuming implicit
|
// identify three corners of the parallelograms assuming implicit
|
||||||
// fourth point. The arguments are arrays of double[6] mapped
|
// fourth point. The arguments are arrays of double[6] mapped
|
||||||
// to x1,y1, x2,y2, x3,y3 where the coordinates are:
|
// to x1,y1, x2,y2, x3,y3 where the coordinates are:
|
||||||
// *-----------------*
|
// *-----------------*
|
||||||
// / (x3,y3)/
|
// / (x3,y3)/
|
||||||
// / /
|
// / /
|
||||||
// /(x1,y1) (x2,y2)/
|
// /(x1,y1) (x2,y2)/
|
||||||
// *-----------------*
|
// *-----------------*
|
||||||
const trans_affine& parl_to_parl(const double* src,
|
const trans_affine& parl_to_parl(const double* src,
|
||||||
const double* dst);
|
const double* dst);
|
||||||
|
|
||||||
const trans_affine& rect_to_parl(double x1, double y1,
|
const trans_affine& rect_to_parl(double x1, double y1,
|
||||||
double x2, double y2,
|
double x2, double y2,
|
||||||
const double* parl);
|
const double* parl);
|
||||||
|
|
||||||
const trans_affine& parl_to_rect(const double* parl,
|
const trans_affine& parl_to_rect(const double* parl,
|
||||||
double x1, double y1,
|
double x1, double y1,
|
||||||
double x2, double y2);
|
double x2, double y2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ namespace agg
|
||||||
// Multiply inverse of "m" to "this" and assign the result to "this"
|
// Multiply inverse of "m" to "this" and assign the result to "this"
|
||||||
const trans_affine& premultiply_inv(const trans_affine& m);
|
const trans_affine& premultiply_inv(const trans_affine& m);
|
||||||
|
|
||||||
// Invert matrix. Do not try to invert degenerate matrices,
|
// Invert matrix. Do not try to invert degenerate matrices,
|
||||||
// there's no check for validity. If you set scale to 0 and
|
// there's no check for validity. If you set scale to 0 and
|
||||||
// then try to invert matrix, expect unpredictable result.
|
// then try to invert matrix, expect unpredictable result.
|
||||||
const trans_affine& invert();
|
const trans_affine& invert();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------- Operators
|
//------------------------------------------- Operators
|
||||||
|
|
||||||
// Multiply the matrix by another one
|
// Multiply the matrix by another one
|
||||||
const trans_affine& operator *= (const trans_affine& m)
|
const trans_affine& operator *= (const trans_affine& m)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ namespace agg
|
||||||
return trans_affine(*this).multiply(m);
|
return trans_affine(*this).multiply(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiply the matrix by inverse of another one
|
// Multiply the matrix by inverse of another one
|
||||||
// and return the result in a separate matrix.
|
// and return the result in a separate matrix.
|
||||||
trans_affine operator / (const trans_affine& m) const
|
trans_affine operator / (const trans_affine& m) const
|
||||||
{
|
{
|
||||||
|
@ -250,9 +250,9 @@ namespace agg
|
||||||
// Direct transformation of x and y, 2x2 matrix only, no translation
|
// Direct transformation of x and y, 2x2 matrix only, no translation
|
||||||
void transform_2x2(double* x, double* y) const;
|
void transform_2x2(double* x, double* y) const;
|
||||||
|
|
||||||
// Inverse transformation of x and y. It works slower than the
|
// Inverse transformation of x and y. It works slower than the
|
||||||
// direct transformation. For massive operations it's better to
|
// direct transformation. For massive operations it's better to
|
||||||
// invert() the matrix and then use direct transformations.
|
// invert() the matrix and then use direct transformations.
|
||||||
void inverse_transform(double* x, double* y) const;
|
void inverse_transform(double* x, double* y) const;
|
||||||
|
|
||||||
//-------------------------------------------- Auxiliary
|
//-------------------------------------------- Auxiliary
|
||||||
|
@ -268,7 +268,7 @@ namespace agg
|
||||||
return 1.0 / (sx * sy - shy * shx);
|
return 1.0 / (sx * sy - shy * shx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the average scale (by X and Y).
|
// Get the average scale (by X and Y).
|
||||||
// Basically used to calculate the approximation_scale when
|
// Basically used to calculate the approximation_scale when
|
||||||
// decomposinting curves into line segments.
|
// decomposinting curves into line segments.
|
||||||
double scale() const;
|
double scale() const;
|
||||||
|
@ -282,7 +282,7 @@ namespace agg
|
||||||
// Check to see if two matrices are equal
|
// Check to see if two matrices are equal
|
||||||
bool is_equal(const trans_affine& m, double epsilon = affine_epsilon) const;
|
bool is_equal(const trans_affine& m, double epsilon = affine_epsilon) const;
|
||||||
|
|
||||||
// Determine the major parameters. Use with caution considering
|
// Determine the major parameters. Use with caution considering
|
||||||
// possible degenerate cases.
|
// possible degenerate cases.
|
||||||
double rotation() const;
|
double rotation() const;
|
||||||
void translation(double* dx, double* dy) const;
|
void translation(double* dx, double* dy) const;
|
||||||
|
@ -293,7 +293,7 @@ namespace agg
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline void trans_affine::transform(double* x, double* y) const
|
inline void trans_affine::transform(double* x, double* y) const
|
||||||
{
|
{
|
||||||
register double tmp = *x;
|
double tmp = *x;
|
||||||
*x = tmp * sx + *y * shx + tx;
|
*x = tmp * sx + *y * shx + tx;
|
||||||
*y = tmp * shy + *y * sy + ty;
|
*y = tmp * shy + *y * sy + ty;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ namespace agg
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline void trans_affine::transform_2x2(double* x, double* y) const
|
inline void trans_affine::transform_2x2(double* x, double* y) const
|
||||||
{
|
{
|
||||||
register double tmp = *x;
|
double tmp = *x;
|
||||||
*x = tmp * sx + *y * shx;
|
*x = tmp * sx + *y * shx;
|
||||||
*y = tmp * shy + *y * sy;
|
*y = tmp * shy + *y * sy;
|
||||||
}
|
}
|
||||||
|
@ -309,9 +309,9 @@ namespace agg
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline void trans_affine::inverse_transform(double* x, double* y) const
|
inline void trans_affine::inverse_transform(double* x, double* y) const
|
||||||
{
|
{
|
||||||
register double d = determinant_reciprocal();
|
double d = determinant_reciprocal();
|
||||||
register double a = (*x - tx) * d;
|
double a = (*x - tx) * d;
|
||||||
register double b = (*y - ty) * d;
|
double b = (*y - ty) * d;
|
||||||
*x = a * sy - b * shx;
|
*x = a * sy - b * shx;
|
||||||
*y = b * sx - a * shy;
|
*y = b * sx - a * shy;
|
||||||
}
|
}
|
||||||
|
@ -325,23 +325,23 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline const trans_affine& trans_affine::translate(double x, double y)
|
inline const trans_affine& trans_affine::translate(double x, double y)
|
||||||
{
|
{
|
||||||
tx += x;
|
tx += x;
|
||||||
ty += y;
|
ty += y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline const trans_affine& trans_affine::rotate(double a)
|
inline const trans_affine& trans_affine::rotate(double a)
|
||||||
{
|
{
|
||||||
double ca = cos(a);
|
double ca = cos(a);
|
||||||
double sa = sin(a);
|
double sa = sin(a);
|
||||||
double t0 = sx * ca - shy * sa;
|
double t0 = sx * ca - shy * sa;
|
||||||
double t2 = shx * ca - sy * sa;
|
double t2 = shx * ca - sy * sa;
|
||||||
double t4 = tx * ca - ty * sa;
|
double t4 = tx * ca - ty * sa;
|
||||||
shy = sx * sa + shy * ca;
|
shy = sx * sa + shy * ca;
|
||||||
sy = shx * sa + sy * ca;
|
sy = shx * sa + sy * ca;
|
||||||
ty = tx * sa + ty * ca;
|
ty = tx * sa + ty * ca;
|
||||||
sx = t0;
|
sx = t0;
|
||||||
shx = t2;
|
shx = t2;
|
||||||
|
@ -350,10 +350,10 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline const trans_affine& trans_affine::scale(double x, double y)
|
inline const trans_affine& trans_affine::scale(double x, double y)
|
||||||
{
|
{
|
||||||
double mm0 = x; // Possible hint for the optimizer
|
double mm0 = x; // Possible hint for the optimizer
|
||||||
double mm3 = y;
|
double mm3 = y;
|
||||||
sx *= mm0;
|
sx *= mm0;
|
||||||
shx *= mm0;
|
shx *= mm0;
|
||||||
tx *= mm0;
|
tx *= mm0;
|
||||||
|
@ -364,7 +364,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline const trans_affine& trans_affine::scale(double s)
|
inline const trans_affine& trans_affine::scale(double s)
|
||||||
{
|
{
|
||||||
double m = s; // Possible hint for the optimizer
|
double m = s; // Possible hint for the optimizer
|
||||||
sx *= m;
|
sx *= m;
|
||||||
|
@ -402,7 +402,7 @@ namespace agg
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
inline void trans_affine::scaling_abs(double* x, double* y) const
|
inline void trans_affine::scaling_abs(double* x, double* y) const
|
||||||
{
|
{
|
||||||
// Used to calculate scaling coefficients in image resampling.
|
// Used to calculate scaling coefficients in image resampling.
|
||||||
// When there is considerable shear this method gives us much
|
// When there is considerable shear this method gives us much
|
||||||
// better estimation than just sx, sy.
|
// better estimation than just sx, sy.
|
||||||
*x = sqrt(sx * sx + shx * shx);
|
*x = sqrt(sx * sx + shx * shx);
|
||||||
|
@ -412,12 +412,12 @@ namespace agg
|
||||||
//====================================================trans_affine_rotation
|
//====================================================trans_affine_rotation
|
||||||
// Rotation matrix. sin() and cos() are calculated twice for the same angle.
|
// Rotation matrix. sin() and cos() are calculated twice for the same angle.
|
||||||
// There's no harm because the performance of sin()/cos() is very good on all
|
// There's no harm because the performance of sin()/cos() is very good on all
|
||||||
// modern processors. Besides, this operation is not going to be invoked too
|
// modern processors. Besides, this operation is not going to be invoked too
|
||||||
// often.
|
// often.
|
||||||
class trans_affine_rotation : public trans_affine
|
class trans_affine_rotation : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_rotation(double a) :
|
trans_affine_rotation(double a) :
|
||||||
trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0)
|
trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
@ -427,11 +427,11 @@ namespace agg
|
||||||
class trans_affine_scaling : public trans_affine
|
class trans_affine_scaling : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_scaling(double x, double y) :
|
trans_affine_scaling(double x, double y) :
|
||||||
trans_affine(x, 0.0, 0.0, y, 0.0, 0.0)
|
trans_affine(x, 0.0, 0.0, y, 0.0, 0.0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
trans_affine_scaling(double s) :
|
trans_affine_scaling(double s) :
|
||||||
trans_affine(s, 0.0, 0.0, s, 0.0, 0.0)
|
trans_affine(s, 0.0, 0.0, s, 0.0, 0.0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
@ -441,7 +441,7 @@ namespace agg
|
||||||
class trans_affine_translation : public trans_affine
|
class trans_affine_translation : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_translation(double x, double y) :
|
trans_affine_translation(double x, double y) :
|
||||||
trans_affine(1.0, 0.0, 0.0, 1.0, x, y)
|
trans_affine(1.0, 0.0, 0.0, 1.0, x, y)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
@ -451,19 +451,19 @@ namespace agg
|
||||||
class trans_affine_skewing : public trans_affine
|
class trans_affine_skewing : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_skewing(double x, double y) :
|
trans_affine_skewing(double x, double y) :
|
||||||
trans_affine(1.0, tan(y), tan(x), 1.0, 0.0, 0.0)
|
trans_affine(1.0, tan(y), tan(x), 1.0, 0.0, 0.0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//===============================================trans_affine_line_segment
|
//===============================================trans_affine_line_segment
|
||||||
// Rotate, Scale and Translate, associating 0...dist with line segment
|
// Rotate, Scale and Translate, associating 0...dist with line segment
|
||||||
// x1,y1,x2,y2
|
// x1,y1,x2,y2
|
||||||
class trans_affine_line_segment : public trans_affine
|
class trans_affine_line_segment : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_line_segment(double x1, double y1, double x2, double y2,
|
trans_affine_line_segment(double x1, double y1, double x2, double y2,
|
||||||
double dist)
|
double dist)
|
||||||
{
|
{
|
||||||
double dx = x2 - x1;
|
double dx = x2 - x1;
|
||||||
|
@ -479,24 +479,24 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
//============================================trans_affine_reflection_unit
|
//============================================trans_affine_reflection_unit
|
||||||
// Reflection matrix. Reflect coordinates across the line through
|
// Reflection matrix. Reflect coordinates across the line through
|
||||||
// the origin containing the unit vector (ux, uy).
|
// the origin containing the unit vector (ux, uy).
|
||||||
// Contributed by John Horigan
|
// Contributed by John Horigan
|
||||||
class trans_affine_reflection_unit : public trans_affine
|
class trans_affine_reflection_unit : public trans_affine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
trans_affine_reflection_unit(double ux, double uy) :
|
trans_affine_reflection_unit(double ux, double uy) :
|
||||||
trans_affine(2.0 * ux * ux - 1.0,
|
trans_affine(2.0 * ux * ux - 1.0,
|
||||||
2.0 * ux * uy,
|
2.0 * ux * uy,
|
||||||
2.0 * ux * uy,
|
2.0 * ux * uy,
|
||||||
2.0 * uy * uy - 1.0,
|
2.0 * uy * uy - 1.0,
|
||||||
0.0, 0.0)
|
0.0, 0.0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//=================================================trans_affine_reflection
|
//=================================================trans_affine_reflection
|
||||||
// Reflection matrix. Reflect coordinates across the line through
|
// Reflection matrix. Reflect coordinates across the line through
|
||||||
// the origin at the angle a or containing the non-unit vector (x, y).
|
// the origin at the angle a or containing the non-unit vector (x, y).
|
||||||
// Contributed by John Horigan
|
// Contributed by John Horigan
|
||||||
class trans_affine_reflection : public trans_affine_reflection_unit
|
class trans_affine_reflection : public trans_affine_reflection_unit
|
||||||
|
@ -516,4 +516,3 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,9 @@
|
||||||
// boost
|
// boost
|
||||||
#include <boost/variant/static_visitor.hpp>
|
#include <boost/variant/static_visitor.hpp>
|
||||||
#include <boost/variant/apply_visitor.hpp>
|
#include <boost/variant/apply_visitor.hpp>
|
||||||
#include <boost/regex.hpp>
|
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
// stl
|
||||||
#include <boost/regex/icu.hpp>
|
#include <regex>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -117,24 +116,14 @@ struct evaluate : boost::static_visitor<T1>
|
||||||
value_type operator() (regex_match_node const& x) const
|
value_type operator() (regex_match_node const& x) const
|
||||||
{
|
{
|
||||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
return std::regex_match(v.to_string(),x.pattern);
|
||||||
return boost::u32regex_match(v.to_unicode(),x.pattern);
|
|
||||||
#else
|
|
||||||
return boost::regex_match(v.to_string(),x.pattern);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
value_type operator() (regex_replace_node const& x) const
|
value_type operator() (regex_replace_node const& x) const
|
||||||
{
|
{
|
||||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
std::string repl = std::regex_replace(v.to_string(),x.pattern,x.format);
|
||||||
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
|
return repl;
|
||||||
#else
|
|
||||||
std::string repl = boost::regex_replace(v.to_string(),x.pattern,x.format);
|
|
||||||
mapnik::transcoder tr_("utf8");
|
|
||||||
return tr_.transcode(repl.c_str());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
feature_type const& feature_;
|
feature_type const& feature_;
|
||||||
|
|
|
@ -47,21 +47,13 @@ namespace mapnik
|
||||||
template <typename T0,typename T1>
|
template <typename T0,typename T1>
|
||||||
expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const
|
expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const
|
||||||
{
|
{
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
|
||||||
return regex_match_node(node,tr_.transcode(pattern.c_str()));
|
|
||||||
#else
|
|
||||||
return regex_match_node(node,pattern);
|
return regex_match_node(node,pattern);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T0,typename T1,typename T2>
|
template <typename T0,typename T1,typename T2>
|
||||||
expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const
|
expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const
|
||||||
{
|
{
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
|
||||||
return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str()));
|
|
||||||
#else
|
|
||||||
return regex_replace_node(node,pattern,format);
|
return regex_replace_node(node,pattern,format);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator>
|
template <typename Iterator>
|
||||||
|
@ -162,7 +154,7 @@ expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
|
||||||
| no_case[lit("false")] [_val = false]
|
| no_case[lit("false")] [_val = false]
|
||||||
| no_case[lit("null")] [_val = value_null() ]
|
| no_case[lit("null")] [_val = value_null() ]
|
||||||
| no_case[geom_type][_val = _1 ]
|
| no_case[geom_type][_val = _1 ]
|
||||||
| ustring [_val = unicode_(_1) ]
|
| ustring [_val = _1]
|
||||||
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
|
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
|
||||||
| attr [_val = construct<mapnik::attribute>( _1 ) ]
|
| attr [_val = construct<mapnik::attribute>( _1 ) ]
|
||||||
| '(' >> expr [_val = _1 ] >> ')'
|
| '(' >> expr [_val = _1 ] >> ')'
|
||||||
|
|
|
@ -29,12 +29,9 @@
|
||||||
#include <mapnik/attribute.hpp>
|
#include <mapnik/attribute.hpp>
|
||||||
#include <mapnik/expression_node_types.hpp>
|
#include <mapnik/expression_node_types.hpp>
|
||||||
|
|
||||||
// boost
|
// stl
|
||||||
#include <boost/regex.hpp>
|
#include <functional>
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
#include <regex>
|
||||||
#include <boost/regex/icu.hpp>
|
|
||||||
#endif
|
|
||||||
#include <boost/function.hpp>
|
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -84,31 +81,12 @@ struct binary_node
|
||||||
expr_node left,right;
|
expr_node left,right;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
|
||||||
|
|
||||||
struct regex_match_node
|
|
||||||
{
|
|
||||||
regex_match_node (expr_node const& a, mapnik::value_unicode_string const& ustr);
|
|
||||||
expr_node expr;
|
|
||||||
boost::u32regex pattern;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct regex_replace_node
|
|
||||||
{
|
|
||||||
regex_replace_node (expr_node const& a, mapnik::value_unicode_string const& ustr, mapnik::value_unicode_string const& f);
|
|
||||||
expr_node expr;
|
|
||||||
boost::u32regex pattern;
|
|
||||||
mapnik::value_unicode_string format;
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct regex_match_node
|
struct regex_match_node
|
||||||
{
|
{
|
||||||
regex_match_node (expr_node const& a, std::string const& str);
|
regex_match_node (expr_node const& a, std::string const& str);
|
||||||
expr_node expr;
|
expr_node expr;
|
||||||
boost::regex pattern;
|
std::regex pattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,10 +94,9 @@ struct regex_replace_node
|
||||||
{
|
{
|
||||||
regex_replace_node (expr_node const& a, std::string const& str, std::string const& f);
|
regex_replace_node (expr_node const& a, std::string const& str, std::string const& f);
|
||||||
expr_node expr;
|
expr_node expr;
|
||||||
boost::regex pattern;
|
std::regex pattern;
|
||||||
std::string format;
|
std::string format;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
struct function_call
|
struct function_call
|
||||||
{
|
{
|
||||||
|
@ -129,7 +106,7 @@ struct function_call
|
||||||
call_(f) {}
|
call_(f) {}
|
||||||
|
|
||||||
expr_node expr;
|
expr_node expr;
|
||||||
boost::function<value_type(value_type)> call_;
|
std::function<value_type(value_type)> call_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ops
|
// ops
|
||||||
|
|
|
@ -115,20 +115,6 @@ struct make_properties_range
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct utf8
|
|
||||||
{
|
|
||||||
template <typename T>
|
|
||||||
struct result { typedef std::string type; };
|
|
||||||
|
|
||||||
std::string operator() (mapnik::value_unicode_string const& ustr) const
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
to_utf8(ustr,result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct value_base
|
struct value_base
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -221,7 +207,7 @@ struct feature_generator_grammar:
|
||||||
value_null_ = string[_1 = "null"]
|
value_null_ = string[_1 = "null"]
|
||||||
;
|
;
|
||||||
|
|
||||||
ustring = escaped_string_(quote_.c_str())[_1 = utf8_(_val)]
|
ustring = escaped_string_(quote_.c_str())[_1 = _val]
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +224,6 @@ struct feature_generator_grammar:
|
||||||
// phoenix functions
|
// phoenix functions
|
||||||
phoenix::function<get_id> id_;
|
phoenix::function<get_id> id_;
|
||||||
phoenix::function<value_base> value_base_;
|
phoenix::function<value_base> value_base_;
|
||||||
phoenix::function<utf8> utf8_;
|
|
||||||
std::string quote_;
|
std::string quote_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -684,7 +684,7 @@ void save_as_png8_hex(T1 & file,
|
||||||
//transparency values per palette index
|
//transparency values per palette index
|
||||||
std::vector<mapnik::rgba> pal;
|
std::vector<mapnik::rgba> pal;
|
||||||
tree.create_palette(pal);
|
tree.create_palette(pal);
|
||||||
assert(int(pal.size()) <= colors);
|
assert(int(pal.size()) <= opts.colors);
|
||||||
std::vector<mapnik::rgb> palette;
|
std::vector<mapnik::rgb> palette;
|
||||||
std::vector<unsigned> alphaTable;
|
std::vector<unsigned> alphaTable;
|
||||||
for(unsigned i=0; i<pal.size(); i++)
|
for(unsigned i=0; i<pal.size(); i++)
|
||||||
|
|
|
@ -105,15 +105,13 @@ public:
|
||||||
|
|
||||||
bool has_line_breaks() const
|
bool has_line_breaks() const
|
||||||
{
|
{
|
||||||
// uint16_t
|
return (text_.find('\n') != std::string::npos);
|
||||||
UChar break_char = '\n';
|
|
||||||
return (text_.indexOf(break_char) >= 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets object to initial state.
|
// Resets object to initial state.
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
text_.remove();
|
text_.clear();
|
||||||
characters_.clear();
|
characters_.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,9 +52,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace U_ICU_NAMESPACE {
|
namespace U_ICU_NAMESPACE {
|
||||||
inline std::size_t hash_value(mapnik::value_unicode_string const& val) {
|
|
||||||
return val.hashCode();
|
inline std::size_t hash_value(mapnik::value_unicode_string const& val)
|
||||||
|
{
|
||||||
|
std::hash<mapnik::value_unicode_string> hash;
|
||||||
|
return hash(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MAPNIK_UNICODE_HPP
|
#endif // MAPNIK_UNICODE_HPP
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// icu
|
// icu
|
||||||
#include <unicode/unistr.h>
|
#include <unicode/unistr.h>
|
||||||
|
@ -50,29 +51,6 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
inline void to_utf8(mapnik::value_unicode_string const& input, std::string & target)
|
|
||||||
{
|
|
||||||
if (input.isEmpty()) return;
|
|
||||||
|
|
||||||
const int BUF_SIZE = 256;
|
|
||||||
char buf [BUF_SIZE];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
|
||||||
u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
|
|
||||||
if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING )
|
|
||||||
{
|
|
||||||
const std::unique_ptr<char[]> buf_ptr(new char [len+1]);
|
|
||||||
err = U_ZERO_ERROR;
|
|
||||||
u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err);
|
|
||||||
target.assign(buf_ptr.get() , static_cast<std::size_t>(len));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
target.assign(buf, static_cast<std::size_t>(len));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef boost::variant<value_null,value_bool,value_integer,value_double,value_unicode_string> value_base;
|
typedef boost::variant<value_null,value_bool,value_integer,value_double,value_unicode_string> value_base;
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
@ -186,7 +164,7 @@ struct not_equals
|
||||||
bool operator() (value_null lhs, value_unicode_string const& rhs) const
|
bool operator() (value_null lhs, value_unicode_string const& rhs) const
|
||||||
{
|
{
|
||||||
boost::ignore_unused_variable_warning(lhs);
|
boost::ignore_unused_variable_warning(lhs);
|
||||||
if (rhs.isEmpty()) return false;
|
if (rhs.empty()) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +571,8 @@ struct negate : public boost::static_visitor<V>
|
||||||
value_type operator() (value_unicode_string const& ustr) const
|
value_type operator() (value_unicode_string const& ustr) const
|
||||||
{
|
{
|
||||||
value_unicode_string inplace(ustr);
|
value_unicode_string inplace(ustr);
|
||||||
return inplace.reverse();
|
std::reverse(inplace.begin(), inplace.end());
|
||||||
|
return inplace;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -606,7 +585,7 @@ struct to_bool : public boost::static_visitor<value_bool>
|
||||||
|
|
||||||
value_bool operator() (value_unicode_string const& ustr) const
|
value_bool operator() (value_unicode_string const& ustr) const
|
||||||
{
|
{
|
||||||
return !ustr.isEmpty();
|
return !ustr.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
value_bool operator() (value_null const& val) const
|
value_bool operator() (value_null const& val) const
|
||||||
|
@ -633,11 +612,9 @@ struct to_string : public boost::static_visitor<std::string>
|
||||||
}
|
}
|
||||||
|
|
||||||
// specializations
|
// specializations
|
||||||
std::string operator() (value_unicode_string const& val) const
|
std::string const& operator() (value_unicode_string const& val) const
|
||||||
{
|
{
|
||||||
std::string utf8;
|
return val;
|
||||||
to_utf8(val,utf8);
|
|
||||||
return utf8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string operator() (value_double val) const
|
std::string operator() (value_double val) const
|
||||||
|
@ -689,9 +666,9 @@ struct to_expression_string : public boost::static_visitor<std::string>
|
||||||
{
|
{
|
||||||
std::string operator() (value_unicode_string const& val) const
|
std::string operator() (value_unicode_string const& val) const
|
||||||
{
|
{
|
||||||
std::string utf8;
|
//std::string utf8(val);
|
||||||
to_utf8(val,utf8);
|
//to_utf8(val);//,utf8);
|
||||||
return "'" + utf8 + "'";
|
return "'" + val + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string operator() (value_integer val) const
|
std::string operator() (value_integer val) const
|
||||||
|
@ -737,7 +714,7 @@ struct to_double : public boost::static_visitor<value_double>
|
||||||
return static_cast<value_double>(val);
|
return static_cast<value_double>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_double operator() (std::string const& val) const
|
value_double operator() (value_unicode_string const& val) const
|
||||||
{
|
{
|
||||||
value_double result;
|
value_double result;
|
||||||
if (util::string2double(val,result))
|
if (util::string2double(val,result))
|
||||||
|
@ -745,13 +722,6 @@ struct to_double : public boost::static_visitor<value_double>
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_double operator() (value_unicode_string const& val) const
|
|
||||||
{
|
|
||||||
std::string utf8;
|
|
||||||
to_utf8(val,utf8);
|
|
||||||
return operator()(utf8);
|
|
||||||
}
|
|
||||||
|
|
||||||
value_double operator() (value_null const& val) const
|
value_double operator() (value_null const& val) const
|
||||||
{
|
{
|
||||||
boost::ignore_unused_variable_warning(val);
|
boost::ignore_unused_variable_warning(val);
|
||||||
|
@ -776,7 +746,7 @@ struct to_int : public boost::static_visitor<value_integer>
|
||||||
return static_cast<value_integer>(val);
|
return static_cast<value_integer>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_integer operator() (std::string const& val) const
|
value_integer operator() (value_unicode_string const& val) const
|
||||||
{
|
{
|
||||||
value_integer result;
|
value_integer result;
|
||||||
if (util::string2int(val,result))
|
if (util::string2int(val,result))
|
||||||
|
@ -784,13 +754,6 @@ struct to_int : public boost::static_visitor<value_integer>
|
||||||
return value_integer(0);
|
return value_integer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_integer operator() (value_unicode_string const& val) const
|
|
||||||
{
|
|
||||||
std::string utf8;
|
|
||||||
to_utf8(val,utf8);
|
|
||||||
return operator()(utf8);
|
|
||||||
}
|
|
||||||
|
|
||||||
value_integer operator() (value_null const& val) const
|
value_integer operator() (value_null const& val) const
|
||||||
{
|
{
|
||||||
boost::ignore_unused_variable_warning(val);
|
boost::ignore_unused_variable_warning(val);
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#ifndef MAPNIK_VALUE_TYPES_HPP
|
#ifndef MAPNIK_VALUE_TYPES_HPP
|
||||||
#define MAPNIK_VALUE_TYPES_HPP
|
#define MAPNIK_VALUE_TYPES_HPP
|
||||||
|
|
||||||
// icu
|
|
||||||
#include <unicode/unistr.h> // for UnicodeString
|
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
|
@ -35,14 +32,13 @@
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
#ifdef BIGINT
|
#ifdef BIGINT
|
||||||
//typedef boost::long_long_type value_integer;
|
|
||||||
typedef long long value_integer;
|
typedef long long value_integer;
|
||||||
#else
|
#else
|
||||||
typedef int value_integer;
|
typedef int value_integer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef double value_double;
|
typedef double value_double;
|
||||||
typedef U_NAMESPACE_QUALIFIER UnicodeString value_unicode_string;
|
typedef std::string value_unicode_string;
|
||||||
typedef bool value_bool;
|
typedef bool value_bool;
|
||||||
|
|
||||||
struct value_null
|
struct value_null
|
||||||
|
|
|
@ -77,11 +77,6 @@ struct attr_value_converter : public boost::static_visitor<mapnik::eAttributeTyp
|
||||||
return mapnik::Boolean;
|
return mapnik::Boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnik::eAttributeType operator() (std::string const& /*val*/) const
|
|
||||||
{
|
|
||||||
return mapnik::String;
|
|
||||||
}
|
|
||||||
|
|
||||||
mapnik::eAttributeType operator() (mapnik::value_unicode_string const& /*val*/) const
|
mapnik::eAttributeType operator() (mapnik::value_unicode_string const& /*val*/) const
|
||||||
{
|
{
|
||||||
return mapnik::String;
|
return mapnik::String;
|
||||||
|
|
|
@ -53,11 +53,10 @@ libmapnik_defines = copy(lib_env['CPPDEFINES'])
|
||||||
ABI_VERSION = env['ABI_VERSION']
|
ABI_VERSION = env['ABI_VERSION']
|
||||||
|
|
||||||
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
||||||
regex = 'boost_regex%s' % env['BOOST_APPEND']
|
|
||||||
system = 'boost_system%s' % env['BOOST_APPEND']
|
system = 'boost_system%s' % env['BOOST_APPEND']
|
||||||
|
|
||||||
# clear out and re-set libs for this env
|
# clear out and re-set libs for this env
|
||||||
lib_env['LIBS'] = ['freetype',env['ICU_LIB_NAME'],filesystem,system,regex]
|
lib_env['LIBS'] = ['freetype',env['ICU_LIB_NAME'],filesystem,system]
|
||||||
|
|
||||||
if '-DMAPNIK_USE_PROJ4' in env['CPPDEFINES']:
|
if '-DMAPNIK_USE_PROJ4' in env['CPPDEFINES']:
|
||||||
lib_env['LIBS'].append('proj')
|
lib_env['LIBS'].append('proj')
|
||||||
|
@ -86,12 +85,6 @@ if len(env['EXTRA_FREETYPE_LIBS']):
|
||||||
lib_env['LIBS'].append('xml2')
|
lib_env['LIBS'].append('xml2')
|
||||||
lib_env['LIBS'].append('z')
|
lib_env['LIBS'].append('z')
|
||||||
|
|
||||||
#if env['THREADING'] == 'multi':
|
|
||||||
# lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
|
|
||||||
|
|
||||||
if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']:
|
|
||||||
lib_env['LIBS'].append('icui18n')
|
|
||||||
|
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
if 'icuuc' in env['ICU_LIB_NAME']:
|
if 'icuuc' in env['ICU_LIB_NAME']:
|
||||||
lib_env['LIBS'].append('icudata')
|
lib_env['LIBS'].append('icudata')
|
||||||
|
|
|
@ -26,27 +26,13 @@
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
|
||||||
|
|
||||||
regex_match_node::regex_match_node (expr_node const& a, mapnik::value_unicode_string const& ustr)
|
|
||||||
: expr(a),
|
|
||||||
pattern(boost::make_u32regex(ustr)) {}
|
|
||||||
|
|
||||||
regex_replace_node::regex_replace_node (expr_node const& a, mapnik::value_unicode_string const& ustr, mapnik::value_unicode_string const& f)
|
|
||||||
: expr(a),
|
|
||||||
pattern(boost::make_u32regex(ustr)),
|
|
||||||
format(f) {}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
regex_match_node::regex_match_node (expr_node const& a, std::string const& str)
|
regex_match_node::regex_match_node (expr_node const& a, std::string const& str)
|
||||||
: expr(a),
|
: expr(a),
|
||||||
pattern(str) {}
|
pattern(str, std::regex::extended | std::regex::optimize) {}
|
||||||
|
|
||||||
regex_replace_node::regex_replace_node (expr_node const& a, std::string const& str, std::string const& f)
|
regex_replace_node::regex_replace_node (expr_node const& a, std::string const& str, std::string const& f)
|
||||||
: expr(a),
|
: expr(a),
|
||||||
pattern(str),
|
pattern(str, std::regex::extended | std::regex::optimize),
|
||||||
format(f) {}
|
format(f) {}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,7 @@
|
||||||
#include <mapnik/value.hpp>
|
#include <mapnik/value.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant/static_visitor.hpp>
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
|
||||||
#include <boost/regex/icu.hpp> // for u32regex
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -91,14 +88,8 @@ struct expression_string : boost::static_visitor<void>
|
||||||
{
|
{
|
||||||
boost::apply_visitor(expression_string(str_),x.expr);
|
boost::apply_visitor(expression_string(str_),x.expr);
|
||||||
str_ +=".match('";
|
str_ +=".match('";
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
//str_ += std::string(x.pattern.str());
|
||||||
std::string utf8;
|
str_ += "FIXME";
|
||||||
mapnik::value_unicode_string ustr = mapnik::value_unicode_string::fromUTF32( &x.pattern.str()[0] ,x.pattern.str().length());
|
|
||||||
to_utf8(ustr,utf8);
|
|
||||||
str_ += utf8;
|
|
||||||
#else
|
|
||||||
str_ += x.pattern.str();
|
|
||||||
#endif
|
|
||||||
str_ +="')";
|
str_ +="')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,19 +98,10 @@ struct expression_string : boost::static_visitor<void>
|
||||||
boost::apply_visitor(expression_string(str_),x.expr);
|
boost::apply_visitor(expression_string(str_),x.expr);
|
||||||
str_ +=".replace(";
|
str_ +=".replace(";
|
||||||
str_ += "'";
|
str_ += "'";
|
||||||
#if defined(BOOST_REGEX_HAS_ICU)
|
//str_ += x.pattern.str();
|
||||||
std::string utf8;
|
str_ += "FIXME";
|
||||||
mapnik::value_unicode_string ustr = mapnik::value_unicode_string::fromUTF32( &x.pattern.str()[0] ,x.pattern.str().length());
|
|
||||||
to_utf8(ustr,utf8);
|
|
||||||
str_ += utf8;
|
|
||||||
str_ +="','";
|
|
||||||
to_utf8(x.format ,utf8);
|
|
||||||
str_ += utf8;
|
|
||||||
#else
|
|
||||||
str_ += x.pattern.str();
|
|
||||||
str_ +="','";
|
str_ +="','";
|
||||||
str_ += x.format;
|
str_ += x.format;
|
||||||
#endif
|
|
||||||
str_ +="')";
|
str_ +="')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,12 +345,13 @@ char_info font_face_set::character_dimensions(unsigned int c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void font_face_set::get_string_info(string_info & info, mapnik::value_unicode_string const& ustr, char_properties *format)
|
void font_face_set::get_string_info(string_info & info, mapnik::value_unicode_string const& str, char_properties *format)
|
||||||
{
|
{
|
||||||
double avg_height = character_dimensions('X').height();
|
double avg_height = character_dimensions('X').height();
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
mapnik::value_unicode_string reordered;
|
UnicodeString ustr = UnicodeString::fromUTF8(str);
|
||||||
mapnik::value_unicode_string shaped;
|
UnicodeString reordered;
|
||||||
|
UnicodeString shaped;
|
||||||
|
|
||||||
int32_t length = ustr.length();
|
int32_t length = ustr.length();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/formatting/text.hpp>
|
#include <mapnik/formatting/text.hpp>
|
||||||
#include <mapnik/expression_string.hpp>
|
#include <mapnik/expression_string.hpp>
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
// boost
|
// boost
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -57,17 +59,17 @@ void text_node::apply(char_properties const& p, feature_impl const& feature, pro
|
||||||
mapnik::value_unicode_string text_str = boost::apply_visitor(evaluate<feature_impl,value_type>(feature), *text_).to_unicode();
|
mapnik::value_unicode_string text_str = boost::apply_visitor(evaluate<feature_impl,value_type>(feature), *text_).to_unicode();
|
||||||
if (p.text_transform == UPPERCASE)
|
if (p.text_transform == UPPERCASE)
|
||||||
{
|
{
|
||||||
text_str = text_str.toUpper();
|
boost::to_upper(text_str);
|
||||||
}
|
}
|
||||||
else if (p.text_transform == LOWERCASE)
|
else if (p.text_transform == LOWERCASE)
|
||||||
{
|
{
|
||||||
text_str = text_str.toLower();
|
boost::to_lower(text_str);
|
||||||
}
|
}
|
||||||
#if !UCONFIG_NO_BREAK_ITERATION
|
#if !UCONFIG_NO_BREAK_ITERATION
|
||||||
else if (p.text_transform == CAPITALIZE)
|
else if (p.text_transform == CAPITALIZE)
|
||||||
{
|
{
|
||||||
// note: requires BreakIterator support in ICU which is optional
|
// note: requires BreakIterator support in ICU which is optional
|
||||||
text_str = text_str.toTitle(NULL);
|
//text_str = text_str.toTitle(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (text_str.length() > 0) {
|
if (text_str.length() > 0) {
|
||||||
|
|
|
@ -42,14 +42,7 @@ transcoder::transcoder (std::string const& encoding)
|
||||||
|
|
||||||
mapnik::value_unicode_string transcoder::transcode(const char* data, boost::int32_t length) const
|
mapnik::value_unicode_string transcoder::transcode(const char* data, boost::int32_t length) const
|
||||||
{
|
{
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
return mapnik::value_unicode_string(data);
|
||||||
|
|
||||||
mapnik::value_unicode_string ustr(data,length,conv_,err);
|
|
||||||
if (ustr.isBogus())
|
|
||||||
{
|
|
||||||
ustr.remove();
|
|
||||||
}
|
|
||||||
return ustr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transcoder::~transcoder()
|
transcoder::~transcoder()
|
||||||
|
|
|
@ -4,11 +4,7 @@ from copy import copy
|
||||||
|
|
||||||
Import ('env')
|
Import ('env')
|
||||||
|
|
||||||
headers = env['CPPPATH']
|
headers = env['CPPPATH']
|
||||||
|
|
||||||
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
|
||||||
system = 'boost_system%s' % env['BOOST_APPEND']
|
|
||||||
regex = 'boost_regex%s' % env['BOOST_APPEND']
|
|
||||||
|
|
||||||
libraries = copy(env['LIBMAPNIK_LIBS'])
|
libraries = copy(env['LIBMAPNIK_LIBS'])
|
||||||
libraries.append('mapnik')
|
libraries.append('mapnik')
|
||||||
|
|
Loading…
Reference in a new issue