Merge branch 'master' into gsoc-crundel

This commit is contained in:
Dane Springmeyer 2011-11-09 16:57:20 -08:00
commit 43f2fa7075
395 changed files with 7881 additions and 5252 deletions

10
.gitignore vendored
View file

@ -1,3 +1,4 @@
.DS_Store
*~ *~
*.o *.o
*.pyc *.pyc
@ -24,3 +25,12 @@ utils/pgsql2sqlite/pgsql2sqlite
utils/svg2png/svg2png utils/svg2png/svg2png
demo/python/demo* 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

View file

@ -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) - 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 Mapnik 2.0.0

View file

@ -329,7 +329,7 @@ opts.AddVariables(
('BOOST_TOOLKIT','Specify boost toolkit, e.g., gcc41.','',False), ('BOOST_TOOLKIT','Specify boost toolkit, e.g., gcc41.','',False),
('BOOST_ABI', 'Specify boost ABI, e.g., d.','',False), ('BOOST_ABI', 'Specify boost ABI, e.g., d.','',False),
('BOOST_VERSION','Specify boost version, e.g., 1_35.','',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 # Variables for required dependencies
('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'), ('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'),
@ -425,7 +425,6 @@ pickle_store = [# Scons internal variables
'PYTHON_INSTALL_LOCATION', 'PYTHON_INSTALL_LOCATION',
'PYTHON_SYS_PREFIX', 'PYTHON_SYS_PREFIX',
'COLOR_PRINT', 'COLOR_PRINT',
'HAS_BOOST_SYSTEM',
'SVN_REVISION', 'SVN_REVISION',
'HAS_CAIRO', 'HAS_CAIRO',
'HAS_PYCAIRO', 'HAS_PYCAIRO',
@ -451,6 +450,7 @@ pickle_store = [# Scons internal variables
'CAIROMM_LIBPATHS', 'CAIROMM_LIBPATHS',
'CAIROMM_LINKFLAGS', 'CAIROMM_LINKFLAGS',
'CAIROMM_CPPPATHS', 'CAIROMM_CPPPATHS',
'SVG_RENDERER',
] ]
# Add all other user configurable options to pickle pickle_store # 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(CPPPATH = os.path.realpath(inc_path))
env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
conf.parse_config('FREETYPE_CONFIG') if conf.parse_config('FREETYPE_CONFIG'):
# check if freetype links to bz2
# check if freetype links to bz2 if env['RUNTIME_LINK'] == 'static':
if env['RUNTIME_LINK'] == 'static': temp_env = env.Clone()
temp_env = env.Clone() temp_env['LIBS'] = []
temp_env['LIBS'] = [] try:
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG']) temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
if 'bz2' in temp_env['LIBS']: if 'bz2' in temp_env['LIBS']:
env['EXTRA_FREETYPE_LIBS'].append('bz2') env['EXTRA_FREETYPE_LIBS'].append('bz2')
except OSError,e:
pass
# libxml2 should be optional but is currently not # libxml2 should be optional but is currently not
# https://github.com/mapnik/mapnik/issues/913 # https://github.com/mapnik/mapnik/issues/913
@ -1105,14 +1107,14 @@ if not preconfigured:
if env['PRIORITIZE_LINKING']: if env['PRIORITIZE_LINKING']:
conf.prioritize_paths(silent=False) conf.prioritize_paths(silent=False)
for libinfo in LIBSHEADERS: for libname, headers, required, lang in LIBSHEADERS:
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], libinfo[3]): if not conf.CheckLibWithHeader(libname, headers, lang):
if libinfo[2]: if required:
color_print(1,'Could not find required header or shared library for %s' % libinfo[0]) color_print(1, 'Could not find required header or shared library for %s' % libname)
env['MISSING_DEPS'].append(libinfo[0]) env['MISSING_DEPS'].append(libname)
else: else:
color_print(4,'Could not find optional header or shared library for %s' % libinfo[0]) color_print(4, 'Could not find optional header or shared library for %s' % libname)
env['SKIPPED_DEPS'].append(libinfo[0]) env['SKIPPED_DEPS'].append(libname)
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
if not conf.icu_at_least_four_two(): if not conf.icu_at_least_four_two():
@ -1126,18 +1128,14 @@ if not preconfigured:
conf.FindBoost(BOOST_SEARCH_PREFIXES,thread_flag) 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() boost_lib_version_from_header = conf.GetBoostLibVersion()
if boost_lib_version_from_header: if boost_lib_version_from_header:
boost_version_from_header = int(boost_lib_version_from_header.split('_')[1]) 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. # The other required boost headers.
BOOST_LIBSHEADERS = [ 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], ['filesystem', 'boost/filesystem/operations.hpp', True],
['regex', 'boost/regex.hpp', True], ['regex', 'boost/regex.hpp', True],
['program_options', 'boost/program_options.hpp', False] ['program_options', 'boost/program_options.hpp', False]
@ -1502,7 +1500,7 @@ if not preconfigured:
if not conf.CheckHeader(header='Python.h',language='C'): 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']) color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
env.Replace(**backup) env.Replace(**backup)
env['MISSING_DEPS'].append('python %s development headers' % env['PYTHON_VERSION']) Exit(1)
else: else:
env.Replace(**backup) env.Replace(**backup)
@ -1510,6 +1508,15 @@ if not preconfigured:
color_print(1,"Python version 2.2 or greater required") color_print(1,"Python version 2.2 or greater required")
Exit(1) 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,'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 %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'])) color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION']))

View file

@ -48,13 +48,7 @@ if env['JPEG']:
libraries.append('jpeg') libraries.append('jpeg')
if env['BOOST_PYTHON_LIB']: if env['BOOST_PYTHON_LIB']:
if os.path.sep in env['BOOST_PYTHON_LIB']: libraries.append(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))
else: else:
if is_py3(): if is_py3():
libraries.append('boost_python3%s' % env['BOOST_APPEND']) libraries.append('boost_python3%s' % env['BOOST_APPEND'])

View file

@ -410,6 +410,13 @@ def Raster(**keywords):
Optional keyword arguments: Optional keyword arguments:
base -- path prefix (default None) 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 >>> 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) >>> 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: Required keyword arguments:
file -- path to OGR supported dataset 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: 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) base -- path prefix (default None)
encoding -- file encoding (default 'utf-8') encoding -- file encoding (default 'utf-8')
multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False) multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)

View file

@ -15,6 +15,7 @@ page.render_map(m,"my_output_file.pdf")
see the documentation of mapnik2.printing.PDFPrinter() for options 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 from . import render, Map, Box2d, MemoryDatasource, Layer, Feature, Projection, ProjTransform, Coord, Style, Rule, Geometry2d
import math import math

View file

