stay in sync with master
This commit is contained in:
commit
c0c6962780
491 changed files with 8744 additions and 5326 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -39,7 +39,8 @@ tests/data/sqlite/*index
|
|||
demo/c++/cairo-demo.pdf
|
||||
demo/c++/cairo-demo.png
|
||||
demo/c++/cairo-demo256.png
|
||||
demo/c++/demo.tif
|
||||
demo/c++/demo.jpg
|
||||
demo/c++/demo.png
|
||||
demo/c++/demo256.png
|
||||
|
||||
tests/cpp_tests/*-bin
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
# $Id: CHANGELOG 776 2008-12-7 01:30:27Z dane $
|
||||
|
||||
----------------
|
||||
Mapnik Changelog
|
||||
----------------
|
||||
# Mapnik Changelog
|
||||
|
||||
A simple log of core changes affecting Mapnik usage.
|
||||
|
||||
|
@ -11,10 +7,21 @@ Developers: Please commit along with changes.
|
|||
For a complete change history, see the SVN log.
|
||||
|
||||
|
||||
Mapnik 2.1.0
|
||||
------------
|
||||
## Mapnik 2.1.0
|
||||
|
||||
- Removed mutex locking during reprojection if using >= proj 4.7 (#1072)
|
||||
- GDAL: allow setting nodata value on the fly (will override value if nodata is set in data) (#1161)
|
||||
|
||||
- GDAL: respect nodata for paletted/colormapped images (#1160)
|
||||
|
||||
- PostGIS: Added a new option called 'autodetect_key_field' (by default false) that if true will
|
||||
trigger autodetection of a given tables' primary key allowing for feature.id() to represent
|
||||
globally unique ids. This option has no effect if the user has not manually supplied the 'key_field' option. (#804)
|
||||
|
||||
- Cairo: Add full rendering support for markers to match AGG renderer functionality (#1071)
|
||||
|
||||
- Fix Markers rendering so that ellipse height/width units are pixels (previously were unintentionally radii) (#1134)
|
||||
|
||||
- Added 'ignore-placement` attribute to markers-symbolizer (#1135)
|
||||
|
||||
- Removed PointDatasource - use more robust MemoryDatasource instead (#1032)
|
||||
|
||||
|
@ -26,11 +33,47 @@ Mapnik 2.1.0
|
|||
|
||||
- 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)
|
||||
|
||||
- Added suppport for output maps as tiff files (addresses #967 partially)
|
||||
- Added support for output maps as tiff files (addresses #967 partially)
|
||||
|
||||
- Added support for justify-alignment=auto. This is the new default. (#1125)
|
||||
|
||||
|
||||
Mapnik 2.0.0
|
||||
------------
|
||||
## Mapnik 2.0.1
|
||||
|
||||
(Packaged from 5cd3cb2efdaf7e9990a57e8e00b652a81aaa39ae)
|
||||
|
||||
- Support for PostGIS 2.0 (#956,#1083)
|
||||
|
||||
- Switched back to "libmapnik" and "import mapnik" rather than "mapnik2" (mapnik2 will still work from python) (#941)
|
||||
|
||||
- Restored Python 2.5 compatibility (#904)
|
||||
|
||||
- Fixed `mapnik-config --version` (#903)
|
||||
|
||||
- Cairo: Add full rendering support for markers to match AGG renderer functionality (#1071)
|
||||
|
||||
- Fix Markers rendering so that ellipse height/width units are pixels (previously were unintentially radii) (#1134)
|
||||
|
||||
- Added 'ignore-placement` attribute to markers-symbolizer (#1135)
|
||||
|
||||
- Removed svn_revision info from mapnik-config and python bindings as git is now used
|
||||
|
||||
- Removed OGCServer from core - now at https://github.com/mapnik/OGCServer (e7f6267)
|
||||
|
||||
- Fixed SQLite open stability across platforms/versions (#854)
|
||||
|
||||
- Workaround for boost interprocess compile error with recent gcc versions (#950,#1001,#1082)
|
||||
|
||||
- Fix possible memory corruption when using hextree mode for png color reduction (#1087)
|
||||
|
||||
- Fixed bug in shield line placement when dx/dy are used to shift the label relative to the placement point (Matt Amos) (#908)
|
||||
|
||||
- Fix to avoid modifying a feature if an attribute is requested that does not exist (0f5ab18ed)
|
||||
|
||||
- Fixed ability to save to jpeg format from python (7387afd9) (#896)
|
||||
|
||||
|
||||
## Mapnik 2.0.0
|
||||
|
||||
- Add minimum-path-length property to text_symbolizer to allow labels to be placed only on lines of a certain length (#865)
|
||||
|
||||
|
@ -119,8 +162,7 @@ Mapnik 2.0.0
|
|||
- Implement MarkersSymbolizer in Cairo render and improve the markers placement finder. (#553)
|
||||
|
||||
|
||||
Mapnik 0.7.2 Release
|
||||
--------------------
|
||||
# Mapnik 0.7.2 Release
|
||||
|
||||
- Added forward compatibility for Mapnik 2.0 XML syntax (https://trac.mapnik.org/wiki/Mapnik2/Changes)
|
||||
|
||||
|
@ -163,8 +205,7 @@ Mapnik 0.7.2 Release
|
|||
- Fixed reading of label_position_tolerance on text_symbolizer and height for building_symbolizer
|
||||
|
||||
|
||||
Mapnik 0.7.0 Release
|
||||
--------------------
|
||||
# Mapnik 0.7.0 Release
|
||||
|
||||
(Packaged from r1574)
|
||||
|
||||
|
@ -305,8 +346,7 @@ Mapnik 0.7.0 Release
|
|||
|
||||
|
||||
|
||||
Mapnik 0.6.1 Release
|
||||
--------------------
|
||||
# Mapnik 0.6.1 Release
|
||||
|
||||
(Packaged from r1247)
|
||||
|
||||
|
@ -390,8 +430,7 @@ Mapnik 0.6.1 Release
|
|||
|
||||
|
||||
|
||||
Mapnik 0.6.0 Release
|
||||
--------------------
|
||||
# Mapnik 0.6.0 Release
|
||||
|
||||
(Packaged from r1066)
|
||||
|
12
Makefile
12
Makefile
|
@ -18,6 +18,13 @@ uninstall:
|
|||
python scons/scons.py uninstall
|
||||
|
||||
test:
|
||||
@echo "*** Running visual tests…"
|
||||
@python tests/visual_tests/test.py -q
|
||||
@echo "*** Running C++ tests..."
|
||||
@for FILE in tests/cpp_tests/*-bin; do \
|
||||
$${FILE}; \
|
||||
done
|
||||
@echo "*** Running python tests..."
|
||||
@python tests/run_tests.py -q
|
||||
|
||||
pep8:
|
||||
|
@ -26,4 +33,9 @@ pep8:
|
|||
@pep8 -r --select=W293 -q --filename=*.py `pwd`/tests/ | xargs gsed -i 's/^[ \r\t]*$//'
|
||||
@pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs gsed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}'
|
||||
|
||||
grind:
|
||||
@for FILE in tests/cpp_tests/*-bin; do \
|
||||
valgrind --leak-check=full --log-fd=1 $${FILE} | grep definitely; \
|
||||
done
|
||||
|
||||
.PHONY: clean reset uninstall test install
|
||||
|
|
54
SConstruct
54
SConstruct
|
@ -15,8 +15,6 @@
|
|||
# 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
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
import os
|
||||
|
@ -346,6 +344,11 @@ opts.AddVariables(
|
|||
PathVariable('RASTERLITE_INCLUDES', 'Search path for RASTERLITE include files', '/usr/include/', PathVariable.PathAccept),
|
||||
PathVariable('RASTERLITE_LIBS', 'Search path for RASTERLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
|
||||
# Variables for logging and statistics
|
||||
BoolVariable('ENABLE_LOG', 'Enable logging, which is enabled by default when building in *debug*', 'False'),
|
||||
BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'),
|
||||
('LOG_FORMAT_STRING', 'The format string used before log output string, piped through strftime (max length of 255 characters)', 'Mapnik LOG> %Y-%m-%d %H:%M:%S:'),
|
||||
|
||||
# Other variables
|
||||
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
|
||||
('SYSTEM_FONTS','Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)',''),
|
||||
|
@ -359,7 +362,7 @@ opts.AddVariables(
|
|||
EnumVariable('THREADING','Set threading support','multi', ['multi','single']),
|
||||
EnumVariable('XMLPARSER','Set xml parser','libxml2', ['libxml2','ptree']),
|
||||
('JOBS', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int),
|
||||
BoolVariable('DEMO', 'Compile demo c++ application', 'False'),
|
||||
BoolVariable('DEMO', 'Compile demo c++ application', 'True'),
|
||||
BoolVariable('PGSQL2SQLITE', 'Compile and install a utility to convert postgres tables to sqlite', 'False'),
|
||||
BoolVariable('COLOR_PRINT', 'Print build status information in color', 'True'),
|
||||
BoolVariable('SAMPLE_INPUT_PLUGINS', 'Compile and install sample plugins', 'False'),
|
||||
|
@ -768,7 +771,7 @@ def GetMapnikLibVersion(context):
|
|||
|
||||
int main()
|
||||
{
|
||||
std::cout << MAPNIK_VERSION << std::endl;
|
||||
std::cout << MAPNIK_VERSION_STRING << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -778,11 +781,7 @@ int main()
|
|||
context.Result(ret[0])
|
||||
if not ret[1]:
|
||||
return []
|
||||
version = int(ret[1].strip())
|
||||
patch_level = version % 100
|
||||
minor_version = version / 100 % 1000
|
||||
major_version = version / 100000
|
||||
return [major_version,minor_version,patch_level]
|
||||
return ret[1].strip()
|
||||
|
||||
def icu_at_least_four_two(context):
|
||||
ret = context.TryRun("""
|
||||
|
@ -814,6 +813,9 @@ int main()
|
|||
return False
|
||||
|
||||
def boost_regex_has_icu(context):
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
context.env.Append(LIBS='icui18n')
|
||||
context.env.Append(LIBS='icudata')
|
||||
ret = context.TryRun("""
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
|
@ -1072,7 +1074,7 @@ if not preconfigured:
|
|||
|
||||
# libxml2 should be optional but is currently not
|
||||
# https://github.com/mapnik/mapnik/issues/913
|
||||
if conf.parse_config('XML2_CONFIG'):
|
||||
if conf.parse_config('XML2_CONFIG',checks='--cflags'):
|
||||
env['HAS_LIBXML2'] = True
|
||||
|
||||
LIBSHEADERS = [
|
||||
|
@ -1382,14 +1384,13 @@ if not preconfigured:
|
|||
# fetch the mapnik version header in order to set the
|
||||
# ABI version used to build libmapnik.so on linux in src/build.py
|
||||
abi = conf.GetMapnikLibVersion()
|
||||
abi_fallback = [2,0,0]
|
||||
abi_fallback = "2.0.1-pre"
|
||||
if not abi:
|
||||
color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
|
||||
env['ABI_VERSION'] = abi_fallback
|
||||
else:
|
||||
env['ABI_VERSION'] = abi
|
||||
env['MAPNIK_VERSION_STRING'] = '.'.join(['%d' % i for i in env['ABI_VERSION']])
|
||||
abi = abi_fallback
|
||||
|
||||
env['ABI_VERSION'] = abi.replace('-pre','').split('.')
|
||||
env['MAPNIK_VERSION_STRING'] = abi
|
||||
|
||||
# Common C++ flags.
|
||||
if env['THREADING'] == 'multi':
|
||||
|
@ -1411,9 +1412,28 @@ if not preconfigured:
|
|||
pthread = '-pthread'
|
||||
|
||||
# Common debugging flags.
|
||||
debug_flags = '-g -DDEBUG -DMAPNIK_DEBUG'
|
||||
# http://lists.fedoraproject.org/pipermail/devel/2010-November/144952.html
|
||||
debug_flags = '-g -fno-omit-frame-pointer -DDEBUG -DMAPNIK_DEBUG'
|
||||
ndebug_flags = '-DNDEBUG'
|
||||
|
||||
# Enable logging in debug mode (always) and release mode (when specified)
|
||||
log_enabled = ' -DMAPNIK_LOG -DMAPNIK_LOG_FORMAT="%s"' % env['LOG_FORMAT_STRING']
|
||||
|
||||
if env['DEBUG']:
|
||||
debug_flags += log_enabled
|
||||
else:
|
||||
if env['ENABLE_LOG']:
|
||||
ndebug_flags += log_enabled
|
||||
|
||||
# Enable statistics reporting
|
||||
if env['ENABLE_STATS']:
|
||||
debug_flags += ' -DMAPNIK_STATS'
|
||||
ndebug_flags += ' -DMAPNIK_STATS'
|
||||
|
||||
# Add rdynamic to allow using statics between application and plugins
|
||||
# http://stackoverflow.com/questions/8623657/multiple-instances-of-singleton-across-shared-libraries-on-linux
|
||||
if env['PLATFORM'] != 'Darwin':
|
||||
env.MergeFlags('-rdynamic')
|
||||
|
||||
# Customizing the C++ compiler flags depending on:
|
||||
# (1) the C++ compiler used; and
|
||||
|
@ -1719,7 +1739,7 @@ if not HELP_REQUESTED:
|
|||
|
||||
# build C++ tests
|
||||
# not ready for release
|
||||
#SConscript('tests/cpp_tests/build.py')
|
||||
SConscript('tests/cpp_tests/build.py')
|
||||
|
||||
# not ready for release
|
||||
#if env['SVG_RENDERER']:
|
||||
|
|
|
@ -572,13 +572,6 @@ def Geos(**keywords):
|
|||
keywords['type'] = 'geos'
|
||||
return CreateDatasource(keywords)
|
||||
|
||||
def mapnik_version_string(version=mapnik_version()):
|
||||
"""Return the Mapnik version as a string."""
|
||||
patch_level = version % 100
|
||||
minor_version = version / 100 % 1000
|
||||
major_version = version / 100000
|
||||
return '%s.%s.%s' % ( major_version, minor_version,patch_level)
|
||||
|
||||
def mapnik_version_from_string(version_string):
|
||||
"""Return the Mapnik version from a string."""
|
||||
n = version_string.split('.')
|
||||
|
@ -599,113 +592,3 @@ def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.tt
|
|||
# auto-register known plugins and fonts
|
||||
register_plugins()
|
||||
register_fonts()
|
||||
|
||||
# Explicitly export API members to avoid namespace pollution
|
||||
# and ensure correct documentation processing
|
||||
__all__ = [
|
||||
# classes
|
||||
'CharProperties',
|
||||
'Color',
|
||||
'Coord',
|
||||
'Palette',
|
||||
#'ColorBand',
|
||||
'CompositeOp',
|
||||
'DatasourceCache',
|
||||
'MemoryDatasource',
|
||||
'Box2d',
|
||||
'Feature',
|
||||
'Featureset',
|
||||
'FontEngine',
|
||||
'FontSet',
|
||||
'FormattingNode',
|
||||
'FormattingText',
|
||||
'FormattingFormat',
|
||||
'FormattingList',
|
||||
'FormattingExpressionFormat',
|
||||
'Geometry2d',
|
||||
'Image',
|
||||
'ImageView',
|
||||
'Grid',
|
||||
'GridView',
|
||||
'Layer',
|
||||
'Layers',
|
||||
'LinePatternSymbolizer',
|
||||
'LineSymbolizer',
|
||||
'Map',
|
||||
'MarkersSymbolizer',
|
||||
'Names',
|
||||
'Path',
|
||||
'Parameter',
|
||||
'Parameters',
|
||||
'PointSymbolizer',
|
||||
'PolygonPatternSymbolizer',
|
||||
'PolygonSymbolizer',
|
||||
'ProcessedText',
|
||||
'ProjTransform',
|
||||
'Projection',
|
||||
'Query',
|
||||
'RasterSymbolizer',
|
||||
'RasterColorizer',
|
||||
'Rule', 'Rules',
|
||||
'ShieldSymbolizer',
|
||||
'Singleton',
|
||||
'Stroke',
|
||||
'Style',
|
||||
'Symbolizer',
|
||||
'Symbolizers',
|
||||
'TextPlacements',
|
||||
'TextPlacementInfo',
|
||||
'TextSymbolizer',
|
||||
'TextSymbolizerProperties',
|
||||
'ViewTransform',
|
||||
# enums
|
||||
'aspect_fix_mode',
|
||||
'point_placement',
|
||||
'label_placement',
|
||||
'line_cap',
|
||||
'line_join',
|
||||
'text_transform',
|
||||
'vertical_alignment',
|
||||
'horizontal_alignment',
|
||||
'justify_alignment',
|
||||
'pattern_alignment',
|
||||
'filter_mode',
|
||||
# functions
|
||||
# datasources
|
||||
'Datasource',
|
||||
'CreateDatasource',
|
||||
'Shapefile',
|
||||
'PostGIS',
|
||||
'Raster',
|
||||
'Gdal',
|
||||
'Occi',
|
||||
'Ogr',
|
||||
'SQLite',
|
||||
'Osm',
|
||||
'Kismet',
|
||||
# version and environment
|
||||
'mapnik_version_string',
|
||||
'mapnik_version',
|
||||
'has_cairo',
|
||||
'has_pycairo',
|
||||
# factory methods
|
||||
'Expression',
|
||||
'PathExpression',
|
||||
# load/save/render
|
||||
'load_map',
|
||||
'render_stats',
|
||||
'load_map_from_string',
|
||||
'save_map',
|
||||
'save_map_to_string',
|
||||
'render',
|
||||
'render_grid',
|
||||
'render_tile_to_file',
|
||||
'render_to_file',
|
||||
# other
|
||||
'register_plugins',
|
||||
'register_fonts',
|
||||
'scale_denominator',
|
||||
# deprecated
|
||||
'Filter',
|
||||
'Envelope',
|
||||
]
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/detail/api_placeholder.hpp>
|
||||
|
||||
// stl
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: mapnik_envelope.cc 27 2005-03-30 21:45:40Z pavlenko $
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/expression.hpp>
|
||||
|
@ -30,7 +32,6 @@
|
|||
#include <mapnik/parse_path.hpp>
|
||||
#include <mapnik/value.hpp>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
using mapnik::Feature;
|
||||
using mapnik::expression_ptr;
|
||||
|
|
|
@ -19,13 +19,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
|
||||
#include <boost/python/suite/indexing/indexing_suite.hpp>
|
||||
//#include <boost/python/suite/indexing/map_indexing_suite.hpp>
|
||||
|
||||
#include <boost/python/iterator.hpp>
|
||||
#include <boost/python/call_method.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
|
@ -42,6 +41,7 @@ void export_font_engine()
|
|||
.def("register_fonts",&freetype_engine::register_fonts)
|
||||
.def("face_names",&freetype_engine::face_names)
|
||||
.staticmethod("register_font")
|
||||
.staticmethod("register_fonts")
|
||||
.staticmethod("face_names")
|
||||
;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: mapnik_layer.cc 17 2005-03-08 23:58:43Z pavlenko $
|
||||
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
@ -54,7 +52,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
|
|||
{
|
||||
s.append(style_names[i]);
|
||||
}
|
||||
return boost::python::make_tuple(l.clear_label_cache(),l.getMinZoom(),l.getMaxZoom(),l.isQueryable(),l.datasource()->params(),l.cache_features(),s);
|
||||
return boost::python::make_tuple(l.clear_label_cache(),l.min_zoom(),l.max_zoom(),l.queryable(),l.datasource()->params(),l.cache_features(),s);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -72,11 +70,11 @@ struct layer_pickle_suite : boost::python::pickle_suite
|
|||
|
||||
l.set_clear_label_cache(extract<bool>(state[0]));
|
||||
|
||||
l.setMinZoom(extract<double>(state[1]));
|
||||
l.set_min_zoom(extract<double>(state[1]));
|
||||
|
||||
l.setMaxZoom(extract<double>(state[2]));
|
||||
l.set_max_zoom(extract<double>(state[2]));
|
||||
|
||||
l.setQueryable(extract<bool>(state[3]));
|
||||
l.set_queryable(extract<bool>(state[3]));
|
||||
|
||||
mapnik::parameters params = extract<parameters>(state[4]);
|
||||
l.set_datasource(datasource_cache::instance()->create(params));
|
||||
|
@ -128,7 +126,7 @@ void export_layer()
|
|||
"box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
|
||||
)
|
||||
|
||||
.def("visible", &layer::isVisible,
|
||||
.def("visible", &layer::visible,
|
||||
"Return True if this layer's data is active and visible at a given scale.\n"
|
||||
"\n"
|
||||
"Otherwise returns False.\n"
|
||||
|
@ -149,8 +147,8 @@ void export_layer()
|
|||
)
|
||||
|
||||
.add_property("active",
|
||||
&layer::isActive,
|
||||
&layer::setActive,
|
||||
&layer::active,
|
||||
&layer::set_active,
|
||||
"Get/Set whether this layer is active and will be rendered.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
|
@ -199,8 +197,8 @@ void export_layer()
|
|||
)
|
||||
|
||||
.add_property("maxzoom",
|
||||
&layer::getMaxZoom,
|
||||
&layer::setMaxZoom,
|
||||
&layer::max_zoom,
|
||||
&layer::set_max_zoom,
|
||||
"Get/Set the maximum zoom lever of the layer.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
|
@ -214,8 +212,8 @@ void export_layer()
|
|||
)
|
||||
|
||||
.add_property("minzoom",
|
||||
&layer::getMinZoom,
|
||||
&layer::setMinZoom,
|
||||
&layer::min_zoom,
|
||||
&layer::set_min_zoom,
|
||||
"Get/Set the minimum zoom lever of the layer.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
|
@ -244,8 +242,8 @@ void export_layer()
|
|||
)
|
||||
|
||||
.add_property("queryable",
|
||||
&layer::isQueryable,
|
||||
&layer::setQueryable,
|
||||
&layer::queryable,
|
||||
&layer::set_queryable,
|
||||
"Get/Set whether this layer is queryable.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include "mapnik_enumeration.hpp"
|
||||
|
@ -62,5 +61,9 @@ void export_line_symbolizer()
|
|||
(&line_symbolizer::get_stroke,
|
||||
return_value_policy<copy_const_reference>()),
|
||||
&line_symbolizer::set_stroke)
|
||||
.add_property("smooth",
|
||||
&line_symbolizer::smooth,
|
||||
&line_symbolizer::set_smooth,
|
||||
"smooth value (0..1.0)")
|
||||
;
|
||||
}
|
||||
|
|
133
bindings/python/mapnik_logger.cpp
Normal file
133
bindings/python/mapnik_logger.cpp
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||
*
|
||||
* 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 <mapnik/debug.hpp>
|
||||
|
||||
using mapnik::logger::severity;
|
||||
using mapnik::logger::format;
|
||||
using mapnik::logger::output;
|
||||
|
||||
void set_severity(const severity::type& s)
|
||||
{
|
||||
severity::set(s);
|
||||
}
|
||||
|
||||
severity::type get_severity()
|
||||
{
|
||||
return severity::get();
|
||||
}
|
||||
|
||||
void set_object_severity(const std::string& object_name, const severity::type& s)
|
||||
{
|
||||
severity::set_object(object_name, s);
|
||||
}
|
||||
|
||||
severity::type get_object_severity(const std::string& object_name)
|
||||
{
|
||||
return severity::get_object(object_name);
|
||||
}
|
||||
|
||||
|
||||
void export_logger()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
enum_<mapnik::logger::severity::type>("SeverityType")
|
||||
.value("Info", severity::info)
|
||||
.value("Debug", severity::debug)
|
||||
.value("Warn", severity::warn)
|
||||
.value("Error", severity::error)
|
||||
.value("Fatal", severity::fatal)
|
||||
.value("None", severity::none)
|
||||
;
|
||||
|
||||
/*
|
||||
using mapnik::singleton;
|
||||
using mapnik::CreateStatic;
|
||||
using namespace boost::python;
|
||||
|
||||
class_<singleton<severity,CreateStatic>,boost::noncopyable>("Singleton",no_init)
|
||||
.def("instance",&singleton<severity,CreateStatic>::instance,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("instance")
|
||||
;
|
||||
|
||||
class_<severity,bases<singleton<severity,CreateStatic> >,
|
||||
boost::noncopyable>("Severity",no_init)
|
||||
.def("get",&severity::get)
|
||||
.def("set",&severity::set)
|
||||
.def("get_object",&severity::get_object)
|
||||
.def("set_object",&severity::set_object)
|
||||
.staticmethod("get")
|
||||
.staticmethod("set")
|
||||
.staticmethod("get_object")
|
||||
.staticmethod("set_object")
|
||||
;
|
||||
*/
|
||||
|
||||
def("set_severity", &set_severity,
|
||||
"\n"
|
||||
"Set global logger severity.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> from mapnik import SeverityType, set_severity\n"
|
||||
">>> set_severity(SeverityType.None)\n"
|
||||
">>> set_severity(SeverityType.Info)\n"
|
||||
">>> set_severity(SeverityType.Debug)\n"
|
||||
">>> set_severity(SeverityType.Warn)\n"
|
||||
">>> set_severity(SeverityType.Error)\n"
|
||||
">>> set_severity(SeverityType.Fatal)\n"
|
||||
);
|
||||
|
||||
def("get_severity", &get_severity,
|
||||
"\n"
|
||||
"Get global logger severity.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> from mapnik import get_severity\n"
|
||||
">>> get_severity()\n"
|
||||
);
|
||||
|
||||
def("set_object_severity", &set_object_severity,
|
||||
"\n"
|
||||
"Set logger severity for a single object.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> from mapnik import SeverityType, set_object_severity\n"
|
||||
">>> set_object_severity('ogr', SeverityType.None)\n"
|
||||
">>> set_object_severity('gdal', SeverityType.Info)\n"
|
||||
">>> set_object_severity('cairo_renderer', SeverityType.Debug)\n"
|
||||
">>> set_object_severity('agg_renderer', SeverityType.Warn)\n"
|
||||
">>> set_object_severity('bindings', SeverityType.Error)\n"
|
||||
);
|
||||
|
||||
def("get_object_severity", &get_object_severity,
|
||||
"\n"
|
||||
"Get logger severity for a single object.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> from mapnik import get_object_severity"
|
||||
">>> get_object_severity('ogr')\n"
|
||||
);
|
||||
|
||||
}
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id: mapnik_map.cc 17 2005-03-08 23:58:43Z pavlenko $
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
@ -62,7 +61,7 @@ struct map_pickle_suite : boost::python::pickle_suite
|
|||
Map::const_style_iterator end = m.styles().end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
const std::string & name = it->first;
|
||||
std::string const& name = it->first;
|
||||
const mapnik::feature_type_style & style = it->second;
|
||||
boost::python::tuple style_pair = boost::python::make_tuple(name,style);
|
||||
s.append(style_pair);
|
||||
|
@ -117,10 +116,8 @@ struct map_pickle_suite : boost::python::pickle_suite
|
|||
|
||||
std::vector<layer>& (Map::*layers_nonconst)() = &Map::layers;
|
||||
std::vector<layer> const& (Map::*layers_const)() const = &Map::layers;
|
||||
|
||||
mapnik::parameters& (Map::*attr_nonconst)() = &Map::get_extra_attributes;
|
||||
mapnik::parameters& (Map::*params_nonconst)() = &Map::get_extra_parameters;
|
||||
|
||||
boost::optional<mapnik::box2d<double> > const& (Map::*maximum_extent_const)() const = &Map::maximum_extent;
|
||||
|
||||
mapnik::feature_type_style find_style(mapnik::Map const& m, std::string const& name)
|
||||
{
|
||||
|
@ -153,7 +150,7 @@ bool has_metawriter(mapnik::Map const& m)
|
|||
|
||||
// returns empty shared_ptr when the metawriter isn't found, or is
|
||||
// of the wrong type. empty pointers make it back to Python as a None.
|
||||
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map &m, const std::string &name) {
|
||||
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map & m, std::string const& name) {
|
||||
mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
|
||||
mapnik::metawriter_inmem_ptr inmem;
|
||||
|
||||
|
@ -195,6 +192,18 @@ mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
|
|||
return result;
|
||||
}
|
||||
|
||||
// TODO - find a simplier way to set optional to uninitialized
|
||||
void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box)
|
||||
{
|
||||
if (box)
|
||||
{
|
||||
m.set_maximum_extent(*box);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.maximum_extent().reset();
|
||||
}
|
||||
}
|
||||
|
||||
void export_map()
|
||||
{
|
||||
|
@ -482,7 +491,6 @@ void export_map()
|
|||
)
|
||||
|
||||
.def("__deepcopy__",&map_deepcopy)
|
||||
.add_property("extra_attributes",make_function(attr_nonconst,return_value_policy<reference_existing_object>()),"TODO")
|
||||
.add_property("parameters",make_function(params_nonconst,return_value_policy<reference_existing_object>()),"TODO")
|
||||
|
||||
.add_property("aspect_fix_mode",
|
||||
|
@ -554,8 +562,8 @@ void export_map()
|
|||
)
|
||||
|
||||
.add_property("maximum_extent",make_function
|
||||
(&Map::maximum_extent,return_value_policy<copy_const_reference>()),
|
||||
&Map::set_maximum_extent,
|
||||
(maximum_extent_const,return_value_policy<copy_const_reference>()),
|
||||
&set_maximum_extent,
|
||||
"The maximum extent of the map.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include <mapnik/graphics.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/markers_symbolizer.hpp>
|
||||
|
@ -60,7 +60,8 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
static boost::python::tuple
|
||||
getstate(markers_symbolizer const& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_allow_overlap());//,p.get_opacity());
|
||||
return boost::python::make_tuple(p.get_allow_overlap(),
|
||||
p.get_ignore_placement());//,p.get_opacity());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -77,7 +78,8 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
}
|
||||
|
||||
p.set_allow_overlap(extract<bool>(state[0]));
|
||||
//p.set_opacity(extract<float>(state[1]));
|
||||
p.set_ignore_placement(extract<bool>(state[1]));
|
||||
//p.set_opacity(extract<float>(state[2]));
|
||||
|
||||
}
|
||||
|
||||
|
@ -108,8 +110,19 @@ void export_markers_symbolizer()
|
|||
&markers_symbolizer::get_opacity,
|
||||
&markers_symbolizer::set_opacity,
|
||||
"Set/get the text opacity")
|
||||
.add_property("ignore_placement",
|
||||
&markers_symbolizer::get_ignore_placement,
|
||||
&markers_symbolizer::set_ignore_placement)
|
||||
.add_property("transform",
|
||||
&mapnik::get_svg_transform<markers_symbolizer>,
|
||||
&mapnik::set_svg_transform<markers_symbolizer>)
|
||||
.add_property("width",
|
||||
&markers_symbolizer::get_width,
|
||||
&markers_symbolizer::set_width,
|
||||
"Set/get the marker width")
|
||||
.add_property("height",
|
||||
&markers_symbolizer::get_height,
|
||||
&markers_symbolizer::set_height,
|
||||
"Set/get the marker height")
|
||||
;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <boost/make_shared.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/value.hpp>
|
||||
|
@ -102,7 +103,7 @@ struct parameters_pickle_suite : boost::python::pickle_suite
|
|||
}
|
||||
else
|
||||
{
|
||||
std::clog << "could not unpickle key: " << key << "\n";
|
||||
MAPNIK_LOG_DEBUG(bindings) << "parameters_pickle_suite: Could not unpickle key=" << key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include "mapnik_enumeration.hpp"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include "mapnik_enumeration.hpp"
|
||||
|
@ -84,7 +83,11 @@ void export_polygon_symbolizer()
|
|||
.add_property("gamma_method",
|
||||
&polygon_symbolizer::get_gamma_method,
|
||||
&polygon_symbolizer::set_gamma_method,
|
||||
"Set/get the gamma correction method of the polygon")
|
||||
"gamma correction method")
|
||||
.add_property("smooth",
|
||||
&polygon_symbolizer::smooth,
|
||||
&polygon_symbolizer::set_smooth,
|
||||
"smooth value (0..1.0)")
|
||||
;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
//boost
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
|
|
|
@ -67,6 +67,7 @@ void export_view_transform();
|
|||
void export_raster_colorizer();
|
||||
void export_inmem_metawriter();
|
||||
void export_label_collision_detector();
|
||||
void export_logger();
|
||||
|
||||
#include <mapnik/version.hpp>
|
||||
#include <mapnik/value_error.hpp>
|
||||
|
@ -289,6 +290,11 @@ unsigned mapnik_version()
|
|||
return MAPNIK_VERSION;
|
||||
}
|
||||
|
||||
std::string mapnik_version_string()
|
||||
{
|
||||
return MAPNIK_VERSION_STRING;
|
||||
}
|
||||
|
||||
// indicator for jpeg read/write support within libmapnik
|
||||
bool has_jpeg()
|
||||
{
|
||||
|
@ -391,6 +397,7 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
export_raster_colorizer();
|
||||
export_inmem_metawriter();
|
||||
export_label_collision_detector();
|
||||
export_logger();
|
||||
|
||||
def("render_grid",&render_grid,
|
||||
( arg("map"),
|
||||
|
@ -583,6 +590,7 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
|
||||
def("save_map_to_string", &save_map_to_string, save_map_to_string_overloads());
|
||||
def("mapnik_version", &mapnik_version,"Get the Mapnik version number");
|
||||
def("mapnik_version_string", &mapnik_version_string,"Get the Mapnik version string");
|
||||
def("has_jpeg", &has_jpeg, "Get jpeg read/write support status");
|
||||
def("has_cairo", &has_cairo, "Get cairo library status");
|
||||
def("has_pycairo", &has_pycairo, "Get pycairo module status");
|
||||
|
|
|
@ -19,11 +19,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/query.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
|
||||
using mapnik::query;
|
||||
using mapnik::box2d;
|
||||
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/raster_colorizer.hpp>
|
||||
|
||||
using mapnik::raster_colorizer;
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/raster_symbolizer.hpp>
|
||||
|
||||
using mapnik::raster_symbolizer;
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <boost/python/detail/api_placeholder.hpp>
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/rule.hpp>
|
||||
#include <mapnik/expression.hpp>
|
||||
#include <mapnik/expression_string.hpp>
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/shield_symbolizer.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/path_expression_grammar.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||
|
||||
// mapnik
|
||||
#include "mapnik_enumeration.hpp"
|
||||
#include <mapnik/feature_type_style.hpp>
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
||||
// mapnik
|
||||
//symbolizer typdef here rather than mapnik/symbolizer.hpp
|
||||
#include <mapnik/rule.hpp>
|
||||
|
||||
|
|
|
@ -40,15 +40,15 @@
|
|||
using namespace mapnik;
|
||||
|
||||
/* Notes:
|
||||
Overriding functions in inherited classes:
|
||||
boost.python documentation doesn't really tell you how to do it.
|
||||
But this helps:
|
||||
http://www.gamedev.net/topic/446225-inheritance-in-boostpython/
|
||||
Overriding functions in inherited classes:
|
||||
boost.python documentation doesn't really tell you how to do it.
|
||||
But this helps:
|
||||
http://www.gamedev.net/topic/446225-inheritance-in-boostpython/
|
||||
|
||||
register_ptr_to_python is required for wrapped classes, but not for unwrapped.
|
||||
register_ptr_to_python is required for wrapped classes, but not for unwrapped.
|
||||
|
||||
Functions don't have to be members of the class, but can also be
|
||||
normal functions taking a ref to the class as first parameter.
|
||||
Functions don't have to be members of the class, but can also be
|
||||
normal functions taking a ref to the class as first parameter.
|
||||
*/
|
||||
|
||||
namespace {
|
||||
|
@ -251,8 +251,7 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
|
|||
|
||||
struct TextPlacementsWrap: text_placements, wrapper<text_placements>
|
||||
{
|
||||
text_placement_info_ptr get_placement_info(double scale_factor_, dimension_type dim,
|
||||
bool has_dimensions_) const
|
||||
text_placement_info_ptr get_placement_info(double scale_factor_) const
|
||||
{
|
||||
python_block_auto_unblock b;
|
||||
return this->get_override("get_placement_info")();
|
||||
|
@ -262,8 +261,8 @@ struct TextPlacementsWrap: text_placements, wrapper<text_placements>
|
|||
struct TextPlacementInfoWrap: text_placement_info, wrapper<text_placement_info>
|
||||
{
|
||||
TextPlacementInfoWrap(text_placements const* parent,
|
||||
double scale_factor_, dimension_type dim, bool has_dimensions_)
|
||||
: text_placement_info(parent, scale_factor_, dim, has_dimensions_)
|
||||
double scale_factor_)
|
||||
: text_placement_info(parent, scale_factor_)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -330,6 +329,7 @@ void export_text_placement()
|
|||
.value("LEFT",J_LEFT)
|
||||
.value("MIDDLE",J_MIDDLE)
|
||||
.value("RIGHT",J_RIGHT)
|
||||
.value("AUTO", J_AUTO)
|
||||
;
|
||||
|
||||
enumeration_<text_transform_e>("text_transform")
|
||||
|
@ -421,20 +421,13 @@ void export_text_placement()
|
|||
boost::shared_ptr<TextPlacementInfoWrap>,
|
||||
boost::noncopyable>
|
||||
("TextPlacementInfo",
|
||||
init<text_placements const*, double, dimension_type, bool>())
|
||||
init<text_placements const*, double>())
|
||||
.def("next", pure_virtual(&text_placement_info::next))
|
||||
.def("get_actual_label_spacing", &text_placement_info::get_actual_label_spacing)
|
||||
.def("get_actual_minimum_distance", &text_placement_info::get_actual_minimum_distance)
|
||||
.def("get_actual_minimum_padding", &text_placement_info::get_actual_minimum_padding)
|
||||
.def_readwrite("properties", &text_placement_info::properties)
|
||||
.def_readwrite("scale_factor", &text_placement_info::scale_factor)
|
||||
.def_readwrite("has_dimensions", &text_placement_info::has_dimensions)
|
||||
.def_readwrite("dimensions", &text_placement_info::dimensions)
|
||||
.def_readwrite("collect_extents", &text_placement_info::collect_extents)
|
||||
.def_readwrite("extents", &text_placement_info::extents)
|
||||
.def_readwrite("additional_boxes", &text_placement_info::additional_boxes)
|
||||
.def_readwrite("envelopes", &text_placement_info::envelopes)
|
||||
// .def_readwrite("placements", &text_placement_info::placements)
|
||||
;
|
||||
register_ptr_to_python<boost::shared_ptr<text_placement_info> >();
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <boost/foreach.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/grid/grid_renderer.hpp>
|
||||
#include <mapnik/grid/grid.hpp>
|
||||
#include <mapnik/grid/grid_util.hpp>
|
||||
|
@ -271,7 +272,7 @@ static void write_features(T const& grid_type,
|
|||
}
|
||||
else
|
||||
{
|
||||
std::clog << "should not get here: key '" << key << "' not found in grid feature properties\n";
|
||||
MAPNIK_LOG_DEBUG(bindings) << "write_features: Should not get here: key " << key << " not found in grid feature properties";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/python.hpp>
|
||||
|
@ -103,7 +102,7 @@ struct python_optional : public boost::noncopyable
|
|||
/** This class works around a bug in boost python.
|
||||
|
||||
See http://osdir.com/ml/python.c++/2003-11/msg00158.html
|
||||
*/
|
||||
*/
|
||||
template <typename T, typename X1 = boost::python::detail::not_specified, typename X2 = boost::python::detail::not_specified, typename X3 = boost::python::detail::not_specified>
|
||||
class class_with_converter : public boost::python::class_<T, X1, X2, X3>
|
||||
{
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
CXX = g++
|
||||
|
||||
CXXFLAGS = $(shell mapnik-config --cflags)
|
||||
LDFLAGS = $(shell mapnik-config --libs --dep-libs --ldflags)
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ rundemo = demo_env.Program('rundemo', source, LIBS=libraries, LINKFLAGS=env["CUS
|
|||
|
||||
Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
# we don't install this app because the datasource paths are relative
|
||||
# and we're not going to install the sample data.
|
||||
#env.Install(install_prefix + '/bin', rundemo)
|
||||
#env.Alias('install', install_prefix + '/bin')
|
||||
# build locally if installing
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
env.Alias('install',rundemo)
|
||||
|
|
|
@ -70,7 +70,7 @@ int main ( int argc , char** argv)
|
|||
provpoly_style.add_rule(provpoly_rule_on);
|
||||
|
||||
rule provpoly_rule_qc;
|
||||
provpoly_rule_qc.set_filter(parse_expression("[NOM_FR] = 'Québec'"));
|
||||
provpoly_rule_qc.set_filter(parse_expression("[NOM_FR] = 'Québec'"));
|
||||
provpoly_rule_qc.append(polygon_symbolizer(color(217, 235, 203)));
|
||||
provpoly_style.add_rule(provpoly_rule_qc);
|
||||
|
||||
|
@ -175,6 +175,7 @@ int main ( int argc , char** argv)
|
|||
parameters p;
|
||||
p["type"]="shape";
|
||||
p["file"]="../data/boundaries";
|
||||
p["encoding"]="latin1";
|
||||
|
||||
layer lyr("Provinces");
|
||||
lyr.set_datasource(datasource_cache::instance()->create(p));
|
||||
|
|
|
@ -138,7 +138,9 @@ qcdrain_lyr.datasource = mapnik.Shapefile(file='../data/qcdrainage')
|
|||
qcdrain_style = mapnik.Style()
|
||||
qcdrain_rule = mapnik.Rule()
|
||||
qcdrain_rule.filter = mapnik.Expression('[HYC] = 8')
|
||||
qcdrain_rule.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color(153, 204, 255)))
|
||||
sym = mapnik.PolygonSymbolizer(mapnik.Color(153, 204, 255))
|
||||
sym.smooth = 1.0 # very smooth
|
||||
qcdrain_rule.symbols.append(sym)
|
||||
qcdrain_style.rules.append(qcdrain_rule)
|
||||
|
||||
m.append_style('drainage', qcdrain_style)
|
||||
|
|
|
@ -49,7 +49,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
|
|||
else if (role == Qt::DecorationRole)
|
||||
{
|
||||
double scale = map_->scale();
|
||||
if (map_->layers().at(index.row()).isVisible(scale))
|
||||
if (map_->layers().at(index.row()).visible(scale))
|
||||
{
|
||||
return QIcon(":/images/globe.png");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
|
|||
}
|
||||
else if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (map_->layers().at(index.row()).isActive())
|
||||
if (map_->layers().at(index.row()).active())
|
||||
return QVariant(Qt::Checked);
|
||||
else
|
||||
return QVariant(Qt::Unchecked);
|
||||
|
@ -92,7 +92,7 @@ bool LayerListModel::setData(const QModelIndex &index,
|
|||
{
|
||||
int status = value.toInt();
|
||||
std::vector<mapnik::layer> & layers = const_cast<std::vector<mapnik::layer>& >(map_->layers());
|
||||
layers.at(index.row()).setActive(status);
|
||||
layers.at(index.row()).set_active(status);
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/memory_datasource.hpp>
|
||||
#include <mapnik/feature_kv_iterator.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
#include "mapwidget.hpp"
|
||||
#include "info_dialog.hpp"
|
||||
|
||||
|
@ -157,7 +158,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
if (int(index) != selectedLayer_) continue;
|
||||
|
||||
layer & layer = map_->layers()[index];
|
||||
if (!layer.isVisible(scale_denom)) continue;
|
||||
if (!layer.visible(scale_denom)) continue;
|
||||
std::string name = layer.name();
|
||||
double x = e->x();
|
||||
double y = e->y();
|
||||
|
|
|
@ -95,6 +95,18 @@ If you see bits of code around that do not follow these please don't hesitate to
|
|||
|
||||
(int)value; // no
|
||||
|
||||
#### Use const keyword after the type
|
||||
|
||||
std::string const& variable_name // preferred, for consistency
|
||||
|
||||
const std::string & variable_name // no
|
||||
|
||||
#### Pass built-in types by value, all others by const&
|
||||
|
||||
void my_function(int double val); // if int, char, double, etc pass by value
|
||||
|
||||
void my_function(std::string const& val); // if std::string or user type, pass by const&
|
||||
|
||||
#### 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:
|
||||
|
|
91
include/mapnik/agg_helpers.hpp
Normal file
91
include/mapnik/agg_helpers.hpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2012 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_AGG_HELPERS_HPP
|
||||
#define MAPNIK_AGG_HELPERS_HPP
|
||||
|
||||
#include "agg_gamma_functions.h"
|
||||
#include "agg_math_stroke.h"
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename T0, typename T1>
|
||||
void set_gamma_method(T0 const& obj, T1 & ras_ptr)
|
||||
{
|
||||
switch (obj.get_gamma_method())
|
||||
{
|
||||
case GAMMA_POWER:
|
||||
ras_ptr->gamma(agg::gamma_power(obj.get_gamma()));
|
||||
break;
|
||||
case GAMMA_LINEAR:
|
||||
ras_ptr->gamma(agg::gamma_linear(0.0, obj.get_gamma()));
|
||||
break;
|
||||
case GAMMA_NONE:
|
||||
ras_ptr->gamma(agg::gamma_none());
|
||||
break;
|
||||
case GAMMA_THRESHOLD:
|
||||
ras_ptr->gamma(agg::gamma_threshold(obj.get_gamma()));
|
||||
break;
|
||||
case GAMMA_MULTIPLY:
|
||||
ras_ptr->gamma(agg::gamma_multiply(obj.get_gamma()));
|
||||
break;
|
||||
default:
|
||||
ras_ptr->gamma(agg::gamma_power(obj.get_gamma()));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Stroke,typename PathType>
|
||||
void set_join_caps(Stroke const& stroke_, PathType & stroke)
|
||||
{
|
||||
line_join_e join=stroke_.get_line_join();
|
||||
switch (join)
|
||||
{
|
||||
case MITER_JOIN:
|
||||
stroke.generator().line_join(agg::miter_join);
|
||||
break;
|
||||
case MITER_REVERT_JOIN:
|
||||
stroke.generator().line_join(agg::miter_join);
|
||||
break;
|
||||
case ROUND_JOIN:
|
||||
stroke.generator().line_join(agg::round_join);
|
||||
break;
|
||||
default:
|
||||
stroke.generator().line_join(agg::bevel_join);
|
||||
}
|
||||
|
||||
line_cap_e cap=stroke_.get_line_cap();
|
||||
switch (cap)
|
||||
{
|
||||
case BUTT_CAP:
|
||||
stroke.generator().line_cap(agg::butt_cap);
|
||||
break;
|
||||
case SQUARE_CAP:
|
||||
stroke.generator().line_cap(agg::square_cap);
|
||||
break;
|
||||
default:
|
||||
stroke.generator().line_cap(agg::round_cap);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //MAPNIK_AGG_HELPERS_HPP
|
|
@ -29,10 +29,6 @@
|
|||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/label_collision_detector.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
//#include <mapnik/marker.hpp>
|
||||
|
||||
// agg
|
||||
//#include "agg_trans_affine.h"
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
@ -67,7 +63,7 @@ public:
|
|||
~agg_renderer();
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(layer const& lay);
|
||||
void start_layer_processing(layer const& lay, box2d<double> const& query_extent);
|
||||
void end_layer_processing(layer const& lay);
|
||||
void render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity);
|
||||
|
||||
|
@ -123,7 +119,7 @@ private:
|
|||
face_manager<freetype_engine> font_manager_;
|
||||
boost::shared_ptr<label_collision_detector4> detector_;
|
||||
boost::scoped_ptr<rasterizer> ras_ptr;
|
||||
|
||||
box2d<double> query_extent_;
|
||||
void setup(Map const &m);
|
||||
};
|
||||
}
|
||||
|
|
99
include/mapnik/boolean.hpp
Normal file
99
include/mapnik/boolean.hpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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_BOOLEAN_HPP
|
||||
#define MAPNIK_BOOLEAN_HPP
|
||||
|
||||
// std
|
||||
#include <istream>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
/** Helper for class bool */
|
||||
class boolean {
|
||||
public:
|
||||
boolean(): b_(false) {}
|
||||
boolean(bool b) : b_(b) {}
|
||||
boolean(boolean const& b) : b_(b.b_) {}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return b_;
|
||||
}
|
||||
|
||||
boolean & operator = (boolean const& other)
|
||||
{
|
||||
b_ = other.b_;
|
||||
return * this;
|
||||
}
|
||||
|
||||
boolean & operator = (bool other)
|
||||
{
|
||||
b_ = other;
|
||||
return * this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool b_;
|
||||
};
|
||||
|
||||
/** Special stream input operator for boolean values */
|
||||
template <typename charT, typename traits>
|
||||
std::basic_istream<charT, traits> &
|
||||
operator >> ( std::basic_istream<charT, traits> & s, boolean & b )
|
||||
{
|
||||
std::string word;
|
||||
s >> word;
|
||||
boost::algorithm::to_lower(word);
|
||||
if ( s )
|
||||
{
|
||||
if ( word == "true" || word == "yes" || word == "on" ||
|
||||
word == "1")
|
||||
{
|
||||
b = true;
|
||||
}
|
||||
else if ( word == "false" || word == "no" || word == "off" ||
|
||||
word == "0")
|
||||
{
|
||||
b = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.setstate( std::ios::failbit );
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
template <typename charT, typename traits>
|
||||
std::basic_ostream<charT, traits> &
|
||||
operator << ( std::basic_ostream<charT, traits> & s, boolean const& b )
|
||||
{
|
||||
s << ( b ? "true" : "false" );
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_BOOLEAN_HPP
|
|
@ -78,7 +78,7 @@ protected:
|
|||
public:
|
||||
~cairo_renderer_base();
|
||||
void start_map_processing(Map const& map);
|
||||
void start_layer_processing(layer const& lay);
|
||||
void start_layer_processing(layer const& lay, box2d<double> const& query_extent);
|
||||
void end_layer_processing(layer const& lay);
|
||||
void process(point_symbolizer const& sym,
|
||||
mapnik::feature_ptr const& feature,
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0);
|
||||
void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0, bool recenter=true);
|
||||
|
||||
Map const& m_;
|
||||
Cairo::RefPtr<Cairo::Context> context_;
|
||||
|
@ -132,6 +132,7 @@ protected:
|
|||
face_manager<freetype_engine> font_manager_;
|
||||
cairo_face_manager face_manager_;
|
||||
label_collision_detector4 detector_;
|
||||
box2d<double> query_extent_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -31,11 +31,24 @@ struct char_properties;
|
|||
class char_info {
|
||||
public:
|
||||
char_info(unsigned c_, double width_, double ymax_, double ymin_, double line_height_)
|
||||
: c(c_), width(width_), line_height(line_height_), ymin(ymin_), ymax(ymax_)
|
||||
: c(c_),
|
||||
width(width_),
|
||||
line_height(line_height_),
|
||||
ymin(ymin_),
|
||||
ymax(ymax_),
|
||||
avg_height(ymax_-ymin_),
|
||||
format()
|
||||
{
|
||||
}
|
||||
|
||||
char_info()
|
||||
: c(0), width(0), line_height(0), ymin(0), ymax(0)
|
||||
: c(0),
|
||||
width(0),
|
||||
line_height(0),
|
||||
ymin(0),
|
||||
ymax(0),
|
||||
avg_height(0),
|
||||
format()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,14 @@ public:
|
|||
std::string to_hex_string() const;
|
||||
};
|
||||
|
||||
template <typename charT, typename traits>
|
||||
std::basic_ostream<charT, traits> &
|
||||
operator << ( std::basic_ostream<charT, traits> & s, mapnik::color const& c )
|
||||
{
|
||||
std::string hex_string( c.to_string() );
|
||||
s << hex_string;
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,134 +25,26 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
// boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane)
|
||||
#if BOOST_VERSION >= 104500
|
||||
#include <mapnik/css_color_grammar.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class color;
|
||||
|
||||
template <typename Iterator> struct css_color_grammar;
|
||||
class MAPNIK_DECL color_factory : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
static void init_from_string(color & c, std::string const& css_color)
|
||||
{
|
||||
typedef std::string::const_iterator iterator_type;
|
||||
typedef mapnik::css_color_grammar<iterator_type> css_color_grammar;
|
||||
|
||||
css_color_grammar g;
|
||||
iterator_type first = css_color.begin();
|
||||
iterator_type last = css_color.end();
|
||||
bool result =
|
||||
boost::spirit::qi::phrase_parse(first,
|
||||
last,
|
||||
g,
|
||||
boost::spirit::ascii::space,
|
||||
c);
|
||||
if (!result)
|
||||
{
|
||||
throw config_error(std::string("Failed to parse color value: ") +
|
||||
"Expected a CSS color, but got '" + css_color + "'");
|
||||
}
|
||||
}
|
||||
static void init_from_string(color & c, std::string const& css_color);
|
||||
|
||||
static bool parse_from_string(color & c, std::string const& css_color,
|
||||
mapnik::css_color_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
std::string::const_iterator first = css_color.begin();
|
||||
std::string::const_iterator last = css_color.end();
|
||||
bool result =
|
||||
boost::spirit::qi::phrase_parse(first,
|
||||
last,
|
||||
g,
|
||||
boost::spirit::ascii::space,
|
||||
c);
|
||||
return result && (first == last);
|
||||
}
|
||||
mapnik::css_color_grammar<std::string::const_iterator> const& g);
|
||||
|
||||
static color from_string(std::string const& css_color)
|
||||
{
|
||||
color c;
|
||||
init_from_string(c,css_color);
|
||||
return c;
|
||||
}
|
||||
static color from_string(std::string const& css_color);
|
||||
};
|
||||
}
|
||||
|
||||
#else
|
||||
#include <mapnik/css_color_grammar_deprecated.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class MAPNIK_DECL color_factory : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
static bool parse_from_string(color & c, std::string const& css_color,
|
||||
mapnik::css_color_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
std::string::const_iterator first = css_color.begin();
|
||||
std::string::const_iterator last = css_color.end();
|
||||
mapnik::css css_;
|
||||
bool result =
|
||||
boost::spirit::qi::phrase_parse(first,
|
||||
last,
|
||||
g,
|
||||
boost::spirit::ascii::space,
|
||||
css_);
|
||||
if (result && (first == last))
|
||||
{
|
||||
c.set_red(css_.r);
|
||||
c.set_green(css_.g);
|
||||
c.set_blue(css_.b);
|
||||
c.set_alpha(css_.a);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void init_from_string(color & c, std::string const& css_color)
|
||||
{
|
||||
typedef std::string::const_iterator iterator_type;
|
||||
typedef mapnik::css_color_grammar<iterator_type> css_color_grammar;
|
||||
|
||||
css_color_grammar g;
|
||||
iterator_type first = css_color.begin();
|
||||
iterator_type last = css_color.end();
|
||||
mapnik::css css_;
|
||||
bool result =
|
||||
boost::spirit::qi::phrase_parse(first,
|
||||
last,
|
||||
g,
|
||||
boost::spirit::ascii::space,
|
||||
css_);
|
||||
if (!result)
|
||||
{
|
||||
throw config_error(std::string("Failed to parse color value: ") +
|
||||
"Expected a CSS color, but got '" + css_color + "'");
|
||||
}
|
||||
c.set_red(css_.r);
|
||||
c.set_green(css_.g);
|
||||
c.set_blue(css_.b);
|
||||
c.set_alpha(css_.a);
|
||||
}
|
||||
|
||||
static color from_string(std::string const& css_color)
|
||||
{
|
||||
color c;
|
||||
init_from_string(c,css_color);
|
||||
return c;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MAPNIK_COLOR_FACTORY_HPP
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
// Windows DLL support
|
||||
|
||||
#define MAPNIK_SUPPORTS_GRID_RENDERER
|
||||
|
||||
#ifdef _WINDOWS
|
||||
# define MAPNIK_EXP __declspec (dllexport)
|
||||
# define MAPNIK_IMP __declspec (dllimport)
|
||||
|
|
|
@ -28,30 +28,28 @@
|
|||
|
||||
namespace mapnik {
|
||||
|
||||
class xml_node;
|
||||
class config_error : public std::exception
|
||||
{
|
||||
public:
|
||||
config_error() {}
|
||||
|
||||
config_error( const std::string & what ) :
|
||||
what_( what )
|
||||
{
|
||||
}
|
||||
config_error(std::string const& what);
|
||||
config_error(std::string const& what, xml_node const& node);
|
||||
config_error(std::string const& what, unsigned line_number, std::string const& filename);
|
||||
virtual ~config_error() throw() {}
|
||||
|
||||
virtual const char * what() const throw()
|
||||
{
|
||||
return what_.c_str();
|
||||
}
|
||||
|
||||
void append_context(const std::string & ctx) const
|
||||
{
|
||||
what_ += " " + ctx;
|
||||
}
|
||||
virtual const char * what() const throw();
|
||||
|
||||
void append_context(const std::string & ctx) const;
|
||||
void append_context(const std::string & ctx, xml_node const& node) const;
|
||||
void append_context(xml_node const& node) const;
|
||||
protected:
|
||||
mutable std::string what_;
|
||||
mutable unsigned line_number_;
|
||||
mutable std::string file_;
|
||||
mutable std::string node_name_;
|
||||
mutable std::string msg_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_CONFIG_ERROR_HPP
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define MAPNIK_CTRANS_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/vertex.hpp>
|
||||
#include <mapnik/coord_array.hpp>
|
||||
|
@ -72,16 +73,16 @@ template <typename Transform, typename Geometry>
|
|||
struct MAPNIK_DECL coord_transform2
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
typedef typename Geometry::value_type value_type;
|
||||
//typedef typename Geometry::value_type value_type;
|
||||
|
||||
coord_transform2(Transform const& t,
|
||||
Geometry const& geom,
|
||||
Geometry & geom,
|
||||
proj_transform const& prj_trans)
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans) {}
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
unsigned vertex(double *x, double *y)
|
||||
{
|
||||
unsigned command = SEG_MOVETO;
|
||||
bool ok = false;
|
||||
|
@ -115,7 +116,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
Geometry & geom_;
|
||||
proj_transform const& prj_trans_;
|
||||
};
|
||||
|
||||
|
@ -239,10 +240,10 @@ struct MAPNIK_DECL coord_transform_parallel
|
|||
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
|
||||
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: Offsetting line by=" << offset_;
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: Initial dx=" << (dx_pre * offset_) << ",dy=" << (dy_pre * offset_);
|
||||
|
||||
*x = m_pre_x + (dx_pre * offset_);
|
||||
*y = m_pre_y + (dy_pre * offset_);
|
||||
m_status = process;
|
||||
|
@ -289,15 +290,14 @@ struct MAPNIK_DECL coord_transform_parallel
|
|||
}
|
||||
else // skip sharp spikes
|
||||
{
|
||||
|
||||
#ifdef MAPNIK_DEBUG
|
||||
#ifdef MAPNIK_LOG
|
||||
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";
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: angle a=" << angle_a;
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: angle b=" << angle_b;
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: h=" << h;
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: sin_curve=" << sin_curve;
|
||||
#endif
|
||||
m_status = process;
|
||||
break;
|
||||
|
@ -309,9 +309,7 @@ struct MAPNIK_DECL coord_transform_parallel
|
|||
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
|
||||
MAPNIK_LOG_DEBUG(ctrans) << "coord_transform_parallel: sin_curve value=" << sin_curve;
|
||||
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);
|
||||
|
@ -380,19 +378,26 @@ class CoordTransform
|
|||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
double sx_;
|
||||
double sy_;
|
||||
box2d<double> extent_;
|
||||
double offset_x_;
|
||||
double offset_y_;
|
||||
double sx_;
|
||||
double sy_;
|
||||
|
||||
public:
|
||||
CoordTransform(int width, int height, const box2d<double>& extent,
|
||||
double offset_x = 0, double offset_y = 0)
|
||||
: width_(width), height_(height), extent_(extent),
|
||||
offset_x_(offset_x), offset_y_(offset_y)
|
||||
: width_(width),
|
||||
height_(height),
|
||||
extent_(extent),
|
||||
offset_x_(offset_x),
|
||||
offset_y_(offset_y),
|
||||
sx_(1.0),
|
||||
sy_(1.0)
|
||||
{
|
||||
if (extent_.width() > 0)
|
||||
sx_ = static_cast<double>(width_) / extent_.width();
|
||||
if (extent_.height() > 0)
|
||||
sy_ = static_cast<double>(height_) / extent_.height();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,25 +45,30 @@ typedef MAPNIK_DECL boost::shared_ptr<Feature> feature_ptr;
|
|||
|
||||
struct MAPNIK_DECL Featureset : private boost::noncopyable
|
||||
{
|
||||
virtual feature_ptr next()=0;
|
||||
virtual ~Featureset() {};
|
||||
virtual feature_ptr next() = 0;
|
||||
virtual ~Featureset() {}
|
||||
};
|
||||
|
||||
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
|
||||
|
||||
class MAPNIK_DECL datasource_exception : public std::exception
|
||||
{
|
||||
private:
|
||||
std::string message_;
|
||||
public:
|
||||
datasource_exception(const std::string& message=std::string("no reason"))
|
||||
:message_(message) {}
|
||||
datasource_exception(const std::string& message = std::string("no reason"))
|
||||
: message_(message)
|
||||
{
|
||||
}
|
||||
|
||||
~datasource_exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
~datasource_exception() throw() {}
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
private:
|
||||
std::string message_;
|
||||
};
|
||||
|
||||
class MAPNIK_DECL datasource : private boost::noncopyable
|
||||
|
@ -84,7 +89,8 @@ public:
|
|||
datasource (parameters const& params)
|
||||
: params_(params),
|
||||
is_bound_(false)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the configuration parameters of the data source.
|
||||
|
@ -102,19 +108,19 @@ public:
|
|||
* @brief Get the type of the datasource
|
||||
* @return The type of the datasource (Vector or Raster)
|
||||
*/
|
||||
virtual datasource_t type() const=0;
|
||||
virtual datasource_t type() const = 0;
|
||||
|
||||
/*!
|
||||
* @brief Connect to the datasource
|
||||
*/
|
||||
virtual void bind() const {};
|
||||
virtual void bind() const {}
|
||||
|
||||
virtual featureset_ptr features(const query& q) const=0;
|
||||
virtual featureset_ptr features_at_point(coord2d const& pt) const=0;
|
||||
virtual box2d<double> envelope() const=0;
|
||||
virtual boost::optional<geometry_t> get_geometry_type() const=0;
|
||||
virtual layer_descriptor get_descriptor() const=0;
|
||||
virtual ~datasource() {};
|
||||
virtual featureset_ptr features(const query& q) const = 0;
|
||||
virtual featureset_ptr features_at_point(coord2d const& pt) const = 0;
|
||||
virtual box2d<double> envelope() const = 0;
|
||||
virtual boost::optional<geometry_t> get_geometry_type() const = 0;
|
||||
virtual layer_descriptor get_descriptor() const = 0;
|
||||
virtual ~datasource() {}
|
||||
protected:
|
||||
parameters params_;
|
||||
mutable bool is_bound_;
|
||||
|
@ -124,7 +130,6 @@ typedef std::string datasource_name();
|
|||
typedef datasource* create_ds(const parameters& params, bool bind);
|
||||
typedef void destroy_ds(datasource *ds);
|
||||
|
||||
|
||||
class datasource_deleter
|
||||
{
|
||||
public:
|
||||
|
@ -136,7 +141,6 @@ public:
|
|||
|
||||
typedef boost::shared_ptr<datasource> datasource_ptr;
|
||||
|
||||
|
||||
#define DATASOURCE_PLUGIN(classname) \
|
||||
extern "C" MAPNIK_EXP std::string datasource_name() \
|
||||
{ \
|
||||
|
@ -149,8 +153,7 @@ typedef boost::shared_ptr<datasource> datasource_ptr;
|
|||
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
|
||||
{ \
|
||||
delete ds; \
|
||||
} \
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
279
include/mapnik/debug.hpp
Normal file
279
include/mapnik/debug.hpp
Normal file
|
@ -0,0 +1,279 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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_DEBUG_HPP
|
||||
#define MAPNIK_DEBUG_HPP
|
||||
|
||||
// mapnik (should not depend on anything that need to use this)
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#endif
|
||||
|
||||
// std
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace mapnik {
|
||||
namespace logger {
|
||||
|
||||
class MAPNIK_DECL severity :
|
||||
public singleton<severity,CreateStatic>,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
enum type
|
||||
{
|
||||
info,
|
||||
debug,
|
||||
warn,
|
||||
error,
|
||||
fatal,
|
||||
none
|
||||
};
|
||||
|
||||
typedef boost::unordered_map<std::string, type> severity_map;
|
||||
|
||||
// globally get security level
|
||||
static type get()
|
||||
{
|
||||
return severity_level_;
|
||||
}
|
||||
|
||||
// globally set security level
|
||||
static void set(const type& severity_level)
|
||||
{
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
boost::mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
|
||||
severity_level_ = severity_level;
|
||||
}
|
||||
|
||||
// per object get security level
|
||||
static type get_object(const std::string& object_name)
|
||||
{
|
||||
severity_map::iterator it = object_severity_level_.find(object_name);
|
||||
if (object_name.empty() || it == object_severity_level_.end())
|
||||
{
|
||||
return severity_level_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
// per object set security level
|
||||
static void set_object(const std::string& object_name,
|
||||
const type& security_level)
|
||||
{
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
boost::mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
if (! object_name.empty())
|
||||
{
|
||||
object_severity_level_[object_name] = security_level;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static type severity_level_;
|
||||
static severity_map object_severity_level_;
|
||||
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
static boost::mutex mutex_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
class MAPNIK_DECL format :
|
||||
public singleton<format,CreateStatic>,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
static std::string get()
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
static void set(const std::string& format)
|
||||
{
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
boost::mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
format_ = format;
|
||||
}
|
||||
|
||||
static std::string str();
|
||||
|
||||
private:
|
||||
static std::string format_;
|
||||
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
static boost::mutex mutex_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
class MAPNIK_DECL output :
|
||||
public singleton<output,CreateStatic>,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
static void use_file(const std::string& filepath);
|
||||
static void use_console();
|
||||
|
||||
private:
|
||||
static std::ofstream file_output_;
|
||||
static std::string file_name_;
|
||||
static std::streambuf* saved_buf_;
|
||||
};
|
||||
|
||||
|
||||
template<class Ch, class Tr, class A>
|
||||
class clog_sink
|
||||
{
|
||||
public:
|
||||
typedef std::basic_ostringstream<Ch, Tr, A> stream_buffer;
|
||||
|
||||
void operator()(const stream_buffer &s)
|
||||
{
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
static boost::mutex mutex;
|
||||
boost::mutex::scoped_lock lock(mutex);
|
||||
#endif
|
||||
std::clog << format::str() << " " << s.str() << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<template <class Ch, class Tr, class A> class OutputPolicy,
|
||||
severity::type Severity,
|
||||
class Ch = char,
|
||||
class Tr = std::char_traits<Ch>,
|
||||
class A = std::allocator<Ch> >
|
||||
class base_log : public boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef OutputPolicy<Ch, Tr, A> output_policy;
|
||||
|
||||
base_log() {}
|
||||
|
||||
base_log(const char* object_name)
|
||||
{
|
||||
#ifdef MAPNIK_LOG
|
||||
if (object_name != NULL)
|
||||
{
|
||||
object_name_ = object_name;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
~base_log()
|
||||
{
|
||||
#ifdef MAPNIK_LOG
|
||||
if (check_severity())
|
||||
{
|
||||
output_policy()(streambuf_);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class T>
|
||||
base_log &operator<<(const T &x)
|
||||
{
|
||||
#ifdef MAPNIK_LOG
|
||||
streambuf_ << x;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef MAPNIK_LOG
|
||||
inline bool check_severity()
|
||||
{
|
||||
return Severity >= severity::get_object(object_name_);
|
||||
}
|
||||
|
||||
typename output_policy::stream_buffer streambuf_;
|
||||
std::string object_name_;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef base_log<clog_sink, severity::info> base_log_info;
|
||||
typedef base_log<clog_sink, severity::debug> base_log_debug;
|
||||
typedef base_log<clog_sink, severity::warn> base_log_warn;
|
||||
typedef base_log<clog_sink, severity::error> base_log_error;
|
||||
typedef base_log<clog_sink, severity::fatal> base_log_fatal;
|
||||
}
|
||||
|
||||
|
||||
class MAPNIK_DECL info : public logger::base_log_info {
|
||||
public:
|
||||
info() : logger::base_log_info() {}
|
||||
info(const char* object_name) : logger::base_log_info(object_name) {}
|
||||
};
|
||||
|
||||
class MAPNIK_DECL debug : public logger::base_log_debug {
|
||||
public:
|
||||
debug() : logger::base_log_debug() {}
|
||||
debug(const char* object_name) : logger::base_log_debug(object_name) {}
|
||||
};
|
||||
|
||||
class MAPNIK_DECL warn : public logger::base_log_warn {
|
||||
public:
|
||||
warn() : logger::base_log_warn() {}
|
||||
warn(const char* object_name) : logger::base_log_warn(object_name) {}
|
||||
};
|
||||
|
||||
class MAPNIK_DECL error : public logger::base_log_error {
|
||||
public:
|
||||
error() : logger::base_log_error() {}
|
||||
error(const char* object_name) : logger::base_log_error(object_name) {}
|
||||
};
|
||||
|
||||
class MAPNIK_DECL fatal : public logger::base_log_fatal {
|
||||
public:
|
||||
fatal() : logger::base_log_fatal() {}
|
||||
fatal(const char* object_name) : logger::base_log_fatal(object_name) {}
|
||||
};
|
||||
|
||||
|
||||
#define MAPNIK_LOG_INFO(s) mapnik::info(#s)
|
||||
#define MAPNIK_LOG_DEBUG(s) mapnik::debug(#s)
|
||||
#define MAPNIK_LOG_WARN(s) mapnik::warn(#s)
|
||||
#define MAPNIK_LOG_ERROR(s) mapnik::error(#s)
|
||||
#define MAPNIK_LOG_FATAL(s) mapnik::fatal(#s)
|
||||
}
|
||||
|
||||
#endif // MAPNIK_DEBUG_HPP
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
|
@ -37,9 +38,10 @@ namespace mapnik {
|
|||
class illegal_enum_value : public std::exception
|
||||
{
|
||||
public:
|
||||
illegal_enum_value() {}
|
||||
illegal_enum_value():
|
||||
what_() {}
|
||||
|
||||
illegal_enum_value( const std::string & what ) :
|
||||
illegal_enum_value( std::string const& what ) :
|
||||
what_( what )
|
||||
{
|
||||
}
|
||||
|
@ -72,7 +74,7 @@ protected:
|
|||
* underscores (<i>_</i>) and dashes (<i>-</i>).
|
||||
*
|
||||
*
|
||||
* @warning At the moment the verify() method is called during static initialization.
|
||||
* @warning At the moment the verify_mapnik_enum() method is called during static initialization.
|
||||
* It quits the application with exit code 1 if any error is detected. The other solution
|
||||
* i thought of is to do the checks at compile time (using boost::mpl).
|
||||
*
|
||||
|
@ -138,9 +140,15 @@ template <class ENUM, int THE_MAX>
|
|||
class MAPNIK_DECL enumeration {
|
||||
public:
|
||||
typedef ENUM native_type;
|
||||
enumeration() {};
|
||||
enumeration( ENUM v ) : value_(v) {}
|
||||
enumeration( const enumeration & other ) : value_(other.value_) {}
|
||||
|
||||
enumeration()
|
||||
: value_() {}
|
||||
|
||||
enumeration( ENUM v )
|
||||
: value_(v) {}
|
||||
|
||||
enumeration( const enumeration & other )
|
||||
: value_(other.value_) {}
|
||||
|
||||
/** Assignment operator for native enum values. */
|
||||
void operator=(ENUM v)
|
||||
|
@ -164,14 +172,16 @@ public:
|
|||
{
|
||||
MAX = THE_MAX
|
||||
};
|
||||
|
||||
ENUM max() const
|
||||
{
|
||||
return THE_MAX;
|
||||
}
|
||||
|
||||
/** Converts @p str to an enum.
|
||||
* @throw illegal_enum_value @p str is not a legal identifier.
|
||||
* */
|
||||
void from_string(const std::string & str)
|
||||
void from_string(std::string const& str)
|
||||
{
|
||||
for (unsigned i = 0; i < THE_MAX; ++i)
|
||||
{
|
||||
|
@ -245,32 +255,36 @@ public:
|
|||
/** Performs some simple checks and quits the application if
|
||||
* any error is detected. Tries to print helpful error messages.
|
||||
*/
|
||||
static bool verify(const char * filename, unsigned line_no)
|
||||
static bool verify_mapnik_enum(const char * filename, unsigned line_no)
|
||||
{
|
||||
for (unsigned i = 0; i < THE_MAX; ++i)
|
||||
{
|
||||
if (our_strings_[i] == 0 )
|
||||
{
|
||||
std::cerr << "### FATAL: Not enough strings for enum "
|
||||
MAPNIK_LOG_FATAL(enumeration)
|
||||
<< "### FATAL: Not enough strings for enum "
|
||||
<< our_name_ << " defined in file '" << filename
|
||||
<< "' at line " << line_no << std::endl;
|
||||
<< "' at line " << line_no;
|
||||
//std::exit(1);
|
||||
}
|
||||
}
|
||||
if ( std::string("") != our_strings_[THE_MAX])
|
||||
{
|
||||
std::cerr << "### FATAL: The string array for enum " << our_name_
|
||||
MAPNIK_LOG_FATAL(enumeration)
|
||||
<< "### FATAL: The string array for enum " << our_name_
|
||||
<< " defined in file '" << filename << "' at line " << line_no
|
||||
<< " has too many items or is not terminated with an "
|
||||
<< "empty string." << std::endl;
|
||||
<< "empty string";
|
||||
//std::exit(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static const std::string & get_full_qualified_name()
|
||||
|
||||
static std::string const& get_full_qualified_name()
|
||||
{
|
||||
return our_name_;
|
||||
}
|
||||
|
||||
static std::string get_name()
|
||||
{
|
||||
std::string::size_type idx = our_name_.find_last_of(":");
|
||||
|
@ -281,6 +295,7 @@ public:
|
|||
return our_name_.substr( idx + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ENUM value_;
|
||||
static const char ** our_strings_ ;
|
||||
|
@ -318,13 +333,13 @@ operator>>(std::istream & is, mapnik::enumeration<ENUM, THE_MAX> & e)
|
|||
#define DEFINE_ENUM( name, e) \
|
||||
typedef enumeration<e, e ## _MAX> name
|
||||
|
||||
/** Helper macro. Runs the verify() method during static initialization.
|
||||
/** Helper macro. Runs the verify_mapnik_enum() method during static initialization.
|
||||
* @relates mapnik::enumeration
|
||||
*/
|
||||
|
||||
#define IMPLEMENT_ENUM( name, strings ) \
|
||||
template <> const char ** name ::our_strings_ = strings; \
|
||||
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_mapnik_enum(__FILE__, __LINE__));
|
||||
|
||||
#endif // MAPNIK_ENUMERATION_HPP
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
#include <mapnik/expression_grammar.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
@ -35,6 +34,7 @@ namespace mapnik
|
|||
{
|
||||
|
||||
typedef boost::shared_ptr<expr_node> expression_ptr;
|
||||
template <typename Iterator> struct expression_grammar;
|
||||
|
||||
class expression_factory
|
||||
{
|
||||
|
|
|
@ -100,7 +100,9 @@ public:
|
|||
feature_impl(context_ptr const& ctx, int id)
|
||||
: id_(id),
|
||||
ctx_(ctx),
|
||||
data_(ctx_->mapping_.size())
|
||||
data_(ctx_->mapping_.size()),
|
||||
geom_cont_(),
|
||||
raster_()
|
||||
{}
|
||||
|
||||
inline int id() const { return id_;}
|
||||
|
@ -222,13 +224,14 @@ public:
|
|||
|
||||
box2d<double> envelope() const
|
||||
{
|
||||
// TODO - cache this
|
||||
box2d<double> result;
|
||||
for (unsigned i=0;i<num_geometries();++i)
|
||||
{
|
||||
geometry_type const& geom = get_geometry(i);
|
||||
if (i==0)
|
||||
{
|
||||
box2d<double> box = geom.envelope();
|
||||
box2d<double> const& box = geom.envelope();
|
||||
result.init(box.minx(),box.miny(),box.maxx(),box.maxy());
|
||||
}
|
||||
else
|
||||
|
@ -280,9 +283,9 @@ public:
|
|||
private:
|
||||
int id_;
|
||||
context_ptr ctx_;
|
||||
cont_type data_;
|
||||
boost::ptr_vector<geometry_type> geom_cont_;
|
||||
raster_ptr raster_;
|
||||
cont_type data_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
#define MAPNIK_FONT_ENGINE_FREETYPE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/text_path.hpp>
|
||||
#include <mapnik/font_set.hpp>
|
||||
#include <mapnik/char_info.hpp>
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
|
||||
// freetype2
|
||||
extern "C"
|
||||
|
@ -45,6 +47,7 @@ extern "C"
|
|||
#include <boost/make_shared.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#endif
|
||||
|
@ -56,9 +59,14 @@ extern "C"
|
|||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
// uci
|
||||
#include <unicode/unistr.h>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
class font_face;
|
||||
class text_path;
|
||||
class string_info;
|
||||
|
||||
typedef boost::shared_ptr<font_face> face_ptr;
|
||||
|
||||
|
@ -131,10 +139,8 @@ public:
|
|||
|
||||
~font_face()
|
||||
{
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "~font_face: Clean up face \"" << family_name()
|
||||
<< " " << style_name() << "\"" << std::endl;
|
||||
#endif
|
||||
MAPNIK_LOG_DEBUG(font_engine_freetype) << "font_face: Clean up face \"" << family_name() << " " << style_name() << "\"";
|
||||
|
||||
FT_Done_Face(face_);
|
||||
}
|
||||
|
||||
|
@ -146,7 +152,8 @@ class MAPNIK_DECL font_face_set : private boost::noncopyable
|
|||
{
|
||||
public:
|
||||
font_face_set(void)
|
||||
: faces_() {}
|
||||
: faces_(),
|
||||
dimension_cache_() {}
|
||||
|
||||
void add(face_ptr face)
|
||||
{
|
||||
|
@ -161,11 +168,10 @@ public:
|
|||
|
||||
glyph_ptr get_glyph(unsigned c) const
|
||||
{
|
||||
for (std::vector<face_ptr>::const_iterator face = faces_.begin(); face != faces_.end(); ++face)
|
||||
BOOST_FOREACH ( face_ptr const& face, faces_)
|
||||
{
|
||||
FT_UInt g = (*face)->get_char(c);
|
||||
|
||||
if (g) return boost::make_shared<font_glyph>(*face, g);
|
||||
FT_UInt g = face->get_char(c);
|
||||
if (g) return boost::make_shared<font_glyph>(face, g);
|
||||
}
|
||||
|
||||
// Final fallback to empty square if nothing better in any font
|
||||
|
@ -178,17 +184,17 @@ public:
|
|||
|
||||
void set_pixel_sizes(unsigned size)
|
||||
{
|
||||
for (std::vector<face_ptr>::iterator face = faces_.begin(); face != faces_.end(); ++face)
|
||||
BOOST_FOREACH ( face_ptr const& face, faces_)
|
||||
{
|
||||
(*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)
|
||||
BOOST_FOREACH ( face_ptr const& face, faces_)
|
||||
{
|
||||
(*face)->set_character_sizes(size);
|
||||
face->set_character_sizes(size);
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
@ -218,9 +224,8 @@ public:
|
|||
|
||||
~stroker()
|
||||
{
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "~stroker: destroy stroker:" << s_ << std::endl;
|
||||
#endif
|
||||
MAPNIK_LOG_DEBUG(font_engine_freetype) << "stroker: Destroy stroker=" << s_;
|
||||
|
||||
FT_Stroker_Done(s_);
|
||||
}
|
||||
private:
|
||||
|
@ -256,7 +261,7 @@ template <typename T>
|
|||
class MAPNIK_DECL face_manager : private boost::noncopyable
|
||||
{
|
||||
typedef T font_engine_type;
|
||||
typedef std::map<std::string,face_ptr> faces;
|
||||
typedef std::map<std::string,face_ptr> face_ptr_cache_type;
|
||||
|
||||
public:
|
||||
face_manager(T & engine)
|
||||
|
@ -265,9 +270,9 @@ public:
|
|||
|
||||
face_ptr get_face(std::string const& name)
|
||||
{
|
||||
typename faces::iterator itr;
|
||||
itr = faces_.find(name);
|
||||
if (itr != faces_.end())
|
||||
face_ptr_cache_type::iterator itr;
|
||||
itr = face_ptr_cache_.find(name);
|
||||
if (itr != face_ptr_cache_.end())
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
|
@ -276,7 +281,7 @@ public:
|
|||
face_ptr face = engine_.create_face(name);
|
||||
if (face)
|
||||
{
|
||||
faces_.insert(make_pair(name,face));
|
||||
face_ptr_cache_.insert(make_pair(name,face));
|
||||
}
|
||||
return face;
|
||||
}
|
||||
|
@ -301,10 +306,12 @@ public:
|
|||
if (face_ptr face = get_face(*name))
|
||||
{
|
||||
face_set->add(face);
|
||||
} else {
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::cerr << "Failed to find face '" << *name << "' in font set '" << fset.get_name() << "'\n";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
MAPNIK_LOG_ERROR(font_engine_freetype)
|
||||
<< "Failed to find face '" << *name
|
||||
<< "' in font set '" << fset.get_name() << "'\n";
|
||||
}
|
||||
}
|
||||
return face_set;
|
||||
|
@ -328,7 +335,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
faces faces_;
|
||||
face_ptr_cache_type face_ptr_cache_;
|
||||
font_engine_type & engine_;
|
||||
stroker_ptr stroker_;
|
||||
};
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace mapnik {
|
|||
|
||||
typedef std::set<expression_ptr> expression_set;
|
||||
class processed_text;
|
||||
class xml_node;
|
||||
struct char_properties;
|
||||
|
||||
namespace formatting {
|
||||
|
@ -48,7 +49,7 @@ class node
|
|||
public:
|
||||
virtual ~node() {}
|
||||
virtual void to_xml(boost::property_tree::ptree &xml) const;
|
||||
static node_ptr from_xml(boost::property_tree::ptree const& xml);
|
||||
static node_ptr from_xml(xml_node const& xml);
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const = 0;
|
||||
virtual void add_expressions(expression_set &output) const;
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace formatting {
|
|||
class expression_format: public node {
|
||||
public:
|
||||
void to_xml(boost::property_tree::ptree &xml) const;
|
||||
static node_ptr from_xml(boost::property_tree::ptree const& xml);
|
||||
static node_ptr from_xml(xml_node const& xml);
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
|
||||
virtual void add_expressions(expression_set &output) const;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
private:
|
||||
node_ptr child_;
|
||||
static expression_ptr get_expression(boost::property_tree::ptree const& xml, std::string name);
|
||||
static expression_ptr get_expression(xml_node const& xml, std::string name);
|
||||
};
|
||||
} //ns formatting
|
||||
} //ns mapnik
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace formatting {
|
|||
class format_node: public node {
|
||||
public:
|
||||
void to_xml(boost::property_tree::ptree &xml) const;
|
||||
static node_ptr from_xml(boost::property_tree::ptree const& xml);
|
||||
static node_ptr from_xml(xml_node const& xml);
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
|
||||
virtual void add_expressions(expression_set &output) const;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace mapnik
|
|||
namespace formatting
|
||||
{
|
||||
|
||||
typedef node_ptr (*from_xml_function_ptr)(boost::property_tree::ptree const& xml);
|
||||
typedef node_ptr (*from_xml_function_ptr)(xml_node const& xml);
|
||||
|
||||
class registry : public singleton<registry, CreateStatic>,
|
||||
private boost::noncopyable
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
registry();
|
||||
~registry() {}
|
||||
void register_name(std::string name, from_xml_function_ptr ptr, bool overwrite=false);
|
||||
node_ptr from_xml(std::string name, boost::property_tree::ptree const& xml);
|
||||
node_ptr from_xml(xml_node const& xml);
|
||||
private:
|
||||
std::map<std::string, from_xml_function_ptr> map_;
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
text_node(expression_ptr text): node(), text_(text) {}
|
||||
text_node(std::string text): node(), text_(parse_expression(text)) {}
|
||||
void to_xml(boost::property_tree::ptree &xml) const;
|
||||
static node_ptr from_xml(boost::property_tree::ptree const& xml);
|
||||
static node_ptr from_xml(xml_node const& xml);
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
|
||||
virtual void add_expressions(expression_set &output) const;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_GAMMA_METHOD_HPP
|
||||
#define MAPNIK_GAMMA_METHOD_HPP
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/grid/grid_view.hpp>
|
||||
|
@ -72,7 +73,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
|
||||
hit_grid(int width, int height, std::string const& key, unsigned int resolution)
|
||||
:width_(width),
|
||||
height_(height),
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
std::clog << "should not get here: key '" << key_ << "' not found in feature properties\n";
|
||||
MAPNIK_LOG_DEBUG(grid) << "hit_grid: Should not get here: key '" << key_ << "' not found in feature properties";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
std::clog << "### Warning: key '" << key_ << "' was blank for " << *feature << "\n";
|
||||
MAPNIK_LOG_DEBUG(grid) << "hit_grid: Warning - key '" << key_ << "' was blank for " << *feature;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_GRID_RASTERIZER_HPP
|
||||
#define MAPNIK_GRID_RASTERIZER_HPP
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef GRID_RENDERER_HPP
|
||||
#define GRID_RENDERER_HPP
|
||||
|
||||
|
@ -32,7 +30,6 @@
|
|||
#include <mapnik/label_collision_detector.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
//#include <mapnik/marker.hpp>
|
||||
|
||||
#include <mapnik/grid/grid.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -63,7 +60,7 @@ public:
|
|||
~grid_renderer();
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(layer const& lay);
|
||||
void start_layer_processing(layer const& lay, box2d<double> const& query_extent);
|
||||
void end_layer_processing(layer const& lay);
|
||||
void render_marker(mapnik::feature_ptr const& feature, unsigned int step, pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_GRID_RENDERING_BUFFER_HPP
|
||||
#define MAPNIK_GRID_RENDERING_BUFFER_HPP
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_GRID_VIEW_HPP
|
||||
#define MAPNIK_GRID_VIEW_HPP
|
||||
|
||||
|
@ -34,6 +32,7 @@
|
|||
|
||||
// boost
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
// stl
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
#define MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
|
||||
// agg
|
||||
#include "agg_rendering_buffer.h"
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
#include "agg_scanline_u.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -69,116 +64,7 @@ enum composite_mode_e
|
|||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void composite(T1 & im, T2 & im2, composite_mode_e mode)
|
||||
{
|
||||
typedef agg::rgba8 color;
|
||||
typedef agg::order_bgra order;
|
||||
typedef agg::pixel32_type pixel_type;
|
||||
typedef agg::comp_op_adaptor_rgba<color, order> blender_type;
|
||||
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_type;
|
||||
typedef agg::renderer_base<pixfmt_type> renderer_type;
|
||||
typedef agg::comp_op_adaptor_rgba<color, order> blender_type;
|
||||
typedef agg::renderer_base<pixfmt_type> renderer_type;
|
||||
|
||||
agg::rendering_buffer source(im.getBytes(),im.width(),im.height(),im.width() * 4);
|
||||
agg::rendering_buffer mask(im2.getBytes(),im2.width(),im2.height(),im2.width() * 4);
|
||||
|
||||
agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixf(source);
|
||||
agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixf_mask(mask);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case clear :
|
||||
pixf.comp_op(agg::comp_op_clear);
|
||||
break;
|
||||
case src:
|
||||
pixf.comp_op(agg::comp_op_src);
|
||||
break;
|
||||
case dst:
|
||||
pixf.comp_op(agg::comp_op_dst);
|
||||
break;
|
||||
case src_over:
|
||||
pixf.comp_op(agg::comp_op_src_over);
|
||||
break;
|
||||
case dst_over:
|
||||
pixf.comp_op(agg::comp_op_dst_over);
|
||||
break;
|
||||
case src_in:
|
||||
pixf.comp_op(agg::comp_op_src_in);
|
||||
break;
|
||||
case dst_in:
|
||||
pixf.comp_op(agg::comp_op_dst_in);
|
||||
break;
|
||||
case src_out:
|
||||
pixf.comp_op(agg::comp_op_src_out);
|
||||
break;
|
||||
case dst_out:
|
||||
pixf.comp_op(agg::comp_op_dst_out);
|
||||
break;
|
||||
case src_atop:
|
||||
pixf.comp_op(agg::comp_op_src_atop);
|
||||
break;
|
||||
case dst_atop:
|
||||
pixf.comp_op(agg::comp_op_dst_atop);
|
||||
break;
|
||||
case _xor:
|
||||
pixf.comp_op(agg::comp_op_xor);
|
||||
break;
|
||||
case plus:
|
||||
pixf.comp_op(agg::comp_op_plus);
|
||||
break;
|
||||
case minus:
|
||||
pixf.comp_op(agg::comp_op_minus);
|
||||
break;
|
||||
case multiply:
|
||||
pixf.comp_op(agg::comp_op_multiply);
|
||||
break;
|
||||
case screen:
|
||||
pixf.comp_op(agg::comp_op_screen);
|
||||
break;
|
||||
case overlay:
|
||||
pixf.comp_op(agg::comp_op_overlay);
|
||||
break;
|
||||
case darken:
|
||||
pixf.comp_op(agg::comp_op_darken);
|
||||
break;
|
||||
case lighten:
|
||||
pixf.comp_op(agg::comp_op_lighten);
|
||||
break;
|
||||
case color_dodge:
|
||||
pixf.comp_op(agg::comp_op_color_dodge);
|
||||
break;
|
||||
case color_burn:
|
||||
pixf.comp_op(agg::comp_op_color_burn);
|
||||
break;
|
||||
case hard_light:
|
||||
pixf.comp_op(agg::comp_op_hard_light);
|
||||
break;
|
||||
case soft_light:
|
||||
pixf.comp_op(agg::comp_op_soft_light);
|
||||
break;
|
||||
case difference:
|
||||
pixf.comp_op(agg::comp_op_difference);
|
||||
break;
|
||||
case exclusion:
|
||||
pixf.comp_op(agg::comp_op_exclusion);
|
||||
break;
|
||||
case contrast:
|
||||
pixf.comp_op(agg::comp_op_contrast);
|
||||
break;
|
||||
case invert:
|
||||
pixf.comp_op(agg::comp_op_invert);
|
||||
break;
|
||||
case invert_rgb:
|
||||
pixf.comp_op(agg::comp_op_invert_rgb);
|
||||
break;
|
||||
}
|
||||
renderer_type ren(pixf);
|
||||
agg::renderer_base<pixfmt_type> rb(pixf);
|
||||
rb.blend_from(pixf_mask,0,0,0,255);
|
||||
void composite(T1 & im, T2 & im2, composite_mode_e mode);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
|
|
|
@ -147,7 +147,7 @@ inline boost::optional<std::string> type_from_filename(std::string const& filena
|
|||
return result_type();
|
||||
}
|
||||
|
||||
inline std::string guess_type( const std::string & filename )
|
||||
inline std::string guess_type( std::string const& filename )
|
||||
{
|
||||
std::string::size_type idx = filename.find_last_of(".");
|
||||
if ( idx != std::string::npos ) {
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
#ifndef DUMP_XML_HPP
|
||||
#define DUMP_XML_HPP
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <mapnik/xml_node.hpp>
|
||||
|
||||
/* Debug dump ptree XML representation.
|
||||
*/
|
||||
void dump_xml(boost::property_tree::ptree const& xml, unsigned level=0)
|
||||
*/
|
||||
void dump_xml(xml_node const& xml, unsigned level=0)
|
||||
{
|
||||
std::string indent;
|
||||
int i;
|
||||
unsigned i;
|
||||
for (i=0; i<level; i++)
|
||||
{
|
||||
indent += " ";
|
||||
}
|
||||
if (xml.data().length()) std::cout << indent << "data: '" << xml.data() << "'\n";
|
||||
boost::property_tree::ptree::const_iterator itr = xml.begin();
|
||||
boost::property_tree::ptree::const_iterator end = xml.end();
|
||||
xml_node::attribute_map const& attr = xml.get_attributes();
|
||||
std::cerr << indent <<"[" << xml.name();
|
||||
xml_node::attribute_map::const_iterator aitr = attr.begin();
|
||||
xml_node::attribute_map::const_iterator aend = attr.end();
|
||||
for (;aitr!=aend; aitr++)
|
||||
{
|
||||
std::cerr << " (" << aitr->first << ", " << aitr->second.value << ", " << aitr->second.processed << ")";
|
||||
}
|
||||
std::cerr << "]" << "\n";
|
||||
if (xml.is_text()) std::cerr << indent << "text: '" << xml.text() << "'\n";
|
||||
xml_node::const_iterator itr = xml.begin();
|
||||
xml_node::const_iterator end = xml.end();
|
||||
for (; itr!=end; itr++)
|
||||
{
|
||||
std::cout << indent <<"[" << itr->first << "]" << "\n";
|
||||
dump_xml(itr->second, level+1);
|
||||
std::cout << indent << "[/" << itr->first << "]" << "\n";
|
||||
dump_xml(*itr, level+1);
|
||||
}
|
||||
std::cerr << indent << "[/" << xml.name() << "]" << "\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -266,12 +266,12 @@ struct feature_grammar :
|
|||
//
|
||||
;
|
||||
|
||||
coordinates = eps(_r2 == 1) > point_coordinates(extract_geometry_(_r1))
|
||||
| eps(_r2 == 2) > linestring_coordinates(extract_geometry_(_r1))
|
||||
| eps(_r2 == 3) > polygon_coordinates(extract_geometry_(_r1))
|
||||
| eps(_r2 == 4) > multipoint_coordinates(extract_geometry_(_r1))
|
||||
| eps(_r2 == 5) > multilinestring_coordinates(extract_geometry_(_r1))
|
||||
| eps(_r2 == 6) > multipolygon_coordinates(extract_geometry_(_r1))
|
||||
coordinates = (eps(_r2 == 1) > point_coordinates(extract_geometry_(_r1)))
|
||||
| (eps(_r2 == 2) > linestring_coordinates(extract_geometry_(_r1)))
|
||||
| (eps(_r2 == 3) > polygon_coordinates(extract_geometry_(_r1)))
|
||||
| (eps(_r2 == 4) > multipoint_coordinates(extract_geometry_(_r1)))
|
||||
| (eps(_r2 == 5) > multilinestring_coordinates(extract_geometry_(_r1)))
|
||||
| (eps(_r2 == 6) > multipolygon_coordinates(extract_geometry_(_r1)))
|
||||
;
|
||||
|
||||
point_coordinates = eps[ _a = new_<geometry_type>(Point) ]
|
||||
|
@ -316,7 +316,7 @@ struct feature_grammar :
|
|||
on_error<fail>
|
||||
(
|
||||
feature
|
||||
, std::cerr
|
||||
, std::clog
|
||||
<< phoenix::val("Error! Expecting ")
|
||||
<< _4 // what failed?
|
||||
<< phoenix::val(" here: \"")
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef MAPNIK_JSON_GEOMETRY_GENERATOR_GRAMMAR_HPP
|
||||
#define MAPNIK_JSON_GEOMETRY_GENERATOR_GRAMMAR_HPP
|
||||
|
||||
|
@ -30,6 +28,7 @@
|
|||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/util/vertex_iterator.hpp>
|
||||
#include <mapnik/util/container_adapter.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
|
|
|
@ -39,7 +39,7 @@ struct label_collision_detector
|
|||
{
|
||||
typedef std::vector<box2d<double> > label_placements;
|
||||
|
||||
bool has_plasement(box2d<double> const& box)
|
||||
bool has_placement(box2d<double> const& box)
|
||||
{
|
||||
label_placements::const_iterator itr=labels_.begin();
|
||||
for( ; itr !=labels_.end();++itr)
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
//quad tree based label collission detector so labels dont appear within a given distance
|
||||
//quad tree based label collision detector so labels dont appear within a given distance
|
||||
class label_collision_detector4 : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -88,44 +88,44 @@ public:
|
|||
std::vector<std::string>& styles();
|
||||
|
||||
/*!
|
||||
* @param maxZoom The minimum zoom level to set
|
||||
* @param max_zoom The minimum zoom level to set
|
||||
*/
|
||||
void setMinZoom(double minZoom);
|
||||
void set_min_zoom(double min_zoom);
|
||||
|
||||
/*!
|
||||
* @param maxZoom The maximum zoom level to set
|
||||
* @param max_zoom The maximum zoom level to set
|
||||
*/
|
||||
void setMaxZoom(double maxZoom);
|
||||
void set_max_zoom(double max_zoom);
|
||||
|
||||
/*!
|
||||
* @return the minimum zoom level of the layer.
|
||||
*/
|
||||
double getMinZoom() const;
|
||||
double min_zoom() const;
|
||||
|
||||
/*!
|
||||
* @return the maximum zoom level of the layer.
|
||||
*/
|
||||
double getMaxZoom() const;
|
||||
double max_zoom() const;
|
||||
|
||||
/*!
|
||||
* @brief Set whether this layer is active and will be rendered.
|
||||
*/
|
||||
void setActive(bool active);
|
||||
void set_active(bool active);
|
||||
|
||||
/*!
|
||||
* @return whether this layer is active and will be rendered.
|
||||
*/
|
||||
bool isActive() const;
|
||||
bool active() const;
|
||||
|
||||
/*!
|
||||
* @brief Set whether this layer is queryable.
|
||||
*/
|
||||
void setQueryable(bool queryable);
|
||||
void set_queryable(bool queryable);
|
||||
|
||||
/*!
|
||||
* @return whether this layer is queryable or not.
|
||||
*/
|
||||
bool isQueryable() const;
|
||||
bool queryable() const;
|
||||
|
||||
/*!
|
||||
* @brief Get the visability for a specific scale.
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
* or
|
||||
* scale < maxzoom + 1e-6
|
||||
*/
|
||||
bool isVisible(double scale) const;
|
||||
bool visible(double scale) const;
|
||||
|
||||
/*!
|
||||
* @param clear_cache Set whether this layer's labels are cached.
|
||||
|
@ -195,8 +195,8 @@ private:
|
|||
std::string name_;
|
||||
std::string srs_;
|
||||
|
||||
double minZoom_;
|
||||
double maxZoom_;
|
||||
double min_zoom_;
|
||||
double max_zoom_;
|
||||
bool active_;
|
||||
bool queryable_;
|
||||
bool clear_label_cache_;
|
||||
|
|
|
@ -44,17 +44,20 @@ struct MAPNIK_DECL line_symbolizer : public symbolizer_base
|
|||
explicit line_symbolizer()
|
||||
: symbolizer_base(),
|
||||
stroke_(),
|
||||
rasterizer_p_(RASTERIZER_FULL) {}
|
||||
rasterizer_p_(RASTERIZER_FULL),
|
||||
smooth_(0.0) {}
|
||||
|
||||
line_symbolizer(stroke const& stroke)
|
||||
: symbolizer_base(),
|
||||
stroke_(stroke),
|
||||
rasterizer_p_(RASTERIZER_FULL) {}
|
||||
rasterizer_p_(RASTERIZER_FULL),
|
||||
smooth_(0.0) {}
|
||||
|
||||
line_symbolizer(color const& pen,float width=1.0)
|
||||
: symbolizer_base(),
|
||||
stroke_(pen,width),
|
||||
rasterizer_p_(RASTERIZER_FULL) {}
|
||||
rasterizer_p_(RASTERIZER_FULL),
|
||||
smooth_(0.0) {}
|
||||
|
||||
stroke const& get_stroke() const
|
||||
{
|
||||
|
@ -76,9 +79,20 @@ struct MAPNIK_DECL line_symbolizer : public symbolizer_base
|
|||
return rasterizer_p_;
|
||||
}
|
||||
|
||||
void set_smooth(double smooth)
|
||||
{
|
||||
smooth_ = smooth;
|
||||
}
|
||||
|
||||
double smooth() const
|
||||
{
|
||||
return smooth_;
|
||||
}
|
||||
|
||||
private:
|
||||
stroke stroke_;
|
||||
line_rasterizer_e rasterizer_p_;
|
||||
double smooth_;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/config.hpp> // for MAPNIK_DECL
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
@ -32,7 +33,7 @@
|
|||
namespace mapnik
|
||||
{
|
||||
MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false);
|
||||
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 base_path="");
|
||||
}
|
||||
|
||||
#endif // MAPNIK_LOAD_MAP_HPP
|
||||
|
|
|
@ -79,7 +79,6 @@ private:
|
|||
box2d<double> current_extent_;
|
||||
boost::optional<box2d<double> > maximum_extent_;
|
||||
std::string base_path_;
|
||||
parameters extra_attr_;
|
||||
parameters extra_params_;
|
||||
|
||||
public:
|
||||
|
@ -338,6 +337,10 @@ public:
|
|||
*/
|
||||
boost::optional<box2d<double> > const& maximum_extent() const;
|
||||
|
||||
/*! \brief Get the non-const map maximum extent as box2d<double>
|
||||
*/
|
||||
boost::optional<box2d<double> > & maximum_extent();
|
||||
|
||||
/*! \brief Get the map base path where paths should be relative to.
|
||||
*/
|
||||
std::string const& base_path() const;
|
||||
|
@ -440,21 +443,6 @@ public:
|
|||
*/
|
||||
std::string get_metawriter_property(std::string name) const;
|
||||
|
||||
/*!
|
||||
* @brief Get extra valid attributes of the Map that are not true members
|
||||
*/
|
||||
parameters const& get_extra_attributes() const;
|
||||
|
||||
/*!
|
||||
* @brief Get non-const extra valid attributes of the Map that are not true members
|
||||
*/
|
||||
parameters& get_extra_attributes();
|
||||
|
||||
/*!
|
||||
* @brief Set extra attributes of the Map
|
||||
*/
|
||||
void set_extra_attributes(parameters& attr);
|
||||
|
||||
/*!
|
||||
* @brief Get extra, arbitrary Parameters attached to the Map
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,7 @@ struct MAPNIK_DECL mapped_memory_cache :
|
|||
static boost::unordered_map<std::string,mapped_region_ptr> cache_;
|
||||
static bool insert(std::string const& key, mapped_region_ptr);
|
||||
static boost::optional<mapped_region_ptr> find(std::string const& key, bool update_cache = false);
|
||||
static void clear();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -25,14 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
#include <mapnik/svg/svg_storage.hpp>
|
||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_path_storage.h"
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
@ -43,7 +36,7 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
using namespace mapnik::svg;
|
||||
class marker;
|
||||
|
||||
typedef boost::shared_ptr<marker> marker_ptr;
|
||||
|
||||
|
@ -57,6 +50,7 @@ struct MAPNIK_DECL marker_cache :
|
|||
static boost::unordered_map<std::string,marker_ptr> cache_;
|
||||
static bool insert(std::string const& key, marker_ptr);
|
||||
static boost::optional<marker_ptr> find(std::string const& key, bool update_cache = false);
|
||||
static void clear();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
explicit markers_symbolizer();
|
||||
markers_symbolizer(path_expression_ptr filename);
|
||||
markers_symbolizer(markers_symbolizer const& rhs);
|
||||
void set_ignore_placement(bool ignore_placement);
|
||||
bool get_ignore_placement() const;
|
||||
void set_allow_overlap(bool overlap);
|
||||
bool get_allow_overlap() const;
|
||||
void set_spacing(double spacing);
|
||||
|
@ -76,6 +78,7 @@ public:
|
|||
marker_type_e get_marker_type() const;
|
||||
|
||||
private:
|
||||
bool ignore_placement_;
|
||||
bool allow_overlap_;
|
||||
color fill_;
|
||||
double spacing_;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define MAPNIK_MEMORY_FEATURESET_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/memory_datasource.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -52,11 +53,12 @@ public:
|
|||
{
|
||||
while (pos_ != end_)
|
||||
{
|
||||
for (unsigned i=0; i<(*pos_)->num_geometries();++i) {
|
||||
for (unsigned i=0; i<(*pos_)->num_geometries();++i)
|
||||
{
|
||||
geometry_type & geom = (*pos_)->get_geometry(i);
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "bbox_=" << bbox_ << ", geom.envelope=" << geom.envelope() << "\n";
|
||||
#endif
|
||||
|
||||
MAPNIK_LOG_DEBUG(memory_featureset) << "memory_featureset: BBox=" << bbox_ << ",Envelope=" << geom.envelope();
|
||||
|
||||
if (bbox_.intersects(geom.envelope()))
|
||||
{
|
||||
return *pos_++;
|
||||
|
|
|
@ -24,9 +24,8 @@
|
|||
#define MAPNIK_METAWRITER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
@ -42,6 +41,7 @@
|
|||
namespace mapnik {
|
||||
|
||||
class text_placement_info;
|
||||
class text_path;
|
||||
|
||||
/** Implementation of std::map that also returns const& for operator[]. */
|
||||
class metawriter_property_map
|
||||
|
@ -103,8 +103,8 @@ public:
|
|||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
virtual void add_text(text_placement_info const& placement,
|
||||
face_manager_freetype &font_manager,
|
||||
virtual void add_text(boost::ptr_vector<text_path> &placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
class xml_node;
|
||||
|
||||
/**
|
||||
* Creates a metawriter with the properties specified in the property
|
||||
|
@ -37,7 +38,7 @@ namespace mapnik {
|
|||
* metawriters, but should provide an easy point to make them a
|
||||
* proper factory method if this is wanted in the future.
|
||||
*/
|
||||
metawriter_ptr metawriter_create(const boost::property_tree::ptree &pt);
|
||||
metawriter_ptr metawriter_create(xml_node const& pt);
|
||||
|
||||
/**
|
||||
* Writes properties into the given property tree representing the
|
||||
|
|
|
@ -65,8 +65,8 @@ public:
|
|||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_text(text_placement_info const& p,
|
||||
face_manager_freetype &font_manager,
|
||||
virtual void add_text(boost::ptr_vector<text_path> &placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_text(text_placement_info const& p,
|
||||
face_manager_freetype &font_manager,
|
||||
virtual void add_text(boost::ptr_vector<text_path> &placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
|
@ -72,12 +72,14 @@ public:
|
|||
void set_pixel_coordinates(bool on) { pixel_coordinates_ = on; }
|
||||
bool get_pixel_coordinates() { return pixel_coordinates_; }
|
||||
virtual void set_map_srs(projection const& proj);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
HEADER_NOT_WRITTEN = -1,
|
||||
STOPPED = -2,
|
||||
STARTED = 0
|
||||
};
|
||||
|
||||
/** Features written. */
|
||||
int count_;
|
||||
bool output_empty_;
|
||||
|
@ -85,20 +87,23 @@ protected:
|
|||
proj_transform *trans_;
|
||||
projection output_srs_;
|
||||
bool pixel_coordinates_;
|
||||
|
||||
virtual void write_header();
|
||||
|
||||
inline void write_feature_header(std::string type) {
|
||||
#ifdef MAPNIK_DEBUG
|
||||
if (count_ == STOPPED)
|
||||
{
|
||||
std::cerr << "WARNING: Metawriter not started before using it.\n";
|
||||
MAPNIK_LOG_WARN(metawrite_json) << "Metawriter: instance not started before using it.";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (count_ == HEADER_NOT_WRITTEN) write_header();
|
||||
if (count_++) *f_ << ",\n";
|
||||
|
||||
*f_ << "{ \"type\": \"Feature\",\n \"geometry\": { \"type\": \"" << type << "\",\n \"coordinates\":";
|
||||
}
|
||||
|
||||
void write_properties(Feature const& feature, metawriter_properties const& properties);
|
||||
|
||||
inline void write_point(CoordTransform const& t, double x, double y, bool last = false)
|
||||
{
|
||||
double z = 0.0;
|
||||
|
@ -111,6 +116,7 @@ protected:
|
|||
*f_ << ",";
|
||||
}
|
||||
}
|
||||
|
||||
void write_line_polygon(path_type & path, CoordTransform const& t, bool polygon);
|
||||
|
||||
private:
|
||||
|
@ -136,10 +142,12 @@ public:
|
|||
void set_filename(path_expression_ptr fn);
|
||||
/** Get filename template. */
|
||||
path_expression_ptr get_filename() const;
|
||||
|
||||
private:
|
||||
path_expression_ptr fn_;
|
||||
std::fstream f_;
|
||||
std::string filename_;
|
||||
|
||||
protected:
|
||||
virtual void write_header();
|
||||
};
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue