2006-03-31 12:32:02 +02:00
|
|
|
/*****************************************************************************
|
Patch from David Eastcott :
1. Modified Text Symbolizer
a) corrected line fragment centering (for 2nd and subsequent lines, when line breaks occur).
b) adjusted vertical alignment calculation so that:
i) middle -> has the center of the text line(s) at the point origin
ii) bottom -> has the text line(s) below the point origin
iii) top -> has the text line(s) above the point origin
c) added new text_symbolizer attribute: 'wrap_before', value range: true/false, default == false
allows line breaks at first wrap_char before wrap_width as an alternative to the original
which was to create the line break at the first wrap_char after wrap_width
d) added new text_symbolizer attribute: 'horizontal_alignment', value range: left/middle/right, default == middle
i) left -> has all text line(s) to left of the point origin
ii) middle -> has all text line(s) centered on the the point origin
iii) right -> has all text line(s) to the right of the point origin
NOTE: dx, dy position adjustments are applied after alignments and before Justify.
e) added new text_symbolizer attribute: 'justify_alignment', value range: left/middle/right, default == middle
i) left -> after alignments, has all text line(s) are left justified (left to right reading)
ii) middle -> after alignments, has all text line(s) center justified
iii) right -> after alignments, has all text line(s) right justified (right to left reading)
f) added new text_symbolizer attribute: 'opacity', value range: 0.0 thru 1.0; 1.0 == fully opaque
g) modified positioning to compensate for both line_spacing and character_spacing, to ensure proper
centering of the text envelope. Also ensure that centering occurs correctly even if no wrapping
occurs. Line spacing is uniform and consistent and compensates for errors between text_size and
the actual size (ci.height is inconsistent, depending on case and character); fixes issue with
multi-line text where some lines have a slight gap and others are compressed together.
2. Modified shield_symbolizer
a) added the attributes:
i) allow_overlap
ii) vertical_alignment
iii) horizontal_alignment
iv) justify_alignment
v) wrap_width
vi) wrap_character
vii) wrap_before
viii) text_convert
ix) line_spacing
x) character_spacing
xi) opacity
b) added new shield_symbolizer attribute: 'unlock_image', value range: true/false, default == false
i) false == image and text placement behaviour same as before
ii) true == image placement independant of text, image is always centered at geometry point, text placed per attributes,
dx/dy only affect text.
Allows user to create point markers with text, but both the text and image rendering collision detection are done
as a pair (they come and go together - solves problem if using point_symbolizer and text_symbolizers where one or the
other are omitted due to overlaps, but not both)
c) extended choices for the attribute 'placement' to include vertex; effect is limited to the shield_symbolizer
Allows an attempted placement at every vertex available, gives additional shield placement volume when using line geometry
d) ensured that the text placement was not updating the detector unless a shield image was actually placed.
e) added new shield_symbolizer attribute: 'no_text', value range: true/false, default = false
When set true, the text for the feature is ignored ('space' subsituted) so that pure graphic symbols can be used
and no text is rendered over top of them.
2009-10-19 15:52:53 +02:00
|
|
|
*
|
2006-03-31 12:32:02 +02:00
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
2006-03-10 13:08:55 +01:00
|
|
|
*
|
2011-10-23 15:04:25 +02:00
|
|
|
* Copyright (C) 2011 Artem Pavlenko
|
2006-03-10 13:08:55 +01:00
|
|
|
*
|
2006-03-31 12:32:02 +02:00
|
|
|
* 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,
|
2006-03-10 13:08:55 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2006-03-31 12:32:02 +02:00
|
|
|
* 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
|
2006-03-10 13:08:55 +01:00
|
|
|
*
|
2006-03-31 12:32:02 +02:00
|
|
|
*****************************************************************************/
|
2006-03-10 13:08:55 +01:00
|
|
|
|
2007-07-02 15:39:08 +02:00
|
|
|
//mapnik
|
2012-04-08 02:20:56 +02:00
|
|
|
#include <mapnik/debug.hpp>
|
2006-10-04 13:22:18 +02:00
|
|
|
#include <mapnik/text_symbolizer.hpp>
|
2012-02-12 02:47:26 +01:00
|
|
|
#include <mapnik/enumeration.hpp>
|
2013-11-28 07:50:15 +01:00
|
|
|
#include <mapnik/formatting/text.hpp>
|
2012-02-12 02:47:26 +01:00
|
|
|
|
2010-06-18 17:39:07 +02:00
|
|
|
namespace mapnik
|
|
|
|
{
|
|
|
|
|
2013-03-09 05:32:39 +01:00
|
|
|
static const char * halo_rasterizer_strings[] = {
|
|
|
|
"full",
|
|
|
|
"fast",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( halo_rasterizer_e, halo_rasterizer_strings )
|
|
|
|
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
static const char * label_placement_strings[] = {
|
|
|
|
"point",
|
|
|
|
"line",
|
|
|
|
"vertex",
|
|
|
|
"interior",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( label_placement_e, label_placement_strings )
|
|
|
|
|
|
|
|
static const char * vertical_alignment_strings[] = {
|
|
|
|
"top",
|
|
|
|
"middle",
|
|
|
|
"bottom",
|
|
|
|
"auto",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( vertical_alignment_e, vertical_alignment_strings )
|
|
|
|
|
|
|
|
static const char * horizontal_alignment_strings[] = {
|
|
|
|
"left",
|
|
|
|
"middle",
|
|
|
|
"right",
|
|
|
|
"auto",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( horizontal_alignment_e, horizontal_alignment_strings )
|
|
|
|
|
|
|
|
static const char * justify_alignment_strings[] = {
|
|
|
|
"left",
|
|
|
|
"center", // not 'middle' in order to match CSS
|
|
|
|
"right",
|
|
|
|
"auto",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( justify_alignment_e, justify_alignment_strings )
|
|
|
|
|
|
|
|
static const char * text_transform_strings[] = {
|
|
|
|
"none",
|
|
|
|
"uppercase",
|
|
|
|
"lowercase",
|
|
|
|
"capitalize",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_ENUM( text_transform_e, text_transform_strings )
|
|
|
|
|
|
|
|
#if 0
|
2012-01-22 17:27:52 +01:00
|
|
|
text_symbolizer::text_symbolizer(text_placements_ptr placements)
|
2012-02-02 02:53:35 +01:00
|
|
|
: symbolizer_base(),
|
2013-03-09 05:32:39 +01:00
|
|
|
placement_options_(placements),
|
|
|
|
halo_rasterizer_(HALO_RASTERIZER_FULL)
|
2012-01-22 17:27:52 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2009-07-20 17:30:19 +02:00
|
|
|
|
2011-02-28 14:17:46 +01:00
|
|
|
text_symbolizer::text_symbolizer(expression_ptr name, std::string const& face_name,
|
2013-11-28 07:50:15 +01:00
|
|
|
float size, color const& fill,
|
2011-02-28 14:17:46 +01:00
|
|
|
text_placements_ptr placements)
|
2010-08-10 14:19:19 +02:00
|
|
|
: symbolizer_base(),
|
2013-03-09 05:32:39 +01:00
|
|
|
placement_options_(placements),
|
|
|
|
halo_rasterizer_(HALO_RASTERIZER_FULL)
|
2011-02-28 14:17:46 +01:00
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
set_name(name);
|
|
|
|
set_face_name(face_name);
|
2011-02-28 14:17:46 +01:00
|
|
|
set_text_size(size);
|
2012-01-22 17:27:52 +01:00
|
|
|
set_fill(fill);
|
2011-02-28 14:17:46 +01:00
|
|
|
}
|
2009-12-16 21:02:06 +01:00
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
text_symbolizer::text_symbolizer(expression_ptr name, float size, color const& fill,
|
2011-02-28 14:17:46 +01:00
|
|
|
text_placements_ptr placements)
|
2010-08-10 14:19:19 +02:00
|
|
|
: symbolizer_base(),
|
2013-03-09 05:32:39 +01:00
|
|
|
placement_options_(placements),
|
|
|
|
halo_rasterizer_(HALO_RASTERIZER_FULL)
|
2011-02-28 14:17:46 +01:00
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
set_name(name);
|
2011-02-28 14:17:46 +01:00
|
|
|
set_text_size(size);
|
2012-01-22 17:27:52 +01:00
|
|
|
set_fill(fill);
|
2011-02-28 14:17:46 +01:00
|
|
|
}
|
2009-12-16 21:02:06 +01:00
|
|
|
|
|
|
|
text_symbolizer::text_symbolizer(text_symbolizer const& rhs)
|
2010-08-10 14:19:19 +02:00
|
|
|
: symbolizer_base(rhs),
|
2013-03-09 05:32:39 +01:00
|
|
|
placement_options_(rhs.placement_options_),
|
|
|
|
halo_rasterizer_(rhs.halo_rasterizer_)
|
|
|
|
/*TODO: Copy options! */
|
2012-01-22 17:27:52 +01:00
|
|
|
{
|
|
|
|
}
|
2009-12-16 21:02:06 +01:00
|
|
|
|
|
|
|
text_symbolizer& text_symbolizer::operator=(text_symbolizer const& other)
|
|
|
|
{
|
|
|
|
if (this == &other)
|
2010-06-02 13:03:30 +02:00
|
|
|
return *this;
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_ = other.placement_options_; /*TODO: Copy options? */
|
2013-03-09 05:32:39 +01:00
|
|
|
halo_rasterizer_ = other.halo_rasterizer_;
|
2009-12-16 21:02:06 +01:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-02-03 19:36:01 +01:00
|
|
|
expression_ptr text_symbolizer::get_name() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-05-27 01:14:26 +02:00
|
|
|
formatting::text_node *node = dynamic_cast<formatting::text_node *>(placement_options_->defaults.format_tree().get());
|
|
|
|
if (!node) return expression_ptr();
|
|
|
|
return node->get_text();
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-02-03 19:36:01 +01:00
|
|
|
void text_symbolizer::set_name(expression_ptr name)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.set_old_style_expression(name);
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-05-27 12:19:39 +02:00
|
|
|
expression_ptr text_symbolizer::get_orientation() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.orientation;
|
2010-05-27 12:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_orientation(expression_ptr orientation)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.orientation = orientation;
|
2010-05-27 12:19:39 +02:00
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
std::string const& text_symbolizer::get_face_name() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.face_name;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_face_name(std::string face_name)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.face_name = face_name;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_fontset(font_set const& fontset)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.fontset = fontset;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-14 23:17:45 +02:00
|
|
|
boost::optional<font_set> const& text_symbolizer::get_fontset() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.fontset;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_text_ratio() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.text_ratio;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_text_ratio(double ratio)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.text_ratio = ratio;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_wrap_width() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.wrap_width;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_wrap_width(double width)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.wrap_width = width;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_wrap_before() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.wrap_before;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_before(bool wrap_before)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.wrap_before = wrap_before;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char text_symbolizer::get_wrap_char() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.wrap_char;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string text_symbolizer::get_wrap_char_string() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return std::string(1, placement_options_->defaults.format.wrap_char);
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_char(unsigned char character)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.wrap_char = character;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_char_from_string(std::string const& character)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.wrap_char = (character)[0];
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-09-18 21:10:18 +02:00
|
|
|
text_transform_e text_symbolizer::get_text_transform() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.text_transform;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-09-18 21:10:18 +02:00
|
|
|
void text_symbolizer::set_text_transform(text_transform_e convert)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.text_transform = convert;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_line_spacing() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.line_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_line_spacing(double spacing)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.line_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_character_spacing() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.character_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_character_spacing(double spacing)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.character_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_label_spacing() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.label_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_label_spacing(double spacing)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.label_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
double text_symbolizer::get_label_position_tolerance() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.label_position_tolerance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
void text_symbolizer::set_label_position_tolerance(double tolerance)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.label_position_tolerance = tolerance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_force_odd_labels() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.force_odd_labels;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_force_odd_labels(bool force)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.force_odd_labels = force;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
double text_symbolizer::get_max_char_angle_delta() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.max_char_angle_delta;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_max_char_angle_delta(double angle)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.max_char_angle_delta = angle;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
void text_symbolizer::set_text_size(double size)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.text_size = size;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 02:15:58 +02:00
|
|
|
double text_symbolizer::get_text_size() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.text_size;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_fill(color const& fill)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.fill = fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
color const& text_symbolizer::get_fill() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_halo_fill(color const& fill)
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.halo_fill = fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
color const& text_symbolizer::get_halo_fill() const
|
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.halo_fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-06-16 17:15:13 +02:00
|
|
|
void text_symbolizer::set_halo_radius(double radius)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.halo_radius = radius;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-06-16 17:15:13 +02:00
|
|
|
double text_symbolizer::get_halo_radius() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.halo_radius;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2013-03-09 05:32:39 +01:00
|
|
|
void text_symbolizer::set_halo_rasterizer(halo_rasterizer_e rasterizer_p)
|
|
|
|
{
|
|
|
|
halo_rasterizer_ = rasterizer_p;
|
|
|
|
}
|
|
|
|
|
|
|
|
halo_rasterizer_e text_symbolizer::get_halo_rasterizer() const
|
|
|
|
{
|
|
|
|
return halo_rasterizer_;
|
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
void text_symbolizer::set_label_placement(label_placement_e label_p)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.label_placement = label_p;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
label_placement_e text_symbolizer::get_label_placement() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.label_placement;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-01-22 17:27:52 +01:00
|
|
|
void text_symbolizer::set_displacement(double x, double y)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.displacement = std::make_pair(x,y);
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
void text_symbolizer::set_displacement(position const& p)
|
2011-10-20 08:58:56 +02:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.displacement = p;
|
2011-10-20 08:58:56 +02:00
|
|
|
}
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
position const& text_symbolizer::get_displacement() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.displacement;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_avoid_edges() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.avoid_edges;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_avoid_edges(bool avoid)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.avoid_edges = avoid;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2012-06-25 16:00:53 +02:00
|
|
|
bool text_symbolizer::largest_bbox_only() const
|
|
|
|
{
|
|
|
|
return placement_options_->defaults.largest_bbox_only;
|
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_largest_bbox_only(bool v)
|
|
|
|
{
|
|
|
|
placement_options_->defaults.largest_bbox_only = v;
|
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
double text_symbolizer::get_minimum_distance() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.minimum_distance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_distance(double distance)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.minimum_distance = distance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-11-03 14:18:56 +01:00
|
|
|
double text_symbolizer::get_minimum_padding() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.minimum_padding;
|
2010-11-03 14:18:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_padding(double distance)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.minimum_padding = distance;
|
2010-11-03 14:18:56 +01:00
|
|
|
}
|
2011-09-04 19:33:48 +02:00
|
|
|
|
|
|
|
double text_symbolizer::get_minimum_path_length() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.minimum_path_length;
|
2011-09-04 19:33:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_path_length(double size)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.minimum_path_length = size;
|
2011-09-04 19:33:48 +02:00
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
void text_symbolizer::set_allow_overlap(bool overlap)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.allow_overlap = overlap;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_allow_overlap() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.allow_overlap;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-06-15 14:27:42 +02:00
|
|
|
void text_symbolizer::set_text_opacity(double text_opacity)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
placement_options_->defaults.format.text_opacity = text_opacity;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2010-06-15 14:27:42 +02:00
|
|
|
double text_symbolizer::get_text_opacity() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
return placement_options_->defaults.format.text_opacity;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2011-05-30 00:33:41 +02:00
|
|
|
void text_symbolizer::set_vertical_alignment(vertical_alignment_e valign)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.valign = valign;
|
2011-05-30 00:33:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
vertical_alignment_e text_symbolizer::get_vertical_alignment() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.valign;
|
2011-05-30 00:33:41 +02:00
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
void text_symbolizer::set_horizontal_alignment(horizontal_alignment_e halign)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.halign = halign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
horizontal_alignment_e text_symbolizer::get_horizontal_alignment() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.halign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_justify_alignment(justify_alignment_e jalign)
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
placement_options_->defaults.jalign = jalign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
justify_alignment_e text_symbolizer::get_justify_alignment() const
|
|
|
|
{
|
2012-02-16 00:17:22 +01:00
|
|
|
return placement_options_->defaults.jalign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
2011-02-28 14:17:46 +01:00
|
|
|
|
|
|
|
text_placements_ptr text_symbolizer::get_placement_options() const
|
|
|
|
{
|
|
|
|
return placement_options_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_placement_options(text_placements_ptr placement_options)
|
|
|
|
{
|
|
|
|
placement_options_ = placement_options;
|
|
|
|
}
|
|
|
|
|
2013-11-28 07:50:15 +01:00
|
|
|
#endif
|
2006-03-10 13:08:55 +01:00
|
|
|
}
|