2014-10-17 11:38:54 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2016-12-20 17:57:22 +01:00
|
|
|
* Copyright (C) 2016 Artem Pavlenko
|
2014-10-17 11:38:54 +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
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef MAPNIK_SYMBOLIZER_DEFAULT_VALUES_HPP
|
|
|
|
#define MAPNIK_SYMBOLIZER_DEFAULT_VALUES_HPP
|
|
|
|
|
|
|
|
#include <mapnik/symbolizer_keys.hpp>
|
2015-12-16 23:22:36 +01:00
|
|
|
#include <mapnik/symbolizer_enumerations.hpp>
|
|
|
|
#include <mapnik/image_compositing.hpp>
|
|
|
|
#include <mapnik/image_scaling.hpp>
|
|
|
|
#include <mapnik/simplify.hpp>
|
2014-10-17 11:38:54 +02:00
|
|
|
#include <mapnik/color.hpp>
|
2016-08-02 16:34:59 +02:00
|
|
|
#include <mapnik/value/types.hpp>
|
2014-10-17 11:38:54 +02:00
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
|
|
|
|
namespace mapnik {
|
|
|
|
|
|
|
|
template <typename T, keys key>
|
2014-10-17 21:45:15 +02:00
|
|
|
struct symbolizer_default {};
|
2014-10-17 11:38:54 +02:00
|
|
|
|
|
|
|
// specializations for properties
|
|
|
|
// gamma
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::gamma>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// gamma-method
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<gamma_method_enum, keys::gamma_method>
|
|
|
|
{
|
|
|
|
static gamma_method_enum value() { return GAMMA_POWER; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// opacity
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::opacity>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// alignment
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<pattern_alignment_enum, keys::alignment>
|
|
|
|
{
|
2014-10-17 22:23:00 +02:00
|
|
|
static pattern_alignment_enum value() { return GLOBAL_ALIGNMENT; }
|
2014-10-17 11:38:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// offset
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::offset>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// comp-op
|
|
|
|
template <>
|
2014-10-17 21:45:15 +02:00
|
|
|
struct symbolizer_default<composite_mode_e, keys::comp_op>
|
2014-10-17 11:38:54 +02:00
|
|
|
{
|
|
|
|
static composite_mode_e value() { return src_over; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// clip
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::clip>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// fill
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<color, keys::fill>
|
|
|
|
{
|
|
|
|
static color value() { return color(128,128,128); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// fill-opacity
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::fill_opacity>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<color, keys::stroke>
|
|
|
|
{
|
|
|
|
static color value() { return color(0,0,0); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-width
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::stroke_width>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-opacity
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::stroke_opacity>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-linejoin
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<line_join_enum, keys::stroke_linejoin>
|
|
|
|
{
|
|
|
|
static line_join_enum value() { return MITER_JOIN; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-linecap
|
|
|
|
template <>
|
2014-10-17 21:45:15 +02:00
|
|
|
struct symbolizer_default<line_cap_enum, keys::stroke_linecap>
|
2014-10-17 11:38:54 +02:00
|
|
|
{
|
|
|
|
static line_cap_enum value() { return BUTT_CAP; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-gamma
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::stroke_gamma>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-gamma-method
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<gamma_method_enum, keys::stroke_gamma_method>
|
|
|
|
{
|
|
|
|
static gamma_method_enum value() { return GAMMA_POWER; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-dashoffset
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_integer, keys::stroke_dashoffset>
|
|
|
|
{
|
|
|
|
static value_integer value() { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// stroke-dasharray
|
|
|
|
|
|
|
|
// stroke-miterlimit
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::stroke_miterlimit>
|
|
|
|
{
|
|
|
|
static value_double value() { return 4.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// geometry-transform
|
|
|
|
|
|
|
|
// rasterizer
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<line_rasterizer_enum, keys::line_rasterizer>
|
|
|
|
{
|
|
|
|
static line_rasterizer_enum value() { return RASTERIZER_FULL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// transform
|
|
|
|
|
|
|
|
// spacing
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::spacing>
|
|
|
|
{
|
2014-10-17 21:45:15 +02:00
|
|
|
static value_double value() { return 100.0; }
|
2014-10-17 11:38:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// max-error
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::max_error>
|
|
|
|
{
|
2014-10-17 21:45:15 +02:00
|
|
|
static value_double value() { return 0.2; }
|
2014-10-17 11:38:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// allow-overlap
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::allow_overlap>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// ignore-placement
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::ignore_placement>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// width
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::width>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// height
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::height>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// file ??
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<std::string, keys::file>
|
|
|
|
{
|
|
|
|
static std::string value() { return ""; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// shield-dx
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::shield_dx>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// shield-dy
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::shield_dy>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// unlock-image
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::unlock_image>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// mode
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::mode>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// scaling
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::scaling>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// filter-factor
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::filter_factor>
|
|
|
|
{
|
|
|
|
static value_double value() { return 1.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// mesh-size
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_integer, keys::mesh_size>
|
|
|
|
{
|
|
|
|
static value_integer value() { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// premultiplied
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::premultiplied>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// smooth
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::smooth>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// simplify-algorithm
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<simplify_algorithm_e, keys::simplify_algorithm>
|
|
|
|
{
|
|
|
|
static simplify_algorithm_e value() { return radial_distance; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// simplify
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_double, keys::simplify_tolerance>
|
|
|
|
{
|
|
|
|
static value_double value() { return 0.0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// halo-rasterizer
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<halo_rasterizer_enum, keys::halo_rasterizer>
|
|
|
|
{
|
|
|
|
static halo_rasterizer_enum value() { return HALO_RASTERIZER_FULL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// text-placements
|
|
|
|
|
|
|
|
// placement (point-placement-type FIXME)
|
|
|
|
template <>
|
2014-10-17 21:45:15 +02:00
|
|
|
struct symbolizer_default<point_placement_enum, keys::point_placement_type>
|
2014-10-17 11:38:54 +02:00
|
|
|
{
|
2014-10-17 21:45:15 +02:00
|
|
|
static point_placement_enum value() { return CENTROID_POINT_PLACEMENT; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// marker placement
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<marker_placement_enum, keys::markers_placement_type>
|
|
|
|
{
|
|
|
|
static marker_placement_enum value() { return MARKER_POINT_PLACEMENT; }
|
2014-10-17 11:38:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// multi-policy
|
2014-10-17 21:45:15 +02:00
|
|
|
template <>
|
|
|
|
struct symbolizer_default<marker_multi_policy_enum, keys::markers_multipolicy>
|
|
|
|
{
|
|
|
|
static marker_multi_policy_enum value() { return MARKER_EACH_MULTI; }
|
|
|
|
};
|
|
|
|
|
2015-01-19 14:47:46 +01:00
|
|
|
// direction
|
|
|
|
template <>
|
|
|
|
struct symbolizer_default<direction_enum, keys::direction>
|
|
|
|
{
|
|
|
|
static direction_enum value() { return DIRECTION_RIGHT; }
|
|
|
|
};
|
|
|
|
|
2014-10-17 11:38:54 +02:00
|
|
|
// placement
|
|
|
|
|
|
|
|
// colorizer
|
|
|
|
|
|
|
|
// halo-transform
|
|
|
|
|
|
|
|
// num-columns
|
|
|
|
// start-column
|
|
|
|
// repeat-key
|
|
|
|
// symbolizer-properties ??
|
|
|
|
// largest-box-only
|
|
|
|
// minimum-path-length
|
|
|
|
// halo-comp-op
|
|
|
|
// text-transform
|
|
|
|
// horizontal-alignment
|
|
|
|
// justify-alignment
|
|
|
|
// vertical-alignment
|
|
|
|
// upright
|
2014-10-17 21:45:15 +02:00
|
|
|
|
2014-10-17 11:38:54 +02:00
|
|
|
// avoid-edges
|
2014-10-17 21:45:15 +02:00
|
|
|
template <>
|
|
|
|
struct symbolizer_default<value_bool, keys::avoid_edges>
|
|
|
|
{
|
|
|
|
static value_bool value() { return false; }
|
|
|
|
};
|
|
|
|
|
2014-10-17 11:38:54 +02:00
|
|
|
// font-feature-settings
|
|
|
|
|
|
|
|
} // namespace mapnik
|
|
|
|
|
|
|
|
#endif // MAPNIK_SYMBOLIZER_DEFAULT_VALUES_HPP
|