beef up has_index
method to check if *.index file is valid (has expected header) (ref #3300)
This commit is contained in:
parent
5183c1da44
commit
b43ee6dd04
1 changed files with 12 additions and 6 deletions
|
@ -23,16 +23,16 @@
|
||||||
#ifndef SHAPE_IO_HPP
|
#ifndef SHAPE_IO_HPP
|
||||||
#define SHAPE_IO_HPP
|
#define SHAPE_IO_HPP
|
||||||
|
|
||||||
|
// stl
|
||||||
|
#include <memory>
|
||||||
|
#include <ios>
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/box2d.hpp>
|
#include <mapnik/box2d.hpp>
|
||||||
#include <mapnik/util/noncopyable.hpp>
|
#include <mapnik/util/noncopyable.hpp>
|
||||||
|
#include <mapnik/util/spatial_index.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
//
|
||||||
// stl
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "dbfile.hpp"
|
#include "dbfile.hpp"
|
||||||
#include "shapefile.hpp"
|
#include "shapefile.hpp"
|
||||||
|
|
||||||
|
@ -72,7 +72,13 @@ public:
|
||||||
|
|
||||||
inline bool has_index() const
|
inline bool has_index() const
|
||||||
{
|
{
|
||||||
return (index_ && index_->is_open());
|
if (index_ && index_->is_open())
|
||||||
|
{
|
||||||
|
bool status = mapnik::util::check_spatial_index(index_->file());
|
||||||
|
index_->seek(0);// rewind
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int id() const { return id_;}
|
inline int id() const { return id_;}
|
||||||
|
|
Loading…
Add table
Reference in a new issue