@ -78,7 +78,6 @@ void export_geometry()
.def("envelope",&geometry_type::envelope) .def("envelope",&geometry_type::envelope)
// .def("__str__",&geometry_type::to_string) // .def("__str__",&geometry_type::to_string)
.def("type",&geometry_type::type) .def("type",&geometry_type::type)
.def("area",&geometry_type::area)
// TODO add other geometry_type methods // TODO add other geometry_type methods
; ;

View 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))")
;
}

View file

@ -66,6 +66,7 @@ void export_view_transform();
void export_raster_colorizer(); void export_raster_colorizer();
void export_glyph_symbolizer(); void export_glyph_symbolizer();
void export_inmem_metawriter(); void export_inmem_metawriter();
void export_label_collision_detector();
#include <mapnik/version.hpp> #include <mapnik/version.hpp>
#include <mapnik/value_error.hpp> #include <mapnik/value_error.hpp>
@ -120,6 +121,28 @@ void render(const mapnik::Map& map,
Py_END_ALLOW_THREADS 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, void render_layer2(const mapnik::Map& map,
mapnik::image_32& image, mapnik::image_32& image,
unsigned layer_idx) 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_overloads, save_map, 2, 3)
BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_to_string_overloads, save_map_to_string, 1, 2) 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_overloads, render, 2, 5)
BOOST_PYTHON_FUNCTION_OVERLOADS(render_with_detector_overloads, render_with_detector, 3, 6)
BOOST_PYTHON_MODULE(_mapnik2) BOOST_PYTHON_MODULE(_mapnik2)
{ {
@ -427,6 +451,7 @@ BOOST_PYTHON_MODULE(_mapnik2)
export_raster_colorizer(); export_raster_colorizer();
export_glyph_symbolizer(); export_glyph_symbolizer();
export_inmem_metawriter(); export_inmem_metawriter();
export_label_collision_detector();
def("render_grid",&render_grid, def("render_grid",&render_grid,
( arg("map"), ( arg("map"),
@ -503,6 +528,19 @@ BOOST_PYTHON_MODULE(_mapnik2)
"\n" "\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, def("render_layer", &render_layer2,
(arg("map"),arg("image"),args("layer")) (arg("map"),arg("image"),args("layer"))
); );

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -1,5 +1,6 @@
/* This file is part of Mapnik (c++ mapping toolkit) /* 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 * Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View file

@ -736,7 +736,7 @@ namespace agg
template<class VertexSource> template<class VertexSource>
void join_path(VertexSource& vs, unsigned path_id = 0) void join_path(VertexSource& vs, unsigned path_id = 0)
{ {
double x, y; double x=0.0, y=0.0;
unsigned cmd; unsigned cmd;
vs.rewind(path_id); vs.rewind(path_id);
cmd = vs.vertex(&x, &y); cmd = vs.vertex(&x, &y);

View file

@ -323,68 +323,65 @@ namespace agg
int y2; int y2;
int lprev; 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]; case outline_miter_join:
x1 = v->x; case outline_round_join:
y1 = v->y; dv.flags =
lprev = v->len; (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
break;
v = &m_src_vertices[0]; case outline_miter_accurate_join:
x2 = v->x; dv.flags = 0;
y2 = v->y; break;
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());
} }
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 else
{ {

View file

@ -78,8 +78,8 @@ namespace agg
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void rounded_rect::normalize_radius() void rounded_rect::normalize_radius()
{ {
double dx = fabs(m_y2 - m_y1); double dx = fabs(m_x2 - m_x1);
double dy = fabs(m_x2 - m_x1); double dy = fabs(m_y2 - m_y1);
double k = 1.0; double k = 1.0;
double t; double t;

View file

@ -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. 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. 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. 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 ## 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. 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 #### 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 #### 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: #### 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: #### 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 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) if (a == b)
{ {

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_AGG_PATTERN_SOURCE_HPP #ifndef MAPNIK_AGG_PATTERN_SOURCE_HPP
#define MAPNIK_AGG_PATTERN_SOURCE_HPP #define MAPNIK_AGG_PATTERN_SOURCE_HPP
// mapnik // mapnik
#include <mapnik/image_data.hpp> #include <mapnik/image_data.hpp>
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
// agg // agg
#include "agg_color_rgba.h" #include "agg_color_rgba.h"
@ -61,4 +62,4 @@ private:
}; };
} }
#endif //MAPNIK_AGG_PATTERN_SOURCE_HPP #endif // MAPNIK_AGG_PATTERN_SOURCE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_AGG_RASTERIZER_HPP #ifndef MAPNIK_AGG_RASTERIZER_HPP
#define MAPNIK_AGG_RASTERIZER_HPP #define MAPNIK_AGG_RASTERIZER_HPP
// boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
// agg
#include "agg_rasterizer_scanline_aa.h" #include "agg_rasterizer_scanline_aa.h"
namespace mapnik { namespace mapnik {
@ -33,4 +35,4 @@ struct rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {};
} }
#endif //MAPNIK_AGG_RASTERIZER_HPP #endif // MAPNIK_AGG_RASTERIZER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_AGG_RENDERER_HPP
#define MAPNIK_AGG_RENDERER_HPP
#ifndef AGG_RENDERER_HPP
#define AGG_RENDERER_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
@ -40,6 +38,7 @@
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
// FIXME // FIXME
// forward declare so that // forward declare so that
@ -61,7 +60,11 @@ class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T>
{ {
public: 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); 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(); ~agg_renderer();
void start_map_processing(Map const& map); void start_map_processing(Map const& map);
void end_map_processing(Map const& map); void end_map_processing(Map const& map);
@ -122,9 +125,11 @@ private:
CoordTransform t_; CoordTransform t_;
freetype_engine font_engine_; freetype_engine font_engine_;
face_manager<freetype_engine> font_manager_; face_manager<freetype_engine> font_manager_;
label_collision_detector4 detector_; boost::shared_ptr<label_collision_detector4> detector_;
boost::scoped_ptr<rasterizer> ras_ptr; boost::scoped_ptr<rasterizer> ras_ptr;
void setup(Map const &m);
}; };
} }
#endif //AGG_RENDERER_HPP #endif // MAPNIK_AGG_RENDERER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_ARROW_HPP
#define MAPNIK_ARROW_HPP
#ifndef ARROW_HPP
#define ARROW_HPP
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
@ -44,4 +42,4 @@ private:
}; };
} }
#endif // ARROW_HPP #endif // MAPNIK_ARROW_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,15 +20,18 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_ATTRIBUTE_HPP #ifndef MAPNIK_ATTRIBUTE_HPP
#define MAPNIK_ATTRIBUTE_HPP #define MAPNIK_ATTRIBUTE_HPP
// mapnik
#include <mapnik/value.hpp>
// stl
#include <string> #include <string>
namespace mapnik { namespace mapnik {
static mapnik::value _null_value;
struct attribute struct attribute
{ {
std::string name_; std::string name_;
@ -38,7 +41,13 @@ struct attribute
template <typename V ,typename F> template <typename V ,typename F>
V value(F const& f) const 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_;} std::string const& name() const { return name_;}
}; };

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,20 +20,20 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_ATTRIBUTE_COLLECTOR_HPP
#define MAPNIK_ATTRIBUTE_COLLECTOR_HPP
#ifndef ATTRIBUTE_COLLECTOR_HPP
#define ATTRIBUTE_COLLECTOR_HPP
// mapnik // mapnik
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/rule.hpp> #include <mapnik/rule.hpp>
#include <mapnik/path_expression_grammar.hpp> #include <mapnik/path_expression_grammar.hpp>
#include <mapnik/parse_path.hpp> #include <mapnik/parse_path.hpp>
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
// stl // stl
#include <set> #include <set>
#include <iostream> #include <iostream>
@ -271,4 +271,4 @@ private:
} // namespace mapnik } // namespace mapnik
#endif //ATTRIBUTE_COLLECTOR_HPP #endif // MAPNIK_ATTRIBUTE_COLLECTOR_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
#define MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
#ifndef ATTRIBUTE_DESCRIPTOR
#define ATTRIBUTE_DESCRIPTOR
#include <string> #include <string>
@ -118,4 +116,4 @@ operator << (std::basic_ostream<charT,traits>& out,
} }
#endif // ATTRIBUTE_DESCRIPTOR_HPP #endif // MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 #ifndef MAPNIK_BOX2D_HPP
#define MAPNIK_BOX2D_HPP #define MAPNIK_BOX2D_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/coord.hpp> #include <mapnik/coord.hpp>
// boost // boost
#include <boost/operators.hpp> #include <boost/operators.hpp>
// stl // stl
#include <iomanip> #include <iomanip>

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,10 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#if defined(HAVE_CAIRO) #if defined(HAVE_CAIRO)
#ifndef CAIRO_RENDERER_HPP #ifndef MAPNIK_CAIRO_RENDERER_HPP
#define CAIRO_RENDERER_HPP #define MAPNIK_CAIRO_RENDERER_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
@ -152,6 +148,6 @@ public:
}; };
} }
#endif #endif // MAPNIK_CAIRO_RENDERER_HPP
#endif //CAIRO_RENDERER_HPP #endif

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_COLOR_HPP
#define MAPNIK_COLOR_HPP
#ifndef COLOR_HPP
#define COLOR_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
@ -32,6 +30,7 @@
//boost //boost
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
// stl // stl
#include <sstream> #include <sstream>
@ -141,4 +140,4 @@ public:
} }
#endif //COLOR_HPP #endif // MAPNIK_COLOR_HPP

View file

@ -20,8 +20,6 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_COLOR_FACTORY_HPP #ifndef MAPNIK_COLOR_FACTORY_HPP
#define MAPNIK_COLOR_FACTORY_HPP #define MAPNIK_COLOR_FACTORY_HPP
@ -120,4 +118,4 @@ public:
#endif #endif
#endif //MAPNIK_COLOR_FACTORY_HPP #endif // MAPNIK_COLOR_FACTORY_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef CONFIG_HPP #ifndef MAPNIK_CONFIG_HPP
#define CONFIG_HPP #define MAPNIK_CONFIG_HPP
// Windows DLL support // Windows DLL support
@ -47,4 +47,5 @@
#endif #endif
#define PROJ_ENVELOPE_POINTS 20 #define PROJ_ENVELOPE_POINTS 20
#endif // CONFIG_HPP
#endif // MAPNIK_CONFIG_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef MAPNIK_CONFIG_ERROR_INCLUDED #ifndef MAPNIK_CONFIG_ERROR_HPP
#define MAPNIK_CONFIG_ERROR_INCLUDED #define MAPNIK_CONFIG_ERROR_HPP
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -54,4 +54,4 @@ protected:
}; };
} }
#endif // MAPNIK_CONFIG_ERROR_INCLUDED #endif // MAPNIK_CONFIG_ERROR_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_COORD_HPP
#define MAPNIK_COORD_HPP
#ifndef COORD_HPP
#define COORD_HPP
// boost
#include <boost/operators.hpp> #include <boost/operators.hpp>
// stl
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@ -187,4 +188,4 @@ operator << (std::basic_ostream<charT,traits>& out,
} }
} }
#endif // COORD_HPP #endif // MAPNIK_COORD_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_COORD_ARRAY_HPP
#define MAPNIK_COORD_ARRAY_HPP
#ifndef COORD_ARRAY_HPP
#define COORD_ARRAY_HPP
//mapnik //mapnik
#include <mapnik/coord.hpp> #include <mapnik/coord.hpp>
// stl // stl
#include <cassert> #include <cassert>
@ -89,4 +88,4 @@ private:
} }
#endif //COORD_ARRAY_HPP #endif // MAPNIK_COORD_ARRAY_HPP

View file

@ -20,22 +20,23 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP #ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP
#define MAPNIK_CSS_COLOR_GRAMMAR_HPP #define MAPNIK_CSS_COLOR_GRAMMAR_HPP
// mapnik // mapnik
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
// spirit2 // spirit2
#include <boost/config/warning_disable.hpp> #include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_action.hpp>
// phoenix // phoenix
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp> #include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
// fusion // fusion
#include <boost/fusion/include/adapt_struct.hpp> #include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/include/adapt_adt.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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,22 +20,23 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
#define MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP
#define MAPNIK_CSS_COLOR_GRAMMAR_HPP
// mapnik // mapnik
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
// spirit2 // spirit2
#include <boost/config/warning_disable.hpp> #include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_action.hpp>
// phoenix // phoenix
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp> #include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
// fusion // fusion
#include <boost/fusion/include/adapt_struct.hpp> #include <boost/fusion/include/adapt_struct.hpp>
@ -45,7 +46,6 @@
// stl // stl
#include <string> #include <string>
//BOOST_FUSION_ADAPT_CLASS( //BOOST_FUSION_ADAPT_CLASS(
// mapnik::color, // mapnik::color,
// (unsigned, unsigned, obj.red(), obj.set_red(val)) // (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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,35 +20,44 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id: ctrans.hpp 39 2005-04-10 20:39:53Z pavlenko $ #ifndef MAPNIK_CTRANS_HPP
#define MAPNIK_CTRANS_HPP
#ifndef CTRANS_HPP
#define CTRANS_HPP
#include <algorithm>
// mapnik
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
#include <mapnik/coord_array.hpp> #include <mapnik/coord_array.hpp>
#include <mapnik/proj_transform.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; typedef coord_array<coord2d> CoordinateArray;
template <typename Transform,typename Geometry>
template <typename Transform, typename Geometry>
struct MAPNIK_DECL coord_transform struct MAPNIK_DECL coord_transform
{ {
coord_transform(Transform const& t, Geometry& geom) coord_transform(Transform const& t, Geometry& geom)
: t_(t), geom_(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); unsigned command = geom_.vertex(x, y);
t_.forward(x,y); t_.forward(x, y);
return command; return command;
} }
void rewind (unsigned pos) void rewind(unsigned pos)
{ {
geom_.rewind(pos); geom_.rewind(pos);
} }
@ -58,7 +67,8 @@ private:
Geometry& geom_; Geometry& geom_;
}; };
template <typename Transform,typename Geometry>
template <typename Transform, typename Geometry>
struct MAPNIK_DECL coord_transform2 struct MAPNIK_DECL coord_transform2
{ {
typedef std::size_t size_type; typedef std::size_t size_type;
@ -71,39 +81,29 @@ struct MAPNIK_DECL coord_transform2
geom_(geom), geom_(geom),
prj_trans_(prj_trans) {} 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 ok = false;
bool skipped_points = false; bool skipped_points = false;
while (!ok) double z = 0;
while (!ok && command != SEG_END)
{ {
command = geom_.vertex(x,y); command = geom_.vertex(x, y);
double z=0; ok = prj_trans_.backward(*x, *y, z);
ok = prj_trans_.backward(*x,*y,z);
if (!ok) { if (!ok) {
skipped_points = true; skipped_points = true;
} }
ok = ok || (command == SEG_END);
} }
if (skipped_points && (command == SEG_LINETO)) if (skipped_points && (command == SEG_LINETO))
{ {
command = SEG_MOVETO; command = SEG_MOVETO;
} }
t_.forward(x,y); t_.forward(x, y);
return command; return command;
} }
/*unsigned vertex(double * x , double * y) const void rewind(unsigned pos)
{
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)
{ {
geom_.rewind(pos); geom_.rewind(pos);
} }
@ -120,7 +120,7 @@ private:
}; };
template <typename Transform,typename Geometry> template <typename Transform, typename Geometry>
struct MAPNIK_DECL coord_transform3 struct MAPNIK_DECL coord_transform3
{ {
coord_transform3(Transform const& t, coord_transform3(Transform const& t,
@ -132,18 +132,18 @@ struct MAPNIK_DECL coord_transform3
prj_trans_(prj_trans), prj_trans_(prj_trans),
dx_(dx), dy_(dy) {} dx_(dx), dy_(dy) {}
unsigned vertex(double * x , double * y) const unsigned vertex(double *x, double *y) const
{ {
unsigned command = geom_.vertex(x,y); unsigned command = geom_.vertex(x, y);
double z=0; double z = 0;
prj_trans_.backward(*x,*y,z); prj_trans_.backward(*x, *y, z);
t_.forward(x,y); t_.forward(x, y);
*x+=dx_; *x += dx_;
*y+=dy_; *y += dy_;
return command; return command;
} }
void rewind (unsigned pos) void rewind(unsigned pos)
{ {
geom_.rewind(pos); geom_.rewind(pos);
} }
@ -156,6 +156,225 @@ private:
int dy_; 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 class CoordTransform
{ {
private: private:
@ -166,13 +385,15 @@ private:
box2d<double> extent_; box2d<double> extent_;
double offset_x_; double offset_x_;
double offset_y_; double offset_y_;
public: 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) 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(); sx_ = static_cast<double>(width_) / extent_.width();
sy_ = (double(height_))/extent_.height(); sy_ = static_cast<double>(height_) / extent_.height();
} }
inline int width() const inline int width() const
@ -195,42 +416,43 @@ public:
return sy_; 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_; *x = (*x - extent_.minx()) * sx_ - offset_x_;
*y = (extent_.maxy() - *y) * sy_ - offset_y_; *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_; *x = extent_.minx() + (*x + offset_x_) / sx_;
*y = extent_.maxy() - (*y + offset_y_)/sy_; *y = extent_.maxy() - (*y + offset_y_) / sy_;
} }
inline coord2d& forward(coord2d& c) const inline coord2d& forward(coord2d& c) const
{ {
forward(&c.x,&c.y); forward(&c.x, &c.y);
return c; return c;
} }
inline coord2d& backward(coord2d& c) const inline coord2d& backward(coord2d& c) const
{ {
backward(&c.x,&c.y); backward(&c.x, &c.y);
return c; return c;
} }
inline box2d<double> forward(const box2d<double>& e,proj_transform const& prj_trans) const inline box2d<double> forward(const box2d<double>& e,
proj_transform const& prj_trans) const
{ {
double x0 = e.minx(); double x0 = e.minx();
double y0 = e.miny(); double y0 = e.miny();
double x1 = e.maxx(); double x1 = e.maxx();
double y1 = e.maxy(); double y1 = e.maxy();
double z = 0.0; double z = 0.0;
prj_trans.backward(x0,y0,z); prj_trans.backward(x0, y0, z);
forward(&x0,&y0); forward(&x0, &y0);
prj_trans.backward(x1,y1,z); prj_trans.backward(x1, y1, z);
forward(&x1,&y1); forward(&x1, &y1);
return box2d<double>(x0,y0,x1,y1); return box2d<double>(x0, y0, x1, y1);
} }
inline box2d<double> forward(const box2d<double>& e) const inline box2d<double> forward(const box2d<double>& e) const
@ -239,23 +461,24 @@ public:
double y0 = e.miny(); double y0 = e.miny();
double x1 = e.maxx(); double x1 = e.maxx();
double y1 = e.maxy(); double y1 = e.maxy();
forward(&x0,&y0); forward(&x0, &y0);
forward(&x1,&y1); forward(&x1, &y1);
return box2d<double>(x0,y0,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 x0 = e.minx();
double y0 = e.miny(); double y0 = e.miny();
double x1 = e.maxx(); double x1 = e.maxx();
double y1 = e.maxy(); double y1 = e.maxy();
double z = 0.0; double z = 0.0;
backward(&x0,&y0); backward(&x0, &y0);
prj_trans.forward(x0,y0,z); prj_trans.forward(x0, y0, z);
backward(&x1,&y1); backward(&x1, &y1);
prj_trans.forward(x1,y1,z); prj_trans.forward(x1, y1, z);
return box2d<double>(x0,y0,x1,y1); return box2d<double>(x0, y0, x1, y1);
} }
inline box2d<double> backward(const box2d<double>& e) const inline box2d<double> backward(const box2d<double>& e) const
@ -264,14 +487,14 @@ public:
double y0 = e.miny(); double y0 = e.miny();
double x1 = e.maxx(); double x1 = e.maxx();
double y1 = e.maxy(); double y1 = e.maxy();
backward(&x0,&y0); backward(&x0, &y0);
backward(&x1,&y1); backward(&x1, &y1);
return box2d<double>(x0,y0,x1,y1); return box2d<double>(x0, y0, x1, y1);
} }
inline CoordinateArray& forward(CoordinateArray& coords) const 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]); forward(coords[i]);
} }
@ -280,12 +503,13 @@ public:
inline CoordinateArray& backward(CoordinateArray& coords) const 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]); backward(coords[i]);
} }
return coords; return coords;
} }
inline box2d<double> const& extent() const inline box2d<double> const& extent() const
{ {
return extent_; return extent_;
@ -293,4 +517,4 @@ public:
}; };
} }
#endif //CTRANS_HPP #endif // MAPNIK_CTRANS_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/ctrans.hpp> #include <mapnik/ctrans.hpp>
@ -31,9 +30,11 @@
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
// stl // stl
#include <map> #include <map>
#include <string> #include <string>
@ -142,6 +143,7 @@ typedef boost::shared_ptr<datasource> datasource_ptr;
delete ds; \ delete ds; \
} \ } \
// //
} }
#endif //DATASOURCE_HPP #endif // MAPNIK_DATASOURCE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_DATASOURCE_CACHE_HPP
#define MAPNIK_DATASOURCE_CACHE_HPP
#ifndef DATASOURCE_CACHE_HPP
#define DATASOURCE_CACHE_HPP
// mapnik // mapnik
#include <mapnik/utils.hpp> #include <mapnik/utils.hpp>
#include <mapnik/params.hpp> #include <mapnik/params.hpp>
#include <mapnik/plugin.hpp> #include <mapnik/plugin.hpp>
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
// boost // boost
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
// stl // stl
#include <map> #include <map>
@ -57,4 +57,4 @@ public:
}; };
} }
#endif //DATASOURCE_CACHE_HPP #endif // MAPNIK_DATASOURCE_CACHE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_DISTANCE_HPP
#define MAPNIK_DISTANCE_HPP
#ifndef DISTANCE_HPP
#define DISTANCE_HPP
#include <mapnik/coord.hpp> #include <mapnik/coord.hpp>
@ -52,4 +50,4 @@ public:
*/ */
} }
#endif // GEO_UTILS_HPP #endif // MAPNIK_DISTANCE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,6 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_ELLIPSOID_HPP #ifndef MAPNIK_ELLIPSOID_HPP
#define MAPNIK_ELLIPSOID_HPP #define MAPNIK_ELLIPSOID_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,11 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef MAPNIK_ENUMERATION_INCLUDED #ifndef MAPNIK_ENUMERATION_HPP
#define MAPNIK_ENUMERATION_INCLUDED #define MAPNIK_ENUMERATION_HPP
// mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
// stl
#include <vector> #include <vector>
#include <bitset> #include <bitset>
#include <iostream> #include <iostream>
@ -325,4 +327,4 @@ operator>>(std::istream & is, mapnik::enumeration<ENUM, THE_MAX> & e)
template <> std::string name ::our_name_ = #name; \ template <> std::string name ::our_name_ = #name; \
template <> bool name ::our_verified_flag_( name ::verify(__FILE__, __LINE__)); template <> bool name ::our_verified_flag_( name ::verify(__FILE__, __LINE__));
#endif // MAPNIK_ENUMERATION_INCLUDED #endif // MAPNIK_ENUMERATION_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,11 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_EXPRESSION_EVALUATOR_HPP #ifndef MAPNIK_EXPRESSION_EVALUATOR_HPP
#define MAPNIK_EXPRESSION_EVALUATOR_HPP #define MAPNIK_EXPRESSION_EVALUATOR_HPP
// boost // boost
#include <boost/regex.hpp> #include <boost/regex.hpp>
//#include <boost/regex/config.hpp>
#if defined(BOOST_REGEX_HAS_ICU) #if defined(BOOST_REGEX_HAS_ICU)
#include <boost/regex/icu.hpp> #include <boost/regex/icu.hpp>
#endif #endif
@ -43,7 +40,11 @@ struct evaluate : boost::static_visitor<T1>
explicit evaluate(feature_type const& f) explicit evaluate(feature_type const& f)
: feature_(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 value_type operator() (attribute const& attr) const
{ {
return attr.value<value_type,feature_type>(feature_); 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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,6 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_EXPRESSIONS_GRAMMAR_HPP #ifndef MAPNIK_EXPRESSIONS_GRAMMAR_HPP
#define MAPNIK_EXPRESSIONS_GRAMMAR_HPP #define MAPNIK_EXPRESSIONS_GRAMMAR_HPP
@ -34,12 +32,15 @@
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
//spirit2
// spirit2
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_action.hpp>
//fusion
// fusion
#include <boost/fusion/include/adapt_struct.hpp> #include <boost/fusion/include/adapt_struct.hpp>
//phoenix
// phoenix
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_object.hpp> #include <boost/spirit/include/phoenix_object.hpp>
#include <boost/spirit/include/phoenix_operator.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 ] >> ')' | '(' >> expr [_val = _1 ] >> ')'
; ;
attr %= '[' >> +(char_ - ']') >> ']';
#if BOOST_VERSION > 104200 #if BOOST_VERSION > 104200
ustring %= '\'' >> no_skip[*~char_('\'')] >> '\''; ustring %= '\'' >> no_skip[*~char_('\'')] >> '\'';
attr %= '[' >> no_skip[+~char_(']')] >> ']';
#else #else
ustring %= '\'' >> lexeme[*(char_-'\'')] >> '\''; ustring %= '\'' >> lexeme[*(char_-'\'')] >> '\'';
attr %= '[' >> lexeme[+(char_ - ']')] >> ']';
#endif #endif
} }

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,12 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef MAPNIK_EXPRESSION_NODE_HPP #ifndef MAPNIK_EXPRESSION_NODE_HPP
#define MAPNIK_EXPRESSION_NODE_HPP #define MAPNIK_EXPRESSION_NODE_HPP
// mapnik // mapnik
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/attribute.hpp> #include <mapnik/attribute.hpp>
// boost // boost
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_EXPRESSION_STRING_HPP #ifndef MAPNIK_EXPRESSION_STRING_HPP
#define MAPNIK_EXPRESSION_STRING_HPP #define MAPNIK_EXPRESSION_STRING_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/expression_node.hpp> #include <mapnik/expression_node.hpp>
// stl // stl
#include <string> #include <string>

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_FACTORY_HPP
#define MAPNIK_FACTORY_HPP
#ifndef FACTORY_HPP
#define FACTORY_HPP
// mapnik // mapnik
#include <mapnik/utils.hpp> #include <mapnik/utils.hpp>
// stl // stl
#include <stdexcept> #include <stdexcept>
#include <map> #include <map>
@ -89,4 +88,4 @@ public:
}; };
} }
#endif //FACTORY_HPP #endif // MAPNIK_FACTORY_HPP

View file

@ -20,8 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef FASTMATH_HPP #ifndef MAPNIK_FASTMATH_HPP
#define FASTMATH_HPP #define MAPNIK_FASTMATH_HPP
/* Timings: /* Timings:
* fast_sin(not inlined) 8.95s * fast_sin(not inlined) 8.95s
@ -109,4 +109,4 @@ static inline double fast_atan2(double y, double x)
return result; return result;
} }
#endif // FASTMATH_HPP #endif // MAPNIK_FASTMATH_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
@ -36,9 +35,9 @@
#else #else
#include <boost/property_map.hpp> #include <boost/property_map.hpp>
#endif #endif
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
// stl // stl
#include <map> #include <map>
@ -66,6 +65,7 @@ private:
std::map<std::string,value> props_; std::map<std::string,value> props_;
public: public:
typedef std::map<std::string,value>::iterator iterator; typedef std::map<std::string,value>::iterator iterator;
typedef std::map<std::string,value>::const_iterator const_iterator;
explicit feature(int id) explicit feature(int id)
: properties(props_), : properties(props_),
id_(id), id_(id),
@ -157,11 +157,26 @@ public:
return props_.end(); 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::string to_string() const
{ {
std::stringstream ss; std::stringstream ss;
ss << "feature (" << std::endl; ss << "feature "
ss << " id:" << id_ << std::endl; << id_ << " (" << std::endl;
for (std::map<std::string,value>::const_iterator itr=props_.begin(); for (std::map<std::string,value>::const_iterator itr=props_.begin();
itr != props_.end();++itr) 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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,12 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_FEATURE_FACTORY_HPP
#define MAPNIK_FEATURE_FACTORY_HPP
#ifndef FEATURE_FACTORY_HPP
#define FEATURE_FACTORY_HPP
// mapnik
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
// boost
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
//#include <boost/pool/pool_alloc.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::allocate_shared<Feature>(boost::fast_pool_allocator<Feature>(),fid);
return boost::make_shared<Feature>(fid); return boost::make_shared<Feature>(fid);
} }
}; };
} }
#endif //FEATURE_FACTORY_HPP #endif // MAPNIK_FEATURE_FACTORY_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_FEATURE_LAYER_DESC_HPP
#define MAPNIK_FEATURE_LAYER_DESC_HPP
#ifndef FEATURE_LAYER_DESC_HPP
#define FEATURE_LAYER_DESC_HPP
// mapnik // mapnik
#include <mapnik/attribute_descriptor.hpp> #include <mapnik/attribute_descriptor.hpp>
// stl
#include <string> #include <string>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@ -106,4 +105,4 @@ operator << (std::basic_ostream<charT,traits>& out,
} }
} }
#endif //FEATURE_LAYER_DESC_HPP #endif // MAPNIK_FEATURE_LAYER_DESC_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_FEATURE_STYLE_PROCESSOR_HPP
#define MAPNIK_FEATURE_STYLE_PROCESSOR_HPP
#ifndef FEATURE_STYLE_PROCESSOR_HPP
#define FEATURE_STYLE_PROCESSOR_HPP
#include <set> #include <set>
#include <string> #include <string>
@ -74,4 +72,4 @@ private:
}; };
} }
#endif //FEATURE_STYLE_PROCESSOR_HPP #endif // MAPNIK_FEATURE_STYLE_PROCESSOR_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/rule.hpp> #include <mapnik/rule.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/enumeration.hpp> #include <mapnik/enumeration.hpp>
// stl // stl
#include <vector> #include <vector>
@ -69,4 +69,4 @@ public:
}; };
} }
#endif //FEATURE_TYPE_STYLE_HPP #endif // MAPNIK_FEATURE_TYPE_STYLE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,17 +20,16 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_FILL_HPP
#define MAPNIK_FILL_HPP
#ifndef FILL_HPP
#define FILL_HPP
namespace mapnik namespace mapnik
{ {
class fill class fill
{ {
}; };
} }
#endif //FILL_HPP #endif // MAPNIK_FILL_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_FILTER_FACTORY_HPP #ifndef MAPNIK_FILTER_FACTORY_HPP
#define MAPNIK_FILTER_FACTORY_HPP #define MAPNIK_FILTER_FACTORY_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/expression_node.hpp> #include <mapnik/expression_node.hpp>
// stl // stl
#include <string> #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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,11 +20,10 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_FILTER_FEATURESET_HPP #ifndef MAPNIK_FILTER_FEATURESET_HPP
#define MAPNIK_FILTER_FEATURESET_HPP #define MAPNIK_FILTER_FEATURESET_HPP
// mapnik
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
namespace mapnik { namespace mapnik {
@ -54,4 +53,4 @@ private:
}; };
} }
#endif //MAPNIK_FILTER_FEATURESET_HPP #endif // MAPNIK_FILTER_FEATURESET_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
#include <mapnik/utils.hpp> #include <mapnik/utils.hpp>
@ -50,7 +49,6 @@ extern "C"
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#endif #endif
// stl // stl
#include <string> #include <string>
#include <vector> #include <vector>
@ -121,7 +119,13 @@ public:
{ {
if (! FT_Set_Pixel_Sizes( face_, 0, size )) if (! FT_Set_Pixel_Sizes( face_, 0, size ))
return true; 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; return false;
} }
@ -186,6 +190,14 @@ public:
(*face)->set_pixel_sizes(size); (*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: private:
std::vector<face_ptr> faces_; std::vector<face_ptr> faces_;
std::map<unsigned, dimension_t> dimension_cache_; std::map<unsigned, dimension_t> dimension_cache_;
@ -200,7 +212,7 @@ public:
void init(double radius) 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_LINECAP_ROUND,
FT_STROKER_LINEJOIN_ROUND, FT_STROKER_LINEJOIN_ROUND,
0); 0);
@ -334,11 +346,17 @@ struct text_renderer : private boost::noncopyable
halo_radius_(0.0), halo_radius_(0.0),
opacity_(1.0) {} opacity_(1.0) {}
void set_pixel_size(unsigned size) void set_pixel_size(unsigned size)
{ {
faces_->set_pixel_sizes(size); faces_->set_pixel_sizes(size);
} }
void set_character_size(float size)
{
faces_->set_character_sizes(size);
}
void set_fill(mapnik::color const& fill) void set_fill(mapnik::color const& fill)
{ {
fill_=fill; fill_=fill;
@ -602,4 +620,4 @@ private:
}; };
} }
#endif // FONT_ENGINE_FREETYPE_HPP #endif // MAPNIK_FONT_ENGINE_FREETYPE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_FONT_SET_HPP
#define MAPNIK_FONT_SET_HPP
#ifndef FONT_SET_HPP
#define FONT_SET_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
@ -52,4 +50,4 @@ private:
}; };
} }
#endif //FONT_SET_HPP #endif // MAPNIK_FONT_SET_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_GAMMA_HPP
#define MAPNIK_GAMMA_HPP
#ifndef GAMMA_HPP
#define GAMMA_HPP
#include <cmath> #include <cmath>
@ -50,4 +48,4 @@ struct MAPNIK_DECL gamma
}; };
} }
#endif //GAMMA_HPP #endif // MAPNIK_GAMMA_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
// boost // boost
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
// stl // stl
#include <cmath> #include <cmath>
@ -217,4 +218,4 @@ struct filter_at_point
}; };
} }
#endif //GEOM_UTIL_HPP #endif // MAPNIK_GEOM_UTIL_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_GEOMETRY_HPP
#define MAPNIK_GEOMETRY_HPP
#ifndef GEOMETRY_HPP
#define GEOMETRY_HPP
// mapnik // mapnik
#include <mapnik/vertex_vector.hpp> #include <mapnik/vertex_vector.hpp>
#include <mapnik/ctrans.hpp> #include <mapnik/ctrans.hpp>
#include <mapnik/geom_util.hpp> #include <mapnik/geom_util.hpp>
// boost // boost
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
@ -69,26 +68,6 @@ public:
return type_; 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> envelope() const
{ {
box2d<double> result; box2d<double> result;
@ -412,4 +391,4 @@ typedef boost::ptr_vector<geometry_type> geometry_containter;
} }
#endif //GEOMETRY_HPP #endif // MAPNIK_GEOMETRY_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_GLOBAL_HPP
#define MAPNIK_GLOBAL_HPP
#ifndef GLOBAL_HPP
#define GLOBAL_HPP
// boost // boost
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/detail/endian.hpp> #include <boost/detail/endian.hpp>
// stl // stl
#include <cstring> #include <cstring>
@ -183,4 +182,4 @@ inline double round (double val)
#endif //GLOBAL_HPP #endif // MAPNIK_GLOBAL_HPP

View file

@ -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 // mapnik
#include <mapnik/enumeration.hpp> #include <mapnik/enumeration.hpp>
@ -190,4 +212,4 @@ private:
} // end mapnik namespace } // end mapnik namespace
#endif #endif // MAPNIK_GLYPH_SYMBOLIZER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef GRADIENT_HPP #ifndef MAPNIK_GRADIENT_HPP
#define GRADIENT_HPP #define MAPNIK_GRADIENT_HPP
// agg
#include <agg_trans_affine.h> #include <agg_trans_affine.h>
// mapnik // mapnik
@ -104,4 +104,4 @@ private:
}; };
} }
#endif //GRADIENT_HPP #endif // MAPNIK_GRADIENT_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_GRAPHICS_HPP
#define MAPNIK_GRAPHICS_HPP
#ifndef GRAPHICS_HPP
#define GRAPHICS_HPP
// mapnik // mapnik
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
@ -520,4 +518,5 @@ public:
} }
}; };
} }
#endif //GRAPHICS_HPP
#endif // MAPNIK_GRAPHICS_HPP

View file

@ -23,7 +23,7 @@
#ifndef MAPNIK_GRID_PIXFMT_HPP #ifndef MAPNIK_GRID_PIXFMT_HPP
#define MAPNIK_GRID_PIXFMT_HPP #define MAPNIK_GRID_PIXFMT_HPP
#include <string.h> #include <string>
#include "agg_basics.h" #include "agg_basics.h"
#include <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_rendering_buffer.hpp> #include <mapnik/grid/grid_rendering_buffer.hpp>

View file

@ -50,7 +50,10 @@ static inline void scale_grid(mapnik::grid::data_type & target,
int th2 = target_height/2; int th2 = target_height/2;
int offs_x = rint((source_width-target_width-x_off_f*2*source_width)/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); 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 //no scaling or subpixel offset
if (target_height == source_height && target_width == source_width && offs_x == 0 && offs_y == 0){ if (target_height == source_height && target_width == source_width && offs_x == 0 && offs_y == 0){

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef _HEXTREE_HPP_ #ifndef MAPNIK_HEXTREE_HPP
#define _HEXTREE_HPP_ #define MAPNIK_HEXTREE_HPP
// mapnik // mapnik
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
@ -455,4 +454,4 @@ private:
}; };
} // namespace mapnik } // namespace mapnik
#endif // _HEXTREE_HPP_ #endif // MAPNIK_HEXTREE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,11 +20,10 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_HIT_TEST_FILTER_HPP
#define MAPNIK_HIT_TEST_FILTER_HPP
#ifndef HIT_TEST_FILTER_HPP
#define HIT_TEST_FILTER_HPP
// mapnik
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
namespace mapnik { namespace mapnik {
@ -54,4 +53,4 @@ private:
}; };
} }
#endif // HIT_TEST_FILTER_HPP #endif // MAPNIK_HIT_TEST_FILTER_HPP

View file

@ -20,10 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_IMAGE_COMPOSITING_HPP
#define MAPNIK_IMAGE_COMPOSITING_HPP
#ifndef IMAGE_COMPOSITING_HPP
#define IMAGE_COMPOSITING_HPP
// agg // agg
#include "agg_rendering_buffer.h" #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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_IMAGE_DATA_HPP
#define MAPNIK_IMAGE_DATA_HPP
#ifndef IMAGE_DATA_HPP
#define IMAGE_DATA_HPP
// mapnik
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
// stl
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
@ -139,4 +140,4 @@ typedef ImageData<unsigned> image_data_32;
typedef ImageData<byte> image_data_8; typedef ImageData<byte> image_data_8;
} }
#endif //IMAGE_DATA_HPP #endif // MAPNIK_IMAGE_DATA_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 // mapnik
#include <mapnik/image_data.hpp> #include <mapnik/image_data.hpp>
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
// stl // stl
#include <stdexcept> #include <stdexcept>
#include <string> #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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_IMAGE_UTIL_HPP
#define MAPNIK_IMAGE_UTIL_HPP
#ifndef IMAGE_UTIL_HPP
#define IMAGE_UTIL_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #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&); rgba_palette const&);
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> 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&); rgba_palette const&);
#endif #endif
} }
#endif //IMAGE_UTIL_HPP #endif // MAPNIK_IMAGE_UTIL_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,11 +20,8 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_IMAGE_VIEW_HPP
#define MAPNIK_IMAGE_VIEW_HPP
#ifndef IMAGE_VIEW_HPP
#define IMAGE_VIEW_HPP
namespace mapnik { namespace mapnik {
@ -107,5 +104,5 @@ private:
}; };
} }
#endif // IMAGE_VIEW_HPP #endif // MAPNIK_IMAGE_VIEW_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,6 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_JPEG_IO_HPP #ifndef MAPNIK_JPEG_IO_HPP
#define MAPNIK_JPEG_IO_HPP #define MAPNIK_JPEG_IO_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,13 +20,12 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_LABEL_COLLISION_DETECTOR_HPP
#define MAPNIK_LABEL_COLLISION_DETECTOR_HPP
#ifndef LABEL_COLLISION_DETECTOR_HPP
#define LABEL_COLLISION_DETECTOR_HPP
// mapnik // mapnik
#include <mapnik/quad_tree.hpp> #include <mapnik/quad_tree.hpp>
// stl // stl
#include <vector> #include <vector>
#include <unicode/unistr.h> #include <unicode/unistr.h>
@ -138,6 +137,7 @@ public:
//quad tree based label collission detector so labels dont appear within a given distance //quad tree based label collission detector so labels dont appear within a given distance
class label_collision_detector4 : boost::noncopyable class label_collision_detector4 : boost::noncopyable
{ {
public:
struct label struct label
{ {
label(box2d<double> const& b) : box(b) {} label(box2d<double> const& b) : box(b) {}
@ -147,10 +147,12 @@ class label_collision_detector4 : boost::noncopyable
UnicodeString text; UnicodeString text;
}; };
private:
typedef quad_tree< label > tree_t; typedef quad_tree< label > tree_t;
tree_t tree_; tree_t tree_;
public: public:
typedef tree_t::query_iterator query_iterator;
explicit label_collision_detector4(box2d<double> const& extent) explicit label_collision_detector4(box2d<double> const& extent)
: tree_(extent) {} : tree_(extent) {}
@ -224,7 +226,10 @@ public:
{ {
return tree_.extent(); 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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef LABEL_PLACEMENT_HPP #ifndef MAPNIK_LABEL_PLACEMENT_HPP
#define LABEL_PLACEMENT_HPP #define MAPNIK_LABEL_PLACEMENT_HPP
namespace mapnik namespace mapnik
{ {
@ -51,4 +50,4 @@ public:
}; };
} }
#endif //LABEL_PLACEMENT_HPP #endif // MAPNIK_LABEL_PLACEMENT_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * 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 #ifndef MAPNIK_LAYER_HPP
#define LAYER_HPP #define MAPNIK_LAYER_HPP
// mapnik // mapnik
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
@ -217,4 +217,4 @@ private:
}; };
} }
#endif //LAYER_HPP #endif // MAPNIK_LAYER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,11 +20,13 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef LIBXML2_LOADER_INCLUDED #ifndef MAPNIK_LIBXML2_LOADER_HPP
#define LIBXML2_LOADER_INCLUDED #define MAPNIK_LIBXML2_LOADER_HPP
// boost
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
// stl
#include <string> #include <string>
namespace mapnik 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=""); 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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * 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 #ifndef MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP
#define LINE_PATTERN_SYMBOLIZER_HPP #define MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP
// mapnik // mapnik
#include <mapnik/symbolizer.hpp> #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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * 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 #ifndef MAPNIK_LINE_SYMBOLIZER_HPP
#define LINE_SYMBOLIZER_HPP #define MAPNIK_LINE_SYMBOLIZER_HPP
// mapnik
#include <mapnik/stroke.hpp> #include <mapnik/stroke.hpp>
#include <mapnik/symbolizer.hpp> #include <mapnik/symbolizer.hpp>
#include <mapnik/enumeration.hpp> #include <mapnik/enumeration.hpp>
@ -82,4 +82,4 @@ private:
}; };
} }
#endif //LINE_SYMBOLIZER_HPP #endif // MAPNIK_LINE_SYMBOLIZER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
*****************************************************************************/ *****************************************************************************/
// $Id$
#ifndef MAP_LOADER_HPP #ifndef MAPNIK_LOAD_MAP_HPP
#define MAP_LOADER_HPP #define MAPNIK_LOAD_MAP_HPP
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.hpp>
#endif #endif
// mapnik
#include <mapnik/map.hpp> #include <mapnik/map.hpp>
// stl
#include <string> #include <string>
namespace mapnik 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=""); 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

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 * 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 #ifndef MAPNIK_MAP_HPP
#define MAP_HPP #define MAPNIK_MAP_HPP
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.hpp>
#endif #endif
// mapnik // mapnik
@ -461,4 +460,4 @@ private:
DEFINE_ENUM(aspect_fix_mode_e,Map::aspect_fix_mode); DEFINE_ENUM(aspect_fix_mode_e,Map::aspect_fix_mode);
} }
#endif //MAP_HPP #endif // MAPNIK_MAP_HPP

View file

@ -20,21 +20,19 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$ #ifndef MAPNIK_MAPPED_MEMORY_CACHE_HPP
#define MAPNIK_MAPPED_MEMORY_CACHE_HPP
#ifndef MEMORY_REGION_CACHE_HPP
#define MEMORY_REGION_CACHE_HPP
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/utils.hpp> #include <mapnik/utils.hpp>
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/mapped_region.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#ifdef MAPNIK_THREADSAFE #ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#endif #endif
@ -61,5 +59,5 @@ struct MAPNIK_DECL mapped_memory_cache :
} }
#endif // MAPNIK_MARKER_CACHE_HPP #endif // MAPNIK_MAPPED_MEMORY_CACHE_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 MAPNIK_MARKER_HPP
#define MAPNIK_MARKER_HPP
#ifndef MARKER_HPP
#define MARKER_HPP
// mapnik
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
#include <mapnik/image_data.hpp> #include <mapnik/image_data.hpp>
#include <mapnik/svg/svg_path_attributes.hpp> #include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_storage.hpp> #include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp> #include <mapnik/svg/svg_path_adapter.hpp>
// agg
#include "agg_path_storage.h" #include "agg_path_storage.h"
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
@ -39,6 +40,7 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
// stl
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
@ -125,4 +127,4 @@ private:
} }
#endif //MARKER_HPP #endif // MAPNIK_MARKER_HPP

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,8 +20,6 @@
* *
*****************************************************************************/ *****************************************************************************/
//$Id$
#ifndef MAPNIK_MARKER_CACHE_HPP #ifndef MAPNIK_MARKER_CACHE_HPP
#define MAPNIK_MARKER_CACHE_HPP #define MAPNIK_MARKER_CACHE_HPP
@ -32,8 +30,10 @@
#include <mapnik/svg/svg_path_attributes.hpp> #include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_storage.hpp> #include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp> #include <mapnik/svg/svg_path_adapter.hpp>
// agg // agg
#include "agg_path_storage.h" #include "agg_path_storage.h"
// boost // boost
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>

Some files were not shown because too many files have changed in this diff Show more