Merge branch 'debugsymbolizer' into harfbuzz
This commit is contained in:
commit
b97840660c
6 changed files with 131 additions and 1 deletions
|
@ -107,6 +107,9 @@ public:
|
||||||
void process(markers_symbolizer const& sym,
|
void process(markers_symbolizer const& sym,
|
||||||
mapnik::feature_impl & feature,
|
mapnik::feature_impl & feature,
|
||||||
proj_transform const& prj_trans);
|
proj_transform const& prj_trans);
|
||||||
|
void process(debug_symbolizer const& sym,
|
||||||
|
feature_impl & feature,
|
||||||
|
proj_transform const& prj_trans);
|
||||||
|
|
||||||
inline bool process(rule::symbolizers const& /*syms*/,
|
inline bool process(rule::symbolizers const& /*syms*/,
|
||||||
mapnik::feature_impl & /*feature*/,
|
mapnik::feature_impl & /*feature*/,
|
||||||
|
|
39
include/mapnik/debug_symbolizer.hpp
Normal file
39
include/mapnik/debug_symbolizer.hpp
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Artem Pavlenko
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAPNIK_DEBUG_SYMBOLIZER_HPP
|
||||||
|
#define MAPNIK_DEBUG_SYMBOLIZER_HPP
|
||||||
|
|
||||||
|
#include <mapnik/config.hpp>
|
||||||
|
#include <mapnik/symbolizer.hpp>
|
||||||
|
|
||||||
|
namespace mapnik
|
||||||
|
{
|
||||||
|
|
||||||
|
struct MAPNIK_DECL debug_symbolizer :
|
||||||
|
public symbolizer_base
|
||||||
|
{
|
||||||
|
debug_symbolizer() : symbolizer_base() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DEBUG_SYMBOLIZER_HPP
|
|
@ -34,6 +34,7 @@
|
||||||
#include <mapnik/shield_symbolizer.hpp>
|
#include <mapnik/shield_symbolizer.hpp>
|
||||||
#include <mapnik/text_symbolizer.hpp>
|
#include <mapnik/text_symbolizer.hpp>
|
||||||
#include <mapnik/markers_symbolizer.hpp>
|
#include <mapnik/markers_symbolizer.hpp>
|
||||||
|
#include <mapnik/debug_symbolizer.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
#include <mapnik/expression.hpp>
|
#include <mapnik/expression.hpp>
|
||||||
#include <mapnik/expression_string.hpp>
|
#include <mapnik/expression_string.hpp>
|
||||||
|
@ -108,6 +109,12 @@ inline bool operator==(markers_symbolizer const& lhs,
|
||||||
return (&lhs == &rhs);
|
return (&lhs == &rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool operator==(debug_symbolizer const& lhs,
|
||||||
|
debug_symbolizer const& rhs)
|
||||||
|
{
|
||||||
|
return (&lhs == &rhs);
|
||||||
|
}
|
||||||
|
|
||||||
typedef boost::variant<point_symbolizer,
|
typedef boost::variant<point_symbolizer,
|
||||||
line_symbolizer,
|
line_symbolizer,
|
||||||
line_pattern_symbolizer,
|
line_pattern_symbolizer,
|
||||||
|
@ -117,7 +124,8 @@ typedef boost::variant<point_symbolizer,
|
||||||
shield_symbolizer,
|
shield_symbolizer,
|
||||||
text_symbolizer,
|
text_symbolizer,
|
||||||
building_symbolizer,
|
building_symbolizer,
|
||||||
markers_symbolizer> symbolizer;
|
markers_symbolizer,
|
||||||
|
debug_symbolizer> symbolizer;
|
||||||
|
|
||||||
class rule
|
class rule
|
||||||
{
|
{
|
||||||
|
|
66
src/agg/process_debug_symbolizer.cpp
Normal file
66
src/agg/process_debug_symbolizer.cpp
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Artem Pavlenko
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// mapnik
|
||||||
|
#include <mapnik/agg_renderer.hpp>
|
||||||
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
|
#include <mapnik/graphics.hpp>
|
||||||
|
#include "agg_renderer_primitives.h"
|
||||||
|
|
||||||
|
namespace mapnik {
|
||||||
|
|
||||||
|
void draw_rect(image_32 &pixmap, box2d<double> const& box)
|
||||||
|
{
|
||||||
|
double x0 = box.minx();
|
||||||
|
double x1 = box.maxx();
|
||||||
|
double y0 = box.miny();
|
||||||
|
double y1 = box.maxy();
|
||||||
|
unsigned color1 = 0xff0000ff;
|
||||||
|
for (double x=x0; x<x1; x++)
|
||||||
|
{
|
||||||
|
pixmap.setPixel(x, y0, color1);
|
||||||
|
pixmap.setPixel(x, y1, color1);
|
||||||
|
}
|
||||||
|
for (double y=y0; y<y1; y++)
|
||||||
|
{
|
||||||
|
pixmap.setPixel(x0, y, color1);
|
||||||
|
pixmap.setPixel(x1, y, color1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void agg_renderer<T>::process(debug_symbolizer const& sym,
|
||||||
|
mapnik::feature_impl & feature,
|
||||||
|
proj_transform const& prj_trans)
|
||||||
|
{
|
||||||
|
label_collision_detector4::query_iterator itr = detector_->begin(), end = detector_->end();
|
||||||
|
for (;itr!=end; itr++)
|
||||||
|
{
|
||||||
|
draw_rect(pixmap_, itr->box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template void agg_renderer<image_32>::process(debug_symbolizer const&,
|
||||||
|
mapnik::feature_impl &,
|
||||||
|
proj_transform const&);
|
||||||
|
}
|
||||||
|
|
|
@ -263,6 +263,7 @@ source += Split(
|
||||||
agg/process_raster_symbolizer.cpp
|
agg/process_raster_symbolizer.cpp
|
||||||
agg/process_shield_symbolizer.cpp
|
agg/process_shield_symbolizer.cpp
|
||||||
agg/process_markers_symbolizer.cpp
|
agg/process_markers_symbolizer.cpp
|
||||||
|
agg/process_debug_symbolizer.cpp
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ private:
|
||||||
void parse_building_symbolizer(rule & rule, xml_node const& sym);
|
void parse_building_symbolizer(rule & rule, xml_node const& sym);
|
||||||
void parse_raster_symbolizer(rule & rule, xml_node const& sym);
|
void parse_raster_symbolizer(rule & rule, xml_node const& sym);
|
||||||
void parse_markers_symbolizer(rule & rule, xml_node const& sym);
|
void parse_markers_symbolizer(rule & rule, xml_node const& sym);
|
||||||
|
void parse_debug_symbolizer(rule & rule, xml_node const& sym);
|
||||||
|
|
||||||
void parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node);
|
void parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node);
|
||||||
bool parse_stroke(stroke & strk, xml_node const & sym);
|
bool parse_stroke(stroke & strk, xml_node const & sym);
|
||||||
|
@ -806,6 +807,10 @@ void map_parser::parse_rule(feature_type_style & style, xml_node const& r)
|
||||||
{
|
{
|
||||||
parse_markers_symbolizer(rule, *symIter);
|
parse_markers_symbolizer(rule, *symIter);
|
||||||
}
|
}
|
||||||
|
else if (symIter->is("DebugSymbolizer"))
|
||||||
|
{
|
||||||
|
parse_debug_symbolizer(rule, *symIter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
style.add_rule(rule);
|
style.add_rule(rule);
|
||||||
|
|
||||||
|
@ -1536,6 +1541,14 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void map_parser::parse_debug_symbolizer(rule & rule, xml_node const & sym)
|
||||||
|
{
|
||||||
|
debug_symbolizer symbol;
|
||||||
|
|
||||||
|
parse_symbolizer_base(symbol, sym);
|
||||||
|
rule.append(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
void map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc,
|
void map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc,
|
||||||
xml_node const& node)
|
xml_node const& node)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue