Merge branch 'master' of github.com:mapnik/mapnik
This commit is contained in:
commit
636a5dadc5
279 changed files with 2935 additions and 3550 deletions
29
SConstruct
29
SConstruct
|
@ -32,10 +32,7 @@ try:
|
|||
except:
|
||||
HAS_DISTUTILS = False
|
||||
|
||||
if platform.uname()[4] == 'ppc64':
|
||||
LIBDIR_SCHEMA='lib64'
|
||||
else:
|
||||
LIBDIR_SCHEMA='lib'
|
||||
LIBDIR_SCHEMA_DEFAULT='lib'
|
||||
|
||||
py3 = None
|
||||
|
||||
|
@ -287,6 +284,7 @@ opts.AddVariables(
|
|||
|
||||
# Install Variables
|
||||
('PREFIX', 'The install path "prefix"', '/usr/local'),
|
||||
('LIBDIR_SCHEMA', 'The library sub-directory appended to the "prefix", sometimes lib64 on 64bit linux systems', LIBDIR_SCHEMA_DEFAULT),
|
||||
('PYTHON_PREFIX','Custom install path "prefix" for python bindings (default of no prefix)',''),
|
||||
('DESTDIR', 'The root directory to install into. Useful mainly for binary package building', '/'),
|
||||
('PATH', 'A custom path (or multiple paths divided by ":") to append to the $PATH env to prioritize usage of command line programs (if multiple are present on the system)', ''),
|
||||
|
@ -307,17 +305,17 @@ opts.AddVariables(
|
|||
('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'),
|
||||
('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, 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('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
BoolVariable('JPEG', 'Build Mapnik with JPEG read and write support', 'True'),
|
||||
PathVariable('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
PathVariable('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('TIFF_LIBS', 'Search path for libtiff library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/local/include', PathVariable.PathAccept),
|
||||
PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/local/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('TIFF_LIBS', 'Search path for libtiff library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
('PKG_CONFIG_PATH', 'Use this path to point pkg-config to .pc files instead of the PKG_CONFIG_PATH environment setting',''),
|
||||
|
||||
# Variables affecting rendering back-ends
|
||||
|
@ -336,11 +334,11 @@ opts.AddVariables(
|
|||
('GDAL_CONFIG', 'The path to the gdal-config executable for finding gdal and ogr details.', 'gdal-config'),
|
||||
('PG_CONFIG', 'The path to the pg_config executable.', 'pg_config'),
|
||||
PathVariable('OCCI_INCLUDES', 'Search path for OCCI include files', '/usr/lib/oracle/10.2.0.3/client/include', PathVariable.PathAccept),
|
||||
PathVariable('OCCI_LIBS', 'Search path for OCCI library files', '/usr/lib/oracle/10.2.0.3/client/'+ LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('OCCI_LIBS', 'Search path for OCCI library files', '/usr/lib/oracle/10.2.0.3/client/'+ LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
PathVariable('SQLITE_INCLUDES', 'Search path for SQLITE include files', '/usr/include/', PathVariable.PathAccept),
|
||||
PathVariable('SQLITE_LIBS', 'Search path for SQLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('SQLITE_LIBS', 'Search path for SQLITE library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
PathVariable('RASTERLITE_INCLUDES', 'Search path for RASTERLITE include files', '/usr/include/', PathVariable.PathAccept),
|
||||
PathVariable('RASTERLITE_LIBS', 'Search path for RASTERLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||
PathVariable('RASTERLITE_LIBS', 'Search path for RASTERLITE library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
|
||||
# Variables for logging and statistics
|
||||
BoolVariable('ENABLE_LOG', 'Enable logging, which is enabled by default when building in *debug*', 'False'),
|
||||
|
@ -657,7 +655,7 @@ def FindBoost(context, prefixes, thread_flag):
|
|||
prefixes.insert(0,os.path.dirname(os.path.normpath(env['BOOST_INCLUDES'])))
|
||||
prefixes.insert(0,os.path.dirname(os.path.normpath(env['BOOST_LIBS'])))
|
||||
for searchDir in prefixes:
|
||||
libItems = glob(os.path.join(searchDir, LIBDIR_SCHEMA, '%s*.*' % search_lib))
|
||||
libItems = glob(os.path.join(searchDir, env['LIBDIR_SCHEMA'], '%s*.*' % search_lib))
|
||||
if not libItems:
|
||||
libItems = glob(os.path.join(searchDir, 'lib/%s*.*' % search_lib))
|
||||
incItems = glob(os.path.join(searchDir, 'include/boost*/'))
|
||||
|
@ -676,7 +674,7 @@ def FindBoost(context, prefixes, thread_flag):
|
|||
msg += '\n *libs found: %s' % BOOST_LIB_DIR
|
||||
env['BOOST_LIBS'] = BOOST_LIB_DIR
|
||||
else:
|
||||
env['BOOST_LIBS'] = '/usr/' + LIBDIR_SCHEMA
|
||||
env['BOOST_LIBS'] = '/usr/' + env['LIBDIR_SCHEMA']
|
||||
msg += '\n *using default boost lib dir: %s' % env['BOOST_LIBS']
|
||||
|
||||
if BOOST_INCLUDE_DIR:
|
||||
|
@ -958,7 +956,6 @@ if not preconfigured:
|
|||
env['LIBMAPNIK_LIBS'] = []
|
||||
env['LIBMAPNIK_CPPATHS'] = []
|
||||
env['LIBMAPNIK_CXXFLAGS'] = []
|
||||
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
||||
env['PLUGINS'] = PLUGINS
|
||||
env['EXTRA_FREETYPE_LIBS'] = []
|
||||
env['SQLITE_LINKFLAGS'] = []
|
||||
|
|
|
@ -30,21 +30,11 @@
|
|||
|
||||
using mapnik::font_set;
|
||||
|
||||
struct fontset_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const font_set& fs)
|
||||
{
|
||||
return boost::python::make_tuple(fs.get_name());
|
||||
}
|
||||
};
|
||||
|
||||
void export_fontset ()
|
||||
{
|
||||
using namespace boost::python;
|
||||
class_<font_set>("FontSet", init<>("default fontset constructor")
|
||||
)
|
||||
.def_pickle(fontset_pickle_suite())
|
||||
.def("add_face_name",&font_set::add_face_name,
|
||||
(arg("name")),
|
||||
"Add a face-name to the fontset.\n"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
using namespace boost::python;
|
||||
|
||||
// help compiler see template definitions
|
||||
static dict (*encode)( mapnik::grid const&, std::string, bool, unsigned int) = mapnik::grid_encode;
|
||||
static dict (*encode)( mapnik::grid const&, std::string const& , bool, unsigned int) = mapnik::grid_encode;
|
||||
|
||||
bool painted(mapnik::grid const& grid)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
using namespace boost::python;
|
||||
|
||||
// help compiler see template definitions
|
||||
static dict (*encode)( mapnik::grid_view const&, std::string, bool, unsigned int) = mapnik::grid_encode;
|
||||
static dict (*encode)( mapnik::grid_view const&, std::string const& , bool, unsigned int) = mapnik::grid_encode;
|
||||
|
||||
void export_grid_view()
|
||||
{
|
||||
|
|
|
@ -1,67 +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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// boost
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/metawriter_inmem.hpp>
|
||||
|
||||
using mapnik::metawriter_inmem;
|
||||
using mapnik::metawriter_inmem_ptr;
|
||||
|
||||
namespace {
|
||||
std::map<std::string, mapnik::value>::const_iterator
|
||||
mapnik_value_map_begin(const std::map<std::string, mapnik::value> &m) {
|
||||
return m.begin();
|
||||
}
|
||||
|
||||
std::map<std::string, mapnik::value>::const_iterator
|
||||
mapnik_value_map_end(const std::map<std::string, mapnik::value> &m) {
|
||||
return m.end();
|
||||
}
|
||||
}
|
||||
|
||||
void export_inmem_metawriter() {
|
||||
using namespace boost::python;
|
||||
|
||||
class_<std::map<std::string, mapnik::value> >
|
||||
("MapnikProperties", "Retarded.", init<>())
|
||||
.def("__iter__", range(&mapnik_value_map_begin, &mapnik_value_map_end))
|
||||
;
|
||||
|
||||
class_<metawriter_inmem::meta_instance>
|
||||
("MetaInstance", "Single rendered instance of meta-information.", no_init)
|
||||
.def_readonly("box", &metawriter_inmem::meta_instance::box)
|
||||
.def_readonly("properties", &metawriter_inmem::meta_instance::properties)
|
||||
;
|
||||
|
||||
class_<metawriter_inmem, metawriter_inmem_ptr, boost::noncopyable>
|
||||
("MetaWriterInMem",
|
||||
"Collects meta-information about elements rendered.",
|
||||
no_init)
|
||||
.def("__iter__", range(&metawriter_inmem::inst_begin,
|
||||
&metawriter_inmem::inst_end))
|
||||
;
|
||||
}
|
|
@ -49,17 +49,6 @@ void set_filename(line_pattern_symbolizer & t, std::string const& file_expr)
|
|||
|
||||
}
|
||||
|
||||
struct line_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const line_pattern_symbolizer& l)
|
||||
{
|
||||
std::string filename = path_processor_type::to_string(*l.get_filename());
|
||||
// FIXME : Do we need "type" parameter at all ?
|
||||
return boost::python::make_tuple(filename, guess_type(filename));
|
||||
}
|
||||
};
|
||||
|
||||
void export_line_pattern_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -67,7 +56,6 @@ void export_line_pattern_symbolizer()
|
|||
class_<line_pattern_symbolizer>("LinePatternSymbolizer",
|
||||
init<path_expression_ptr>
|
||||
("<image file expression>"))
|
||||
//.def_pickle(line_pattern_symbolizer_pickle_suite())
|
||||
.add_property("transform",
|
||||
mapnik::get_svg_transform<line_pattern_symbolizer>,
|
||||
mapnik::set_svg_transform<line_pattern_symbolizer>)
|
||||
|
|
|
@ -29,16 +29,6 @@ using mapnik::line_symbolizer;
|
|||
using mapnik::stroke;
|
||||
using mapnik::color;
|
||||
|
||||
struct line_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const line_symbolizer& l)
|
||||
{
|
||||
return boost::python::make_tuple(l.get_stroke());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_line_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -50,7 +40,6 @@ void export_line_symbolizer()
|
|||
init<>("Default LineSymbolizer - 1px solid black"))
|
||||
.def(init<stroke const&>("TODO"))
|
||||
.def(init<color const& ,float>())
|
||||
.def_pickle(line_symbolizer_pickle_suite())
|
||||
.add_property("rasterizer",
|
||||
&line_symbolizer::get_rasterizer,
|
||||
&line_symbolizer::set_rasterizer,
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
// mapnik
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/feature_type_style.hpp>
|
||||
#include <mapnik/metawriter_inmem.hpp>
|
||||
#include <mapnik/util/deepcopy.hpp>
|
||||
//#include <mapnik/util/deepcopy.hpp>
|
||||
#include "mapnik_enumeration.hpp"
|
||||
|
||||
using mapnik::color;
|
||||
|
@ -39,85 +40,9 @@ using mapnik::box2d;
|
|||
using mapnik::layer;
|
||||
using mapnik::Map;
|
||||
|
||||
struct map_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const Map& m)
|
||||
{
|
||||
return boost::python::make_tuple(m.width(),m.height(),m.srs());
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const Map& m)
|
||||
{
|
||||
boost::python::list l;
|
||||
for (unsigned i=0;i<m.layer_count();++i)
|
||||
{
|
||||
l.append(m.getLayer(i));
|
||||
}
|
||||
|
||||
boost::python::list s;
|
||||
Map::const_style_iterator it = m.styles().begin();
|
||||
Map::const_style_iterator end = m.styles().end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
std::string const& name = it->first;
|
||||
const mapnik::feature_type_style & style = it->second;
|
||||
boost::python::tuple style_pair = boost::python::make_tuple(name,style);
|
||||
s.append(style_pair);
|
||||
}
|
||||
|
||||
return boost::python::make_tuple(m.get_current_extent(),m.background(),l,s,m.base_path());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (Map& m, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 5)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 5-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
box2d<double> ext = extract<box2d<double> >(state[0]);
|
||||
m.zoom_to_box(ext);
|
||||
if (state[1])
|
||||
{
|
||||
color bg = extract<color>(state[1]);
|
||||
m.set_background(bg);
|
||||
}
|
||||
|
||||
boost::python::list l=extract<boost::python::list>(state[2]);
|
||||
for (int i=0;i<len(l);++i)
|
||||
{
|
||||
m.addLayer(extract<layer>(l[i]));
|
||||
}
|
||||
|
||||
boost::python::list s=extract<boost::python::list>(state[3]);
|
||||
for (int i=0;i<len(s);++i)
|
||||
{
|
||||
boost::python::tuple style_pair=extract<boost::python::tuple>(s[i]);
|
||||
std::string name = extract<std::string>(style_pair[0]);
|
||||
mapnik::feature_type_style style = extract<mapnik::feature_type_style>(style_pair[1]);
|
||||
m.insert_style(name, style);
|
||||
}
|
||||
|
||||
if (state[4])
|
||||
{
|
||||
std::string base_path = extract<std::string>(state[4]);
|
||||
m.set_base_path(base_path);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<layer>& (Map::*layers_nonconst)() = &Map::layers;
|
||||
std::vector<layer> const& (Map::*layers_const)() const = &Map::layers;
|
||||
mapnik::parameters& (Map::*params_nonconst)() = &Map::get_extra_parameters;
|
||||
//boost::optional<mapnik::box2d<double> > const& (Map::*maximum_extent_const)() const = &Map::maximum_extent;
|
||||
|
||||
mapnik::feature_type_style find_style(mapnik::Map const& m, std::string const& name)
|
||||
{
|
||||
|
@ -141,26 +66,6 @@ mapnik::font_set find_fontset(mapnik::Map const& m, std::string const& name)
|
|||
return *fontset;
|
||||
}
|
||||
|
||||
bool has_metawriter(mapnik::Map const& m)
|
||||
{
|
||||
if (m.metawriters().size() >=1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns empty shared_ptr when the metawriter isn't found, or is
|
||||
// of the wrong type. empty pointers make it back to Python as a None.
|
||||
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map & m, std::string const& name) {
|
||||
mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
|
||||
mapnik::metawriter_inmem_ptr inmem;
|
||||
|
||||
if (metawriter) {
|
||||
inmem = boost::dynamic_pointer_cast<mapnik::metawriter_inmem>(metawriter);
|
||||
}
|
||||
|
||||
return inmem;
|
||||
}
|
||||
|
||||
// TODO - we likely should allow indexing by negative number from python
|
||||
// for now, protect against negative values and kindly throw
|
||||
mapnik::featureset_ptr query_point(mapnik::Map const& m, int index, double x, double y)
|
||||
|
@ -184,6 +89,7 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x
|
|||
}
|
||||
|
||||
// deepcopy
|
||||
/*
|
||||
mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
|
||||
{
|
||||
// FIXME: ignore memo for now
|
||||
|
@ -191,6 +97,7 @@ mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
|
|||
mapnik::util::deepcopy(m, result);
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box)
|
||||
{
|
||||
|
@ -240,9 +147,6 @@ void export_map()
|
|||
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
|
||||
))
|
||||
|
||||
.def_pickle(map_pickle_suite()
|
||||
)
|
||||
|
||||
.def("append_style",&Map::insert_style,
|
||||
(arg("style_name"),arg("style_object")),
|
||||
"Insert a Mapnik Style onto the map by appending it.\n"
|
||||
|
@ -310,15 +214,6 @@ void export_map()
|
|||
"<mapnik._mapnik.Style object at 0x654f0>\n"
|
||||
)
|
||||
|
||||
.def("has_metawriter",
|
||||
has_metawriter,
|
||||
"Check if the Map has any active metawriters\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> m.has_metawriter()\n"
|
||||
"False\n"
|
||||
)
|
||||
|
||||
.def("pan",&Map::pan,
|
||||
(arg("x"),arg("y")),
|
||||
"Set the Map center at a given x,y location\n"
|
||||
|
@ -457,39 +352,8 @@ void export_map()
|
|||
">>> extext = Box2d(-180.0, -90.0, 180.0, 90.0)\n"
|
||||
">>> m.zoom_to_box(extent)\n"
|
||||
)
|
||||
.def("get_metawriter_property", &Map::get_metawriter_property,
|
||||
(arg("name")),
|
||||
"Reads a metawriter property.\n"
|
||||
"These properties are completely user-defined and can be used to"
|
||||
"create filenames, etc.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> map.set_metawriter_property(\"x\", \"10\")\n"
|
||||
">>> map.get_metawriter_property(\"x\")\n"
|
||||
"10\n"
|
||||
)
|
||||
.def("set_metawriter_property", &Map::set_metawriter_property,
|
||||
(arg("name"),arg("value")),
|
||||
"Sets a metawriter property.\n"
|
||||
"These properties are completely user-defined and can be used to"
|
||||
"create filenames, etc.\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
">>> map.set_metawriter_property(\"x\", str(x))\n"
|
||||
">>> map.set_metawriter_property(\"y\", str(y))\n"
|
||||
">>> map.set_metawriter_property(\"z\", str(z))\n"
|
||||
"\n"
|
||||
"Use a path like \"[z]/[x]/[y].json\" to create filenames.\n"
|
||||
)
|
||||
.def("find_inmem_metawriter", find_inmem_metawriter,
|
||||
(arg("name")),
|
||||
"Gets an inmem metawriter, or None if no such metawriter "
|
||||
"exists.\n"
|
||||
"Use this after the map has been rendered to retrieve information "
|
||||
"about the hit areas rendered on the map.\n"
|
||||
)
|
||||
|
||||
.def("__deepcopy__",&map_deepcopy)
|
||||
//.def("__deepcopy__",&map_deepcopy)
|
||||
.add_property("parameters",make_function(params_nonconst,return_value_policy<reference_existing_object>()),"TODO")
|
||||
|
||||
.add_property("aspect_fix_mode",
|
||||
|
|
|
@ -49,43 +49,7 @@ void set_filename(mapnik::markers_symbolizer & symbolizer, std::string const& fi
|
|||
|
||||
}
|
||||
|
||||
struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(markers_symbolizer const& p)
|
||||
{
|
||||
std::string filename = path_processor_type::to_string(*p.get_filename());
|
||||
return boost::python::make_tuple(filename,mapnik::guess_type(filename));
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(markers_symbolizer const& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_allow_overlap(),
|
||||
p.get_ignore_placement());//,p.get_opacity());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (markers_symbolizer& p, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 2)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 2-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
p.set_allow_overlap(extract<bool>(state[0]));
|
||||
p.set_ignore_placement(extract<bool>(state[1]));
|
||||
//p.set_opacity(extract<float>(state[2]));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// https://github.com/mapnik/mapnik/issues/1367
|
||||
PyObject* get_fill_opacity_impl(markers_symbolizer & sym)
|
||||
{
|
||||
boost::optional<float> fill_opacity = sym.get_fill_opacity();
|
||||
|
@ -107,7 +71,6 @@ void export_markers_symbolizer()
|
|||
class_<markers_symbolizer>("MarkersSymbolizer",
|
||||
init<>("Default Markers Symbolizer - circle"))
|
||||
.def (init<mapnik::path_expression_ptr>("<path expression ptr>"))
|
||||
//.def_pickle(markers_symbolizer_pickle_suite())
|
||||
.add_property("filename",
|
||||
&get_filename,
|
||||
&set_filename)
|
||||
|
|
|
@ -50,47 +50,6 @@ void set_filename(point_symbolizer & t, std::string const& file_expr)
|
|||
|
||||
}
|
||||
|
||||
struct point_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const point_symbolizer& p)
|
||||
{
|
||||
std::string filename = path_processor_type::to_string(*p.get_filename());
|
||||
return boost::python::make_tuple(filename,mapnik::guess_type(filename));
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const point_symbolizer& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_allow_overlap(),
|
||||
p.get_opacity(),
|
||||
p.get_ignore_placement(),
|
||||
p.get_point_placement());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (point_symbolizer& p, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 4)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 4-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
p.set_allow_overlap(extract<bool>(state[0]));
|
||||
p.set_opacity(extract<float>(state[1]));
|
||||
p.set_ignore_placement(extract<bool>(state[2]));
|
||||
p.set_point_placement(extract<point_placement_e>(state[3]));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
void export_point_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -103,7 +62,6 @@ void export_point_symbolizer()
|
|||
class_<point_symbolizer>("PointSymbolizer",
|
||||
init<>("Default Point Symbolizer - 4x4 black square"))
|
||||
.def (init<mapnik::path_expression_ptr>("<path expression ptr>"))
|
||||
.def_pickle(point_symbolizer_pickle_suite())
|
||||
.add_property("filename",
|
||||
&get_filename,
|
||||
&set_filename)
|
||||
|
|
|
@ -49,41 +49,6 @@ void set_filename(polygon_pattern_symbolizer & t, std::string const& file_expr)
|
|||
|
||||
}
|
||||
|
||||
struct polygon_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const polygon_pattern_symbolizer& p)
|
||||
{
|
||||
std::string filename = path_processor_type::to_string(*p.get_filename());
|
||||
return boost::python::make_tuple(filename,guess_type(filename));
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const polygon_pattern_symbolizer& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_alignment(),p.get_gamma(),p.get_gamma_method());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (polygon_pattern_symbolizer& p, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 3)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 3-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
p.set_alignment(extract<pattern_alignment_e>(state[0]));
|
||||
p.set_gamma(extract<float>(state[1]));
|
||||
p.set_gamma_method(extract<gamma_method_e>(state[2]));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_polygon_pattern_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -95,7 +60,6 @@ void export_polygon_pattern_symbolizer()
|
|||
|
||||
class_<polygon_pattern_symbolizer>("PolygonPatternSymbolizer",
|
||||
init<path_expression_ptr>("<path_expression_ptr>"))
|
||||
.def_pickle(polygon_pattern_symbolizer_pickle_suite())
|
||||
.add_property("alignment",
|
||||
&polygon_pattern_symbolizer::get_alignment,
|
||||
&polygon_pattern_symbolizer::set_alignment,
|
||||
|
|
|
@ -28,40 +28,6 @@ using namespace mapnik;
|
|||
using mapnik::polygon_symbolizer;
|
||||
using mapnik::color;
|
||||
|
||||
struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const polygon_symbolizer& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_fill());
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const polygon_symbolizer& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_opacity(),p.get_gamma(),p.get_gamma_method());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (polygon_symbolizer& p, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 3)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 3-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
p.set_opacity(extract<float>(state[0]));
|
||||
p.set_gamma(extract<float>(state[1]));
|
||||
p.set_gamma_method(extract<gamma_method_e>(state[2]));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_polygon_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -69,7 +35,6 @@ void export_polygon_symbolizer()
|
|||
class_<polygon_symbolizer>("PolygonSymbolizer",
|
||||
init<>("Default PolygonSymbolizer - solid fill grey"))
|
||||
.def(init<color const&>("TODO"))
|
||||
.def_pickle(polygon_symbolizer_pickle_suite())
|
||||
.add_property("fill",make_function
|
||||
(&polygon_symbolizer::get_fill,
|
||||
return_value_policy<copy_const_reference>()),
|
||||
|
|
|
@ -66,7 +66,6 @@ void export_projection();
|
|||
void export_proj_transform();
|
||||
void export_view_transform();
|
||||
void export_raster_colorizer();
|
||||
void export_inmem_metawriter();
|
||||
void export_label_collision_detector();
|
||||
void export_logger();
|
||||
|
||||
|
@ -407,7 +406,6 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
export_coord();
|
||||
export_map();
|
||||
export_raster_colorizer();
|
||||
export_inmem_metawriter();
|
||||
export_label_collision_detector();
|
||||
export_logger();
|
||||
|
||||
|
|
|
@ -32,15 +32,6 @@ using mapnik::box2d;
|
|||
|
||||
namespace python = boost::python;
|
||||
|
||||
struct query_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(query const& q)
|
||||
{
|
||||
return boost::python::make_tuple(q.get_bbox(),q.resolution());
|
||||
}
|
||||
};
|
||||
|
||||
struct resolution_to_tuple
|
||||
{
|
||||
static PyObject* convert(query::resolution_type const& x)
|
||||
|
@ -64,7 +55,6 @@ void export_query()
|
|||
class_<query>("Query", "a spatial query data object",
|
||||
init<box2d<double>,query::resolution_type const&,double>() )
|
||||
.def(init<box2d<double> >())
|
||||
.def_pickle(query_pickle_suite())
|
||||
.add_property("resolution",make_function(&query::resolution,
|
||||
return_value_policy<copy_const_reference>()))
|
||||
.add_property("bbox", make_function(&query::get_bbox,
|
||||
|
|
|
@ -29,44 +29,6 @@
|
|||
|
||||
using mapnik::raster_symbolizer;
|
||||
|
||||
struct raster_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
/*
|
||||
static boost::python::tuple
|
||||
getinitargs(const raster_symbolizer& r)
|
||||
{
|
||||
return boost::python::make_tuple();
|
||||
}
|
||||
*/
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(raster_symbolizer const& r)
|
||||
{
|
||||
return boost::python::make_tuple(r.get_mode(),r.get_scaling_method(),r.get_opacity(),r.get_filter_factor(),r.get_mesh_size());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (raster_symbolizer & r, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 5)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 5-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
r.set_mode(extract<std::string>(state[0]));
|
||||
r.set_scaling_method(extract<mapnik::scaling_method_e>(state[1]));
|
||||
r.set_opacity(extract<float>(state[2]));
|
||||
r.set_filter_factor(extract<float>(state[3]));
|
||||
r.set_mesh_size(extract<unsigned>(state[4]));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_raster_symbolizer()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -74,8 +36,6 @@ void export_raster_symbolizer()
|
|||
class_<raster_symbolizer>("RasterSymbolizer",
|
||||
init<>("Default ctor"))
|
||||
|
||||
.def_pickle(raster_symbolizer_pickle_suite())
|
||||
|
||||
.add_property("mode",
|
||||
make_function(&raster_symbolizer::get_mode,return_value_policy<copy_const_reference>()),
|
||||
&raster_symbolizer::set_mode,
|
||||
|
|
|
@ -48,108 +48,6 @@ using mapnik::markers_symbolizer;
|
|||
using mapnik::symbolizer;
|
||||
using mapnik::to_expression_string;
|
||||
|
||||
struct pickle_symbolizer : public boost::static_visitor<>
|
||||
{
|
||||
public:
|
||||
pickle_symbolizer( boost::python::list syms):
|
||||
syms_(syms) {}
|
||||
|
||||
template <typename T>
|
||||
void operator () ( T const& sym )
|
||||
{
|
||||
syms_.append(sym);
|
||||
}
|
||||
|
||||
private:
|
||||
boost::python::list syms_;
|
||||
};
|
||||
|
||||
|
||||
struct extract_symbolizer : public boost::static_visitor<>
|
||||
{
|
||||
public:
|
||||
extract_symbolizer( rule& r):
|
||||
r_(r) {}
|
||||
|
||||
template <typename T>
|
||||
void operator () ( T const& sym )
|
||||
{
|
||||
r_.append(sym);
|
||||
}
|
||||
private:
|
||||
rule& r_;
|
||||
|
||||
};
|
||||
|
||||
struct rule_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const rule& r)
|
||||
{
|
||||
return boost::python::make_tuple(r.get_name(),r.get_min_scale(),r.get_max_scale());
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const rule& r)
|
||||
{
|
||||
boost::python::list syms;
|
||||
|
||||
rule::symbolizers::const_iterator begin = r.get_symbolizers().begin();
|
||||
rule::symbolizers::const_iterator end = r.get_symbolizers().end();
|
||||
pickle_symbolizer serializer( syms );
|
||||
std::for_each( begin, end , boost::apply_visitor( serializer ));
|
||||
|
||||
// We serialize filter expressions AST as strings
|
||||
std::string filter_expr = to_expression_string(*r.get_filter());
|
||||
|
||||
return boost::python::make_tuple(filter_expr,r.has_else_filter(),r.has_also_filter(),syms);
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (rule& r, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 4)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 4-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
if (state[0])
|
||||
{
|
||||
rule dfl;
|
||||
std::string filter = extract<std::string>(state[1]);
|
||||
std::string default_filter = "<TODO>";//dfl.get_filter()->to_string();
|
||||
if ( filter != default_filter)
|
||||
{
|
||||
r.set_filter(mapnik::parse_expression(filter,"utf8"));
|
||||
}
|
||||
}
|
||||
|
||||
if (state[1])
|
||||
{
|
||||
r.set_else(true);
|
||||
}
|
||||
|
||||
if (state[2])
|
||||
{
|
||||
r.set_also(true);
|
||||
}
|
||||
|
||||
boost::python::list syms=extract<boost::python::list>(state[4]);
|
||||
extract_symbolizer serializer( r );
|
||||
for (int i=0;i<len(syms);++i)
|
||||
{
|
||||
//symbolizer symbol = extract<symbolizer>(syms[i]);
|
||||
//boost::apply_visitor( serializer, symbol );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_rule()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -171,7 +69,6 @@ void export_rule()
|
|||
class_<rule>("Rule",init<>("default constructor"))
|
||||
.def(init<std::string const&,
|
||||
boost::python::optional<double,double> >())
|
||||
.def_pickle(rule_pickle_suite())
|
||||
.add_property("name",make_function
|
||||
(&rule::get_name,
|
||||
return_value_policy<copy_const_reference>()),
|
||||
|
|
|
@ -96,7 +96,6 @@ void export_shield_symbolizer()
|
|||
unsigned, mapnik::color const&,
|
||||
path_expression_ptr>()
|
||||
)
|
||||
//.def_pickle(shield_symbolizer_pickle_suite())
|
||||
.add_property("allow_overlap",
|
||||
&shield_symbolizer::get_allow_overlap,
|
||||
&shield_symbolizer::set_allow_overlap,
|
||||
|
|
|
@ -49,63 +49,6 @@ list get_dashes_list(const stroke& stroke)
|
|||
}
|
||||
}
|
||||
|
||||
struct stroke_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const stroke& s)
|
||||
{
|
||||
|
||||
return boost::python::make_tuple(s.get_color(),s.get_width());
|
||||
|
||||
}
|
||||
|
||||
static boost::python::tuple
|
||||
getstate(const stroke& s)
|
||||
{
|
||||
boost::python::list dashes = get_dashes_list(s);
|
||||
return boost::python::make_tuple(s.get_opacity(),
|
||||
dashes,
|
||||
s.get_line_cap(),
|
||||
s.get_line_join(),
|
||||
s.get_gamma(),
|
||||
s.get_gamma_method());
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (stroke& s, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 6)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 6-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
s.set_opacity(extract<float>(state[0]));
|
||||
|
||||
if (state[1])
|
||||
{
|
||||
list dashes = extract<list>(state[1]);
|
||||
for(boost::python::ssize_t i=0; i<len(dashes); i++) {
|
||||
double ds1 = extract<double>(dashes[i][0]);
|
||||
double ds2 = extract<double>(dashes[i][1]);
|
||||
s.add_dash(ds1,ds2);
|
||||
}
|
||||
}
|
||||
|
||||
s.set_line_cap(extract<line_cap_e>(state[2]));
|
||||
s.set_line_join(extract<line_join_e>(state[3]));
|
||||
s.set_gamma(extract<double>(state[4]));
|
||||
s.set_gamma_method(extract<gamma_method_e>(state[5]));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
void export_stroke ()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -132,7 +75,6 @@ void export_stroke ()
|
|||
(arg("color"),arg("width")),
|
||||
"Creates a new stroke object with a specified color and width.\n")
|
||||
)
|
||||
.def_pickle(stroke_pickle_suite())
|
||||
.add_property("color",make_function
|
||||
(&stroke::get_color,return_value_policy<copy_const_reference>()),
|
||||
&stroke::set_color,
|
||||
|
|
|
@ -32,45 +32,6 @@ using mapnik::feature_type_style;
|
|||
using mapnik::rules;
|
||||
using mapnik::rule;
|
||||
|
||||
struct style_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getstate(const feature_type_style& s)
|
||||
{
|
||||
boost::python::list rule_list;
|
||||
|
||||
rules::const_iterator it = s.get_rules().begin();
|
||||
rules::const_iterator end = s.get_rules().end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
rule_list.append( *it );
|
||||
}
|
||||
|
||||
return boost::python::make_tuple(rule_list);
|
||||
}
|
||||
|
||||
static void
|
||||
setstate (feature_type_style& s, boost::python::tuple state)
|
||||
{
|
||||
using namespace boost::python;
|
||||
if (len(state) != 1)
|
||||
{
|
||||
PyErr_SetObject(PyExc_ValueError,
|
||||
("expected 1-item tuple in call to __setstate__; got %s"
|
||||
% state).ptr()
|
||||
);
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
boost::python::list rules = extract<boost::python::list>(state[0]);
|
||||
for (int i=0; i<len(rules); ++i)
|
||||
{
|
||||
s.add_rule(extract<rule>(rules[i]));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void export_style()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
@ -85,9 +46,6 @@ void export_style()
|
|||
;
|
||||
class_<feature_type_style>("Style",init<>("default style constructor"))
|
||||
|
||||
.def_pickle(style_pickle_suite()
|
||||
)
|
||||
|
||||
.add_property("rules",make_function
|
||||
(&feature_type_style::get_rules,
|
||||
return_value_policy<reference_existing_object>()),
|
||||
|
|
|
@ -342,7 +342,7 @@ void grid_encode_utf(T const& grid_type,
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
boost::python::dict grid_encode( T const& grid, std::string format, bool add_features, unsigned int resolution)
|
||||
boost::python::dict grid_encode( T const& grid, std::string const& format, bool add_features, unsigned int resolution)
|
||||
{
|
||||
if (format == "utf") {
|
||||
boost::python::dict json;
|
||||
|
@ -357,8 +357,8 @@ boost::python::dict grid_encode( T const& grid, std::string format, bool add_fea
|
|||
}
|
||||
}
|
||||
|
||||
template boost::python::dict grid_encode( mapnik::grid const& grid, std::string format, bool add_features, unsigned int resolution);
|
||||
template boost::python::dict grid_encode( mapnik::grid_view const& grid, std::string format, bool add_features, unsigned int resolution);
|
||||
template boost::python::dict grid_encode( mapnik::grid const& grid, std::string const& format, bool add_features, unsigned int resolution);
|
||||
template boost::python::dict grid_encode( mapnik::grid_view const& grid, std::string const& format, bool add_features, unsigned int resolution);
|
||||
|
||||
/* new approach: key comes from grid object
|
||||
* grid size should be same as the map
|
||||
|
@ -379,12 +379,15 @@ void render_layer_for_grid(const mapnik::Map& map,
|
|||
throw std::runtime_error(s.str());
|
||||
}
|
||||
|
||||
// convert python list to std::vector
|
||||
// convert python list to std::set
|
||||
std::set<std::string> attributes;
|
||||
boost::python::ssize_t num_fields = boost::python::len(fields);
|
||||
for(boost::python::ssize_t i=0; i<num_fields; i++) {
|
||||
boost::python::extract<std::string> name(fields[i]);
|
||||
if (name.check()) {
|
||||
if (name.check())
|
||||
{
|
||||
grid.add_property_name(name());
|
||||
attributes.insert(name());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -394,8 +397,6 @@ void render_layer_for_grid(const mapnik::Map& map,
|
|||
}
|
||||
}
|
||||
|
||||
// copy property names
|
||||
std::set<std::string> attributes = grid.property_names();
|
||||
std::string const& key = grid.get_key();
|
||||
|
||||
// if key is special __id__ keyword
|
||||
|
@ -405,13 +406,10 @@ void render_layer_for_grid(const mapnik::Map& map,
|
|||
|
||||
// if __id__ is requested to be dumped out
|
||||
// remove it so that datasource queries will not break
|
||||
if (attributes.find(key) != attributes.end())
|
||||
{
|
||||
attributes.erase(key);
|
||||
}
|
||||
attributes.erase(key);
|
||||
}
|
||||
// if key is not the special __id__ keyword
|
||||
else if (attributes.find(key) == attributes.end())
|
||||
else
|
||||
{
|
||||
// them make sure the datasource query includes this field
|
||||
attributes.insert(key);
|
||||
|
|
|
@ -64,7 +64,7 @@ void grid_encode_utf(T const& grid_type,
|
|||
unsigned int resolution);
|
||||
|
||||
template <typename T>
|
||||
boost::python::dict grid_encode( T const& grid, std::string format, bool add_features, unsigned int resolution);
|
||||
boost::python::dict grid_encode( T const& grid, std::string const& format, bool add_features, unsigned int resolution);
|
||||
|
||||
/* new approach: key comes from grid object
|
||||
* grid size should be same as the map
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/save_map.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
#endif
|
||||
|
||||
// qt
|
||||
|
|
8
deps/agg/include/agg_pixfmt_rgba.h
vendored
8
deps/agg/include/agg_pixfmt_rgba.h
vendored
|
@ -1450,6 +1450,9 @@ namespace agg
|
|||
};
|
||||
|
||||
// colorize alpha values
|
||||
// TODO - consider moving to image-filters:
|
||||
// https://github.com/mapnik/mapnik/issues/1371
|
||||
/*
|
||||
template <typename ColorT, typename Order>
|
||||
struct comp_op_rgba_colorize_alpha
|
||||
{
|
||||
|
@ -1503,6 +1506,7 @@ namespace agg
|
|||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
// grain extract (GIMP)
|
||||
// E = I - M + 128
|
||||
|
@ -1790,7 +1794,7 @@ namespace agg
|
|||
comp_op_rgba_saturation<ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_color<ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_value<ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_colorize_alpha<ColorT,Order>::blend_pix,
|
||||
//comp_op_rgba_colorize_alpha<ColorT,Order>::blend_pix,
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -1832,7 +1836,7 @@ namespace agg
|
|||
comp_op_saturation, //----comp_op_saturation
|
||||
comp_op_color, //----comp_op_color
|
||||
comp_op_value, //----comp_op_value
|
||||
comp_op_colorize_alpha,//----comp_op_colorize_alpha
|
||||
//comp_op_colorize_alpha,//----comp_op_colorize_alpha
|
||||
end_of_comp_op_e
|
||||
};
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
if (*it) boost::apply_visitor(f_attr, **it);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
||||
|
@ -113,14 +112,12 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
path_processor_type::collect_attributes(*filename_expr,names_);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_image_transform());
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
||||
void operator () (line_symbolizer const& sym)
|
||||
{
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
||||
|
@ -131,14 +128,12 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
path_processor_type::collect_attributes(*filename_expr,names_);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_image_transform());
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
||||
void operator () (polygon_symbolizer const& sym)
|
||||
{
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
||||
|
@ -149,7 +144,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
path_processor_type::collect_attributes(*filename_expr,names_);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_image_transform());
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
@ -169,7 +163,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
path_processor_type::collect_attributes(*filename_expr,names_);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_image_transform());
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
@ -186,7 +179,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
boost::apply_visitor(f_attr,*width_expr);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_image_transform());
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
|
@ -198,7 +190,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
{
|
||||
boost::apply_visitor(f_attr,*height_expr);
|
||||
}
|
||||
collect_metawriter(sym);
|
||||
collect_transform(sym.get_transform());
|
||||
}
|
||||
// TODO - support remaining syms
|
||||
|
@ -206,11 +197,6 @@ struct symbolizer_attributes : public boost::static_visitor<>
|
|||
private:
|
||||
std::set<std::string>& names_;
|
||||
expression_attributes<std::set<std::string> > f_attr;
|
||||
void collect_metawriter(symbolizer_base const& sym)
|
||||
{
|
||||
metawriter_properties const& properties = sym.get_metawriter_properties();
|
||||
names_.insert(properties.begin(), properties.end());
|
||||
}
|
||||
void collect_transform(transform_list_ptr const& trans_expr)
|
||||
{
|
||||
if (trans_expr)
|
||||
|
|
|
@ -37,13 +37,15 @@
|
|||
#include <boost/spirit/include/phoenix_fusion.hpp>
|
||||
#include <boost/spirit/include/phoenix_function.hpp>
|
||||
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION >= 104500
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
mapnik::color,
|
||||
(unsigned, unsigned, obj.red(), obj.set_red(val))
|
||||
|
@ -161,4 +163,373 @@ struct css_color_grammar : qi::grammar<Iterator, color(), ascii_space_type>
|
|||
|
||||
}
|
||||
|
||||
#else // boost 1.42 compatibility
|
||||
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
// temp workaround . TODO: adapt mapnik::color
|
||||
struct css
|
||||
{
|
||||
css ()
|
||||
: r(255),g(255),b(255),a(255) {}
|
||||
css(unsigned r_,unsigned g_, unsigned b_,unsigned a_ = 0xff)
|
||||
: r(r_),g(g_),b(b_),a(a_) {}
|
||||
|
||||
unsigned r;
|
||||
unsigned g;
|
||||
unsigned b;
|
||||
unsigned a;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::css,
|
||||
(unsigned, r)
|
||||
(unsigned, g)
|
||||
(unsigned, b)
|
||||
(unsigned, a)
|
||||
)
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace ascii = boost::spirit::ascii;
|
||||
namespace phoenix = boost::phoenix;
|
||||
|
||||
typedef boost::spirit::ascii::space_type ascii_space_type;
|
||||
|
||||
struct named_colors_ : qi::symbols<char,css>
|
||||
{
|
||||
named_colors_()
|
||||
{
|
||||
add
|
||||
("aliceblue", css(240, 248, 255))
|
||||
("antiquewhite", css(250, 235, 215))
|
||||
("aqua", css(0, 255, 255))
|
||||
("aquamarine", css(127, 255, 212))
|
||||
("azure", css(240, 255, 255))
|
||||
("beige", css(245, 245, 220))
|
||||
("bisque", css(255, 228, 196))
|
||||
("black", css(0, 0, 0))
|
||||
("blanchedalmond", css(255,235,205))
|
||||
("blue", css(0, 0, 255))
|
||||
("blueviolet", css(138, 43, 226))
|
||||
("brown", css(165, 42, 42))
|
||||
("burlywood", css(222, 184, 135))
|
||||
("cadetblue", css(95, 158, 160))
|
||||
("chartreuse", css(127, 255, 0))
|
||||
("chocolate", css(210, 105, 30))
|
||||
("coral", css(255, 127, 80))
|
||||
("cornflowerblue", css(100, 149, 237))
|
||||
("cornsilk", css(255, 248, 220))
|
||||
("crimson", css(220, 20, 60))
|
||||
("cyan", css(0, 255, 255))
|
||||
("darkblue", css(0, 0, 139))
|
||||
("darkcyan", css(0, 139, 139))
|
||||
("darkgoldenrod", css(184, 134, 11))
|
||||
("darkgray", css(169, 169, 169))
|
||||
("darkgreen", css(0, 100, 0))
|
||||
("darkgrey", css(169, 169, 169))
|
||||
("darkkhaki", css(189, 183, 107))
|
||||
("darkmagenta", css(139, 0, 139))
|
||||
("darkolivegreen", css(85, 107, 47))
|
||||
("darkorange", css(255, 140, 0))
|
||||
("darkorchid", css(153, 50, 204))
|
||||
("darkred", css(139, 0, 0))
|
||||
("darksalmon", css(233, 150, 122))
|
||||
("darkseagreen", css(143, 188, 143))
|
||||
("darkslateblue", css(72, 61, 139))
|
||||
("darkslategrey", css(47, 79, 79))
|
||||
("darkturquoise", css(0, 206, 209))
|
||||
("darkviolet", css(148, 0, 211))
|
||||
("deeppink", css(255, 20, 147))
|
||||
("deepskyblue", css(0, 191, 255))
|
||||
("dimgray", css(105, 105, 105))
|
||||
("dimgrey", css(105, 105, 105))
|
||||
("dodgerblue", css(30, 144, 255))
|
||||
("firebrick", css(178, 34, 34))
|
||||
("floralwhite", css(255, 250, 240))
|
||||
("forestgreen", css(34, 139, 34))
|
||||
("fuchsia", css(255, 0, 255))
|
||||
("gainsboro", css(220, 220, 220))
|
||||
("ghostwhite", css(248, 248, 255))
|
||||
("gold", css(255, 215, 0))
|
||||
("goldenrod", css(218, 165, 32))
|
||||
("gray", css(128, 128, 128))
|
||||
("grey", css(128, 128, 128))
|
||||
("green", css(0, 128, 0))
|
||||
("greenyellow", css(173, 255, 47))
|
||||
("honeydew", css(240, 255, 240))
|
||||
("hotpink", css(255, 105, 180))
|
||||
("indianred", css(205, 92, 92))
|
||||
("indigo", css(75, 0, 130))
|
||||
("ivory", css(255, 255, 240))
|
||||
("khaki", css(240, 230, 140))
|
||||
("lavender", css(230, 230, 250))
|
||||
("lavenderblush", css(255, 240, 245))
|
||||
("lawngreen", css(124, 252, 0))
|
||||
("lemonchiffon", css(255, 250, 205))
|
||||
("lightblue", css(173, 216, 230))
|
||||
("lightcoral", css(240, 128, 128))
|
||||
("lightcyan", css(224, 255, 255))
|
||||
("lightgoldenrodyellow", css(250, 250, 210))
|
||||
("lightgray", css(211, 211, 211))
|
||||
("lightgreen", css(144, 238, 144))
|
||||
("lightgrey", css(211, 211, 211))
|
||||
("lightpink", css(255, 182, 193))
|
||||
("lightsalmon", css(255, 160, 122))
|
||||
("lightseagreen", css(32, 178, 170))
|
||||
("lightskyblue", css(135, 206, 250))
|
||||
("lightslategray", css(119, 136, 153))
|
||||
("lightslategrey", css(119, 136, 153))
|
||||
("lightsteelblue", css(176, 196, 222))
|
||||
("lightyellow", css(255, 255, 224))
|
||||
("lime", css(0, 255, 0))
|
||||
("limegreen", css(50, 205, 50))
|
||||
("linen", css(250, 240, 230))
|
||||
("magenta", css(255, 0, 255))
|
||||
("maroon", css(128, 0, 0))
|
||||
("mediumaquamarine", css(102, 205, 170))
|
||||
("mediumblue", css(0, 0, 205))
|
||||
("mediumorchid", css(186, 85, 211))
|
||||
("mediumpurple", css(147, 112, 219))
|
||||
("mediumseagreen", css(60, 179, 113))
|
||||
("mediumslateblue", css(123, 104, 238))
|
||||
("mediumspringgreen", css(0, 250, 154))
|
||||
("mediumturquoise", css(72, 209, 204))
|
||||
("mediumvioletred", css(199, 21, 133))
|
||||
("midnightblue", css(25, 25, 112))
|
||||
("mintcream", css(245, 255, 250))
|
||||
("mistyrose", css(255, 228, 225))
|
||||
("moccasin", css(255, 228, 181))
|
||||
("navajowhite", css(255, 222, 173))
|
||||
("navy", css(0, 0, 128))
|
||||
("oldlace", css(253, 245, 230))
|
||||
("olive", css(128, 128, 0))
|
||||
("olivedrab", css(107, 142, 35))
|
||||
("orange", css(255, 165, 0))
|
||||
("orangered", css(255, 69, 0))
|
||||
("orchid", css(218, 112, 214))
|
||||
("palegoldenrod", css(238, 232, 170))
|
||||
("palegreen", css(152, 251, 152))
|
||||
("paleturquoise", css(175, 238, 238))
|
||||
("palevioletred", css(219, 112, 147))
|
||||
("papayawhip", css(255, 239, 213))
|
||||
("peachpuff", css(255, 218, 185))
|
||||
("peru", css(205, 133, 63))
|
||||
("pink", css(255, 192, 203))
|
||||
("plum", css(221, 160, 221))
|
||||
("powderblue", css(176, 224, 230))
|
||||
("purple", css(128, 0, 128))
|
||||
("red", css(255, 0, 0))
|
||||
("rosybrown", css(188, 143, 143))
|
||||
("royalblue", css(65, 105, 225))
|
||||
("saddlebrown", css(139, 69, 19))
|
||||
("salmon", css(250, 128, 114))
|
||||
("sandybrown", css(244, 164, 96))
|
||||
("seagreen", css(46, 139, 87))
|
||||
("seashell", css(255, 245, 238))
|
||||
("sienna", css(160, 82, 45))
|
||||
("silver", css(192, 192, 192))
|
||||
("skyblue", css(135, 206, 235))
|
||||
("slateblue", css(106, 90, 205))
|
||||
("slategray", css(112, 128, 144))
|
||||
("slategrey", css(112, 128, 144))
|
||||
("snow", css(255, 250, 250))
|
||||
("springgreen", css(0, 255, 127))
|
||||
("steelblue", css(70, 130, 180))
|
||||
("tan", css(210, 180, 140))
|
||||
("teal", css(0, 128, 128))
|
||||
("thistle", css(216, 191, 216))
|
||||
("tomato", css(255, 99, 71))
|
||||
("turquoise", css(64, 224, 208))
|
||||
("violet", css(238, 130, 238))
|
||||
("wheat", css(245, 222, 179))
|
||||
("white", css(255, 255, 255))
|
||||
("whitesmoke", css(245, 245, 245))
|
||||
("yellow", css(255, 255, 0))
|
||||
("yellowgreen", css(154, 205, 50))
|
||||
("transparent", css(0, 0, 0, 0))
|
||||
;
|
||||
}
|
||||
} ;
|
||||
|
||||
// clipper helper
|
||||
|
||||
template <int MIN,int MAX>
|
||||
inline int clip_int(int val)
|
||||
{
|
||||
if (val < MIN ) return MIN;
|
||||
if (val > MAX ) return MAX;
|
||||
return val;
|
||||
}
|
||||
|
||||
struct percent_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
|
||||
unsigned operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val)/100.0 + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
struct alpha_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
|
||||
unsigned operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val) + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// http://www.w3.org/TR/css3-color/#hsl-color
|
||||
inline double hue_to_rgb( double m1, double m2, double h)
|
||||
{
|
||||
if (h < 0.0) h = h + 1.0;
|
||||
else if (h > 1) h = h - 1.0;
|
||||
|
||||
if (h * 6 < 1.0)
|
||||
return m1 + (m2 - m1) * h * 6.0;
|
||||
if (h * 2 < 1.0)
|
||||
return m2;
|
||||
if (h * 3 < 2.0)
|
||||
return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0;
|
||||
return m1;
|
||||
}
|
||||
|
||||
struct hsl_conv_impl
|
||||
{
|
||||
template<typename T0,typename T1, typename T2, typename T3>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
void operator() (T0 & c, T1 h, T2 s, T3 l) const
|
||||
{
|
||||
double m1,m2;
|
||||
// normalize values
|
||||
h /= 360.0;
|
||||
s /= 100.0;
|
||||
l /= 100.0;
|
||||
|
||||
if (l <= 0.5)
|
||||
m2 = l * (s + 1.0);
|
||||
else
|
||||
m2 = l + s - l*s;
|
||||
m1 = l * 2 - m2;
|
||||
|
||||
double r = hue_to_rgb(m1, m2, h + 1.0/3.0);
|
||||
double g = hue_to_rgb(m1, m2, h);
|
||||
double b = hue_to_rgb(m1, m2, h - 1.0/3.0);
|
||||
|
||||
c.r = clip_int<0,255>(int((255.0 * r) + 0.5));
|
||||
c.g = clip_int<0,255>(int((255.0 * g) + 0.5));
|
||||
c.b = clip_int<0,255>(int((255.0 * b) + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Iterator>
|
||||
struct css_color_grammar : qi::grammar<Iterator, css(), ascii_space_type>
|
||||
{
|
||||
|
||||
css_color_grammar()
|
||||
: css_color_grammar::base_type(css_color)
|
||||
|
||||
{
|
||||
using qi::lit;
|
||||
using qi::_val;
|
||||
using qi::double_;
|
||||
using qi::_1;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_c;
|
||||
using ascii::no_case;
|
||||
using phoenix::at_c;
|
||||
|
||||
css_color %= rgba_color
|
||||
| rgba_percent_color
|
||||
| hsl_percent_color
|
||||
| hex_color
|
||||
| hex_color_small
|
||||
| no_case[named];
|
||||
|
||||
hex_color %= lit('#')
|
||||
>> hex2
|
||||
>> hex2
|
||||
>> hex2
|
||||
>> -hex2
|
||||
;
|
||||
|
||||
hex_color_small = lit('#')
|
||||
>> hex1 [ at_c<0>(_val) = _1 | _1 << 4 ]
|
||||
>> hex1 [ at_c<1>(_val) = _1 | _1 << 4 ]
|
||||
>> hex1 [ at_c<2>(_val) = _1 | _1 << 4 ]
|
||||
>> -hex1[ at_c<3>(_val) = _1 | _1 << 4 ]
|
||||
;
|
||||
|
||||
rgba_color = lit("rgb") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> dec3 [at_c<0>(_val) = _1] >> ','
|
||||
>> dec3 [at_c<1>(_val) = _1] >> ','
|
||||
>> dec3 [at_c<2>(_val) = _1]
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)])
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
rgba_percent_color = lit("rgb") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> double_ [at_c<0>(_val) = percent_converter(_1)] >> '%' >> ','
|
||||
>> double_ [at_c<1>(_val) = percent_converter(_1)] >> '%' >> ','
|
||||
>> double_ [at_c<2>(_val) = percent_converter(_1)] >> '%'
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)])
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
hsl_percent_color = lit("hsl") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> double_ [ _a = _1] >> ',' // hue 0..360
|
||||
>> double_ [ _b = _1] >> '%' >> ',' // saturation 0..100%
|
||||
>> double_ [ _c = _1] >> '%' // lightness 0..100%
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) // opacity 0...1
|
||||
>> lit (')') [ hsl_converter(_val,_a,_b,_c)]
|
||||
;
|
||||
}
|
||||
|
||||
qi::uint_parser< unsigned, 16, 2, 2 > hex2 ;
|
||||
qi::uint_parser< unsigned, 16, 1, 1 > hex1 ;
|
||||
qi::uint_parser< unsigned, 10, 1, 3 > dec3 ;
|
||||
qi::rule<Iterator, css(), ascii_space_type> rgba_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> rgba_percent_color;
|
||||
qi::rule<Iterator, qi::locals<double,double,double>,css(), ascii_space_type> hsl_percent_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> hex_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> hex_color_small;
|
||||
qi::rule<Iterator, css(), ascii_space_type> css_color;
|
||||
named_colors_ named;
|
||||
phoenix::function<percent_conv_impl> percent_converter;
|
||||
phoenix::function<alpha_conv_impl> alpha_converter;
|
||||
phoenix::function<hsl_conv_impl> hsl_converter;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
|
|
|
@ -1,420 +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 MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
|
||||
// spirit2
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
|
||||
// phoenix
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_fusion.hpp>
|
||||
#include <boost/spirit/include/phoenix_function.hpp>
|
||||
|
||||
// fusion
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
|
||||
// not in boost 1.41
|
||||
//#include <boost/fusion/include/adapt_class.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
//BOOST_FUSION_ADAPT_CLASS(
|
||||
// mapnik::color,
|
||||
// (unsigned, unsigned, obj.red(), obj.set_red(val))
|
||||
// (unsigned, unsigned, obj.green(), obj.set_green(val))
|
||||
// (unsigned, unsigned, obj.blue(), obj.set_blue(val))
|
||||
// (unsigned, unsigned, obj.alpha(), obj.set_alpha(val))
|
||||
// )
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
// temp workaround . TODO: adapt mapnik::color
|
||||
struct css
|
||||
{
|
||||
css ()
|
||||
: r(255),g(255),b(255),a(255) {}
|
||||
css(unsigned r_,unsigned g_, unsigned b_,unsigned a_ = 0xff)
|
||||
: r(r_),g(g_),b(b_),a(a_) {}
|
||||
|
||||
unsigned r;
|
||||
unsigned g;
|
||||
unsigned b;
|
||||
unsigned a;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::css,
|
||||
(unsigned, r)
|
||||
(unsigned, g)
|
||||
(unsigned, b)
|
||||
(unsigned, a)
|
||||
)
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
namespace ascii = boost::spirit::ascii;
|
||||
namespace phoenix = boost::phoenix;
|
||||
|
||||
typedef boost::spirit::ascii::space_type ascii_space_type;
|
||||
|
||||
struct named_colors_ : qi::symbols<char,css>
|
||||
{
|
||||
named_colors_()
|
||||
{
|
||||
add
|
||||
("aliceblue", css(240, 248, 255))
|
||||
("antiquewhite", css(250, 235, 215))
|
||||
("aqua", css(0, 255, 255))
|
||||
("aquamarine", css(127, 255, 212))
|
||||
("azure", css(240, 255, 255))
|
||||
("beige", css(245, 245, 220))
|
||||
("bisque", css(255, 228, 196))
|
||||
("black", css(0, 0, 0))
|
||||
("blanchedalmond", css(255,235,205))
|
||||
("blue", css(0, 0, 255))
|
||||
("blueviolet", css(138, 43, 226))
|
||||
("brown", css(165, 42, 42))
|
||||
("burlywood", css(222, 184, 135))
|
||||
("cadetblue", css(95, 158, 160))
|
||||
("chartreuse", css(127, 255, 0))
|
||||
("chocolate", css(210, 105, 30))
|
||||
("coral", css(255, 127, 80))
|
||||
("cornflowerblue", css(100, 149, 237))
|
||||
("cornsilk", css(255, 248, 220))
|
||||
("crimson", css(220, 20, 60))
|
||||
("cyan", css(0, 255, 255))
|
||||
("darkblue", css(0, 0, 139))
|
||||
("darkcyan", css(0, 139, 139))
|
||||
("darkgoldenrod", css(184, 134, 11))
|
||||
("darkgray", css(169, 169, 169))
|
||||
("darkgreen", css(0, 100, 0))
|
||||
("darkgrey", css(169, 169, 169))
|
||||
("darkkhaki", css(189, 183, 107))
|
||||
("darkmagenta", css(139, 0, 139))
|
||||
("darkolivegreen", css(85, 107, 47))
|
||||
("darkorange", css(255, 140, 0))
|
||||
("darkorchid", css(153, 50, 204))
|
||||
("darkred", css(139, 0, 0))
|
||||
("darksalmon", css(233, 150, 122))
|
||||
("darkseagreen", css(143, 188, 143))
|
||||
("darkslateblue", css(72, 61, 139))
|
||||
("darkslategrey", css(47, 79, 79))
|
||||
("darkturquoise", css(0, 206, 209))
|
||||
("darkviolet", css(148, 0, 211))
|
||||
("deeppink", css(255, 20, 147))
|
||||
("deepskyblue", css(0, 191, 255))
|
||||
("dimgray", css(105, 105, 105))
|
||||
("dimgrey", css(105, 105, 105))
|
||||
("dodgerblue", css(30, 144, 255))
|
||||
("firebrick", css(178, 34, 34))
|
||||
("floralwhite", css(255, 250, 240))
|
||||
("forestgreen", css(34, 139, 34))
|
||||
("fuchsia", css(255, 0, 255))
|
||||
("gainsboro", css(220, 220, 220))
|
||||
("ghostwhite", css(248, 248, 255))
|
||||
("gold", css(255, 215, 0))
|
||||
("goldenrod", css(218, 165, 32))
|
||||
("gray", css(128, 128, 128))
|
||||
("grey", css(128, 128, 128))
|
||||
("green", css(0, 128, 0))
|
||||
("greenyellow", css(173, 255, 47))
|
||||
("honeydew", css(240, 255, 240))
|
||||
("hotpink", css(255, 105, 180))
|
||||
("indianred", css(205, 92, 92))
|
||||
("indigo", css(75, 0, 130))
|
||||
("ivory", css(255, 255, 240))
|
||||
("khaki", css(240, 230, 140))
|
||||
("lavender", css(230, 230, 250))
|
||||
("lavenderblush", css(255, 240, 245))
|
||||
("lawngreen", css(124, 252, 0))
|
||||
("lemonchiffon", css(255, 250, 205))
|
||||
("lightblue", css(173, 216, 230))
|
||||
("lightcoral", css(240, 128, 128))
|
||||
("lightcyan", css(224, 255, 255))
|
||||
("lightgoldenrodyellow", css(250, 250, 210))
|
||||
("lightgray", css(211, 211, 211))
|
||||
("lightgreen", css(144, 238, 144))
|
||||
("lightgrey", css(211, 211, 211))
|
||||
("lightpink", css(255, 182, 193))
|
||||
("lightsalmon", css(255, 160, 122))
|
||||
("lightseagreen", css(32, 178, 170))
|
||||
("lightskyblue", css(135, 206, 250))
|
||||
("lightslategray", css(119, 136, 153))
|
||||
("lightslategrey", css(119, 136, 153))
|
||||
("lightsteelblue", css(176, 196, 222))
|
||||
("lightyellow", css(255, 255, 224))
|
||||
("lime", css(0, 255, 0))
|
||||
("limegreen", css(50, 205, 50))
|
||||
("linen", css(250, 240, 230))
|
||||
("magenta", css(255, 0, 255))
|
||||
("maroon", css(128, 0, 0))
|
||||
("mediumaquamarine", css(102, 205, 170))
|
||||
("mediumblue", css(0, 0, 205))
|
||||
("mediumorchid", css(186, 85, 211))
|
||||
("mediumpurple", css(147, 112, 219))
|
||||
("mediumseagreen", css(60, 179, 113))
|
||||
("mediumslateblue", css(123, 104, 238))
|
||||
("mediumspringgreen", css(0, 250, 154))
|
||||
("mediumturquoise", css(72, 209, 204))
|
||||
("mediumvioletred", css(199, 21, 133))
|
||||
("midnightblue", css(25, 25, 112))
|
||||
("mintcream", css(245, 255, 250))
|
||||
("mistyrose", css(255, 228, 225))
|
||||
("moccasin", css(255, 228, 181))
|
||||
("navajowhite", css(255, 222, 173))
|
||||
("navy", css(0, 0, 128))
|
||||
("oldlace", css(253, 245, 230))
|
||||
("olive", css(128, 128, 0))
|
||||
("olivedrab", css(107, 142, 35))
|
||||
("orange", css(255, 165, 0))
|
||||
("orangered", css(255, 69, 0))
|
||||
("orchid", css(218, 112, 214))
|
||||
("palegoldenrod", css(238, 232, 170))
|
||||
("palegreen", css(152, 251, 152))
|
||||
("paleturquoise", css(175, 238, 238))
|
||||
("palevioletred", css(219, 112, 147))
|
||||
("papayawhip", css(255, 239, 213))
|
||||
("peachpuff", css(255, 218, 185))
|
||||
("peru", css(205, 133, 63))
|
||||
("pink", css(255, 192, 203))
|
||||
("plum", css(221, 160, 221))
|
||||
("powderblue", css(176, 224, 230))
|
||||
("purple", css(128, 0, 128))
|
||||
("red", css(255, 0, 0))
|
||||
("rosybrown", css(188, 143, 143))
|
||||
("royalblue", css(65, 105, 225))
|
||||
("saddlebrown", css(139, 69, 19))
|
||||
("salmon", css(250, 128, 114))
|
||||
("sandybrown", css(244, 164, 96))
|
||||
("seagreen", css(46, 139, 87))
|
||||
("seashell", css(255, 245, 238))
|
||||
("sienna", css(160, 82, 45))
|
||||
("silver", css(192, 192, 192))
|
||||
("skyblue", css(135, 206, 235))
|
||||
("slateblue", css(106, 90, 205))
|
||||
("slategray", css(112, 128, 144))
|
||||
("slategrey", css(112, 128, 144))
|
||||
("snow", css(255, 250, 250))
|
||||
("springgreen", css(0, 255, 127))
|
||||
("steelblue", css(70, 130, 180))
|
||||
("tan", css(210, 180, 140))
|
||||
("teal", css(0, 128, 128))
|
||||
("thistle", css(216, 191, 216))
|
||||
("tomato", css(255, 99, 71))
|
||||
("turquoise", css(64, 224, 208))
|
||||
("violet", css(238, 130, 238))
|
||||
("wheat", css(245, 222, 179))
|
||||
("white", css(255, 255, 255))
|
||||
("whitesmoke", css(245, 245, 245))
|
||||
("yellow", css(255, 255, 0))
|
||||
("yellowgreen", css(154, 205, 50))
|
||||
("transparent", css(0, 0, 0, 0))
|
||||
;
|
||||
}
|
||||
} ;
|
||||
|
||||
// clipper helper
|
||||
|
||||
template <int MIN,int MAX>
|
||||
inline int clip_int(int val)
|
||||
{
|
||||
if (val < MIN ) return MIN;
|
||||
if (val > MAX ) return MAX;
|
||||
return val;
|
||||
}
|
||||
|
||||
struct percent_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
|
||||
unsigned operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val)/100.0 + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
struct alpha_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
|
||||
unsigned operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val) + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// http://www.w3.org/TR/css3-color/#hsl-color
|
||||
inline double hue_to_rgb( double m1, double m2, double h)
|
||||
{
|
||||
if (h < 0.0) h = h + 1.0;
|
||||
else if (h > 1) h = h - 1.0;
|
||||
|
||||
if (h * 6 < 1.0)
|
||||
return m1 + (m2 - m1) * h * 6.0;
|
||||
if (h * 2 < 1.0)
|
||||
return m2;
|
||||
if (h * 3 < 2.0)
|
||||
return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0;
|
||||
return m1;
|
||||
}
|
||||
|
||||
struct hsl_conv_impl
|
||||
{
|
||||
template<typename T0,typename T1, typename T2, typename T3>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
void operator() (T0 & c, T1 h, T2 s, T3 l) const
|
||||
{
|
||||
double m1,m2;
|
||||
// normalize values
|
||||
h /= 360.0;
|
||||
s /= 100.0;
|
||||
l /= 100.0;
|
||||
|
||||
if (l <= 0.5)
|
||||
m2 = l * (s + 1.0);
|
||||
else
|
||||
m2 = l + s - l*s;
|
||||
m1 = l * 2 - m2;
|
||||
|
||||
double r = hue_to_rgb(m1, m2, h + 1.0/3.0);
|
||||
double g = hue_to_rgb(m1, m2, h);
|
||||
double b = hue_to_rgb(m1, m2, h - 1.0/3.0);
|
||||
|
||||
c.r = clip_int<0,255>(int((255.0 * r) + 0.5));
|
||||
c.g = clip_int<0,255>(int((255.0 * g) + 0.5));
|
||||
c.b = clip_int<0,255>(int((255.0 * b) + 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Iterator>
|
||||
struct css_color_grammar : qi::grammar<Iterator, css(), ascii_space_type>
|
||||
{
|
||||
|
||||
css_color_grammar()
|
||||
: css_color_grammar::base_type(css_color)
|
||||
|
||||
{
|
||||
using qi::lit;
|
||||
using qi::_val;
|
||||
using qi::double_;
|
||||
using qi::_1;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_c;
|
||||
using ascii::no_case;
|
||||
using phoenix::at_c;
|
||||
|
||||
css_color %= rgba_color
|
||||
| rgba_percent_color
|
||||
| hsl_percent_color
|
||||
| hex_color
|
||||
| hex_color_small
|
||||
| no_case[named];
|
||||
|
||||
hex_color %= lit('#')
|
||||
>> hex2
|
||||
>> hex2
|
||||
>> hex2
|
||||
>> -hex2
|
||||
;
|
||||
|
||||
hex_color_small = lit('#')
|
||||
>> hex1 [ at_c<0>(_val) = _1 | _1 << 4 ]
|
||||
>> hex1 [ at_c<1>(_val) = _1 | _1 << 4 ]
|
||||
>> hex1 [ at_c<2>(_val) = _1 | _1 << 4 ]
|
||||
>> -hex1[ at_c<3>(_val) = _1 | _1 << 4 ]
|
||||
;
|
||||
|
||||
rgba_color = lit("rgb") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> dec3 [at_c<0>(_val) = _1] >> ','
|
||||
>> dec3 [at_c<1>(_val) = _1] >> ','
|
||||
>> dec3 [at_c<2>(_val) = _1]
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)])
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
rgba_percent_color = lit("rgb") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> double_ [at_c<0>(_val) = percent_converter(_1)] >> '%' >> ','
|
||||
>> double_ [at_c<1>(_val) = percent_converter(_1)] >> '%' >> ','
|
||||
>> double_ [at_c<2>(_val) = percent_converter(_1)] >> '%'
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)])
|
||||
>> lit(')')
|
||||
;
|
||||
|
||||
hsl_percent_color = lit("hsl") >> -lit('a')
|
||||
>> lit('(')
|
||||
>> double_ [ _a = _1] >> ',' // hue 0..360
|
||||
>> double_ [ _b = _1] >> '%' >> ',' // saturation 0..100%
|
||||
>> double_ [ _c = _1] >> '%' // lightness 0..100%
|
||||
>> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) // opacity 0...1
|
||||
>> lit (')') [ hsl_converter(_val,_a,_b,_c)]
|
||||
;
|
||||
}
|
||||
|
||||
qi::uint_parser< unsigned, 16, 2, 2 > hex2 ;
|
||||
qi::uint_parser< unsigned, 16, 1, 1 > hex1 ;
|
||||
qi::uint_parser< unsigned, 10, 1, 3 > dec3 ;
|
||||
qi::rule<Iterator, css(), ascii_space_type> rgba_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> rgba_percent_color;
|
||||
qi::rule<Iterator, qi::locals<double,double,double>,css(), ascii_space_type> hsl_percent_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> hex_color;
|
||||
qi::rule<Iterator, css(), ascii_space_type> hex_color_small;
|
||||
qi::rule<Iterator, css(), ascii_space_type> css_color;
|
||||
named_colors_ named;
|
||||
phoenix::function<percent_conv_impl> percent_converter;
|
||||
phoenix::function<alpha_conv_impl> alpha_converter;
|
||||
phoenix::function<hsl_conv_impl> hsl_converter;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
#include <mapnik/memory_datasource.hpp>
|
||||
|
||||
|
||||
// stl
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -40,6 +38,7 @@ namespace mapnik
|
|||
class Map;
|
||||
class layer;
|
||||
class projection;
|
||||
class proj_transform;
|
||||
|
||||
template <typename Processor>
|
||||
class feature_style_processor
|
||||
|
@ -58,15 +57,6 @@ public:
|
|||
*/
|
||||
void apply(mapnik::layer const& lyr, std::set<std::string>& names);
|
||||
private:
|
||||
/*!
|
||||
* @return initialize metawriters for a given map and projection.
|
||||
*/
|
||||
void start_metawriters(Map const& m_, projection const& proj);
|
||||
/*!
|
||||
* @return stop metawriters that were previously initialized.
|
||||
*/
|
||||
void stop_metawriters(Map const& m_);
|
||||
|
||||
/*!
|
||||
* @return render a layer given a projection and scale.
|
||||
*/
|
||||
|
|
|
@ -126,6 +126,14 @@ public:
|
|||
push_vertex(x,y,SEG_CLOSE);
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
if (cont_.size() > 3)
|
||||
{
|
||||
cont_.set_command(cont_.size() - 1, SEG_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned vertex(double* x, double* y) const
|
||||
{
|
||||
return cont_.get_vertex(itr_++,x,y);
|
||||
|
|
279
include/mapnik/grid/grid_marker_helpers.hpp
Normal file
279
include/mapnik/grid/grid_marker_helpers.hpp
Normal file
|
@ -0,0 +1,279 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2012 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_GRID_MARKER_HELPERS_HPP
|
||||
#define MAPNIK_GRID_MARKER_HELPERS_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/markers_symbolizer.hpp>
|
||||
#include <mapnik/markers_placement.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_renderer_scanline.h"
|
||||
#include "agg_scanline_bin.h"
|
||||
#include "agg_image_filters.h"
|
||||
#include "agg_trans_bilinear.h"
|
||||
#include "agg_span_allocator.h"
|
||||
#include "agg_image_accessors.h"
|
||||
#include "agg_span_image_filter_gray.h"
|
||||
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
template <typename BufferType, typename Rasterizer, typename PixFmt, typename RendererBase, typename RendererType, typename Detector, typename PixMapType>
|
||||
struct raster_markers_rasterizer_dispatch_grid
|
||||
{
|
||||
typedef mapnik::gray32 color_type;
|
||||
typedef typename RendererBase::pixfmt_type pixfmt_type;
|
||||
|
||||
raster_markers_rasterizer_dispatch_grid(BufferType & render_buffer,
|
||||
Rasterizer & ras,
|
||||
image_data_32 const& src,
|
||||
agg::trans_affine const& marker_trans,
|
||||
markers_symbolizer const& sym,
|
||||
Detector & detector,
|
||||
double scale_factor,
|
||||
mapnik::feature_impl & feature,
|
||||
PixMapType & pixmap)
|
||||
: buf_(render_buffer),
|
||||
pixf_(buf_),
|
||||
renb_(pixf_),
|
||||
ras_(ras),
|
||||
src_(src),
|
||||
marker_trans_(marker_trans),
|
||||
sym_(sym),
|
||||
detector_(detector),
|
||||
scale_factor_(scale_factor),
|
||||
feature_(feature),
|
||||
pixmap_(pixmap),
|
||||
placed_(false)
|
||||
{
|
||||
// TODO - support basic binary operators
|
||||
//pixf_.comp_op(static_cast<agg::comp_op_e>(sym_.comp_op()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void add_path(T & path)
|
||||
{
|
||||
marker_placement_e placement_method = sym_.get_marker_placement();
|
||||
box2d<double> bbox_(0,0, src_.width(),src_.height());
|
||||
if (placement_method != MARKER_LINE_PLACEMENT)
|
||||
{
|
||||
double x,y;
|
||||
path.rewind(0);
|
||||
if (placement_method == MARKER_INTERIOR_PLACEMENT)
|
||||
{
|
||||
label::interior_position(path, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
label::centroid(path, x, y);
|
||||
}
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
matrix.translate(x,y);
|
||||
box2d<double> transformed_bbox = bbox_ * matrix;
|
||||
if (sym_.get_allow_overlap() ||
|
||||
detector_.has_placement(transformed_bbox))
|
||||
{
|
||||
render_raster_marker(matrix);
|
||||
if (!sym_.get_ignore_placement())
|
||||
{
|
||||
detector_.insert(transformed_bbox);
|
||||
}
|
||||
if (!placed_)
|
||||
{
|
||||
pixmap_.add_feature(feature_);
|
||||
placed_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
markers_placement<T, label_collision_detector4> placement(path, bbox_, marker_trans_, detector_,
|
||||
sym_.get_spacing() * scale_factor_,
|
||||
sym_.get_max_error(),
|
||||
sym_.get_allow_overlap());
|
||||
double x, y, angle;
|
||||
while (placement.get_point(x, y, angle))
|
||||
{
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
render_raster_marker(matrix);
|
||||
if (!placed_)
|
||||
{
|
||||
pixmap_.add_feature(feature_);
|
||||
placed_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void render_raster_marker(agg::trans_affine const& marker_tr)
|
||||
{
|
||||
double width = src_.width();
|
||||
double height = src_.height();
|
||||
double p[8];
|
||||
p[0] = 0; p[1] = 0;
|
||||
p[2] = width; p[3] = 0;
|
||||
p[4] = width; p[5] = height;
|
||||
p[6] = 0; p[7] = height;
|
||||
marker_tr.transform(&p[0], &p[1]);
|
||||
marker_tr.transform(&p[2], &p[3]);
|
||||
marker_tr.transform(&p[4], &p[5]);
|
||||
marker_tr.transform(&p[6], &p[7]);
|
||||
ras_.move_to_d(p[0],p[1]);
|
||||
ras_.line_to_d(p[2],p[3]);
|
||||
ras_.line_to_d(p[4],p[5]);
|
||||
ras_.line_to_d(p[6],p[7]);
|
||||
RendererType ren(renb_);
|
||||
ren.color(mapnik::gray32(feature_.id()));
|
||||
agg::render_scanlines(ras_, sl_, ren);
|
||||
}
|
||||
|
||||
private:
|
||||
agg::scanline_bin sl_;
|
||||
BufferType & buf_;
|
||||
PixFmt pixf_;
|
||||
RendererBase renb_;
|
||||
Rasterizer & ras_;
|
||||
image_data_32 const& src_;
|
||||
agg::trans_affine const& marker_trans_;
|
||||
markers_symbolizer const& sym_;
|
||||
Detector & detector_;
|
||||
double scale_factor_;
|
||||
mapnik::feature_impl & feature_;
|
||||
PixMapType & pixmap_;
|
||||
bool placed_;
|
||||
};
|
||||
|
||||
|
||||
template <typename BufferType, typename SvgRenderer, typename Rasterizer, typename Detector, typename PixMapType>
|
||||
struct vector_markers_rasterizer_dispatch_grid
|
||||
{
|
||||
typedef typename SvgRenderer::renderer_base renderer_base;
|
||||
typedef typename renderer_base::pixfmt_type pixfmt_type;
|
||||
|
||||
vector_markers_rasterizer_dispatch_grid(BufferType & render_buffer,
|
||||
SvgRenderer & svg_renderer,
|
||||
Rasterizer & ras,
|
||||
box2d<double> const& bbox,
|
||||
agg::trans_affine const& marker_trans,
|
||||
markers_symbolizer const& sym,
|
||||
Detector & detector,
|
||||
double scale_factor,
|
||||
mapnik::feature_impl & feature,
|
||||
PixMapType & pixmap)
|
||||
: buf_(render_buffer),
|
||||
pixf_(buf_),
|
||||
renb_(pixf_),
|
||||
svg_renderer_(svg_renderer),
|
||||
ras_(ras),
|
||||
bbox_(bbox),
|
||||
marker_trans_(marker_trans),
|
||||
sym_(sym),
|
||||
detector_(detector),
|
||||
scale_factor_(scale_factor),
|
||||
feature_(feature),
|
||||
pixmap_(pixmap),
|
||||
placed_(false)
|
||||
{
|
||||
// TODO
|
||||
//pixf_.comp_op(static_cast<agg::comp_op_e>(sym_.comp_op()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void add_path(T & path)
|
||||
{
|
||||
marker_placement_e placement_method = sym_.get_marker_placement();
|
||||
if (placement_method != MARKER_LINE_PLACEMENT)
|
||||
{
|
||||
double x,y;
|
||||
path.rewind(0);
|
||||
if (placement_method == MARKER_INTERIOR_PLACEMENT)
|
||||
{
|
||||
label::interior_position(path, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
label::centroid(path, x, y);
|
||||
}
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
matrix.translate(x,y);
|
||||
box2d<double> transformed_bbox = bbox_ * matrix;
|
||||
if (sym_.get_allow_overlap() ||
|
||||
detector_.has_placement(transformed_bbox))
|
||||
{
|
||||
svg_renderer_.render_id(ras_, sl_, renb_, feature_.id(), matrix, sym_.get_opacity(), bbox_);
|
||||
if (!sym_.get_ignore_placement())
|
||||
{
|
||||
detector_.insert(transformed_bbox);
|
||||
}
|
||||
if (!placed_)
|
||||
{
|
||||
pixmap_.add_feature(feature_);
|
||||
placed_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
markers_placement<T, Detector> placement(path, bbox_, marker_trans_, detector_,
|
||||
sym_.get_spacing() * scale_factor_,
|
||||
sym_.get_max_error(),
|
||||
sym_.get_allow_overlap());
|
||||
double x, y, angle;
|
||||
while (placement.get_point(x, y, angle))
|
||||
{
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
svg_renderer_.render_id(ras_, sl_, renb_, feature_.id(), matrix, sym_.get_opacity(), bbox_);
|
||||
if (!placed_)
|
||||
{
|
||||
pixmap_.add_feature(feature_);
|
||||
placed_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
agg::scanline_bin sl_;
|
||||
BufferType & buf_;
|
||||
pixfmt_type pixf_;
|
||||
renderer_base renb_;
|
||||
SvgRenderer & svg_renderer_;
|
||||
Rasterizer & ras_;
|
||||
box2d<double> const& bbox_;
|
||||
agg::trans_affine const& marker_trans_;
|
||||
markers_symbolizer const& sym_;
|
||||
Detector & detector_;
|
||||
double scale_factor_;
|
||||
mapnik::feature_impl & feature_;
|
||||
PixMapType & pixmap_;
|
||||
bool placed_;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -74,8 +74,8 @@ enum composite_mode_e
|
|||
hue,
|
||||
saturation,
|
||||
_color,
|
||||
_value,
|
||||
colorize_alpha
|
||||
_value
|
||||
//colorize_alpha
|
||||
};
|
||||
|
||||
MAPNIK_DECL boost::optional<composite_mode_e> comp_op_from_string(std::string const& name);
|
||||
|
|
|
@ -52,7 +52,7 @@ struct image_filter_grammar :
|
|||
|
||||
#if BOOST_VERSION >= 104700
|
||||
using qi::no_skip;
|
||||
start = -(filter % no_skip[*char_("; ")])
|
||||
start = -(filter % no_skip[*char_(", ")])
|
||||
;
|
||||
#else
|
||||
start = -(filter)
|
||||
|
@ -77,9 +77,10 @@ struct image_filter_grammar :
|
|||
lit("y-gradient")[push_back(_val,construct<mapnik::filter::y_gradient>())]
|
||||
|
|
||||
(lit("agg-stack-blur")[_a = 1, _b = 1]
|
||||
>> -( lit(':') >> radius_[_a = _1]
|
||||
>> -( lit('(') >> radius_[_a = _1]
|
||||
>> lit(',')
|
||||
>> radius_[_b = _1])
|
||||
>> radius_[_b = _1]
|
||||
>> lit(')'))
|
||||
[push_back(_val,construct<mapnik::filter::agg_stack_blur>(_a,_b))])
|
||||
|
|
||||
lit("invert")[push_back(_val,construct<mapnik::filter::invert>())]
|
||||
|
|
|
@ -219,6 +219,11 @@ template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
|||
std::string const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
std::string const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
|
||||
std::string const&,
|
||||
rgba_palette const&);
|
||||
|
|
|
@ -116,6 +116,22 @@ struct push_vertex
|
|||
}
|
||||
};
|
||||
|
||||
struct close_path
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void operator() (T path) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->close();
|
||||
}
|
||||
};
|
||||
|
||||
struct cleanup
|
||||
{
|
||||
template <typename T0>
|
||||
|
@ -187,6 +203,7 @@ struct feature_grammar :
|
|||
phoenix::function<put_property> put_property_;
|
||||
phoenix::function<extract_geometry> extract_geometry_;
|
||||
boost::phoenix::function<push_vertex> push_vertex_;
|
||||
boost::phoenix::function<close_path> close_path_;
|
||||
boost::phoenix::function<cleanup> cleanup_;
|
||||
|
||||
};
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <mapnik/feature_type_style.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/metawriter.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -36,6 +35,9 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class CoordTransform;
|
||||
|
||||
class MAPNIK_DECL Map
|
||||
{
|
||||
public:
|
||||
|
@ -72,7 +74,6 @@ private:
|
|||
boost::optional<color> background_;
|
||||
boost::optional<std::string> background_image_;
|
||||
std::map<std::string,feature_type_style> styles_;
|
||||
std::map<std::string,metawriter_ptr> metawriters_;
|
||||
std::map<std::string,font_set> fontsets_;
|
||||
std::vector<layer> layers_;
|
||||
aspect_fix_mode aspectFixMode_;
|
||||
|
@ -87,7 +88,6 @@ public:
|
|||
typedef std::map<std::string,feature_type_style>::iterator style_iterator;
|
||||
typedef std::map<std::string,font_set>::const_iterator const_fontset_iterator;
|
||||
typedef std::map<std::string,font_set>::iterator fontset_iterator;
|
||||
typedef std::map<std::string,metawriter_ptr>::const_iterator const_metawriter_iterator;
|
||||
|
||||
/*! \brief Default constructor.
|
||||
*
|
||||
|
@ -167,40 +167,6 @@ public:
|
|||
*/
|
||||
boost::optional<feature_type_style const&> find_style(std::string const& name) const;
|
||||
|
||||
/*! \brief Insert a metawriter in the map.
|
||||
* @param name The name of the writer.
|
||||
* @param style A pointer to the writer to insert.
|
||||
* @return true If success.
|
||||
* @return false If no success.
|
||||
*/
|
||||
bool insert_metawriter(std::string const& name, metawriter_ptr const& writer);
|
||||
|
||||
/*! \brief Remove a metawriter from the map.
|
||||
* @param name The name of the writer.
|
||||
*/
|
||||
void remove_metawriter(const std::string& name);
|
||||
|
||||
/*! \brief Find a metawriter.
|
||||
* @param name The name of the writer.
|
||||
* @return The writer if found. If not found return 0.
|
||||
*/
|
||||
metawriter_ptr find_metawriter(std::string const& name) const;
|
||||
|
||||
/*! \brief Get all metawriters.
|
||||
* @return Const reference to metawriters.
|
||||
*/
|
||||
std::map<std::string,metawriter_ptr> const& metawriters() const;
|
||||
|
||||
/*! \brief Get first iterator in metawriters.
|
||||
* @return Constant metawriter iterator.
|
||||
*/
|
||||
const_metawriter_iterator begin_metawriters() const;
|
||||
|
||||
/*! \brief Get last iterator in metawriters.
|
||||
* @return Constant metawriter iterator.
|
||||
*/
|
||||
const_metawriter_iterator end_metawriters() const;
|
||||
|
||||
/*! \brief Insert a fontset into the map.
|
||||
* @param name The name of the fontset.
|
||||
* @param style The fontset to insert.
|
||||
|
@ -413,34 +379,11 @@ public:
|
|||
*/
|
||||
featureset_ptr query_map_point(unsigned index, double x, double y) const;
|
||||
|
||||
/*!
|
||||
* @brief Resolve names to object references for metawriters.
|
||||
*/
|
||||
void init_metawriters();
|
||||
|
||||
~Map();
|
||||
|
||||
inline void set_aspect_fix_mode(aspect_fix_mode afm) { aspectFixMode_ = afm; }
|
||||
inline aspect_fix_mode get_aspect_fix_mode() const { return aspectFixMode_; }
|
||||
|
||||
/*!
|
||||
* @brief Metawriter properties.
|
||||
*
|
||||
* These properties are defined by the user and are substituted in filenames,
|
||||
* sepcial columns in tables, etc.
|
||||
*/
|
||||
metawriter_property_map metawriter_output_properties;
|
||||
|
||||
/*!
|
||||
* @brief Set a metawriter property.
|
||||
*/
|
||||
void set_metawriter_property(std::string name, std::string value);
|
||||
|
||||
/*!
|
||||
* @brief Get a metawriter property.
|
||||
*/
|
||||
std::string get_metawriter_property(std::string name) const;
|
||||
|
||||
/*!
|
||||
* @brief Get extra, arbitrary Parameters attached to the Map
|
||||
*/
|
||||
|
|
|
@ -359,7 +359,7 @@ bool push_explicit_style(Attr const& src, Attr & dst, markers_symbolizer const&
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void setup_label_transform(agg::trans_affine & tr, box2d<double> const& bbox, mapnik::feature_impl const& feature, T const& sym)
|
||||
void setup_transform_scaling(agg::trans_affine & tr, box2d<double> const& bbox, mapnik::feature_impl const& feature, T const& sym)
|
||||
{
|
||||
double width = 0;
|
||||
double height = 0;
|
||||
|
@ -388,10 +388,6 @@ void setup_label_transform(agg::trans_affine & tr, box2d<double> const& bbox, ma
|
|||
double sy = height/bbox.height();
|
||||
tr *= agg::trans_affine_scaling(sy);
|
||||
}
|
||||
else
|
||||
{
|
||||
evaluate_transform(tr, feature, sym.get_image_transform());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,169 +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 MAPNIK_METAWRITER_HPP
|
||||
#define MAPNIK_METAWRITER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
// stl
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class text_placement_info;
|
||||
class text_path;
|
||||
|
||||
/** Implementation of std::map that also returns const& for operator[]. */
|
||||
class metawriter_property_map
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, UnicodeString> property_map;
|
||||
typedef property_map::const_iterator const_iterator;
|
||||
|
||||
metawriter_property_map() :
|
||||
m_(),
|
||||
not_found_() {}
|
||||
|
||||
UnicodeString const& operator[](std::string const& key) const;
|
||||
UnicodeString& operator[](std::string const& key) {return m_[key];}
|
||||
|
||||
std::map<std::string, UnicodeString>::const_iterator find(std::string const& key) const
|
||||
{
|
||||
return m_.find(key);
|
||||
}
|
||||
|
||||
std::map<std::string, UnicodeString>::const_iterator end() const
|
||||
{
|
||||
return m_.end();
|
||||
}
|
||||
|
||||
UnicodeString const& get(std::string const& key) const
|
||||
{
|
||||
return (*this)[key];
|
||||
}
|
||||
|
||||
private:
|
||||
property_map m_;
|
||||
UnicodeString not_found_;
|
||||
};
|
||||
|
||||
|
||||
/** All properties to be output by a metawriter. */
|
||||
class metawriter_properties : public std::set<std::string>
|
||||
{
|
||||
public:
|
||||
metawriter_properties(boost::optional<std::string> str);
|
||||
metawriter_properties() {}
|
||||
template <class InputIterator> metawriter_properties(
|
||||
InputIterator first, InputIterator last) : std::set<std::string>(first, last) {}
|
||||
std::string to_string() const;
|
||||
};
|
||||
|
||||
/** Abstract baseclass for all metawriter classes. */
|
||||
class metawriter
|
||||
{
|
||||
public:
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
metawriter(metawriter_properties dflt_properties) :
|
||||
dflt_properties_(dflt_properties),
|
||||
width_(0),
|
||||
height_(0) {}
|
||||
virtual ~metawriter() {}
|
||||
/** Output a rectangular area.
|
||||
* \param box Area (in pixel coordinates)
|
||||
* \param feature The feature being processed
|
||||
* \param prj_trans Projection transformation
|
||||
* \param t Coordinate transformation
|
||||
* \param properties List of properties to output
|
||||
*/
|
||||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
virtual void add_text(boost::ptr_vector<text_path> const& placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
virtual void add_polygon(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
virtual void add_line(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties)=0;
|
||||
|
||||
/** Start processing.
|
||||
* Write file header, init database connection, ...
|
||||
*
|
||||
* \param properties metawriter_property_map object with userdefined values.
|
||||
* Useful for setting filename etc.
|
||||
*/
|
||||
virtual void start(metawriter_property_map const& properties)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(properties);
|
||||
}
|
||||
|
||||
/** Stop processing.
|
||||
* Write file footer, close database connection, ...
|
||||
*/
|
||||
virtual void stop() {}
|
||||
/** Set output size (pixels).
|
||||
* All features that are completely outside this size are discarded.
|
||||
*/
|
||||
void set_size(int width, int height) { width_ = width; height_ = height; }
|
||||
/** Set Map object's srs. */
|
||||
virtual void set_map_srs(projection const& proj)
|
||||
{
|
||||
boost::ignore_unused_variable_warning(proj);
|
||||
}
|
||||
|
||||
/** Return the list of default properties. */
|
||||
metawriter_properties const& get_default_properties() const { return dflt_properties_;}
|
||||
protected:
|
||||
metawriter_properties dflt_properties_;
|
||||
/** Output width (pixels). */
|
||||
int width_;
|
||||
/** Output height (pixels). */
|
||||
int height_;
|
||||
};
|
||||
|
||||
/** Shared pointer to metawriter object. */
|
||||
typedef boost::shared_ptr<metawriter> metawriter_ptr;
|
||||
/** Metawriter object + properties. */
|
||||
typedef std::pair<metawriter_ptr, metawriter_properties> metawriter_with_properties;
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_METAWRITER_HPP
|
|
@ -1,55 +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 MAPNIK_METAWRITER_FACTORY_HPP
|
||||
#define MAPNIK_METAWRITER_FACTORY_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/metawriter.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
class xml_node;
|
||||
|
||||
/**
|
||||
* Creates a metawriter with the properties specified in the property
|
||||
* tree argument. Currently, this is hard-coded to the JSON and inmem
|
||||
* metawriters, but should provide an easy point to make them a
|
||||
* proper factory method if this is wanted in the future.
|
||||
*/
|
||||
metawriter_ptr metawriter_create(xml_node const& pt);
|
||||
|
||||
/**
|
||||
* Writes properties into the given property tree representing the
|
||||
* metawriter argument, and which can be used to reconstruct it.
|
||||
*/
|
||||
void metawriter_save(
|
||||
const metawriter_ptr &m,
|
||||
boost::property_tree::ptree &pt,
|
||||
bool explicit_defaults);
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_METAWRITER_FACTORY_HPP
|
||||
|
|
@ -1,119 +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 MAPNIK_METAWRITER_INMEM_HPP
|
||||
#define MAPNIK_METAWRITER_INMEM_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/metawriter.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <list>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
/**
|
||||
* Keeps metadata information in-memory, where it can be retrieved by whatever's
|
||||
* calling Mapnik and custom output provided.
|
||||
*
|
||||
* Stored data is all in image coordinates in the current implementation.
|
||||
*
|
||||
* This is most useful when Mapnik is being called from Python, and the result
|
||||
* of the metawriter can be queried and injected into the (meta)tile or whatever
|
||||
* in a very flexible way. E.g: for a GUI app the metawriter can be used to
|
||||
* create hit areas, for a web app it could be used to create an HTML image map.
|
||||
*
|
||||
* Because this is kept in-memory, applying this metawriter to features which are
|
||||
* very common in the rendered image will increase memory usage, especially if
|
||||
* many attributes are also kept.
|
||||
*/
|
||||
class MAPNIK_DECL metawriter_inmem
|
||||
: public metawriter, private boost::noncopyable {
|
||||
public:
|
||||
/**
|
||||
* Construct an in-memory writer which keeps properties specified by the
|
||||
* dflt_properties argument. For example: if dflt_properties contains "name",
|
||||
* then the name attribute of rendered features referencing this metawriter
|
||||
* will be kept in memory.
|
||||
*/
|
||||
metawriter_inmem(metawriter_properties dflt_properties);
|
||||
~metawriter_inmem();
|
||||
|
||||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_text(boost::ptr_vector<text_path> const& placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_polygon(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_line(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
|
||||
virtual void start(metawriter_property_map const& properties);
|
||||
|
||||
/**
|
||||
* An instance of a rendered feature. The box represents the image
|
||||
* coordinates of a bounding box around the feature. The properties
|
||||
* are the intersection of the features' properties and the "kept"
|
||||
* properties of the metawriter.
|
||||
*/
|
||||
struct MAPNIK_DECL meta_instance {
|
||||
box2d<double> box;
|
||||
std::map<std::string, value> properties;
|
||||
};
|
||||
|
||||
typedef std::list<meta_instance> meta_instance_list;
|
||||
|
||||
// const-only access to the instances.
|
||||
const meta_instance_list &instances() const;
|
||||
|
||||
// utility iterators for use in the python bindings.
|
||||
meta_instance_list::const_iterator inst_begin() const;
|
||||
meta_instance_list::const_iterator inst_end() const;
|
||||
|
||||
private:
|
||||
|
||||
std::list<meta_instance> instances_;
|
||||
|
||||
void add_vertices(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
};
|
||||
|
||||
/** Shared pointer to metawriter_inmem object. */
|
||||
typedef boost::shared_ptr<metawriter_inmem> metawriter_inmem_ptr;
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_METAWRITER_INMEM_HPP
|
|
@ -1,160 +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 MAPNIK_METAWRITER_JSON_HPP
|
||||
#define MAPNIK_METAWRITER_JSON_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/metawriter.hpp>
|
||||
#include <mapnik/parse_path.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <fstream>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
||||
/** Write JSON data to a stream object. */
|
||||
class metawriter_json_stream : public metawriter, private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
metawriter_json_stream(metawriter_properties dflt_properties);
|
||||
~metawriter_json_stream();
|
||||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_text(boost::ptr_vector<text_path> const& placements,
|
||||
box2d<double> const& extents,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_polygon(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_line(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
|
||||
virtual void start(metawriter_property_map const& properties);
|
||||
virtual void stop();
|
||||
/** Set output stream. This function has to be called before the first output is made. */
|
||||
void set_stream(std::ostream *f) { f_ = f; }
|
||||
/** Get output stream. */
|
||||
std::ostream *get_stream() const { return f_; }
|
||||
/** Only write header/footer to file with one or more features. */
|
||||
void set_output_empty(bool output_empty) { output_empty_ = output_empty; }
|
||||
/** See set_output_empty(). */
|
||||
bool get_output_empty() { return output_empty_; }
|
||||
void set_pixel_coordinates(bool on) { pixel_coordinates_ = on; }
|
||||
bool get_pixel_coordinates() { return pixel_coordinates_; }
|
||||
virtual void set_map_srs(projection const& proj);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
HEADER_NOT_WRITTEN = -1,
|
||||
STOPPED = -2,
|
||||
STARTED = 0
|
||||
};
|
||||
|
||||
/** Features written. */
|
||||
int count_;
|
||||
bool output_empty_;
|
||||
/** Transformation from map srs to output srs. */
|
||||
proj_transform *trans_;
|
||||
projection output_srs_;
|
||||
bool pixel_coordinates_;
|
||||
|
||||
virtual void write_header();
|
||||
|
||||
inline void write_feature_header(std::string type) {
|
||||
if (count_ == STOPPED)
|
||||
{
|
||||
MAPNIK_LOG_WARN(metawrite_json) << "Metawriter: instance not started before using it.";
|
||||
}
|
||||
|
||||
if (count_ == HEADER_NOT_WRITTEN) write_header();
|
||||
if (count_++) *f_ << ",\n";
|
||||
|
||||
*f_ << "{ \"type\": \"Feature\",\n \"geometry\": { \"type\": \"" << type << "\",\n \"coordinates\":";
|
||||
}
|
||||
|
||||
void write_properties(Feature const& feature, metawriter_properties const& properties);
|
||||
|
||||
inline void write_point(CoordTransform const& t, double x, double y, bool last = false)
|
||||
{
|
||||
double z = 0.0;
|
||||
if (!pixel_coordinates_) {
|
||||
t.backward(&x, &y);
|
||||
trans_->forward(x, y, z);
|
||||
}
|
||||
*f_ << "[" << x << "," << y << "]";
|
||||
if (!last) {
|
||||
*f_ << ",";
|
||||
}
|
||||
}
|
||||
|
||||
void write_line_polygon(path_type & path, CoordTransform const& t, bool polygon);
|
||||
|
||||
private:
|
||||
std::ostream *f_;
|
||||
};
|
||||
|
||||
/** Shared pointer to metawriter_json_stream object. */
|
||||
typedef boost::shared_ptr<metawriter_json_stream> metawriter_json_stream_ptr;
|
||||
|
||||
/** JSON writer. */
|
||||
class metawriter_json : public metawriter_json_stream
|
||||
{
|
||||
public:
|
||||
metawriter_json(metawriter_properties dflt_properties, path_expression_ptr fn);
|
||||
|
||||
virtual void start(metawriter_property_map const& properties);
|
||||
virtual void stop();
|
||||
/** Set filename template.
|
||||
*
|
||||
* This template is processed with values from Map's metawriter properties to
|
||||
* create the actual filename during start() call.
|
||||
*/
|
||||
void set_filename(path_expression_ptr fn);
|
||||
/** Get filename template. */
|
||||
path_expression_ptr get_filename() const;
|
||||
|
||||
private:
|
||||
path_expression_ptr fn_;
|
||||
std::fstream f_;
|
||||
std::string filename_;
|
||||
|
||||
protected:
|
||||
virtual void write_header();
|
||||
};
|
||||
|
||||
/** Shared pointer to metawriter_json object. */
|
||||
typedef boost::shared_ptr<metawriter_json> metawriter_json_ptr;
|
||||
|
||||
}
|
||||
|
||||
#endif // MAPNIK_METAWRITER_JSON_HPP
|
|
@ -249,8 +249,6 @@ public:
|
|||
symbolizers::const_iterator it = syms_.begin();
|
||||
symbolizers::const_iterator end = syms_.end();
|
||||
|
||||
// FIXME - metawriter_ptr?
|
||||
|
||||
for(; it != end; ++it)
|
||||
{
|
||||
boost::apply_visitor(deepcopy_symbolizer(),*it);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/parse_path.hpp>
|
||||
#include <mapnik/metawriter.hpp>
|
||||
#include <mapnik/image_compositing.hpp>
|
||||
#include <mapnik/transform_expression.hpp>
|
||||
|
||||
|
@ -44,45 +43,11 @@ MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr, Feature const& featur
|
|||
|
||||
class Map;
|
||||
|
||||
class MAPNIK_DECL symbolizer_base
|
||||
class MAPNIK_DECL symbolizer_base
|
||||
{
|
||||
public:
|
||||
symbolizer_base();
|
||||
symbolizer_base();
|
||||
symbolizer_base(symbolizer_base const& other);
|
||||
|
||||
/** Add a metawriter to this symbolizer using a name. */
|
||||
void add_metawriter(std::string const& name, metawriter_properties const& properties);
|
||||
/** Add a metawriter to this symbolizer using a pointer.
|
||||
* The name is only needed if you intend to call save_map() some time.
|
||||
* You don't need to call cache_metawriters() when using this function.
|
||||
* Call this function with an NULL writer_ptr to remove a metawriter.
|
||||
*/
|
||||
void add_metawriter(metawriter_ptr writer_ptr,
|
||||
metawriter_properties const& properties = metawriter_properties(),
|
||||
std::string const& name = "");
|
||||
/** Cache metawriter objects to avoid repeated lookups while processing.
|
||||
*
|
||||
* If the metawriter was added using a symbolic name (instead of a pointer)
|
||||
* this function has to be called before the symbolizer is used, because
|
||||
* the map object is not available in renderer::apply() to resolve the reference.
|
||||
*/
|
||||
void cache_metawriters(Map const &m);
|
||||
/** Get the metawriter associated with this symbolizer or a NULL pointer if none exists.
|
||||
*
|
||||
* This functions requires that cache_metawriters() was called first.
|
||||
*/
|
||||
metawriter_with_properties get_metawriter() const;
|
||||
/** Get metawriter properties.
|
||||
* This functions returns the default attributes of the
|
||||
* metawriter + symbolizer specific attributes.
|
||||
* \note This function is a helperfunction for class attribute_collector.
|
||||
*/
|
||||
metawriter_properties const& get_metawriter_properties() const { return properties_complete_; }
|
||||
/** Get metawriter properties which only apply to this symbolizer.
|
||||
*/
|
||||
metawriter_properties const& get_metawriter_properties_overrides() const { return properties_; }
|
||||
/** Get metawriter name. */
|
||||
std::string const& get_metawriter_name() const { return writer_name_; }
|
||||
void set_comp_op(composite_mode_e comp_op);
|
||||
composite_mode_e comp_op() const;
|
||||
void set_transform(transform_type const& );
|
||||
|
@ -93,10 +58,6 @@ public:
|
|||
void set_smooth(double smooth);
|
||||
double smooth() const;
|
||||
private:
|
||||
metawriter_properties properties_;
|
||||
metawriter_properties properties_complete_;
|
||||
std::string writer_name_;
|
||||
metawriter_ptr writer_ptr_;
|
||||
composite_mode_e comp_op_;
|
||||
transform_type affine_transform_;
|
||||
bool clip_;
|
||||
|
@ -104,7 +65,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class MAPNIK_DECL symbolizer_with_image
|
||||
class MAPNIK_DECL symbolizer_with_image
|
||||
{
|
||||
public:
|
||||
path_expression_ptr get_filename() const;
|
||||
|
|
|
@ -63,7 +63,6 @@ public:
|
|||
t_(t),
|
||||
font_manager_(font_manager),
|
||||
detector_(detector),
|
||||
writer_(sym.get_metawriter()),
|
||||
dims_(0, 0, width, height),
|
||||
query_extent_(query_extent),
|
||||
text_(font_manager, scale_factor),
|
||||
|
@ -101,7 +100,6 @@ protected:
|
|||
CoordTransform const& t_;
|
||||
FaceManagerT & font_manager_;
|
||||
DetectorT & detector_;
|
||||
metawriter_with_properties writer_;
|
||||
box2d<double> dims_;
|
||||
box2d<double> const& query_extent_;
|
||||
//Processing
|
||||
|
@ -182,7 +180,7 @@ protected:
|
|||
double marker_h_;
|
||||
double marker_x_;
|
||||
double marker_y_;
|
||||
|
||||
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::geometries_to_process_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::placement_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::next_placement;
|
||||
|
@ -190,7 +188,6 @@ protected:
|
|||
using text_symbolizer_helper<FaceManagerT, DetectorT>::geo_itr_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::point_itr_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::points_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::writer_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::font_manager_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::feature_;
|
||||
using text_symbolizer_helper<FaceManagerT, DetectorT>::t_;
|
||||
|
|
|
@ -115,6 +115,14 @@ public:
|
|||
return commands_[block] [pos & block_mask];
|
||||
}
|
||||
|
||||
void set_command(unsigned pos, unsigned command)
|
||||
{
|
||||
if (pos < pos_)
|
||||
{
|
||||
unsigned block = pos >> block_shift;
|
||||
commands_[block] [pos & block_mask] = command;
|
||||
}
|
||||
}
|
||||
private:
|
||||
void allocate_block(unsigned block)
|
||||
{
|
||||
|
|
|
@ -59,6 +59,22 @@ namespace mapnik { namespace wkt {
|
|||
}
|
||||
};
|
||||
|
||||
struct close_path
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void operator() (T path) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->close();
|
||||
}
|
||||
};
|
||||
|
||||
struct cleanup
|
||||
{
|
||||
template <typename T0>
|
||||
|
@ -119,7 +135,7 @@ namespace mapnik { namespace wkt {
|
|||
;
|
||||
|
||||
// <polygon text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
|
||||
polygon_text = (lit('(') >> linestring_text(_r1) % lit(',') >> lit(')')) | empty_set;
|
||||
polygon_text = (lit('(') >> linestring_text(_r1)[close_path_(_r1)] % lit(',') >> lit(')')) | empty_set;
|
||||
|
||||
|
||||
//<multipoint tagged text> ::= multipoint <multipoint text>
|
||||
|
@ -191,6 +207,7 @@ namespace mapnik { namespace wkt {
|
|||
qi::rule<Iterator,qi::locals<CommandType>,void(geometry_type*),ascii::space_type> points;
|
||||
qi::rule<Iterator,ascii::space_type> empty_set;
|
||||
boost::phoenix::function<push_vertex> push_vertex_;
|
||||
boost::phoenix::function<close_path> close_path_;
|
||||
boost::phoenix::function<cleanup> cleanup_;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,11 +31,7 @@
|
|||
// boost
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 104500
|
||||
#include <mapnik/css_color_grammar.hpp>
|
||||
#else
|
||||
#include <mapnik/css_color_grammar_deprecated.hpp>
|
||||
#endif
|
||||
|
||||
//stl
|
||||
#include <string>
|
||||
|
|
|
@ -50,8 +50,8 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
|
|||
int band,
|
||||
gdal_query q,
|
||||
mapnik::box2d<double> extent,
|
||||
double width,
|
||||
double height,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
int nbands,
|
||||
double dx,
|
||||
double dy,
|
||||
|
@ -515,7 +515,8 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
|
|||
double Y = pt.y - gt[3] - gt[5]/2;
|
||||
double det1 = gt[1]*Y + gt[4]*X;
|
||||
double det2 = gt[2]*Y + gt[5]*X;
|
||||
unsigned x = det2/det, y = det1/det;
|
||||
unsigned x = static_cast<unsigned>(det2/det);
|
||||
unsigned y = static_cast<unsigned>(det1/det);
|
||||
|
||||
if (x < raster_xsize && y < raster_ysize)
|
||||
{
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
int band,
|
||||
gdal_query q,
|
||||
mapnik::box2d<double> extent,
|
||||
double width,
|
||||
double height,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
int nbands,
|
||||
double dx,
|
||||
double dy,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
This copyright and license do not apply to any other software
|
||||
with which this software may have been included.
|
||||
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
|
||||
SCons - a software construction tool
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ way for wrapping up the functions.
|
|||
|
||||
"""
|
||||
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -97,7 +97,7 @@ way for wrapping up the functions.
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Action.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Action.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
||||
|
@ -899,7 +899,7 @@ class CommandGeneratorAction(ActionBase):
|
|||
show=_null, execute=_null, chdir=_null, executor=None):
|
||||
act = self._generate(target, source, env, 0, executor)
|
||||
if act is None:
|
||||
raise UserError("While building `%s': "
|
||||
raise SCons.Errors.UserError("While building `%s': "
|
||||
"Cannot deduce file extension from source files: %s"
|
||||
% (repr(list(map(str, target))), repr(list(map(str, source)))))
|
||||
return act(target, source, env, exitstatfunc, presub,
|
|
@ -76,7 +76,7 @@ There are the following methods for internal use within this module:
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -97,7 +97,7 @@ There are the following methods for internal use within this module:
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Builder.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Builder.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import collections
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/CacheDir.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/CacheDir.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """
|
||||
CacheDir support
|
|
@ -554,7 +554,7 @@ def CheckDeclaration(context, symbol, includes = None, language = None):
|
|||
|
||||
lang, suffix, msg = _lang2suffix(language)
|
||||
if msg:
|
||||
context.Display("Cannot check for declaration %s: %s\n" % (type_name, msg))
|
||||
context.Display("Cannot check for declaration %s: %s\n" % (symbol, msg))
|
||||
return msg
|
||||
|
||||
src = includetext + includes
|
|
@ -6,7 +6,7 @@ needed by most users.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -28,7 +28,7 @@ needed by most users.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Debug.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Debug.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import os
|
||||
import sys
|
|
@ -10,7 +10,7 @@ from distutils.msvccompiler.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -33,7 +33,7 @@ from distutils.msvccompiler.
|
|||
#
|
||||
from __future__ import division
|
||||
|
||||
__revision__ = "src/engine/SCons/Defaults.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Defaults.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
|
||||
import os
|
|
@ -10,7 +10,7 @@ Environment
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -31,7 +31,7 @@ Environment
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Environment.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Environment.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
|
||||
import copy
|
||||
|
@ -72,6 +72,7 @@ CleanTargets = {}
|
|||
CalculatorArgs = {}
|
||||
|
||||
semi_deepcopy = SCons.Util.semi_deepcopy
|
||||
semi_deepcopy_dict = SCons.Util.semi_deepcopy_dict
|
||||
|
||||
# Pull UserError into the global name space for the benefit of
|
||||
# Environment().SourceSignatures(), which has some import statements
|
||||
|
@ -303,7 +304,9 @@ class BuilderDict(UserDict):
|
|||
UserDict.__init__(self, dict)
|
||||
|
||||
def __semi_deepcopy__(self):
|
||||
return self.__class__(self.data, self.env)
|
||||
# These cannot be copied since they would both modify the same builder object, and indeed
|
||||
# just copying would modify the original builder
|
||||
raise TypeError( 'cannot semi_deepcopy a BuilderDict' )
|
||||
|
||||
def __setitem__(self, item, val):
|
||||
try:
|
||||
|
@ -1374,15 +1377,15 @@ class Base(SubstitutionEnvironment):
|
|||
(like a function). There are no references to any mutable
|
||||
objects in the original Environment.
|
||||
"""
|
||||
clone = copy.copy(self)
|
||||
clone._dict = semi_deepcopy(self._dict)
|
||||
|
||||
try:
|
||||
cbd = clone._dict['BUILDERS']
|
||||
builders = self._dict['BUILDERS']
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
clone._dict['BUILDERS'] = BuilderDict(cbd, clone)
|
||||
|
||||
clone = copy.copy(self)
|
||||
# BUILDERS is not safe to do a simple copy
|
||||
clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS'])
|
||||
clone._dict['BUILDERS'] = BuilderDict(builders, clone)
|
||||
|
||||
# Check the methods added via AddMethod() and re-bind them to
|
||||
# the cloned environment. Only do this if the attribute hasn't
|
||||
|
@ -1733,7 +1736,7 @@ class Base(SubstitutionEnvironment):
|
|||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
kwbd = semi_deepcopy(kwbd)
|
||||
kwbd = BuilderDict(kwbd,self)
|
||||
del kw['BUILDERS']
|
||||
self.__setitem__('BUILDERS', kwbd)
|
||||
kw = copy_non_reserved_keywords(kw)
|
||||
|
@ -2228,14 +2231,11 @@ class Base(SubstitutionEnvironment):
|
|||
sources.append(s)
|
||||
build_source(node.all_children())
|
||||
|
||||
# THIS CODE APPEARS TO HAVE NO EFFECT
|
||||
# # get the final srcnode for all nodes, this means stripping any
|
||||
# # attached build node by calling the srcnode function
|
||||
# for file in sources:
|
||||
# srcnode = file.srcnode()
|
||||
# while srcnode != file.srcnode():
|
||||
# srcnode = file.srcnode()
|
||||
|
||||
def final_source(node):
|
||||
while (node != node.srcnode()):
|
||||
node = node.srcnode()
|
||||
return node
|
||||
sources = map( final_source, sources );
|
||||
# remove duplicates
|
||||
return list(set(sources))
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -28,7 +28,7 @@ and user errors in SCons.
|
|||
|
||||
"""
|
||||
|
||||
__revision__ = "src/engine/SCons/Errors.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Errors.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Util
|
||||
|
|
@ -6,7 +6,7 @@ Nodes.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ Nodes.
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Executor.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Executor.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import collections
|
||||
|
|
@ -7,7 +7,7 @@ stop, and wait on jobs.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -29,7 +29,7 @@ stop, and wait on jobs.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Job.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Job.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Memoize.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Memoize.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Memoizer
|
||||
|
|
@ -8,7 +8,7 @@ This creates a hash of global Aliases (dummy targets).
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ This creates a hash of global Aliases (dummy targets).
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Node/Alias.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Node/Alias.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import collections
|
||||
|
|
@ -11,7 +11,7 @@ that can be used by scripts or modules looking for the canonical default.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -32,7 +32,7 @@ that can be used by scripts or modules looking for the canonical default.
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Node/FS.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Node/FS.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
|
@ -2715,7 +2715,7 @@ class File(Base):
|
|||
so only do thread safe stuff here. Do thread unsafe stuff in
|
||||
built().
|
||||
|
||||
Returns true iff the node was successfully retrieved.
|
||||
Returns true if the node was successfully retrieved.
|
||||
"""
|
||||
if self.nocache:
|
||||
return None
|
|
@ -5,7 +5,7 @@ Python nodes.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ Python nodes.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Node/Python.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Node/Python.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node
|
||||
|
|
@ -20,7 +20,7 @@ be able to depend on any other type of "thing."
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -41,7 +41,7 @@ be able to depend on any other type of "thing."
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Node/__init__.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Node/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import collections
|
||||
import copy
|
||||
|
@ -216,6 +216,7 @@ class Node(object):
|
|||
self.precious = None
|
||||
self.noclean = 0
|
||||
self.nocache = 0
|
||||
self.cached = 0 # is this node pulled from cache?
|
||||
self.always_build = None
|
||||
self.includes = None
|
||||
self.attributes = self.Attrs() # Generic place to stick information about the Node.
|
||||
|
@ -306,7 +307,7 @@ class Node(object):
|
|||
so only do thread safe stuff here. Do thread unsafe stuff in
|
||||
built().
|
||||
|
||||
Returns true iff the node was successfully retrieved.
|
||||
Returns true if the node was successfully retrieved.
|
||||
"""
|
||||
return 0
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/BoolOption.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/BoolOption.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/EnumOption.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/EnumOption.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/ListOption.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/ListOption.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/PackageOption.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/PackageOption.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/PathOption.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/PathOption.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Options/__init__.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Options/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Options module hierarchy
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/PathList.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/PathList.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """SCons.PathList
|
||||
|
|
@ -20,7 +20,7 @@ their own platform definition.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -42,7 +42,7 @@ their own platform definition.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/__init__.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/aix.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/aix.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import os
|
||||
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/cygwin.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/cygwin.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import posix
|
||||
from SCons.Platform import TempFileMunge
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/darwin.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/darwin.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import posix
|
||||
import os
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/hpux.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/hpux.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import posix
|
||||
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/irix.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/irix.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import posix
|
||||
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/os2.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/os2.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
import win32
|
||||
|
||||
def generate(env):
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/posix.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/posix.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import errno
|
||||
import os
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/sunos.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/sunos.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import posix
|
||||
|
|
@ -8,7 +8,7 @@ selection method.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ selection method.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Platform/win32.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Platform/win32.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
@ -64,13 +64,12 @@ else:
|
|||
|
||||
_builtin_file = builtins.file
|
||||
_builtin_open = builtins.open
|
||||
|
||||
def _scons_file(*args, **kw):
|
||||
fp = _builtin_file(*args, **kw)
|
||||
win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()),
|
||||
win32con.HANDLE_FLAG_INHERIT,
|
||||
0)
|
||||
return fp
|
||||
|
||||
class _scons_file(_builtin_file):
|
||||
def __init__(self, *args, **kw):
|
||||
_builtin_file.__init__(self, *args, **kw)
|
||||
win32api.SetHandleInformation(msvcrt.get_osfhandle(self.fileno()),
|
||||
win32con.HANDLE_FLAG_INHERIT, 0)
|
||||
|
||||
def _scons_open(*args, **kw):
|
||||
fp = _builtin_open(*args, **kw)
|
|
@ -4,7 +4,7 @@ Autoconf-like configuration support.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -26,7 +26,7 @@ Autoconf-like configuration support.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/SConf.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/SConf.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
|
@ -5,7 +5,7 @@ Writing and reading information to the .sconsign file or files.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ Writing and reading information to the .sconsign file or files.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/SConsign.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/SConsign.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
|
@ -5,7 +5,7 @@ This module implements the depenency scanner for C/C++ code.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/C.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/C.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner
|
|
@ -8,7 +8,7 @@ Coded by Andy Friesen
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -30,7 +30,7 @@ Coded by Andy Friesen
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/D.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/D.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import re
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -20,7 +20,7 @@
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/Dir.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/Dir.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner
|
|
@ -5,7 +5,7 @@ This module implements the dependency scanner for Fortran code.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -26,7 +26,7 @@ This module implements the dependency scanner for Fortran code.
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/Fortran.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/Fortran.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import re
|
||||
|
|
@ -6,7 +6,7 @@ Definition Language) files.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -28,7 +28,7 @@ Definition Language) files.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/IDL.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/IDL.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner
|
|
@ -5,7 +5,7 @@ This module implements the dependency scanner for LaTeX code.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ This module implements the dependency scanner for LaTeX code.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/LaTeX.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/LaTeX.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import os.path
|
||||
import re
|
||||
|
@ -159,6 +159,9 @@ class LaTeX(SCons.Scanner.Base):
|
|||
'includegraphics': 'TEXINPUTS',
|
||||
'bibliography': 'BIBINPUTS',
|
||||
'bibliographystyle': 'BSTINPUTS',
|
||||
'addbibresource': 'BIBINPUTS',
|
||||
'addglobalbib': 'BIBINPUTS',
|
||||
'addsectionbib': 'BIBINPUTS',
|
||||
'makeindex': 'INDEXSTYLE',
|
||||
'usepackage': 'TEXINPUTS',
|
||||
'lstinputlisting': 'TEXINPUTS'}
|
||||
|
@ -172,7 +175,7 @@ class LaTeX(SCons.Scanner.Base):
|
|||
# line followed by one or more newline characters (i.e. blank
|
||||
# lines), interfering with a match on the next line.
|
||||
# add option for whitespace before the '[options]' or the '{filename}'
|
||||
regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage)\s*{([^}]*)}'
|
||||
regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|addbibresource|addglobalbib|addsectionbib|usepackage)\s*{([^}]*)}'
|
||||
self.cre = re.compile(regex, re.M)
|
||||
self.comment_re = re.compile(r'^((?:(?:\\%)|[^%\n])*)(.*)$', re.M)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/Prog.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/Prog.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node
|
||||
import SCons.Node.FS
|
|
@ -6,7 +6,7 @@ Definition Language) files.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -28,7 +28,7 @@ Definition Language) files.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/RC.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/RC.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner
|
|
@ -5,7 +5,7 @@ The Scanner package for the SCons software construction utility.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Scanner/__init__.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Scanner/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import re
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -20,7 +20,7 @@
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Script/Interactive.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Script/Interactive.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """
|
||||
SCons interactive mode
|
|
@ -13,7 +13,7 @@ it goes here.
|
|||
unsupported_python_version = (2, 3, 0)
|
||||
deprecated_python_version = (2, 4, 0)
|
||||
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -34,7 +34,7 @@ deprecated_python_version = (2, 4, 0)
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Script/Main.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Script/Main.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons.compat
|
||||
|
||||
|
@ -869,7 +869,8 @@ def _main(parser):
|
|||
script_dir = ''
|
||||
|
||||
if script_dir and script_dir != os.getcwd():
|
||||
display("scons: Entering directory `%s'" % script_dir)
|
||||
if not options.silent:
|
||||
display("scons: Entering directory `%s'" % script_dir)
|
||||
try:
|
||||
os.chdir(script_dir)
|
||||
except OSError:
|
||||
|
@ -1329,7 +1330,7 @@ def main():
|
|||
pass
|
||||
parts.append(version_string("engine", SCons))
|
||||
parts.append(path_string("engine", SCons))
|
||||
parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation")
|
||||
parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation")
|
||||
version = ''.join(parts)
|
||||
|
||||
import SConsOptions
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Script/SConsOptions.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Script/SConsOptions.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import optparse
|
||||
import re
|
|
@ -6,7 +6,7 @@ files.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -28,7 +28,7 @@ files.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import division
|
||||
|
||||
__revision__ = "src/engine/SCons/Script/SConscript.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Script/SConscript.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import SCons
|
||||
import SCons.Action
|
|
@ -12,7 +12,7 @@ it goes here.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -34,7 +34,7 @@ it goes here.
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Script/__init__.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Script/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import time
|
||||
start_time = time.time()
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -21,7 +21,7 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
__revision__ = "src/engine/SCons/Sig.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Sig.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
__doc__ = """Place-holder for the old SCons.Sig module hierarchy
|
||||
|
|
@ -5,7 +5,7 @@ SCons string substitution.
|
|||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -26,7 +26,7 @@ SCons string substitution.
|
|||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
__revision__ = "src/engine/SCons/Subst.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Subst.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
import collections
|
||||
import re
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
|
@ -47,7 +47,7 @@ interface and the SCons build engine. There are two key classes here:
|
|||
target(s) that it decides need to be evaluated and/or built.
|
||||
"""
|
||||
|
||||
__revision__ = "src/engine/SCons/Taskmaster.py 5357 2011/09/09 21:31:03 bdeegan"
|
||||
__revision__ = "src/engine/SCons/Taskmaster.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
|
||||
|
||||
from itertools import chain
|
||||
import operator
|
||||
|
@ -227,20 +227,26 @@ class Task(object):
|
|||
if T: T.write(self.trace_message(u'Task.execute()', self.node))
|
||||
|
||||
try:
|
||||
everything_was_cached = 1
|
||||
cached_targets = []
|
||||
for t in self.targets:
|
||||
if t.retrieve_from_cache():
|
||||
# Call the .built() method without calling the
|
||||
# .push_to_cache() method, since we just got the
|
||||
# target from the cache and don't need to push
|
||||
# it back there.
|
||||
t.set_state(NODE_EXECUTED)
|
||||
t.built()
|
||||
else:
|
||||
everything_was_cached = 0
|
||||
if not t.retrieve_from_cache():
|
||||
break
|
||||
if not everything_was_cached:
|
||||
cached_targets.append(t)
|
||||
if len(cached_targets) < len(self.targets):
|
||||
# Remove targets before building. It's possible that we
|
||||
# partially retrieved targets from the cache, leaving
|
||||
# them in read-only mode. That might cause the command
|
||||
# to fail.
|
||||
#
|
||||
for t in cached_targets:
|
||||
try:
|
||||
t.fs.unlink(t.path)
|
||||
except (IOError, OSError):
|
||||
pass
|
||||
self.targets[0].build()
|
||||
else:
|
||||
for t in cached_targets:
|
||||
t.cached = 1
|
||||
except SystemExit:
|
||||
exc_value = sys.exc_info()[1]
|
||||
raise SCons.Errors.ExplicitExit(self.targets[0], exc_value.code)
|
||||
|
@ -292,7 +298,8 @@ class Task(object):
|
|||
for side_effect in t.side_effects:
|
||||
side_effect.set_state(NODE_NO_STATE)
|
||||
t.set_state(NODE_EXECUTED)
|
||||
t.push_to_cache()
|
||||
if not t.cached:
|
||||
t.push_to_cache()
|
||||
t.built()
|
||||
t.visited()
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue