Merge branch 'master' of github.com:mapnik/mapnik into 3x-msvs
|
@ -46,6 +46,7 @@ before_script:
|
|||
script:
|
||||
- ./configure CXX="${CXX}" CC="${CC}" CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS}" CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS}" XML_PARSER="${XML_PARSER}" ENABLE_LOG="${ENABLE_LOG}" DEBUG="${DEBUG}" DEMO="${DEMO}" BENCHMARK="${BENCHMARK}" CPP_TESTS=True CAIRO=True FAST=True || cat config.log
|
||||
- if [[ "${DEBUG}" == true ]]; then JOBS=2 make; else JOBS=4 make; fi;
|
||||
- git clone https://github.com/mapbox/mapnik-test-data tests/data/mapnik-test-data
|
||||
- make test
|
||||
- source localize.sh && make grind
|
||||
- if [[ ${BENCHMARK} != False ]]; then make bench; fi;
|
||||
|
|
14
INSTALL.md
|
@ -4,8 +4,18 @@ Mapnik is cross platform and runs on Linux, Mac OSX, Solaris, *BSD, and Windows.
|
|||
|
||||
To configure and build Mapnik do:
|
||||
|
||||
./configure
|
||||
make
|
||||
```bash
|
||||
$ ./configure
|
||||
$ make
|
||||
```
|
||||
|
||||
To use a Python interpreter that is not named `python` for your build, do
|
||||
something like the following instead:
|
||||
|
||||
```bash
|
||||
$ PYTHON=python2 ./configure
|
||||
$ make PYTHON=python2
|
||||
```
|
||||
|
||||
NOTE: the above will not work on windows, rather see https://github.com/mapnik/mapnik/wiki/WindowsInstallation
|
||||
|
||||
|
|
10
Makefile
|
@ -1,6 +1,8 @@
|
|||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
PYTHON = python
|
||||
|
||||
ifeq ($(JOBS),)
|
||||
JOBS:=1
|
||||
ifeq ($(OS),Linux)
|
||||
|
@ -14,13 +16,13 @@ endif
|
|||
all: mapnik
|
||||
|
||||
install:
|
||||
python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 install
|
||||
$(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 install
|
||||
|
||||
mapnik:
|
||||
python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1
|
||||
$(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1
|
||||
|
||||
clean:
|
||||
@python scons/scons.py -j$(JOBS) -c --config=cache --implicit-cache --max-drift=1
|
||||
@$(PYTHON) scons/scons.py -j$(JOBS) -c --config=cache --implicit-cache --max-drift=1
|
||||
@if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi
|
||||
@if test -e "config.log"; then rm "config.log"; fi
|
||||
@if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi
|
||||
|
@ -42,7 +44,7 @@ rebuild:
|
|||
make uninstall && make clean && time make && make install
|
||||
|
||||
uninstall:
|
||||
@python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall
|
||||
@$(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall
|
||||
|
||||
test:
|
||||
./run_tests
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace boost { namespace python {
|
|||
{
|
||||
static PyObject* convert(mapnik::value const& v)
|
||||
{
|
||||
return mapnik::util::apply_visitor(value_converter(),v.base());
|
||||
return mapnik::util::apply_visitor(value_converter(),v);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
4
configure
vendored
|
@ -1,3 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
python scons/scons.py --implicit-deps-changed configure "$@"
|
||||
PYTHON=${PYTHON:-python}
|
||||
|
||||
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"
|
||||
|
|
|
@ -70,7 +70,7 @@ struct value_not_null
|
|||
{
|
||||
bool operator() (feature_kv_iterator::value_type const& kv) const
|
||||
{
|
||||
return !util::apply_visitor(mapnik::detail::is_null_visitor(), std::get<1>(kv).base());
|
||||
return !util::apply_visitor(mapnik::detail::is_null_visitor(), std::get<1>(kv));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -126,15 +126,6 @@ struct utf8
|
|||
}
|
||||
};
|
||||
|
||||
struct value_base
|
||||
{
|
||||
using result_type = mapnik::value_base const&;
|
||||
mapnik::value_base const& operator() (mapnik::value const& val) const
|
||||
{
|
||||
return val.base();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
struct escaped_string
|
||||
: karma::grammar<OutputIterator, std::string(char const*)>
|
||||
|
@ -150,7 +141,7 @@ struct extract_string
|
|||
|
||||
result_type operator() (mapnik::value const& val) const
|
||||
{
|
||||
bool need_quotes = val.base().is<value_unicode_string>();
|
||||
bool need_quotes = val.is<value_unicode_string>();
|
||||
return std::make_tuple(val.to_string(), need_quotes);
|
||||
}
|
||||
};
|
||||
|
@ -173,7 +164,6 @@ struct feature_generator_grammar:
|
|||
karma::rule<OutputIterator, mapnik::value_unicode_string()> ustring;
|
||||
typename karma::int_generator<mapnik::value_integer,10, false> int__;
|
||||
boost::phoenix::function<get_id> id_;
|
||||
boost::phoenix::function<value_base> value_base_;
|
||||
boost::phoenix::function<extract_string> extract_string_;
|
||||
boost::phoenix::function<utf8> utf8_;
|
||||
std::string quote_;
|
||||
|
|
|
@ -89,7 +89,7 @@ feature_generator_grammar<OutputIterator>::feature_generator_grammar()
|
|||
pair = lit('"')
|
||||
<< kstring[_1 = boost::phoenix::at_c<0>(_val)] << lit('"')
|
||||
<< lit(':')
|
||||
<< value[_1 = extract_string_(value_base_(at_c<1>(_val)))]
|
||||
<< value[_1 = extract_string_(at_c<1>(_val))]
|
||||
;
|
||||
|
||||
value = eps(at_c<1>(_val)) << escaped_string_(quote_.c_str())[_1 = at_c<0>(_val)]
|
||||
|
|
|
@ -70,7 +70,7 @@ struct put_property
|
|||
explicit put_property(mapnik::transcoder const& tr)
|
||||
: tr_(tr) {}
|
||||
template <typename T0,typename T1, typename T2>
|
||||
result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
|
||||
result_type operator() (T0 & feature, T1 const& key, T2 && val) const
|
||||
{
|
||||
feature.put_new(key, mapnik::util::apply_visitor(attribute_value_visitor(tr_),val));
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ struct feature_grammar :
|
|||
|
||||
qi::rule<Iterator,void(FeatureType &),space_type> properties;
|
||||
qi::rule<Iterator,qi::locals<std::string>, void(FeatureType &),space_type> attributes;
|
||||
qi::rule<Iterator, mapnik::util::variant<value_null,bool,value_integer,value_double,std::string>(), space_type> attribute_value;
|
||||
qi::rule<Iterator, mapnik::util::variant<value_null,value_double,value_integer, bool, std::string>(), space_type> attribute_value;
|
||||
|
||||
phoenix::function<put_property> put_property_;
|
||||
phoenix::function<extract_geometry> extract_geometry_;
|
||||
|
|
|
@ -41,8 +41,10 @@ struct generic_json
|
|||
qi::int_parser<mapnik::value_integer,10,1,-1> int__;
|
||||
qi::rule<Iterator,std::string(), space_type> string_;
|
||||
qi::rule<Iterator,space_type> key_value;
|
||||
qi::rule<Iterator,mapnik::util::variant<value_null,bool,
|
||||
value_integer,value_double,
|
||||
qi::rule<Iterator,mapnik::util::variant<value_null,
|
||||
value_double,
|
||||
value_integer,
|
||||
bool,
|
||||
std::string>(),space_type> number;
|
||||
qi::rule<Iterator,space_type> object;
|
||||
qi::rule<Iterator,space_type> array;
|
||||
|
|
|
@ -56,6 +56,21 @@ struct where_message
|
|||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct value_converter
|
||||
{
|
||||
using result_type = T;
|
||||
template <typename T1>
|
||||
result_type operator() (T1 const& val) const
|
||||
{
|
||||
return static_cast<result_type>(val);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
struct topojson_grammar : qi::grammar<Iterator, space_type, topology()>
|
||||
|
||||
|
@ -69,9 +84,7 @@ private:
|
|||
qi::int_parser<mapnik::value_integer,10,1,-1> int__;
|
||||
qi::rule<Iterator,std::string(), space_type> string_;
|
||||
qi::rule<Iterator,space_type> key_value;
|
||||
qi::rule<Iterator,space_type, util::variant<value_null,bool,
|
||||
value_integer,value_double,
|
||||
std::string>()> number;
|
||||
qi::rule<Iterator,space_type, mapnik::topojson::value()> number;
|
||||
qi::rule<Iterator,space_type> object;
|
||||
qi::rule<Iterator,space_type> array;
|
||||
qi::rule<Iterator,space_type> pairs;
|
||||
|
@ -102,7 +115,9 @@ private:
|
|||
qi::rule<Iterator, space_type, mapnik::topojson::value()> attribute_value;
|
||||
// id
|
||||
qi::rule<Iterator,space_type> id;
|
||||
|
||||
// conversions
|
||||
boost::phoenix::function<detail::value_converter<mapnik::value_integer> > integer_converter;
|
||||
boost::phoenix::function<detail::value_converter<mapnik::value_double> > double_converter;
|
||||
// error
|
||||
boost::phoenix::function<where_message> where_message_;
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ topojson_grammar<Iterator>::topojson_grammar()
|
|||
using qi::fail;
|
||||
using qi::on_error;
|
||||
using phoenix::push_back;
|
||||
|
||||
using phoenix::construct;
|
||||
// generic json types
|
||||
value = object | array | string_ | number
|
||||
;
|
||||
|
@ -68,11 +68,11 @@ topojson_grammar<Iterator>::topojson_grammar()
|
|||
>> lit(']')
|
||||
;
|
||||
|
||||
number %= strict_double
|
||||
| int__
|
||||
number = strict_double[_val = double_converter(_1)]
|
||||
| int__[_val = integer_converter(_1)]
|
||||
| lit("true")[_val = true]
|
||||
| lit("false")[_val = false]
|
||||
| lit("null")
|
||||
| lit("null")[_val = construct<value_null>()]
|
||||
;
|
||||
|
||||
unesc_char.add
|
||||
|
|
|
@ -43,7 +43,7 @@ struct coordinate
|
|||
double y;
|
||||
};
|
||||
|
||||
using value = mapnik::util::variant<value_null,bool,value_integer,value_double,std::string>;
|
||||
using value = mapnik::util::variant<value_null,bool,value_double,value_integer,std::string>;
|
||||
using property = std::tuple<std::string, value >;
|
||||
using properties = std::vector<property>;
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ private:
|
|||
void rewind_subpath();
|
||||
bool next_segment();
|
||||
bool previous_segment();
|
||||
double current_segment_angle();
|
||||
// Position as calculated by last move/forward/next call.
|
||||
pixel_position current_position_;
|
||||
// First pixel of current segment.
|
||||
|
|
|
@ -541,21 +541,11 @@ public:
|
|||
: type_index(detail::invalid_value) {}
|
||||
|
||||
template <typename T, class = typename std::enable_if<
|
||||
detail::is_valid_type<T, Types...>::value>::type>
|
||||
VARIANT_INLINE explicit variant(T const& val) noexcept
|
||||
: type_index(detail::value_traits<T, Types...>::index)
|
||||
{
|
||||
constexpr std::size_t index = sizeof...(Types) - detail::value_traits<T, Types...>::index - 1;
|
||||
using target_type = typename detail::select_type<index, Types...>::type;
|
||||
new (&data) target_type(val);
|
||||
}
|
||||
|
||||
template <typename T, class = typename std::enable_if<
|
||||
detail::is_valid_type<T, Types...>::value>::type>
|
||||
detail::is_valid_type<typename std::remove_reference<T>::type, Types...>::value>::type>
|
||||
VARIANT_INLINE variant(T && val) noexcept
|
||||
: type_index(detail::value_traits<T, Types...>::index)
|
||||
: type_index(detail::value_traits<typename std::remove_reference<T>::type, Types...>::index)
|
||||
{
|
||||
constexpr std::size_t index = sizeof...(Types) - detail::value_traits<T, Types...>::index - 1;
|
||||
constexpr std::size_t index = sizeof...(Types) - detail::value_traits<typename std::remove_reference<T>::type, Types...>::index - 1;
|
||||
using target_type = typename detail::select_type<index, Types...>::type;
|
||||
new (&data) target_type(std::forward<T>(val)); // nothrow
|
||||
}
|
||||
|
|
|
@ -799,9 +799,8 @@ struct to_expression_string : public util::static_visitor<std::string>
|
|||
|
||||
namespace value_adl_barrier {
|
||||
|
||||
class value
|
||||
class value : public value_base
|
||||
{
|
||||
value_base base_;
|
||||
friend const value operator+(value const&,value const&);
|
||||
friend const value operator-(value const&,value const&);
|
||||
friend const value operator*(value const&,value const&);
|
||||
|
@ -810,64 +809,55 @@ class value
|
|||
|
||||
public:
|
||||
value () noexcept //-- comment out for VC++11
|
||||
: base_(value_null()) {}
|
||||
: value_base(value_null()) {}
|
||||
|
||||
value (value const& other) = default;
|
||||
|
||||
value( value && other) noexcept = default;
|
||||
|
||||
template <typename T>
|
||||
value ( T const& val)
|
||||
: base_(typename detail::mapnik_value_type<T>::type(val)) {}
|
||||
: value_base(typename detail::mapnik_value_type<T>::type(val)) {}
|
||||
|
||||
value (value const& other)
|
||||
: base_(other.base_) {}
|
||||
template <typename T>
|
||||
value ( T && val)
|
||||
: value_base(std::move(typename detail::mapnik_value_type<T>::type(val))) {}
|
||||
|
||||
value & operator=( value const& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
base_ = other.base_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
value( value && other) noexcept
|
||||
: base_(std::move(other.base_)) {}
|
||||
value & operator=( value const& other) = default;
|
||||
|
||||
bool operator==(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::equals(),base_,other.base_);
|
||||
return util::apply_visitor(impl::equals(),*this,other);
|
||||
}
|
||||
|
||||
bool operator!=(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::not_equals(),base_,other.base_);
|
||||
return util::apply_visitor(impl::not_equals(),*this,other);
|
||||
}
|
||||
|
||||
bool operator>(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::greater_than(),base_,other.base_);
|
||||
return util::apply_visitor(impl::greater_than(),*this,other);
|
||||
}
|
||||
|
||||
bool operator>=(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::greater_or_equal(),base_,other.base_);
|
||||
return util::apply_visitor(impl::greater_or_equal(),*this,other);
|
||||
}
|
||||
|
||||
bool operator<(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::less_than(),base_,other.base_);
|
||||
return util::apply_visitor(impl::less_than(),*this,other);
|
||||
}
|
||||
|
||||
bool operator<=(value const& other) const
|
||||
{
|
||||
return util::apply_visitor(impl::less_or_equal(),base_,other.base_);
|
||||
return util::apply_visitor(impl::less_or_equal(),*this,other);
|
||||
}
|
||||
|
||||
value operator- () const
|
||||
{
|
||||
return util::apply_visitor(impl::negate<value>(), base_);
|
||||
}
|
||||
|
||||
value_base const& base() const
|
||||
{
|
||||
return base_;
|
||||
return util::apply_visitor(impl::negate<value>(), *this);
|
||||
}
|
||||
|
||||
bool is_null() const;
|
||||
|
@ -875,68 +865,67 @@ public:
|
|||
template <typename T>
|
||||
T convert() const
|
||||
{
|
||||
return util::apply_visitor(impl::convert<T>(),base_);
|
||||
return util::apply_visitor(impl::convert<T>(),*this);
|
||||
}
|
||||
|
||||
value_bool to_bool() const
|
||||
{
|
||||
return util::apply_visitor(impl::convert<value_bool>(),base_);
|
||||
return util::apply_visitor(impl::convert<value_bool>(),*this);
|
||||
}
|
||||
|
||||
std::string to_expression_string(char quote = '\'') const
|
||||
{
|
||||
return util::apply_visitor(impl::to_expression_string(quote),base_);
|
||||
return util::apply_visitor(impl::to_expression_string(quote),*this);
|
||||
}
|
||||
|
||||
std::string to_string() const
|
||||
{
|
||||
return util::apply_visitor(impl::convert<std::string>(),base_);
|
||||
return util::apply_visitor(impl::convert<std::string>(),*this);
|
||||
}
|
||||
|
||||
value_unicode_string to_unicode() const
|
||||
{
|
||||
return util::apply_visitor(impl::to_unicode(),base_);
|
||||
return util::apply_visitor(impl::to_unicode(),*this);
|
||||
}
|
||||
|
||||
value_double to_double() const
|
||||
{
|
||||
return util::apply_visitor(impl::convert<value_double>(),base_);
|
||||
return util::apply_visitor(impl::convert<value_double>(),*this);
|
||||
}
|
||||
|
||||
value_integer to_int() const
|
||||
{
|
||||
return util::apply_visitor(impl::convert<value_integer>(),base_);
|
||||
return util::apply_visitor(impl::convert<value_integer>(),*this);
|
||||
}
|
||||
};
|
||||
|
||||
inline const value operator+(value const& p1,value const& p2)
|
||||
{
|
||||
|
||||
return value(util::apply_visitor(impl::add<value>(),p1.base_, p2.base_));
|
||||
return value(util::apply_visitor(impl::add<value>(),p1, p2));
|
||||
}
|
||||
|
||||
inline const value operator-(value const& p1,value const& p2)
|
||||
{
|
||||
|
||||
return value(util::apply_visitor(impl::sub<value>(),p1.base_, p2.base_));
|
||||
return value(util::apply_visitor(impl::sub<value>(),p1, p2));
|
||||
}
|
||||
|
||||
inline const value operator*(value const& p1,value const& p2)
|
||||
{
|
||||
|
||||
return value(util::apply_visitor(impl::mult<value>(),p1.base_, p2.base_));
|
||||
return value(util::apply_visitor(impl::mult<value>(),p1, p2));
|
||||
}
|
||||
|
||||
inline const value operator/(value const& p1,value const& p2)
|
||||
{
|
||||
|
||||
return value(util::apply_visitor(impl::div<value>(),p1.base_, p2.base_));
|
||||
return value(util::apply_visitor(impl::div<value>(),p1, p2));
|
||||
}
|
||||
|
||||
inline const value operator%(value const& p1,value const& p2)
|
||||
{
|
||||
|
||||
return value(util::apply_visitor(impl::mod<value>(),p1.base_, p2.base_));
|
||||
return value(util::apply_visitor(impl::mod<value>(),p1, p2));
|
||||
}
|
||||
|
||||
template <typename charT, typename traits>
|
||||
|
@ -948,12 +937,6 @@ operator << (std::basic_ostream<charT,traits>& out,
|
|||
return out;
|
||||
}
|
||||
|
||||
// hash function
|
||||
inline std::size_t hash_value(value const& val)
|
||||
{
|
||||
return hash_value(val.base());
|
||||
}
|
||||
|
||||
} // namespace value_adl_barrier
|
||||
|
||||
using value_adl_barrier::value;
|
||||
|
@ -984,7 +967,7 @@ struct is_null_visitor : public util::static_visitor<bool>
|
|||
|
||||
inline bool value::is_null() const
|
||||
{
|
||||
return util::apply_visitor(mapnik::detail::is_null_visitor(), base_);
|
||||
return util::apply_visitor(mapnik::detail::is_null_visitor(), *this);
|
||||
}
|
||||
|
||||
} // namespace mapnik
|
||||
|
|
|
@ -199,7 +199,7 @@ struct mapnik_value_type<T, typename std::enable_if<detail::is_value_double<T>::
|
|||
template <typename T>
|
||||
struct mapnik_value_type<T, typename std::enable_if<detail::is_value_unicode_string<T>::value>::type>
|
||||
{
|
||||
using type = mapnik::value_unicode_string;
|
||||
using type = mapnik::value_unicode_string const&;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
|
|
@ -177,7 +177,7 @@ void geojson_datasource::parse_geojson(T const& buffer)
|
|||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(std::get<0>(kv),
|
||||
mapnik::util::apply_visitor(attr_value_converter(),
|
||||
std::get<1>(kv).base())));
|
||||
std::get<1>(kv))));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
failures=0
|
||||
|
||||
source ./localize.sh
|
||||
PYTHON=${PYTHON:-python}
|
||||
|
||||
echo "*** Running visual tests..."
|
||||
python tests/visual_tests/test.py -q
|
||||
$PYTHON tests/visual_tests/test.py -q
|
||||
failures=$((failures+$?))
|
||||
|
||||
echo "*** Running C++ tests..."
|
||||
|
@ -14,7 +15,7 @@ failures=$((failures+$?))
|
|||
echo
|
||||
|
||||
echo "*** Running python tests..."
|
||||
python tests/run_tests.py -q
|
||||
$PYTHON tests/run_tests.py -q
|
||||
failures=$((failures+$?))
|
||||
|
||||
exit $failures
|
||||
|
|
|
@ -27,29 +27,40 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
double vertex_cache::current_segment_angle()
|
||||
{
|
||||
return std::atan2(-(current_segment_->pos.y - segment_starting_point_.y),
|
||||
current_segment_->pos.x - segment_starting_point_.x);
|
||||
}
|
||||
|
||||
double vertex_cache::angle(double width)
|
||||
{
|
||||
/* IMPORTANT NOTE: See note about coordinate systems in placement_finder::find_point_placement()
|
||||
* for imformation about why the y axis is inverted! */
|
||||
// IMPORTANT NOTE: See note about coordinate systems in placement_finder::find_point_placement()
|
||||
// for imformation about why the y axis is inverted!
|
||||
double tmp = width + position_in_segment_;
|
||||
if ((tmp <= current_segment_->length) && (tmp >= 0))
|
||||
{
|
||||
//Only calculate angle on request as it is expensive
|
||||
if (!angle_valid_)
|
||||
{
|
||||
angle_ = std::atan2(-(current_segment_->pos.y - segment_starting_point_.y),
|
||||
current_segment_->pos.x - segment_starting_point_.x);
|
||||
angle_ = current_segment_angle();
|
||||
}
|
||||
return width >= 0 ? angle_ : angle_ + M_PI;
|
||||
} else
|
||||
{
|
||||
scoped_state s(*this);
|
||||
pixel_position const& old_pos = s.get_state().position();
|
||||
move(width);
|
||||
double angle = std::atan2(-(current_position_.y - old_pos.y),
|
||||
current_position_.x - old_pos.x);
|
||||
return angle;
|
||||
if (move(width))
|
||||
{
|
||||
pixel_position const& old_pos = s.get_state().position();
|
||||
return std::atan2(-(current_position_.y - old_pos.y),
|
||||
current_position_.x - old_pos.x);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.restore();
|
||||
angle_ = current_segment_angle();
|
||||
}
|
||||
}
|
||||
return width >= 0 ? angle_ : angle_ + M_PI;
|
||||
}
|
||||
|
||||
bool vertex_cache::next_subpath()
|
||||
|
|
61
tests/python_tests/mapnik_test_data_test.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
from glob import glob
|
||||
|
||||
default_logging_severity = mapnik.logger.get_severity()
|
||||
|
||||
def setup():
|
||||
mapnik.logger.set_severity(mapnik.severity_type.None)
|
||||
# All of the paths used are relative, if we run the tests
|
||||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def teardown():
|
||||
mapnik.logger.set_severity(default_logging_severity)
|
||||
|
||||
plugin_mapping = {
|
||||
'.csv' : ['csv'],
|
||||
'.json': ['geojson','ogr'],
|
||||
'.tif' : ['gdal'],
|
||||
#'.tif' : ['gdal','raster'],
|
||||
'.kml' : ['ogr'],
|
||||
'.gpx' : ['ogr'],
|
||||
'.vrt' : ['gdal']
|
||||
}
|
||||
|
||||
def test_opening_data():
|
||||
# https://github.com/mapbox/mapnik-test-data
|
||||
# cd tests/data
|
||||
# git clone --depth 1 https://github.com/mapbox/mapnik-test-data
|
||||
if os.path.exists('../data/mapnik-test-data/'):
|
||||
files = glob('../data/mapnik-test-data/data/*/*.*')
|
||||
for filepath in files:
|
||||
ext = os.path.splitext(filepath)[1]
|
||||
if plugin_mapping.get(ext):
|
||||
print 'testing opening %s' % filepath
|
||||
if 'topo' in filepath:
|
||||
kwargs = {'type': 'ogr','file': filepath}
|
||||
kwargs['layer_by_index'] = 0
|
||||
try:
|
||||
ds = mapnik.Datasource(**kwargs)
|
||||
except Exception, e:
|
||||
print 'could not open, %s: %s' % (kwargs,e)
|
||||
else:
|
||||
for plugin in plugin_mapping[ext]:
|
||||
kwargs = {'type': plugin,'file': filepath}
|
||||
if plugin is 'ogr':
|
||||
kwargs['layer_by_index'] = 0
|
||||
try:
|
||||
ds = mapnik.Datasource(**kwargs)
|
||||
except Exception, e:
|
||||
print 'could not open, %s: %s' % (kwargs,e)
|
||||
else:
|
||||
print 'skipping opening %s' % filepath
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
exit(run_all(eval(x) for x in dir() if x.startswith("test_")))
|
|
@ -21,7 +21,7 @@
|
|||
"data": {},
|
||||
"grid": [
|
||||
" ! ! ! !! !! ! !!!!!!! ",
|
||||
" !! !!!! !!! !! !! !! ",
|
||||
" !! !!!! !!! !! !! ! ",
|
||||
" !!!! ! ! ! ! ! !!! ! ",
|
||||
" !! !!!! ! ! ! !! !!!! ",
|
||||
" !!!!!! ! !!!!!!!!!! !!! !!!!! ",
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
" %%%% %% &&& & &##&#&#& # # &&&& & && #### &&&& &&&& # # $$$$ ",
|
||||
" %%% %% & &&&& &### & # & &&&&& ## & &&&&& & & # $$$$ ",
|
||||
" %%% %%% && && & & &&& & & & & & &&&&& && & $$$$ ",
|
||||
" %%% %%% && && & &&&&& &&&&& & & &&& &&&&&&&& &&& & & &&&&&&&&&&&&& & && $$$$ ",
|
||||
" %%% %%% && && & &&&&& &&&&& & & &&& &&&&&&&& &&& & & &&&&&&&&&&&&& & && & $$$$ ",
|
||||
" %%%% % &&&&&&&&&&& & &&& &&& &&&&&&&&& &&&&& &&&&&&&&&&&&&& &&&&&& & &&&&&&&&&&&&&& &&& $$$$ ",
|
||||
" %%% &&&&&&&&&& & && & & &&&&&&&&&&&& & && & &&&&&&&&&&&&& && && &&&&&&&&&&&&&&&&& && $$$$ ",
|
||||
" %%% &&&&&&&&&& & && & & &&&&&&&&&&&& & && & &&&&&&&&&&&&& && && &&&&&&&&&&&&&&&&& & $$$$ ",
|
||||
" %%% &&&&&&&&&&&&& &&&& && &&&&&&& &&&&&&& & &&&&&& &&&&& && && &&&&&& &&&&&& & $$$$$$$ ",
|
||||
" %%% &&&&&& &&&& && && &&&&&& &&&& & && &&&&&& &&&& & &&&& &&&&& &&&& &&& $$$$$$$$$ ",
|
||||
" %%% &&&&& &&&& &&& & &&&&& &&&& &&& &&&&& &&&&&&&&&& &&&&& &&&& & & & $$ $$$$$$ ",
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
" %%% & &&&& &&&&&&&& && & &&& &&&&&&&&&& && & &&&&&&&&&&&& &&& & &&&&&&&&&&&&& & & $ $ $$$ ",
|
||||
" %%% &&&&&&&&&&& && & & & &&&&&&&&&&&&&& & && && && &&&&&&&&&&&&&& & & & &&&&&&&& &&&&& & $$ $ $$$ ",
|
||||
" %%% &&& &&&&&&&&&&&&&& & && && &&&&&&& &&&&&& &&& & &&& &&&&&&& &&&&& &&& & &&& &&&&&& &&&&& &&&&& $$ $ $$$$ ",
|
||||
" %%% &&& &&&&&&& &&&&& &&&& && && &&&&&&& &&&&& && && & & &&&&&& &&&&& & &&&&&& && &&&&& &&&&& && && $$$$$$ ",
|
||||
" %%% &&& &&&&&&& &&&&& &&&& && && &&&&&&& &&&&& && && & & &&&&&& &&&&& & &&&&&& && &&&&& &&&&& && & $$$$$$ ",
|
||||
" %%% &&&&&& &&&& && & &&& &&&&&&&& &&&& && && &&& &&&&& &&&&&& &&&&& &&&& && && & $$$$ ",
|
||||
" %%% &&&&&& &&&&&&& && &&&&&&&&& &&&&&& & &&&&&&& &&&& && && &&&&&& &&&& && &&& $$$$ ",
|
||||
" %%% &&&&& &&&& & &&& &&&&& &&&& & & &&&&& &&&& & && &&&&& &&&&& & & && $$$$ ",
|
||||
|
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |