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
|
|
|
|
|
|
|
//$Id$
|
|
|
|
|
2007-07-02 15:39:08 +02:00
|
|
|
//mapnik
|
2006-10-04 13:22:18 +02:00
|
|
|
#include <mapnik/text_symbolizer.hpp>
|
2007-10-08 19:42:41 +02:00
|
|
|
// boost
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2012-01-22 17:27:52 +01:00
|
|
|
#include <mapnik/text_processing.hpp>
|
2006-03-10 13:08:55 +01:00
|
|
|
|
2010-06-18 17:39:07 +02:00
|
|
|
namespace mapnik
|
|
|
|
{
|
|
|
|
|
2007-09-25 20:47:12 +02:00
|
|
|
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",
|
2011-02-01 09:13:08 +01:00
|
|
|
"interior",
|
2007-09-25 20:47:12 +02:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2008-06-29 12:58:48 +02:00
|
|
|
|
2011-04-01 08:24:57 +02:00
|
|
|
IMPLEMENT_ENUM( label_placement_e, label_placement_strings )
|
2007-09-25 20:47:12 +02:00
|
|
|
|
2009-03-30 22:47:26 +02:00
|
|
|
static const char * vertical_alignment_strings[] = {
|
|
|
|
"top",
|
|
|
|
"middle",
|
|
|
|
"bottom",
|
2011-02-28 14:17:46 +01:00
|
|
|
"auto",
|
2009-03-30 22:47:26 +02:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-01 08:24:57 +02:00
|
|
|
IMPLEMENT_ENUM( vertical_alignment_e, vertical_alignment_strings )
|
2009-03-30 22:47:26 +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
|
|
|
static const char * horizontal_alignment_strings[] = {
|
|
|
|
"left",
|
|
|
|
"middle",
|
|
|
|
"right",
|
2011-02-28 14:17:46 +01:00
|
|
|
"auto",
|
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
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-01 08:24:57 +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",
|
2011-09-12 22:15:13 +02:00
|
|
|
"center",
|
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
|
|
|
"right",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-01 08:24:57 +02:00
|
|
|
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
|
|
|
|
2010-09-18 21:10:18 +02:00
|
|
|
static const char * text_transform_strings[] = {
|
2009-07-20 17:30:19 +02:00
|
|
|
"none",
|
2010-09-18 21:10:18 +02:00
|
|
|
"uppercase",
|
|
|
|
"lowercase",
|
2011-02-21 21:43:26 +01:00
|
|
|
"capitalize",
|
2009-07-20 17:30:19 +02:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-01 08:24:57 +02:00
|
|
|
IMPLEMENT_ENUM( text_transform_e, text_transform_strings )
|
2010-06-18 17:39:07 +02:00
|
|
|
|
2009-07-20 17:30:19 +02:00
|
|
|
|
2012-01-22 17:27:52 +01:00
|
|
|
text_symbolizer::text_symbolizer(text_placements_ptr placements)
|
|
|
|
: symbolizer_base(),
|
|
|
|
placement_options_(placements)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
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,
|
2011-10-27 14:24:50 +02: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(),
|
2011-02-28 14:17:46 +01:00
|
|
|
placement_options_(placements)
|
|
|
|
{
|
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
|
|
|
|
2011-10-27 14:24:50 +02: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(),
|
2011-02-28 14:17:46 +01:00
|
|
|
placement_options_(placements)
|
|
|
|
{
|
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),
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_(rhs.placement_options_) /*TODO: Copy options! */
|
|
|
|
{
|
|
|
|
}
|
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? */
|
|
|
|
std::clog << "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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return expression_ptr();
|
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-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.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-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.orientation;
|
2010-05-27 12:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_orientation(expression_ptr orientation)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.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
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.face_name;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_face_name(std::string face_name)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.face_name = face_name;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_fontset(font_set const& fontset)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.fontset = fontset;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
font_set const& text_symbolizer::get_fontset() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.fontset;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_text_ratio() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.text_ratio;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_text_ratio(unsigned ratio)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.text_ratio = ratio;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_wrap_width() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.wrap_width;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_width(unsigned width)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.wrap_width = width;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_wrap_before() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.wrap_before;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_before(bool wrap_before)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.wrap_before = wrap_before;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char text_symbolizer::get_wrap_char() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.wrap_char;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string text_symbolizer::get_wrap_char_string() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return std::string(1, placement_options_->properties.processor.defaults.wrap_char);
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_char(unsigned char character)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.wrap_char = character;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_wrap_char_from_string(std::string const& character)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.text_transform = convert;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_line_spacing() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.line_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_line_spacing(unsigned spacing)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.line_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_character_spacing() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.character_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_character_spacing(unsigned spacing)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.character_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_label_spacing() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.label_spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_label_spacing(unsigned spacing)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.label_spacing = spacing;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned text_symbolizer::get_label_position_tolerance() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.label_position_tolerance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_label_position_tolerance(unsigned tolerance)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.label_position_tolerance = tolerance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_force_odd_labels() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.force_odd_labels;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_force_odd_labels(bool force)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.force_odd_labels = force;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
double text_symbolizer::get_max_char_angle_delta() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.max_char_angle_delta;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_max_char_angle_delta(double angle)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.max_char_angle_delta = angle;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2011-10-27 14:24:50 +02:00
|
|
|
void text_symbolizer::set_text_size(float size)
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.text_size = size;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2011-10-27 14:24:50 +02:00
|
|
|
float text_symbolizer::get_text_size() const
|
2009-12-16 21:02:06 +01:00
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.text_size;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_fill(color const& fill)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.fill = fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
color const& text_symbolizer::get_fill() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_halo_fill(color const& fill)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.halo_fill = fill;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
color const& text_symbolizer::get_halo_fill() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.halo_radius;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_label_placement(label_placement_e label_p)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.label_placement = label_p;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
label_placement_e text_symbolizer::get_label_placement() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.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
|
|
|
{
|
2012-01-29 17:33:43 +01:00
|
|
|
placement_options_->properties.displacement = std::make_pair(x,y);
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
2011-10-20 08:58:56 +02:00
|
|
|
void text_symbolizer::set_displacement(position const& p)
|
|
|
|
{
|
2012-01-22 19:17:59 +01:00
|
|
|
placement_options_->properties.displacement = p;
|
2011-10-20 08:58:56 +02:00
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
position const& text_symbolizer::get_displacement() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.displacement;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_avoid_edges() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.avoid_edges;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_avoid_edges(bool avoid)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.avoid_edges = avoid;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
double text_symbolizer::get_minimum_distance() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.minimum_distance;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_distance(double distance)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.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-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.minimum_padding;
|
2010-11-03 14:18:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_padding(double distance)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.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-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.minimum_path_length;
|
2011-09-04 19:33:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_minimum_path_length(double size)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.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-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.allow_overlap = overlap;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool text_symbolizer::get_allow_overlap() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.processor.defaults.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
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.processor.defaults.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-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.valign = valign;
|
2011-05-30 00:33:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
vertical_alignment_e text_symbolizer::get_vertical_alignment() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.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-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.halign = halign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
horizontal_alignment_e text_symbolizer::get_horizontal_alignment() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.halign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void text_symbolizer::set_justify_alignment(justify_alignment_e jalign)
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
placement_options_->properties.jalign = jalign;
|
2009-12-16 21:02:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
justify_alignment_e text_symbolizer::get_justify_alignment() const
|
|
|
|
{
|
2012-01-22 17:27:52 +01:00
|
|
|
return placement_options_->properties.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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-10 13:08:55 +01:00
|
|
|
}
|