Merge branch 'master' into svg-group-render

This commit is contained in:
Artem Pavlenko 2023-11-17 09:43:02 +00:00
commit 738a7f19b7
1536 changed files with 130 additions and 50 deletions

View file

@ -40,6 +40,9 @@
#include <cstdio>
#include <algorithm>
// boost string algo
#include <boost/algorithm/string/trim.hpp>
namespace csv_utils {
namespace detail {

View file

@ -24,8 +24,6 @@
#include "ogr_featureset.hpp"
#include "ogr_index_featureset.hpp"
#include <gdal_version.h>
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/boolean.hpp>
@ -93,11 +91,7 @@ ogr_datasource::~ogr_datasource()
{
// free layer before destroying the datasource
layer_.free_layer();
#if GDAL_VERSION_MAJOR >= 2
GDALClose((GDALDatasetH)dataset_);
#else
OGRDataSource::DestroyDataSource(dataset_);
#endif
}
void ogr_datasource::init(mapnik::parameters const& params)
@ -136,27 +130,15 @@ void ogr_datasource::init(mapnik::parameters const& params)
if (!driver.empty())
{
#if GDAL_VERSION_MAJOR >= 2
unsigned int nOpenFlags = GDAL_OF_READONLY | GDAL_OF_VECTOR;
const char* papszAllowedDrivers[] = {driver.c_str(), nullptr};
dataset_ = reinterpret_cast<gdal_dataset_type>(
GDALOpenEx(dataset_name_.c_str(), nOpenFlags, papszAllowedDrivers, nullptr, nullptr));
#else
OGRSFDriver* ogr_driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driver.c_str());
if (ogr_driver && ogr_driver != nullptr)
{
dataset_ = ogr_driver->Open((dataset_name_).c_str(), false);
}
#endif
}
else
{
// open ogr driver
#if GDAL_VERSION_MAJOR >= 2
dataset_ = reinterpret_cast<gdal_dataset_type>(OGROpen(dataset_name_.c_str(), false, nullptr));
#else
dataset_ = OGRSFDriverRegistrar::Open(dataset_name_.c_str(), false);
#endif
}
if (!dataset_)
@ -353,9 +335,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
switch (type_oid)
{
case OFTInteger:
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64:
#endif
desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Integer));
break;
@ -373,9 +353,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
break;
case OFTIntegerList:
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64List:
#endif
case OFTRealList:
case OFTStringList:
case OFTWideStringList: // deprecated !

View file

@ -122,12 +122,10 @@ feature_ptr ogr_featureset::next()
feature->put<mapnik::value_integer>(fld_name, poFeature->GetFieldAsInteger(i));
break;
}
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64: {
feature->put<mapnik::value_integer>(fld_name, poFeature->GetFieldAsInteger64(i));
break;
}
#endif
case OFTReal: {
feature->put(fld_name, poFeature->GetFieldAsDouble(i));
@ -142,9 +140,7 @@ feature_ptr ogr_featureset::next()
}
case OFTIntegerList:
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64List:
#endif
case OFTRealList:
case OFTStringList:
case OFTWideStringList: // deprecated !

View file

@ -48,8 +48,6 @@ MAPNIK_DISABLE_WARNING_POP
#include "ogr_converter.hpp"
#include "ogr_index.hpp"
#include <gdal_version.h>
using mapnik::box2d;
using mapnik::feature_factory;
using mapnik::feature_ptr;
@ -153,12 +151,10 @@ feature_ptr ogr_index_featureset<filterT>::next()
feature->put<mapnik::value_integer>(fld_name, poFeature->GetFieldAsInteger(i));
break;
}
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64: {
feature->put<mapnik::value_integer>(fld_name, poFeature->GetFieldAsInteger64(i));
break;
}
#endif
case OFTReal: {
feature->put(fld_name, poFeature->GetFieldAsDouble(i));
@ -173,9 +169,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
}
case OFTIntegerList:
#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64List:
#endif
case OFTRealList:
case OFTStringList:
case OFTWideStringList: // deprecated !

View file

