Rename properties=>defauls, default_format=>format.
This commit is contained in:
parent
4602338e0c
commit
819ee98041
6 changed files with 90 additions and 89 deletions
|
@ -129,7 +129,7 @@ public:
|
|||
virtual ~text_placements() {}
|
||||
|
||||
/** List of all properties used as the default for the subclasses. */
|
||||
text_symbolizer_properties properties;
|
||||
text_symbolizer_properties defaults;
|
||||
};
|
||||
|
||||
/** Pointer to object of class text_placements */
|
||||
|
|
|
@ -162,7 +162,7 @@ struct text_symbolizer_properties
|
|||
unsigned text_ratio;
|
||||
unsigned wrap_width;
|
||||
/** Default values for char_properties. */
|
||||
char_properties default_format;
|
||||
char_properties format;
|
||||
private:
|
||||
/** A tree of formatting::nodes which contain text and formatting information. */
|
||||
formatting::node_ptr tree_;
|
||||
|
|
|
@ -1281,10 +1281,10 @@ void map_parser::parse_text_symbolizer( rule & rule, ptree const & sym )
|
|||
placement_finder = text_placements_ptr(new text_placements_dummy());
|
||||
}
|
||||
|
||||
placement_finder->properties.from_xml(sym, fontsets_);
|
||||
placement_finder->defaults.from_xml(sym, fontsets_);
|
||||
if (strict_ &&
|
||||
!placement_finder->properties.default_format.fontset.size())
|
||||
ensure_font_face(placement_finder->properties.default_format.face_name);
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
ensure_font_face(placement_finder->defaults.format.face_name);
|
||||
if (list) {
|
||||
ptree::const_iterator symIter = sym.begin();
|
||||
ptree::const_iterator endSym = sym.end();
|
||||
|
@ -1299,8 +1299,8 @@ void map_parser::parse_text_symbolizer( rule & rule, ptree const & sym )
|
|||
text_symbolizer_properties & p = list->add();
|
||||
p.from_xml(symIter->second, fontsets_);
|
||||
if (strict_ &&
|
||||
!p.default_format.fontset.size())
|
||||
ensure_font_face(p.default_format.face_name);
|
||||
!p.format.fontset.size())
|
||||
ensure_font_face(p.format.face_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1354,10 +1354,10 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
|
|||
placement_finder = text_placements_ptr(new text_placements_dummy());
|
||||
}
|
||||
|
||||
placement_finder->properties.from_xml(sym, fontsets_);
|
||||
placement_finder->defaults.from_xml(sym, fontsets_);
|
||||
if (strict_ &&
|
||||
!placement_finder->properties.default_format.fontset.size())
|
||||
ensure_font_face(placement_finder->properties.default_format.face_name);
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
ensure_font_face(placement_finder->defaults.format.face_name);
|
||||
if (list) {
|
||||
ptree::const_iterator symIter = sym.begin();
|
||||
ptree::const_iterator endSym = sym.end();
|
||||
|
@ -1372,8 +1372,8 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
|
|||
text_symbolizer_properties & p = list->add();
|
||||
p.from_xml(symIter->second, fontsets_);
|
||||
if (strict_&&
|
||||
!placement_finder->properties.default_format.fontset.size())
|
||||
ensure_font_face(p.default_format.face_name);
|
||||
!p.format.fontset.size())
|
||||
ensure_font_face(p.format.face_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ private:
|
|||
void add_font_attributes(ptree & node, const text_symbolizer & sym)
|
||||
{
|
||||
text_placements_ptr p = sym.get_placement_options();
|
||||
p->properties.to_xml(node, explicit_defaults_);
|
||||
p->defaults.to_xml(node, explicit_defaults_);
|
||||
/* Known types:
|
||||
- text_placements_dummy: no handling required
|
||||
- text_placements_simple: positions string
|
||||
|
@ -366,13 +366,14 @@ private:
|
|||
text_placements_simple *simple = dynamic_cast<text_placements_simple *>(p.get());
|
||||
text_placements_list *list = dynamic_cast<text_placements_list *>(p.get());
|
||||
if (simple) {
|
||||
set_attr(node, "placment-type", "simple");
|
||||
set_attr(node, "placement-type", "simple");
|
||||
set_attr(node, "placements", simple->get_positions());
|
||||
}
|
||||
if (list) {
|
||||
set_attr(node, "placment-type", "list");
|
||||
set_attr(node, "placement-type", "list");
|
||||
unsigned i;
|
||||
text_symbolizer_properties *dfl = &(list->properties);
|
||||
//dfl = last properties passed as default so only attributes that change are actually written
|
||||
text_symbolizer_properties *dfl = &(list->defaults);
|
||||
for (i=0; i < list->size(); i++) {
|
||||
ptree &placement_node = node.push_back(ptree::value_type("Placement", ptree()))->second;
|
||||
list->get(i).to_xml(placement_node, explicit_defaults_, *dfl);
|
||||
|
|
|
@ -68,7 +68,7 @@ void text_symbolizer_properties::process(processed_text &output, Feature const&
|
|||
{
|
||||
output.clear();
|
||||
if (tree_) {
|
||||
tree_->apply(default_format, feature, output);
|
||||
tree_->apply(format, feature, output);
|
||||
} else {
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::cerr << "Warning: text_symbolizer_properties can't produce text: No formatting tree!\n";
|
||||
|
@ -130,7 +130,7 @@ void text_symbolizer_properties::from_xml(boost::property_tree::ptree const &sym
|
|||
set_old_style_expression(parse_expression(*name_, "utf8"));
|
||||
}
|
||||
|
||||
default_format.from_xml(sym, fontsets);
|
||||
format.from_xml(sym, fontsets);
|
||||
formatting::node_ptr n(formatting::node::from_xml(sym));
|
||||
if (n) set_format_tree(n);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void text_symbolizer_properties::to_xml(boost::property_tree::ptree &node, bool
|
|||
{
|
||||
set_attr(node, "vertical-alignment", valign);
|
||||
}
|
||||
default_format.to_xml(node, explicit_defaults, dfl.default_format);
|
||||
format.to_xml(node, explicit_defaults, dfl.format);
|
||||
if (tree_) tree_->to_xml(node);
|
||||
}
|
||||
|
||||
|
@ -352,13 +352,13 @@ void char_properties::to_xml(boost::property_tree::ptree &node, bool explicit_de
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
text_placements::text_placements() : properties()
|
||||
text_placements::text_placements() : defaults()
|
||||
{
|
||||
}
|
||||
|
||||
void text_placements::add_expressions(expression_set &output)
|
||||
{
|
||||
properties.add_expressions(output);
|
||||
defaults.add_expressions(output);
|
||||
}
|
||||
|
||||
|
||||
|
@ -366,7 +366,7 @@ void text_placements::add_expressions(expression_set &output)
|
|||
|
||||
text_placement_info::text_placement_info(text_placements const* parent,
|
||||
double scale_factor_, dimension_type dim, bool has_dimensions_)
|
||||
: properties(parent->properties),
|
||||
: properties(parent->defaults),
|
||||
scale_factor(scale_factor_),
|
||||
has_dimensions(has_dimensions_),
|
||||
dimensions(dim),
|
||||
|
@ -397,7 +397,7 @@ bool text_placement_info_simple::next()
|
|||
if (state > 0)
|
||||
{
|
||||
if (state > parent_->text_sizes_.size()) return false;
|
||||
properties.default_format.text_size = parent_->text_sizes_[state-1];
|
||||
properties.format.text_size = parent_->text_sizes_[state-1];
|
||||
}
|
||||
if (!next_position_only()) {
|
||||
state++;
|
||||
|
@ -411,7 +411,7 @@ bool text_placement_info_simple::next()
|
|||
|
||||
bool text_placement_info_simple::next_position_only()
|
||||
{
|
||||
const position &pdisp = parent_->properties.displacement;
|
||||
const position &pdisp = parent_->defaults.displacement;
|
||||
position &displacement = properties.displacement;
|
||||
if (position_state >= parent_->direction_.size()) return false;
|
||||
directions_t dir = parent_->direction_[position_state];
|
||||
|
@ -523,7 +523,7 @@ std::string text_placements_simple::get_positions()
|
|||
bool text_placement_info_list::next()
|
||||
{
|
||||
if (state == 0) {
|
||||
properties = parent_->properties;
|
||||
properties = parent_->defaults;
|
||||
} else {
|
||||
if (state-1 >= parent_->list_.size()) return false;
|
||||
properties = parent_->list_[state-1];
|
||||
|
@ -538,7 +538,7 @@ text_symbolizer_properties & text_placements_list::add()
|
|||
text_symbolizer_properties &last = list_.back();
|
||||
list_.push_back(last); //Preinitialize with old values
|
||||
} else {
|
||||
list_.push_back(properties);
|
||||
list_.push_back(defaults);
|
||||
}
|
||||
return list_.back();
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ text_placements_list::text_placements_list() : text_placements(), list_(0)
|
|||
|
||||
void text_placements_list::add_expressions(expression_set &output)
|
||||
{
|
||||
properties.add_expressions(output);
|
||||
defaults.add_expressions(output);
|
||||
|
||||
std::vector<text_symbolizer_properties>::const_iterator it;
|
||||
for (it=list_.begin(); it != list_.end(); it++)
|
||||
|
|
|
@ -138,312 +138,312 @@ expression_ptr text_symbolizer::get_name() const
|
|||
|
||||
void text_symbolizer::set_name(expression_ptr name)
|
||||
{
|
||||
placement_options_->properties.set_old_style_expression(name);
|
||||
placement_options_->defaults.set_old_style_expression(name);
|
||||
}
|
||||
|
||||
expression_ptr text_symbolizer::get_orientation() const
|
||||
{
|
||||
return placement_options_->properties.orientation;
|
||||
return placement_options_->defaults.orientation;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_orientation(expression_ptr orientation)
|
||||
{
|
||||
placement_options_->properties.orientation = orientation;
|
||||
placement_options_->defaults.orientation = orientation;
|
||||
}
|
||||
|
||||
std::string const& text_symbolizer::get_face_name() const
|
||||
{
|
||||
return placement_options_->properties.default_format.face_name;
|
||||
return placement_options_->defaults.format.face_name;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_face_name(std::string face_name)
|
||||
{
|
||||
placement_options_->properties.default_format.face_name = face_name;
|
||||
placement_options_->defaults.format.face_name = face_name;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_fontset(font_set const& fontset)
|
||||
{
|
||||
placement_options_->properties.default_format.fontset = fontset;
|
||||
placement_options_->defaults.format.fontset = fontset;
|
||||
}
|
||||
|
||||
font_set const& text_symbolizer::get_fontset() const
|
||||
{
|
||||
return placement_options_->properties.default_format.fontset;
|
||||
return placement_options_->defaults.format.fontset;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_text_ratio() const
|
||||
{
|
||||
return placement_options_->properties.text_ratio;
|
||||
return placement_options_->defaults.text_ratio;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_text_ratio(unsigned ratio)
|
||||
{
|
||||
placement_options_->properties.text_ratio = ratio;
|
||||
placement_options_->defaults.text_ratio = ratio;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_wrap_width() const
|
||||
{
|
||||
return placement_options_->properties.wrap_width;
|
||||
return placement_options_->defaults.wrap_width;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_wrap_width(unsigned width)
|
||||
{
|
||||
placement_options_->properties.wrap_width = width;
|
||||
placement_options_->defaults.wrap_width = width;
|
||||
}
|
||||
|
||||
bool text_symbolizer::get_wrap_before() const
|
||||
{
|
||||
return placement_options_->properties.default_format.wrap_before;
|
||||
return placement_options_->defaults.format.wrap_before;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_wrap_before(bool wrap_before)
|
||||
{
|
||||
placement_options_->properties.default_format.wrap_before = wrap_before;
|
||||
placement_options_->defaults.format.wrap_before = wrap_before;
|
||||
}
|
||||
|
||||
unsigned char text_symbolizer::get_wrap_char() const
|
||||
{
|
||||
return placement_options_->properties.default_format.wrap_char;
|
||||
return placement_options_->defaults.format.wrap_char;
|
||||
}
|
||||
|
||||
std::string text_symbolizer::get_wrap_char_string() const
|
||||
{
|
||||
return std::string(1, placement_options_->properties.default_format.wrap_char);
|
||||
return std::string(1, placement_options_->defaults.format.wrap_char);
|
||||
}
|
||||
|
||||
void text_symbolizer::set_wrap_char(unsigned char character)
|
||||
{
|
||||
placement_options_->properties.default_format.wrap_char = character;
|
||||
placement_options_->defaults.format.wrap_char = character;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_wrap_char_from_string(std::string const& character)
|
||||
{
|
||||
placement_options_->properties.default_format.wrap_char = (character)[0];
|
||||
placement_options_->defaults.format.wrap_char = (character)[0];
|
||||
}
|
||||
|
||||
text_transform_e text_symbolizer::get_text_transform() const
|
||||
{
|
||||
return placement_options_->properties.default_format.text_transform;
|
||||
return placement_options_->defaults.format.text_transform;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_text_transform(text_transform_e convert)
|
||||
{
|
||||
placement_options_->properties.default_format.text_transform = convert;
|
||||
placement_options_->defaults.format.text_transform = convert;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_line_spacing() const
|
||||
{
|
||||
return placement_options_->properties.default_format.line_spacing;
|
||||
return placement_options_->defaults.format.line_spacing;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_line_spacing(unsigned spacing)
|
||||
{
|
||||
placement_options_->properties.default_format.line_spacing = spacing;
|
||||
placement_options_->defaults.format.line_spacing = spacing;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_character_spacing() const
|
||||
{
|
||||
return placement_options_->properties.default_format.character_spacing;
|
||||
return placement_options_->defaults.format.character_spacing;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_character_spacing(unsigned spacing)
|
||||
{
|
||||
placement_options_->properties.default_format.character_spacing = spacing;
|
||||
placement_options_->defaults.format.character_spacing = spacing;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_label_spacing() const
|
||||
{
|
||||
return placement_options_->properties.label_spacing;
|
||||
return placement_options_->defaults.label_spacing;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_label_spacing(unsigned spacing)
|
||||
{
|
||||
placement_options_->properties.label_spacing = spacing;
|
||||
placement_options_->defaults.label_spacing = spacing;
|
||||
}
|
||||
|
||||
unsigned text_symbolizer::get_label_position_tolerance() const
|
||||
{
|
||||
return placement_options_->properties.label_position_tolerance;
|
||||
return placement_options_->defaults.label_position_tolerance;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_label_position_tolerance(unsigned tolerance)
|
||||
{
|
||||
placement_options_->properties.label_position_tolerance = tolerance;
|
||||
placement_options_->defaults.label_position_tolerance = tolerance;
|
||||
}
|
||||
|
||||
bool text_symbolizer::get_force_odd_labels() const
|
||||
{
|
||||
return placement_options_->properties.force_odd_labels;
|
||||
return placement_options_->defaults.force_odd_labels;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_force_odd_labels(bool force)
|
||||
{
|
||||
placement_options_->properties.force_odd_labels = force;
|
||||
placement_options_->defaults.force_odd_labels = force;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_max_char_angle_delta() const
|
||||
{
|
||||
return placement_options_->properties.max_char_angle_delta;
|
||||
return placement_options_->defaults.max_char_angle_delta;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_max_char_angle_delta(double angle)
|
||||
{
|
||||
placement_options_->properties.max_char_angle_delta = angle;
|
||||
placement_options_->defaults.max_char_angle_delta = angle;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_text_size(float size)
|
||||
{
|
||||
placement_options_->properties.default_format.text_size = size;
|
||||
placement_options_->defaults.format.text_size = size;
|
||||
}
|
||||
|
||||
float text_symbolizer::get_text_size() const
|
||||
{
|
||||
return placement_options_->properties.default_format.text_size;
|
||||
return placement_options_->defaults.format.text_size;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_fill(color const& fill)
|
||||
{
|
||||
placement_options_->properties.default_format.fill = fill;
|
||||
placement_options_->defaults.format.fill = fill;
|
||||
}
|
||||
|
||||
color const& text_symbolizer::get_fill() const
|
||||
{
|
||||
return placement_options_->properties.default_format.fill;
|
||||
return placement_options_->defaults.format.fill;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_halo_fill(color const& fill)
|
||||
{
|
||||
placement_options_->properties.default_format.halo_fill = fill;
|
||||
placement_options_->defaults.format.halo_fill = fill;
|
||||
}
|
||||
|
||||
color const& text_symbolizer::get_halo_fill() const
|
||||
{
|
||||
return placement_options_->properties.default_format.halo_fill;
|
||||
return placement_options_->defaults.format.halo_fill;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_halo_radius(double radius)
|
||||
{
|
||||
placement_options_->properties.default_format.halo_radius = radius;
|
||||
placement_options_->defaults.format.halo_radius = radius;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_halo_radius() const
|
||||
{
|
||||
return placement_options_->properties.default_format.halo_radius;
|
||||
return placement_options_->defaults.format.halo_radius;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_label_placement(label_placement_e label_p)
|
||||
{
|
||||
placement_options_->properties.label_placement = label_p;
|
||||
placement_options_->defaults.label_placement = label_p;
|
||||
}
|
||||
|
||||
label_placement_e text_symbolizer::get_label_placement() const
|
||||
{
|
||||
return placement_options_->properties.label_placement;
|
||||
return placement_options_->defaults.label_placement;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_displacement(double x, double y)
|
||||
{
|
||||
placement_options_->properties.displacement = std::make_pair(x,y);
|
||||
placement_options_->defaults.displacement = std::make_pair(x,y);
|
||||
}
|
||||
|
||||
void text_symbolizer::set_displacement(position const& p)
|
||||
{
|
||||
placement_options_->properties.displacement = p;
|
||||
placement_options_->defaults.displacement = p;
|
||||
}
|
||||
|
||||
position const& text_symbolizer::get_displacement() const
|
||||
{
|
||||
return placement_options_->properties.displacement;
|
||||
return placement_options_->defaults.displacement;
|
||||
}
|
||||
|
||||
bool text_symbolizer::get_avoid_edges() const
|
||||
{
|
||||
return placement_options_->properties.avoid_edges;
|
||||
return placement_options_->defaults.avoid_edges;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_avoid_edges(bool avoid)
|
||||
{
|
||||
placement_options_->properties.avoid_edges = avoid;
|
||||
placement_options_->defaults.avoid_edges = avoid;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_minimum_distance() const
|
||||
{
|
||||
return placement_options_->properties.minimum_distance;
|
||||
return placement_options_->defaults.minimum_distance;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_minimum_distance(double distance)
|
||||
{
|
||||
placement_options_->properties.minimum_distance = distance;
|
||||
placement_options_->defaults.minimum_distance = distance;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_minimum_padding() const
|
||||
{
|
||||
return placement_options_->properties.minimum_padding;
|
||||
return placement_options_->defaults.minimum_padding;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_minimum_padding(double distance)
|
||||
{
|
||||
placement_options_->properties.minimum_padding = distance;
|
||||
placement_options_->defaults.minimum_padding = distance;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_minimum_path_length() const
|
||||
{
|
||||
return placement_options_->properties.minimum_path_length;
|
||||
return placement_options_->defaults.minimum_path_length;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_minimum_path_length(double size)
|
||||
{
|
||||
placement_options_->properties.minimum_path_length = size;
|
||||
placement_options_->defaults.minimum_path_length = size;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_allow_overlap(bool overlap)
|
||||
{
|
||||
placement_options_->properties.allow_overlap = overlap;
|
||||
placement_options_->defaults.allow_overlap = overlap;
|
||||
}
|
||||
|
||||
bool text_symbolizer::get_allow_overlap() const
|
||||
{
|
||||
return placement_options_->properties.allow_overlap;
|
||||
return placement_options_->defaults.allow_overlap;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_text_opacity(double text_opacity)
|
||||
{
|
||||
placement_options_->properties.default_format.text_opacity = text_opacity;
|
||||
placement_options_->defaults.format.text_opacity = text_opacity;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_text_opacity() const
|
||||
{
|
||||
return placement_options_->properties.default_format.text_opacity;
|
||||
return placement_options_->defaults.format.text_opacity;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_vertical_alignment(vertical_alignment_e valign)
|
||||
{
|
||||
placement_options_->properties.valign = valign;
|
||||
placement_options_->defaults.valign = valign;
|
||||
}
|
||||
|
||||
vertical_alignment_e text_symbolizer::get_vertical_alignment() const
|
||||
{
|
||||
return placement_options_->properties.valign;
|
||||
return placement_options_->defaults.valign;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_horizontal_alignment(horizontal_alignment_e halign)
|
||||
{
|
||||
placement_options_->properties.halign = halign;
|
||||
placement_options_->defaults.halign = halign;
|
||||
}
|
||||
|
||||
horizontal_alignment_e text_symbolizer::get_horizontal_alignment() const
|
||||
{
|
||||
return placement_options_->properties.halign;
|
||||
return placement_options_->defaults.halign;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_justify_alignment(justify_alignment_e jalign)
|
||||
{
|
||||
placement_options_->properties.jalign = jalign;
|
||||
placement_options_->defaults.jalign = jalign;
|
||||
}
|
||||
|
||||
justify_alignment_e text_symbolizer::get_justify_alignment() const
|
||||
{
|
||||
return placement_options_->properties.jalign;
|
||||
return placement_options_->defaults.jalign;
|
||||
}
|
||||
|
||||
text_placements_ptr text_symbolizer::get_placement_options() const
|
||||
|
|
Loading…
Add table
Reference in a new issue