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',
|
||||
'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',
|
||||
'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)',
|
||||
'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)
|
||||
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):
|
||||
""" check an sqlite3 install has rtree support.
|
||||
|
||||
|
@ -994,6 +964,30 @@ int main()
|
|||
return True
|
||||
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,
|
||||
'CheckPKGConfig' : CheckPKGConfig,
|
||||
'CheckPKG' : CheckPKG,
|
||||
|
@ -1009,8 +1003,8 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
|
|||
'get_pkg_lib' : get_pkg_lib,
|
||||
'rollback_option' : rollback_option,
|
||||
'icu_at_least_four_two' : icu_at_least_four_two,
|
||||
'boost_regex_has_icu' : boost_regex_has_icu,
|
||||
'sqlite_has_rtree' : sqlite_has_rtree,
|
||||
'supports_cxx11' : supports_cxx11,
|
||||
}
|
||||
|
||||
|
||||
|
@ -1121,7 +1115,6 @@ if not preconfigured:
|
|||
if env['SYSTEM_FONTS']:
|
||||
if not os.path.isdir(env['SYSTEM_FONTS']):
|
||||
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
|
||||
env['CPPPATH'] = ['#include', '#']
|
||||
|
@ -1259,6 +1252,11 @@ if not preconfigured:
|
|||
if env['PRIORITIZE_LINKING']:
|
||||
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']:
|
||||
for libname, headers, required, lang in REQUIRED_LIBSHEADERS:
|
||||
if not conf.CheckLibWithHeader(libname, headers, lang):
|
||||
|
@ -1299,7 +1297,6 @@ if not preconfigured:
|
|||
BOOST_LIBSHEADERS = [
|
||||
['system', 'boost/system/system_error.hpp', True],
|
||||
['filesystem', 'boost/filesystem/operations.hpp', True],
|
||||
['regex', 'boost/regex.hpp', True],
|
||||
['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
|
||||
# important to try this check with the library linked
|
||||
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:
|
||||
if not env['HOST']:
|
||||
|
|
|
@ -100,9 +100,7 @@ struct parameters_pickle_suite : boost::python::pickle_suite
|
|||
}
|
||||
else if (ex3.check())
|
||||
{
|
||||
std::string buffer;
|
||||
mapnik::to_utf8(ex3(),buffer);
|
||||
p[key] = buffer;
|
||||
p[key] = ex3();
|
||||
}
|
||||
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::string key_utf8;
|
||||
mapnik::to_utf8(key, key_utf8);
|
||||
return std::make_shared<mapnik::parameter>(key_utf8,value);
|
||||
return std::make_shared<mapnik::parameter>(key,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::string key_utf8;
|
||||
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);
|
||||
return std::make_shared<mapnik::parameter>(key, ustr);
|
||||
}
|
||||
|
||||
void export_parameters()
|
||||
|
|
|
@ -48,16 +48,16 @@ namespace boost { namespace python {
|
|||
return ::PyBool_FromLong(val);
|
||||
}
|
||||
|
||||
PyObject * operator() (std::string const& s) const
|
||||
{
|
||||
return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
||||
}
|
||||
// PyObject * operator() (std::string const& s) const
|
||||
// {
|
||||
// return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
||||
// }
|
||||
|
||||
PyObject * operator() (mapnik::value_unicode_string const& s) const
|
||||
{
|
||||
std::string buffer;
|
||||
mapnik::to_utf8(s,buffer);
|
||||
return ::PyUnicode_DecodeUTF8(buffer.c_str(),implicit_cast<ssize_t>(buffer.length()),0);
|
||||
//std::string buffer;
|
||||
//mapnik::to_utf8(s,buffer);
|
||||
return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast<ssize_t>(s.length()),0);
|
||||
}
|
||||
|
||||
PyObject * operator() (mapnik::value_null const& /*s*/) const
|
||||
|
|
3
deps/agg/include/agg_basics.h
vendored
3
deps/agg/include/agg_basics.h
vendored
|
@ -205,7 +205,7 @@ namespace agg
|
|||
{
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
@ -529,4 +529,3 @@ namespace agg
|
|||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
4
deps/agg/include/agg_image_accessors.h
vendored
4
deps/agg/include/agg_image_accessors.h
vendored
|
@ -174,8 +174,8 @@ namespace agg
|
|||
private:
|
||||
AGG_INLINE const int8u* pixel() const
|
||||
{
|
||||
register int x = m_x;
|
||||
register int y = m_y;
|
||||
int x = m_x;
|
||||
int y = m_y;
|
||||
if(x < 0) x = 0;
|
||||
if(y < 0) y = 0;
|
||||
if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1;
|
||||
|
|
11
deps/agg/include/agg_trans_affine.h
vendored
11
deps/agg/include/agg_trans_affine.h
vendored
|
@ -293,7 +293,7 @@ namespace agg
|
|||
//------------------------------------------------------------------------
|
||||
inline void trans_affine::transform(double* x, double* y) const
|
||||
{
|
||||
register double tmp = *x;
|
||||
double tmp = *x;
|
||||
*x = tmp * sx + *y * shx + tx;
|
||||
*y = tmp * shy + *y * sy + ty;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ namespace agg
|
|||
//------------------------------------------------------------------------
|
||||
inline void trans_affine::transform_2x2(double* x, double* y) const
|
||||
{
|
||||
register double tmp = *x;
|
||||
double tmp = *x;
|
||||
*x = tmp * sx + *y * shx;
|
||||
*y = tmp * shy + *y * sy;
|
||||
}
|
||||
|
@ -309,9 +309,9 @@ namespace agg
|
|||
//------------------------------------------------------------------------
|
||||
inline void trans_affine::inverse_transform(double* x, double* y) const
|
||||
{
|
||||
register double d = determinant_reciprocal();
|
||||
register double a = (*x - tx) * d;
|
||||
register double b = (*y - ty) * d;
|
||||
double d = determinant_reciprocal();
|
||||
double a = (*x - tx) * d;
|
||||
double b = (*y - ty) * d;
|
||||
*x = a * sy - b * shx;
|
||||
*y = b * sx - a * shy;
|
||||
}
|
||||
|
@ -516,4 +516,3 @@ namespace agg
|
|||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,10 +31,9 @@
|
|||
// boost
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
#include <boost/regex/icu.hpp>
|
||||
#endif
|
||||
|
||||
// stl
|
||||
#include <regex>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -117,24 +116,14 @@ struct evaluate : boost::static_visitor<T1>
|
|||
value_type operator() (regex_match_node const& x) const
|
||||
{
|
||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return boost::u32regex_match(v.to_unicode(),x.pattern);
|
||||
#else
|
||||
return boost::regex_match(v.to_string(),x.pattern);
|
||||
#endif
|
||||
|
||||
return std::regex_match(v.to_string(),x.pattern);
|
||||
}
|
||||
|
||||
value_type operator() (regex_replace_node const& x) const
|
||||
{
|
||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
|
||||
#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
|
||||
std::string repl = std::regex_replace(v.to_string(),x.pattern,x.format);
|
||||
return repl;
|
||||
}
|
||||
|
||||
feature_type const& feature_;
|
||||
|
|
|
@ -47,21 +47,13 @@ namespace mapnik
|
|||
template <typename T0,typename T1>
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T0,typename T1,typename T2>
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
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("null")] [_val = value_null() ]
|
||||
| no_case[geom_type][_val = _1 ]
|
||||
| ustring [_val = unicode_(_1) ]
|
||||
| ustring [_val = _1]
|
||||
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
|
||||
| attr [_val = construct<mapnik::attribute>( _1 ) ]
|
||||
| '(' >> expr [_val = _1 ] >> ')'
|
||||
|
|
|
@ -29,12 +29,9 @@
|
|||
#include <mapnik/attribute.hpp>
|
||||
#include <mapnik/expression_node_types.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/regex.hpp>
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
#include <boost/regex/icu.hpp>
|
||||
#endif
|
||||
#include <boost/function.hpp>
|
||||
// stl
|
||||
#include <functional>
|
||||
#include <regex>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -84,31 +81,12 @@ struct binary_node
|
|||
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
|
||||
{
|
||||
regex_match_node (expr_node const& a, std::string const& str);
|
||||
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);
|
||||
expr_node expr;
|
||||
boost::regex pattern;
|
||||
std::regex pattern;
|
||||
std::string format;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct function_call
|
||||
{
|
||||
|
@ -129,7 +106,7 @@ struct function_call
|
|||
call_(f) {}
|
||||
|
||||
expr_node expr;
|
||||
boost::function<value_type(value_type)> call_;
|
||||
std::function<value_type(value_type)> call_;
|
||||
};
|
||||
|
||||
// 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
|
||||
{
|
||||
template <typename T>
|
||||
|
@ -221,7 +207,7 @@ struct feature_generator_grammar:
|
|||
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::function<get_id> id_;
|
||||
phoenix::function<value_base> value_base_;
|
||||
phoenix::function<utf8> utf8_;
|
||||
std::string quote_;
|
||||
};
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ void save_as_png8_hex(T1 & file,
|
|||
//transparency values per palette index
|
||||
std::vector<mapnik::rgba> pal;
|
||||
tree.create_palette(pal);
|
||||
assert(int(pal.size()) <= colors);
|
||||
assert(int(pal.size()) <= opts.colors);
|
||||
std::vector<mapnik::rgb> palette;
|
||||
std::vector<unsigned> alphaTable;
|
||||
for(unsigned i=0; i<pal.size(); i++)
|
||||
|
|
|
@ -105,15 +105,13 @@ public:
|
|||
|
||||
bool has_line_breaks() const
|
||||
{
|
||||
// uint16_t
|
||||
UChar break_char = '\n';
|
||||
return (text_.indexOf(break_char) >= 0);
|
||||
return (text_.find('\n') != std::string::npos);
|
||||
}
|
||||
|
||||
// Resets object to initial state.
|
||||
void clear()
|
||||
{
|
||||
text_.remove();
|
||||
text_.clear();
|
||||
characters_.clear();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -52,9 +52,13 @@ private:
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <string>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
// icu
|
||||
#include <unicode/unistr.h>
|
||||
|
@ -50,29 +51,6 @@
|
|||
|
||||
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;
|
||||
|
||||
namespace impl {
|
||||
|
@ -186,7 +164,7 @@ struct not_equals
|
|||
bool operator() (value_null lhs, value_unicode_string const& rhs) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(lhs);
|
||||
if (rhs.isEmpty()) return false;
|
||||
if (rhs.empty()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -593,7 +571,8 @@ struct negate : public boost::static_visitor<V>
|
|||
value_type operator() (value_unicode_string const& ustr) const
|
||||
{
|
||||
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
|
||||
{
|
||||
return !ustr.isEmpty();
|
||||
return !ustr.empty();
|
||||
}
|
||||
|
||||
value_bool operator() (value_null const& val) const
|
||||
|
@ -633,11 +612,9 @@ struct to_string : public boost::static_visitor<std::string>
|
|||
}
|
||||
|
||||
// specializations
|
||||
std::string operator() (value_unicode_string const& val) const
|
||||
std::string const& operator() (value_unicode_string const& val) const
|
||||
{
|
||||
std::string utf8;
|
||||
to_utf8(val,utf8);
|
||||
return utf8;
|
||||
return val;
|
||||
}
|
||||
|
||||
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 utf8;
|
||||
to_utf8(val,utf8);
|
||||
return "'" + utf8 + "'";
|
||||
//std::string utf8(val);
|
||||
//to_utf8(val);//,utf8);
|
||||
return "'" + val + "'";
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
value_double operator() (std::string const& val) const
|
||||
value_double operator() (value_unicode_string const& val) const
|
||||
{
|
||||
value_double result;
|
||||
if (util::string2double(val,result))
|
||||
|
@ -745,13 +722,6 @@ struct to_double : public boost::static_visitor<value_double>
|
|||
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
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
value_integer operator() (std::string const& val) const
|
||||
value_integer operator() (value_unicode_string const& val) const
|
||||
{
|
||||
value_integer result;
|
||||
if (util::string2int(val,result))
|
||||
|
@ -784,13 +754,6 @@ struct to_int : public boost::static_visitor<value_integer>
|
|||
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
|
||||
{
|
||||
boost::ignore_unused_variable_warning(val);
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
#ifndef MAPNIK_VALUE_TYPES_HPP
|
||||
#define MAPNIK_VALUE_TYPES_HPP
|
||||
|
||||
// icu
|
||||
#include <unicode/unistr.h> // for UnicodeString
|
||||
|
||||
// boost
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
|
@ -35,14 +32,13 @@
|
|||
namespace mapnik {
|
||||
|
||||
#ifdef BIGINT
|
||||
//typedef boost::long_long_type value_integer;
|
||||
typedef long long value_integer;
|
||||
#else
|
||||
typedef int value_integer;
|
||||
#endif
|
||||
|
||||
typedef double value_double;
|
||||
typedef U_NAMESPACE_QUALIFIER UnicodeString value_unicode_string;
|
||||
typedef std::string value_unicode_string;
|
||||
typedef bool value_bool;
|
||||
|
||||
struct value_null
|
||||
|
|
|
@ -77,11 +77,6 @@ struct attr_value_converter : public boost::static_visitor<mapnik::eAttributeTyp
|
|||
return mapnik::Boolean;
|
||||
}
|
||||
|
||||
mapnik::eAttributeType operator() (std::string const& /*val*/) const
|
||||
{
|
||||
return mapnik::String;
|
||||
}
|
||||
|
||||
mapnik::eAttributeType operator() (mapnik::value_unicode_string const& /*val*/) const
|
||||
{
|
||||
return mapnik::String;
|
||||
|
|
|
@ -53,11 +53,10 @@ libmapnik_defines = copy(lib_env['CPPDEFINES'])
|
|||
ABI_VERSION = env['ABI_VERSION']
|
||||
|
||||
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
||||
regex = 'boost_regex%s' % env['BOOST_APPEND']
|
||||
system = 'boost_system%s' % env['BOOST_APPEND']
|
||||
|
||||
# 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']:
|
||||
lib_env['LIBS'].append('proj')
|
||||
|
@ -86,12 +85,6 @@ if len(env['EXTRA_FREETYPE_LIBS']):
|
|||
lib_env['LIBS'].append('xml2')
|
||||
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 'icuuc' in env['ICU_LIB_NAME']:
|
||||
lib_env['LIBS'].append('icudata')
|
||||
|
|
|
@ -26,27 +26,13 @@
|
|||
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)
|
||||
: 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)
|
||||
: expr(a),
|
||||
pattern(str),
|
||||
pattern(str, std::regex::extended | std::regex::optimize),
|
||||
format(f) {}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
#include <mapnik/value.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/variant.hpp>
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
#include <boost/regex/icu.hpp> // for u32regex
|
||||
#endif
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -91,14 +88,8 @@ struct expression_string : boost::static_visitor<void>
|
|||
{
|
||||
boost::apply_visitor(expression_string(str_),x.expr);
|
||||
str_ +=".match('";
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
std::string utf8;
|
||||
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_ += std::string(x.pattern.str());
|
||||
str_ += "FIXME";
|
||||
str_ +="')";
|
||||
}
|
||||
|
||||
|
@ -107,19 +98,10 @@ struct expression_string : boost::static_visitor<void>
|
|||
boost::apply_visitor(expression_string(str_),x.expr);
|
||||
str_ +=".replace(";
|
||||
str_ += "'";
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
std::string utf8;
|
||||
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_ += x.pattern.str();
|
||||
str_ += "FIXME";
|
||||
str_ +="','";
|
||||
str_ += x.format;
|
||||
#endif
|
||||
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();
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
mapnik::value_unicode_string reordered;
|
||||
mapnik::value_unicode_string shaped;
|
||||
UnicodeString ustr = UnicodeString::fromUTF8(str);
|
||||
UnicodeString reordered;
|
||||
UnicodeString shaped;
|
||||
|
||||
int32_t length = ustr.length();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/formatting/text.hpp>
|
||||
#include <mapnik/expression_string.hpp>
|
||||
|
@ -32,6 +33,7 @@
|
|||
// boost
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
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();
|
||||
if (p.text_transform == UPPERCASE)
|
||||
{
|
||||
text_str = text_str.toUpper();
|
||||
boost::to_upper(text_str);
|
||||
}
|
||||
else if (p.text_transform == LOWERCASE)
|
||||
{
|
||||
text_str = text_str.toLower();
|
||||
boost::to_lower(text_str);
|
||||
}
|
||||
#if !UCONFIG_NO_BREAK_ITERATION
|
||||
else if (p.text_transform == CAPITALIZE)
|
||||
{
|
||||
// note: requires BreakIterator support in ICU which is optional
|
||||
text_str = text_str.toTitle(NULL);
|
||||
//text_str = text_str.toTitle(NULL);
|
||||
}
|
||||
#endif
|
||||
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
|
||||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
|
||||
mapnik::value_unicode_string ustr(data,length,conv_,err);
|
||||
if (ustr.isBogus())
|
||||
{
|
||||
ustr.remove();
|
||||
}
|
||||
return ustr;
|
||||
return mapnik::value_unicode_string(data);
|
||||
}
|
||||
|
||||
transcoder::~transcoder()
|
||||
|
|
|
@ -6,10 +6,6 @@ Import ('env')
|
|||
|
||||
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.append('mapnik')
|
||||
|
||||
|
|
Loading…
Reference in a new issue