DYT/Tool/OpenSceneGraph-3.6.5/include/osgEarth/TileIndex
2024-12-25 07:49:36 +08:00

72 lines
2.3 KiB
C++

/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth 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 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTHUTIL_TILEINDEX_H
#define OSGEARTHUTIL_TILEINDEX_H 1
#include <osgEarth/Common>
#include <osg/Referenced>
#include <osg/ref_ptr>
#include <osgEarth/FeatureSource>
#include <string>
#include <vector>
namespace osgEarth { namespace Contrib
{
/**
* Manages a FeatureSource that is an index of geospatial data files
*/
class OSGEARTH_EXPORT TileIndex : public osg::Referenced
{
public:
static TileIndex* load( const std::string& filename );
static TileIndex* create( const std::string& filename, const osgEarth::SpatialReference* srs);
/**
* Gets files within the given extent.
*/
void getFiles(const osgEarth::GeoExtent& extent, std::vector< std::string >& files);
/**
* Adds the given filename to the index
*/
bool add( const std::string& filename, const GeoExtent& extent );
/**
* Gets the filename of the shapefile used for this index.
*/
const std::string& getFilename() const { return _filename;}
protected:
TileIndex();
~TileIndex();
osg::ref_ptr< osgEarth::FeatureSource > _features;
std::string _filename;
};
} } // namespace osgEarth::Util
#endif //OSGEARTHUTIL_TILEINDEX_H