diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index d64d37384..c73406468 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -49,7 +49,7 @@ dbf_file::dbf_file() record_length_(0), record_(0) {} -dbf_file::dbf_file(std::string const& file_name) +dbf_file::dbf_file(std::string const& file_name, bool update_cache) :num_records_(0), num_fields_(0), record_length_(0), @@ -64,7 +64,7 @@ dbf_file::dbf_file(std::string const& file_name) { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - boost::optional memory = mapnik::mapped_memory_cache::instance().find(file_name,true); + boost::optional memory = mapnik::mapped_memory_cache::instance().find(file_name, update_cache); if (memory) { mapped_region_ = *memory; diff --git a/plugins/input/shape/dbfile.hpp b/plugins/input/shape/dbfile.hpp index 9ff022400..0f6f37db1 100644 --- a/plugins/input/shape/dbfile.hpp +++ b/plugins/input/shape/dbfile.hpp @@ -69,7 +69,7 @@ private: char* record_; public: dbf_file(); - dbf_file(std::string const& file_name); + dbf_file(std::string const& file_name, bool update_cache = true); ~dbf_file(); bool is_open(); int num_records() const; diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 56d7a6aae..d101ba8c4 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -64,6 +64,7 @@ shape_datasource::shape_datasource(parameters const& params) file_length_(0), indexed_(false), row_limit_(*params.get("row_limit",0)), + update_cache_(*params.get("update-cache", true)), desc_(shape_datasource::name(), *params.get("encoding","utf-8")) { #ifdef MAPNIK_STATS diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index f702036eb..ee1647512 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -72,6 +72,7 @@ private: box2d extent_; bool indexed_; const int row_limit_; + const bool update_cache_; layer_descriptor desc_; }; diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index 5dd591996..b3423e62a 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -35,11 +35,11 @@ const std::string shape_io::SHX = ".shx"; const std::string shape_io::DBF = ".dbf"; const std::string shape_io::INDEX = ".index"; -shape_io::shape_io(std::string const& shape_name, bool open_index) +shape_io::shape_io(std::string const& shape_name, bool open_index, bool update_cache) : type_(shape_null), - shp_(shape_name + SHP), - shx_(shape_name + SHX), - dbf_(shape_name + DBF), + shp_(shape_name + SHP, update_cache), + shx_(shape_name + SHX, update_cache), + dbf_(shape_name + DBF, update_cache), reclength_(0), id_(0) { diff --git a/plugins/input/shape/shape_io.hpp b/plugins/input/shape/shape_io.hpp index 1828ebd54..6ff634413 100644 --- a/plugins/input/shape/shape_io.hpp +++ b/plugins/input/shape/shape_io.hpp @@ -57,7 +57,7 @@ public: shape_multipatch = 31 }; - shape_io(std::string const& shape_name, bool open_index=true); + shape_io(std::string const& shape_name, bool open_index = true, bool update_cache = true); ~shape_io(); shape_file& shp(); diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 15e5c7757..c175ba6d5 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -159,7 +159,7 @@ public: shape_file() {} - shape_file(std::string const& file_name) : + shape_file(std::string const& file_name, bool update_cache = true) : #if defined(MAPNIK_MEMORY_MAPPED_FILE) file_() #elif defined (_WINDOWS) @@ -170,7 +170,7 @@ public: { #if defined(MAPNIK_MEMORY_MAPPED_FILE) boost::optional memory = - mapnik::mapped_memory_cache::instance().find(file_name,true); + mapnik::mapped_memory_cache::instance().find(file_name, update_cache); if (memory) {