mapnik/src/text_symbolizer.cpp

532 lines
12 KiB
C++
Raw Normal View History

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-31 12:32:02 +02:00
* Copyright (C) 2006 Artem Pavlenko
*
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,
* 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-31 12:32:02 +02:00
*****************************************************************************/
//$Id$
//mapnik
#include <mapnik/text_symbolizer.hpp>
2007-10-08 19:42:41 +02:00
// boost
#include <boost/scoped_ptr.hpp>
namespace mapnik
{
static const char * label_placement_strings[] = {
"point",
"line",
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
"vertex",
"interior",
""
};
IMPLEMENT_ENUM( label_placement_e, label_placement_strings );
static const char * vertical_alignment_strings[] = {
"top",
"middle",
"bottom",
""
};
IMPLEMENT_ENUM( vertical_alignment_e, vertical_alignment_strings );
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
static const char * horizontal_alignment_strings[] = {
"left",
"middle",
"right",
""
};
2010-06-19 07:27:11 +02:00
IMPLEMENT_ENUM( horizontal_alignment_e, horizontal_alignment_strings );
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
static const char * justify_alignment_strings[] = {
"left",
"middle",
"right",
""
};
IMPLEMENT_ENUM( justify_alignment_e, justify_alignment_strings );
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
static const char * text_transform_strings[] = {
"none",
"uppercase",
"lowercase",
""
};
IMPLEMENT_ENUM( text_transform_e, text_transform_strings );
2009-12-16 21:02:06 +01:00
text_symbolizer::text_symbolizer(expression_ptr name, std::string const& face_name, unsigned size, color const& fill)
2010-08-10 14:19:19 +02:00
: symbolizer_base(),
name_(name),
2009-12-16 21:02:06 +01:00
face_name_(face_name),
//fontset_(default_fontset),
size_(size),
text_ratio_(0),
wrap_width_(0),
wrap_char_(' '),
text_transform_(NONE),
2009-12-16 21:02:06 +01:00
line_spacing_(0),
character_spacing_(0),
label_spacing_(0),
label_position_tolerance_(0),
force_odd_labels_(false),
2010-09-24 14:55:14 +02:00
max_char_angle_delta_(25.0 * M_PI/180.0),
2009-12-16 21:02:06 +01:00
fill_(fill),
halo_fill_(color(255,255,255)),
halo_radius_(0),
label_p_(POINT_PLACEMENT),
valign_(MIDDLE),
2009-12-16 21:02:06 +01:00
anchor_(0.0,0.5),
displacement_(0.0,0.0),
avoid_edges_(false),
minimum_distance_(0.0),
minimum_padding_(0.0),
2009-12-16 21:02:06 +01:00
overlap_(false),
text_opacity_(1.0),
2009-12-16 21:02:06 +01:00
wrap_before_(false),
halign_(H_MIDDLE),
jalign_(J_MIDDLE) {}
text_symbolizer::text_symbolizer(expression_ptr name, unsigned size, color const& fill)
2010-08-10 14:19:19 +02:00
: symbolizer_base(),
name_(name),
2009-12-16 21:02:06 +01:00
//face_name_(""),
//fontset_(default_fontset),
size_(size),
text_ratio_(0),
wrap_width_(0),
wrap_char_(' '),
text_transform_(NONE),
2009-12-16 21:02:06 +01:00
line_spacing_(0),
character_spacing_(0),
label_spacing_(0),
label_position_tolerance_(0),
force_odd_labels_(false),
2010-09-24 14:55:14 +02:00
max_char_angle_delta_(25.0 * M_PI/180.0),
2009-12-16 21:02:06 +01:00
fill_(fill),
halo_fill_(color(255,255,255)),
halo_radius_(0),
label_p_(POINT_PLACEMENT),
valign_(MIDDLE),
2009-12-16 21:02:06 +01:00
anchor_(0.0,0.5),
displacement_(0.0,0.0),
avoid_edges_(false),
minimum_distance_(0.0),
minimum_padding_(0.0),
2009-12-16 21:02:06 +01:00
overlap_(false),
text_opacity_(1.0),
2009-12-16 21:02:06 +01:00
wrap_before_(false),
halign_(H_MIDDLE),
jalign_(J_MIDDLE) {}
text_symbolizer::text_symbolizer(text_symbolizer const& rhs)
2010-08-10 14:19:19 +02:00
: symbolizer_base(rhs),
name_(rhs.name_),
orientation_(rhs.orientation_),
2009-12-16 21:02:06 +01:00
face_name_(rhs.face_name_),
fontset_(rhs.fontset_),
size_(rhs.size_),
text_ratio_(rhs.text_ratio_),
wrap_width_(rhs.wrap_width_),
wrap_char_(rhs.wrap_char_),
text_transform_(rhs.text_transform_),
2009-12-16 21:02:06 +01:00
line_spacing_(rhs.line_spacing_),
character_spacing_(rhs.character_spacing_),
label_spacing_(rhs.label_spacing_),
label_position_tolerance_(rhs.label_position_tolerance_),
force_odd_labels_(rhs.force_odd_labels_),
max_char_angle_delta_(rhs.max_char_angle_delta_),
fill_(rhs.fill_),
halo_fill_(rhs.halo_fill_),
halo_radius_(rhs.halo_radius_),
label_p_(rhs.label_p_),
valign_(rhs.valign_),
anchor_(rhs.anchor_),
displacement_(rhs.displacement_),
avoid_edges_(rhs.avoid_edges_),
minimum_distance_(rhs.minimum_distance_),
minimum_padding_(rhs.minimum_padding_),
2009-12-16 21:02:06 +01:00
overlap_(rhs.overlap_),
text_opacity_(rhs.text_opacity_),
2009-12-16 21:02:06 +01:00
wrap_before_(rhs.wrap_before_),
halign_(rhs.halign_),
jalign_(rhs.jalign_) {}
text_symbolizer& text_symbolizer::operator=(text_symbolizer const& other)
{
if (this == &other)
2010-06-02 13:03:30 +02:00
return *this;
2009-12-16 21:02:06 +01:00
name_ = other.name_;
orientation_ = other.orientation_;
2009-12-16 21:02:06 +01:00
face_name_ = other.face_name_;
fontset_ = other.fontset_;
size_ = other.size_;
text_ratio_ = other.text_ratio_;
wrap_width_ = other.wrap_width_;
wrap_char_ = other.wrap_char_;
text_transform_ = other.text_transform_;
2009-12-16 21:02:06 +01:00
line_spacing_ = other.line_spacing_;
character_spacing_ = other.character_spacing_;
label_spacing_ = other.label_spacing_;
label_position_tolerance_ = other.label_position_tolerance_;
force_odd_labels_ = other.force_odd_labels_;
max_char_angle_delta_ = other.max_char_angle_delta_;
fill_ = other.fill_;
halo_fill_ = other.halo_fill_;
halo_radius_ = other.halo_radius_;
label_p_ = other.label_p_;
valign_ = other.valign_;
anchor_ = other.anchor_;
displacement_ = other.displacement_;
avoid_edges_ = other.avoid_edges_;
minimum_distance_ = other.minimum_distance_;
minimum_padding_ = other.minimum_padding_;
2009-12-16 21:02:06 +01:00
overlap_ = other.overlap_;
text_opacity_ = other.text_opacity_;
2009-12-16 21:02:06 +01:00
wrap_before_ = other.wrap_before_;
halign_ = other.halign_;
jalign_ = other.jalign_;
2010-08-10 14:19:19 +02:00
std::cout << "TODO: Metawriter (text_symbolizer::operator=)\n";
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
{
return name_;
}
2010-02-03 19:36:01 +01:00
void text_symbolizer::set_name(expression_ptr name)
2009-12-16 21:02:06 +01:00
{
name_ = name;
}
expression_ptr text_symbolizer::get_orientation() const
{
return orientation_;
}
void text_symbolizer::set_orientation(expression_ptr orientation)
{
orientation_ = orientation;
}
2009-12-16 21:02:06 +01:00
std::string const& text_symbolizer::get_face_name() const
{
return face_name_;
}
void text_symbolizer::set_face_name(std::string face_name)
{
face_name_ = face_name;
}
void text_symbolizer::set_fontset(font_set const& fontset)
{
fontset_ = fontset;
}
font_set const& text_symbolizer::get_fontset() const
{
return fontset_;
}
unsigned text_symbolizer::get_text_ratio() const
{
return text_ratio_;
}
void text_symbolizer::set_text_ratio(unsigned ratio)
{
text_ratio_ = ratio;
}
unsigned text_symbolizer::get_wrap_width() const
{
return wrap_width_;
}
void text_symbolizer::set_wrap_width(unsigned width)
{
wrap_width_ = width;
}
bool text_symbolizer::get_wrap_before() const
{
return wrap_before_;
}
void text_symbolizer::set_wrap_before(bool wrap_before)
{
wrap_before_ = wrap_before;
}
unsigned char text_symbolizer::get_wrap_char() const
{
return wrap_char_;
}
std::string text_symbolizer::get_wrap_char_string() const
{
return std::string(1, wrap_char_);
}
void text_symbolizer::set_wrap_char(unsigned char character)
{
wrap_char_ = character;
}
void text_symbolizer::set_wrap_char_from_string(std::string const& character)
{
wrap_char_ = (character)[0];
}
text_transform_e text_symbolizer::get_text_transform() const
2009-12-16 21:02:06 +01:00
{
return text_transform_;
2009-12-16 21:02:06 +01:00
}
void text_symbolizer::set_text_transform(text_transform_e convert)
2009-12-16 21:02:06 +01:00
{
text_transform_ = convert;
2009-12-16 21:02:06 +01:00
}
unsigned text_symbolizer::get_line_spacing() const
{
return line_spacing_;
}
void text_symbolizer::set_line_spacing(unsigned spacing)
{
line_spacing_ = spacing;
}
unsigned text_symbolizer::get_character_spacing() const
{
return character_spacing_;
}
void text_symbolizer::set_character_spacing(unsigned spacing)
{
character_spacing_ = spacing;
}
unsigned text_symbolizer::get_label_spacing() const
{
return label_spacing_;
}
void text_symbolizer::set_label_spacing(unsigned spacing)
{
label_spacing_ = spacing;
}
unsigned text_symbolizer::get_label_position_tolerance() const
{
return label_position_tolerance_;
}
void text_symbolizer::set_label_position_tolerance(unsigned tolerance)
{
label_position_tolerance_ = tolerance;
}
bool text_symbolizer::get_force_odd_labels() const
{
return force_odd_labels_;
}
void text_symbolizer::set_force_odd_labels(bool force)
{
force_odd_labels_ = force;
}
double text_symbolizer::get_max_char_angle_delta() const
{
return max_char_angle_delta_;
}
void text_symbolizer::set_max_char_angle_delta(double angle)
{
max_char_angle_delta_ = angle;
}
void text_symbolizer::set_text_size(unsigned size)
{
size_ = size;
}
unsigned text_symbolizer::get_text_size() const
{
return size_;
}
void text_symbolizer::set_fill(color const& fill)
{
fill_ = fill;
}
color const& text_symbolizer::get_fill() const
{
return fill_;
}
void text_symbolizer::set_halo_fill(color const& fill)
{
halo_fill_ = fill;
}
color const& text_symbolizer::get_halo_fill() const
{
return halo_fill_;
}
void text_symbolizer::set_halo_radius(double radius)
2009-12-16 21:02:06 +01:00
{
halo_radius_ = radius;
}
double text_symbolizer::get_halo_radius() const
2009-12-16 21:02:06 +01:00
{
return halo_radius_;
}
void text_symbolizer::set_label_placement(label_placement_e label_p)
{
label_p_ = label_p;
}
label_placement_e text_symbolizer::get_label_placement() const
{
return label_p_;
}
void text_symbolizer::set_vertical_alignment(vertical_alignment_e valign)
{
valign_ = valign;
}
vertical_alignment_e text_symbolizer::get_vertical_alignment() const
{
return valign_;
}
void text_symbolizer::set_anchor(double x, double y)
{
anchor_ = boost::make_tuple(x,y);
}
position const& text_symbolizer::get_anchor() const
{
return anchor_;
}
void text_symbolizer::set_displacement(double x, double y)
{
displacement_ = boost::make_tuple(x,y);
}
position const& text_symbolizer::get_displacement() const
{
return displacement_;
}
bool text_symbolizer::get_avoid_edges() const
{
return avoid_edges_;
}
void text_symbolizer::set_avoid_edges(bool avoid)
{
avoid_edges_ = avoid;
}
double text_symbolizer::get_minimum_distance() const
{
return minimum_distance_;
}
void text_symbolizer::set_minimum_distance(double distance)
{
minimum_distance_ = distance;
}
double text_symbolizer::get_minimum_padding() const
{
return minimum_padding_;
}
void text_symbolizer::set_minimum_padding(double distance)
{
minimum_padding_ = distance;
}
2009-12-16 21:02:06 +01:00
void text_symbolizer::set_allow_overlap(bool overlap)
{
overlap_ = overlap;
}
bool text_symbolizer::get_allow_overlap() const
{
return overlap_;
}
void text_symbolizer::set_text_opacity(double text_opacity)
2009-12-16 21:02:06 +01:00
{
text_opacity_ = text_opacity;
2009-12-16 21:02:06 +01:00
}
double text_symbolizer::get_text_opacity() const
2009-12-16 21:02:06 +01:00
{
return text_opacity_;
2009-12-16 21:02:06 +01:00
}
void text_symbolizer::set_horizontal_alignment(horizontal_alignment_e halign)
{
halign_ = halign;
}
horizontal_alignment_e text_symbolizer::get_horizontal_alignment() const
{
return halign_;
}
void text_symbolizer::set_justify_alignment(justify_alignment_e jalign)
{
jalign_ = jalign;
}
justify_alignment_e text_symbolizer::get_justify_alignment() const
{
return jalign_;
}
}