Merge branch 'master' into image_filters
This commit is contained in:
commit
75522c0cc5
12 changed files with 53 additions and 23 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -6,6 +6,19 @@ Developers: Please commit along with changes.
|
|||
|
||||
For a complete change history, see the git log.
|
||||
|
||||
## Future
|
||||
|
||||
Released: YYYY XX, 2015
|
||||
|
||||
(Packaged from xxxx)
|
||||
|
||||
#### Summary
|
||||
|
||||
- Fixed an issue with fields over size of int32 in OGR plugin (https://github.com/mapnik/node-mapnik/issues/499)
|
||||
- Added 3 new image-filters to simulate types of colorblindness (`color-blind-protanope`,`color-blind-deuteranope`,`color-blind-tritanope`)
|
||||
- Fix so that null text boxes have no bounding boxes when attempting placement ( 162f82cba5b0fb984c425586c6a4b354917abc47 )
|
||||
- Patch to add legacy method for setting JPEG quality in images ( #3024 )
|
||||
|
||||
## 3.0.2
|
||||
|
||||
Released: July 31, 2015
|
||||
|
|
|
@ -301,6 +301,7 @@ opts.AddVariables(
|
|||
('HOST', 'Set the target host for cross compiling', ''),
|
||||
('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG),
|
||||
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
|
||||
BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'),
|
||||
# http://www.scons.org/wiki/GoFastButton
|
||||
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
|
||||
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
|
||||
|
@ -1706,6 +1707,9 @@ if not preconfigured:
|
|||
if env['THREADING'] == 'multi':
|
||||
env.Append(CPPDEFINES = '-DMAPNIK_THREADSAFE')
|
||||
|
||||
if env['NO_ATEXIT']:
|
||||
env.Append(CPPDEFINES = '-DMAPNIK_NO_ATEXIT')
|
||||
|
||||
# Mac OSX (Darwin) special settings
|
||||
if env['PLATFORM'] == 'Darwin':
|
||||
pthread = ''
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
|
||||
namespace mapnik { namespace geometry {
|
||||
|
||||
template <typename T>
|
||||
|
@ -91,10 +93,14 @@ struct linear_ring : line_string<T>
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
using rings_container = std::vector<linear_ring<T>>;
|
||||
|
||||
template <typename T, template <typename> class InteriorRings = rings_container>
|
||||
struct polygon
|
||||
{
|
||||
linear_ring<T> exterior_ring;
|
||||
std::vector<linear_ring<T>> interior_rings;
|
||||
using rings_container = InteriorRings<T>;
|
||||
rings_container interior_rings;
|
||||
|
||||
polygon() = default;
|
||||
inline void set_exterior_ring(linear_ring<T> && ring)
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include <mapnik/box2d.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
// register point
|
||||
BOOST_GEOMETRY_REGISTER_POINT_2D (mapnik::geometry::point<double>, double, boost::geometry::cs::cartesian, x, y)
|
||||
|
@ -180,13 +179,13 @@ struct ring_mutable_type<mapnik::geometry::polygon<CoordinateType> >
|
|||
template <typename CoordinateType>
|
||||
struct interior_const_type<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using type = typename std::vector<mapnik::geometry::linear_ring<CoordinateType> > const&;
|
||||
using type = typename mapnik::geometry::polygon<CoordinateType>::rings_container const&;
|
||||
};
|
||||
|
||||
template <typename CoordinateType>
|
||||
struct interior_mutable_type<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using type = typename std::vector<mapnik::geometry::linear_ring<CoordinateType> >&;
|
||||
using type = typename mapnik::geometry::polygon<CoordinateType>::rings_container&;
|
||||
};
|
||||
|
||||
// exterior
|
||||
|
@ -207,7 +206,7 @@ struct exterior_ring<mapnik::geometry::polygon<CoordinateType> >
|
|||
template <typename CoordinateType>
|
||||
struct interior_rings<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using holes_type = std::vector<mapnik::geometry::linear_ring<CoordinateType> >;
|
||||
using holes_type = typename mapnik::geometry::polygon<CoordinateType>::rings_container;
|
||||
static holes_type& get(mapnik::geometry::polygon<CoordinateType> & p)
|
||||
{
|
||||
return p.interior_rings;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <vector>
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::point<double>,
|
||||
|
@ -43,11 +42,11 @@ BOOST_FUSION_ADAPT_STRUCT(
|
|||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::polygon<double>,
|
||||
(mapnik::geometry::linear_ring<double> const&, exterior_ring)
|
||||
(std::vector<mapnik::geometry::linear_ring<double> > const& , interior_rings))
|
||||
(mapnik::geometry::polygon<double>::rings_container const& , interior_rings))
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::polygon<std::int64_t>,
|
||||
(mapnik::geometry::linear_ring<std::int64_t> const&, exterior_ring)
|
||||
(std::vector<mapnik::geometry::linear_ring<std::int64_t> > const& , interior_rings))
|
||||
(mapnik::geometry::polygon<std::int64_t>::rings_container const& , interior_rings))
|
||||
|
||||
#endif // MAPNIK_GEOMETRY_FUSION_ADAPTED_HPP
|
||||
|
|
|
@ -104,7 +104,7 @@ struct geometry_generator_grammar :
|
|||
karma::rule<OutputIterator, geometry::geometry<double> const&()> polygon;
|
||||
karma::rule<OutputIterator, geometry::polygon<double> const&()> polygon_coord;
|
||||
karma::rule<OutputIterator, geometry::linear_ring<double> const&()> exterior_ring_coord;
|
||||
karma::rule<OutputIterator, std::vector<geometry::linear_ring<double> > const&()> interior_ring_coord;
|
||||
karma::rule<OutputIterator, geometry::polygon<double>::rings_container const&()> interior_ring_coord;
|
||||
karma::rule<OutputIterator, geometry::geometry<double> const& ()> multi_point;
|
||||
karma::rule<OutputIterator, geometry::multi_point<double> const& ()> multi_point_coord;
|
||||
karma::rule<OutputIterator, geometry::geometry<double> const& ()> multi_linestring;
|
||||
|
|
|
@ -320,12 +320,12 @@ public:
|
|||
svg_height_ = h;
|
||||
}
|
||||
|
||||
double width()
|
||||
double width() const
|
||||
{
|
||||
return svg_width_;
|
||||
}
|
||||
|
||||
double height()
|
||||
double height() const
|
||||
{
|
||||
return svg_height_;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
// Checks for collision.
|
||||
bool collision(box2d<double> const& box, const value_unicode_string &repeat_key, bool line_placement) const;
|
||||
// Adds marker to glyph_positions and to collision detector. Returns false if there is a collision.
|
||||
bool add_marker(glyph_positions_ptr & glyphs, pixel_position const& pos) const;
|
||||
bool add_marker(glyph_positions_ptr & glyphs, pixel_position const& pos, std::vector<box2d<double>> & bboxes) const;
|
||||
// Maps upright==auto, left-only and right-only to left,right to simplify processing.
|
||||
// angle = angle of at start of line (to estimate best option for upright==auto)
|
||||
text_upright_e simplify_upright(text_upright_e upright, double angle) const;
|
||||
|
|
|
@ -119,8 +119,10 @@ template <typename T,
|
|||
{
|
||||
tmp = CreatePolicy<T>::create();
|
||||
pInstance_.store(tmp, std::memory_order_release);
|
||||
#ifndef MAPNIK_NO_ATEXIT
|
||||
// register destruction
|
||||
std::atexit(&DestroySingleton);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
// boost
|
||||
|
@ -76,9 +75,9 @@ namespace boost { namespace spirit { namespace traits {
|
|||
|
||||
template <>
|
||||
struct transform_attribute<mapnik::geometry::polygon<double> const,
|
||||
std::vector<mapnik::geometry::linear_ring<double> > const&, karma::domain>
|
||||
mapnik::geometry::polygon<double>::rings_container const&, karma::domain>
|
||||
{
|
||||
using type = std::vector<mapnik::geometry::linear_ring<double> > const&;
|
||||
using type = mapnik::geometry::polygon<double>::rings_container const&;
|
||||
static type pre(mapnik::geometry::polygon<double> const& poly)
|
||||
{
|
||||
return poly.interior_rings;
|
||||
|
@ -164,9 +163,9 @@ namespace boost { namespace spirit { namespace traits {
|
|||
|
||||
template <>
|
||||
struct transform_attribute<mapnik::geometry::polygon<std::int64_t> const,
|
||||
std::vector<mapnik::geometry::linear_ring<std::int64_t> > const&, karma::domain>
|
||||
mapnik::geometry::polygon<std::int64_t>::rings_container const&, karma::domain>
|
||||
{
|
||||
using type = std::vector<mapnik::geometry::linear_ring<std::int64_t> > const&;
|
||||
using type = mapnik::geometry::polygon<std::int64_t>::rings_container const&;
|
||||
static type pre(mapnik::geometry::polygon<std::int64_t> const& poly)
|
||||
{
|
||||
return poly.interior_rings;
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t):
|
||||
stream_(stream), t_(t) {}
|
||||
jpeg_saver::jpeg_saver(std::ostream & stream, std::string const& t)
|
||||
: stream_(stream), t_(t) {}
|
||||
|
||||
template <typename T>
|
||||
void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream & stream)
|
||||
|
@ -54,6 +54,13 @@ void process_rgba8_jpeg(T const& image, std::string const& type, std::ostream &
|
|||
auto const& val = kv.second;
|
||||
|
||||
if ( key == "jpeg" ) continue;
|
||||
else if ( key.size() > 4 && key.substr(0,4) == "jpeg")
|
||||
{
|
||||
if (!mapnik::util::string2int(key.substr(4), quality))
|
||||
{
|
||||
throw image_writer_exception("invalid jpeg quality: '" + key.substr(4) + "'");
|
||||
}
|
||||
}
|
||||
else if ( key == "quality")
|
||||
{
|
||||
if (val && ! (*val).empty())
|
||||
|
|
|
@ -143,7 +143,7 @@ bool placement_finder::find_point_placement(pixel_position const& pos)
|
|||
/* For point placements it is faster to just check the bounding box. */
|
||||
if (collision(bbox, layouts_.text(), false)) return false;
|
||||
|
||||
if (layout.num_lines()) bboxes.push_back(std::move(bbox));
|
||||
if (layout.glyphs_count()) bboxes.push_back(std::move(bbox));
|
||||
|
||||
pixel_position layout_offset = layout_center - glyphs->get_base_point();
|
||||
layout_offset.y = -layout_offset.y;
|
||||
|
@ -178,7 +178,7 @@ bool placement_finder::find_point_placement(pixel_position const& pos)
|
|||
}
|
||||
|
||||
// add_marker first checks for collision and then updates the detector.
|
||||
if (has_marker_ && !add_marker(glyphs, pos)) return false;
|
||||
if (has_marker_ && !add_marker(glyphs, pos, bboxes)) return false;
|
||||
|
||||
box2d<double> label_box;
|
||||
bool first = true;
|
||||
|
@ -418,14 +418,15 @@ void placement_finder::set_marker(marker_info_ptr m, box2d<double> box, bool mar
|
|||
}
|
||||
|
||||
|
||||
bool placement_finder::add_marker(glyph_positions_ptr & glyphs, pixel_position const& pos) const
|
||||
bool placement_finder::add_marker(glyph_positions_ptr & glyphs, pixel_position const& pos, std::vector<box2d<double>> & bboxes) const
|
||||
{
|
||||
pixel_position real_pos = (marker_unlocked_ ? pos : glyphs->get_base_point()) + marker_displacement_;
|
||||
box2d<double> bbox = marker_box_;
|
||||
bbox.move(real_pos.x, real_pos.y);
|
||||
glyphs->set_marker(marker_, real_pos);
|
||||
if (collision(bbox, layouts_.text(), false)) return false;
|
||||
detector_.insert(bbox);
|
||||
bboxes.push_back(std::move(bbox));
|
||||
glyphs->set_marker(marker_, real_pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue