rename large_geojson_featureset -> geojson_memory_index_featurest to better reflect undelying implementations: geojson_index_featureset is most capable in terms of handling large input data with minimal memory requrements via utilising on disk spatial index (createed with mapnik-index utility)
This commit is contained in:
parent
ee873aa17d
commit
26bf021af9
4 changed files with 13 additions and 13 deletions
|
@ -43,7 +43,7 @@ else:
|
||||||
%(PLUGIN_NAME)s_datasource.cpp
|
%(PLUGIN_NAME)s_datasource.cpp
|
||||||
%(PLUGIN_NAME)s_featureset.cpp
|
%(PLUGIN_NAME)s_featureset.cpp
|
||||||
%(PLUGIN_NAME)s_index_featureset.cpp
|
%(PLUGIN_NAME)s_index_featureset.cpp
|
||||||
large_%(PLUGIN_NAME)s_featureset.cpp
|
%(PLUGIN_NAME)s_memory_index_featureset.cpp
|
||||||
|
|
||||||
""" % locals()
|
""" % locals()
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "geojson_datasource.hpp"
|
#include "geojson_datasource.hpp"
|
||||||
#include "geojson_featureset.hpp"
|
#include "geojson_featureset.hpp"
|
||||||
#include "geojson_index_featureset.hpp"
|
#include "geojson_index_featureset.hpp"
|
||||||
#include "large_geojson_featureset.hpp"
|
#include "geojson_memory_index_featureset.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
|
||||||
{
|
{
|
||||||
return item0.second.first < item1.second.first;
|
return item0.second.first < item1.second.first;
|
||||||
});
|
});
|
||||||
return std::make_shared<large_geojson_featureset>(filename_, std::move(index_array));
|
return std::make_shared<geojson_memory_index_featureset>(filename_, std::move(index_array));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (has_disk_index_)
|
else if (has_disk_index_)
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "large_geojson_featureset.hpp"
|
#include "geojson_memory_index_featureset.hpp"
|
||||||
|
|
||||||
large_geojson_featureset::large_geojson_featureset(std::string const& filename,
|
geojson_memory_index_featureset::geojson_memory_index_featureset(std::string const& filename,
|
||||||
array_type && index_array)
|
array_type && index_array)
|
||||||
:
|
:
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
@ -48,9 +48,9 @@ large_geojson_featureset::large_geojson_featureset(std::string const& filename,
|
||||||
if (!file_) throw std::runtime_error("Can't open " + filename);
|
if (!file_) throw std::runtime_error("Can't open " + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
large_geojson_featureset::~large_geojson_featureset() {}
|
geojson_memory_index_featureset::~geojson_memory_index_featureset() {}
|
||||||
|
|
||||||
mapnik::feature_ptr large_geojson_featureset::next()
|
mapnik::feature_ptr geojson_memory_index_featureset::next()
|
||||||
{
|
{
|
||||||
if (index_itr_ != index_end_)
|
if (index_itr_ != index_end_)
|
||||||
{
|
{
|
|
@ -20,8 +20,8 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef LARGE_GEOJSON_FEATURESET_HPP
|
#ifndef GEOJSON_MEMORY_INDEX_FEATURESET_HPP
|
||||||
#define LARGE_GEOJSON_FEATURESET_HPP
|
#define GEOJSON_MEMORY_INDEX_FEATURESET_HPP
|
||||||
|
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
#include "geojson_datasource.hpp"
|
#include "geojson_datasource.hpp"
|
||||||
|
@ -29,15 +29,15 @@
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
class large_geojson_featureset : public mapnik::Featureset
|
class geojson_memory_index_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using array_type = std::deque<geojson_datasource::item_type>;
|
using array_type = std::deque<geojson_datasource::item_type>;
|
||||||
using file_ptr = std::unique_ptr<std::FILE, int (*)(std::FILE *)>;
|
using file_ptr = std::unique_ptr<std::FILE, int (*)(std::FILE *)>;
|
||||||
|
|
||||||
large_geojson_featureset(std::string const& filename,
|
geojson_memory_index_featureset(std::string const& filename,
|
||||||
array_type && index_array);
|
array_type && index_array);
|
||||||
virtual ~large_geojson_featureset();
|
virtual ~geojson_memory_index_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -49,4 +49,4 @@ private:
|
||||||
mapnik::context_ptr ctx_;
|
mapnik::context_ptr ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LARGE_GEOJSON_FEATURESET_HPP
|
#endif // GEOJSON_MEMORY_INDEX_FEATURESET_HPP
|
Loading…
Reference in a new issue