Merge branch 'master' into gsoc-crundel
This commit is contained in:
commit
d0d2efbf54
395 changed files with 7881 additions and 5252 deletions
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.DS_Store
|
||||
*~
|
||||
*.o
|
||||
*.pyc
|
||||
|
@ -23,4 +24,13 @@ utils/shapeindex/shapeindex
|
|||
utils/pgsql2sqlite/pgsql2sqlite
|
||||
utils/svg2png/svg2png
|
||||
demo/python/demo*
|
||||
demo/python/map.xml
|
||||
demo/python/map.xml
|
||||
tests/cpp_tests/svg_renderer_tests/background_color_test
|
||||
tests/cpp_tests/svg_renderer_tests/combined_test
|
||||
tests/cpp_tests/svg_renderer_tests/compilation_test
|
||||
tests/cpp_tests/svg_renderer_tests/file_output_test
|
||||
tests/cpp_tests/svg_renderer_tests/file_output_test_case.svg
|
||||
tests/cpp_tests/svg_renderer_tests/path_element_test
|
||||
tests/cpp_tests/svg_renderer_tests/path_element_test_case_1.svg
|
||||
tests/cpp_tests/svg_renderer_tests/root_element_test
|
||||
tests/data/sqlite/*index
|
||||
|
|
25
CHANGELOG
25
CHANGELOG
|
@ -3,7 +3,7 @@
|
|||
----------------
|
||||
Mapnik Changelog
|
||||
----------------
|
||||
|
||||
|
||||
A simple log of core changes affecting Mapnik usage.
|
||||
|
||||
Developers: Please commit along with changes.
|
||||
|
@ -18,6 +18,7 @@ Mapnik 2.1.0
|
|||
|
||||
- Fixed bug in shield line placement when dx/dy are used to shift the label relative to the placement point (Matt Amos) (#908)
|
||||
|
||||
- Added <layer_by_sql> parameter in OGR plugin to select a layer by SQL query (besides name or index): see http://www.gdal.org/ogr/ogr_sql.html for specifications (kunitoki) (#472)
|
||||
|
||||
|
||||
Mapnik 2.0.0
|
||||
|
@ -45,7 +46,7 @@ Mapnik 2.0.0
|
|||
- Added map.base parameter that can be set to control where files with relative paths should be interpreted
|
||||
from when a map is loaded from a string or saved to a string. It defaults to an empty string which means
|
||||
that the base path will be the current working directory of the mapnik process. When a stylesheet is read
|
||||
from a file that files directory is used. And a custom value can still be passed as an argument to
|
||||
from a file that files directory is used. And a custom value can still be passed as an argument to
|
||||
load_map_from_string().
|
||||
|
||||
- Added python function 'render_grid' to allow conversion of grid buffer to python object containing list of grid
|
||||
|
@ -112,7 +113,7 @@ Mapnik 2.0.0
|
|||
|
||||
Mapnik 0.7.2 Release
|
||||
--------------------
|
||||
|
||||
|
||||
- Added forward compatibility for Mapnik 2.0 XML syntax (https://trac.mapnik.org/wiki/Mapnik2/Changes)
|
||||
|
||||
- Build fixes to ensure boost_threads are not used unless THREADING=multi build option is used
|
||||
|
@ -167,9 +168,9 @@ Mapnik 0.7.0 Release
|
|||
|
||||
* Use the gdaladdo utility to add overviews to existing GDAL datasets
|
||||
|
||||
- PostGIS: Added an optional 'geometry_table' parameter. The 'geometry_table' used by Mapnik to look up
|
||||
- PostGIS: Added an optional 'geometry_table' parameter. The 'geometry_table' used by Mapnik to look up
|
||||
metadata in the geometry_columns and calculate extents (when the 'geometry_field' and 'srid' parameters
|
||||
are not supplied). If 'geometry_table' is not specified Mapnik will attempt to determine the name of the
|
||||
are not supplied). If 'geometry_table' is not specified Mapnik will attempt to determine the name of the
|
||||
table to query based on parsing the 'table' parameter, which may fail for complex queries with more than
|
||||
one 'from' keyword. Using this parameter should allow for existing metadata and table indexes to be used
|
||||
while opening the door to much more complicated subqueries being passed to the 'table' parameter without
|
||||
|
@ -191,7 +192,7 @@ Mapnik 0.7.0 Release
|
|||
query to be used by indexes. (#415)
|
||||
|
||||
* Pass the bbox token inside a subquery like: !bbox!
|
||||
|
||||
|
||||
* Valid Usages include:
|
||||
|
||||
<Parameter name="table">
|
||||
|
@ -210,7 +211,7 @@ Mapnik 0.7.0 Release
|
|||
|
||||
- PostGIS Plugin: Added support for quoted table names (r1454) (#393)
|
||||
|
||||
- PostGIS: Add a 'persist_connection' option (default true), that when false will release
|
||||
- PostGIS: Add a 'persist_connection' option (default true), that when false will release
|
||||
the idle psql connection after datasource goes out of scope (r1337) (#433,#434)
|
||||
|
||||
- PostGIS: Added support for BigInt (int8) postgres type (384)
|
||||
|
@ -234,14 +235,14 @@ Mapnik 0.7.0 Release
|
|||
- PolygonSymbolizer: Added 'gamma' attribute to allow for dilation of polygon edges - a solution
|
||||
to gap artifacts or "ghost lines" between adjacent polygons and allows for slight sharpening of
|
||||
the edges of non overlapping polygons. Accepts any values but 0-1 is the recommended range.
|
||||
|
||||
- TextSymbolizer: Large set of new attributes: 'text_transform', 'line_spacing', 'character_spacing',
|
||||
|
||||
- TextSymbolizer: Large set of new attributes: 'text_transform', 'line_spacing', 'character_spacing',
|
||||
'wrap_character', 'wrap_before', 'horizontal_alignment', 'justify_alignment', and 'opacity'.
|
||||
|
||||
* More details at changesets: r1254 and r1341
|
||||
|
||||
- SheildSymbolizer: Added special new attributes: 'unlock_image', 'VERTEX' placement, 'no_text' and many
|
||||
attributes previously only supported in the TextSymbolizer: 'allow_overlap', 'vertical_alignment',
|
||||
attributes previously only supported in the TextSymbolizer: 'allow_overlap', 'vertical_alignment',
|
||||
'horizontal_alignment', 'justify_alignment', 'wrap_width', 'wrap_character', 'wrap_before', 'text_transform',
|
||||
'line_spacing', 'character_spacing', and 'opacity'.
|
||||
|
||||
|
@ -281,7 +282,7 @@ Mapnik 0.7.0 Release
|
|||
|
||||
- Python: Ensured mapnik::config_errors now throw RuntimeError exception instead of UserWarning exception (#442)
|
||||
|
||||
- Filters: Added support for '!=' as an alias to '<>' for not-equals filters (avoids <>) (r1326) (#427)
|
||||
- Filters: Added support for '!=' as an alias to '<>' for not-equals filters (avoids <>) (r1326) (#427)
|
||||
|
||||
- SCons: Improved boost auto-detection (r1255,r1279)
|
||||
|
||||
|
@ -303,7 +304,7 @@ Mapnik 0.6.1 Release
|
|||
|
||||
(Packaged from r1247)
|
||||
|
||||
- Plugins: expose list of registered plugins as a 'plugin_names()' method of DatasourceCache (r1180)
|
||||
- Plugins: expose list of registered plugins as a 'plugin_names()' method of DatasourceCache (r1180)
|
||||
|
||||
- XML: Fixed serialization and parsing bugs related to handling of integers and Enums (#328,#353)
|
||||
|
||||
|
|
59
SConstruct
59
SConstruct
|
@ -329,7 +329,7 @@ opts.AddVariables(
|
|||
('BOOST_TOOLKIT','Specify boost toolkit, e.g., gcc41.','',False),
|
||||
('BOOST_ABI', 'Specify boost ABI, e.g., d.','',False),
|
||||
('BOOST_VERSION','Specify boost version, e.g., 1_35.','',False),
|
||||
('BOOST_PYTHON_LIB','Specify library name or full path to boost_python lib (e.g. "boost_python-py26" or "/usr/lib/libboost_python.dylib")',''),
|
||||
('BOOST_PYTHON_LIB','Specify library name to specific Boost Python lib (e.g. "boost_python-py26")',''),
|
||||
|
||||
# Variables for required dependencies
|
||||
('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'),
|
||||
|
@ -425,7 +425,6 @@ pickle_store = [# Scons internal variables
|
|||
'PYTHON_INSTALL_LOCATION',
|
||||
'PYTHON_SYS_PREFIX',
|
||||
'COLOR_PRINT',
|
||||
'HAS_BOOST_SYSTEM',
|
||||
'SVN_REVISION',
|
||||
'HAS_CAIRO',
|
||||
'HAS_PYCAIRO',
|
||||
|
@ -451,6 +450,7 @@ pickle_store = [# Scons internal variables
|
|||
'CAIROMM_LIBPATHS',
|
||||
'CAIROMM_LINKFLAGS',
|
||||
'CAIROMM_CPPPATHS',
|
||||
'SVG_RENDERER',
|
||||
]
|
||||
|
||||
# Add all other user configurable options to pickle pickle_store
|
||||
|
@ -1070,15 +1070,17 @@ if not preconfigured:
|
|||
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
|
||||
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
|
||||
|
||||
conf.parse_config('FREETYPE_CONFIG')
|
||||
|
||||
# check if freetype links to bz2
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
temp_env = env.Clone()
|
||||
temp_env['LIBS'] = []
|
||||
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
||||
if 'bz2' in temp_env['LIBS']:
|
||||
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
||||
if conf.parse_config('FREETYPE_CONFIG'):
|
||||
# check if freetype links to bz2
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
temp_env = env.Clone()
|
||||
temp_env['LIBS'] = []
|
||||
try:
|
||||
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
||||
if 'bz2' in temp_env['LIBS']:
|
||||
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
||||
except OSError,e:
|
||||
pass
|
||||
|
||||
# libxml2 should be optional but is currently not
|
||||
# https://github.com/mapnik/mapnik/issues/913
|
||||
|
@ -1105,14 +1107,14 @@ if not preconfigured:
|
|||
if env['PRIORITIZE_LINKING']:
|
||||
conf.prioritize_paths(silent=False)
|
||||
|
||||
for libinfo in LIBSHEADERS:
|
||||
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], libinfo[3]):
|
||||
if libinfo[2]:
|
||||
color_print(1,'Could not find required header or shared library for %s' % libinfo[0])
|
||||
env['MISSING_DEPS'].append(libinfo[0])
|
||||
for libname, headers, required, lang in LIBSHEADERS:
|
||||
if not conf.CheckLibWithHeader(libname, headers, lang):
|
||||
if required:
|
||||
color_print(1, 'Could not find required header or shared library for %s' % libname)
|
||||
env['MISSING_DEPS'].append(libname)
|
||||
else:
|
||||
color_print(4,'Could not find optional header or shared library for %s' % libinfo[0])
|
||||
env['SKIPPED_DEPS'].append(libinfo[0])
|
||||
color_print(4, 'Could not find optional header or shared library for %s' % libname)
|
||||
env['SKIPPED_DEPS'].append(libname)
|
||||
|
||||
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
|
||||
if not conf.icu_at_least_four_two():
|
||||
|
@ -1126,18 +1128,14 @@ if not preconfigured:
|
|||
|
||||
conf.FindBoost(BOOST_SEARCH_PREFIXES,thread_flag)
|
||||
|
||||
# boost system is used in boost 1.35 and greater
|
||||
env['HAS_BOOST_SYSTEM'] = False
|
||||
boost_lib_version_from_header = conf.GetBoostLibVersion()
|
||||
if boost_lib_version_from_header:
|
||||
boost_version_from_header = int(boost_lib_version_from_header.split('_')[1])
|
||||
if boost_version_from_header >= 35:
|
||||
env['HAS_BOOST_SYSTEM'] = True
|
||||
|
||||
|
||||
# The other required boost headers.
|
||||
BOOST_LIBSHEADERS = [
|
||||
['system', 'boost/system/system_error.hpp', env['HAS_BOOST_SYSTEM']],
|
||||
['system', 'boost/system/system_error.hpp', True],
|
||||
['filesystem', 'boost/filesystem/operations.hpp', True],
|
||||
['regex', 'boost/regex.hpp', True],
|
||||
['program_options', 'boost/program_options.hpp', False]
|
||||
|
@ -1331,7 +1329,7 @@ if not preconfigured:
|
|||
if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'):
|
||||
color_print(1,'Could not find required header files for boost python')
|
||||
env['MISSING_DEPS'].append('boost python')
|
||||
|
||||
|
||||
if env['CAIRO']:
|
||||
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
|
||||
env['HAS_PYCAIRO'] = True
|
||||
|
@ -1502,14 +1500,23 @@ if not preconfigured:
|
|||
if not conf.CheckHeader(header='Python.h',language='C'):
|
||||
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
|
||||
env.Replace(**backup)
|
||||
env['MISSING_DEPS'].append('python %s development headers' % env['PYTHON_VERSION'])
|
||||
Exit(1)
|
||||
else:
|
||||
env.Replace(**backup)
|
||||
|
||||
if (int(majver), int(minver)) < (2, 2):
|
||||
color_print(1,"Python version 2.2 or greater required")
|
||||
Exit(1)
|
||||
|
||||
|
||||
if env['BOOST_PYTHON_LIB']:
|
||||
env.Append(LIBS='python%s' % env['PYTHON_VERSION'])
|
||||
if not conf.CheckLibWithHeader(libs=[env['BOOST_PYTHON_LIB']], header='boost/python/detail/config.hpp', language='C++'):
|
||||
color_print(1, 'Could not find library %s for boost python' % env['BOOST_PYTHON_LIB'])
|
||||
env.Replace(**backup)
|
||||
Exit(1)
|
||||
else:
|
||||
env.Replace(**backup)
|
||||
|
||||
color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION'])
|
||||
color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX']))
|
||||
color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION']))
|
||||
|
|
|
@ -48,13 +48,7 @@ if env['JPEG']:
|
|||
libraries.append('jpeg')
|
||||
|
||||
if env['BOOST_PYTHON_LIB']:
|
||||
if os.path.sep in env['BOOST_PYTHON_LIB']:
|
||||
pylib_dir = os.path.dirname(env['BOOST_PYTHON_LIB'])
|
||||
env.Prepend(LIBPATH = pylib_dir)
|
||||
pylib_name = os.path.splitext(os.path.basename(env['BOOST_PYTHON_LIB']))[0].replace('lib','',1)
|
||||
libraries.append(pylib_name)
|
||||
else:
|
||||
libraries.append(env['BOOST_PYTHON_LIB'].replace('lib','',1))
|
||||
libraries.append(env['BOOST_PYTHON_LIB'])
|
||||
else:
|
||||
if is_py3():
|
||||
libraries.append('boost_python3%s' % env['BOOST_APPEND'])
|
||||
|
|
|
@ -410,6 +410,13 @@ def Raster(**keywords):
|
|||
|
||||
Optional keyword arguments:
|
||||
base -- path prefix (default None)
|
||||
multi -- whether the image is in tiles on disk (default False)
|
||||
|
||||
Multi-tiled keyword arguments:
|
||||
x_width -- virtual image number of tiles in X direction (required)
|
||||
y_width -- virtual image number of tiles in Y direction (required)
|
||||
tile_size -- if an image is in tiles, how large are the tiles (default 256)
|
||||
tile_stride -- if an image is in tiles, what's the increment between rows/cols (default 1)
|
||||
|
||||
>>> from mapnik import Raster, Layer
|
||||
>>> raster = Raster(base='/home/mapnik/data',file='elevation.tif',lox=-122.8,loy=48.5,hix=-122.7,hiy=48.6)
|
||||
|
@ -478,10 +485,11 @@ def Ogr(**keywords):
|
|||
|
||||
Required keyword arguments:
|
||||
file -- path to OGR supported dataset
|
||||
layer -- name of layer to use within datasource (optional if layer_by_index is used)
|
||||
layer -- name of layer to use within datasource (optional if layer_by_index or layer_by_sql is used)
|
||||
|
||||
Optional keyword arguments:
|
||||
layer_by_index -- choose layer by index number instead of by layer name.
|
||||
layer_by_index -- choose layer by index number instead of by layer name or sql.
|
||||
layer_by_sql -- choose layer by sql query number instead of by layer name or index.
|
||||
base -- path prefix (default None)
|
||||
encoding -- file encoding (default 'utf-8')
|
||||
multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)
|
||||
|
|
|
@ -15,6 +15,7 @@ page.render_map(m,"my_output_file.pdf")
|
|||
see the documentation of mapnik2.printing.PDFPrinter() for options
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import render, Map, Box2d, MemoryDatasource, Layer, Feature, Projection, ProjTransform, Coord, Style, Rule, Geometry2d
|
||||
import math
|
||||
|
|
|
@ -78,7 +78,6 @@ void export_geometry()
|
|||
.def("envelope",&geometry_type::envelope)
|
||||
// .def("__str__",&geometry_type::to_string)
|
||||
.def("type",&geometry_type::type)
|
||||
.def("area",&geometry_type::area)
|
||||
// TODO add other geometry_type methods
|
||||
;
|
||||
|
||||
|
|
123
bindings/python/mapnik_label_collision_detector.cpp
Normal file
123
bindings/python/mapnik_label_collision_detector.cpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
|
||||
#include <list>
|
||||
|
||||
using mapnik::label_collision_detector4;
|
||||
using mapnik::box2d;
|
||||
using mapnik::Map;
|
||||
using boost::make_shared;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
boost::shared_ptr<label_collision_detector4>
|
||||
create_label_collision_detector_from_extent(box2d<double> const &extent)
|
||||
{
|
||||
return make_shared<label_collision_detector4>(extent);
|
||||
}
|
||||
|
||||
boost::shared_ptr<label_collision_detector4>
|
||||
create_label_collision_detector_from_map(Map const &m)
|
||||
{
|
||||
double buffer = m.buffer_size();
|
||||
box2d<double> extent(-buffer, -buffer, m.width() + buffer, m.height() + buffer);
|
||||
return make_shared<label_collision_detector4>(extent);
|
||||
}
|
||||
|
||||
boost::python::list
|
||||
make_label_boxes(boost::shared_ptr<label_collision_detector4> det)
|
||||
{
|
||||
boost::python::list boxes;
|
||||
|
||||
for (label_collision_detector4::query_iterator jtr = det->begin();
|
||||
jtr != det->end(); ++jtr)
|
||||
{
|
||||
boxes.append<box2d<double> >(jtr->box);
|
||||
}
|
||||
|
||||
return boxes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void export_label_collision_detector()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
// for overload resolution
|
||||
void (label_collision_detector4::*insert_box)(box2d<double> const &) = &label_collision_detector4::insert;
|
||||
|
||||
class_<label_collision_detector4, boost::shared_ptr<label_collision_detector4>, boost::noncopyable>
|
||||
("LabelCollisionDetector",
|
||||
"Object to detect collisions between labels, used in the rendering process.",
|
||||
no_init)
|
||||
|
||||
.def("__init__", make_constructor(create_label_collision_detector_from_extent),
|
||||
"Creates an empty collision detection object with a given extent. Note "
|
||||
"that the constructor from Map objects is a sensible default and usually "
|
||||
"what you want to do.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> m = Map(size_x, size_y)\n"
|
||||
">>> buf_sz = m.buffer_size\n"
|
||||
">>> extent = mapnik.Box2d(-buf_sz, -buf_sz, m.width + buf_sz, m.height + buf_sz)\n"
|
||||
">>> detector = mapnik.LabelCollisionDetector(extent)")
|
||||
|
||||
.def("__init__", make_constructor(create_label_collision_detector_from_map),
|
||||
"Creates an empty collision detection object matching the given Map object. "
|
||||
"The created detector will have the same size, including the buffer, as the "
|
||||
"map object. This is usually what you want to do.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> m = Map(size_x, size_y)\n"
|
||||
">>> detector = mapnik.LabelCollisionDetector(m)")
|
||||
|
||||
.def("extent", &label_collision_detector4::extent, return_value_policy<copy_const_reference>(),
|
||||
"Returns the total extent (bounding box) of all labels inside the detector.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> detector.extent()\n"
|
||||
"Box2d(573.252589209,494.789179821,584.261023823,496.83610261)")
|
||||
|
||||
.def("boxes", &make_label_boxes,
|
||||
"Returns a list of all the label boxes inside the detector.")
|
||||
|
||||
.def("insert", insert_box,
|
||||
"Insert a 2d box into the collision detector. This can be used to ensure that "
|
||||
"some space is left clear on the map for later overdrawing, for example by "
|
||||
"non-Mapnik processes.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> m = Map(size_x, size_y)\n"
|
||||
">>> detector = mapnik.LabelCollisionDetector(m)"
|
||||
">>> detector.insert(mapnik.Box2d(196, 254, 291, 389))")
|
||||
;
|
||||
}
|
|
@ -66,6 +66,7 @@ void export_view_transform();
|
|||
void export_raster_colorizer();
|
||||
void export_glyph_symbolizer();
|
||||
void export_inmem_metawriter();
|
||||
void export_label_collision_detector();
|
||||
|
||||
#include <mapnik/version.hpp>
|
||||
#include <mapnik/value_error.hpp>
|
||||
|
@ -120,6 +121,28 @@ void render(const mapnik::Map& map,
|
|||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
|
||||
void render_with_detector(
|
||||
const mapnik::Map &map,
|
||||
mapnik::image_32 &image,
|
||||
boost::shared_ptr<mapnik::label_collision_detector4> detector,
|
||||
double scale_factor = 1.0,
|
||||
unsigned offset_x = 0u,
|
||||
unsigned offset_y = 0u)
|
||||
{
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
try
|
||||
{
|
||||
mapnik::agg_renderer<mapnik::image_32> ren(map,image,detector);
|
||||
ren.apply();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Py_BLOCK_THREADS
|
||||
throw;
|
||||
}
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
|
||||
void render_layer2(const mapnik::Map& map,
|
||||
mapnik::image_32& image,
|
||||
unsigned layer_idx)
|
||||
|
@ -374,6 +397,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_string_overloads, load_map_string, 2, 4
|
|||
BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_overloads, save_map, 2, 3)
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_to_string_overloads, save_map_to_string, 1, 2)
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS(render_overloads, render, 2, 5)
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS(render_with_detector_overloads, render_with_detector, 3, 6)
|
||||
|
||||
BOOST_PYTHON_MODULE(_mapnik2)
|
||||
{
|
||||
|
@ -427,6 +451,7 @@ BOOST_PYTHON_MODULE(_mapnik2)
|
|||
export_raster_colorizer();
|
||||
export_glyph_symbolizer();
|
||||
export_inmem_metawriter();
|
||||
export_label_collision_detector();
|
||||
|
||||
def("render_grid",&render_grid,
|
||||
( arg("map"),
|
||||
|
@ -503,6 +528,19 @@ BOOST_PYTHON_MODULE(_mapnik2)
|
|||
"\n"
|
||||
));
|
||||
|
||||
def("render_with_detector", &render_with_detector, render_with_detector_overloads(
|
||||
"\n"
|
||||
"Render Map to an AGG image_32 using a pre-constructed detector.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> from mapnik import Map, Image, LabelCollisionDetector, render_with_detector, load_map\n"
|
||||
">>> m = Map(256,256)\n"
|
||||
">>> load_map(m,'mapfile.xml')\n"
|
||||
">>> im = Image(m.width,m.height)\n"
|
||||
">>> detector = LabelCollisionDetector(m)\n"
|
||||
">>> render_with_detector(m, im, detector)\n"
|
||||
));
|
||||
|
||||
def("render_layer", &render_layer2,
|
||||
(arg("map"),arg("image"),args("layer"))
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -35,6 +36,6 @@ info_dialog::info_dialog(QVector<QPair<QString,QString> > const& info, QWidget *
|
|||
QTableWidgetItem *keyItem = new QTableWidgetItem(info[i].first);
|
||||
QTableWidgetItem *valueItem = new QTableWidgetItem(info[i].second);
|
||||
ui.tableWidget->setItem(i,0,keyItem);
|
||||
ui.tableWidget->setItem(i,1,valueItem);
|
||||
ui.tableWidget->setItem(i,1,valueItem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -28,15 +29,15 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent)
|
|||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
ui.tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Name"));
|
||||
ui.tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Value"));
|
||||
|
||||
|
||||
// Layer name
|
||||
ui.layerNameEdit->setText(QString(lay.name().c_str()));
|
||||
|
||||
// Named Styles : TODO!!!
|
||||
|
||||
|
||||
// Datasource
|
||||
mapnik::datasource_ptr ds = lay.datasource();
|
||||
if (ds)
|
||||
|
@ -57,10 +58,10 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent)
|
|||
QTableWidgetItem *keyItem = new QTableWidgetItem(QString(pos->first.c_str()));
|
||||
QTableWidgetItem *valueItem = new QTableWidgetItem(QString((*result).c_str()));
|
||||
ui.tableWidget->setItem(index,0,keyItem);
|
||||
ui.tableWidget->setItem(index,1,valueItem);
|
||||
ui.tableWidget->setItem(index,1,valueItem);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,7 +38,7 @@ void LayerDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
|||
else
|
||||
painter->setBrush(QBrush(QColor(255, 0, 0, 64)));
|
||||
|
||||
|
||||
|
||||
painter->drawRoundRect(option.rect,4,4);
|
||||
|
||||
if (option.state & QStyle::State_Selected)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,11 +33,11 @@ class QPainter;
|
|||
class LayerDelegate : public QAbstractItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
LayerDelegate(QObject *parent = 0);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index ) const;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -61,7 +62,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
|
|||
{
|
||||
if (map_->layers().at(index.row()).isActive())
|
||||
return QVariant(Qt::Checked);
|
||||
else
|
||||
else
|
||||
return QVariant(Qt::Unchecked);
|
||||
}
|
||||
else
|
||||
|
@ -75,7 +76,7 @@ QVariant LayerListModel::headerData(int section, Qt::Orientation orientation,
|
|||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
|
||||
if (orientation == Qt::Horizontal)
|
||||
return QString("TODO Column %1").arg(section);
|
||||
else
|
||||
|
@ -86,22 +87,22 @@ bool LayerListModel::setData(const QModelIndex &index,
|
|||
const QVariant &value, int role)
|
||||
{
|
||||
if (!map_) return false;
|
||||
|
||||
|
||||
if (index.isValid() && role == Qt::CheckStateRole)
|
||||
{
|
||||
int status = value.toInt();
|
||||
int status = value.toInt();
|
||||
std::vector<mapnik::layer> & layers = const_cast<std::vector<mapnik::layer>& >(map_->layers());
|
||||
layers.at(index.row()).setActive(status);
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags LayerListModel::flags(QModelIndex const& index) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
|
||||
|
||||
|
||||
if (index.isValid())
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
return flags;
|
||||
|
@ -121,4 +122,4 @@ boost::optional<mapnik::layer&> LayerListModel::map_layer(int i)
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -36,10 +37,10 @@ class LayerListModel : public QAbstractListModel
|
|||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
int role = Qt::DisplayRole) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole);
|
||||
Qt::ItemFlags flags(QModelIndex const& index) const;
|
||||
Qt::ItemFlags flags(QModelIndex const& index) const;
|
||||
boost::optional<mapnik::layer&> map_layer(int i);
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -41,7 +42,7 @@ LayerTab::LayerTab(QWidget* parent)
|
|||
|
||||
void LayerTab::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QListView::paintEvent(e);
|
||||
QListView::paintEvent(e);
|
||||
}
|
||||
|
||||
void LayerTab::dataChanged(const QModelIndex &topLeft,
|
||||
|
@ -55,7 +56,7 @@ void LayerTab::dataChanged(const QModelIndex &topLeft,
|
|||
void LayerTab::selectionChanged(const QItemSelection & selected, const QItemSelection &)
|
||||
{
|
||||
QModelIndexList list = selected.indexes();
|
||||
if (list.size() != 0)
|
||||
if (list.size() != 0)
|
||||
{
|
||||
std::cout << "SELECTED LAYER ->" << list[0].row() << "\n";
|
||||
emit layerSelected(list[0].row());
|
||||
|
@ -69,7 +70,7 @@ void LayerTab::layerInfo()
|
|||
if (indexes.size() > 0)
|
||||
{
|
||||
qDebug("id = %d",indexes[0].row());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +82,7 @@ void LayerTab::layerInfo2(QModelIndex const& index)
|
|||
unsigned i = index.row();
|
||||
LayerListModel * model = static_cast<LayerListModel*>(this->model());
|
||||
boost::optional<mapnik::layer&> layer = model->map_layer(i);
|
||||
|
||||
|
||||
if (layer)
|
||||
{
|
||||
layer_info_dialog dlg(*layer,this);
|
||||
|
@ -91,7 +92,7 @@ void LayerTab::layerInfo2(QModelIndex const& index)
|
|||
|
||||
StyleTab::StyleTab(QWidget*)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void StyleTab::contextMenuEvent(QContextMenuEvent * event )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,10 +34,10 @@ class LayerTab : public QListView
|
|||
void paintEvent(QPaintEvent *e);
|
||||
signals:
|
||||
void update_mapwidget();
|
||||
void layerSelected(int) const;
|
||||
void layerSelected(int) const;
|
||||
public slots:
|
||||
void layerInfo();
|
||||
void layerInfo2(QModelIndex const&);
|
||||
void layerInfo();
|
||||
void layerInfo2(QModelIndex const&);
|
||||
protected slots:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
void selectionChanged(const QItemSelection & selected, const QItemSelection &);
|
||||
|
@ -51,4 +52,4 @@ protected:
|
|||
void contextMenuEvent(QContextMenuEvent * event );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,13 +35,13 @@ int main( int argc, char **argv )
|
|||
{
|
||||
using mapnik::datasource_cache;
|
||||
using mapnik::freetype_engine;
|
||||
|
||||
|
||||
QCoreApplication::setOrganizationName("Mapnik");
|
||||
QCoreApplication::setOrganizationDomain("mapnik.org");
|
||||
QCoreApplication::setApplicationName("Viewer");
|
||||
|
||||
|
||||
QSettings settings("viewer.ini",QSettings::IniFormat);
|
||||
|
||||
|
||||
// register input plug-ins
|
||||
QString plugins_dir = settings.value("mapnik/plugins_dir",
|
||||
QVariant("/usr/local/lib/mapnik2/input/")).toString();
|
||||
|
@ -54,8 +55,8 @@ int main( int argc, char **argv )
|
|||
freetype_engine::register_fonts(font_dir.toStdString());
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
QApplication app( argc, argv );
|
||||
|
||||
QApplication app( argc, argv );
|
||||
MainWindow window;
|
||||
window.show();
|
||||
if (argc > 1) window.open(argv[1]);
|
||||
|
@ -82,5 +83,5 @@ int main( int argc, char **argv )
|
|||
double scaling_factor = QString(argv[3]).toDouble(&ok);
|
||||
if (ok) window.set_scaling_factor(scaling_factor);
|
||||
}
|
||||
return app.exec();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -47,42 +48,42 @@
|
|||
MainWindow::MainWindow()
|
||||
: filename_(),
|
||||
default_extent_(-20037508.3428,-20037508.3428,20037508.3428,20037508.3428)
|
||||
{
|
||||
{
|
||||
mapWidget_ = new MapWidget(this);
|
||||
QSplitter *splitter = new QSplitter(this);
|
||||
QSplitter *splitter = new QSplitter(this);
|
||||
QTabWidget *tabWidget=new QTabWidget;
|
||||
layerTab_ = new LayerTab;
|
||||
layerTab_->setFocusPolicy(Qt::NoFocus);
|
||||
layerTab_->setIconSize(QSize(16,16));
|
||||
|
||||
//LayerDelegate *delegate = new LayerDelegate(this);
|
||||
|
||||
//LayerDelegate *delegate = new LayerDelegate(this);
|
||||
//layerTab_->setItemDelegate(delegate);
|
||||
//layerTab_->setItemDelegate(new QItemDelegate(this));
|
||||
//layerTab_->setViewMode(QListView::IconMode);
|
||||
|
||||
|
||||
layerTab_->setFlow(QListView::TopToBottom);
|
||||
tabWidget->addTab(layerTab_,tr("Layers"));
|
||||
|
||||
// Styles tab
|
||||
styleTab_ = new StyleTab;
|
||||
tabWidget->addTab(styleTab_,tr("Styles"));
|
||||
tabWidget->addTab(styleTab_,tr("Styles"));
|
||||
splitter->addWidget(tabWidget);
|
||||
splitter->addWidget(mapWidget_);
|
||||
QList<int> list;
|
||||
list.push_back(200);
|
||||
list.push_back(600);
|
||||
splitter->setSizes(list);
|
||||
|
||||
|
||||
mapWidget_->setFocusPolicy(Qt::StrongFocus);
|
||||
mapWidget_->setFocus();
|
||||
|
||||
|
||||
//setCentralWidget(mapWidget_);
|
||||
setCentralWidget(splitter);
|
||||
createActions();
|
||||
createMenus();
|
||||
createToolBars();
|
||||
createContextMenu();
|
||||
|
||||
|
||||
setWindowTitle(tr("Mapnik Viewer"));
|
||||
status=new QStatusBar(this);
|
||||
status->showMessage(tr(""));
|
||||
|
@ -91,11 +92,11 @@ MainWindow::MainWindow()
|
|||
|
||||
//connect mapview to layerlist
|
||||
connect(mapWidget_, SIGNAL(mapViewChanged()),layerTab_, SLOT(update()));
|
||||
// slider
|
||||
// slider
|
||||
connect(slider_,SIGNAL(valueChanged(int)),mapWidget_,SLOT(zoomToLevel(int)));
|
||||
//
|
||||
//
|
||||
connect(layerTab_,SIGNAL(update_mapwidget()),mapWidget_,SLOT(updateMap()));
|
||||
connect(layerTab_,SIGNAL(layerSelected(int)),
|
||||
connect(layerTab_,SIGNAL(layerSelected(int)),
|
||||
mapWidget_,SLOT(layerSelected(int)));
|
||||
}
|
||||
|
||||
|
@ -128,21 +129,21 @@ void MainWindow::open(QString const& path)
|
|||
{
|
||||
filename_ = path;
|
||||
}
|
||||
|
||||
|
||||
if (!filename_.isEmpty())
|
||||
{
|
||||
|
||||
|
||||
load_map_file(filename_);
|
||||
setWindowTitle(tr("%1 - Mapnik Viewer").arg(filename_));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::reload()
|
||||
{
|
||||
if (!filename_.isEmpty())
|
||||
{
|
||||
|
||||
|
||||
mapnik::box2d<double> bbox = mapWidget_->getMap()->get_current_extent();
|
||||
load_map_file(filename_);
|
||||
mapWidget_->zoomToBox(bbox);
|
||||
|
@ -157,7 +158,7 @@ void MainWindow::save()
|
|||
initialPath,
|
||||
tr("%1 Files (*.xml)")
|
||||
.arg(QString("Mapnik definition")));
|
||||
if (!filename.isEmpty())
|
||||
if (!filename.isEmpty())
|
||||
{
|
||||
std::cout<<"saving "<< filename.toStdString() << std::endl;
|
||||
mapnik::save_map(*mapWidget_->getMap(),filename.toStdString());
|
||||
|
@ -166,16 +167,16 @@ void MainWindow::save()
|
|||
|
||||
void MainWindow::load_map_file(QString const& filename)
|
||||
{
|
||||
std::cout<<"loading "<< filename.toStdString() << std::endl;
|
||||
std::cout<<"loading "<< filename.toStdString() << std::endl;
|
||||
unsigned width = mapWidget_->width();
|
||||
unsigned height = mapWidget_->height();
|
||||
boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
|
||||
boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height));
|
||||
mapWidget_->setMap(map);
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
mapnik::load_map(*map,filename.toStdString());
|
||||
}
|
||||
catch (mapnik::config_error & ex)
|
||||
catch (mapnik::config_error & ex)
|
||||
{
|
||||
std::cout << ex.what() << "\n";
|
||||
}
|
||||
|
@ -195,7 +196,7 @@ void MainWindow::zoom_to_box()
|
|||
|
||||
void MainWindow::pan()
|
||||
{
|
||||
mapWidget_->setTool(MapWidget::Pan);
|
||||
mapWidget_->setTool(MapWidget::Pan);
|
||||
}
|
||||
|
||||
void MainWindow::info()
|
||||
|
@ -240,7 +241,7 @@ void MainWindow::export_as()
|
|||
tr("%1 Files (*.%2);;All Files (*)")
|
||||
.arg(QString(fileFormat.toUpper()))
|
||||
.arg(QString(fileFormat)));
|
||||
if (!fileName.isEmpty())
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
QPixmap const& pix = mapWidget_->pixmap();
|
||||
pix.save(fileName);
|
||||
|
@ -248,8 +249,8 @@ void MainWindow::export_as()
|
|||
}
|
||||
|
||||
void MainWindow::print()
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
//Q_ASSERT(mapWidget_->pixmap());
|
||||
//QPrintDialog dialog(&printer, this);
|
||||
//if (dialog.exec()) {
|
||||
|
@ -264,31 +265,31 @@ void MainWindow::print()
|
|||
}
|
||||
|
||||
void MainWindow::createActions()
|
||||
{
|
||||
{
|
||||
//exportAct = new QAction(tr("&Export as ..."),this);
|
||||
//exportAct->setShortcut(tr("Ctrl+E"));
|
||||
//connect(exportAct, SIGNAL(triggered()), this, SLOT(export_as()));
|
||||
zoomAllAct = new QAction(QIcon(":/images/home.png"),tr("Zoom All"),this);
|
||||
connect(zoomAllAct, SIGNAL(triggered()), this, SLOT(zoom_all()));
|
||||
|
||||
|
||||
zoomBoxAct = new QAction(QIcon(":/images/zoombox.png"),tr("Zoom To Box"),this);
|
||||
zoomBoxAct->setCheckable(true);
|
||||
connect(zoomBoxAct, SIGNAL(triggered()), this, SLOT(zoom_to_box()));
|
||||
|
||||
|
||||
panAct = new QAction(QIcon(":/images/pan.png"),tr("Pan"),this);
|
||||
panAct->setCheckable(true);
|
||||
connect(panAct, SIGNAL(triggered()), this, SLOT(pan()));
|
||||
|
||||
|
||||
infoAct = new QAction(QIcon(":/images/info.png"),tr("Info"),this);
|
||||
infoAct->setCheckable(true);
|
||||
connect(infoAct, SIGNAL(triggered()), this, SLOT(info()));
|
||||
|
||||
|
||||
toolsGroup=new QActionGroup(this);
|
||||
toolsGroup->addAction(zoomBoxAct);
|
||||
toolsGroup->addAction(panAct);
|
||||
toolsGroup->addAction(infoAct);
|
||||
zoomBoxAct->setChecked(true);
|
||||
|
||||
|
||||
openAct=new QAction(tr("Open Map definition"),this);
|
||||
connect(openAct,SIGNAL(triggered()),this,SLOT(open()));
|
||||
saveAct=new QAction(tr("Save Map definition"),this);
|
||||
|
@ -302,27 +303,27 @@ void MainWindow::createActions()
|
|||
connect(panUpAct, SIGNAL(triggered()), this, SLOT(pan_up()));
|
||||
panDownAct = new QAction(QIcon(":/images/down.png"),tr("&Pan Down"),this);
|
||||
connect(panDownAct, SIGNAL(triggered()), this, SLOT(pan_down()));
|
||||
|
||||
|
||||
reloadAct = new QAction(QIcon(":/images/reload.png"),tr("Reload"),this);
|
||||
connect(reloadAct, SIGNAL(triggered()), this, SLOT(reload()));
|
||||
|
||||
|
||||
layerInfo = new QAction(QIcon(":/images/info.png"),tr("&Layer info"),layerTab_);
|
||||
connect(layerInfo, SIGNAL(triggered()), layerTab_,SLOT(layerInfo()));
|
||||
connect(layerTab_, SIGNAL(doubleClicked(QModelIndex const&)), layerTab_,SLOT(layerInfo2(QModelIndex const&)));
|
||||
foreach (QByteArray format, QImageWriter::supportedImageFormats())
|
||||
foreach (QByteArray format, QImageWriter::supportedImageFormats())
|
||||
{
|
||||
QString text = tr("%1...").arg(QString(format).toUpper());
|
||||
|
||||
|
||||
QAction *action = new QAction(text, this);
|
||||
action->setData(format);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(export_as()));
|
||||
exportAsActs.append(action);
|
||||
}
|
||||
|
||||
|
||||
printAct = new QAction(QIcon(":/images/print.png"),tr("&Print ..."),this);
|
||||
printAct->setShortcut(tr("Ctrl+E"));
|
||||
connect(printAct, SIGNAL(triggered()), this, SLOT(print()));
|
||||
|
||||
|
||||
exitAct = new QAction(tr("E&xit"), this);
|
||||
exitAct->setShortcut(tr("Ctrl+Q"));
|
||||
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
||||
|
@ -335,8 +336,8 @@ void MainWindow::createMenus()
|
|||
{
|
||||
exportMenu = new QMenu(tr("&Export As"), this);
|
||||
foreach (QAction *action, exportAsActs)
|
||||
exportMenu->addAction(action);
|
||||
|
||||
exportMenu->addAction(action);
|
||||
|
||||
fileMenu = new QMenu(tr("&File"),this);
|
||||
fileMenu->addAction(openAct);
|
||||
fileMenu->addAction(saveAct);
|
||||
|
@ -345,7 +346,7 @@ void MainWindow::createMenus()
|
|||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(exitAct);
|
||||
menuBar()->addMenu(fileMenu);
|
||||
|
||||
|
||||
helpMenu = new QMenu(tr("&Help"), this);
|
||||
helpMenu->addAction(aboutAct);
|
||||
menuBar()->addMenu(helpMenu);
|
||||
|
@ -377,10 +378,10 @@ void MainWindow::createToolBars()
|
|||
|
||||
void MainWindow::set_default_extent(double x0,double y0, double x1, double y1)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
boost::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
|
||||
if (map_ptr)
|
||||
if (map_ptr)
|
||||
{
|
||||
mapnik::projection prj(map_ptr->srs());
|
||||
prj.forward(x0,y0);
|
||||
|
@ -401,7 +402,7 @@ void MainWindow::set_scaling_factor(double scaling_factor)
|
|||
void MainWindow::zoom_all()
|
||||
{
|
||||
boost::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
|
||||
if (map_ptr)
|
||||
if (map_ptr)
|
||||
{
|
||||
map_ptr->zoom_all();
|
||||
mapnik::box2d<double> const& ext = map_ptr->get_current_extent();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -67,7 +68,7 @@ private:
|
|||
void createToolBars();
|
||||
void createContextMenu();
|
||||
void load_map_file(QString const& filename);
|
||||
|
||||
|
||||
|
||||
QString currentPath;
|
||||
QString filename_;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -63,7 +64,7 @@ double scales [] = {279541132.014,
|
|||
1066.36479192,
|
||||
533.182395962};
|
||||
|
||||
MapWidget::MapWidget(QWidget *parent)
|
||||
MapWidget::MapWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
map_(),
|
||||
selected_(1),
|
||||
|
@ -90,9 +91,9 @@ void MapWidget::setTool(eTool tool)
|
|||
}
|
||||
|
||||
void MapWidget::paintEvent(QPaintEvent*)
|
||||
{
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
|
||||
if (drag_)
|
||||
{
|
||||
if (cur_tool_ == ZoomToBox)
|
||||
|
@ -119,7 +120,7 @@ void MapWidget::paintEvent(QPaintEvent*)
|
|||
}
|
||||
painter.end();
|
||||
}
|
||||
|
||||
|
||||
void MapWidget::resizeEvent(QResizeEvent * ev)
|
||||
{
|
||||
if (map_)
|
||||
|
@ -128,10 +129,10 @@ void MapWidget::resizeEvent(QResizeEvent * ev)
|
|||
updateMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MapWidget::mousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
if (e->button()==Qt::LeftButton)
|
||||
if (e->button()==Qt::LeftButton)
|
||||
{
|
||||
if (cur_tool_ == ZoomToBox || cur_tool_==Pan)
|
||||
{
|
||||
|
@ -142,17 +143,17 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
else if (cur_tool_==Info)
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
{
|
||||
QVector<QPair<QString,QString> > info;
|
||||
|
||||
|
||||
projection map_proj(map_->srs()); // map projection
|
||||
double scale_denom = scale_denominator(*map_,map_proj.is_geographic());
|
||||
CoordTransform t(map_->width(),map_->height(),map_->get_current_extent());
|
||||
|
||||
|
||||
for (unsigned index = 0; index < map_->layer_count();++index)
|
||||
{
|
||||
if (int(index) != selectedLayer_) continue;
|
||||
|
||||
|
||||
layer & layer = map_->layers()[index];
|
||||
if (!layer.isVisible(scale_denom)) continue;
|
||||
std::string name = layer.name();
|
||||
|
@ -163,11 +164,11 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
mapnik::proj_transform prj_trans(map_proj,layer_proj);
|
||||
//std::auto_ptr<mapnik::memory_datasource> data(new mapnik::memory_datasource);
|
||||
mapnik::featureset_ptr fs = map_->query_map_point(index,x,y);
|
||||
|
||||
|
||||
if (fs)
|
||||
{
|
||||
feature_ptr feat = fs->next();
|
||||
if (feat)
|
||||
if (feat)
|
||||
{
|
||||
std::map<std::string,mapnik::value> const& props = feat->props();
|
||||
std::map<std::string,mapnik::value>::const_iterator itr=props.begin();
|
||||
|
@ -180,10 +181,10 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
}
|
||||
}
|
||||
typedef mapnik::coord_transform2<mapnik::CoordTransform,mapnik::geometry_type> path_type;
|
||||
|
||||
|
||||
for (unsigned i=0; i<feat->num_geometries();++i)
|
||||
{
|
||||
mapnik::geometry_type & geom = feat->get_geometry(i);
|
||||
mapnik::geometry_type & geom = feat->get_geometry(i);
|
||||
path_type path(t,geom,prj_trans);
|
||||
if (geom.num_points() > 0)
|
||||
{
|
||||
|
@ -208,7 +209,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (info.size() > 0)
|
||||
{
|
||||
info_dialog info_dlg(info,this);
|
||||
|
@ -216,34 +217,34 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remove annotation layer
|
||||
map_->layers().erase(remove_if(map_->layers().begin(),
|
||||
map_->layers().end(),
|
||||
bind(&layer::name,_1) == "*annotations*")
|
||||
, map_->layers().end());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e->button()==Qt::RightButton)
|
||||
{
|
||||
else if (e->button()==Qt::RightButton)
|
||||
{
|
||||
//updateMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MapWidget::mouseMoveEvent(QMouseEvent* e)
|
||||
{
|
||||
{
|
||||
if (cur_tool_ == ZoomToBox || cur_tool_==Pan)
|
||||
{
|
||||
end_x_ = e->x();
|
||||
end_y_ = e->y();
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MapWidget::mouseReleaseEvent(QMouseEvent* e)
|
||||
{
|
||||
if (e->button()==Qt::LeftButton)
|
||||
if (e->button()==Qt::LeftButton)
|
||||
{
|
||||
end_x_ = e->x();
|
||||
end_y_ = e->y();
|
||||
|
@ -252,7 +253,7 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
|
|||
drag_=false;
|
||||
if (map_)
|
||||
{
|
||||
CoordTransform t(map_->width(),map_->height(),map_->get_current_extent());
|
||||
CoordTransform t(map_->width(),map_->height(),map_->get_current_extent());
|
||||
box2d<double> box = t.backward(box2d<double>(start_x_,start_y_,end_x_,end_y_));
|
||||
map_->zoom_to_box(box);
|
||||
updateMap();
|
||||
|
@ -267,7 +268,7 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
|
|||
int cy = int(0.5 * map_->height());
|
||||
int dx = end_x_ - start_x_;
|
||||
int dy = end_y_ - start_y_;
|
||||
map_->pan(cx - dx ,cy - dy);
|
||||
map_->pan(cx - dx ,cy - dy);
|
||||
updateMap();
|
||||
}
|
||||
}
|
||||
|
@ -275,10 +276,10 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
|
|||
}
|
||||
|
||||
|
||||
void MapWidget::keyPressEvent(QKeyEvent *e)
|
||||
void MapWidget::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
std::cout << "key pressed:"<< e->key()<<"\n";
|
||||
switch (e->key()) {
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Minus:
|
||||
zoomOut();
|
||||
break;
|
||||
|
@ -294,10 +295,10 @@ void MapWidget::keyPressEvent(QKeyEvent *e)
|
|||
break;
|
||||
case Qt::Key_Down:
|
||||
panDown();
|
||||
break;
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
panLeft();
|
||||
break;
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
panRight();
|
||||
break;
|
||||
|
@ -309,7 +310,7 @@ void MapWidget::keyPressEvent(QKeyEvent *e)
|
|||
break;
|
||||
case 51:
|
||||
zoomToLevel(12);
|
||||
break;
|
||||
break;
|
||||
case 52:
|
||||
zoomToLevel(13);
|
||||
break;
|
||||
|
@ -318,7 +319,7 @@ void MapWidget::keyPressEvent(QKeyEvent *e)
|
|||
break;
|
||||
case 54:
|
||||
zoomToLevel(15);
|
||||
break;
|
||||
break;
|
||||
case 55:
|
||||
zoomToLevel(16);
|
||||
break;
|
||||
|
@ -327,12 +328,12 @@ void MapWidget::keyPressEvent(QKeyEvent *e)
|
|||
break;
|
||||
case 57:
|
||||
zoomToLevel(18);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
QWidget::keyPressEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MapWidget::zoomToBox(mapnik::box2d<double> const& bbox)
|
||||
|
@ -344,7 +345,7 @@ void MapWidget::zoomToBox(mapnik::box2d<double> const& bbox)
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::defaultView()
|
||||
void MapWidget::defaultView()
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
|
@ -354,7 +355,7 @@ void MapWidget::defaultView()
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::zoomIn()
|
||||
void MapWidget::zoomIn()
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
|
@ -363,7 +364,7 @@ void MapWidget::zoomIn()
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::zoomOut()
|
||||
void MapWidget::zoomOut()
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
|
@ -406,12 +407,12 @@ void MapWidget::panLeft()
|
|||
}
|
||||
|
||||
void MapWidget::panRight()
|
||||
{
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
double cx = 0.5*map_->width();
|
||||
double cy = 0.5*map_->height();
|
||||
map_->pan(int(cx + cx * 0.25),int(cy));
|
||||
map_->pan(int(cx + cx * 0.25),int(cy));
|
||||
updateMap();
|
||||
}
|
||||
}
|
||||
|
@ -425,11 +426,11 @@ void MapWidget::zoomToLevel(int level)
|
|||
std::cerr << "scale denominator = " << scale_denom << "\n";
|
||||
mapnik::box2d<double> ext = map_->get_current_extent();
|
||||
double width = static_cast<double>(map_->width());
|
||||
double height= static_cast<double>(map_->height());
|
||||
double height= static_cast<double>(map_->height());
|
||||
mapnik::coord2d pt = ext.center();
|
||||
|
||||
double res = scale_denom * 0.00028;
|
||||
|
||||
|
||||
mapnik::box2d<double> box(pt.x - 0.5 * width * res,
|
||||
pt.y - 0.5 * height*res,
|
||||
pt.x + 0.5 * width * res,
|
||||
|
@ -439,37 +440,37 @@ void MapWidget::zoomToLevel(int level)
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&)
|
||||
void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&)
|
||||
{
|
||||
//image_32 image(width,height);
|
||||
//agg_renderer renderer(map,image);
|
||||
//renderer.apply();
|
||||
//image.saveToFile(filename,type);
|
||||
}
|
||||
|
||||
|
||||
void MapWidget::set_scaling_factor(double scaling_factor)
|
||||
{
|
||||
scaling_factor_ = scaling_factor;
|
||||
}
|
||||
|
||||
void MapWidget::updateMap()
|
||||
{
|
||||
void MapWidget::updateMap()
|
||||
{
|
||||
if (map_)
|
||||
{
|
||||
unsigned width=map_->width();
|
||||
unsigned height=map_->height();
|
||||
|
||||
|
||||
image_32 buf(width,height);
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
mapnik::agg_renderer<image_32> ren(*map_,buf,scaling_factor_);
|
||||
ren.apply();
|
||||
|
||||
|
||||
QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32);
|
||||
pix_=QPixmap::fromImage(image.rgbSwapped());
|
||||
projection prj(map_->srs()); // map projection
|
||||
|
||||
|
||||
box2d<double> ext = map_->get_current_extent();
|
||||
double x0 = ext.minx();
|
||||
double y0 = ext.miny();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,19 +33,19 @@
|
|||
#include <boost/scoped_ptr.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
|
||||
class MapWidget : public QWidget
|
||||
class MapWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum eTool
|
||||
|
||||
public:
|
||||
enum eTool
|
||||
{
|
||||
ZoomToBox = 1,
|
||||
Pan,
|
||||
Info,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
boost::shared_ptr<mapnik::Map> map_;
|
||||
int selected_;
|
||||
QPixmap pix_;
|
||||
|
@ -64,7 +65,7 @@ public:
|
|||
void setTool(eTool tool);
|
||||
boost::shared_ptr<mapnik::Map> getMap();
|
||||
inline QPixmap const& pixmap() const { return pix_;}
|
||||
void setMap(boost::shared_ptr<mapnik::Map> map);
|
||||
void setMap(boost::shared_ptr<mapnik::Map> map);
|
||||
void defaultView();
|
||||
void zoomToBox(mapnik::box2d<double> const& box);
|
||||
void zoomIn();
|
||||
|
@ -80,7 +81,7 @@ public slots:
|
|||
void layerSelected(int);
|
||||
signals:
|
||||
void mapViewChanged();
|
||||
protected:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* ev);
|
||||
void resizeEvent(QResizeEvent* ev);
|
||||
void mousePressEvent(QMouseEvent* e);
|
||||
|
@ -89,8 +90,8 @@ protected:
|
|||
void keyPressEvent(QKeyEvent *e);
|
||||
void export_to_file(unsigned width,
|
||||
unsigned height,
|
||||
std::string const& filename,
|
||||
std::string const& type);
|
||||
std::string const& filename,
|
||||
std::string const& type);
|
||||
};
|
||||
|
||||
#endif // MAP_WIDGET_HPP
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,60 +39,60 @@ class node : private boost::noncopyable
|
|||
virtual QIcon icon() const=0;
|
||||
virtual ~node_base() {}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct wrap : public node_base
|
||||
{
|
||||
wrap(T const& obj)
|
||||
: obj_(obj) {}
|
||||
|
||||
|
||||
~wrap() {}
|
||||
|
||||
|
||||
QString name () const
|
||||
{
|
||||
return obj_.name();
|
||||
}
|
||||
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return obj_.icon();
|
||||
}
|
||||
|
||||
|
||||
T obj_;
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
node ( T const& obj, node * parent=0)
|
||||
: impl_(new wrap<T>(obj)),
|
||||
parent_(parent)
|
||||
{}
|
||||
|
||||
|
||||
QString name() const
|
||||
{
|
||||
return impl_->name();
|
||||
}
|
||||
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return impl_->icon();
|
||||
}
|
||||
|
||||
|
||||
unsigned num_children() const
|
||||
{
|
||||
return children_.count();
|
||||
}
|
||||
|
||||
|
||||
node * child(unsigned row) const
|
||||
{
|
||||
return children_.value(row);
|
||||
}
|
||||
|
||||
|
||||
node * parent() const
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
|
||||
|
||||
node * add_child(node * child)
|
||||
{
|
||||
children_.push_back(child);
|
||||
|
@ -104,12 +105,12 @@ public:
|
|||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
~node()
|
||||
|
||||
~node()
|
||||
{
|
||||
qDeleteAll(children_);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
boost::scoped_ptr<node_base> impl_;
|
||||
QList<node*> children_;
|
||||
|
@ -124,7 +125,7 @@ struct symbolizer_info : public boost::static_visitor<QString>
|
|||
boost::ignore_unused_variable_warning(sym);
|
||||
return QString("PointSymbolizer");
|
||||
}
|
||||
|
||||
|
||||
QString operator() (mapnik::line_symbolizer const& sym) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(sym);
|
||||
|
@ -148,19 +149,19 @@ struct symbolizer_info : public boost::static_visitor<QString>
|
|||
boost::ignore_unused_variable_warning(sym);
|
||||
return QString("PolygonSymbolizer");
|
||||
}
|
||||
|
||||
|
||||
QString operator() (mapnik::text_symbolizer const& sym) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(sym);
|
||||
return QString("TextSymbolizer");
|
||||
}
|
||||
|
||||
|
||||
QString operator() (mapnik::shield_symbolizer const& sym) const
|
||||
{
|
||||
boost::ignore_unused_variable_warning(sym);
|
||||
return QString("ShieldSymbolizer");
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
QString operator() (T const& ) const
|
||||
{
|
||||
|
@ -200,14 +201,14 @@ struct symbolizer_icon : public boost::static_visitor<QIcon>
|
|||
QPixmap pix(48,16);
|
||||
pix.fill();
|
||||
QPainter painter(&pix);
|
||||
mapnik::stroke const& strk = sym.get_stroke();
|
||||
mapnik::stroke const& strk = sym.get_stroke();
|
||||
mapnik::color const& col = strk.get_color();
|
||||
QPen pen(QColor(col.red(),col.green(),col.blue(),col.alpha()));
|
||||
pen.setWidth(strk.get_width());
|
||||
painter.setPen(pen);
|
||||
painter.drawLine(0,7,47,7);
|
||||
//painter.drawLine(7,15,12,0);
|
||||
//painter.drawLine(12,0,8,15);
|
||||
//painter.drawLine(12,0,8,15);
|
||||
return QIcon(pix);
|
||||
}
|
||||
|
||||
|
@ -224,13 +225,13 @@ public:
|
|||
symbolizer_node(mapnik::symbolizer const & sym)
|
||||
: sym_(sym) {}
|
||||
~symbolizer_node(){}
|
||||
|
||||
QString name() const
|
||||
|
||||
QString name() const
|
||||
{
|
||||
//return QString("Symbolizer:fixme");
|
||||
return boost::apply_visitor(symbolizer_info(),sym_);
|
||||
}
|
||||
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return boost::apply_visitor(symbolizer_icon(),sym_);//QIcon(":/images/filter.png");
|
||||
|
@ -248,15 +249,15 @@ public:
|
|||
QString name() const
|
||||
{
|
||||
mapnik::expression_ptr filter = rule_.get_filter();
|
||||
|
||||
|
||||
return QString(mapnik::to_expression_string(*filter).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return QIcon(":/images/filter.png");
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
mapnik::rule const& rule_;
|
||||
|
@ -268,19 +269,19 @@ public:
|
|||
style_node(QString name, mapnik::feature_type_style const& style)
|
||||
: name_(name),
|
||||
style_(style) {}
|
||||
|
||||
|
||||
~style_node() {}
|
||||
|
||||
|
||||
QString name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return QIcon(":/images/style.png");
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
mapnik::feature_type_style const& style_;
|
||||
|
@ -292,26 +293,26 @@ public:
|
|||
explicit map_node(boost::shared_ptr<mapnik::Map> map)
|
||||
: map_(map) {}
|
||||
~map_node() {}
|
||||
|
||||
|
||||
QString name() const
|
||||
{
|
||||
return QString("Map");
|
||||
}
|
||||
|
||||
|
||||
QIcon icon() const
|
||||
{
|
||||
return QIcon(":/images/map.png");
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
boost::shared_ptr<mapnik::Map> map_;
|
||||
};
|
||||
|
||||
StyleModel::StyleModel(boost::shared_ptr<mapnik::Map> map, QObject * parent)
|
||||
: QAbstractItemModel(parent),
|
||||
root_(new node(map_node(map)))
|
||||
root_(new node(map_node(map)))
|
||||
{
|
||||
typedef std::map<std::string,mapnik::feature_type_style> style_type;
|
||||
typedef std::map<std::string,mapnik::feature_type_style> style_type;
|
||||
style_type const & styles = map->styles();
|
||||
style_type::const_iterator itr = styles.begin();
|
||||
style_type::const_iterator end = styles.end();
|
||||
|
@ -329,22 +330,22 @@ StyleModel::StyleModel(boost::shared_ptr<mapnik::Map> map, QObject * parent)
|
|||
rule_n->add_child(new node(symbolizer_node(*itr3),rule_n));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyleModel::~StyleModel() {}
|
||||
|
||||
// interface
|
||||
// interface
|
||||
QModelIndex StyleModel::index (int row, int col, QModelIndex const& parent) const
|
||||
{
|
||||
// qDebug("index() row=%d col=%d parent::internalId() = %lld", row,col,parent.internalId());
|
||||
node * parent_node;
|
||||
|
||||
|
||||
if (!parent.isValid())
|
||||
parent_node = root_.get();
|
||||
else
|
||||
parent_node = static_cast<node*>(parent.internalPointer());
|
||||
|
||||
|
||||
node * child_node = parent_node->child(row);
|
||||
if (child_node)
|
||||
return createIndex(row,col,child_node);
|
||||
|
@ -358,7 +359,7 @@ QModelIndex StyleModel::parent (QModelIndex const& index) const
|
|||
node * parent_node = child_node->parent();
|
||||
if (parent_node == root_.get())
|
||||
return QModelIndex();
|
||||
|
||||
|
||||
return createIndex(parent_node->row(),0,parent_node);
|
||||
}
|
||||
|
||||
|
@ -389,7 +390,7 @@ QVariant StyleModel::data(const QModelIndex & index, int role) const
|
|||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
|
||||
|
||||
return QVariant(cur_node->name());
|
||||
}
|
||||
else if ( role == Qt::DecorationRole)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2007 Artem Pavlenko
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,11 +33,11 @@ class StyleModel : public QAbstractItemModel
|
|||
public:
|
||||
StyleModel(boost::shared_ptr<mapnik::Map> map, QObject * parent=0);
|
||||
~StyleModel();
|
||||
// interface
|
||||
// interface
|
||||
QModelIndex index (int row, int col, QModelIndex const& parent = QModelIndex()) const;
|
||||
QModelIndex parent (QModelIndex const& child) const;
|
||||
int rowCount( QModelIndex const& parent = QModelIndex()) const;
|
||||
int columnCount( QModelIndex const& parent = QModelIndex()) const;
|
||||
int columnCount( QModelIndex const& parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
|
||||
private:
|
||||
//boost::shared_ptr<mapnik::Map> map_;
|
||||
|
|
2
deps/agg/include/agg_path_storage.h
vendored
2
deps/agg/include/agg_path_storage.h
vendored
|
@ -736,7 +736,7 @@ namespace agg
|
|||
template<class VertexSource>
|
||||
void join_path(VertexSource& vs, unsigned path_id = 0)
|
||||
{
|
||||
double x, y;
|
||||
double x=0.0, y=0.0;
|
||||
unsigned cmd;
|
||||
vs.rewind(path_id);
|
||||
cmd = vs.vertex(&x, &y);
|
||||
|
|
111
deps/agg/include/agg_rasterizer_outline_aa.h
vendored
111
deps/agg/include/agg_rasterizer_outline_aa.h
vendored
|
@ -323,68 +323,65 @@ namespace agg
|
|||
int y2;
|
||||
int lprev;
|
||||
|
||||
if(close_polygon)
|
||||
if(close_polygon && (m_src_vertices.size() >= 3))
|
||||
{
|
||||
if(m_src_vertices.size() >= 3)
|
||||
dv.idx = 2;
|
||||
|
||||
v = &m_src_vertices[m_src_vertices.size() - 1];
|
||||
x1 = v->x;
|
||||
y1 = v->y;
|
||||
lprev = v->len;
|
||||
|
||||
v = &m_src_vertices[0];
|
||||
x2 = v->x;
|
||||
y2 = v->y;
|
||||
dv.lcurr = v->len;
|
||||
line_parameters prev(x1, y1, x2, y2, lprev);
|
||||
|
||||
v = &m_src_vertices[1];
|
||||
dv.x1 = v->x;
|
||||
dv.y1 = v->y;
|
||||
dv.lnext = v->len;
|
||||
dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
|
||||
|
||||
v = &m_src_vertices[dv.idx];
|
||||
dv.x2 = v->x;
|
||||
dv.y2 = v->y;
|
||||
dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
|
||||
|
||||
dv.xb1 = 0;
|
||||
dv.yb1 = 0;
|
||||
dv.xb2 = 0;
|
||||
dv.yb2 = 0;
|
||||
|
||||
switch(m_line_join)
|
||||
{
|
||||
dv.idx = 2;
|
||||
case outline_no_join:
|
||||
dv.flags = 3;
|
||||
break;
|
||||
|
||||
v = &m_src_vertices[m_src_vertices.size() - 1];
|
||||
x1 = v->x;
|
||||
y1 = v->y;
|
||||
lprev = v->len;
|
||||
case outline_miter_join:
|
||||
case outline_round_join:
|
||||
dv.flags =
|
||||
(prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
|
||||
((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
|
||||
break;
|
||||
|
||||
v = &m_src_vertices[0];
|
||||
x2 = v->x;
|
||||
y2 = v->y;
|
||||
dv.lcurr = v->len;
|
||||
line_parameters prev(x1, y1, x2, y2, lprev);
|
||||
|
||||
v = &m_src_vertices[1];
|
||||
dv.x1 = v->x;
|
||||
dv.y1 = v->y;
|
||||
dv.lnext = v->len;
|
||||
dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
|
||||
|
||||
v = &m_src_vertices[dv.idx];
|
||||
dv.x2 = v->x;
|
||||
dv.y2 = v->y;
|
||||
dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
|
||||
|
||||
dv.xb1 = 0;
|
||||
dv.yb1 = 0;
|
||||
dv.xb2 = 0;
|
||||
dv.yb2 = 0;
|
||||
|
||||
switch(m_line_join)
|
||||
{
|
||||
case outline_no_join:
|
||||
dv.flags = 3;
|
||||
break;
|
||||
|
||||
case outline_miter_join:
|
||||
case outline_round_join:
|
||||
dv.flags =
|
||||
(prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
|
||||
((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
|
||||
break;
|
||||
|
||||
case outline_miter_accurate_join:
|
||||
dv.flags = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
|
||||
{
|
||||
bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
|
||||
}
|
||||
|
||||
if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
|
||||
{
|
||||
bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
|
||||
}
|
||||
draw(dv, 0, m_src_vertices.size());
|
||||
case outline_miter_accurate_join:
|
||||
dv.flags = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
|
||||
{
|
||||
bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
|
||||
}
|
||||
|
||||
if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
|
||||
{
|
||||
bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
|
||||
}
|
||||
draw(dv, 0, m_src_vertices.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
4
deps/agg/src/agg_rounded_rect.cpp
vendored
4
deps/agg/src/agg_rounded_rect.cpp
vendored
|
@ -78,8 +78,8 @@ namespace agg
|
|||
//--------------------------------------------------------------------
|
||||
void rounded_rect::normalize_radius()
|
||||
{
|
||||
double dx = fabs(m_y2 - m_y1);
|
||||
double dy = fabs(m_x2 - m_x1);
|
||||
double dx = fabs(m_x2 - m_x1);
|
||||
double dy = fabs(m_y2 - m_y1);
|
||||
|
||||
double k = 1.0;
|
||||
double t;
|
||||
|
|
|
@ -15,11 +15,33 @@ Look through the code to get an idea, and do not hesitate to ask questions.
|
|||
|
||||
Also read the design philosophy page for the motivations that lead to code decisions.
|
||||
|
||||
Templates are good, within reason. We seek to use templates were possible for flexible code, but not in cases where functional
|
||||
patterns would be just as concise and clear.
|
||||
|
||||
In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG, besides producing the best visual output, strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much.
|
||||
|
||||
You will also notice that we don't use many of the standard geo libraries when we could. For instance we don't use GDAL, OGR, or GEOS anywhere in core, and only leverage them in optional plugins. We feel we can often write code that is faster and more thread safe than these libraries but that still does the job. If this ever changes we can adapt and start using these libraries or others as dependencies - nothing is nicer than standing on the shoulders of giants when it makes sense.
|
||||
|
||||
|
||||
## Code commits best practices.
|
||||
|
||||
#### Big changes - awesome as pull requests
|
||||
|
||||
We love big, aggressive refactoring - but ideally in branches. Even if the changes should go directly into the mainline code and are stable, very big changes are useful to see as a group and branches are cheap. So, branch and commit then create a pull request against master so that other developers can take a quick look. This is a great way for informal code review when a full issue is not warrented.
|
||||
|
||||
#### Commits that fix issues should note the issue #
|
||||
|
||||
git commit plugins/input/ogr/ -m "implemented sql query in OGR plugin (closes #472)"
|
||||
|
||||
#### Commits that relate to issues should reference them:
|
||||
|
||||
git commit tests/python_tests/sqlite_test.py -m "more robust sqlite tests - refs #928"
|
||||
|
||||
#### Commits that add a new feature or fix should be added to the CHANGELOG
|
||||
|
||||
Ideally the CHANGELOG can be a very concise place to look for the most important recent development and should not read like a full commit log. So, some developers may prefer to weekly or monthly look back over their commits and summarize all at once with additions to the CHANGELOG. Other developers may prefer to add as they go.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Mapnik is licensed LGPL, which means that you are a free to use the code in any of your applications whether they be open source or not. It also means that if you contribute code to Mapnik that others are free to continue using Mapnik in the same way, even with your new additions. If you choose to redistribute an application using Mapnik just make sure to provide any source code modifications you make back to the community. For the actual details see the full LGPL license in the COPYING doc.
|
||||
|
@ -67,13 +89,19 @@ If you see bits of code around that do not follow these please don't hesitate to
|
|||
|
||||
#### Indentation is four spaces
|
||||
|
||||
#### Use C++ style casts
|
||||
|
||||
static_cast<int>(value); // yes
|
||||
|
||||
(int)value; // no
|
||||
|
||||
#### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible
|
||||
|
||||
#### Function definitions should not be separated from their arguments:
|
||||
|
||||
void foo(int a) { ... } // please
|
||||
void foo(int a) // please
|
||||
|
||||
void foo (int a) { ... } // no
|
||||
void foo (int a) // no
|
||||
|
||||
#### Separate arguments by a single space:
|
||||
|
||||
|
@ -87,7 +115,18 @@ If you see bits of code around that do not follow these please don't hesitate to
|
|||
|
||||
if(a==b) // no
|
||||
|
||||
#### Braces should ideally be on a separate line:
|
||||
#### Braces should always be used:
|
||||
|
||||
if (!file)
|
||||
{
|
||||
throw mapnik::datasource_exception("not found"); // please
|
||||
}
|
||||
|
||||
if (!file)
|
||||
throw mapnik::datasource_exception("not found"); // no
|
||||
|
||||
|
||||
#### Braces should be on a separate line:
|
||||
|
||||
if (a == b)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2010 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,15 +19,16 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_AGG_PATTERN_SOURCE_HPP
|
||||
#define MAPNIK_AGG_PATTERN_SOURCE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_color_rgba.h"
|
||||
|
||||
|
@ -61,4 +62,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //MAPNIK_AGG_PATTERN_SOURCE_HPP
|
||||
#endif // MAPNIK_AGG_PATTERN_SOURCE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2010 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,12 +19,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_AGG_RASTERIZER_HPP
|
||||
#define MAPNIK_AGG_RASTERIZER_HPP
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
|
||||
namespace mapnik {
|
||||
|
@ -33,4 +35,4 @@ struct rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {};
|
|||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_AGG_RASTERIZER_HPP
|
||||
#endif // MAPNIK_AGG_RASTERIZER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef AGG_RENDERER_HPP
|
||||
#define AGG_RENDERER_HPP
|
||||
#ifndef MAPNIK_AGG_RENDERER_HPP
|
||||
#define MAPNIK_AGG_RENDERER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
@ -40,6 +38,7 @@
|
|||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// FIXME
|
||||
// forward declare so that
|
||||
|
@ -61,7 +60,11 @@ class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T>
|
|||
{
|
||||
|
||||
public:
|
||||
// create with default, empty placement detector
|
||||
agg_renderer(Map const& m, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
// create with external placement detector, possibly non-empty
|
||||
agg_renderer(Map const &m, T & pixmap, boost::shared_ptr<label_collision_detector4> detector,
|
||||
double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
~agg_renderer();
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
|
@ -122,9 +125,11 @@ private:
|
|||
CoordTransform t_;
|
||||
freetype_engine font_engine_;
|
||||
face_manager<freetype_engine> font_manager_;
|
||||
label_collision_detector4 detector_;
|
||||
boost::shared_ptr<label_collision_detector4> detector_;
|
||||
boost::scoped_ptr<rasterizer> ras_ptr;
|
||||
|
||||
void setup(Map const &m);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //AGG_RENDERER_HPP
|
||||
#endif // MAPNIK_AGG_RENDERER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef ARROW_HPP
|
||||
#define ARROW_HPP
|
||||
#ifndef MAPNIK_ARROW_HPP
|
||||
#define MAPNIK_ARROW_HPP
|
||||
|
||||
#include <mapnik/box2d.hpp>
|
||||
|
||||
|
@ -44,4 +42,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // ARROW_HPP
|
||||
#endif // MAPNIK_ARROW_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2010 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,15 +20,18 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_ATTRIBUTE_HPP
|
||||
#define MAPNIK_ATTRIBUTE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/value.hpp>
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
static mapnik::value _null_value;
|
||||
|
||||
struct attribute
|
||||
{
|
||||
std::string name_;
|
||||
|
@ -38,7 +41,13 @@ struct attribute
|
|||
template <typename V ,typename F>
|
||||
V value(F const& f) const
|
||||
{
|
||||
return f[name_];
|
||||
typedef typename F::const_iterator const_iterator;
|
||||
const_iterator itr = f.find(name_);
|
||||
if (itr != f.end())
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return _null_value;
|
||||
}
|
||||
std::string const& name() const { return name_;}
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,20 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef ATTRIBUTE_COLLECTOR_HPP
|
||||
#define ATTRIBUTE_COLLECTOR_HPP
|
||||
#ifndef MAPNIK_ATTRIBUTE_COLLECTOR_HPP
|
||||
#define MAPNIK_ATTRIBUTE_COLLECTOR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/rule.hpp>
|
||||
#include <mapnik/path_expression_grammar.hpp>
|
||||
#include <mapnik/parse_path.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
// stl
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
|
@ -271,4 +271,4 @@ private:
|
|||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif //ATTRIBUTE_COLLECTOR_HPP
|
||||
#endif // MAPNIK_ATTRIBUTE_COLLECTOR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef ATTRIBUTE_DESCRIPTOR
|
||||
#define ATTRIBUTE_DESCRIPTOR
|
||||
#ifndef MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|
||||
#define MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -118,4 +116,4 @@ operator << (std::basic_ostream<charT,traits>& out,
|
|||
|
||||
}
|
||||
|
||||
#endif // ATTRIBUTE_DESCRIPTOR_HPP
|
||||
#endif // MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2010 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,16 +20,16 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: box2d.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef MAPNIK_BOX2D_HPP
|
||||
#define MAPNIK_BOX2D_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/coord.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
// stl
|
||||
#include <iomanip>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2008 Tom Hughes
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,10 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
|
||||
#ifndef CAIRO_RENDERER_HPP
|
||||
#define CAIRO_RENDERER_HPP
|
||||
|
||||
|
||||
#ifndef MAPNIK_CAIRO_RENDERER_HPP
|
||||
#define MAPNIK_CAIRO_RENDERER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
@ -152,6 +148,6 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // MAPNIK_CAIRO_RENDERER_HPP
|
||||
|
||||
#endif //CAIRO_RENDERER_HPP
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: color.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef COLOR_HPP
|
||||
#define COLOR_HPP
|
||||
#ifndef MAPNIK_COLOR_HPP
|
||||
#define MAPNIK_COLOR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
@ -32,6 +30,7 @@
|
|||
//boost
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
// stl
|
||||
#include <sstream>
|
||||
|
||||
|
@ -141,4 +140,4 @@ public:
|
|||
|
||||
}
|
||||
|
||||
#endif //COLOR_HPP
|
||||
#endif // MAPNIK_COLOR_HPP
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_COLOR_FACTORY_HPP
|
||||
#define MAPNIK_COLOR_FACTORY_HPP
|
||||
|
||||
|
@ -120,4 +118,4 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
#endif //MAPNIK_COLOR_FACTORY_HPP
|
||||
#endif // MAPNIK_COLOR_FACTORY_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_HPP
|
||||
#define CONFIG_HPP
|
||||
#ifndef MAPNIK_CONFIG_HPP
|
||||
#define MAPNIK_CONFIG_HPP
|
||||
|
||||
// Windows DLL support
|
||||
|
||||
|
@ -47,4 +47,5 @@
|
|||
#endif
|
||||
|
||||
#define PROJ_ENVELOPE_POINTS 20
|
||||
#endif // CONFIG_HPP
|
||||
|
||||
#endif // MAPNIK_CONFIG_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_CONFIG_ERROR_INCLUDED
|
||||
#define MAPNIK_CONFIG_ERROR_INCLUDED
|
||||
#ifndef MAPNIK_CONFIG_ERROR_HPP
|
||||
#define MAPNIK_CONFIG_ERROR_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@ -54,4 +54,4 @@ protected:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // MAPNIK_CONFIG_ERROR_INCLUDED
|
||||
#endif // MAPNIK_CONFIG_ERROR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,12 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: coord.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef COORD_HPP
|
||||
#define COORD_HPP
|
||||
#ifndef MAPNIK_COORD_HPP
|
||||
#define MAPNIK_COORD_HPP
|
||||
|
||||
// boost
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
// stl
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -187,4 +188,4 @@ operator << (std::basic_ostream<charT,traits>& out,
|
|||
}
|
||||
}
|
||||
|
||||
#endif // COORD_HPP
|
||||
#endif // MAPNIK_COORD_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,12 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: coord_array.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef COORD_ARRAY_HPP
|
||||
#define COORD_ARRAY_HPP
|
||||
#ifndef MAPNIK_COORD_ARRAY_HPP
|
||||
#define MAPNIK_COORD_ARRAY_HPP
|
||||
|
||||
//mapnik
|
||||
#include <mapnik/coord.hpp>
|
||||
|
||||
// stl
|
||||
#include <cassert>
|
||||
|
||||
|
@ -89,4 +88,4 @@ private:
|
|||
}
|
||||
|
||||
|
||||
#endif //COORD_ARRAY_HPP
|
||||
#endif // MAPNIK_COORD_ARRAY_HPP
|
||||
|
|
|
@ -20,22 +20,23 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
|
||||
// spirit2
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
|
||||
// phoenix
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_fusion.hpp>
|
||||
#include <boost/spirit/include/phoenix_function.hpp>
|
||||
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
@ -387,4 +388,4 @@ struct css_color_grammar : qi::grammar<Iterator, color(), ascii_space_type>
|
|||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#endif // MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,22 +20,23 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
|
||||
// spirit2
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
|
||||
// phoenix
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_fusion.hpp>
|
||||
#include <boost/spirit/include/phoenix_function.hpp>
|
||||
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
|
||||
|
@ -45,7 +46,6 @@
|
|||
// stl
|
||||
#include <string>
|
||||
|
||||
|
||||
//BOOST_FUSION_ADAPT_CLASS(
|
||||
// mapnik::color,
|
||||
// (unsigned, unsigned, obj.red(), obj.set_red(val))
|
||||
|
@ -417,4 +417,4 @@ struct css_color_grammar : qi::grammar<Iterator, css(), ascii_space_type>
|
|||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#endif // MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,90 +20,90 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: ctrans.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef CTRANS_HPP
|
||||
#define CTRANS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#ifndef MAPNIK_CTRANS_HPP
|
||||
#define MAPNIK_CTRANS_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/vertex.hpp>
|
||||
#include <mapnik/coord_array.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
// boost
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
// stl
|
||||
#include <algorithm>
|
||||
|
||||
const double pi = boost::math::constants::pi<double>();
|
||||
const double pi_by_2 = pi/2.0;
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
typedef coord_array<coord2d> CoordinateArray;
|
||||
|
||||
template <typename Transform,typename Geometry>
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform
|
||||
{
|
||||
coord_transform(Transform const& t, Geometry& geom)
|
||||
: t_(t), geom_(geom) {}
|
||||
|
||||
unsigned vertex(double *x , double *y) const
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x,y);
|
||||
t_.forward(x,y);
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
t_.forward(x, y);
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind (unsigned pos)
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry& geom_;
|
||||
};
|
||||
|
||||
template <typename Transform,typename Geometry>
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform2
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
typedef typename Geometry::value_type value_type;
|
||||
|
||||
coord_transform2(Transform const& t,
|
||||
Geometry const& geom,
|
||||
coord_transform2(Transform const& t,
|
||||
Geometry const& geom,
|
||||
proj_transform const& prj_trans)
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans) {}
|
||||
|
||||
unsigned vertex(double * x , double * y) const
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command(SEG_MOVETO);
|
||||
unsigned command = SEG_MOVETO;
|
||||
bool ok = false;
|
||||
bool skipped_points = false;
|
||||
while (!ok)
|
||||
double z = 0;
|
||||
while (!ok && command != SEG_END)
|
||||
{
|
||||
command = geom_.vertex(x,y);
|
||||
double z=0;
|
||||
ok = prj_trans_.backward(*x,*y,z);
|
||||
command = geom_.vertex(x, y);
|
||||
ok = prj_trans_.backward(*x, *y, z);
|
||||
if (!ok) {
|
||||
skipped_points = true;
|
||||
}
|
||||
ok = ok || (command == SEG_END);
|
||||
}
|
||||
if (skipped_points && (command == SEG_LINETO))
|
||||
{
|
||||
command = SEG_MOVETO;
|
||||
}
|
||||
t_.forward(x,y);
|
||||
t_.forward(x, y);
|
||||
return command;
|
||||
}
|
||||
|
||||
/*unsigned vertex(double * x , double * y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x,y);
|
||||
double z=0;
|
||||
prj_trans_.backward(*x,*y,z);
|
||||
t_.forward(x,y);
|
||||
return command;
|
||||
}*/
|
||||
|
||||
void rewind (unsigned pos)
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
@ -112,42 +112,42 @@ struct MAPNIK_DECL coord_transform2
|
|||
{
|
||||
return geom_;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
proj_transform const& prj_trans_;
|
||||
};
|
||||
|
||||
|
||||
template <typename Transform,typename Geometry>
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform3
|
||||
{
|
||||
coord_transform3(Transform const& t,
|
||||
Geometry const& geom,
|
||||
coord_transform3(Transform const& t,
|
||||
Geometry const& geom,
|
||||
proj_transform const& prj_trans,
|
||||
int dx, int dy)
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans),
|
||||
dx_(dx), dy_(dy) {}
|
||||
|
||||
unsigned vertex(double * x , double * y) const
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x,y);
|
||||
double z=0;
|
||||
prj_trans_.backward(*x,*y,z);
|
||||
t_.forward(x,y);
|
||||
*x+=dx_;
|
||||
*y+=dy_;
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
double z = 0;
|
||||
prj_trans_.backward(*x, *y, z);
|
||||
t_.forward(x, y);
|
||||
*x += dx_;
|
||||
*y += dy_;
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind (unsigned pos)
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
|
@ -155,7 +155,226 @@ private:
|
|||
int dx_;
|
||||
int dy_;
|
||||
};
|
||||
|
||||
|
||||
// TODO - expose this and make chainable
|
||||
template <typename Transform,typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform_parallel
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
typedef typename Geometry::value_type value_type;
|
||||
|
||||
coord_transform_parallel(Transform const& t,
|
||||
Geometry const& geom,
|
||||
proj_transform const& prj_trans )
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans),
|
||||
offset_(0.0),
|
||||
threshold_(10),
|
||||
m_status(initial) {}
|
||||
|
||||
enum status
|
||||
{
|
||||
initial,
|
||||
start,
|
||||
first,
|
||||
process,
|
||||
last_vertex,
|
||||
angle_joint,
|
||||
end
|
||||
};
|
||||
|
||||
double get_offset() const
|
||||
{
|
||||
return offset_;
|
||||
}
|
||||
|
||||
void set_offset(double offset)
|
||||
{
|
||||
offset_ = offset;
|
||||
}
|
||||
|
||||
unsigned int get_threshold() const
|
||||
{
|
||||
return threshold_;
|
||||
}
|
||||
|
||||
void set_threshold(unsigned int t)
|
||||
{
|
||||
threshold_ = t;
|
||||
}
|
||||
|
||||
unsigned vertex(double * x , double * y)
|
||||
{
|
||||
double z=0;
|
||||
|
||||
if (offset_==0.0)
|
||||
{
|
||||
unsigned command = geom_.vertex(x,y);
|
||||
prj_trans_.backward(*x,*y,z);
|
||||
t_.forward(x,y);
|
||||
return command;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(true){
|
||||
switch(m_status)
|
||||
{
|
||||
case end:
|
||||
return SEG_END;
|
||||
break;
|
||||
case initial:
|
||||
m_pre_cmd = geom_.vertex(x,y);
|
||||
prj_trans_.backward(*x,*y,z);
|
||||
t_.forward(x,y);
|
||||
m_pre_x = *x;
|
||||
m_pre_y = *y;
|
||||
//m_status = (m_pre_cmd!=SEG_END)?start:end; //
|
||||
case start:
|
||||
m_cur_cmd = geom_.vertex(&m_cur_x, &m_cur_y);
|
||||
prj_trans_.backward(m_cur_x,m_cur_y,z);
|
||||
t_.forward(&m_cur_x,&m_cur_y);
|
||||
case first:
|
||||
angle_a = atan2((m_pre_y-m_cur_y),(m_pre_x-m_cur_x));
|
||||
dx_pre = cos(angle_a + pi_by_2);
|
||||
dy_pre = sin(angle_a + pi_by_2);
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "offsetting line by: " << offset_ << "\n";
|
||||
std::clog << "initial dx=" << (dx_pre * offset_) << " dy=" << (dy_pre * offset_) << "\n";
|
||||
#endif
|
||||
*x = m_pre_x + (dx_pre * offset_);
|
||||
*y = m_pre_y + (dy_pre * offset_);
|
||||
m_status = process;
|
||||
return SEG_MOVETO;
|
||||
case process:
|
||||
switch(m_cur_cmd)
|
||||
{
|
||||
case SEG_LINETO:
|
||||
m_next_cmd = geom_.vertex(&m_next_x, &m_next_y);
|
||||
prj_trans_.backward(m_next_x,m_next_y,z);
|
||||
t_.forward(&m_next_x,&m_next_y);
|
||||
switch(m_next_cmd)
|
||||
{
|
||||
case SEG_LINETO:
|
||||
m_status = angle_joint;
|
||||
break;
|
||||
default:
|
||||
m_status = last_vertex;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SEG_END:
|
||||
m_status = end;
|
||||
return SEG_END;
|
||||
}
|
||||
break;
|
||||
case last_vertex:
|
||||
dx_curr = cos(angle_a + pi_by_2);
|
||||
dy_curr = sin(angle_a + pi_by_2);
|
||||
*x = m_cur_x + (dx_curr * offset_);
|
||||
*y = m_cur_y + (dy_curr * offset_);
|
||||
m_status = end;
|
||||
return m_cur_cmd;
|
||||
case angle_joint:
|
||||
angle_b = atan2((m_cur_y-m_next_y),(m_cur_x-m_next_x));
|
||||
h = tan((angle_b - angle_a)/2.0);
|
||||
|
||||
if (fabs(h) < threshold_)
|
||||
{
|
||||
dx_curr = cos(angle_a + pi_by_2);
|
||||
dy_curr = sin(angle_a + pi_by_2);
|
||||
*x = m_cur_x + (dx_curr * offset_) - h * (dy_curr * offset_);
|
||||
*y = m_cur_y + (dy_curr * offset_) + h * (dx_curr * offset_);
|
||||
}
|
||||
else // skip sharp spikes
|
||||
{
|
||||
|
||||
#ifdef MAPNIK_DEBUG
|
||||
dx_curr = cos(angle_a + pi_by_2);
|
||||
dy_curr = sin(angle_a + pi_by_2);
|
||||
sin_curve = dx_curr*dy_pre-dy_curr*dx_pre;
|
||||
std::clog << "angle a: " << angle_a << "\n";
|
||||
std::clog << "angle b: " << angle_b << "\n";
|
||||
std::clog << "h: " << h << "\n";
|
||||
std::clog << "sin_curve: " << sin_curve << "\n";
|
||||
#endif
|
||||
m_status = process;
|
||||
break;
|
||||
}
|
||||
|
||||
// alternate sharp spike fix, but suboptimal...
|
||||
|
||||
/*
|
||||
sin_curve = dx_curr*dy_pre-dy_curr*dx_pre;
|
||||
cos_curve = -dx_pre*dx_curr-dy_pre*dy_curr;
|
||||
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "sin_curve value: " << sin_curve << "\n";
|
||||
#endif
|
||||
if(sin_curve > -0.3 && sin_curve < 0.3) {
|
||||
angle_b = atan2((m_cur_y-m_next_y),(m_cur_x-m_next_x));
|
||||
h = tan((angle_b - angle_a)/2.0);
|
||||
*x = m_cur_x + (dx_curr * offset_) - h * (dy_curr * offset_);
|
||||
*y = m_cur_y + (dy_curr * offset_) + h * (dx_curr * offset_);
|
||||
} else {
|
||||
if (angle_b - angle_a > 0)
|
||||
h = -1.0*(1.0+cos_curve)/sin_curve;
|
||||
else
|
||||
h = (1.0+cos_curve)/sin_curve;
|
||||
*x = m_cur_x + (dx_curr + base_shift*dy_curr)*offset_;
|
||||
*y = m_cur_y + (dy_curr - base_shift*dx_curr)*offset_;
|
||||
}
|
||||
*/
|
||||
|
||||
m_pre_x = *x;
|
||||
m_pre_x = *y;
|
||||
m_cur_x = m_next_x;
|
||||
m_cur_y = m_next_y;
|
||||
angle_a = angle_b;
|
||||
m_pre_cmd = m_cur_cmd;
|
||||
m_cur_cmd = m_next_cmd;
|
||||
m_status = process;
|
||||
return m_pre_cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rewind (unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
m_status = initial;
|
||||
}
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
proj_transform const& prj_trans_;
|
||||
int offset_;
|
||||
unsigned int threshold_;
|
||||
status m_status;
|
||||
double dx_pre;
|
||||
double dy_pre;
|
||||
double dx_curr;
|
||||
double dy_curr;
|
||||
double sin_curve;
|
||||
double cos_curve;
|
||||
double angle_a;
|
||||
double angle_b;
|
||||
double h;
|
||||
unsigned m_pre_cmd;
|
||||
double m_pre_x;
|
||||
double m_pre_y;
|
||||
unsigned m_cur_cmd;
|
||||
double m_cur_x;
|
||||
double m_cur_y;
|
||||
unsigned m_next_cmd;
|
||||
double m_next_x;
|
||||
double m_next_y;
|
||||
};
|
||||
|
||||
|
||||
class CoordTransform
|
||||
{
|
||||
private:
|
||||
|
@ -166,71 +385,74 @@ private:
|
|||
box2d<double> extent_;
|
||||
double offset_x_;
|
||||
double offset_y_;
|
||||
|
||||
public:
|
||||
CoordTransform(int width,int height,const box2d<double>& extent,
|
||||
CoordTransform(int width, int height, const box2d<double>& extent,
|
||||
double offset_x = 0, double offset_y = 0)
|
||||
:width_(width),height_(height),extent_(extent),offset_x_(offset_x),offset_y_(offset_y)
|
||||
: width_(width), height_(height), extent_(extent),
|
||||
offset_x_(offset_x), offset_y_(offset_y)
|
||||
{
|
||||
sx_ = (double(width_))/extent_.width();
|
||||
sy_ = (double(height_))/extent_.height();
|
||||
sx_ = static_cast<double>(width_) / extent_.width();
|
||||
sy_ = static_cast<double>(height_) / extent_.height();
|
||||
}
|
||||
|
||||
|
||||
inline int width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
|
||||
inline int height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
|
||||
inline double scale_x() const
|
||||
{
|
||||
return sx_;
|
||||
}
|
||||
|
||||
|
||||
inline double scale_y() const
|
||||
{
|
||||
return sy_;
|
||||
}
|
||||
|
||||
inline void forward(double * x, double * y) const
|
||||
|
||||
inline void forward(double *x, double *y) const
|
||||
{
|
||||
*x = (*x - extent_.minx()) * sx_ - offset_x_;
|
||||
*y = (extent_.maxy() - *y) * sy_ - offset_y_;
|
||||
}
|
||||
|
||||
inline void backward(double * x, double * y) const
|
||||
|
||||
inline void backward(double *x, double *y) const
|
||||
{
|
||||
*x = extent_.minx() + (*x + offset_x_)/sx_;
|
||||
*y = extent_.maxy() - (*y + offset_y_)/sy_;
|
||||
*x = extent_.minx() + (*x + offset_x_) / sx_;
|
||||
*y = extent_.maxy() - (*y + offset_y_) / sy_;
|
||||
}
|
||||
|
||||
|
||||
inline coord2d& forward(coord2d& c) const
|
||||
{
|
||||
forward(&c.x,&c.y);
|
||||
return c;
|
||||
}
|
||||
|
||||
inline coord2d& backward(coord2d& c) const
|
||||
{
|
||||
backward(&c.x,&c.y);
|
||||
forward(&c.x, &c.y);
|
||||
return c;
|
||||
}
|
||||
|
||||
inline box2d<double> forward(const box2d<double>& e,proj_transform const& prj_trans) const
|
||||
inline coord2d& backward(coord2d& c) const
|
||||
{
|
||||
backward(&c.x, &c.y);
|
||||
return c;
|
||||
}
|
||||
|
||||
inline box2d<double> forward(const box2d<double>& e,
|
||||
proj_transform const& prj_trans) const
|
||||
{
|
||||
double x0 = e.minx();
|
||||
double y0 = e.miny();
|
||||
double x1 = e.maxx();
|
||||
double y1 = e.maxy();
|
||||
double z = 0.0;
|
||||
prj_trans.backward(x0,y0,z);
|
||||
forward(&x0,&y0);
|
||||
prj_trans.backward(x1,y1,z);
|
||||
forward(&x1,&y1);
|
||||
return box2d<double>(x0,y0,x1,y1);
|
||||
prj_trans.backward(x0, y0, z);
|
||||
forward(&x0, &y0);
|
||||
prj_trans.backward(x1, y1, z);
|
||||
forward(&x1, &y1);
|
||||
return box2d<double>(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
inline box2d<double> forward(const box2d<double>& e) const
|
||||
|
@ -239,23 +461,24 @@ public:
|
|||
double y0 = e.miny();
|
||||
double x1 = e.maxx();
|
||||
double y1 = e.maxy();
|
||||
forward(&x0,&y0);
|
||||
forward(&x1,&y1);
|
||||
return box2d<double>(x0,y0,x1,y1);
|
||||
forward(&x0, &y0);
|
||||
forward(&x1, &y1);
|
||||
return box2d<double>(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
inline box2d<double> backward(const box2d<double>& e,proj_transform const& prj_trans) const
|
||||
inline box2d<double> backward(const box2d<double>& e,
|
||||
proj_transform const& prj_trans) const
|
||||
{
|
||||
double x0 = e.minx();
|
||||
double y0 = e.miny();
|
||||
double x1 = e.maxx();
|
||||
double y1 = e.maxy();
|
||||
double z = 0.0;
|
||||
backward(&x0,&y0);
|
||||
prj_trans.forward(x0,y0,z);
|
||||
backward(&x1,&y1);
|
||||
prj_trans.forward(x1,y1,z);
|
||||
return box2d<double>(x0,y0,x1,y1);
|
||||
backward(&x0, &y0);
|
||||
prj_trans.forward(x0, y0, z);
|
||||
backward(&x1, &y1);
|
||||
prj_trans.forward(x1, y1, z);
|
||||
return box2d<double>(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
inline box2d<double> backward(const box2d<double>& e) const
|
||||
|
@ -264,28 +487,29 @@ public:
|
|||
double y0 = e.miny();
|
||||
double x1 = e.maxx();
|
||||
double y1 = e.maxy();
|
||||
backward(&x0,&y0);
|
||||
backward(&x1,&y1);
|
||||
return box2d<double>(x0,y0,x1,y1);
|
||||
backward(&x0, &y0);
|
||||
backward(&x1, &y1);
|
||||
return box2d<double>(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
inline CoordinateArray& forward(CoordinateArray& coords) const
|
||||
{
|
||||
for (unsigned i=0;i<coords.size();++i)
|
||||
for (unsigned i = 0; i < coords.size(); ++i)
|
||||
{
|
||||
forward(coords[i]);
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
|
||||
|
||||
inline CoordinateArray& backward(CoordinateArray& coords) const
|
||||
{
|
||||
for (unsigned i=0;i<coords.size();++i)
|
||||
for (unsigned i = 0; i < coords.size(); ++i)
|
||||
{
|
||||
backward(coords[i]);
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
|
||||
inline box2d<double> const& extent() const
|
||||
{
|
||||
return extent_;
|
||||
|
@ -293,4 +517,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //CTRANS_HPP
|
||||
#endif // MAPNIK_CTRANS_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,9 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: datasource.hpp 43 2005-04-22 18:52:47Z pavlenko $
|
||||
#ifndef MAPNIK_DATASOURCE_HPP
|
||||
#define MAPNIK_DATASOURCE_HPP
|
||||
|
||||
#ifndef DATASOURCE_HPP
|
||||
#define DATASOURCE_HPP
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
|
@ -31,9 +30,11 @@
|
|||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/query.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -142,6 +143,7 @@ typedef boost::shared_ptr<datasource> datasource_ptr;
|
|||
delete ds; \
|
||||
} \
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
#endif //DATASOURCE_HPP
|
||||
#endif // MAPNIK_DATASOURCE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,18 +20,18 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: datasource_cache.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef DATASOURCE_CACHE_HPP
|
||||
#define DATASOURCE_CACHE_HPP
|
||||
#ifndef MAPNIK_DATASOURCE_CACHE_HPP
|
||||
#define MAPNIK_DATASOURCE_CACHE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/plugin.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <map>
|
||||
|
||||
|
@ -57,4 +57,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //DATASOURCE_CACHE_HPP
|
||||
#endif // MAPNIK_DATASOURCE_CACHE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef DISTANCE_HPP
|
||||
#define DISTANCE_HPP
|
||||
#ifndef MAPNIK_DISTANCE_HPP
|
||||
#define MAPNIK_DISTANCE_HPP
|
||||
|
||||
#include <mapnik/coord.hpp>
|
||||
|
||||
|
@ -52,4 +50,4 @@ public:
|
|||
*/
|
||||
}
|
||||
|
||||
#endif // GEO_UTILS_HPP
|
||||
#endif // MAPNIK_DISTANCE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_ELLIPSOID_HPP
|
||||
#define MAPNIK_ELLIPSOID_HPP
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,11 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_ENUMERATION_INCLUDED
|
||||
#define MAPNIK_ENUMERATION_INCLUDED
|
||||
#ifndef MAPNIK_ENUMERATION_HPP
|
||||
#define MAPNIK_ENUMERATION_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
|
@ -325,4 +327,4 @@ operator>>(std::istream & is, mapnik::enumeration<ENUM, THE_MAX> & e)
|
|||
template <> std::string name ::our_name_ = #name; \
|
||||
template <> bool name ::our_verified_flag_( name ::verify(__FILE__, __LINE__));
|
||||
|
||||
#endif // MAPNIK_ENUMERATION_INCLUDED
|
||||
#endif // MAPNIK_ENUMERATION_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,11 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_EXPRESSION_EVALUATOR_HPP
|
||||
#define MAPNIK_EXPRESSION_EVALUATOR_HPP
|
||||
|
||||
// boost
|
||||
#include <boost/regex.hpp>
|
||||
//#include <boost/regex/config.hpp>
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
#include <boost/regex/icu.hpp>
|
||||
#endif
|
||||
|
@ -43,7 +40,11 @@ struct evaluate : boost::static_visitor<T1>
|
|||
explicit evaluate(feature_type const& f)
|
||||
: feature_(f) {}
|
||||
|
||||
value_type operator() (value_type x) const { return x; }
|
||||
value_type operator() (value_type x) const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
value_type operator() (attribute const& attr) const
|
||||
{
|
||||
return attr.value<value_type,feature_type>(feature_);
|
||||
|
@ -104,4 +105,4 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_EXPRESSION_EVALUATOR_HPP
|
||||
#endif // MAPNIK_EXPRESSION_EVALUATOR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_EXPRESSIONS_GRAMMAR_HPP
|
||||
#define MAPNIK_EXPRESSIONS_GRAMMAR_HPP
|
||||
|
||||
|
@ -34,12 +32,15 @@
|
|||
#include <boost/variant.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
//spirit2
|
||||
|
||||
// spirit2
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
//fusion
|
||||
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
//phoenix
|
||||
|
||||
// phoenix
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_object.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
|
@ -222,11 +223,13 @@ struct expression_grammar : qi::grammar<Iterator, expr_node(), space_type>
|
|||
| '(' >> expr [_val = _1 ] >> ')'
|
||||
;
|
||||
|
||||
attr %= '[' >> +(char_ - ']') >> ']';
|
||||
|
||||
#if BOOST_VERSION > 104200
|
||||
ustring %= '\'' >> no_skip[*~char_('\'')] >> '\'';
|
||||
attr %= '[' >> no_skip[+~char_(']')] >> ']';
|
||||
#else
|
||||
ustring %= '\'' >> lexeme[*(char_-'\'')] >> '\'';
|
||||
attr %= '[' >> lexeme[+(char_ - ']')] >> ']';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,12 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_EXPRESSION_NODE_HPP
|
||||
#define MAPNIK_EXPRESSION_NODE_HPP
|
||||
#ifndef MAPNIK_EXPRESSION_NODE_HPP
|
||||
#define MAPNIK_EXPRESSION_NODE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/value.hpp>
|
||||
#include <mapnik/attribute.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_EXPRESSION_STRING_HPP
|
||||
#define MAPNIK_EXPRESSION_STRING_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,12 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: factory.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef FACTORY_HPP
|
||||
#define FACTORY_HPP
|
||||
#ifndef MAPNIK_FACTORY_HPP
|
||||
#define MAPNIK_FACTORY_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/utils.hpp>
|
||||
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
#include <map>
|
||||
|
@ -89,4 +88,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //FACTORY_HPP
|
||||
#endif // MAPNIK_FACTORY_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef FASTMATH_HPP
|
||||
#define FASTMATH_HPP
|
||||
#ifndef MAPNIK_FASTMATH_HPP
|
||||
#define MAPNIK_FASTMATH_HPP
|
||||
|
||||
/* Timings:
|
||||
* fast_sin(not inlined) 8.95s
|
||||
|
@ -109,4 +109,4 @@ static inline double fast_atan2(double y, double x)
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif // FASTMATH_HPP
|
||||
#endif // MAPNIK_FASTMATH_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,9 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: feature.hpp 40 2005-04-13 20:20:46Z pavlenko $
|
||||
#ifndef MAPNIK_FEATURE_HPP
|
||||
#define MAPNIK_FEATURE_HPP
|
||||
|
||||
#ifndef FEATURE_HPP
|
||||
#define FEATURE_HPP
|
||||
// mapnik
|
||||
#include <mapnik/value.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
@ -36,9 +35,9 @@
|
|||
#else
|
||||
#include <boost/property_map.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <map>
|
||||
|
||||
|
@ -66,6 +65,7 @@ private:
|
|||
std::map<std::string,value> props_;
|
||||
public:
|
||||
typedef std::map<std::string,value>::iterator iterator;
|
||||
typedef std::map<std::string,value>::const_iterator const_iterator;
|
||||
explicit feature(int id)
|
||||
: properties(props_),
|
||||
id_(id),
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
{
|
||||
return props_;
|
||||
}
|
||||
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return props_.begin();
|
||||
|
@ -156,12 +156,27 @@ public:
|
|||
{
|
||||
return props_.end();
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return props_.begin();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return props_.end();
|
||||
}
|
||||
|
||||
const_iterator find(std::string const& key) const
|
||||
{
|
||||
return props_.find(key);
|
||||
}
|
||||
|
||||
std::string to_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "feature (" << std::endl;
|
||||
ss << " id:" << id_ << std::endl;
|
||||
ss << "feature "
|
||||
<< id_ << " (" << std::endl;
|
||||
for (std::map<std::string,value>::const_iterator itr=props_.begin();
|
||||
itr != props_.end();++itr)
|
||||
{
|
||||
|
@ -181,4 +196,4 @@ inline std::ostream& operator<< (std::ostream & out,Feature const& f)
|
|||
}
|
||||
}
|
||||
|
||||
#endif //FEATURE_HPP
|
||||
#endif // MAPNIK_FEATURE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,12 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef FEATURE_FACTORY_HPP
|
||||
#define FEATURE_FACTORY_HPP
|
||||
#ifndef MAPNIK_FEATURE_FACTORY_HPP
|
||||
#define MAPNIK_FEATURE_FACTORY_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/make_shared.hpp>
|
||||
//#include <boost/pool/pool_alloc.hpp>
|
||||
|
||||
|
@ -39,8 +40,7 @@ struct feature_factory
|
|||
//return boost::allocate_shared<Feature>(boost::fast_pool_allocator<Feature>(),fid);
|
||||
return boost::make_shared<Feature>(fid);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif //FEATURE_FACTORY_HPP
|
||||
#endif // MAPNIK_FEATURE_FACTORY_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef FEATURE_LAYER_DESC_HPP
|
||||
#define FEATURE_LAYER_DESC_HPP
|
||||
#ifndef MAPNIK_FEATURE_LAYER_DESC_HPP
|
||||
#define MAPNIK_FEATURE_LAYER_DESC_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/attribute_descriptor.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
@ -106,4 +105,4 @@ operator << (std::basic_ostream<charT,traits>& out,
|
|||
}
|
||||
}
|
||||
|
||||
#endif //FEATURE_LAYER_DESC_HPP
|
||||
#endif // MAPNIK_FEATURE_LAYER_DESC_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef FEATURE_STYLE_PROCESSOR_HPP
|
||||
#define FEATURE_STYLE_PROCESSOR_HPP
|
||||
#ifndef MAPNIK_FEATURE_STYLE_PROCESSOR_HPP
|
||||
#define MAPNIK_FEATURE_STYLE_PROCESSOR_HPP
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -74,4 +72,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //FEATURE_STYLE_PROCESSOR_HPP
|
||||
#endif // MAPNIK_FEATURE_STYLE_PROCESSOR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,14 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
#ifndef MAPNIK_FEATURE_TYPE_STYLE_HPP
|
||||
#define MAPNIK_FEATURE_TYPE_STYLE_HPP
|
||||
|
||||
#ifndef FEATURE_TYPE_STYLE_HPP
|
||||
#define FEATURE_TYPE_STYLE_HPP
|
||||
// mapnik
|
||||
#include <mapnik/rule.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
|
||||
|
@ -69,4 +69,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //FEATURE_TYPE_STYLE_HPP
|
||||
#endif // MAPNIK_FEATURE_TYPE_STYLE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,17 +20,16 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef FILL_HPP
|
||||
#define FILL_HPP
|
||||
#ifndef MAPNIK_FILL_HPP
|
||||
#define MAPNIK_FILL_HPP
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class fill
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //FILL_HPP
|
||||
#endif // MAPNIK_FILL_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006-2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_FILTER_FACTORY_HPP
|
||||
#define MAPNIK_FILTER_FACTORY_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
|
@ -41,4 +40,4 @@ MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt);
|
|||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_FILTER_FACTORY_HPP
|
||||
#endif // MAPNIK_FILTER_FACTORY_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,11 +20,10 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_FILTER_FEATURESET_HPP
|
||||
#define MAPNIK_FILTER_FEATURESET_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
@ -54,4 +53,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //MAPNIK_FILTER_FEATURESET_HPP
|
||||
#endif // MAPNIK_FILTER_FEATURESET_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,9 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
#ifndef MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
||||
#define MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
||||
|
||||
#ifndef FONT_ENGINE_FREETYPE_HPP
|
||||
#define FONT_ENGINE_FREETYPE_HPP
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
|
@ -50,7 +49,6 @@ extern "C"
|
|||
#include <boost/thread/mutex.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -121,7 +119,13 @@ public:
|
|||
{
|
||||
if (! FT_Set_Pixel_Sizes( face_, 0, size ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool set_character_sizes(float size)
|
||||
{
|
||||
if ( !FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -186,6 +190,14 @@ public:
|
|||
(*face)->set_pixel_sizes(size);
|
||||
}
|
||||
}
|
||||
|
||||
void set_character_sizes(float size)
|
||||
{
|
||||
for (std::vector<face_ptr>::iterator face = faces_.begin(); face != faces_.end(); ++face)
|
||||
{
|
||||
(*face)->set_character_sizes(size);
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::vector<face_ptr> faces_;
|
||||
std::map<unsigned, dimension_t> dimension_cache_;
|
||||
|
@ -200,7 +212,7 @@ public:
|
|||
|
||||
void init(double radius)
|
||||
{
|
||||
FT_Stroker_Set(s_, (FT_Fixed) radius * (1<<6),
|
||||
FT_Stroker_Set(s_, (FT_Fixed) (radius * (1<<6)),
|
||||
FT_STROKER_LINECAP_ROUND,
|
||||
FT_STROKER_LINEJOIN_ROUND,
|
||||
0);
|
||||
|
@ -334,11 +346,17 @@ struct text_renderer : private boost::noncopyable
|
|||
halo_radius_(0.0),
|
||||
opacity_(1.0) {}
|
||||
|
||||
|
||||
void set_pixel_size(unsigned size)
|
||||
{
|
||||
faces_->set_pixel_sizes(size);
|
||||
}
|
||||
|
||||
|
||||
void set_character_size(float size)
|
||||
{
|
||||
faces_->set_character_sizes(size);
|
||||
}
|
||||
|
||||
void set_fill(mapnik::color const& fill)
|
||||
{
|
||||
fill_=fill;
|
||||
|
@ -602,4 +620,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // FONT_ENGINE_FREETYPE_HPP
|
||||
#endif // MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef FONT_SET_HPP
|
||||
#define FONT_SET_HPP
|
||||
#ifndef MAPNIK_FONT_SET_HPP
|
||||
#define MAPNIK_FONT_SET_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
@ -52,4 +50,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //FONT_SET_HPP
|
||||
#endif // MAPNIK_FONT_SET_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: gamma.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef GAMMA_HPP
|
||||
#define GAMMA_HPP
|
||||
#ifndef MAPNIK_GAMMA_HPP
|
||||
#define MAPNIK_GAMMA_HPP
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -50,4 +48,4 @@ struct MAPNIK_DECL gamma
|
|||
};
|
||||
}
|
||||
|
||||
#endif //GAMMA_HPP
|
||||
#endif // MAPNIK_GAMMA_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,15 +20,16 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: geom_util.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
#ifndef MAPNIK_GEOM_UTIL_HPP
|
||||
#define MAPNIK_GEOM_UTIL_HPP
|
||||
|
||||
#ifndef GEOM_UTIL_HPP
|
||||
#define GEOM_UTIL_HPP
|
||||
// mapnik
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/vertex.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
|
@ -217,4 +218,4 @@ struct filter_at_point
|
|||
};
|
||||
}
|
||||
|
||||
#endif //GEOM_UTIL_HPP
|
||||
#endif // MAPNIK_GEOM_UTIL_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,15 +20,14 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: geometry.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef GEOMETRY_HPP
|
||||
#define GEOMETRY_HPP
|
||||
#ifndef MAPNIK_GEOMETRY_HPP
|
||||
#define MAPNIK_GEOMETRY_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/vertex_vector.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
@ -68,27 +67,7 @@ public:
|
|||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
double area() const
|
||||
{
|
||||
double sum = 0.0;
|
||||
double x(0);
|
||||
double y(0);
|
||||
rewind(0);
|
||||
double xs = x;
|
||||
double ys = y;
|
||||
for (unsigned i=0;i<num_points();++i)
|
||||
{
|
||||
double x0(0);
|
||||
double y0(0);
|
||||
vertex(&x0,&y0);
|
||||
sum += x * y0 - y * x0;
|
||||
x = x0;
|
||||
y = y0;
|
||||
}
|
||||
return (sum + x * ys - y * xs) * 0.5;
|
||||
}
|
||||
|
||||
|
||||
box2d<double> envelope() const
|
||||
{
|
||||
box2d<double> result;
|
||||
|
@ -412,4 +391,4 @@ typedef boost::ptr_vector<geometry_type> geometry_containter;
|
|||
|
||||
}
|
||||
|
||||
#endif //GEOMETRY_HPP
|
||||
#endif // MAPNIK_GEOMETRY_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,14 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef GLOBAL_HPP
|
||||
#define GLOBAL_HPP
|
||||
#ifndef MAPNIK_GLOBAL_HPP
|
||||
#define MAPNIK_GLOBAL_HPP
|
||||
|
||||
// boost
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
|
||||
// stl
|
||||
#include <cstring>
|
||||
|
||||
|
@ -183,4 +182,4 @@ inline double round (double val)
|
|||
|
||||
|
||||
|
||||
#endif //GLOBAL_HPP
|
||||
#endif // MAPNIK_GLOBAL_HPP
|
||||
|
|
|
@ -1,5 +1,27 @@
|
|||
#ifndef GLYPH_SYMBOLIZER_HPP
|
||||
#define GLYPH_SYMBOLIZER_HPP
|
||||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* 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_GLYPH_SYMBOLIZER_HPP
|
||||
#define MAPNIK_GLYPH_SYMBOLIZER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
@ -190,4 +212,4 @@ private:
|
|||
|
||||
} // end mapnik namespace
|
||||
|
||||
#endif
|
||||
#endif // MAPNIK_GLYPH_SYMBOLIZER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2010 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,11 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef GRADIENT_HPP
|
||||
#define GRADIENT_HPP
|
||||
#ifndef MAPNIK_GRADIENT_HPP
|
||||
#define MAPNIK_GRADIENT_HPP
|
||||
|
||||
// agg
|
||||
#include <agg_trans_affine.h>
|
||||
|
||||
// mapnik
|
||||
|
@ -104,4 +104,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //GRADIENT_HPP
|
||||
#endif // MAPNIK_GRADIENT_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: graphics.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef GRAPHICS_HPP
|
||||
#define GRAPHICS_HPP
|
||||
#ifndef MAPNIK_GRAPHICS_HPP
|
||||
#define MAPNIK_GRAPHICS_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
|
@ -520,4 +518,5 @@ public:
|
|||
}
|
||||
};
|
||||
}
|
||||
#endif //GRAPHICS_HPP
|
||||
|
||||
#endif // MAPNIK_GRAPHICS_HPP
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef MAPNIK_GRID_PIXFMT_HPP
|
||||
#define MAPNIK_GRID_PIXFMT_HPP
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include "agg_basics.h"
|
||||
#include <mapnik/grid/grid_pixel.hpp>
|
||||
#include <mapnik/grid/grid_rendering_buffer.hpp>
|
||||
|
|
|
@ -50,7 +50,10 @@ static inline void scale_grid(mapnik::grid::data_type & target,
|
|||
int th2 = target_height/2;
|
||||
int offs_x = rint((source_width-target_width-x_off_f*2*source_width)/2);
|
||||
int offs_y = rint((source_height-target_height-y_off_f*2*source_height)/2);
|
||||
unsigned yprt, yprt1, xprt, xprt1;
|
||||
unsigned yprt(0);
|
||||
unsigned yprt1(0);
|
||||
unsigned xprt(0);
|
||||
unsigned xprt1(0);
|
||||
|
||||
//no scaling or subpixel offset
|
||||
if (target_height == source_height && target_width == source_width && offs_x == 0 && offs_y == 0){
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,10 +19,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef _HEXTREE_HPP_
|
||||
#define _HEXTREE_HPP_
|
||||
#ifndef MAPNIK_HEXTREE_HPP
|
||||
#define MAPNIK_HEXTREE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
|
@ -455,4 +454,4 @@ private:
|
|||
};
|
||||
} // namespace mapnik
|
||||
|
||||
#endif // _HEXTREE_HPP_
|
||||
#endif // MAPNIK_HEXTREE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,11 +20,10 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef HIT_TEST_FILTER_HPP
|
||||
#define HIT_TEST_FILTER_HPP
|
||||
#ifndef MAPNIK_HIT_TEST_FILTER_HPP
|
||||
#define MAPNIK_HIT_TEST_FILTER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
@ -54,4 +53,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // HIT_TEST_FILTER_HPP
|
||||
#endif // MAPNIK_HIT_TEST_FILTER_HPP
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef IMAGE_COMPOSITING_HPP
|
||||
#define IMAGE_COMPOSITING_HPP
|
||||
#ifndef MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
#define MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
|
||||
// agg
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
@ -186,4 +184,4 @@ void composite(T1 & im, T2 & im2, composite_mode_e mode)
|
|||
|
||||
}
|
||||
|
||||
#endif // IMAGE_COMPOSITING_HPP
|
||||
#endif // MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,12 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: image_data.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef IMAGE_DATA_HPP
|
||||
#define IMAGE_DATA_HPP
|
||||
#ifndef MAPNIK_IMAGE_DATA_HPP
|
||||
#define MAPNIK_IMAGE_DATA_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
|
||||
// stl
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -139,4 +140,4 @@ typedef ImageData<unsigned> image_data_32;
|
|||
typedef ImageData<byte> image_data_8;
|
||||
}
|
||||
|
||||
#endif //IMAGE_DATA_HPP
|
||||
#endif // MAPNIK_IMAGE_DATA_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: image_reader.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
#ifndef MAPNIK_IMAGE_READER_HPP
|
||||
#define MAPNIK_IMAGE_READER_HPP
|
||||
|
||||
#ifndef IMAGE_READER_HPP
|
||||
#define IMAGE_READER_HPP
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
@ -63,4 +63,4 @@ MAPNIK_DECL image_reader* get_image_reader(const std::string& file);
|
|||
|
||||
}
|
||||
|
||||
#endif //IMAGE_READER_HPP
|
||||
#endif // MAPNIK_IMAGE_READER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,10 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: image_util.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef IMAGE_UTIL_HPP
|
||||
#define IMAGE_UTIL_HPP
|
||||
#ifndef MAPNIK_IMAGE_UTIL_HPP
|
||||
#define MAPNIK_IMAGE_UTIL_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
@ -292,10 +290,13 @@ template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 con
|
|||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif //IMAGE_UTIL_HPP
|
||||
#endif // MAPNIK_IMAGE_UTIL_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,11 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef IMAGE_VIEW_HPP
|
||||
#define IMAGE_VIEW_HPP
|
||||
|
||||
#ifndef MAPNIK_IMAGE_VIEW_HPP
|
||||
#define MAPNIK_IMAGE_VIEW_HPP
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
@ -107,5 +104,5 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // IMAGE_VIEW_HPP
|
||||
#endif // MAPNIK_IMAGE_VIEW_HPP
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_JPEG_IO_HPP
|
||||
#define MAPNIK_JPEG_IO_HPP
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,12 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef LABEL_COLLISION_DETECTOR_HPP
|
||||
#define LABEL_COLLISION_DETECTOR_HPP
|
||||
#ifndef MAPNIK_LABEL_COLLISION_DETECTOR_HPP
|
||||
#define MAPNIK_LABEL_COLLISION_DETECTOR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/quad_tree.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
#include <unicode/unistr.h>
|
||||
|
@ -69,7 +68,7 @@ class label_collision_detector2 : boost::noncopyable
|
|||
typedef quad_tree<box2d<double> > tree_t;
|
||||
tree_t tree_;
|
||||
public:
|
||||
|
||||
|
||||
explicit label_collision_detector2(box2d<double> const& extent)
|
||||
: tree_(extent) {}
|
||||
|
||||
|
@ -138,6 +137,7 @@ public:
|
|||
//quad tree based label collission detector so labels dont appear within a given distance
|
||||
class label_collision_detector4 : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
struct label
|
||||
{
|
||||
label(box2d<double> const& b) : box(b) {}
|
||||
|
@ -146,11 +146,13 @@ class label_collision_detector4 : boost::noncopyable
|
|||
box2d<double> box;
|
||||
UnicodeString text;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
typedef quad_tree< label > tree_t;
|
||||
tree_t tree_;
|
||||
|
||||
public:
|
||||
typedef tree_t::query_iterator query_iterator;
|
||||
|
||||
explicit label_collision_detector4(box2d<double> const& extent)
|
||||
: tree_(extent) {}
|
||||
|
@ -224,7 +226,10 @@ public:
|
|||
{
|
||||
return tree_.extent();
|
||||
}
|
||||
|
||||
query_iterator begin() { return tree_.query_in_box(extent()); }
|
||||
query_iterator end() { return tree_.query_end(); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LABEL_COLLISION_DETECTOR_HPP
|
||||
#endif // MAPNIK_LABEL_COLLISION_DETECTOR_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,10 +19,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef LABEL_PLACEMENT_HPP
|
||||
#define LABEL_PLACEMENT_HPP
|
||||
#ifndef MAPNIK_LABEL_PLACEMENT_HPP
|
||||
#define MAPNIK_LABEL_PLACEMENT_HPP
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -51,4 +50,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //LABEL_PLACEMENT_HPP
|
||||
#endif // MAPNIK_LABEL_PLACEMENT_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,10 +19,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: layer.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef LAYER_HPP
|
||||
#define LAYER_HPP
|
||||
#ifndef MAPNIK_LAYER_HPP
|
||||
#define MAPNIK_LAYER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
@ -217,4 +217,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //LAYER_HPP
|
||||
#endif // MAPNIK_LAYER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,11 +20,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBXML2_LOADER_INCLUDED
|
||||
#define LIBXML2_LOADER_INCLUDED
|
||||
#ifndef MAPNIK_LIBXML2_LOADER_HPP
|
||||
#define MAPNIK_LIBXML2_LOADER_HPP
|
||||
|
||||
// boost
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
namespace mapnik
|
||||
|
@ -33,4 +35,4 @@ void read_xml2( std::string const & filename, boost::property_tree::ptree & pt);
|
|||
void read_xml2_string( std::string const & str, boost::property_tree::ptree & pt, std::string const & base_path="");
|
||||
}
|
||||
|
||||
#endif // LIBXML2_LOADER_INCLUDED
|
||||
#endif // MAPNIK_LIBXML2_LOADER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,10 +19,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: polygon_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef LINE_PATTERN_SYMBOLIZER_HPP
|
||||
#define LINE_PATTERN_SYMBOLIZER_HPP
|
||||
#ifndef MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP
|
||||
#define MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
|
@ -38,4 +37,4 @@ struct MAPNIK_DECL line_pattern_symbolizer :
|
|||
};
|
||||
}
|
||||
|
||||
#endif // LINE_PATTERN_SYMBOLIZER_HPP
|
||||
#endif // MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,11 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: line_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef LINE_SYMBOLIZER_HPP
|
||||
#define LINE_SYMBOLIZER_HPP
|
||||
#ifndef MAPNIK_LINE_SYMBOLIZER_HPP
|
||||
#define MAPNIK_LINE_SYMBOLIZER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/stroke.hpp>
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
@ -82,4 +82,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif //LINE_SYMBOLIZER_HPP
|
||||
#endif // MAPNIK_LINE_SYMBOLIZER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,16 +19,18 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
// $Id$
|
||||
|
||||
#ifndef MAP_LOADER_HPP
|
||||
#define MAP_LOADER_HPP
|
||||
#ifndef MAPNIK_LOAD_MAP_HPP
|
||||
#define MAPNIK_LOAD_MAP_HPP
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <config.hpp>
|
||||
#endif
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/map.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
namespace mapnik
|
||||
|
@ -37,4 +39,4 @@ MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict =
|
|||
MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string const& base_path="");
|
||||
}
|
||||
|
||||
#endif // LOAD_MAP_HPP
|
||||
#endif // MAPNIK_LOAD_MAP_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -19,13 +19,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: map.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef MAP_HPP
|
||||
#define MAP_HPP
|
||||
#ifndef MAPNIK_MAP_HPP
|
||||
#define MAPNIK_MAP_HPP
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <config.hpp>
|
||||
#endif
|
||||
|
||||
// mapnik
|
||||
|
@ -461,4 +460,4 @@ private:
|
|||
DEFINE_ENUM(aspect_fix_mode_e,Map::aspect_fix_mode);
|
||||
}
|
||||
|
||||
#endif //MAP_HPP
|
||||
#endif // MAPNIK_MAP_HPP
|
||||
|
|
|
@ -20,21 +20,19 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MEMORY_REGION_CACHE_HPP
|
||||
#define MEMORY_REGION_CACHE_HPP
|
||||
#ifndef MAPNIK_MAPPED_MEMORY_CACHE_HPP
|
||||
#define MAPNIK_MAPPED_MEMORY_CACHE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#endif
|
||||
|
@ -61,5 +59,5 @@ struct MAPNIK_DECL mapped_memory_cache :
|
|||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_MARKER_CACHE_HPP
|
||||
#endif // MAPNIK_MAPPED_MEMORY_CACHE_HPP
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,18 +20,19 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id: image_data.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef MARKER_HPP
|
||||
#define MARKER_HPP
|
||||
#ifndef MAPNIK_MARKER_HPP
|
||||
#define MAPNIK_MARKER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
#include <mapnik/svg/svg_storage.hpp>
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_path_storage.h"
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
@ -39,6 +40,7 @@
|
|||
#include <boost/optional.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// stl
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -125,4 +127,4 @@ private:
|
|||
|
||||
}
|
||||
|
||||
#endif //MARKER_HPP
|
||||
#endif // MAPNIK_MARKER_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2009 Artem Pavlenko
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_MARKER_CACHE_HPP
|
||||
#define MAPNIK_MARKER_CACHE_HPP
|
||||
|
||||
|
@ -32,8 +30,10 @@
|
|||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
#include <mapnik/svg/svg_storage.hpp>
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_path_storage.h"
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue