Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start moving some spatial index related functions to QgsSpatialIndexU…
…tils
- Loading branch information
1 parent
358e466
commit 69844ec
Showing
5 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*************************************************************************** | ||
qgsspatialindexutils.cpp | ||
------------------------ | ||
Date : December 2019 | ||
Copyright : (C) 2019 by Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsspatialindexutils.h" | ||
#include "qgsrectangle.h" | ||
#include <spatialindex/SpatialIndex.h> | ||
|
||
SpatialIndex::Region QgsSpatialIndexUtils::rectangleToRegion( const QgsRectangle &rectangle ) | ||
{ | ||
double pt1[2] = { rectangle.xMinimum(), rectangle.yMinimum() }; | ||
double pt2[2] = { rectangle.xMaximum(), rectangle.yMaximum() }; | ||
return SpatialIndex::Region( pt1, pt2, 2 ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*************************************************************************** | ||
qgsgenericspatialindex.h | ||
------------------------ | ||
Date : December 2019 | ||
Copyright : (C) 2019 by Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSPATIALINDEXUTILS_H | ||
#define QGSSPATIALINDEXUTILS_H | ||
|
||
#include "qgis_core.h" | ||
#define SIP_NO_FILE | ||
|
||
class QgsRectangle; | ||
|
||
///@cond PRIVATE | ||
// forward declaration | ||
namespace SpatialIndex | ||
{ | ||
class IStorageManager; | ||
class ISpatialIndex; | ||
class Region; | ||
class Point; | ||
|
||
namespace StorageManager | ||
{ | ||
class IBuffer; | ||
} | ||
} | ||
///@endcond | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsSpatialIndex | ||
* | ||
* Contains utility functions for working with spatial indexes. | ||
* | ||
* \note Not available in Python bindings. | ||
* \since QGIS 3.12 | ||
*/ | ||
class CORE_EXPORT QgsSpatialIndexUtils | ||
{ | ||
public: | ||
|
||
/** | ||
* Converts a QGIS \a rectangle to a SpatialIndex region. | ||
*/ | ||
static SpatialIndex::Region rectangleToRegion( const QgsRectangle &rectangle ); | ||
|
||
}; | ||
|
||
#endif // QGSSPATIALINDEXUTILS_H |