@ -30,14 +30,9 @@
#include <stdexcept>
// gdal
#include <gdal_version.h>
#include <ogrsf_frmts.h>
#if GDAL_VERSION_MAJOR >= 2
using gdal_dataset_type = GDALDataset*;
#else
using gdal_dataset_type = OGRDataSource*;
#endif
class ogr_layer_ptr
{

97
scons/scons-configure-cache.py vendored Normal file
View file

@ -0,0 +1,97 @@
#! /usr/bin/env python
#
# SCons - a Software Constructor
#
# MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Show or convert the configuration of an SCons cache directory.
A cache of derived files is stored by file signature.
The files are split into directories named by the first few
digits of the signature. The prefix length used for directory
names can be changed by this script.
"""
__revision__ = "scripts/scons-configure-cache.py 120fd4f633e9ef3cafbc0fec35306d7555ffd1db Tue, 21 Mar 2023 12:11:27 -0400 bdbaddog"
__version__ = "4.5.2"
__build__ = "120fd4f633e9ef3cafbc0fec35306d7555ffd1db"
__buildsys__ = "M1DOG2021"
__date__ = "Tue, 21 Mar 2023 12:11:27 -0400"
__developer__ = "bdbaddog"
import os
import sys
# python compatibility check
if sys.version_info < (3, 6, 0):
msg = "scons: *** SCons version %s does not run under Python version %s.\n\
Python >= 3.5 is required.\n"
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
sys.exit(1)
# Strip the script directory from sys.path so on case-insensitive
# (WIN32) systems Python doesn't think that the "scons" script is the
# "SCons" package.
script_dir = os.path.dirname(os.path.realpath(__file__))
script_path = os.path.realpath(os.path.dirname(__file__))
if script_path in sys.path:
sys.path.remove(script_path)
libs = []
if "SCONS_LIB_DIR" in os.environ:
libs.append(os.environ["SCONS_LIB_DIR"])
# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
source_path = os.path.join(script_path, os.pardir)
if os.path.isdir(source_path):
libs.append(source_path)
# add local-install locations
local_version = 'scons-local-' + __version__
local = 'scons-local'
if script_dir:
local_version = os.path.join(script_dir, local_version)
local = os.path.join(script_dir, local)
if os.path.isdir(local_version):
libs.append(os.path.abspath(local_version))
if os.path.isdir(local):
libs.append(os.path.abspath(local))
scons_version = 'scons-%s' % __version__
sys.path = libs + sys.path
##############################################################################
# END STANDARD SCons SCRIPT HEADER
##############################################################################
from SCons.Utilities.ConfigureCache import main
if __name__ == "__main__":
main()

View file

@ -1043,6 +1043,12 @@ class SubstitutionEnvironment:
flags distributed into appropriate construction variables.
See :meth:`ParseFlags`.
As a side effect, if *unique* is true, a new object is created
for each modified construction variable by the loop at the end.
This is silently expected by the :meth:`Override` *parse_flags*
functionality, which does not want to share the list (or whatever)
with the environment being overridden.
Args:
args: flags to merge
unique: merge flags rather than appending (default: True).
@ -1077,6 +1083,16 @@ class SubstitutionEnvironment:
try:
orig = orig + value
except (KeyError, TypeError):
# If CPPDEFINES is a deque, adding value (a list)
# results in TypeError, so we handle that case here.
# Just in case we got called from Override, make
# sure we make a copy, because we don't go through
# the cleanup loops at the end of the outer for loop,
# which implicitly gives us a new object.
if isinstance(orig, deque):
self[key] = self[key].copy()
self.AppendUnique(CPPDEFINES=value, delete_existing=True)
continue
try:
add_to_orig = orig.append
except AttributeError:
@ -1095,6 +1111,7 @@ class SubstitutionEnvironment:
for v in orig[::-1]:
if v not in t:
t.insert(0, v)
self[key] = t
@ -1419,7 +1436,7 @@ class Base(SubstitutionEnvironment):
if key == 'CPPDEFINES':
_add_cppdefines(self._dict, val)
continue
try:
orig = self._dict[key]
except KeyError:

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