merge with master
This commit is contained in:
commit
8aae463c10
328 changed files with 4468 additions and 4242 deletions
138
CHANGELOG.md
138
CHANGELOG.md
|
@ -6,12 +6,104 @@ Developers: Please commit along with changes.
|
|||
|
||||
For a complete change history, see the git log.
|
||||
|
||||
## Future
|
||||
## 2.2.0
|
||||
|
||||
- Added new mapnik-config options: `git-describe`, `defines`, `includes`, `dep-includes`, and `cxxflags` (#1443)
|
||||
Released ---
|
||||
|
||||
(Packaged from ---)
|
||||
|
||||
Summary: The 2.2.0 release is the fastest running and most stable release in the history of Mapnik. The code line represents development in the master branch since the release of 2.1.0 in Aug 2012 and therefore includes nearly a year of bugfixes and low level optimizations. Shapefile and PostGIS datasources have benefited from numerous stability fixes, 64 bit integer support has been added to support OSM data, and many rendering fixes have landed for high quality output when using a rendering `scale_factor`. Many critical code paths have been optimized extensively include raster rendering, xml map loading, string to number conversion, vector reprojection when using `epsg:4326` and `epsg:3857`, `hextree` encoding, halo rendering, and rendering when using a custom `gamma`. Mapnik 2.2 also compiles faster than previous releases in the 2.x series and drops several uneeded and hard to install dependencies.
|
||||
|
||||
- Removed 3 depedencies without loosing any functionality: `ltdl`, `cairomm` and `libsigc++` (#1804,#806,#1681)
|
||||
|
||||
- Added 64 bit integer support in expressions, feature ids, and the grid_renderer (#1661,#1662,#1662)
|
||||
|
||||
- Added the ability to disable needing various depedencies: `proj4`, `libpng`, `libtiff`, `libjpeg`
|
||||
|
||||
- Added faster reprojection support between `epsg:3857` and `epsg:4326` (#1705,#1703,#1579)
|
||||
|
||||
- Fixed concurrency problem when using cursors in postgis plugin (#1823,#1588)
|
||||
|
||||
- Fixed postgres connection pool leaks when using `persist_connection=false` (#1764)
|
||||
|
||||
- Fixed postgres connection key to respect highest value of `max_size` and `initial_size` for any layer in map (#1599)
|
||||
|
||||
- Fixed potential crash in wkb parsing when postgis returns null geometry (#1843)
|
||||
|
||||
- Fixed blurry rendering of image and SVG icons (#1316)
|
||||
|
||||
- Improved logging system (https://github.com/mapnik/mapnik/wiki/Logging)
|
||||
|
||||
- Added support for reading images from in memory streams (#1805)
|
||||
|
||||
- Optimized halo rendering. When halo radius is < 1 new method will be used automatically (#1781)
|
||||
|
||||
- Added `text-halo-rasterizer` property. Set to `fast` for lower quality but faster
|
||||
halo rendering (#1298)
|
||||
halo rendering (#1298) which matched new default method when radius is < 1.
|
||||
|
||||
- Added support in `shape`, `sqlite`, `geojson`, and `csv` plugin for handling non-latin characters in the paths to file-based resources (#1177)
|
||||
|
||||
- Fixed rendering of markers when their size is greater than the specified `spacing` value (#1487)
|
||||
|
||||
- Fixed handling of alpha premultiplication in image scaling (#1489)
|
||||
|
||||
- Optimized rendering when a style with no symbolizers is encountered (#1517)
|
||||
|
||||
- Optimized string handling and type conversion by removing `boost::to_lower`, `boost::trim`, and `boost::lexical_cast` usage (#1687,#1687,#1633)
|
||||
|
||||
- Optimized alpha preserving `hextree` method for quantization of png images (#1629)
|
||||
|
||||
- Faster rendering of rasters by reducing memory allocation of temporary buffers (#1516)
|
||||
|
||||
- Fixed some raster reprojection artifacts (#1501)
|
||||
|
||||
- Fixed raster alignment when width != height and raster is being scaled (#1748,#1622)
|
||||
|
||||
- Added support for caching rasters for re-use during rendering when styling more than once per layer (#1543)
|
||||
|
||||
- Improved compile speeds of the code - in some cases by up to 2x and removed need for freetype dependency when building code against mapnik (#1688, #1756)
|
||||
|
||||
- Removed internal rule cache on `mapnik::Map` c++ object (#1723)
|
||||
|
||||
- Improved the scaled rendering of various map features when using `scale_factor` > 1 (#1280,#1100,#1273,#1792,#1291,#1344,#1279,#1624,#1767,#1766)
|
||||
|
||||
- Added C++ api for overriding scale_denominator to enable rendering at fixed scale (#1582)
|
||||
|
||||
- Added Layer `buffer-size` that can be used to override Map `buffer-size` to avoid
|
||||
over-fetching of data that does not need to be buffered as much as other layers.
|
||||
Map level `buffer-size` will be default if layers do not set the option. Renamed a
|
||||
previously undocumented parameter by the same name that impacted clipping extent and
|
||||
was not needed (clipping padding should likely be a symbolizer level option) (#1566)
|
||||
|
||||
- Fixed potential file descriptor leaks in image readers when invalid images were encountered (#1783)
|
||||
|
||||
- Fixed alpha handling in the `blur` and `invert` image filters (#1541)
|
||||
|
||||
- Fixed error reporting in the python plugin (#1422)
|
||||
|
||||
- Added the ability to run tests without installing with `make test-local`
|
||||
|
||||
- Reduced library binary size by adding support for `-fvisibility-inlines-hidden` and `-fvisibility=hidden` (#1826,#1832)
|
||||
|
||||
- Added `mapnik::map_request` class, a special object to allow passing mutable map objects to renderer (#1737)
|
||||
|
||||
- Added the ability to use `boost::hash` on `mapnik::value` types (#1729)
|
||||
|
||||
- Removed obsolete `geos` plugin (functionality replaced by `csv` plugin) and unmaintained `kismet` plugin (#1809,#1833)
|
||||
|
||||
- Added new `mapnik-config` flags: `--all-flags`, `--defines`, `--git-describe`, `--includes`, `--dep-includes`, `--cxxflags`, `--cxx` (#1443)
|
||||
|
||||
- Added support for unicode strings as arguments in python bindings (#163)
|
||||
|
||||
- Added DebugSymbolizer which is able to render the otherwise invisible collision boxes (#1366)
|
||||
|
||||
- Optimized rendering by reducing overhead of using `gamma` property (#1174)
|
||||
|
||||
- Fixed rendering artifacts when using `polygon-gamma` or `line-gamma` equal to 0 (#761,#1763)
|
||||
|
||||
- Fixed and optimized the display of excessive precision of some float data in labels (#430,#1697)
|
||||
|
||||
- Removed the `bind` option for datasources (#1654)
|
||||
|
||||
- Added ability to access style list from map by (name,obj) in python (#1725)
|
||||
|
||||
|
@ -21,19 +113,11 @@ For a complete change history, see the git log.
|
|||
|
||||
- Added support for `background-image` in cairo_renderer (#1724)
|
||||
|
||||
- Added Layer `buffer-size` that can be used to override Map `buffer-size` to avoid
|
||||
over-fetching of data that does not need to be buffered as much as other layers.
|
||||
Map level `buffer-size` will be default if layers do not set the option. Renamed a
|
||||
previously undocumented parameter by the same name that impacted clipping extent and
|
||||
was not needed (clipping padding should likely be a symbolizer level option) (#1566)
|
||||
|
||||
- Fixed building symbolizer rendering to be fully sensitive to alpha (8b66128c892 / bc8ea1c5a7a)
|
||||
|
||||
- Added 64 bit integer support in the grid_renderer (#1662)
|
||||
|
||||
- `<Filter>[attr]</Filter>` now returns false if attr is an empty string (#1665)
|
||||
|
||||
- Added 64 bit integer support in expressions and feature ids (#1661,#1662)
|
||||
- `<Filter>[attr]!=null</Filter>` now returns true if attr is not null (#1642)
|
||||
|
||||
- Added support for DBF `Logical` type: #1614
|
||||
|
||||
|
@ -50,9 +134,7 @@ For a complete change history, see the git log.
|
|||
|
||||
- Added support for setting zlib `Z_FIXED` strategy with format string: `png:z=fixed`
|
||||
|
||||
- Fixed handling of transparency level option in Octree-based PNG encoding (#1556)
|
||||
|
||||
- Faster rendering of rasters by reducing memory allocation of temporary buffers (#1516)
|
||||
- Fixed handling of transparency level option in `octree` png encoding (#1556)
|
||||
|
||||
- Added ability to pass a pre-created collision detector to the cairo renderer (#1444)
|
||||
|
||||
|
@ -68,6 +150,24 @@ For a complete change history, see the git log.
|
|||
now the combined layer extents will be again respected: they will be clipped to the maximum-extent if possible
|
||||
and only when back-projecting fails for all layers will the maximum-extent be used as a fallback (#1473)
|
||||
|
||||
- Compile time flag called `PLUGIN_LINKING` to allow input datasource plugins to be statically linked with the mapnik library (#249)
|
||||
|
||||
- Fixed `dasharray` rendering in cairo backend (#1740)
|
||||
|
||||
- Fixed handling of `opacity` in svg rendering (#1744)
|
||||
|
||||
- Fixed uneven rendering of markers along lines (#1693)
|
||||
|
||||
- Fixed handling of extra bytes in some shapefile fields (#1605)
|
||||
|
||||
- Fixed handling (finally) of null shapes and partially corrupt shapefiles (#1630,#1621)
|
||||
|
||||
- Added ability to re-use `mapnik::image_32` and `mapnik::grid` by exposing a `clear` method (#1571)
|
||||
|
||||
- Added support for writing RGB (no A) png images by using the format string of `png:t=0` (#1559)
|
||||
|
||||
- Added experimental support for geometry simplification at symbolizer level (#1385)
|
||||
|
||||
## Mapnik 2.1.0
|
||||
|
||||
Released Aug 23, 2012
|
||||
|
@ -215,7 +315,7 @@ Released April 10, 2012
|
|||
|
||||
- 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)
|
||||
- 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)
|
||||
|
||||
|
@ -395,14 +495,14 @@ Released March 23, 2010
|
|||
|
||||
- PNG: fixed png256 for large images and some improvements to reduce color corruptions ([#522](https://github.com/mapnik/mapnik/issues/522))
|
||||
|
||||
- PNG: Added new quantization method for indexed png format using hextree with full support for alpha
|
||||
- PNG: Added new quantization method for indexed png format using `hextree` with full support for alpha
|
||||
channel. Also new method has some optimizations for color gradients common when using elevation based
|
||||
rasters. By default old method using octree is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))
|
||||
rasters. By default old method using `octree` is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))
|
||||
|
||||
- PNG: Added initial support for passing options to png writter like number of colors, transparency
|
||||
support, quantization method and possibly other in future using type parameter. For example
|
||||
"png8:c=128:t=1:m=h" limits palette to 128 colors, uses only binary transparency (0 - none,
|
||||
1 - binary, 2 - full), and new method of quantization using hextree (h - hextree, o - octree).
|
||||
1 - binary, 2 - full), and new method of quantization using `hextree` (h - `hextree`, o - `octree`).
|
||||
Existing type "png256" can be also written using "png8:c=256:m=o:t=2" (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477))
|
||||
|
||||
|
||||
|
|
155
SConstruct
155
SConstruct
|
@ -22,6 +22,7 @@ import sys
|
|||
import re
|
||||
import platform
|
||||
from glob import glob
|
||||
from copy import copy
|
||||
from subprocess import Popen, PIPE
|
||||
from SCons.SConf import SetCacheMode
|
||||
import pickle
|
||||
|
@ -35,6 +36,12 @@ except:
|
|||
LIBDIR_SCHEMA_DEFAULT='lib'
|
||||
severities = ['debug', 'warn', 'error', 'none']
|
||||
|
||||
DEFAULT_CC = "gcc"
|
||||
DEFAULT_CXX = "g++"
|
||||
if sys.platform == 'darwin':
|
||||
DEFAULT_CC = "clang"
|
||||
DEFAULT_CXX = "clang++"
|
||||
|
||||
py3 = None
|
||||
|
||||
# local file to hold custom user configuration variables
|
||||
|
@ -72,6 +79,7 @@ pretty_dep_names = {
|
|||
'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org',
|
||||
'pg_config':'pg_config program | try setting PG_CONFIG SCons option',
|
||||
'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option',
|
||||
'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program',
|
||||
'gdal-config':'gdal-config program | try setting GDAL_CONFIG SCons option',
|
||||
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option',
|
||||
'osm':'more info: https://github.com/mapnik/mapnik/wiki//OsmPlugin',
|
||||
|
@ -101,7 +109,6 @@ PLUGINS = { # plugins with external dependencies
|
|||
'csv': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
|
||||
'raster': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
|
||||
'geojson': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
|
||||
'kismet': {'default':False,'path':None,'inc':None,'lib':None,'lang':'C++'},
|
||||
'python': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'},
|
||||
}
|
||||
|
||||
|
@ -166,10 +173,14 @@ def shortest_name(libs):
|
|||
name = lib
|
||||
return name
|
||||
|
||||
def rm_path(item,set,_env):
|
||||
for i in _env[set]:
|
||||
if item in i:
|
||||
_env[set].remove(i)
|
||||
|
||||
def sort_paths(items,priority):
|
||||
"""Sort paths such that compiling and linking will globally prefer custom or local libs
|
||||
over system libraries by fixing up the order libs are passed to gcc and the linker.
|
||||
over system libraries by fixing up the order libs are passed to the compiler and the linker.
|
||||
|
||||
Ideally preference could be by-target instead of global, but our SCons implementation
|
||||
is not currently utilizing different SCons build env()'s as we should.
|
||||
|
@ -254,15 +265,15 @@ opts = Variables()
|
|||
|
||||
opts.AddVariables(
|
||||
# Compiler options
|
||||
('CXX', 'The C++ compiler to use to compile mapnik (defaults to g++).', 'g++'),
|
||||
('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'),
|
||||
('CXX', 'The C++ compiler to use to compile mapnik', DEFAULT_CXX),
|
||||
('CC', 'The C compiler used for configure checks of C libs.', DEFAULT_CC),
|
||||
('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''),
|
||||
('CUSTOM_DEFINES', 'Custom Compiler DEFINES, e.g. -DENABLE_THIS', ''),
|
||||
('CUSTOM_CFLAGS', 'Custom C flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> (only used for configure checks)', ''),
|
||||
('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
|
||||
EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
|
||||
EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
|
||||
EnumVariable('OPTIMIZATION','Set g++ optimization level','3', ['0','1','2','3','4','s']),
|
||||
EnumVariable('OPTIMIZATION','Set compiler optimization level','3', ['0','1','2','3','4','s']),
|
||||
# Note: setting DEBUG=True will override any custom OPTIMIZATION level
|
||||
BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
|
||||
BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'),
|
||||
|
@ -303,8 +314,8 @@ opts.AddVariables(
|
|||
('XML2_CONFIG', 'The path to the xml2-config executable.', 'xml2-config'),
|
||||
PathVariable('ICU_INCLUDES', 'Search path for ICU include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('ICU_LIBS','Search path for ICU include files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc',
|
||||
PathVariable.PathAccept),
|
||||
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc', PathVariable.PathAccept),
|
||||
|
||||
BoolVariable('PNG', 'Build Mapnik with PNG read and write support', 'True'),
|
||||
PathVariable('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('PNG_LIBS','Search path for libpng library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
|
@ -325,6 +336,7 @@ PathVariable.PathAccept),
|
|||
|
||||
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
|
||||
BoolVariable('CPP_TESTS', 'Compile the C++ tests', 'True'),
|
||||
BoolVariable('BENCHMARK', 'Compile the C++ benchmark scripts', 'False'),
|
||||
|
||||
# Variables for optional dependencies
|
||||
# Note: cairo and and pycairo are optional but configured automatically through pkg-config
|
||||
|
@ -346,6 +358,9 @@ PathVariable.PathAccept),
|
|||
BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'),
|
||||
('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities) + ')', 'error'),
|
||||
|
||||
# Plugin linking
|
||||
EnumVariable('PLUGIN_LINKING', "Set plugin linking with libmapnik", 'shared', ['shared','static']),
|
||||
|
||||
# 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 provided then the bundled DejaVu fonts are not installed)',''),
|
||||
|
@ -393,6 +408,7 @@ pickle_store = [# Scons internal variables
|
|||
'PLUGINS',
|
||||
'ABI_VERSION',
|
||||
'MAPNIK_VERSION_STRING',
|
||||
'MAPNIK_VERSION',
|
||||
'PLATFORM',
|
||||
'BOOST_ABI',
|
||||
'BOOST_APPEND',
|
||||
|
@ -427,7 +443,7 @@ pickle_store = [# Scons internal variables
|
|||
'LIBMAPNIK_DEFINES',
|
||||
'LIBMAPNIK_CXXFLAGS',
|
||||
'CAIRO_LIBPATHS',
|
||||
'CAIRO_LINKFLAGS',
|
||||
'CAIRO_ALL_LIBS',
|
||||
'CAIRO_CPPPATHS',
|
||||
'SVG_RENDERER',
|
||||
'SQLITE_LINKFLAGS',
|
||||
|
@ -722,25 +738,23 @@ def FindBoost(context, prefixes, thread_flag):
|
|||
msg = str()
|
||||
|
||||
if BOOST_LIB_DIR:
|
||||
msg += '\n *libs found: %s' % BOOST_LIB_DIR
|
||||
msg += '\nFound boost libs: %s' % BOOST_LIB_DIR
|
||||
env['BOOST_LIBS'] = BOOST_LIB_DIR
|
||||
else:
|
||||
env['BOOST_LIBS'] = '/usr/' + env['LIBDIR_SCHEMA']
|
||||
msg += '\n *using default boost lib dir: %s' % env['BOOST_LIBS']
|
||||
msg += '\nUsing default boost lib dir: %s' % env['BOOST_LIBS']
|
||||
|
||||
if BOOST_INCLUDE_DIR:
|
||||
msg += '\n *headers found: %s' % BOOST_INCLUDE_DIR
|
||||
msg += '\nFound boost headers: %s' % BOOST_INCLUDE_DIR
|
||||
env['BOOST_INCLUDES'] = BOOST_INCLUDE_DIR
|
||||
else:
|
||||
env['BOOST_INCLUDES'] = '/usr/include'
|
||||
msg += '\n *using default boost include dir: %s' % env['BOOST_INCLUDES']
|
||||
msg += '\nUsing default boost include dir: %s' % env['BOOST_INCLUDES']
|
||||
|
||||
if not env['BOOST_TOOLKIT'] and not env['BOOST_ABI'] and not env['BOOST_VERSION']:
|
||||
if BOOST_APPEND:
|
||||
msg += '\n *lib naming extension found: %s' % BOOST_APPEND
|
||||
msg += '\nFound boost lib name extension: %s' % BOOST_APPEND
|
||||
env['BOOST_APPEND'] = BOOST_APPEND
|
||||
else:
|
||||
msg += '\n *no lib naming extension found'
|
||||
else:
|
||||
# Creating BOOST_APPEND according to the Boost library naming order,
|
||||
# which goes <toolset>-<threading>-<abi>-<version>. See:
|
||||
|
@ -755,7 +769,7 @@ def FindBoost(context, prefixes, thread_flag):
|
|||
# Boost libraries.
|
||||
if len(append_params) > 1:
|
||||
env['BOOST_APPEND'] = '-'.join(append_params)
|
||||
msg += '\n *using boost lib naming: %s' % env['BOOST_APPEND']
|
||||
msg += '\nFound boost lib name extension: %s' % env['BOOST_APPEND']
|
||||
|
||||
env.AppendUnique(CPPPATH = os.path.realpath(env['BOOST_INCLUDES']))
|
||||
env.AppendUnique(LIBPATH = os.path.realpath(env['BOOST_LIBS']))
|
||||
|
@ -792,6 +806,32 @@ int main()
|
|||
context.Result(ret)
|
||||
return ret
|
||||
|
||||
def CheckCairoHasFreetype(context, silent=False):
|
||||
if not silent:
|
||||
context.Message('Checking for cairo freetype font support ... ')
|
||||
context.env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
|
||||
|
||||
ret = context.TryRun("""
|
||||
|
||||
#include <cairo-features.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef CAIRO_HAS_FT_FONT
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
""", '.cpp')[0]
|
||||
if silent:
|
||||
context.did_show_result=1
|
||||
context.Result(ret)
|
||||
for item in env['CAIRO_CPPPATHS']:
|
||||
rm_path(item,'CPPPATH',context.env)
|
||||
return ret
|
||||
|
||||
def GetBoostLibVersion(context):
|
||||
ret = context.TryRun("""
|
||||
|
||||
|
@ -939,6 +979,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
|
|||
'CheckPKGVersion' : CheckPKGVersion,
|
||||
'FindBoost' : FindBoost,
|
||||
'CheckBoost' : CheckBoost,
|
||||
'CheckCairoHasFreetype' : CheckCairoHasFreetype,
|
||||
'GetBoostLibVersion' : GetBoostLibVersion,
|
||||
'GetMapnikLibVersion' : GetMapnikLibVersion,
|
||||
'parse_config' : parse_config,
|
||||
|
@ -1000,11 +1041,12 @@ if not preconfigured:
|
|||
env['SKIPPED_DEPS'] = []
|
||||
env['HAS_CAIRO'] = False
|
||||
env['CAIRO_LIBPATHS'] = []
|
||||
env['CAIRO_LINKFLAGS'] = []
|
||||
env['CAIRO_ALL_LIBS'] = []
|
||||
env['CAIRO_CPPPATHS'] = []
|
||||
env['HAS_PYCAIRO'] = False
|
||||
env['HAS_LIBXML2'] = False
|
||||
env['LIBMAPNIK_LIBS'] = []
|
||||
env['LIBMAPNIK_LINKFLAGS'] = []
|
||||
env['LIBMAPNIK_CPPATHS'] = []
|
||||
env['LIBMAPNIK_DEFINES'] = []
|
||||
env['LIBMAPNIK_CXXFLAGS'] = []
|
||||
|
@ -1083,7 +1125,7 @@ if not preconfigured:
|
|||
SOLARIS = env['PLATFORM'] == 'SunOS'
|
||||
env['SUNCC'] = SOLARIS and env['CXX'].startswith('CC')
|
||||
|
||||
# If the Sun Studio C++ compiler (`CC`) is used instead of GCC.
|
||||
# If the Sun Studio C++ compiler (`CC`) is used instead of gcc.
|
||||
if env['SUNCC']:
|
||||
env['CC'] = 'cc'
|
||||
# To be compatible w/Boost everything needs to be compiled
|
||||
|
@ -1130,6 +1172,8 @@ if not preconfigured:
|
|||
# https://github.com/mapnik/mapnik/issues/913
|
||||
if conf.parse_config('XML2_CONFIG',checks='--cflags'):
|
||||
env['HAS_LIBXML2'] = True
|
||||
else:
|
||||
env['MISSING_DEPS'].append('libxml2')
|
||||
|
||||
LIBSHEADERS = [
|
||||
['z', 'zlib.h', True,'C'],
|
||||
|
@ -1178,7 +1222,7 @@ if not preconfigured:
|
|||
|
||||
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
||||
if env['PRIORITIZE_LINKING']:
|
||||
conf.prioritize_paths(silent=False)
|
||||
conf.prioritize_paths(silent=True)
|
||||
|
||||
if not env['HOST']:
|
||||
for libname, headers, required, lang in LIBSHEADERS:
|
||||
|
@ -1227,7 +1271,7 @@ if not preconfigured:
|
|||
|
||||
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
||||
if env['PRIORITIZE_LINKING']:
|
||||
conf.prioritize_paths()
|
||||
conf.prioritize_paths(silent=True)
|
||||
|
||||
if not env['HOST']:
|
||||
# if the user is not setting custom boost configuration
|
||||
|
@ -1362,9 +1406,9 @@ if not preconfigured:
|
|||
#os.path.join(c_inc,'include/libpng'),
|
||||
]
|
||||
)
|
||||
env["CAIRO_LINKFLAGS"] = ['cairo']
|
||||
env["CAIRO_ALL_LIBS"] = ['cairo']
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
env["CAIRO_LINKFLAGS"].extend(
|
||||
env["CAIRO_ALL_LIBS"].extend(
|
||||
['pixman-1','expat','fontconfig','iconv']
|
||||
)
|
||||
# todo - run actual checkLib?
|
||||
|
@ -1387,7 +1431,7 @@ if not preconfigured:
|
|||
cairo_env.ParseConfig(cmd)
|
||||
for lib in cairo_env['LIBS']:
|
||||
if not lib in env['LIBS']:
|
||||
env["CAIRO_LINKFLAGS"].append(lib)
|
||||
env["CAIRO_ALL_LIBS"].append(lib)
|
||||
for lpath in cairo_env['LIBPATH']:
|
||||
if not lpath in env['LIBPATH']:
|
||||
env["CAIRO_LIBPATHS"].append(lpath)
|
||||
|
@ -1404,6 +1448,11 @@ if not preconfigured:
|
|||
else:
|
||||
color_print(4,'Not building with cairo support, pass CAIRO=True to enable')
|
||||
|
||||
if not env['HOST'] and env['HAS_CAIRO']:
|
||||
if not conf.CheckCairoHasFreetype():
|
||||
env['SKIPPED_DEPS'].append('cairo')
|
||||
env['HAS_CAIRO'] = False
|
||||
|
||||
if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']:
|
||||
if not os.access(env['PYTHON'], os.X_OK):
|
||||
color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON'])
|
||||
|
@ -1530,8 +1579,10 @@ if not preconfigured:
|
|||
color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
|
||||
abi = abi_fallback
|
||||
|
||||
env['ABI_VERSION'] = abi.replace('-pre','').split('.')
|
||||
abi_no_pre = abi.replace('-pre','').split('.')
|
||||
env['ABI_VERSION'] = abi_no_pre
|
||||
env['MAPNIK_VERSION_STRING'] = abi
|
||||
env['MAPNIK_VERSION'] = str(int(abi_no_pre[0])*100000+int(abi_no_pre[1])*100+int(abi_no_pre[2]))
|
||||
|
||||
# Common DEFINES.
|
||||
env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper())
|
||||
|
@ -1588,12 +1639,18 @@ if not preconfigured:
|
|||
env.Append(CPPDEFINES = ndebug_defines)
|
||||
|
||||
if not env['SUNCC']:
|
||||
# Common flags for GCC.
|
||||
gcc_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
|
||||
|
||||
# Common flags for CXX compiler.
|
||||
common_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
|
||||
|
||||
# https://github.com/mapnik/mapnik/issues/1835
|
||||
if sys.platform == 'darwin' and env['CXX'] == 'g++':
|
||||
common_cxx_flags += '-fpermissive '
|
||||
|
||||
if env['DEBUG']:
|
||||
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline')
|
||||
env.Append(CXXFLAGS = common_cxx_flags + '-O0 -fno-inline')
|
||||
else:
|
||||
env.Append(CXXFLAGS = gcc_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
||||
env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fvisibility-inlines-hidden -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
||||
|
||||
if env['DEBUG_UNDEFINED']:
|
||||
env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv')
|
||||
|
@ -1623,7 +1680,7 @@ if not preconfigured:
|
|||
|
||||
# if requested, sort LIBPATH and CPPPATH one last time before saving...
|
||||
if env['PRIORITIZE_LINKING']:
|
||||
conf.prioritize_paths()
|
||||
conf.prioritize_paths(silent=True)
|
||||
|
||||
# finish config stage and pickle results
|
||||
env = conf.Finish()
|
||||
|
@ -1681,15 +1738,11 @@ if not HELP_REQUESTED:
|
|||
p = env['PATH_REMOVE']
|
||||
if p in env['ENV']['PATH']:
|
||||
env['ENV']['PATH'].replace(p,'')
|
||||
def rm_path(set):
|
||||
for i in env[set]:
|
||||
if p in i:
|
||||
env[set].remove(i)
|
||||
rm_path('LIBPATH')
|
||||
rm_path('CPPPATH')
|
||||
rm_path('CXXFLAGS')
|
||||
rm_path('CAIRO_LIBPATHS')
|
||||
rm_path('CAIRO_CPPPATHS')
|
||||
rm_path(p,'LIBPATH',env)
|
||||
rm_path(p,'CPPPATH',env)
|
||||
rm_path(p,'CXXFLAGS',env)
|
||||
rm_path(p,'CAIRO_LIBPATHS',env)
|
||||
rm_path(p,'CAIRO_CPPPATHS',env)
|
||||
|
||||
if env['PATH_REPLACE']:
|
||||
searches,replace = env['PATH_REPLACE'].split(':')
|
||||
|
@ -1712,11 +1765,8 @@ if not HELP_REQUESTED:
|
|||
Export('env')
|
||||
|
||||
plugin_base = env.Clone()
|
||||
# for this to work you need:
|
||||
# if __GNUC__ >= 4
|
||||
# define MAPNIK_EXP __attribute__ ((visibility ("default")))
|
||||
#plugin_base.Append(CXXFLAGS='-fvisibility=hidden')
|
||||
#plugin_base.Append(CXXFLAGS='-fvisibility-inlines-hidden')
|
||||
if not env['DEBUG']:
|
||||
plugin_base.Append(CXXFLAGS='-fvisibility=hidden')
|
||||
|
||||
Export('plugin_base')
|
||||
|
||||
|
@ -1749,7 +1799,8 @@ if not HELP_REQUESTED:
|
|||
for plugin in env['REQUESTED_PLUGINS']:
|
||||
details = env['PLUGINS'][plugin]
|
||||
if details['lib'] in env['LIBS']:
|
||||
SConscript('plugins/input/%s/build.py' % plugin)
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
SConscript('plugins/input/%s/build.py' % plugin)
|
||||
if plugin == 'ogr': OGR_BUILT = True
|
||||
if plugin == 'gdal': GDAL_BUILT = True
|
||||
if plugin == 'ogr' or plugin == 'gdal':
|
||||
|
@ -1758,8 +1809,9 @@ if not HELP_REQUESTED:
|
|||
else:
|
||||
env['LIBS'].remove(details['lib'])
|
||||
elif not details['lib']:
|
||||
# build internal shape and raster plugins
|
||||
SConscript('plugins/input/%s/build.py' % plugin)
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
# build internal datasource input plugins
|
||||
SConscript('plugins/input/%s/build.py' % plugin)
|
||||
else:
|
||||
color_print(1,"Notice: dependencies not met for plugin '%s', not building..." % plugin)
|
||||
# also clear out locally built target
|
||||
|
@ -1773,11 +1825,11 @@ if not HELP_REQUESTED:
|
|||
# installed plugins that we are no longer building
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
for plugin in PLUGINS.keys():
|
||||
if plugin not in env['REQUESTED_PLUGINS']:
|
||||
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin)
|
||||
if os.path.exists(plugin_path):
|
||||
plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin)
|
||||
if os.path.exists(plugin_path):
|
||||
if plugin not in env['REQUESTED_PLUGINS'] or env['PLUGIN_LINKING'] == 'static':
|
||||
color_print(3,"Notice: removing out of date plugin: '%s'" % plugin_path)
|
||||
os.unlink(plugin_path)
|
||||
os.unlink(plugin_path)
|
||||
|
||||
# Build the c++ rundemo app if requested
|
||||
if env['DEMO']:
|
||||
|
@ -1821,7 +1873,8 @@ if not HELP_REQUESTED:
|
|||
if env['SVG_RENDERER']:
|
||||
SConscript('tests/cpp_tests/svg_renderer_tests/build.py')
|
||||
|
||||
SConscript('benchmark/build.py')
|
||||
if env['BENCHMARK']:
|
||||
SConscript('benchmark/build.py')
|
||||
|
||||
# install pkg-config script and mapnik-config script
|
||||
SConscript('utils/mapnik-config/build.py')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -43,19 +43,22 @@ prefix = env['PREFIX']
|
|||
target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik')
|
||||
target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2')
|
||||
|
||||
libraries = ['mapnik',env['BOOST_PYTHON_LIB']]
|
||||
py_env = env.Clone()
|
||||
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
|
||||
|
||||
py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']]
|
||||
|
||||
# TODO - do solaris/fedora need direct linking too?
|
||||
if env['PLATFORM'] == 'Darwin':
|
||||
if not env['PYTHON_DYNAMIC_LOOKUP']:
|
||||
if env['PNG']:
|
||||
libraries.append('png')
|
||||
py_env.AppendUnique(LIBS = 'png')
|
||||
if env['JPEG']:
|
||||
libraries.append('jpeg')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
|
||||
py_env.AppendUnique(LIBS = 'jpeg')
|
||||
py_env.AppendUnique(LIBS = env['ICU_LIB_NAME'])
|
||||
py_env.AppendUnique(LIBS = 'boost_regex%s' % env['BOOST_APPEND'])
|
||||
if env['THREADING'] == 'multi':
|
||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
##### Python linking on OS X is tricky ###
|
||||
# Confounding problems are:
|
||||
|
@ -115,6 +118,9 @@ if env['CUSTOM_LDFLAGS']:
|
|||
else:
|
||||
linkflags = python_link_flag
|
||||
|
||||
if env['LINKING'] == 'static':
|
||||
py_env.AppendUnique(LIBS=env['LIBMAPNIK_LIBS'])
|
||||
|
||||
paths = '''
|
||||
"""Configuration paths of Mapnik fonts and input plugins (auto-generated by SCons)."""
|
||||
|
||||
|
@ -147,9 +153,6 @@ except: pass
|
|||
# install the shared object beside the module directory
|
||||
sources = glob.glob('*.cpp')
|
||||
|
||||
py_env = env.Clone()
|
||||
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
|
||||
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
# install the core mapnik python files, including '__init__.py'
|
||||
init_files = glob.glob('mapnik/*.py')
|
||||
|
@ -177,14 +180,14 @@ if 'uninstall' not in COMMAND_LINE_TARGETS:
|
|||
py_env.Append(CPPPATH = env['CAIRO_CPPPATHS'])
|
||||
py_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
if env['PLATFORM'] == 'Darwin':
|
||||
py_env.Append(LIBS=env['CAIRO_LINKFLAGS'])
|
||||
py_env.Append(LIBS=env['CAIRO_ALL_LIBS'])
|
||||
|
||||
if env['HAS_PYCAIRO']:
|
||||
py_env.ParseConfig('pkg-config --cflags pycairo')
|
||||
py_env.Append(CPPDEFINES = '-DHAVE_PYCAIRO')
|
||||
|
||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
|
||||
py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND'])
|
||||
_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
|
||||
|
||||
Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
|
|
|
@ -558,44 +558,6 @@ def Osm(**keywords):
|
|||
keywords['type'] = 'osm'
|
||||
return CreateDatasource(keywords)
|
||||
|
||||
def Kismet(**keywords):
|
||||
"""Create a Kismet Datasource.
|
||||
|
||||
Required keyword arguments:
|
||||
host -- kismet hostname
|
||||
port -- kismet port
|
||||
|
||||
Optional keyword arguments:
|
||||
encoding -- file encoding (default 'utf-8')
|
||||
extent -- manually specified data extent (comma delimited string, default None)
|
||||
|
||||
>>> from mapnik import Kismet, Layer
|
||||
>>> datasource = Kismet(host='localhost',port=2501,extent='-179,-85,179,85')
|
||||
>>> lyr = Layer('Kismet Server Layer')
|
||||
>>> lyr.datasource = datasource
|
||||
|
||||
"""
|
||||
keywords['type'] = 'kismet'
|
||||
return CreateDatasource(keywords)
|
||||
|
||||
def Geos(**keywords):
|
||||
"""Create a GEOS Vector Datasource.
|
||||
|
||||
Required keyword arguments:
|
||||
wkt -- inline WKT text of the geometry
|
||||
|
||||
Optional keyword arguments:
|
||||
extent -- manually specified data extent (comma delimited string, default None)
|
||||
|
||||
>>> from mapnik import Geos, Layer
|
||||
>>> datasource = Geos(wkt='MULTIPOINT(100 100, 50 50, 0 0)')
|
||||
>>> lyr = Layer('GEOS Layer from WKT string')
|
||||
>>> lyr.datasource = datasource
|
||||
|
||||
"""
|
||||
keywords['type'] = 'geos'
|
||||
return CreateDatasource(keywords)
|
||||
|
||||
def Python(**keywords):
|
||||
"""Create a Python Datasource.
|
||||
|
||||
|
|
|
@ -48,14 +48,26 @@ namespace
|
|||
{
|
||||
//user-friendly wrapper that uses Python dictionary
|
||||
using namespace boost::python;
|
||||
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
|
||||
boost::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
|
||||
{
|
||||
mapnik::parameters params;
|
||||
boost::python::list keys=d.keys();
|
||||
for (int i=0; i<len(keys); ++i)
|
||||
for (int i=0; i < len(keys); ++i)
|
||||
{
|
||||
std::string key = extract<std::string>(keys[i]);
|
||||
object obj = d[key];
|
||||
if (PyUnicode_Check(obj.ptr()))
|
||||
{
|
||||
PyObject* temp = PyUnicode_AsUTF8String(obj.ptr());
|
||||
if (temp)
|
||||
{
|
||||
char* c_str = PyString_AsString(temp);
|
||||
params[key] = std::string(c_str);
|
||||
Py_DecRef(temp);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
extract<std::string> ex0(obj);
|
||||
extract<mapnik::value_integer> ex1(obj);
|
||||
extract<double> ex2(obj);
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <mapnik/parse_path.hpp>
|
||||
#include <mapnik/value.hpp>
|
||||
|
||||
|
||||
using mapnik::Feature;
|
||||
using mapnik::expression_ptr;
|
||||
using mapnik::parse_expression;
|
||||
using mapnik::to_expression_string;
|
||||
|
@ -53,15 +51,15 @@ std::string expression_to_string_(mapnik::expr_node const& expr)
|
|||
return mapnik::to_expression_string(expr);
|
||||
}
|
||||
|
||||
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::Feature const& f)
|
||||
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::feature_impl const& f)
|
||||
{
|
||||
// will be auto-converted to proper python type by `mapnik_value_to_python`
|
||||
return boost::apply_visitor(mapnik::evaluate<mapnik::Feature,mapnik::value>(f),expr);
|
||||
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value>(f),expr);
|
||||
}
|
||||
|
||||
bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::Feature const& f)
|
||||
bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::feature_impl const& f)
|
||||
{
|
||||
return boost::apply_visitor(mapnik::evaluate<mapnik::Feature,mapnik::value>(f),expr).to_bool();
|
||||
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value>(f),expr).to_bool();
|
||||
}
|
||||
|
||||
// path expression
|
||||
|
@ -75,7 +73,7 @@ std::string path_to_string_(mapnik::path_expression const& expr)
|
|||
return mapnik::path_processor_type::to_string(expr);
|
||||
}
|
||||
|
||||
std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::Feature const& f)
|
||||
std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::feature_impl const& f)
|
||||
{
|
||||
return mapnik::path_processor_type::evaluate(expr, f);
|
||||
}
|
||||
|
|
|
@ -41,28 +41,27 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using mapnik::Feature;
|
||||
using mapnik::geometry_utils;
|
||||
using mapnik::from_wkt;
|
||||
using mapnik::context_type;
|
||||
using mapnik::context_ptr;
|
||||
using mapnik::feature_kv_iterator;
|
||||
|
||||
mapnik::geometry_type const& (mapnik::Feature::*get_geometry_by_const_ref)(unsigned) const = &mapnik::Feature::get_geometry;
|
||||
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::Feature::*get_paths_by_const_ref)() const = &mapnik::Feature::paths;
|
||||
mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(unsigned) const = &mapnik::feature_impl::get_geometry;
|
||||
boost::ptr_vector<mapnik::geometry_type> const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths;
|
||||
|
||||
void feature_add_geometries_from_wkb(Feature &feature, std::string wkb)
|
||||
void feature_add_geometries_from_wkb(mapnik::feature_impl &feature, std::string wkb)
|
||||
{
|
||||
geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size());
|
||||
}
|
||||
|
||||
void feature_add_geometries_from_wkt(Feature &feature, std::string wkt)
|
||||
void feature_add_geometries_from_wkt(mapnik::feature_impl &feature, std::string wkt)
|
||||
{
|
||||
bool result = mapnik::from_wkt(wkt, feature.paths());
|
||||
if (!result) throw std::runtime_error("Failed to parse WKT");
|
||||
}
|
||||
|
||||
std::string feature_to_geojson(Feature const& feature)
|
||||
std::string feature_to_geojson(mapnik::feature_impl const& feature)
|
||||
{
|
||||
std::string json;
|
||||
mapnik::json::feature_generator g;
|
||||
|
@ -73,22 +72,22 @@ std::string feature_to_geojson(Feature const& feature)
|
|||
return json;
|
||||
}
|
||||
|
||||
mapnik::value __getitem__(Feature const& feature, std::string const& name)
|
||||
mapnik::value __getitem__(mapnik::feature_impl const& feature, std::string const& name)
|
||||
{
|
||||
return feature.get(name);
|
||||
}
|
||||
|
||||
mapnik::value __getitem2__(Feature const& feature, std::size_t index)
|
||||
mapnik::value __getitem2__(mapnik::feature_impl const& feature, std::size_t index)
|
||||
{
|
||||
return feature.get(index);
|
||||
}
|
||||
|
||||
void __setitem__(Feature & feature, std::string const& name, mapnik::value const& val)
|
||||
void __setitem__(mapnik::feature_impl & feature, std::string const& name, mapnik::value const& val)
|
||||
{
|
||||
feature.put_new(name,val);
|
||||
}
|
||||
|
||||
boost::python::dict attributes(Feature const& f)
|
||||
boost::python::dict attributes(mapnik::feature_impl const& f)
|
||||
{
|
||||
boost::python::dict attributes;
|
||||
feature_kv_iterator itr = f.begin();
|
||||
|
@ -191,7 +190,6 @@ struct value_null_from_python
|
|||
void export_feature()
|
||||
{
|
||||
using namespace boost::python;
|
||||
using mapnik::Feature;
|
||||
|
||||
// Python to mapnik::value converters
|
||||
// NOTE: order matters here. For example value_null must be listed before
|
||||
|
@ -211,25 +209,25 @@ void export_feature()
|
|||
.def("push", &context_type::push)
|
||||
;
|
||||
|
||||
class_<Feature,boost::shared_ptr<Feature>,
|
||||
class_<mapnik::feature_impl,boost::shared_ptr<mapnik::feature_impl>,
|
||||
boost::noncopyable>("Feature",init<context_ptr,mapnik::value_integer>("Default ctor."))
|
||||
.def("id",&Feature::id)
|
||||
.def("__str__",&Feature::to_string)
|
||||
.def("id",&mapnik::feature_impl::id)
|
||||
.def("__str__",&mapnik::feature_impl::to_string)
|
||||
.def("add_geometries_from_wkb", &feature_add_geometries_from_wkb)
|
||||
.def("add_geometries_from_wkt", &feature_add_geometries_from_wkt)
|
||||
.def("add_geometry", &Feature::add_geometry)
|
||||
.def("num_geometries",&Feature::num_geometries)
|
||||
.def("add_geometry", &mapnik::feature_impl::add_geometry)
|
||||
.def("num_geometries",&mapnik::feature_impl::num_geometries)
|
||||
.def("get_geometry", make_function(get_geometry_by_const_ref,return_value_policy<reference_existing_object>()))
|
||||
.def("geometries",make_function(get_paths_by_const_ref,return_value_policy<reference_existing_object>()))
|
||||
.def("envelope", &Feature::envelope)
|
||||
.def("has_key", &Feature::has_key)
|
||||
.def("envelope", &mapnik::feature_impl::envelope)
|
||||
.def("has_key", &mapnik::feature_impl::has_key)
|
||||
.add_property("attributes",&attributes)
|
||||
.def("__setitem__",&__setitem__)
|
||||
.def("__contains__",&__getitem__)
|
||||
.def("__getitem__",&__getitem__)
|
||||
.def("__getitem__",&__getitem2__)
|
||||
.def("__len__", &Feature::size)
|
||||
.def("context",&Feature::context)
|
||||
.def("__len__", &mapnik::feature_impl::size)
|
||||
.def("context",&mapnik::feature_impl::context)
|
||||
.def("to_geojson",&feature_to_geojson)
|
||||
;
|
||||
}
|
||||
|
|
|
@ -65,10 +65,7 @@ inline mapnik::feature_ptr next(mapnik::featureset_ptr const& itr)
|
|||
void export_featureset()
|
||||
{
|
||||
using namespace boost::python;
|
||||
using mapnik::Feature;
|
||||
using mapnik::Featureset;
|
||||
|
||||
class_<Featureset,boost::shared_ptr<Featureset>,
|
||||
class_<mapnik::Featureset,boost::shared_ptr<mapnik::Featureset>,
|
||||
boost::noncopyable>("Featureset",no_init)
|
||||
.def("__iter__",pass_through)
|
||||
.def("next",next)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <mapnik/parse_path.hpp>
|
||||
#include "mapnik_svg.hpp"
|
||||
#include "mapnik_enumeration.hpp"
|
||||
#include "python_optional.hpp"
|
||||
|
||||
#include <mapnik/marker_cache.hpp> // for known_svg_prefix_
|
||||
|
||||
using mapnik::markers_symbolizer;
|
||||
|
@ -70,16 +72,6 @@ void set_marker_type(mapnik::markers_symbolizer & symbolizer, std::string const&
|
|||
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/mapnik/mapnik/issues/1367
|
||||
PyObject* get_fill_opacity_impl(markers_symbolizer & sym)
|
||||
{
|
||||
boost::optional<float> fill_opacity = sym.get_fill_opacity();
|
||||
if (fill_opacity)
|
||||
return ::PyFloat_FromDouble(*fill_opacity);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
void export_markers_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -119,7 +111,7 @@ void export_markers_symbolizer()
|
|||
&markers_symbolizer::set_opacity,
|
||||
"Set/get the overall opacity")
|
||||
.add_property("fill_opacity",
|
||||
&get_fill_opacity_impl,
|
||||
&markers_symbolizer::get_fill_opacity,
|
||||
&markers_symbolizer::set_fill_opacity,
|
||||
"Set/get the fill opacity")
|
||||
.add_property("ignore_placement",
|
||||
|
|
|
@ -63,6 +63,7 @@ void export_polygon_pattern_symbolizer();
|
|||
void export_raster_symbolizer();
|
||||
void export_text_placement();
|
||||
void export_shield_symbolizer();
|
||||
void export_debug_symbolizer();
|
||||
void export_font_engine();
|
||||
void export_marker_cache();
|
||||
void export_projection();
|
||||
|
@ -86,7 +87,6 @@ void export_logger();
|
|||
#include <mapnik/rule.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/scale_denominator.hpp>
|
||||
#include <mapnik/value_error.hpp>
|
||||
#include <mapnik/save_map.hpp>
|
||||
|
@ -335,11 +335,6 @@ double scale_denominator(mapnik::Map const &map, bool geographic)
|
|||
}
|
||||
|
||||
// http://docs.python.org/c-api/exceptions.html#standard-exceptions
|
||||
void config_error_translator(mapnik::config_error const & ex)
|
||||
{
|
||||
PyErr_SetString(PyExc_RuntimeError, ex.what());
|
||||
}
|
||||
|
||||
void value_error_translator(mapnik::value_error const & ex)
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError, ex.what());
|
||||
|
@ -435,7 +430,6 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
|
||||
register_exception_translator<std::exception>(&standard_error_translator);
|
||||
register_exception_translator<std::out_of_range>(&out_of_range_error_translator);
|
||||
register_exception_translator<mapnik::config_error>(&config_error_translator);
|
||||
register_exception_translator<mapnik::value_error>(&value_error_translator);
|
||||
register_exception_translator<std::runtime_error>(&runtime_error_translator);
|
||||
register_cairo();
|
||||
|
@ -473,6 +467,7 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
export_raster_symbolizer();
|
||||
export_text_placement();
|
||||
export_shield_symbolizer();
|
||||
export_debug_symbolizer();
|
||||
export_font_engine();
|
||||
export_marker_cache();
|
||||
export_projection();
|
||||
|
|
|
@ -28,18 +28,7 @@
|
|||
#include <mapnik/raster_colorizer.hpp>
|
||||
#include <mapnik/image_scaling.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
// https://github.com/mapnik/mapnik/issues/1367
|
||||
PyObject* get_premultiplied_impl(mapnik::raster_symbolizer & sym)
|
||||
{
|
||||
boost::optional<bool> premultiplied = sym.premultiplied();
|
||||
if (premultiplied)
|
||||
return ::PyBool_FromLong(*premultiplied);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
using mapnik::raster_symbolizer;
|
||||
|
||||
void export_raster_symbolizer()
|
||||
|
@ -132,7 +121,7 @@ void export_raster_symbolizer()
|
|||
">>> r.mesh_size = 32\n"
|
||||
)
|
||||
.add_property("premultiplied",
|
||||
&get_premultiplied_impl,
|
||||
&raster_symbolizer::premultiplied,
|
||||
&raster_symbolizer::set_premultiplied,
|
||||
"Get/Set premultiplied status of the source image.\n"
|
||||
"Can be used to override what the source data reports (when in error)\n"
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
using mapnik::rule;
|
||||
using mapnik::expr_node;
|
||||
using mapnik::expression_ptr;
|
||||
using mapnik::Feature;
|
||||
using mapnik::point_symbolizer;
|
||||
using mapnik::line_symbolizer;
|
||||
using mapnik::line_pattern_symbolizer;
|
||||
|
|
|
@ -84,7 +84,7 @@ struct NodeWrap: formatting::node, wrapper<formatting::node>
|
|||
|
||||
}
|
||||
|
||||
void apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
python_block_auto_unblock b;
|
||||
this->get_override("apply")(ptr(&p), ptr(&feature), ptr(&output));
|
||||
|
@ -122,7 +122,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
|
|||
|
||||
}
|
||||
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
if(override o = this->get_override("apply"))
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
|
|||
}
|
||||
}
|
||||
|
||||
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
formatting::text_node::apply(p, feature, output);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ struct TextNodeWrap: formatting::text_node, wrapper<formatting::text_node>
|
|||
|
||||
struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
|
||||
{
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
if(override o = this->get_override("apply"))
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
|
|||
}
|
||||
}
|
||||
|
||||
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
formatting::format_node::apply(p, feature, output);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ struct FormatNodeWrap: formatting::format_node, wrapper<formatting::format_node>
|
|||
|
||||
struct ExprFormatWrap: formatting::expression_format, wrapper<formatting::expression_format>
|
||||
{
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
if(override o = this->get_override("apply"))
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ struct ExprFormatWrap: formatting::expression_format, wrapper<formatting::expres
|
|||
}
|
||||
}
|
||||
|
||||
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
formatting::expression_format::apply(p, feature, output);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
|
|||
http://wiki.python.org/moin/boost.python/HowTo#A.22Raw.22_function */
|
||||
|
||||
|
||||
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
if(override o = this->get_override("apply"))
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ struct ListNodeWrap: formatting::list_node, wrapper<formatting::list_node>
|
|||
}
|
||||
}
|
||||
|
||||
void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const
|
||||
void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
|
||||
{
|
||||
formatting::list_node::apply(p, feature, output);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
|
||||
// boost::optional<T> to/from converter from John Wiegley
|
||||
|
||||
|
@ -46,7 +47,7 @@ struct register_python_conversion
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct python_optional : public boost::noncopyable
|
||||
struct python_optional : public mapnik::noncopyable
|
||||
{
|
||||
struct optional_to_python
|
||||
{
|
||||
|
@ -74,7 +75,7 @@ struct python_optional : public boost::noncopyable
|
|||
rvalue_from_python_stage1(source, converters);
|
||||
return rvalue_from_python_stage2(source, data, converters);
|
||||
}
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void construct(PyObject * source,
|
||||
|
@ -94,17 +95,116 @@ struct python_optional : public boost::noncopyable
|
|||
}
|
||||
};
|
||||
|
||||
explicit python_optional() {
|
||||
explicit python_optional()
|
||||
{
|
||||
register_python_conversion<boost::optional<T>,
|
||||
optional_to_python, optional_from_python>();
|
||||
}
|
||||
};
|
||||
|
||||
/** This class works around a bug in boost python.
|
||||
// to/from boost::optional<bool>
|
||||
template <>
|
||||
struct python_optional<float> : public mapnik::noncopyable
|
||||
{
|
||||
struct optional_to_python
|
||||
{
|
||||
static PyObject * convert(const boost::optional<float>& value)
|
||||
{
|
||||
return (value ? PyFloat_FromDouble(*value) :
|
||||
boost::python::detail::none());
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
struct optional_from_python
|
||||
{
|
||||
static void * convertible(PyObject * source)
|
||||
{
|
||||
using namespace boost::python::converter;
|
||||
|
||||
if (source == Py_None || PyFloat_Check(source))
|
||||
return source;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void construct(PyObject * source,
|
||||
boost::python::converter::rvalue_from_python_stage1_data * data)
|
||||
{
|
||||
using namespace boost::python::converter;
|
||||
void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
|
||||
data)->storage.bytes;
|
||||
if (source == Py_None) // == None
|
||||
new (storage) boost::optional<float>(); // A Boost uninitialized value
|
||||
else
|
||||
new (storage) boost::optional<float>(PyFloat_AsDouble(source));
|
||||
data->convertible = storage;
|
||||
}
|
||||
};
|
||||
|
||||
explicit python_optional()
|
||||
{
|
||||
register_python_conversion<boost::optional<float>,
|
||||
optional_to_python, optional_from_python>();
|
||||
}
|
||||
};
|
||||
|
||||
// to/from boost::optional<float>
|
||||
template <>
|
||||
struct python_optional<bool> : public mapnik::noncopyable
|
||||
{
|
||||
struct optional_to_python
|
||||
{
|
||||
static PyObject * convert(const boost::optional<bool>& value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
if (*value) Py_RETURN_TRUE;
|
||||
else Py_RETURN_FALSE;
|
||||
}
|
||||
else return boost::python::detail::none();
|
||||
}
|
||||
};
|
||||
struct optional_from_python
|
||||
{
|
||||
static void * convertible(PyObject * source)
|
||||
{
|
||||
using namespace boost::python::converter;
|
||||
|
||||
if (source == Py_None || PyBool_Check(source))
|
||||
return source;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void construct(PyObject * source,
|
||||
boost::python::converter::rvalue_from_python_stage1_data * data)
|
||||
{
|
||||
using namespace boost::python::converter;
|
||||
void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
|
||||
data)->storage.bytes;
|
||||
if (source == Py_None) // == None
|
||||
new (storage) boost::optional<bool>(); // A Boost uninitialized value
|
||||
else
|
||||
{
|
||||
new (storage) boost::optional<bool>(source == Py_True ? true : false);
|
||||
}
|
||||
data->convertible = storage;
|
||||
}
|
||||
};
|
||||
|
||||
explicit python_optional()
|
||||
{
|
||||
register_python_conversion<boost::optional<bool>,
|
||||
optional_to_python, optional_from_python>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// This class works around a feature 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>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <mapnik/expression.hpp>
|
||||
#include <mapnik/color_factory.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
|
||||
#if defined(HAVE_CAIRO)
|
||||
#include <mapnik/cairo_renderer.hpp>
|
||||
|
@ -313,11 +312,6 @@ int main ( int argc , char** argv)
|
|||
#endif
|
||||
|
||||
}
|
||||
catch ( const mapnik::config_error & ex )
|
||||
{
|
||||
std::cerr << "### Configuration error: " << ex.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
catch ( const std::exception & ex )
|
||||
{
|
||||
std::cerr << "### std::exception: " << ex.what() << std::endl;
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<GMLFeatureClassList>
|
||||
<GMLFeatureClass>
|
||||
<Name>charplacement</Name>
|
||||
<ElementPath>charplacement</ElementPath>
|
||||
<DatasetSpecificInfo>
|
||||
<FeatureCount>1</FeatureCount>
|
||||
<ExtentXMin>1.00000</ExtentXMin>
|
||||
<ExtentXMax>2.00000</ExtentXMax>
|
||||
<ExtentYMin>1.00000</ExtentYMin>
|
||||
<ExtentYMax>5.00000</ExtentYMax>
|
||||
</DatasetSpecificInfo>
|
||||
<PropertyDefn>
|
||||
<Name>NAME</Name>
|
||||
<ElementPath>NAME</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
<PropertyDefn>
|
||||
<Name>CLASS</Name>
|
||||
<ElementPath>CLASS</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
</GMLFeatureClass>
|
||||
</GMLFeatureClassList>
|
|
@ -1,99 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ogr:FeatureCollection
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="charplacement.xsd"
|
||||
xmlns:ogr="http://ogr.maptools.org/"
|
||||
xmlns:gml="http://www.opengis.net/gml">
|
||||
<gml:boundedBy>
|
||||
<gml:Box>
|
||||
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
|
||||
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember>
|
||||
|
||||
<ogr:charplacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 1,-3 2,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>TRIANGLE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F1">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-3 3,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>TRIANGLE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F7">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-12 13,-12
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F8">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-13 2,-13 5,-13 10,-13 13,-13
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F9">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-3 5,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F10">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 8,-3 8,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F11">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-6 5,-8 6,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F12">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-8 7,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F13">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
<ogr:charplacement fid="F14">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F15">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339
|
||||
11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F16">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>SQUIGGLE</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
<ogr:charplacement fid="F16">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-9 1.4,-10 1.8,-9 2.2,-10 2.6,-9 3.0,-10 3.4,-9 3.8,-10 4.2,-9 4.6,-10
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long ZigZag Road Name</ogr:NAME>
|
||||
<ogr:CLASS>ZIGZAG</ogr:CLASS>
|
||||
</ogr:charplacement>
|
||||
|
||||
</gml:featureMember>
|
||||
</ogr:FeatureCollection>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
|
||||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
|
||||
<xs:complexType name="FeatureCollectionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureCollectionType">
|
||||
<xs:attribute name="lockId" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="scope" type="xs:string" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="charplacement" type="ogr:charplacement_Type" substitutionGroup="gml:_Feature"/>
|
||||
<xs:complexType name="charplacement_Type">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureType">
|
||||
<xs:sequence>
|
||||
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
|
@ -1,25 +0,0 @@
|
|||
<GMLFeatureClassList>
|
||||
<GMLFeatureClass>
|
||||
<Name>displacement</Name>
|
||||
<ElementPath>displacement</ElementPath>
|
||||
<DatasetSpecificInfo>
|
||||
<FeatureCount>1</FeatureCount>
|
||||
<ExtentXMin>1.00000</ExtentXMin>
|
||||
<ExtentXMax>2.00000</ExtentXMax>
|
||||
<ExtentYMin>1.00000</ExtentYMin>
|
||||
<ExtentYMax>5.00000</ExtentYMax>
|
||||
</DatasetSpecificInfo>
|
||||
<PropertyDefn>
|
||||
<Name>NAME</Name>
|
||||
<ElementPath>NAME</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
<PropertyDefn>
|
||||
<Name>CLASS</Name>
|
||||
<ElementPath>CLASS</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
</GMLFeatureClass>
|
||||
</GMLFeatureClassList>
|
|
@ -1,173 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ogr:FeatureCollection
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="displacement.xsd"
|
||||
xmlns:ogr="http://ogr.maptools.org/"
|
||||
xmlns:gml="http://www.opengis.net/gml">
|
||||
<gml:boundedBy>
|
||||
<gml:Box>
|
||||
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
|
||||
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-3 1,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-2 2,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 3,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-2 4,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-3 3,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-4 2,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-4 1,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>CLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-3 6,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-4 7,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-4 8,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-3 8,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-2 7,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 6,-1</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-2</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-2 5,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road</ogr:NAME>
|
||||
<ogr:CLASS>ANTICLOCKWISE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-6.5 2,-5.5 3,-5 4,-5 5,-5.5 6,-6.5
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-7 2,-8 3,-8.5 4,-8.5 5,-8 6,-7
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
3,-8.5 2,-9.5 1.5,-10.5 1.5,-11.5 2,-12.5 3,-13.5
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
|
||||
<ogr:CLASS>VERTCURVE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
4,-8.5 5,-9.5 5.5,-10.5 5.5,-11.5 5,-12.5 4,-13.5
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name To Go Around The Whole Curve!</ogr:NAME>
|
||||
<ogr:CLASS>VERTCURVE</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9.2,-4 9,-3 10,-3 10.2,-4
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>PARALLELOGRAM</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9,-2 9.2,-1 10.2,-1 10,-2
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>PARALLELOGRAM</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
11,-1 11,-2 12,-2
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CORNER</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
11,-4 12,-4 12,-3
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CORNER</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
12.5,-1 13.5,-1 13.5,-2
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CORNER</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
<ogr:displacement fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
12.5,-4 12.5,-3 13.5,-3
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CORNER</ogr:CLASS>
|
||||
</ogr:displacement>
|
||||
|
||||
</gml:featureMember>
|
||||
</ogr:FeatureCollection>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
|
||||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
|
||||
<xs:complexType name="FeatureCollectionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureCollectionType">
|
||||
<xs:attribute name="lockId" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="scope" type="xs:string" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="displacement" type="ogr:displacement_Type" substitutionGroup="gml:_Feature"/>
|
||||
<xs:complexType name="displacement_Type">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureType">
|
||||
<xs:sequence>
|
||||
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
|
@ -1,25 +0,0 @@
|
|||
<GMLFeatureClassList>
|
||||
<GMLFeatureClass>
|
||||
<Name>overlap</Name>
|
||||
<ElementPath>overlap</ElementPath>
|
||||
<DatasetSpecificInfo>
|
||||
<FeatureCount>1</FeatureCount>
|
||||
<ExtentXMin>1.00000</ExtentXMin>
|
||||
<ExtentXMax>2.00000</ExtentXMax>
|
||||
<ExtentYMin>1.00000</ExtentYMin>
|
||||
<ExtentYMax>5.00000</ExtentYMax>
|
||||
</DatasetSpecificInfo>
|
||||
<PropertyDefn>
|
||||
<Name>NAME</Name>
|
||||
<ElementPath>NAME</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
<PropertyDefn>
|
||||
<Name>CLASS</Name>
|
||||
<ElementPath>CLASS</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
</GMLFeatureClass>
|
||||
</GMLFeatureClassList>
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ogr:FeatureCollection
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="overlap.xsd"
|
||||
xmlns:ogr="http://ogr.maptools.org/"
|
||||
xmlns:gml="http://www.opengis.net/gml">
|
||||
<gml:boundedBy>
|
||||
<gml:Box>
|
||||
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
|
||||
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-1 1,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-3 7,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-3 7,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-2 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-7 1,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-2 5,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-3 12,-3</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CROSS</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>10,-1 10,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CROSS</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
10,-9 13,-9 13,-11 11,-11 11,-8
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>SELFOVERLAP</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>4,-9 4,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK2</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-9 8,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK2</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 9,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK2</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-9 2,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK2</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-9 6,-13</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>NETWORK2</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8.8,-6 8.8,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDOVER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-7 10,-7 10,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDUNDER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-6 12.2,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDOVER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>11,-6 11,-7 13,-7 13,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDUNDER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>12.2,-3.5 12.2,-5.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDOVER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
<ogr:overlap fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>11,-4.5 13,-4.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Long Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BENDUNDER</ogr:CLASS>
|
||||
</ogr:overlap>
|
||||
|
||||
|
||||
</gml:featureMember>
|
||||
</ogr:FeatureCollection>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
|
||||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
|
||||
<xs:complexType name="FeatureCollectionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureCollectionType">
|
||||
<xs:attribute name="lockId" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="scope" type="xs:string" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="overlap" type="ogr:overlap_Type" substitutionGroup="gml:_Feature"/>
|
||||
<xs:complexType name="overlap_Type">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureType">
|
||||
<xs:sequence>
|
||||
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
|
@ -1,25 +0,0 @@
|
|||
<GMLFeatureClassList>
|
||||
<GMLFeatureClass>
|
||||
<Name>textspacing</Name>
|
||||
<ElementPath>textspacing</ElementPath>
|
||||
<DatasetSpecificInfo>
|
||||
<FeatureCount>1</FeatureCount>
|
||||
<ExtentXMin>1.00000</ExtentXMin>
|
||||
<ExtentXMax>2.00000</ExtentXMax>
|
||||
<ExtentYMin>1.00000</ExtentYMin>
|
||||
<ExtentYMax>5.00000</ExtentYMax>
|
||||
</DatasetSpecificInfo>
|
||||
<PropertyDefn>
|
||||
<Name>NAME</Name>
|
||||
<ElementPath>NAME</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
<PropertyDefn>
|
||||
<Name>CLASS</Name>
|
||||
<ElementPath>CLASS</ElementPath>
|
||||
<Type>String</Type>
|
||||
<Width>0</Width>
|
||||
</PropertyDefn>
|
||||
</GMLFeatureClass>
|
||||
</GMLFeatureClassList>
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ogr:FeatureCollection
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="textspacing.xsd"
|
||||
xmlns:ogr="http://ogr.maptools.org/"
|
||||
xmlns:gml="http://www.opengis.net/gml">
|
||||
<gml:boundedBy>
|
||||
<gml:Box>
|
||||
<gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
|
||||
<gml:coord><gml:X>13</gml:X><gml:Y>-13</gml:Y></gml:coord>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember>
|
||||
|
||||
<ogr:textspacing fid="F0">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>2,-1 1,-3 2,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>TRIANGLE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F1">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>3,-1 4,-3 3,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>TRIANGLE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F2">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-7 2,-7</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F3">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-8 3,-8</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F4">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-9 4,-9</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F5">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-10 5,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F6">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>1,-11 7,-11</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F7">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-12 13,-12
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F8">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
1,-13 2,-13 5,-13 10,-13 13,-13
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>STRAIGHT</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F9">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>6,-1 5,-3 5,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F10">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>7,-1 8,-3 8,-5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F11">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>5,-6 5,-8 6,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F12">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>8,-6 8,-8 7,-10</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>BEND</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F13">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
<ogr:textspacing fid="F14">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F15">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339
|
||||
11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>CURVE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
<ogr:textspacing fid="F16">
|
||||
<ogr:geometryProperty><gml:LineString><gml:coordinates>
|
||||
9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966
|
||||
</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||
<ogr:NAME>Road Name</ogr:NAME>
|
||||
<ogr:CLASS>SQUIGGLE</ogr:CLASS>
|
||||
</ogr:textspacing>
|
||||
|
||||
</gml:featureMember>
|
||||
</ogr:FeatureCollection>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
|
||||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
|
||||
<xs:complexType name="FeatureCollectionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureCollectionType">
|
||||
<xs:attribute name="lockId" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="scope" type="xs:string" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="textspacing" type="ogr:textspacing_Type" substitutionGroup="gml:_Feature"/>
|
||||
<xs:complexType name="textspacing_Type">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="gml:AbstractFeatureType">
|
||||
<xs:sequence>
|
||||
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="NAME" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CLASS" nillable="true" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="60"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
|
@ -1,3 +0,0 @@
|
|||
These files are for testing various rendering parts of mapnik, they have been created by hand.
|
||||
The raw files are in the raw/ folder (they were created with inkscape to assist!)
|
||||
Run the regenerate.sh script to regenerate the shape files from the gml files, this requires ogr2ogr to run.
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
rm -f textspacing.shp textspacing.shx textspacing.dbf
|
||||
ogr2ogr -f "ESRI Shapefile" textspacing raw/textspacing.gml
|
||||
mv textspacing/* ./
|
||||
rmdir textspacing
|
||||
|
||||
rm -f overlap.shp overlap.shx overlap.dbf
|
||||
ogr2ogr -f "ESRI Shapefile" overlap raw/overlap.gml
|
||||
mv overlap/* ./
|
||||
rmdir overlap
|
||||
|
||||
rm -f displacement.shp displacement.shx displacement.dbf
|
||||
ogr2ogr -f "ESRI Shapefile" displacement raw/displacement.gml
|
||||
mv displacement/* ./
|
||||
rmdir displacement
|
||||
|
||||
rm -f charplacement.shp charplacement.shx charplacement.dbf
|
||||
ogr2ogr -f "ESRI Shapefile" charplacement raw/charplacement.gml
|
||||
mv charplacement/* ./
|
||||
rmdir charplacement
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
// qt
|
||||
#include <QApplication>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
#include <QSlider>
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QToolBar>
|
||||
// mapnik
|
||||
|
||||
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define MAINWINDOW_HPP
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPrinter>
|
||||
#include <QList>
|
||||
#include <QActionGroup>
|
||||
#include <QStatusBar>
|
||||
|
@ -78,7 +77,6 @@ private:
|
|||
LayerTab *layerTab_;
|
||||
StyleTab * styleTab_;
|
||||
MapWidget * mapWidget_;
|
||||
QPrinter printer;
|
||||
//actions
|
||||
QList<QAction *> exportAsActs;
|
||||
QActionGroup *toolsGroup;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <mapnik/agg_renderer.hpp>
|
||||
#include <mapnik/graphics.hpp>
|
||||
#include <mapnik/grid/grid_renderer.hpp>
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
#include <mapnik/scale_denominator.hpp>
|
||||
|
@ -528,42 +527,7 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
|||
|
||||
void render_grid(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
||||
{
|
||||
unsigned width=map.width();
|
||||
unsigned height=map.height();
|
||||
|
||||
mapnik::grid buf(width,height,"F_CODE", 1);
|
||||
mapnik::grid_renderer<mapnik::grid> ren(map,buf,scaling_factor);
|
||||
|
||||
try
|
||||
{
|
||||
ren.apply();
|
||||
mapnik::value_integer * imdata = static_cast<mapnik::value_integer*>(buf.raw_data());
|
||||
|
||||
// Not sure how to display long long values ??
|
||||
//QImage image(width,height,QImage::Format_RGB32);
|
||||
//for (unsigned i = 0 ; i < height ; ++i)
|
||||
//{
|
||||
// for (unsigned j = 0 ; j < width ; ++j)
|
||||
// {
|
||||
// image.setPixel(j,i,qRgb((uint8_t)(imdata[i*width+j]>>8),
|
||||
// (uint8_t)(imdata[i*width+j+1]>>8),
|
||||
// (uint8_t)(imdata[i*width+j+2]>>8)));
|
||||
// }
|
||||
//}
|
||||
//pix = QPixmap::fromImage(image);
|
||||
}
|
||||
catch (mapnik::config_error & ex)
|
||||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
}
|
||||
catch (const std::exception & ex)
|
||||
{
|
||||
std::cerr << "exception: " << ex.what() << std::endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Unknown exception caught!\n";
|
||||
}
|
||||
std::cerr << "Not supported" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
# Mapnik viewer - Copyright (C) 2007 Artem Pavlenko
|
||||
######################################################################
|
||||
TEMPLATE = app
|
||||
QT += core gui widgets
|
||||
QMAKE_CXX = clang++
|
||||
QMAKE_CXXFLAGS += $$system(mapnik-config --cxxflags)
|
||||
QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes)
|
||||
QMAKE_LFLAGS += $$system(mapnik-config --libs)
|
||||
QMAKE_LFLAGS += $$system(mapnik-config --ldflags --dep-libs)
|
||||
QMAKE_LFLAGS += -lboost_timer
|
||||
|
|
621
deps/agg/include/agg_conv_clipper.h
vendored
621
deps/agg/include/agg_conv_clipper.h
vendored
|
@ -1,326 +1,295 @@
|
|||
/*******************************************************************************
|
||||
* *
|
||||
* Author : Angus Johnson *
|
||||
* Version : 1.1 *
|
||||
* Date : 4 April 2011 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2011 *
|
||||
* *
|
||||
* License: *
|
||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||
* http://www.boost.org/LICENSE_1_0.txt *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef AGG_CONV_CLIPPER_INCLUDED
|
||||
#define AGG_CONV_CLIPPER_INCLUDED
|
||||
|
||||
#include <cmath>
|
||||
#include "agg_basics.h"
|
||||
#include "agg_array.h"
|
||||
#include "clipper.hpp"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
enum clipper_op_e { clipper_or,
|
||||
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
|
||||
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
|
||||
|
||||
template<class VSA, class VSB> class conv_clipper
|
||||
{
|
||||
enum status { status_move_to, status_line_to, status_stop };
|
||||
typedef VSA source_a_type;
|
||||
typedef VSB source_b_type;
|
||||
typedef conv_clipper<source_a_type, source_b_type> self_type;
|
||||
|
||||
private:
|
||||
source_a_type* m_src_a;
|
||||
source_b_type* m_src_b;
|
||||
status m_status;
|
||||
int m_vertex;
|
||||
int m_contour;
|
||||
int m_scaling_factor;
|
||||
clipper_op_e m_operation;
|
||||
pod_bvector<ClipperLib::IntPoint, 8> m_vertex_accumulator;
|
||||
ClipperLib::Polygons m_poly_a;
|
||||
ClipperLib::Polygons m_poly_b;
|
||||
ClipperLib::Polygons m_result;
|
||||
ClipperLib::Clipper m_clipper;
|
||||
clipper_PolyFillType m_subjFillType;
|
||||
clipper_PolyFillType m_clipFillType;
|
||||
double start_x_;
|
||||
double start_y_;
|
||||
|
||||
int Round(double val)
|
||||
{
|
||||
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
|
||||
}
|
||||
|
||||
public:
|
||||
conv_clipper(source_a_type &a, source_b_type &b,
|
||||
clipper_op_e op = clipper_or,
|
||||
clipper_PolyFillType subjFillType = clipper_even_odd,
|
||||
clipper_PolyFillType clipFillType = clipper_even_odd,
|
||||
int scaling_factor = 2) :
|
||||
m_src_a(&a),
|
||||
m_src_b(&b),
|
||||
m_status(status_move_to),
|
||||
m_vertex(-1),
|
||||
m_contour(-1),
|
||||
m_operation(op),
|
||||
m_subjFillType(subjFillType),
|
||||
m_clipFillType(clipFillType),
|
||||
start_x_(0),
|
||||
start_y_(0)
|
||||
{
|
||||
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
|
||||
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
|
||||
}
|
||||
|
||||
conv_clipper(source_a_type &a,
|
||||
clipper_op_e op = clipper_and,
|
||||
clipper_PolyFillType subjFillType = clipper_non_zero,
|
||||
clipper_PolyFillType clipFillType = clipper_non_zero,
|
||||
int scaling_factor = 6) :
|
||||
m_src_a(&a),
|
||||
m_status(status_move_to),
|
||||
m_vertex(-1),
|
||||
m_contour(-1),
|
||||
m_operation(op),
|
||||
m_subjFillType(subjFillType),
|
||||
m_clipFillType(clipFillType),
|
||||
start_x_(0),
|
||||
start_y_(0)
|
||||
{
|
||||
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
|
||||
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
|
||||
}
|
||||
|
||||
~conv_clipper()
|
||||
{
|
||||
}
|
||||
unsigned type() const { return m_src_a->type(); }
|
||||
void attach1(VSA &source, clipper_PolyFillType subjFillType = clipper_even_odd)
|
||||
{ m_src_a = &source; m_subjFillType = subjFillType; }
|
||||
void attach2(VSB &source, clipper_PolyFillType clipFillType = clipper_even_odd)
|
||||
{ m_src_b = &source; m_clipFillType = clipFillType; }
|
||||
|
||||
void operation(clipper_op_e v) { m_operation = v; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
bool next_contour();
|
||||
bool next_vertex(double* x, double* y);
|
||||
void start_extracting();
|
||||
void add_vertex_(double &x, double &y);
|
||||
void end_contour(ClipperLib::Polygons &p);
|
||||
|
||||
template<class VS> void add(VS &src, ClipperLib::Polygons &p){
|
||||
unsigned cmd;
|
||||
double x; double y; double start_x; double start_y;
|
||||
bool starting_first_line;
|
||||
|
||||
start_x = 0.0;
|
||||
start_y = 0.0;
|
||||
starting_first_line = true;
|
||||
p.resize(0);
|
||||
|
||||
cmd = src->vertex( &x , &y );
|
||||
while(!is_stop(cmd))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
if(!starting_first_line ) end_contour(p);
|
||||
start_x = x;
|
||||
start_y = y;
|
||||
}
|
||||
add_vertex_( x, y );
|
||||
starting_first_line = false;
|
||||
}
|
||||
else if(is_end_poly(cmd))
|
||||
{
|
||||
if(!starting_first_line && is_closed(cmd))
|
||||
add_vertex_( start_x, start_y );
|
||||
}
|
||||
cmd = src->vertex( &x, &y );
|
||||
}
|
||||
end_contour(p);
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::start_extracting()
|
||||
{
|
||||
m_status = status_move_to;
|
||||
m_contour = -1;
|
||||
m_vertex = -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
|
||||
{
|
||||
m_src_a->rewind( path_id );
|
||||
m_src_b->rewind( path_id );
|
||||
|
||||
add( m_src_a , m_poly_a );
|
||||
add( m_src_b , m_poly_b );
|
||||
m_result.resize(0);
|
||||
|
||||
ClipperLib::PolyFillType pftSubj, pftClip;
|
||||
switch (m_subjFillType)
|
||||
{
|
||||
case clipper_even_odd: pftSubj = ClipperLib::pftEvenOdd; break;
|
||||
case clipper_non_zero: pftSubj = ClipperLib::pftNonZero; break;
|
||||
case clipper_positive: pftSubj = ClipperLib::pftPositive; break;
|
||||
default: pftSubj = ClipperLib::pftNegative;
|
||||
}
|
||||
switch (m_clipFillType)
|
||||
{
|
||||
case clipper_even_odd: pftClip = ClipperLib::pftEvenOdd; break;
|
||||
case clipper_non_zero: pftClip = ClipperLib::pftNonZero; break;
|
||||
case clipper_positive: pftClip = ClipperLib::pftPositive; break;
|
||||
default: pftClip = ClipperLib::pftNegative;
|
||||
}
|
||||
|
||||
m_clipper.Clear();
|
||||
switch( m_operation ) {
|
||||
case clipper_or:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctUnion , m_result , pftSubj, pftClip);
|
||||
break;
|
||||
}
|
||||
case clipper_and:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctIntersection , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_xor:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctXor , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_a_minus_b:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_b_minus_a:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
}
|
||||
start_extracting();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
|
||||
{
|
||||
unsigned i, len;
|
||||
|
||||
if( m_vertex_accumulator.size() < 3 ) return;
|
||||
len = p.size();
|
||||
p.resize(len+1);
|
||||
p[len].resize(m_vertex_accumulator.size());
|
||||
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
|
||||
p[len][i] = m_vertex_accumulator[i];
|
||||
m_vertex_accumulator.remove_all();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
|
||||
{
|
||||
ClipperLib::IntPoint v;
|
||||
|
||||
v.X = Round(x * m_scaling_factor);
|
||||
v.Y = Round(y * m_scaling_factor);
|
||||
m_vertex_accumulator.add( v );
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
bool conv_clipper<VSA, VSB>::next_contour()
|
||||
{
|
||||
m_contour++;
|
||||
if(m_contour >= (int)m_result.size()) return false;
|
||||
m_vertex =-1;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
|
||||
{
|
||||
m_vertex++;
|
||||
if(m_vertex >= (int)m_result[m_contour].size()) return false;
|
||||
*x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor;
|
||||
*y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y)
|
||||
{
|
||||
if( m_status == status_move_to )
|
||||
{
|
||||
if( next_contour() )
|
||||
{
|
||||
if( next_vertex( x, y ) )
|
||||
{
|
||||
m_status =status_line_to;
|
||||
start_x_ = *x;
|
||||
start_y_ = *y;
|
||||
return path_cmd_move_to;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = start_x_;
|
||||
*y = start_y_;
|
||||
m_status = status_stop;
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
}
|
||||
else
|
||||
return path_cmd_stop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( next_vertex( x, y ) )
|
||||
{
|
||||
return path_cmd_line_to;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_status = status_move_to;
|
||||
*x = start_x_;
|
||||
*y = start_y_;
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
} //namespace agg
|
||||
#endif //AGG_CONV_CLIPPER_INCLUDED
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Author : Angus Johnson *
|
||||
* Version : 1.1 *
|
||||
* Date : 4 April 2011 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2011 *
|
||||
* *
|
||||
* License: *
|
||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||
* http://www.boost.org/LICENSE_1_0.txt *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef AGG_CONV_CLIPPER_INCLUDED
|
||||
#define AGG_CONV_CLIPPER_INCLUDED
|
||||
|
||||
#include <cmath>
|
||||
#include "agg_basics.h"
|
||||
#include "agg_array.h"
|
||||
#include "clipper.hpp"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
enum clipper_op_e { clipper_or,
|
||||
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
|
||||
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
|
||||
|
||||
template<class VSA, class VSB> class conv_clipper
|
||||
{
|
||||
enum status { status_move_to, status_line_to, status_stop };
|
||||
typedef VSA source_a_type;
|
||||
typedef VSB source_b_type;
|
||||
typedef conv_clipper<source_a_type, source_b_type> self_type;
|
||||
|
||||
private:
|
||||
source_a_type* m_src_a;
|
||||
source_b_type* m_src_b;
|
||||
status m_status;
|
||||
int m_vertex;
|
||||
int m_contour;
|
||||
int m_scaling_factor;
|
||||
clipper_op_e m_operation;
|
||||
pod_bvector<ClipperLib::IntPoint, 8> m_vertex_accumulator;
|
||||
ClipperLib::Polygons m_poly_a;
|
||||
ClipperLib::Polygons m_poly_b;
|
||||
ClipperLib::Polygons m_result;
|
||||
ClipperLib::Clipper m_clipper;
|
||||
clipper_PolyFillType m_subjFillType;
|
||||
clipper_PolyFillType m_clipFillType;
|
||||
|
||||
int Round(double val)
|
||||
{
|
||||
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
|
||||
}
|
||||
|
||||
public:
|
||||
conv_clipper(source_a_type &a, source_b_type &b,
|
||||
clipper_op_e op = clipper_or,
|
||||
clipper_PolyFillType subjFillType = clipper_even_odd,
|
||||
clipper_PolyFillType clipFillType = clipper_even_odd,
|
||||
int scaling_factor = 2) :
|
||||
m_src_a(&a),
|
||||
m_src_b(&b),
|
||||
m_status(status_move_to),
|
||||
m_vertex(-1),
|
||||
m_contour(-1),
|
||||
m_operation(op),
|
||||
m_subjFillType(subjFillType),
|
||||
m_clipFillType(clipFillType)
|
||||
{
|
||||
m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
|
||||
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
|
||||
}
|
||||
|
||||
~conv_clipper()
|
||||
{
|
||||
}
|
||||
|
||||
void attach1(VSA &source, clipper_PolyFillType subjFillType = clipper_even_odd)
|
||||
{ m_src_a = &source; m_subjFillType = subjFillType; }
|
||||
void attach2(VSB &source, clipper_PolyFillType clipFillType = clipper_even_odd)
|
||||
{ m_src_b = &source; m_clipFillType = clipFillType; }
|
||||
|
||||
void operation(clipper_op_e v) { m_operation = v; }
|
||||
|
||||
void rewind(unsigned path_id);
|
||||
unsigned vertex(double* x, double* y);
|
||||
|
||||
bool next_contour();
|
||||
bool next_vertex(double* x, double* y);
|
||||
void start_extracting();
|
||||
void add_vertex_(double &x, double &y);
|
||||
void end_contour(ClipperLib::Polygons &p);
|
||||
|
||||
template<class VS> void add(VS &src, ClipperLib::Polygons &p){
|
||||
unsigned cmd;
|
||||
double x; double y; double start_x; double start_y;
|
||||
bool starting_first_line;
|
||||
|
||||
start_x = 0.0;
|
||||
start_y = 0.0;
|
||||
starting_first_line = true;
|
||||
p.resize(0);
|
||||
|
||||
cmd = src->vertex( &x , &y );
|
||||
while(!is_stop(cmd))
|
||||
{
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
if(is_move_to(cmd))
|
||||
{
|
||||
if(!starting_first_line ) end_contour(p);
|
||||
start_x = x;
|
||||
start_y = y;
|
||||
}
|
||||
add_vertex_( x, y );
|
||||
starting_first_line = false;
|
||||
}
|
||||
else if(is_end_poly(cmd))
|
||||
{
|
||||
if(!starting_first_line && is_closed(cmd))
|
||||
add_vertex_( start_x, start_y );
|
||||
}
|
||||
cmd = src->vertex( &x, &y );
|
||||
}
|
||||
end_contour(p);
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::start_extracting()
|
||||
{
|
||||
m_status = status_move_to;
|
||||
m_contour = -1;
|
||||
m_vertex = -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
|
||||
{
|
||||
m_src_a->rewind( path_id );
|
||||
m_src_b->rewind( path_id );
|
||||
|
||||
add( m_src_a , m_poly_a );
|
||||
add( m_src_b , m_poly_b );
|
||||
m_result.resize(0);
|
||||
|
||||
ClipperLib::PolyFillType pftSubj, pftClip;
|
||||
switch (m_subjFillType)
|
||||
{
|
||||
case clipper_even_odd: pftSubj = ClipperLib::pftEvenOdd; break;
|
||||
case clipper_non_zero: pftSubj = ClipperLib::pftNonZero; break;
|
||||
case clipper_positive: pftSubj = ClipperLib::pftPositive; break;
|
||||
default: pftSubj = ClipperLib::pftNegative;
|
||||
}
|
||||
switch (m_clipFillType)
|
||||
{
|
||||
case clipper_even_odd: pftClip = ClipperLib::pftEvenOdd; break;
|
||||
case clipper_non_zero: pftClip = ClipperLib::pftNonZero; break;
|
||||
case clipper_positive: pftClip = ClipperLib::pftPositive; break;
|
||||
default: pftClip = ClipperLib::pftNegative;
|
||||
}
|
||||
|
||||
m_clipper.Clear();
|
||||
switch( m_operation ) {
|
||||
case clipper_or:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctUnion , m_result , pftSubj, pftClip);
|
||||
break;
|
||||
}
|
||||
case clipper_and:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctIntersection , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_xor:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctXor , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_a_minus_b:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
case clipper_b_minus_a:
|
||||
{
|
||||
m_clipper.AddPolygons( m_poly_b , ClipperLib::ptSubject );
|
||||
m_clipper.AddPolygons( m_poly_a , ClipperLib::ptClip );
|
||||
m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip );
|
||||
break;
|
||||
}
|
||||
}
|
||||
start_extracting();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
|
||||
{
|
||||
unsigned i, len;
|
||||
|
||||
if( m_vertex_accumulator.size() < 3 ) return;
|
||||
len = p.size();
|
||||
p.resize(len+1);
|
||||
p[len].resize(m_vertex_accumulator.size());
|
||||
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
|
||||
p[len][i] = m_vertex_accumulator[i];
|
||||
m_vertex_accumulator.remove_all();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
|
||||
{
|
||||
ClipperLib::IntPoint v;
|
||||
|
||||
v.X = Round(x * m_scaling_factor);
|
||||
v.Y = Round(y * m_scaling_factor);
|
||||
m_vertex_accumulator.add( v );
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
bool conv_clipper<VSA, VSB>::next_contour()
|
||||
{
|
||||
m_contour++;
|
||||
if(m_contour >= (int)m_result.size()) return false;
|
||||
m_vertex =-1;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
|
||||
{
|
||||
m_vertex++;
|
||||
if(m_vertex >= (int)m_result[m_contour].size()) return false;
|
||||
*x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor;
|
||||
*y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class VSA, class VSB>
|
||||
unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y)
|
||||
{
|
||||
if( m_status == status_move_to )
|
||||
{
|
||||
if( next_contour() )
|
||||
{
|
||||
if( next_vertex( x, y ) )
|
||||
{
|
||||
m_status =status_line_to;
|
||||
return path_cmd_move_to;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_status = status_stop;
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
}
|
||||
else
|
||||
return path_cmd_stop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( next_vertex( x, y ) )
|
||||
{
|
||||
return path_cmd_line_to;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_status = status_move_to;
|
||||
return path_cmd_end_poly | path_flags_close;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
} //namespace agg
|
||||
#endif //AGG_CONV_CLIPPER_INCLUDED
|
||||
|
|
25
deps/clipper/include/clipper.hpp
vendored
Normal file → Executable file
25
deps/clipper/include/clipper.hpp
vendored
Normal file → Executable file
|
@ -1,8 +1,8 @@
|
|||
/*******************************************************************************
|
||||
* *
|
||||
* Author : Angus Johnson *
|
||||
* Version : 5.1.3 *
|
||||
* Date : 27 February 2013 *
|
||||
* Version : 5.1.5 *
|
||||
* Date : 4 May 2013 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2013 *
|
||||
* *
|
||||
|
@ -34,6 +34,8 @@
|
|||
#ifndef clipper_hpp
|
||||
#define clipper_hpp
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
|
@ -134,7 +136,6 @@ struct TEdge {
|
|||
double dx;
|
||||
long64 deltaX;
|
||||
long64 deltaY;
|
||||
long64 tmpX;
|
||||
PolyType polyType;
|
||||
EdgeSide side;
|
||||
int windDelta; //1 or -1 depending on winding direction
|
||||
|
@ -211,7 +212,7 @@ typedef std::vector < HorzJoinRec* > HorzJoinList;
|
|||
//ClipperBase is the ancestor to the Clipper class. It should not be
|
||||
//instantiated directly. This class simply abstracts the conversion of sets of
|
||||
//polygon coordinates into edge objects that are stored in a LocalMinima list.
|
||||
class ClipperBase
|
||||
class MAPNIK_DECL ClipperBase
|
||||
{
|
||||
public:
|
||||
ClipperBase();
|
||||
|
@ -232,7 +233,7 @@ protected:
|
|||
EdgeList m_edges;
|
||||
};
|
||||
|
||||
class Clipper : public virtual ClipperBase
|
||||
class MAPNIK_DECL Clipper : public virtual ClipperBase
|
||||
{
|
||||
public:
|
||||
Clipper();
|
||||
|
@ -248,6 +249,8 @@ public:
|
|||
void Clear();
|
||||
bool ReverseSolution() {return m_ReverseOutput;};
|
||||
void ReverseSolution(bool value) {m_ReverseOutput = value;};
|
||||
bool ForceSimple() {return m_ForceSimple;};
|
||||
void ForceSimple(bool value) {m_ForceSimple = value;};
|
||||
protected:
|
||||
void Reset();
|
||||
virtual bool ExecuteInternal();
|
||||
|
@ -265,6 +268,7 @@ private:
|
|||
PolyFillType m_SubjFillType;
|
||||
bool m_ReverseOutput;
|
||||
bool m_UsingPolyTree;
|
||||
bool m_ForceSimple;
|
||||
void DisposeScanbeamList();
|
||||
void SetWindingCount(TEdge& edge);
|
||||
bool IsEvenOddFillType(const TEdge& edge) const;
|
||||
|
@ -287,10 +291,8 @@ private:
|
|||
void ProcessHorizontal(TEdge *horzEdge);
|
||||
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
|
||||
void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
|
||||
OutRec* GetOutRec(int idx);
|
||||
void AppendPolygon(TEdge *e1, TEdge *e2);
|
||||
void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
||||
void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
||||
void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
||||
void IntersectEdges(TEdge *e1, TEdge *e2,
|
||||
const IntPoint &pt, const IntersectProtects protects);
|
||||
OutRec* CreateOutRec();
|
||||
|
@ -304,12 +306,12 @@ private:
|
|||
void ProcessEdgesAtTopOfScanbeam(const long64 topY);
|
||||
void BuildResult(Polygons& polys);
|
||||
void BuildResult2(PolyTree& polytree);
|
||||
void SetHoleState(TEdge *e, OutRec *OutRec);
|
||||
void SetHoleState(TEdge *e, OutRec *outrec);
|
||||
void DisposeIntersectNodes();
|
||||
bool FixupIntersectionOrder();
|
||||
void FixupOutPolygon(OutRec &outRec);
|
||||
void FixupOutPolygon(OutRec &outrec);
|
||||
bool IsHole(TEdge *e);
|
||||
void FixHoleLinkage(OutRec &outRec);
|
||||
void FixHoleLinkage(OutRec &outrec);
|
||||
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1);
|
||||
void ClearJoins();
|
||||
void AddHorzJoin(TEdge *e, int idx);
|
||||
|
@ -317,6 +319,7 @@ private:
|
|||
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2);
|
||||
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx);
|
||||
void JoinCommonEdges();
|
||||
void DoSimplePolygons();
|
||||
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
|
||||
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec);
|
||||
};
|
||||
|
|
610
deps/clipper/src/clipper.cpp
vendored
Normal file → Executable file
610
deps/clipper/src/clipper.cpp
vendored
Normal file → Executable file
File diff suppressed because it is too large
Load diff
|
@ -39,9 +39,15 @@
|
|||
# pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE
|
||||
# endif
|
||||
#else
|
||||
# if __GNUC__ >= 4
|
||||
# define MAPNIK_EXP __attribute__ ((visibility ("default")))
|
||||
# define MAPNIK_DECL __attribute__ ((visibility ("default")))
|
||||
# define MAPNIK_IMP __attribute__ ((visibility ("default")))
|
||||
# else
|
||||
# define MAPNIK_EXP
|
||||
# define MAPNIK_IMP
|
||||
# define MAPNIK_DECL
|
||||
# define MAPNIK_IMP
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define PROJ_ENVELOPE_POINTS 20
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef MAPNIK_CONFIG_ERROR_HPP
|
||||
#define MAPNIK_CONFIG_ERROR_HPP
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
|
||||
// NOTE: This is an implementation header file and is only meant to be included
|
||||
// from implementation files. It therefore doesn't have an include guard.
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
|
@ -100,5 +100,3 @@ css_color_grammar<Iterator>::css_color_grammar()
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -47,7 +47,7 @@ struct MAPNIK_DECL Featureset : private mapnik::noncopyable
|
|||
virtual ~Featureset() {}
|
||||
};
|
||||
|
||||
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
|
||||
typedef boost::shared_ptr<Featureset> featureset_ptr;
|
||||
|
||||
class MAPNIK_DECL datasource_exception : public std::exception
|
||||
{
|
||||
|
@ -134,19 +134,23 @@ public:
|
|||
|
||||
typedef boost::shared_ptr<datasource> datasource_ptr;
|
||||
|
||||
#define DATASOURCE_PLUGIN(classname) \
|
||||
extern "C" MAPNIK_EXP const char * datasource_name() \
|
||||
{ \
|
||||
return classname::name(); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
|
||||
{ \
|
||||
return new classname(params); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
|
||||
{ \
|
||||
delete ds; \
|
||||
}
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
#define DATASOURCE_PLUGIN(classname)
|
||||
#else
|
||||
#define DATASOURCE_PLUGIN(classname) \
|
||||
extern "C" MAPNIK_EXP const char * datasource_name() \
|
||||
{ \
|
||||
return classname::name(); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
|
||||
{ \
|
||||
return new classname(params); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
|
||||
{ \
|
||||
delete ds; \
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,14 +25,30 @@
|
|||
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
enum debug_symbolizer_mode_enum {
|
||||
DEBUG_SYM_MODE_COLLISION,
|
||||
DEBUG_SYM_MODE_VERTEX,
|
||||
debug_symbolizer_mode_enum_MAX
|
||||
};
|
||||
|
||||
DEFINE_ENUM( debug_symbolizer_mode_e, debug_symbolizer_mode_enum );
|
||||
|
||||
struct MAPNIK_DECL debug_symbolizer :
|
||||
public symbolizer_base
|
||||
{
|
||||
debug_symbolizer() : symbolizer_base() {}
|
||||
debug_symbolizer();
|
||||
debug_symbolizer(debug_symbolizer const& rhs);
|
||||
debug_symbolizer_mode_e get_mode() const;
|
||||
void set_mode(debug_symbolizer_mode_e mode);
|
||||
|
||||
private:
|
||||
debug_symbolizer_mode_e mode_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define MAPNIK_EXPRESSIONS_GRAMMAR_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/value_types.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
|
|
191
include/mapnik/expression_grammar_impl.hpp
Normal file
191
include/mapnik/expression_grammar_impl.hpp
Normal file
|
@ -0,0 +1,191 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// NOTE: This is an implementation header file and is only meant to be included
|
||||
// from implementation files. It therefore doesn't have an include guard.
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/expression_node.hpp>
|
||||
#include <mapnik/expression_grammar.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/value_types.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_object.hpp>
|
||||
|
||||
// fwd declare
|
||||
namespace mapnik {
|
||||
struct attribute;
|
||||
struct geometry_type_attribute;
|
||||
}
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T0,typename T1>
|
||||
expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const
|
||||
{
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return regex_match_node(node,tr_.transcode(pattern.c_str()));
|
||||
#else
|
||||
return regex_match_node(node,pattern);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T0,typename T1,typename T2>
|
||||
expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const
|
||||
{
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str()));
|
||||
#else
|
||||
return regex_replace_node(node,pattern,format);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
|
||||
: expression_grammar::base_type(expr),
|
||||
unicode_(unicode_impl(tr)),
|
||||
regex_match_(regex_match_impl(tr)),
|
||||
regex_replace_(regex_replace_impl(tr))
|
||||
{
|
||||
using boost::phoenix::construct;
|
||||
using qi::_1;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_r1;
|
||||
#if BOOST_VERSION > 104200
|
||||
using qi::no_skip;
|
||||
#endif
|
||||
using qi::lexeme;
|
||||
using qi::_val;
|
||||
using qi::lit;
|
||||
using qi::double_;
|
||||
using qi::hex;
|
||||
using qi::omit;
|
||||
using standard_wide::char_;
|
||||
using standard_wide::no_case;
|
||||
|
||||
expr = logical_expr.alias();
|
||||
|
||||
logical_expr = not_expr [_val = _1]
|
||||
>>
|
||||
*( ( ( lit("and") | lit("&&")) >> not_expr [_val && _1] )
|
||||
| (( lit("or") | lit("||")) >> not_expr [_val || _1])
|
||||
)
|
||||
;
|
||||
|
||||
not_expr =
|
||||
cond_expr [_val = _1 ]
|
||||
| ((lit("not") | lit('!')) >> cond_expr [ _val = !_1 ])
|
||||
;
|
||||
|
||||
cond_expr = equality_expr [_val = _1] | additive_expr [_val = _1]
|
||||
;
|
||||
|
||||
equality_expr =
|
||||
relational_expr [_val = _1]
|
||||
>> *( ( (lit("=") | lit("eq") | lit("is")) >> relational_expr [_val == _1])
|
||||
| (( lit("!=") | lit("<>") | lit("neq") ) >> relational_expr [_val != _1])
|
||||
)
|
||||
;
|
||||
|
||||
regex_match_expr = lit(".match")
|
||||
>> lit('(')
|
||||
>> ustring [_val = _1]
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
regex_replace_expr =
|
||||
lit(".replace")
|
||||
>> lit('(')
|
||||
>> ustring [_a = _1]
|
||||
>> lit(',')
|
||||
>> ustring [_b = _1]
|
||||
>> lit(')') [_val = regex_replace_(_r1,_a,_b)]
|
||||
;
|
||||
|
||||
relational_expr = additive_expr[_val = _1]
|
||||
>>
|
||||
*( ( (lit("<=") | lit("le") ) >> additive_expr [ _val <= _1 ])
|
||||
| ( (lit('<') | lit("lt") ) >> additive_expr [ _val < _1 ])
|
||||
| ( (lit(">=") | lit("ge") ) >> additive_expr [ _val >= _1 ])
|
||||
| ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ])
|
||||
)
|
||||
;
|
||||
|
||||
additive_expr = multiplicative_expr [_val = _1]
|
||||
>> * ( '+' >> multiplicative_expr[_val += _1]
|
||||
| '-' >> multiplicative_expr[_val -= _1]
|
||||
)
|
||||
;
|
||||
|
||||
multiplicative_expr = unary_expr [_val = _1]
|
||||
>> *( '*' >> unary_expr [_val *= _1]
|
||||
| '/' >> unary_expr [_val /= _1]
|
||||
| '%' >> unary_expr [_val %= _1]
|
||||
| regex_match_expr[_val = regex_match_(_val, _1)]
|
||||
| regex_replace_expr(_val) [_val = _1]
|
||||
)
|
||||
;
|
||||
|
||||
unary_expr = primary_expr [_val = _1]
|
||||
| '+' >> primary_expr [_val = _1]
|
||||
| '-' >> primary_expr [_val = -_1]
|
||||
;
|
||||
|
||||
primary_expr = strict_double [_val = _1]
|
||||
| int__[_val = _1]
|
||||
| no_case[lit("true")] [_val = true]
|
||||
| no_case[lit("false")] [_val = false]
|
||||
| no_case[lit("null")] [_val = value_null() ]
|
||||
| no_case[geom_type][_val = _1 ]
|
||||
| ustring [_val = unicode_(_1) ]
|
||||
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
|
||||
| attr [_val = construct<mapnik::attribute>( _1 ) ]
|
||||
| '(' >> expr [_val = _1 ] >> ')'
|
||||
;
|
||||
|
||||
unesc_char.add("\\a", '\a')("\\b", '\b')("\\f", '\f')("\\n", '\n')
|
||||
("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\')
|
||||
("\\\'", '\'')("\\\"", '\"')
|
||||
;
|
||||
|
||||
#if BOOST_VERSION > 104500
|
||||
quote_char %= char_('\'') | char_('"');
|
||||
ustring %= omit[quote_char[_a = _1]]
|
||||
>> *(unesc_char | "\\x" >> hex | (char_ - lit(_a)))
|
||||
>> lit(_a);
|
||||
attr %= '[' >> no_skip[+~char_(']')] >> ']';
|
||||
#else
|
||||
ustring %= lit('\'')
|
||||
>> *(unesc_char | "\\x" >> hex | (char_ - lit('\'')))
|
||||
>> lit('\'');
|
||||
attr %= '[' >> lexeme[+(char_ - ']')] >> ']';
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -87,8 +87,8 @@ private:
|
|||
map_type mapping_;
|
||||
};
|
||||
|
||||
typedef MAPNIK_DECL context<std::map<std::string,std::size_t> > context_type;
|
||||
typedef MAPNIK_DECL boost::shared_ptr<context_type> context_ptr;
|
||||
typedef context<std::map<std::string,std::size_t> > context_type;
|
||||
typedef boost::shared_ptr<context_type> context_ptr;
|
||||
|
||||
static const value default_value;
|
||||
|
||||
|
@ -306,9 +306,10 @@ inline std::ostream& operator<< (std::ostream & out,feature_impl const& f)
|
|||
return out;
|
||||
}
|
||||
|
||||
// TODO - remove at Mapnik 3.x
|
||||
typedef feature_impl Feature;
|
||||
|
||||
typedef MAPNIK_DECL boost::shared_ptr<Feature> feature_ptr;
|
||||
typedef boost::shared_ptr<feature_impl> feature_ptr;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ namespace mapnik
|
|||
{
|
||||
struct feature_factory
|
||||
{
|
||||
static boost::shared_ptr<Feature> create (context_ptr const& ctx, mapnik::value_integer fid)
|
||||
static boost::shared_ptr<feature_impl> create (context_ptr const& ctx, mapnik::value_integer fid)
|
||||
{
|
||||
//return boost::allocate_shared<Feature>(boost::pool_allocator<Feature>(),fid);
|
||||
//return boost::allocate_shared<Feature>(boost::fast_pool_allocator<Feature>(),fid);
|
||||
return boost::make_shared<Feature>(ctx,fid);
|
||||
//return boost::allocate_shared<feature_impl>(boost::pool_allocator<feature_impl>(),fid);
|
||||
//return boost::allocate_shared<feature_impl>(boost::fast_pool_allocator<feature_impl>(),fid);
|
||||
return boost::make_shared<feature_impl>(ctx,fid);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp> // for featureset_ptr
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// stl
|
||||
#include <set>
|
||||
|
@ -48,7 +49,7 @@ enum eAttributeCollectionPolicy
|
|||
};
|
||||
|
||||
template <typename Processor>
|
||||
class feature_style_processor
|
||||
class MAPNIK_DECL feature_style_processor
|
||||
{
|
||||
struct symbol_dispatch;
|
||||
public:
|
||||
|
|
|
@ -606,7 +606,7 @@ void feature_style_processor<Processor>::render_style(
|
|||
BOOST_FOREACH(rule const* r, rc.get_if_rules() )
|
||||
{
|
||||
expression_ptr const& expr=r->get_filter();
|
||||
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature),*expr);
|
||||
value_type result = boost::apply_visitor(evaluate<feature_impl,value_type>(*feature),*expr);
|
||||
if (result.to_bool())
|
||||
{
|
||||
#if defined(RENDERING_STATS)
|
||||
|
|
|
@ -200,10 +200,10 @@ inline bool point_on_path(double x,double y,Iter start,Iter end, double tol)
|
|||
struct filter_in_box
|
||||
{
|
||||
box2d<double> box_;
|
||||
explicit filter_in_box(const box2d<double>& box)
|
||||
explicit filter_in_box(box2d<double> const& box)
|
||||
: box_(box) {}
|
||||
|
||||
bool pass(const box2d<double>& extent) const
|
||||
bool pass(box2d<double> const& extent) const
|
||||
{
|
||||
return extent.intersects(box_);
|
||||
}
|
||||
|
@ -211,23 +211,16 @@ struct filter_in_box
|
|||
|
||||
struct filter_at_point
|
||||
{
|
||||
coord2d pt_;
|
||||
double tol_;
|
||||
explicit filter_at_point(const coord2d& pt, double tol=0)
|
||||
: pt_(pt),
|
||||
tol_(tol) {}
|
||||
bool pass(const box2d<double>& extent) const
|
||||
box2d<double> box_;
|
||||
explicit filter_at_point(coord2d const& pt, double tol=0)
|
||||
: box_(pt,pt)
|
||||
{
|
||||
if (tol_ == 0)
|
||||
{
|
||||
return extent.contains(pt_);
|
||||
}
|
||||
else
|
||||
{
|
||||
box2d<double> extent2 = extent;
|
||||
extent2.pad(tol_);
|
||||
return extent2.contains(pt_);
|
||||
}
|
||||
box_.pad(tol);
|
||||
}
|
||||
|
||||
bool pass(box2d<double> const& extent) const
|
||||
{
|
||||
return extent.intersects(box_);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef MAPNIK_DECL hit_grid<mapnik::value_integer> grid;
|
||||
typedef hit_grid<mapnik::value_integer> grid;
|
||||
|
||||
}
|
||||
#endif //MAPNIK_GRID_HPP
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
y_(y),
|
||||
tol_(tol) {}
|
||||
|
||||
bool pass(Feature & feature)
|
||||
bool pass(feature_impl & feature)
|
||||
{
|
||||
BOOST_FOREACH(geometry_type & geom, feature.paths())
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace mapnik { namespace json {
|
|||
template <typename Iterator, typename FeatureType> struct feature_collection_grammar;
|
||||
|
||||
template <typename Iterator>
|
||||
class feature_collection_parser : private mapnik::noncopyable
|
||||
class MAPNIK_DECL feature_collection_parser : private mapnik::noncopyable
|
||||
{
|
||||
typedef Iterator iterator_type;
|
||||
typedef mapnik::feature_impl feature_type;
|
||||
|
|
|
@ -133,6 +133,7 @@ struct feature_grammar :
|
|||
|
||||
phoenix::function<put_property> put_property_;
|
||||
phoenix::function<extract_geometry> extract_geometry_;
|
||||
boost::phoenix::function<where_message> where_message_;
|
||||
|
||||
geometry_grammar<Iterator> geometry_grammar_;
|
||||
};
|
||||
|
|
|
@ -84,6 +84,25 @@ struct cleanup
|
|||
}
|
||||
};
|
||||
|
||||
struct where_message
|
||||
{
|
||||
template <typename T0,typename T1,typename T2>
|
||||
struct result
|
||||
{
|
||||
typedef std::string type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
std::string operator() (Iterator first, Iterator last, std::size_t size) const
|
||||
{
|
||||
std::string str(first, last);
|
||||
if (str.length() > size)
|
||||
return str.substr(0, size) + "..." ;
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Iterator>
|
||||
struct geometry_grammar :
|
||||
qi::grammar<Iterator,qi::locals<int>, void(boost::ptr_vector<mapnik::geometry_type>& )
|
||||
|
@ -118,6 +137,7 @@ struct geometry_grammar :
|
|||
boost::phoenix::function<push_vertex> push_vertex_;
|
||||
boost::phoenix::function<close_path> close_path_;
|
||||
boost::phoenix::function<cleanup> cleanup_;
|
||||
boost::phoenix::function<where_message> where_message_;
|
||||
};
|
||||
|
||||
}}
|
||||
|
|
|
@ -41,12 +41,13 @@ using namespace boost::interprocess;
|
|||
|
||||
typedef boost::shared_ptr<mapped_region> mapped_region_ptr;
|
||||
|
||||
struct MAPNIK_DECL mapped_memory_cache :
|
||||
class MAPNIK_DECL mapped_memory_cache :
|
||||
public singleton<mapped_memory_cache, CreateStatic>,
|
||||
private mapnik::noncopyable
|
||||
{
|
||||
friend class CreateStatic<mapped_memory_cache>;
|
||||
boost::unordered_map<std::string,mapped_region_ptr> cache_;
|
||||
public:
|
||||
bool insert(std::string const& key, mapped_region_ptr);
|
||||
boost::optional<mapped_region_ptr> find(std::string const& key, bool update_cache = false);
|
||||
void clear();
|
||||
|
|
|
@ -48,7 +48,7 @@ struct MAPNIK_DECL path_processor
|
|||
static void collect_attributes(path_expression const& path, std::set<std::string>& names);
|
||||
};
|
||||
|
||||
typedef MAPNIK_DECL mapnik::path_processor path_processor_type;
|
||||
typedef mapnik::path_processor path_processor_type;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -52,6 +51,10 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
class feature_impl;
|
||||
class raster;
|
||||
|
||||
|
||||
//! \brief Enumerates the modes of interpolation
|
||||
enum colorizer_mode_enum
|
||||
{
|
||||
|
@ -197,7 +200,7 @@ public:
|
|||
//!
|
||||
//! \param[in, out] raster A raster stored in float32 single channel format, which gets colorized in place.
|
||||
//! \param[in] f The feature used to find 'NODATA' information if available
|
||||
void colorize(raster_ptr const& raster, Feature const& f) const;
|
||||
void colorize(boost::shared_ptr<raster> const& raster, feature_impl const& f) const;
|
||||
|
||||
|
||||
//! \brief Perform the translation of input to output
|
||||
|
|
|
@ -57,7 +57,7 @@ class text_symbolizer_helper
|
|||
{
|
||||
public:
|
||||
text_symbolizer_helper(text_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
feature_impl const& feature,
|
||||
proj_transform const& prj_trans,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
|
@ -104,7 +104,7 @@ protected:
|
|||
|
||||
//Input
|
||||
text_symbolizer const& sym_;
|
||||
Feature const& feature_;
|
||||
feature_impl const& feature_;
|
||||
proj_transform const& prj_trans_;
|
||||
CoordTransform const& t_;
|
||||
FaceManagerT & font_manager_;
|
||||
|
@ -142,7 +142,7 @@ class shield_symbolizer_helper: public text_symbolizer_helper<FaceManagerT, Dete
|
|||
{
|
||||
public:
|
||||
shield_symbolizer_helper(shield_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
feature_impl const& feature,
|
||||
proj_transform const& prj_trans,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#define MAPNIK_TIFF_IO_HPP
|
||||
|
||||
#include <mapnik/global.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <mapnik/image_util.hpp>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -45,37 +44,89 @@ namespace mapnik {
|
|||
|
||||
static tsize_t tiff_write_proc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
std::ostream* out = (std::ostream*)fd;
|
||||
std::ostream* out = reinterpret_cast<std::ostream*>(fd);
|
||||
std::ios::pos_type pos = out->tellp();
|
||||
std::streamsize request_size = size;
|
||||
if (static_cast<tsize_t>(request_size) != size)
|
||||
return static_cast<tsize_t>(-1);
|
||||
out->write(reinterpret_cast<const char*>(buf), size);
|
||||
|
||||
out->write((const char*)buf, size);
|
||||
|
||||
return size;
|
||||
if( static_cast<std::streamsize>(pos) == -1 )
|
||||
{
|
||||
return size;
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<tsize_t>(out->tellp()-pos);
|
||||
}
|
||||
}
|
||||
|
||||
static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
|
||||
{
|
||||
if (off == 0xFFFFFFFF)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
std::ostream* out = reinterpret_cast<std::ostream*>(fd);
|
||||
|
||||
std::ostream* out = (std::ostream*)fd;
|
||||
if( out->fail() )
|
||||
return static_cast<toff_t>(-1);
|
||||
|
||||
if( static_cast<std::streamsize>(out->tellp()) == -1)
|
||||
return static_cast< toff_t >( 0 );
|
||||
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
out->seekp(off, std::ios_base::beg);
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
out->seekp(off, std::ios_base::cur);
|
||||
break;
|
||||
case SEEK_END:
|
||||
out->seekp(off, std::ios_base::end);
|
||||
break;
|
||||
case SEEK_SET:
|
||||
default:
|
||||
out->seekp(off, std::ios_base::beg);
|
||||
break;
|
||||
}
|
||||
// grow std::stringstream buffer (re: libtiff/tif_stream.cxx)
|
||||
std::ios::pos_type pos = out->tellp();
|
||||
// second check needed for clang (libcxx doesn't set failbit when seeking beyond the current buffer size
|
||||
if( out->fail() || off != pos)
|
||||
{
|
||||
std::ios::iostate old_state;
|
||||
std::ios::pos_type origin;
|
||||
old_state = out->rdstate();
|
||||
// reset the fail bit or else tellp() won't work below
|
||||
out->clear(out->rdstate() & ~std::ios::failbit);
|
||||
switch( whence )
|
||||
{
|
||||
case SEEK_SET:
|
||||
default:
|
||||
origin = 0L;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
origin = out->tellp();
|
||||
break;
|
||||
case SEEK_END:
|
||||
out->seekp(0, std::ios::end);
|
||||
origin = out->tellp();
|
||||
break;
|
||||
}
|
||||
// restore original stream state
|
||||
out->clear(old_state);
|
||||
|
||||
return (toff_t)out->tellp();
|
||||
// only do something if desired seek position is valid
|
||||
if( (static_cast<uint64_t>(origin) + off) > 0L)
|
||||
{
|
||||
uint64_t num_fill;
|
||||
// clear the fail bit
|
||||
out->clear(out->rdstate() & ~std::ios::failbit);
|
||||
// extend the stream to the expected size
|
||||
out->seekp(0, std::ios::end);
|
||||
num_fill = (static_cast<uint64_t>(origin)) + off - out->tellp();
|
||||
for( uint64_t i = 0; i < num_fill; ++i)
|
||||
out->put('\0');
|
||||
|
||||
// retry the seek
|
||||
out->seekp(static_cast<std::ios::off_type>(static_cast<uint64_t>(origin) + off), std::ios::beg);
|
||||
}
|
||||
}
|
||||
return static_cast<toff_t>(out->tellp());
|
||||
}
|
||||
|
||||
static int tiff_close_proc(thandle_t fd)
|
||||
|
@ -87,8 +138,12 @@ static int tiff_close_proc(thandle_t fd)
|
|||
|
||||
static toff_t tiff_size_proc(thandle_t fd)
|
||||
{
|
||||
std::ostream* out = (std::ostream*)fd;
|
||||
return (toff_t)out->tellp();
|
||||
std::ostream* out = reinterpret_cast<std::ostream*>(fd);
|
||||
std::ios::pos_type pos = out->tellp();
|
||||
out->seekp(0, std::ios::end);
|
||||
std::ios::pos_type len = out->tellp();
|
||||
out->seekp(pos);
|
||||
return (toff_t)len;
|
||||
}
|
||||
|
||||
static tsize_t tiff_dummy_read_proc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
|
@ -113,7 +168,7 @@ void save_as_tiff(T1 & file, T2 const& image)
|
|||
const int scanline_size = sizeof(unsigned char) * width * 3;
|
||||
|
||||
TIFF* output = RealTIFFOpen("mapnik_tiff_stream",
|
||||
"w",
|
||||
"wm",
|
||||
(thandle_t)&file,
|
||||
tiff_dummy_read_proc,
|
||||
tiff_write_proc,
|
||||
|
@ -124,7 +179,7 @@ void save_as_tiff(T1 & file, T2 const& image)
|
|||
tiff_dummy_unmap_proc);
|
||||
if (! output)
|
||||
{
|
||||
// throw ?
|
||||
throw ImageWriterException("Could not write TIFF");
|
||||
}
|
||||
|
||||
TIFFSetField(output, TIFFTAG_IMAGEWIDTH, width);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef MAPNIK_UTILS_HPP
|
||||
#define MAPNIK_UTILS_HPP
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// boost
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
@ -38,6 +40,7 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
using boost::mutex;
|
||||
#endif
|
||||
|
@ -82,86 +85,103 @@ public:
|
|||
return new(&staticMemory) T;
|
||||
}
|
||||
#ifdef __SUNPRO_CC
|
||||
// Sun C++ Compiler doesn't handle `volatile` keyword same as GCC.
|
||||
// Sun C++ Compiler doesn't handle `volatile` keyword same as GCC.
|
||||
static void destroy(T* obj)
|
||||
#else
|
||||
static void destroy(volatile T* obj)
|
||||
static void destroy(volatile T* obj)
|
||||
#endif
|
||||
{
|
||||
obj->~T();
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy=CreateStatic> class singleton
|
||||
template <typename U> class CreatePolicy=CreateStatic> class MAPNIK_DECL singleton
|
||||
{
|
||||
#ifdef __SUNPRO_CC
|
||||
/* Sun's C++ compiler will issue the following errors if CreatePolicy<T> is used:
|
||||
Error: A class template name was expected instead of mapnik::CreatePolicy<mapnik::T>
|
||||
Error: A "friend" declaration must specify a class or function.
|
||||
*/
|
||||
friend class CreatePolicy;
|
||||
#else
|
||||
friend class CreatePolicy<T>;
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy=CreateStatic> class singleton
|
||||
{
|
||||
#endif
|
||||
static T* pInstance_;
|
||||
static bool destroyed_;
|
||||
singleton(const singleton &rhs);
|
||||
singleton& operator=(const singleton&);
|
||||
|
||||
static void onDeadReference()
|
||||
{
|
||||
throw std::runtime_error("dead reference!");
|
||||
}
|
||||
|
||||
static void DestroySingleton()
|
||||
{
|
||||
CreatePolicy<T>::destroy(pInstance_);
|
||||
pInstance_ = 0;
|
||||
destroyed_ = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
static mutex mutex_;
|
||||
#ifdef __SUNPRO_CC
|
||||
/* Sun's C++ compiler will issue the following errors if CreatePolicy<T> is used:
|
||||
Error: A class template name was expected instead of mapnik::CreatePolicy<mapnik::T>
|
||||
Error: A "friend" declaration must specify a class or function.
|
||||
*/
|
||||
friend class CreatePolicy;
|
||||
#else
|
||||
friend class CreatePolicy<T>;
|
||||
#endif
|
||||
singleton() {}
|
||||
public:
|
||||
static T& instance()
|
||||
{
|
||||
if (! pInstance_)
|
||||
static T* pInstance_;
|
||||
static bool destroyed_;
|
||||
singleton(const singleton &rhs);
|
||||
singleton& operator=(const singleton&);
|
||||
|
||||
static void onDeadReference()
|
||||
{
|
||||
throw std::runtime_error("dead reference!");
|
||||
}
|
||||
|
||||
static void DestroySingleton()
|
||||
{
|
||||
CreatePolicy<T>::destroy(pInstance_);
|
||||
pInstance_ = 0;
|
||||
destroyed_ = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
static mutex mutex_;
|
||||
#endif
|
||||
singleton() {}
|
||||
public:
|
||||
static T& instance()
|
||||
{
|
||||
if (! pInstance_)
|
||||
{
|
||||
if (destroyed_)
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
if (! pInstance_)
|
||||
{
|
||||
destroyed_ = false;
|
||||
onDeadReference();
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance_ = CreatePolicy<T>::create();
|
||||
if (destroyed_)
|
||||
{
|
||||
destroyed_ = false;
|
||||
onDeadReference();
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance_ = CreatePolicy<T>::create();
|
||||
|
||||
// register destruction
|
||||
std::atexit(&DestroySingleton);
|
||||
// register destruction
|
||||
std::atexit(&DestroySingleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
return *pInstance_;
|
||||
}
|
||||
return *pInstance_;
|
||||
}
|
||||
};
|
||||
};
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
|
||||
#endif
|
||||
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> T* singleton<T,CreatePolicy>::pInstance_=0;
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> bool singleton<T,CreatePolicy>::destroyed_=false;
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> T* singleton<T,CreatePolicy>::pInstance_=0;
|
||||
template <typename T,
|
||||
template <typename U> class CreatePolicy> bool singleton<T,CreatePolicy>::destroyed_=false;
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
// UTF8 <--> UTF16 conversion routines
|
||||
|
||||
MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr);
|
||||
MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str);
|
||||
|
||||
#endif // _WINDOWS
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "hash_variant.hpp"
|
||||
|
||||
// stl
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
|
@ -670,6 +668,13 @@ struct to_expression_string : public boost::static_visitor<std::string>
|
|||
return "'" + utf8 + "'";
|
||||
}
|
||||
|
||||
std::string operator() (value_integer val) const
|
||||
{
|
||||
std::string output;
|
||||
util::to_string(output,val);
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string operator() (value_double val) const
|
||||
{
|
||||
std::string output;
|
||||
|
@ -687,14 +692,6 @@ struct to_expression_string : public boost::static_visitor<std::string>
|
|||
boost::ignore_unused_variable_warning(val);
|
||||
return "null";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string operator() (T val) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
struct to_double : public boost::static_visitor<value_double>
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef MAPNIK_VALUE_ERROR_HPP
|
||||
#define MAPNIK_VALUE_ERROR_HPP
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,37 +1,62 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik 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
|
||||
#
|
||||
#
|
||||
|
||||
import os
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
PLUGIN_NAME = 'csv'
|
||||
|
||||
install_dest = env['MAPNIK_INPUT_PLUGINS_DEST']
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
""" % locals()
|
||||
)
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries = []
|
||||
libraries.append('mapnik')
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary(
|
||||
'../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS')
|
||||
)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(install_dest, TARGET)
|
||||
env.Alias('install', install_dest)
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS'))
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/feature_factory.hpp>
|
||||
|
@ -119,9 +120,15 @@ csv_datasource::csv_datasource(parameters const& params)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined (_WINDOWS)
|
||||
std::ifstream in(mapnik::utf8_to_utf16(filename_),std::ios_base::in | std::ios_base::binary);
|
||||
#else
|
||||
std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
#endif
|
||||
if (!in.is_open())
|
||||
{
|
||||
throw mapnik::datasource_exception("CSV Plugin: could not open: '" + filename_ + "'");
|
||||
}
|
||||
parse_csv(in,escape_, separator_, quote_);
|
||||
in.close();
|
||||
}
|
||||
|
@ -859,7 +866,7 @@ void csv_datasource::parse_csv(T & stream,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!feature_count > 0)
|
||||
if (feature_count < 1)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(csv) << "CSV Plugin: could not parse any lines of data";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,35 +22,47 @@
|
|||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'gdal'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
gdal_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
gdal_datasource.cpp
|
||||
gdal_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
# clear out and rebuild libs
|
||||
plugin_env['LIBS'] = [env['PLUGINS']['gdal']['lib']]
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
plugin_env['LIBS'].append('mapnik')
|
||||
plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND'])
|
||||
plugin_env['LIBS'].append(env['ICU_LIB_NAME'])
|
||||
libraries = [env['PLUGINS']['gdal']['lib']]
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd = 'gdal-config --dep-libs'
|
||||
plugin_env.ParseConfig(cmd)
|
||||
plugin_env['LIBS'].append('proj')
|
||||
libraries.append('proj')
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2012 Artem Pavlenko
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,7 +17,7 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
Import ('env')
|
||||
|
||||
|
@ -32,27 +32,45 @@ if not can_build:
|
|||
print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47'
|
||||
else:
|
||||
Import ('plugin_base')
|
||||
prefix = env['PREFIX']
|
||||
|
||||
PLUGIN_NAME = 'geojson'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
geojson_src = Split(
|
||||
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
geojson_datasource.cpp
|
||||
geojson_featureset.cpp
|
||||
"""
|
||||
)
|
||||
libraries = []
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries = []
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
if env['THREADING'] == 'multi':
|
||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../geojson', source=geojson_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/feature_kv_iterator.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
|
@ -106,7 +107,11 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
|||
|
||||
typedef std::istreambuf_iterator<char> base_iterator_type;
|
||||
|
||||
std::ifstream is(file_.c_str());
|
||||
#if defined (_WINDOWS)
|
||||
std::ifstream is(mapnik::utf8_to_utf16(file_),std::ios_base::in | std::ios_base::binary);
|
||||
#else
|
||||
std::ifstream is(file_.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
#endif
|
||||
boost::spirit::multi_pass<base_iterator_type> begin =
|
||||
boost::spirit::make_default_multi_pass(base_iterator_type(is));
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
#
|
||||
# Mapnik 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
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
kismet_src = Split(
|
||||
"""
|
||||
kismet_datasource.cpp
|
||||
kismet_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
libraries = []
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
if env['THREADING'] == 'multi':
|
||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../kismet', source=kismet_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
|
@ -1,291 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// network
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/boolean.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "kismet_datasource.hpp"
|
||||
#include "kismet_featureset.hpp"
|
||||
|
||||
#define MAX_TCP_BUFFER 4096 // maximum accepted TCP data block size
|
||||
|
||||
// If you change this also change the according kismet command length !
|
||||
#define MAX_KISMET_LINE 1024 // maximum length of a kismet command (assumed)
|
||||
#define KISMET_COMMAND "*NETWORK: \001%1024[^\001]\001 %1024s %d %lf %lf"
|
||||
|
||||
using mapnik::datasource;
|
||||
using mapnik::parameters;
|
||||
|
||||
DATASOURCE_PLUGIN(kismet_datasource)
|
||||
|
||||
using mapnik::box2d;
|
||||
using mapnik::coord2d;
|
||||
using mapnik::query;
|
||||
using mapnik::featureset_ptr;
|
||||
using mapnik::layer_descriptor;
|
||||
using mapnik::attribute_descriptor;
|
||||
using mapnik::datasource_exception;
|
||||
|
||||
boost::mutex knd_list_mutex;
|
||||
std::list<kismet_network_data> knd_list;
|
||||
const unsigned int queue_size = 20;
|
||||
|
||||
kismet_datasource::kismet_datasource(parameters const& params)
|
||||
: datasource(params),
|
||||
extent_(),
|
||||
extent_initialized_(false),
|
||||
type_(datasource::Vector),
|
||||
srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
|
||||
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
||||
{
|
||||
boost::optional<std::string> host = params.get<std::string>("host");
|
||||
if (host)
|
||||
{
|
||||
host_ = *host;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw datasource_exception("Kismet Plugin: missing <host> parameter");
|
||||
}
|
||||
|
||||
boost::optional<int> port = params.get<int>("port", 2501);
|
||||
if (port)
|
||||
{
|
||||
port_ = static_cast<unsigned>(*port);
|
||||
}
|
||||
|
||||
boost::optional<std::string> srs = params.get<std::string>("srs");
|
||||
if (srs)
|
||||
{
|
||||
srs_ = *srs;
|
||||
}
|
||||
|
||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
||||
if (ext)
|
||||
{
|
||||
extent_initialized_ = extent_.from_string(*ext);
|
||||
}
|
||||
|
||||
kismet_thread.reset(new boost::thread(boost::bind(&kismet_datasource::run, this, host_, port_)));
|
||||
}
|
||||
|
||||
kismet_datasource::~kismet_datasource()
|
||||
{
|
||||
}
|
||||
|
||||
const char * kismet_datasource::name()
|
||||
{
|
||||
return "kismet";
|
||||
}
|
||||
|
||||
mapnik::datasource::datasource_t kismet_datasource::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
box2d<double> kismet_datasource::envelope() const
|
||||
{
|
||||
return extent_;
|
||||
}
|
||||
|
||||
boost::optional<mapnik::datasource::geometry_t> kismet_datasource::get_geometry_type() const
|
||||
{
|
||||
return boost::optional<mapnik::datasource::geometry_t>(mapnik::datasource::Point);
|
||||
}
|
||||
|
||||
layer_descriptor kismet_datasource::get_descriptor() const
|
||||
{
|
||||
return desc_;
|
||||
}
|
||||
|
||||
featureset_ptr kismet_datasource::features(query const& q) const
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()";
|
||||
|
||||
// TODO: use box2d to filter bbox before adding to featureset_ptr
|
||||
// mapnik::box2d<double> const& e = q.get_bbox();
|
||||
|
||||
boost::mutex::scoped_lock lock(knd_list_mutex);
|
||||
return boost::make_shared<kismet_featureset>(knd_list,
|
||||
srs_,
|
||||
desc_.get_encoding());
|
||||
|
||||
// TODO: if illegal:
|
||||
// return featureset_ptr();
|
||||
}
|
||||
|
||||
featureset_ptr kismet_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()";
|
||||
|
||||
return featureset_ptr();
|
||||
}
|
||||
|
||||
void kismet_datasource::run(std::string const& ip_host, const unsigned int port)
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run";
|
||||
|
||||
int sockfd, n;
|
||||
struct sockaddr_in sock_addr;
|
||||
struct in_addr inadr;
|
||||
struct hostent* host;
|
||||
char buffer[MAX_TCP_BUFFER]; // TCP data send from kismet_server
|
||||
std::string command;
|
||||
|
||||
if (inet_aton(ip_host.c_str(), &inadr))
|
||||
{
|
||||
host = gethostbyaddr((char*)&inadr, sizeof(inadr), AF_INET);
|
||||
}
|
||||
else
|
||||
{
|
||||
host = gethostbyname(ip_host.c_str());
|
||||
}
|
||||
|
||||
if (host == NULL)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while searching host";
|
||||
return;
|
||||
}
|
||||
|
||||
sock_addr.sin_family = AF_INET;
|
||||
sock_addr.sin_port = htons(port);
|
||||
memcpy(&sock_addr.sin_addr, host->h_addr_list[0], sizeof(sock_addr.sin_addr));
|
||||
|
||||
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while creating socket";
|
||||
return;
|
||||
}
|
||||
|
||||
if (connect(sockfd, (struct sockaddr*) &sock_addr, sizeof(sock_addr)))
|
||||
{
|
||||
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error while connecting";
|
||||
return;
|
||||
}
|
||||
|
||||
command = "!1 ENABLE NETWORK ssid,bssid,wep,bestlat,bestlon\n";
|
||||
|
||||
if (write(sockfd, command.c_str(), command.length()) != (signed)command.length())
|
||||
{
|
||||
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error sending command to " << ip_host;
|
||||
|
||||
close(sockfd);
|
||||
return;
|
||||
}
|
||||
|
||||
char ssid[MAX_KISMET_LINE] = {};
|
||||
char bssid[MAX_KISMET_LINE] = {};
|
||||
double bestlat = 0;
|
||||
double bestlon = 0;
|
||||
int crypt = crypt_none;
|
||||
|
||||
// BUG: if kismet_server is active sending after mapnik was killed and then restarted the
|
||||
// assert is called. Needs to be analyzed!
|
||||
while ((n = read(sockfd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
assert(n < MAX_TCP_BUFFER);
|
||||
|
||||
buffer[n] = '\0';
|
||||
std::string bufferObj(buffer); // TCP data send from kismet_server as STL string
|
||||
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj;
|
||||
|
||||
std::string::size_type found = 0;
|
||||
std::string::size_type search_start = 0;
|
||||
std::string kismet_line; // contains a line from kismet_server
|
||||
do
|
||||
{
|
||||
found = bufferObj.find('\n', search_start);
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
kismet_line.assign(bufferObj, search_start, found - search_start);
|
||||
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line;
|
||||
|
||||
int param_number = 5; // the number of parameters to parse
|
||||
|
||||
// Attention: string length specified to the constant!
|
||||
if (sscanf (kismet_line.c_str(),
|
||||
KISMET_COMMAND,
|
||||
ssid,
|
||||
bssid,
|
||||
&crypt,
|
||||
&bestlat,
|
||||
&bestlon) == param_number)
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid
|
||||
<< ", bssid=" << bssid
|
||||
<< ", crypt=" << crypt
|
||||
<< ", bestlat=" << bestlat
|
||||
<< ", bestlon=" << bestlon;
|
||||
|
||||
kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt);
|
||||
|
||||
boost::mutex::scoped_lock lock(knd_list_mutex);
|
||||
|
||||
// the queue only grows to a max size
|
||||
if (knd_list.size () >= queue_size)
|
||||
{
|
||||
knd_list.pop_front();
|
||||
}
|
||||
|
||||
knd_list.push_back(knd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// do nothing if not matched!
|
||||
}
|
||||
|
||||
search_start = found + 1;
|
||||
}
|
||||
}
|
||||
while (found != std::string::npos);
|
||||
}
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while reading from socket";
|
||||
}
|
||||
|
||||
close(sockfd);
|
||||
|
||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run";
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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 KISMET_DATASOURCE_HPP
|
||||
#define KISMET_DATASOURCE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/query.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/coord.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
// stl
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "kismet_types.hpp"
|
||||
|
||||
class kismet_datasource : public mapnik::datasource
|
||||
{
|
||||
public:
|
||||
kismet_datasource(mapnik::parameters const& params);
|
||||
virtual ~kismet_datasource ();
|
||||
datasource::datasource_t type() const;
|
||||
static const char * name();
|
||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
||||
mapnik::box2d<double> envelope() const;
|
||||
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
|
||||
mapnik::layer_descriptor get_descriptor() const;
|
||||
|
||||
private:
|
||||
void run (std::string const& host, const unsigned int port);
|
||||
|
||||
mapnik::box2d<double> extent_;
|
||||
bool extent_initialized_;
|
||||
std::string host_;
|
||||
unsigned int port_;
|
||||
mapnik::datasource::datasource_t type_;
|
||||
std::string srs_;
|
||||
mapnik::layer_descriptor desc_;
|
||||
boost::shared_ptr<boost::thread> kismet_thread;
|
||||
};
|
||||
|
||||
#endif // KISMET_DATASOURCE_HPP
|
|
@ -1,97 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/feature_factory.hpp>
|
||||
|
||||
#include "kismet_featureset.hpp"
|
||||
|
||||
// boost
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
using mapnik::feature_ptr;
|
||||
using mapnik::geometry_type;
|
||||
using mapnik::geometry_utils;
|
||||
using mapnik::transcoder;
|
||||
using mapnik::feature_factory;
|
||||
|
||||
kismet_featureset::kismet_featureset(std::list<kismet_network_data> const& knd_list,
|
||||
std::string const& srs,
|
||||
std::string const& encoding)
|
||||
: knd_list_(knd_list),
|
||||
tr_(new transcoder(encoding)),
|
||||
feature_id_(1),
|
||||
knd_list_it(knd_list_.begin()),
|
||||
source_(srs),
|
||||
ctx_(boost::make_shared<mapnik::context_type>())
|
||||
{
|
||||
ctx_->push("internet_access");
|
||||
}
|
||||
|
||||
kismet_featureset::~kismet_featureset()
|
||||
{
|
||||
}
|
||||
|
||||
feature_ptr kismet_featureset::next()
|
||||
{
|
||||
if (knd_list_it != knd_list_.end ())
|
||||
{
|
||||
const kismet_network_data& knd = *knd_list_it;
|
||||
const std::string key = "internet_access";
|
||||
|
||||
std::string value;
|
||||
if (knd.crypt() == crypt_none)
|
||||
{
|
||||
value = "wlan_uncrypted";
|
||||
}
|
||||
else if (knd.crypt() == crypt_wep)
|
||||
{
|
||||
value = "wlan_wep";
|
||||
}
|
||||
else
|
||||
{
|
||||
value = "wlan_crypted";
|
||||
}
|
||||
|
||||
feature_ptr feature(feature_factory::create(ctx_,feature_id_));
|
||||
++feature_id_;
|
||||
|
||||
geometry_type* pt = new geometry_type(mapnik::Point);
|
||||
pt->move_to(knd.bestlon(), knd.bestlat());
|
||||
feature->add_geometry(pt);
|
||||
|
||||
feature->put(key, tr_->transcode(value.c_str()));
|
||||
|
||||
++knd_list_it;
|
||||
|
||||
return feature;
|
||||
}
|
||||
|
||||
return feature_ptr();
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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 KISMET_FEATURESET_HPP
|
||||
#define KISMET_FEATURESET_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//STL
|
||||
#include <list>
|
||||
|
||||
#include "kismet_types.hpp"
|
||||
|
||||
class kismet_featureset : public mapnik::Featureset
|
||||
{
|
||||
public:
|
||||
kismet_featureset(std::list<kismet_network_data> const& knd_list,
|
||||
std::string const& srs,
|
||||
std::string const& encoding);
|
||||
virtual ~kismet_featureset();
|
||||
mapnik::feature_ptr next();
|
||||
|
||||
private:
|
||||
std::list<kismet_network_data> const& knd_list_;
|
||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||
mapnik::value_integer feature_id_;
|
||||
std::list<kismet_network_data>::const_iterator knd_list_it;
|
||||
mapnik::projection source_;
|
||||
mapnik::context_ptr ctx_;
|
||||
};
|
||||
|
||||
#endif // KISMET_FEATURESET_HPP
|
|
@ -1,111 +0,0 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* 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 KISMET_TYPES_HPP
|
||||
#define KISMET_TYPES_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/params.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// this is a copy from packet.h from kismet 2007.10.R1
|
||||
enum crypt_type
|
||||
{
|
||||
crypt_none = 0,
|
||||
crypt_unknown = 1,
|
||||
crypt_wep = 2,
|
||||
crypt_layer3 = 4,
|
||||
// Derived from WPA headers
|
||||
crypt_wep40 = 8,
|
||||
crypt_wep104 = 16,
|
||||
crypt_tkip = 32,
|
||||
crypt_wpa = 64,
|
||||
crypt_psk = 128,
|
||||
crypt_aes_ocb = 256,
|
||||
crypt_aes_ccm = 512,
|
||||
// Derived from data traffic
|
||||
crypt_leap = 1024,
|
||||
crypt_ttls = 2048,
|
||||
crypt_tls = 4096,
|
||||
crypt_peap = 8192,
|
||||
crypt_isakmp = 16384,
|
||||
crypt_pptp = 32768,
|
||||
crypt_ccmp = 65536
|
||||
};
|
||||
|
||||
class kismet_network_data
|
||||
{
|
||||
public:
|
||||
kismet_network_data()
|
||||
: bestlat_(0), bestlon_(0), crypt_(crypt_none)
|
||||
{
|
||||
}
|
||||
|
||||
kismet_network_data(std::string ssid,
|
||||
std::string bssid,
|
||||
double bestlat,
|
||||
double bestlon,
|
||||
int crypt)
|
||||
: ssid_(ssid),
|
||||
bssid_(bssid),
|
||||
bestlat_(bestlat),
|
||||
bestlon_(bestlon),
|
||||
crypt_(crypt)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& ssid() const
|
||||
{
|
||||
return ssid_;
|
||||
}
|
||||
|
||||
std::string const& bssid() const
|
||||
{
|
||||
return bssid_;
|
||||
}
|
||||
|
||||
double bestlat() const
|
||||
{
|
||||
return bestlat_;
|
||||
}
|
||||
|
||||
double bestlon() const
|
||||
{
|
||||
return bestlon_;
|
||||
}
|
||||
|
||||
int crypt() const
|
||||
{
|
||||
return crypt_;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string ssid_;
|
||||
std::string bssid_;
|
||||
double bestlat_;
|
||||
double bestlon_;
|
||||
int crypt_;
|
||||
};
|
||||
|
||||
#endif // KISMET_TYPES_HPP
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,35 +17,49 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'occi'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
occi_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
occi_types.cpp
|
||||
occi_datasource.cpp
|
||||
occi_featureset.cpp
|
||||
%(PLUGIN_NAME)s_types.cpp
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
spatial_classesm.cpp
|
||||
spatial_classeso.cpp
|
||||
"""
|
||||
)
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
libraries = [ 'occi', 'ociei' ]
|
||||
libraries.append('mapnik')
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../occi', source=occi_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,50 +17,67 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'ogr'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
ogr_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
ogr_converter.cpp
|
||||
ogr_datasource.cpp
|
||||
ogr_featureset.cpp
|
||||
ogr_index_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
plugin_env['LIBS'] = [env['PLUGINS']['ogr']['lib']]
|
||||
%(PLUGIN_NAME)s_converter.cpp
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
%(PLUGIN_NAME)s_index_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
plugin_env['LIBS'].append('mapnik')
|
||||
plugin_env['LIBS'].append(env['ICU_LIB_NAME'])
|
||||
plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND'])
|
||||
plugin_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
libraries = [env['PLUGINS']['ogr']['lib']]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
cxxflags = []
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd = 'gdal-config --dep-libs'
|
||||
plugin_env.ParseConfig(cmd)
|
||||
plugin_env['LIBS'].append('proj')
|
||||
libraries.append('proj')
|
||||
|
||||
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
|
||||
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
|
||||
if boost_version_from_header < 46:
|
||||
# avoid ubuntu issue with boost interprocess:
|
||||
# https://github.com/mapnik/mapnik/issues/1082
|
||||
plugin_env.Append(CXXFLAGS = '-fpermissive')
|
||||
cxxflags.Append('-fpermissive')
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../ogr', source=ogr_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
plugin_env.Append(CXXFLAGS=cxxflags)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'CXXFLAGS': cxxflags,
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -82,7 +82,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
|
|||
|
||||
// initialize ogr formats
|
||||
OGRRegisterAll();
|
||||
|
||||
|
||||
boost::optional<std::string> file = params.get<std::string>("file");
|
||||
boost::optional<std::string> string = params.get<std::string>("string");
|
||||
if (! file && ! string)
|
||||
|
@ -525,7 +525,7 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol)
|
|||
|
||||
if (indexed_)
|
||||
{
|
||||
filter_at_point filter(pt);
|
||||
filter_at_point filter(pt, tol);
|
||||
|
||||
return featureset_ptr(new ogr_index_featureset<filter_at_point> (ctx,
|
||||
*layer,
|
||||
|
|
|
@ -59,7 +59,8 @@ ogr_index_featureset<filterT>::ogr_index_featureset(mapnik::context_ptr const &
|
|||
layerdef_(layer.GetLayerDefn()),
|
||||
filter_(filter),
|
||||
tr_(new transcoder(encoding)),
|
||||
fidcolumn_(layer_.GetFIDColumn())
|
||||
fidcolumn_(layer_.GetFIDColumn()),
|
||||
feature_envelope_()
|
||||
{
|
||||
|
||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(index_file, true);
|
||||
|
@ -104,6 +105,9 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
|||
OGRGeometry* geom=poFeature->GetGeometryRef();
|
||||
if (geom && !geom->IsEmpty())
|
||||
{
|
||||
geom->getEnvelope(&feature_envelope_);
|
||||
if (!filter_.pass(mapnik::box2d<double>(feature_envelope_.MinX,feature_envelope_.MinY,
|
||||
feature_envelope_.MaxX,feature_envelope_.MaxY))) continue;
|
||||
ogr_converter::convert_geometry (geom, feature);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
std::vector<int>::iterator itr_;
|
||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||
const char* fidcolumn_;
|
||||
OGREnvelope feature_envelope_;
|
||||
};
|
||||
|
||||
#endif // OGR_INDEX_FEATURESET_HPP
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,38 +17,53 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'osm'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
osm_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s.cpp
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
osmparser.cpp
|
||||
osm.cpp
|
||||
osm_datasource.cpp
|
||||
osm_featureset.cpp
|
||||
dataset_deliverer.cpp
|
||||
basiccurl.cpp
|
||||
"""
|
||||
)
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries = [ 'xml2' ]
|
||||
libraries.append('curl')
|
||||
libraries.append('mapnik')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../osm', source=osm_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,44 +17,57 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'postgis'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
postgis_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
postgis_datasource.cpp
|
||||
postgis_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
# clear out and rebuild libs
|
||||
plugin_env['LIBS'] = ['pq']
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
plugin_env['LIBS'].append('mapnik')
|
||||
plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND'])
|
||||
plugin_env['LIBS'].append(env['ICU_LIB_NAME'])
|
||||
libraries = ['pq']
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
if env['THREADING'] == 'multi':
|
||||
plugin_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
#cmd = 'pg_config --libs'
|
||||
#plugin_env.ParseConfig(cmd)
|
||||
# pg_config does not seem to report correct deps of libpq
|
||||
# so resort to hardcoding for now
|
||||
plugin_env['LIBS'].extend(['ldap','pam','ssl','crypto','krb5'])
|
||||
libraries.extend(['ldap', 'pam', 'ssl', 'crypto', 'krb5'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -117,14 +117,21 @@ feature_ptr postgis_featureset::next()
|
|||
++feature_id_;
|
||||
}
|
||||
|
||||
// null geometry is not acceptable
|
||||
if (rs_->isNull(0))
|
||||
{
|
||||
MAPNIK_LOG_WARN(postgis) << "postgis_featureset: null value encountered for geometry";
|
||||
continue;
|
||||
}
|
||||
|
||||
// parse geometry
|
||||
int size = rs_->getFieldLength(0);
|
||||
const char *data = rs_->getValue(0);
|
||||
|
||||
if (!geometry_utils::from_wkb(feature->paths(), data, size))
|
||||
continue;
|
||||
|
||||
totalGeomSize_ += size;
|
||||
|
||||
unsigned num_attrs = ctx_->size() + 1;
|
||||
for (; pos < num_attrs; ++pos)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik 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
|
||||
#
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
PLUGIN_NAME = 'python'
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
install_dest = env['MAPNIK_INPUT_PLUGINS_DEST']
|
||||
PLUGIN_NAME = 'python'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
|
@ -17,26 +33,32 @@ plugin_sources = Split(
|
|||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
%(PLUGIN_NAME)s_utils.cpp
|
||||
""" % locals()
|
||||
)
|
||||
)
|
||||
|
||||
boost_system = 'boost_system%s' % env['BOOST_APPEND']
|
||||
libraries = ['mapnik',env['BOOST_PYTHON_LIB'],boost_system,env['ICU_LIB_NAME']]
|
||||
# Link Library to Dependencies
|
||||
libraries = []
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['BOOST_PYTHON_LIB'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
python_cpppath = env['PYTHON_INCLUDES']
|
||||
allcpp_paths = env['CPPPATH']
|
||||
allcpp_paths.extend(python_cpppath)
|
||||
# NOTE: explicit linking to libpython is uneeded on most linux version if the
|
||||
# python plugin is used by a app in python using mapnik's python bindings
|
||||
# we explicitly link to libpython here so that this plugin
|
||||
# can be used from a pure C++ calling application or a different binding language
|
||||
if env['PLATFORM'] == 'Darwin' and env['FRAMEWORK_PYTHON']:
|
||||
if env['FRAMEWORK_SEARCH_PATH']:
|
||||
python_link_flag = '-F%s -framework Python -Z' % env['FRAMEWORK_SEARCH_PATH']
|
||||
if env['FRAMEWORK_SEARCH_PATH']:
|
||||
python_link_flag = '-F%s -framework Python -Z' % env['FRAMEWORK_SEARCH_PATH']
|
||||
else:
|
||||
link_prefix = env['PYTHON_SYS_PREFIX']
|
||||
if '.framework' in link_prefix:
|
||||
python_link_flag = '-F%s -framework Python -Z' % os.path.dirname(link_prefix.split('.')[0])
|
||||
elif '/System' in link_prefix:
|
||||
python_link_flag = '-F/System/Library/Frameworks/ -framework Python -Z'
|
||||
else:
|
||||
link_prefix = env['PYTHON_SYS_PREFIX']
|
||||
if '.framework' in link_prefix:
|
||||
python_link_flag = '-F%s -framework Python -Z' % os.path.dirname(link_prefix.split('.')[0])
|
||||
elif '/System' in link_prefix:
|
||||
python_link_flag = '-F/System/Library/Frameworks/ -framework Python -Z'
|
||||
else:
|
||||
python_link_flag = '-F/ -framework Python'
|
||||
python_link_flag = '-F/ -framework Python'
|
||||
else:
|
||||
# on linux the linkflags end up to early in the compile flags to work correctly
|
||||
python_link_flag = '-L%s' % env['PYTHON_SYS_PREFIX'] + os.path.sep + env['LIBDIR_SCHEMA']
|
||||
|
@ -48,33 +70,31 @@ if env['CUSTOM_LDFLAGS']:
|
|||
else:
|
||||
linkflags = python_link_flag
|
||||
|
||||
plugin_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary(
|
||||
# the name of the target to build, eg 'sqlite.input'
|
||||
'../%s' % PLUGIN_NAME,
|
||||
# prefix - normally none used
|
||||
SHLIBPREFIX='',
|
||||
# extension, mapnik expects '.input'
|
||||
SHLIBSUFFIX='.input',
|
||||
# list of source files to compile
|
||||
source=plugin_sources,
|
||||
# libraries to link to
|
||||
LIBS=libraries,
|
||||
# any custom linkflags, eg. LDFLAGS
|
||||
# in this case CUSTOM_LDFLAGS comes
|
||||
# from Mapnik's main SConstruct file
|
||||
# and can be removed here if you do
|
||||
# not need it
|
||||
LINKFLAGS=linkflags
|
||||
)
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
CPPPATH=allcpp_paths,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=linkflags)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
# if 'uninstall' is not passed on the command line
|
||||
# then we actually create the install targets that
|
||||
# scons will install if 'install' is passed as an arg
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(install_dest, TARGET)
|
||||
env.Alias('install', install_dest)
|
||||
# if 'uninstall' is not passed on the command line
|
||||
# then we actually create the install targets that
|
||||
# scons will install if 'install' is passed as an arg
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
'CPPPATH': python_cpppath,
|
||||
'LINKFLAGS': linkflags.replace('-Z','').split(' '),
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,35 +17,49 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'raster'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
raster_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
raster_datasource.cpp
|
||||
raster_featureset.cpp
|
||||
raster_info.cpp
|
||||
"""
|
||||
)
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
%(PLUGIN_NAME)s_info.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
libraries = []
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries = []
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,35 +17,48 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'rasterlite'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
rasterlite_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
rasterlite_datasource.cpp
|
||||
rasterlite_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
libraries = [env['PLUGINS']['rasterlite']['lib']]
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries = [env['PLUGINS']['rasterlite']['lib']]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../rasterlite', source=rasterlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,50 +17,70 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'shape'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
shape_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
dbfile.cpp
|
||||
shape_datasource.cpp
|
||||
shape_featureset.cpp
|
||||
shape_index_featureset.cpp
|
||||
shape_io.cpp
|
||||
shape_utils.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
libraries = []
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
%(PLUGIN_NAME)s_index_featureset.cpp
|
||||
%(PLUGIN_NAME)s_io.cpp
|
||||
%(PLUGIN_NAME)s_utils.cpp
|
||||
dbfile.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries = []
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
cppdefines = []
|
||||
cxxflags = []
|
||||
|
||||
if env['SHAPE_MEMORY_MAPPED_FILE']:
|
||||
plugin_env.Append(CPPDEFINES = '-DSHAPE_MEMORY_MAPPED_FILE')
|
||||
cppdefines.append('-DSHAPE_MEMORY_MAPPED_FILE')
|
||||
|
||||
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
|
||||
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
|
||||
if boost_version_from_header < 46:
|
||||
# avoid ubuntu issue with boost interprocess:
|
||||
# https://github.com/mapnik/mapnik/issues/1082
|
||||
plugin_env.Append(CXXFLAGS = '-fpermissive')
|
||||
cxxflags.append('-fpermissive')
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
plugin_env.Append(CXXFLAGS=cxxflags)
|
||||
plugin_env.Append(CPPDEFINES=cppdefines)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
TARGET = plugin_env.SharedLibrary('../shape',
|
||||
SHLIBSUFFIX='.input',
|
||||
SHLIBPREFIX='',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
'CXXFLAGS': cxxflags,
|
||||
'CPPDEFINES': cppdefines,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -50,6 +50,8 @@ dbf_file::dbf_file(std::string const& file_name)
|
|||
record_length_(0),
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
file_(),
|
||||
#elif defined(_WINDOWS)
|
||||
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary),
|
||||
#else
|
||||
file_(file_name.c_str() ,std::ios::in | std::ios::binary),
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
* Copyright (C) 2013 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -34,6 +34,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/boolean.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
@ -76,18 +77,28 @@ shape_datasource::shape_datasource(const parameters ¶ms)
|
|||
shape_name_ = *file;
|
||||
|
||||
boost::algorithm::ireplace_last(shape_name_,".shp","");
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (!boost::filesystem::exists(mapnik::utf8_to_utf16(shape_name_) + L".shp"))
|
||||
#else
|
||||
if (!boost::filesystem::exists(shape_name_ + ".shp"))
|
||||
#endif
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' does not exist");
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::is_directory(mapnik::utf8_to_utf16(shape_name_) + L".shp"))
|
||||
#else
|
||||
if (boost::filesystem::is_directory(shape_name_ + ".shp"))
|
||||
#endif
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' appears to be a directory not a file");
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (!boost::filesystem::exists(mapnik::utf8_to_utf16(shape_name_) + L".dbf"))
|
||||
#else
|
||||
if (!boost::filesystem::exists(shape_name_ + ".dbf"))
|
||||
#endif
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".dbf' does not exist");
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/mapped_memory_cache.hpp>
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
|
@ -149,6 +150,8 @@ public:
|
|||
shape_file(std::string const& file_name) :
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
file_()
|
||||
#elif defined (_WINDOWS)
|
||||
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary)
|
||||
#else
|
||||
file_(file_name.c_str(), std::ios::in | std::ios::binary)
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
|
||||
# Copyright (C) 2013 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,39 +17,54 @@
|
|||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
prefix = env['PREFIX']
|
||||
PLUGIN_NAME = 'sqlite'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
sqlite_src = Split(
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
sqlite_datasource.cpp
|
||||
sqlite_featureset.cpp
|
||||
"""
|
||||
)
|
||||
|
||||
libraries = [ 'sqlite3' ]
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries.append('mapnik')
|
||||
libraries = [ 'sqlite3' ]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
linkflags = env['CUSTOM_LDFLAGS']
|
||||
linkflags = []
|
||||
if env['SQLITE_LINKFLAGS']:
|
||||
linkflags.append(env['SQLITE_LINKFLAGS'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../sqlite', source=sqlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=linkflags)
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
linkflags.append(env['CUSTOM_LDFLAGS'])
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=(' ').join(linkflags))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
'LINKFLAGS': linkflags,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -90,7 +90,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
else
|
||||
dataset_name_ = *file;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!boost::filesystem::exists(mapnik::utf8_to_utf16(dataset_name_))))
|
||||
#else
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!boost::filesystem::exists(dataset_name_)))
|
||||
#endif
|
||||
{
|
||||
throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist");
|
||||
}
|
||||
|
@ -280,7 +284,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::init(use_spatial_index)");
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::exists(mapnik::utf8_to_utf16(index_db)))
|
||||
#else
|
||||
if (boost::filesystem::exists(index_db))
|
||||
#endif
|
||||
{
|
||||
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
|
||||
}
|
||||
|
@ -318,7 +326,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
{
|
||||
//extent_initialized_ = true;
|
||||
has_spatial_index_ = true;
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::exists(mapnik::utf8_to_utf16(index_db)))
|
||||
#else
|
||||
if (boost::filesystem::exists(index_db))
|
||||
#endif
|
||||
{
|
||||
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
|
||||
}
|
||||
|
@ -436,12 +448,20 @@ void sqlite_datasource::parse_attachdb(std::string const& attachdb) const
|
|||
// Normalize the filename and make it relative to dataset_name_
|
||||
if (filename.compare(":memory:") != 0)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path child_path(mapnik::utf8_to_utf16(filename));
|
||||
#else
|
||||
boost::filesystem::path child_path(filename);
|
||||
#endif
|
||||
|
||||
// It is a relative path. Fix it.
|
||||
if (! child_path.has_root_directory() && ! child_path.has_root_name())
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path absolute_path(mapnik::utf8_to_utf16(dataset_name_));
|
||||
#else
|
||||
boost::filesystem::path absolute_path(dataset_name_);
|
||||
#endif
|
||||
|
||||
// support symlinks
|
||||
if (boost::filesystem::is_symlink(absolute_path))
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
@ -235,7 +236,11 @@ public:
|
|||
int flags;
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
bool existed = boost::filesystem::exists(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
bool existed = boost::filesystem::exists(index_db);
|
||||
#endif
|
||||
boost::shared_ptr<sqlite_connection> ds = boost::make_shared<sqlite_connection>(index_db,flags);
|
||||
|
||||
bool one_success = false;
|
||||
|
@ -328,8 +333,12 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
throw mapnik::datasource_exception(ex.what());
|
||||
|
@ -344,7 +353,11 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
@ -413,7 +426,13 @@ public:
|
|||
int flags;
|
||||
#endif
|
||||
|
||||
bool existed = boost::filesystem::exists(index_db);
|
||||
#ifdef _WINDOWS
|
||||
bool existed = boost::filesystem::exists(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
bool existed = boost::filesystem::exists(index_db);;
|
||||
#endif
|
||||
|
||||
|
||||
boost::shared_ptr<sqlite_connection> ds = boost::make_shared<sqlite_connection>(index_db,flags);
|
||||
|
||||
bool one_success = false;
|
||||
|
@ -460,7 +479,11 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
@ -476,7 +499,11 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
|
|
@ -11,21 +11,17 @@
|
|||
|
||||
import os
|
||||
|
||||
# Give this plugin a name
|
||||
# here this happens to be the same as the directory
|
||||
PLUGIN_NAME = 'hello'
|
||||
|
||||
# Here we pull from the SCons environment exported from the main instance
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
# Give this plugin a name
|
||||
# here this happens to be the same as the directory
|
||||
PLUGIN_NAME = 'hello'
|
||||
|
||||
# the below install details are also pulled from the
|
||||
# main SConstruct file where configuration happens
|
||||
|
||||
# plugins can go anywhere, and be registered in custom locations by Mapnik
|
||||
# but the standard location is '/usr/local/lib/mapnik/input'
|
||||
install_dest = env['MAPNIK_INPUT_PLUGINS_DEST']
|
||||
|
||||
# clone the environment here
|
||||
# so that if we modify the env it in this file
|
||||
# those changes to not pollute other builds later on...
|
||||
|
@ -35,7 +31,7 @@ plugin_env = plugin_base.Clone()
|
|||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
%(PLUGIN_NAME)s_featureset.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
|
@ -43,37 +39,54 @@ plugin_sources = Split(
|
|||
# directly link to
|
||||
libraries = [ '' ] # eg 'libfoo'
|
||||
|
||||
libraries.append('mapnik')
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
# link libicuuc, but ICU_LIB_NAME is used custom builds of icu can
|
||||
# have different library names like osx which offers /usr/lib/libicucore.dylib
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary(
|
||||
# the name of the target to build, eg 'sqlite.input'
|
||||
'../%s' % PLUGIN_NAME,
|
||||
# prefix - normally none used
|
||||
SHLIBPREFIX='',
|
||||
# extension, mapnik expects '.input'
|
||||
SHLIBSUFFIX='.input',
|
||||
# list of source files to compile
|
||||
source=plugin_sources,
|
||||
# libraries to link to
|
||||
LIBS=libraries,
|
||||
# any custom linkflags, eg. LDFLAGS
|
||||
# in this case CUSTOM_LDFLAGS comes
|
||||
# from Mapnik's main SConstruct file
|
||||
# and can be removed here if you do
|
||||
# not need it
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS')
|
||||
)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
# this is valid if we are building an external plugin as shared library
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
# plugins can go anywhere, and be registered in custom locations by Mapnik
|
||||
# but the standard location is '/usr/local/lib/mapnik/input'
|
||||
install_dest = env['MAPNIK_INPUT_PLUGINS_DEST']
|
||||
|
||||
# if 'uninstall' is not passed on the command line
|
||||
# then we actually create the install targets that
|
||||
# scons will install if 'install' is passed as an arg
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(install_dest, TARGET)
|
||||
env.Alias('install', install_dest)
|
||||
# only link mapnik if we are build an external shared object
|
||||
libraries.append('mapnik')
|
||||
|
||||
TARGET = plugin_env.SharedLibrary(
|
||||
# the name of the target to build, eg 'sqlite.input'
|
||||
'../%s' % PLUGIN_NAME,
|
||||
# prefix - normally none used
|
||||
SHLIBPREFIX='',
|
||||
# extension, mapnik expects '.input'
|
||||
SHLIBSUFFIX='.input',
|
||||
# list of source files to compile
|
||||
source=plugin_sources,
|
||||
# libraries to link to
|
||||
LIBS=libraries,
|
||||
# any custom linkflags, eg. LDFLAGS
|
||||
# in this case CUSTOM_LDFLAGS comes
|
||||
# from Mapnik's main SConstruct file
|
||||
# and can be removed here if you do
|
||||
# not need it
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS')
|
||||
)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
# if 'uninstall' is not passed on the command line
|
||||
# then we actually create the install targets that
|
||||
# scons will install if 'install' is passed as an arg
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(install_dest, TARGET)
|
||||
env.Alias('install', install_dest)
|
||||
|
||||
# Return the plugin building options to scons
|
||||
# This is used when statically linking the plugin with mapnik)
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
|
@ -52,10 +52,37 @@ void agg_renderer<T>::process(debug_symbolizer const& sym,
|
|||
mapnik::feature_impl & feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
label_collision_detector4::query_iterator itr = detector_->begin(), end = detector_->end();
|
||||
for (;itr!=end; itr++)
|
||||
debug_symbolizer_mode_e mode = sym.get_mode();
|
||||
if (mode == DEBUG_SYM_MODE_COLLISION)
|
||||
{
|
||||
draw_rect(pixmap_, itr->box);
|
||||
label_collision_detector4::query_iterator itr = detector_->begin(), end = detector_->end();
|
||||
for (;itr!=end; itr++)
|
||||
{
|
||||
draw_rect(pixmap_, itr->box);
|
||||
}
|
||||
}
|
||||
else if (mode == DEBUG_SYM_MODE_VERTEX)
|
||||
{
|
||||
for (unsigned i=0; i<feature.num_geometries(); ++i)
|
||||
{
|
||||
geometry_type const& geom = feature.get_geometry(i);
|
||||
double x;
|
||||
double y;
|
||||
double z = 0;
|
||||
geom.rewind(0);
|
||||
unsigned cmd = 1;
|
||||
while ((cmd = geom.vertex(&x, &y)) != mapnik::SEG_END)
|
||||
{
|
||||
if (cmd == SEG_CLOSE) continue;
|
||||
prj_trans.backward(x,y,z);
|
||||
t_.forward(&x,&y);
|
||||
pixmap_.setPixel(x,y,0xff0000ff);
|
||||
pixmap_.setPixel(x-1,y-1,0xff0000ff);
|
||||
pixmap_.setPixel(x+1,y+1,0xff0000ff);
|
||||
pixmap_.setPixel(x-1,y+1,0xff0000ff);
|
||||
pixmap_.setPixel(x+1,y-1,0xff0000ff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
44
src/build.py
44
src/build.py
|
@ -81,7 +81,6 @@ lib_env['LIBS'].append('xml2')
|
|||
if env['THREADING'] == 'multi':
|
||||
lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
if 'icuuc' in env['ICU_LIB_NAME']:
|
||||
lib_env['LIBS'].append('icudata')
|
||||
|
@ -111,6 +110,7 @@ else: # unix, non-macos
|
|||
source = Split(
|
||||
"""
|
||||
marker.cpp
|
||||
debug_symbolizer.cpp
|
||||
request.cpp
|
||||
well_known_srs.cpp
|
||||
params.cpp
|
||||
|
@ -125,6 +125,7 @@ source = Split(
|
|||
box2d.cpp
|
||||
building_symbolizer.cpp
|
||||
datasource_cache.cpp
|
||||
datasource_cache_static.cpp
|
||||
debug.cpp
|
||||
deepcopy.cpp
|
||||
expression_node.cpp
|
||||
|
@ -208,9 +209,31 @@ source = Split(
|
|||
"""
|
||||
)
|
||||
|
||||
if env['PLUGIN_LINKING'] == 'static':
|
||||
lib_env.Append(CPPDEFINES = '-DMAPNIK_STATIC_PLUGINS')
|
||||
for plugin in env['REQUESTED_PLUGINS']:
|
||||
details = env['PLUGINS'][plugin]
|
||||
if details['lib'] in env['LIBS'] or not details['lib']:
|
||||
lib_env.Append(CPPDEFINES = '-DMAPNIK_STATIC_PLUGIN_%s' % plugin.upper())
|
||||
plugin_env = SConscript('../plugins/input/%s/build.py' % plugin)
|
||||
if plugin_env.has_key('SOURCES') and plugin_env['SOURCES']:
|
||||
source += ['../plugins/input/%s/%s' % (plugin, src) for src in plugin_env['SOURCES']]
|
||||
if plugin_env.has_key('CPPDEFINES') and plugin_env['CPPDEFINES']:
|
||||
lib_env.AppendUnique(CPPDEFINES=plugin_env['CPPDEFINES'])
|
||||
if plugin_env.has_key('CXXFLAGS') and plugin_env['CXXFLAGS']:
|
||||
lib_env.AppendUnique(CXXFLAGS=plugin_env['CXXFLAGS'])
|
||||
if plugin_env.has_key('LINKFLAGS') and plugin_env['LINKFLAGS']:
|
||||
lib_env.AppendUnique(LINKFLAGS=plugin_env['LINKFLAGS'])
|
||||
if plugin_env.has_key('CPPPATH') and plugin_env['CPPPATH']:
|
||||
lib_env.AppendUnique(CPPPATH=copy(plugin_env['CPPPATH']))
|
||||
if plugin_env.has_key('LIBS') and plugin_env['LIBS']:
|
||||
lib_env.AppendUnique(LIBS=plugin_env['LIBS'])
|
||||
else:
|
||||
print("Notice: dependencies not met for plugin '%s', not building..." % plugin)
|
||||
|
||||
if env['HAS_CAIRO']:
|
||||
lib_env.AppendUnique(LIBPATH=env['CAIRO_LIBPATHS'])
|
||||
lib_env.Append(LIBS=env['CAIRO_LINKFLAGS'])
|
||||
lib_env.Append(LIBS=env['CAIRO_ALL_LIBS'])
|
||||
lib_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
libmapnik_defines.append('-DHAVE_CAIRO')
|
||||
lib_env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
|
||||
|
@ -351,13 +374,17 @@ if env['RENDERING_STATS']:
|
|||
else:
|
||||
source.insert(0,processor_cpp);
|
||||
|
||||
# clone the env one more time to isolate mapnik_lib_link_flag
|
||||
lib_env_final = lib_env.Clone()
|
||||
|
||||
if env['CUSTOM_LDFLAGS']:
|
||||
linkflags = '%s %s' % (env['CUSTOM_LDFLAGS'], mapnik_lib_link_flag)
|
||||
lib_env_final.Prepend(LINKFLAGS='%s %s' % (env['CUSTOM_LDFLAGS'], mapnik_lib_link_flag))
|
||||
else:
|
||||
linkflags = mapnik_lib_link_flag
|
||||
lib_env_final.Prepend(LINKFLAGS=mapnik_lib_link_flag)
|
||||
|
||||
# cache library values for other builds to use
|
||||
env['LIBMAPNIK_LIBS'] = copy(lib_env['LIBS'])
|
||||
env['LIBMAPNIK_LINKFLAGS'] = copy(lib_env['LINKFLAGS'])
|
||||
env['LIBMAPNIK_CXXFLAGS'] = libmapnik_cxxflags
|
||||
env['LIBMAPNIK_DEFINES'] = libmapnik_defines
|
||||
|
||||
|
@ -367,9 +394,9 @@ if env['PLATFORM'] == 'Darwin':
|
|||
target_path = env['MAPNIK_LIB_BASE_DEST']
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
if env['LINKING'] == 'static':
|
||||
mapnik = lib_env.StaticLibrary('mapnik', source, LINKFLAGS=linkflags)
|
||||
mapnik = lib_env_final.StaticLibrary('mapnik', source)
|
||||
else:
|
||||
mapnik = lib_env.SharedLibrary('mapnik', source, LINKFLAGS=linkflags)
|
||||
mapnik = lib_env_final.SharedLibrary('mapnik', source)
|
||||
result = env.Install(target_path, mapnik)
|
||||
env.Alias(target='install', source=result)
|
||||
|
||||
|
@ -391,15 +418,14 @@ else:
|
|||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
if env['LINKING'] == 'static':
|
||||
mapnik = lib_env.StaticLibrary('mapnik', source, LINKFLAGS=linkflags)
|
||||
mapnik = lib_env_final.StaticLibrary('mapnik', source)
|
||||
else:
|
||||
mapnik = lib_env.SharedLibrary('mapnik', source, LINKFLAGS=linkflags)
|
||||
mapnik = lib_env_final.SharedLibrary('mapnik', source)
|
||||
result = env.InstallAs(target=target, source=mapnik)
|
||||
env.Alias(target='install', source=result)
|
||||
if result:
|
||||
env.AddPostAction(result, ldconfig)
|
||||
|
||||
|
||||
# Install symlinks
|
||||
target1 = os.path.join(env['MAPNIK_LIB_BASE_DEST'], "%s.%d.%d" % \
|
||||
(os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])),int(major), int(minor)))
|
||||
|
|
|
@ -669,6 +669,15 @@ void cairo_renderer_base::process(point_symbolizer const& sym,
|
|||
|
||||
if (marker)
|
||||
{
|
||||
box2d<double> const& bbox = (*marker)->bounding_box();
|
||||
coord2d center = bbox.center();
|
||||
|
||||
agg::trans_affine tr;
|
||||
evaluate_transform(tr, feature, sym.get_image_transform());
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
agg::trans_affine recenter_tr = recenter * tr;
|
||||
box2d<double> label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_);
|
||||
|
||||
for (unsigned i = 0; i < feature.num_geometries(); ++i)
|
||||
{
|
||||
geometry_type const& geom = feature.get_geometry(i);
|
||||
|
@ -689,15 +698,7 @@ void cairo_renderer_base::process(point_symbolizer const& sym,
|
|||
|
||||
prj_trans.backward(x, y, z);
|
||||
t_.forward(&x, &y);
|
||||
|
||||
double dx = 0.5 * (*marker)->width();
|
||||
double dy = 0.5 * (*marker)->height();
|
||||
agg::trans_affine tr;
|
||||
evaluate_transform(tr, feature, sym.get_image_transform());
|
||||
box2d<double> label_ext (-dx, -dy, dx, dy);
|
||||
label_ext *= tr;
|
||||
label_ext *= agg::trans_affine_translation(x,y);
|
||||
label_ext *= agg::trans_affine_scaling(scale_factor_);
|
||||
label_ext.re_center(x,y);
|
||||
if (sym.get_allow_overlap() ||
|
||||
detector_->has_placement(label_ext))
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#if BOOST_VERSION >= 104500
|
||||
|
||||
#include <mapnik/css_color_grammar_def.hpp>
|
||||
#include <mapnik/css_color_grammar_impl.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
namespace mapnik {
|
||||
|
||||
extern datasource_ptr create_static_datasource(parameters const& params);
|
||||
extern std::vector<std::string> get_static_datasource_names();
|
||||
|
||||
bool is_input_plugin(std::string const& filename)
|
||||
{
|
||||
return boost::algorithm::ends_with(filename,std::string(".input"));
|
||||
|
@ -62,13 +65,23 @@ datasource_ptr datasource_cache::create(parameters const& params)
|
|||
"parameter 'type' is missing");
|
||||
}
|
||||
|
||||
datasource_ptr ds;
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
// return if it's created, raise otherwise
|
||||
ds = create_static_datasource(params);
|
||||
if (ds)
|
||||
{
|
||||
return ds;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MAPNIK_THREADSAFE
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
|
||||
datasource_ptr ds;
|
||||
std::map<std::string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(*type);
|
||||
if ( itr == plugins_.end() )
|
||||
if (itr == plugins_.end())
|
||||
{
|
||||
std::string s("Could not create datasource for type: '");
|
||||
s += *type + "'";
|
||||
|
@ -83,7 +96,7 @@ datasource_ptr datasource_cache::create(parameters const& params)
|
|||
throw config_error(s);
|
||||
}
|
||||
|
||||
if (!itr->second->valid())
|
||||
if (! itr->second->valid())
|
||||
{
|
||||
throw std::runtime_error(std::string("Cannot load library: ") +
|
||||
itr->second->get_error());
|
||||
|
@ -95,13 +108,19 @@ datasource_ptr datasource_cache::create(parameters const& params)
|
|||
#endif
|
||||
create_ds* create_datasource = reinterpret_cast<create_ds*>(itr->second->get_symbol("create"));
|
||||
|
||||
if (!create_datasource)
|
||||
if (! create_datasource)
|
||||
{
|
||||
throw std::runtime_error(std::string("Cannot load symbols: ") +
|
||||
itr->second->get_error());
|
||||
}
|
||||
|
||||
ds = datasource_ptr(create_datasource(params), datasource_deleter());
|
||||
|
||||
#ifdef MAPNIK_LOG
|
||||
MAPNIK_LOG_DEBUG(datasource_cache)
|
||||
<< "datasource_cache: Datasource="
|
||||
<< ds << " type=" << type;
|
||||
|
||||
MAPNIK_LOG_DEBUG(datasource_cache)
|
||||
<< "datasource_cache: Size="
|
||||
<< params.size();
|
||||
|
@ -115,12 +134,6 @@ datasource_ptr datasource_cache::create(parameters const& params)
|
|||
}
|
||||
#endif
|
||||
|
||||
ds = datasource_ptr(create_datasource(params), datasource_deleter());
|
||||
|
||||
MAPNIK_LOG_DEBUG(datasource_cache)
|
||||
<< "datasource_cache: Datasource="
|
||||
<< ds << " type=" << type;
|
||||
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
@ -132,11 +145,17 @@ std::string datasource_cache::plugin_directories()
|
|||
std::vector<std::string> datasource_cache::plugin_names()
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
names = get_static_datasource_names();
|
||||
#endif
|
||||
|
||||
std::map<std::string,boost::shared_ptr<PluginInfo> >::const_iterator itr;
|
||||
for (itr = plugins_.begin();itr!=plugins_.end();++itr)
|
||||
for (itr = plugins_.begin(); itr != plugins_.end(); ++itr)
|
||||
{
|
||||
names.push_back(itr->first);
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
@ -145,6 +164,7 @@ void datasource_cache::register_datasources(std::string const& str)
|
|||
#ifdef MAPNIK_THREADSAFE
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
|
||||
boost::filesystem::path path(str);
|
||||
// TODO - only push unique paths
|
||||
plugin_directories_.push_back(str);
|
||||
|
@ -152,24 +172,24 @@ void datasource_cache::register_datasources(std::string const& str)
|
|||
|
||||
if (exists(path) && is_directory(path))
|
||||
{
|
||||
for (boost::filesystem::directory_iterator itr(path);itr!=end_itr;++itr )
|
||||
for (boost::filesystem::directory_iterator itr(path); itr != end_itr; ++itr )
|
||||
{
|
||||
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
if (!is_directory( *itr ) && is_input_plugin(itr->path().filename().string()))
|
||||
if (! is_directory(*itr) && is_input_plugin(itr->path().filename().string()))
|
||||
#else // v2
|
||||
if (!is_directory( *itr ) && is_input_plugin(itr->path().leaf()))
|
||||
if (! is_directory(*itr) && is_input_plugin(itr->path().leaf()))
|
||||
#endif
|
||||
{
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
if (register_datasource(itr->path().string()))
|
||||
#else // v2
|
||||
if (register_datasource(itr->string()))
|
||||
#endif
|
||||
{
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
if (register_datasource(itr->path().string()))
|
||||
#else // v2
|
||||
if (register_datasource(itr->string()))
|
||||
#endif
|
||||
{
|
||||
registered_ = true;
|
||||
}
|
||||
registered_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,9 +226,9 @@ bool datasource_cache::register_datasource(std::string const& filename)
|
|||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(datasource_cache)
|
||||
<< "Exception caught while loading plugin library: "
|
||||
<< filename << " (" << ex.what() << ")";
|
||||
MAPNIK_LOG_ERROR(datasource_cache)
|
||||
<< "Exception caught while loading plugin library: "
|
||||
<< filename << " (" << ex.what() << ")";
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
|
171
src/datasource_cache_static.cpp
Normal file
171
src/datasource_cache_static.cpp
Normal file
|
@ -0,0 +1,171 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2013 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
#include <mapnik/params.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#endif
|
||||
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
|
||||
// static plugin linkage
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_CSV)
|
||||
#include "plugins/input/csv/csv_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_GDAL)
|
||||
#include "plugins/input/gdal/gdal_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_GEOJSON)
|
||||
#include "plugins/input/geojson/geojson_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_GEOS)
|
||||
#include "plugins/input/geos/geos_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_KISMET)
|
||||
#include "plugins/input/kismet/kismet_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OCCI)
|
||||
#include "plugins/input/occi/occi_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OGR)
|
||||
#include "plugins/input/ogr/ogr_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OSM)
|
||||
#include "plugins/input/osm/osm_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_POSTGIS)
|
||||
#include "plugins/input/postgis/postgis_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_PYTHON)
|
||||
#include "plugins/input/python/python_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_RASTER)
|
||||
#include "plugins/input/raster/raster_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE)
|
||||
#include "plugins/input/rasterlite/rasterlite_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_SHAPE)
|
||||
#include "plugins/input/shape/shape_datasource.hpp"
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_SQLITE)
|
||||
#include "plugins/input/sqlite/sqlite_datasource.hpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
template<typename T>
|
||||
datasource_ptr ds_generator(parameters const& params)
|
||||
{
|
||||
return boost::make_shared<T>(params);
|
||||
}
|
||||
|
||||
typedef datasource_ptr (*ds_generator_ptr)(parameters const& params);
|
||||
typedef boost::unordered::unordered_map<std::string, ds_generator_ptr> datasource_map;
|
||||
|
||||
static datasource_map ds_map = boost::assign::map_list_of
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_CSV)
|
||||
(std::string("csv"), &ds_generator<csv_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_GDAL)
|
||||
(std::string("gdal"), &ds_generator<gdal_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_GEOJSON)
|
||||
(std::string("geojson"), &ds_generator<geojson_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OCCI)
|
||||
(std::string("occi"), &ds_generator<occi_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OGR)
|
||||
(std::string("ogr"), &ds_generator<ogr_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_OSM)
|
||||
(std::string("osm"), &ds_generator<osm_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_POSTGIS)
|
||||
(std::string("postgis"), &ds_generator<postgis_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_PYTHON)
|
||||
(std::string("python"), &ds_generator<python_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_RASTER)
|
||||
(std::string("raster"), &ds_generator<raster_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE)
|
||||
(std::string("rasterlite"), &ds_generator<rasterlite_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_SHAPE)
|
||||
(std::string("shape"), &ds_generator<shape_datasource>)
|
||||
#endif
|
||||
#if defined(MAPNIK_STATIC_PLUGIN_SQLITE)
|
||||
(std::string("sqlite"), &ds_generator<sqlite_datasource>)
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
|
||||
datasource_ptr create_static_datasource(parameters const& params)
|
||||
{
|
||||
datasource_ptr ds;
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
boost::optional<std::string> type = params.get<std::string>("type");
|
||||
|
||||
datasource_map::iterator it = ds_map.find(*type);
|
||||
|
||||
if (it != ds_map.end())
|
||||
{
|
||||
ds = it->second(params);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ds;
|
||||
}
|
||||
|
||||
std::vector<std::string> get_static_datasource_names()
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
datasource_map::iterator it = ds_map.begin();
|
||||
while (it != ds_map.end())
|
||||
{
|
||||
names.push_back(it->first);
|
||||
|
||||
it++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,170 +21,14 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/expression_grammar.hpp>
|
||||
#include <mapnik/expression_node.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/value_types.hpp>
|
||||
#include <mapnik/expression_grammar_impl.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_object.hpp>
|
||||
|
||||
// fwd declare
|
||||
namespace mapnik {
|
||||
struct attribute;
|
||||
struct geometry_type_attribute;
|
||||
}
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T0,typename T1>
|
||||
expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const
|
||||
{
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return regex_match_node(node,tr_.transcode(pattern.c_str()));
|
||||
#else
|
||||
return regex_match_node(node,pattern);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T0,typename T1,typename T2>
|
||||
expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const
|
||||
{
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str()));
|
||||
#else
|
||||
return regex_replace_node(node,pattern,format);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
expression_grammar<Iterator>::expression_grammar(mapnik::transcoder const& tr)
|
||||
: expression_grammar::base_type(expr),
|
||||
unicode_(unicode_impl(tr)),
|
||||
regex_match_(regex_match_impl(tr)),
|
||||
regex_replace_(regex_replace_impl(tr))
|
||||
{
|
||||
using boost::phoenix::construct;
|
||||
using qi::_1;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_r1;
|
||||
#if BOOST_VERSION > 104200
|
||||
using qi::no_skip;
|
||||
#endif
|
||||
using qi::lexeme;
|
||||
using qi::_val;
|
||||
using qi::lit;
|
||||
using qi::double_;
|
||||
using qi::hex;
|
||||
using qi::omit;
|
||||
using standard_wide::char_;
|
||||
using standard_wide::no_case;
|
||||
|
||||
expr = logical_expr.alias();
|
||||
|
||||
logical_expr = not_expr [_val = _1]
|
||||
>>
|
||||
*( ( ( lit("and") | lit("&&")) >> not_expr [_val && _1] )
|
||||
| (( lit("or") | lit("||")) >> not_expr [_val || _1])
|
||||
)
|
||||
;
|
||||
|
||||
not_expr =
|
||||
cond_expr [_val = _1 ]
|
||||
| ((lit("not") | lit('!')) >> cond_expr [ _val = !_1 ])
|
||||
;
|
||||
|
||||
cond_expr = equality_expr [_val = _1] | additive_expr [_val = _1]
|
||||
;
|
||||
|
||||
equality_expr =
|
||||
relational_expr [_val = _1]
|
||||
>> *( ( (lit("=") | lit("eq") | lit("is")) >> relational_expr [_val == _1])
|
||||
| (( lit("!=") | lit("<>") | lit("neq") ) >> relational_expr [_val != _1])
|
||||
)
|
||||
;
|
||||
|
||||
regex_match_expr = lit(".match")
|
||||
>> lit('(')
|
||||
>> ustring [_val = _1]
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
regex_replace_expr =
|
||||
lit(".replace")
|
||||
>> lit('(')
|
||||
>> ustring [_a = _1]
|
||||
>> lit(',')
|
||||
>> ustring [_b = _1]
|
||||
>> lit(')') [_val = regex_replace_(_r1,_a,_b)]
|
||||
;
|
||||
|
||||
relational_expr = additive_expr[_val = _1]
|
||||
>>
|
||||
*( ( (lit("<=") | lit("le") ) >> additive_expr [ _val <= _1 ])
|
||||
| ( (lit('<') | lit("lt") ) >> additive_expr [ _val < _1 ])
|
||||
| ( (lit(">=") | lit("ge") ) >> additive_expr [ _val >= _1 ])
|
||||
| ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ])
|
||||
)
|
||||
;
|
||||
|
||||
additive_expr = multiplicative_expr [_val = _1]
|
||||
>> * ( '+' >> multiplicative_expr[_val += _1]
|
||||
| '-' >> multiplicative_expr[_val -= _1]
|
||||
)
|
||||
;
|
||||
|
||||
multiplicative_expr = unary_expr [_val = _1]
|
||||
>> *( '*' >> unary_expr [_val *= _1]
|
||||
| '/' >> unary_expr [_val /= _1]
|
||||
| '%' >> unary_expr [_val %= _1]
|
||||
| regex_match_expr[_val = regex_match_(_val, _1)]
|
||||
| regex_replace_expr(_val) [_val = _1]
|
||||
)
|
||||
;
|
||||
|
||||
unary_expr = primary_expr [_val = _1]
|
||||
| '+' >> primary_expr [_val = _1]
|
||||
| '-' >> primary_expr [_val = -_1]
|
||||
;
|
||||
|
||||
primary_expr = strict_double [_val = _1]
|
||||
| int__[_val = _1]
|
||||
| no_case[lit("true")] [_val = true]
|
||||
| no_case[lit("false")] [_val = false]
|
||||
| no_case[lit("null")] [_val = value_null() ]
|
||||
| no_case[geom_type][_val = _1 ]
|
||||
| ustring [_val = unicode_(_1) ]
|
||||
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
|
||||
| attr [_val = construct<mapnik::attribute>( _1 ) ]
|
||||
| '(' >> expr [_val = _1 ] >> ')'
|
||||
;
|
||||
|
||||
unesc_char.add("\\a", '\a')("\\b", '\b')("\\f", '\f')("\\n", '\n')
|
||||
("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\')
|
||||
("\\\'", '\'')("\\\"", '\"')
|
||||
;
|
||||
|
||||
#if BOOST_VERSION > 104500
|
||||
quote_char %= char_('\'') | char_('"');
|
||||
ustring %= omit[quote_char[_a = _1]]
|
||||
>> *(unesc_char | "\\x" >> hex | (char_ - lit(_a)))
|
||||
>> lit(_a);
|
||||
attr %= '[' >> no_skip[+~char_(']')] >> ']';
|
||||
#else
|
||||
ustring %= lit('\'')
|
||||
>> *(unesc_char | "\\x" >> hex | (char_ - lit('\'')))
|
||||
>> lit('\'');
|
||||
attr %= '[' >> lexeme[+(char_ - ']')] >> ']';
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
template struct mapnik::expression_grammar<std::string::const_iterator>;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <mapnik/feature_type_style.hpp>
|
||||
#include <mapnik/rule.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue