This repository has been archived on 2019-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
copr-dani-qgis/qgis-1.7.1-spatialindex.patch

258 lines
7.9 KiB
Diff
Raw Normal View History

--- qgis-1.7.1/CMakeLists.txt 2011-09-24 01:38:02.000000000 +0200
+++ ../BUILD/qgis-1.7.1/CMakeLists.txt 2011-10-16 16:17:07.042202703 +0200
@@ -66,7 +66,9 @@
SET (POSTGRESQL_PREFIX "" CACHE PATH "Path to POSTGRESQL base directory")
ENDIF (WITH_POSTGRESQL)
-SET (WITH_INTERNAL_QWTPOLAR TRUE CACHE BOOL "Use internal built of QwtPolar")
+SET (WITH_INTERNAL_QWTPOLAR TRUE CACHE BOOL "Use internal build of QwtPolar")
+
+SET (WITH_INTERNAL_SPATIALINDEX TRUE CACHE BOOL "Use internal build of Spatialindex")
SET (WITH_SPATIALITE TRUE CACHE BOOL "Determines whether SPATIALITE support should be built")
@@ -145,6 +147,11 @@
FIND_PACKAGE(GSL) # Georeferencer
FIND_PACKAGE(GEOS)
FIND_PACKAGE(GDAL)
+
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+ FIND_PACKAGE(Spatialindex REQUIRED)
+ENDIF(NOT WITH_INTERNAL_SPATIALINDEX)
+
FIND_PACKAGE(Qwt REQUIRED)
IF (NOT WITH_INTERNAL_QWTPOLAR)
FIND_PACKAGE(QwtPolar REQUIRED)
--- qgis-1.7.1/src/core/CMakeLists.txt 2011-09-24 01:38:02.000000000 +0200
+++ ../BUILD/qgis-1.7.1/src/core/CMakeLists.txt 2011-10-16 16:19:28.845050529 +0200
@@ -266,7 +266,6 @@
raster
renderer
symbology
- spatialindex/include
symbology-ng
gps/qextserialport
${PROJ_INCLUDE_DIR}
@@ -274,6 +273,12 @@
${GDAL_INCLUDE_DIR}
)
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+ INCLUDE_DIRECTORIES(${SPATIALINDEX_INCLUDE_DIR})
+ELSE (NOT WITH_INTERNAL_SPATIALINDEX)
+ INCLUDE_DIRECTORIES(spatialindex/include)
+ENDIF (NOT WITH_INTERNAL_SPATIALINDEX)
+
IF (NOT WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ENDIF (NOT WITH_INTERNAL_SPATIALITE)
@@ -296,25 +301,27 @@
#############################################################
# spatial indexing library
-# add path prefix to every specified file
-MACRO(PATH_PREFIX OUTPUT PREFIX)
- FOREACH(F ${ARGN})
- SET(${OUTPUT} ${${OUTPUT}} ${PREFIX}/${F})
- ENDFOREACH(F)
-ENDMACRO(PATH_PREFIX)
-
-# tools library
-PATH_PREFIX(TOOLS_SRC tools ExternalSort.cc ExternalSort.h TemporaryFile.cc Tools.cc)
-PATH_PREFIX(GEOM_SRC geometry LineSegment.cc Point.cc Region.cc)
-
-# spatial index library
-PATH_PREFIX(SPINDEX_SRC spatialindex SpatialIndexImpl.cc)
-PATH_PREFIX(STMAN_SRC storagemanager Buffer.cc DiskStorageManager.cc MemoryStorageManager.cc RandomEvictionsBuffer.cc)
-PATH_PREFIX(RTREE_SRC rtree BulkLoader.cc Index.cc Leaf.cc Node.cc RTree.cc Statistics.cc)
-
-SET(SPINDEX_SRC ${TOOLS_SRC} ${GEOM_SRC} ${SPINDEX_SRC} ${STMAN_SRC} ${RTREE_SRC})
-
-PATH_PREFIX(INDEX_SRC spatialindex ${SPINDEX_SRC})
+IF (WITH_INTERNAL_SPATIALINDEX)
+ # add path prefix to every specified file
+ MACRO(PATH_PREFIX OUTPUT PREFIX)
+ FOREACH(F ${ARGN})
+ SET(${OUTPUT} ${${OUTPUT}} ${PREFIX}/${F})
+ ENDFOREACH(F)
+ ENDMACRO(PATH_PREFIX)
+
+ # tools library
+ PATH_PREFIX(TOOLS_SRC tools ExternalSort.cc ExternalSort.h TemporaryFile.cc Tools.cc)
+ PATH_PREFIX(GEOM_SRC geometry LineSegment.cc Point.cc Region.cc)
+
+ # spatial index library
+ PATH_PREFIX(SPINDEX_SRC spatialindex SpatialIndexImpl.cc)
+ PATH_PREFIX(STMAN_SRC storagemanager Buffer.cc DiskStorageManager.cc MemoryStorageManager.cc RandomEvictionsBuffer.cc)
+ PATH_PREFIX(RTREE_SRC rtree BulkLoader.cc Index.cc Leaf.cc Node.cc RTree.cc Statistics.cc)
+
+ SET(SPINDEX_SRC ${TOOLS_SRC} ${GEOM_SRC} ${SPINDEX_SRC} ${STMAN_SRC} ${RTREE_SRC})
+
+ PATH_PREFIX(INDEX_SRC spatialindex ${SPINDEX_SRC})
+ENDIF (WITH_INTERNAL_SPATIALINDEX)
#############################################################
# qgis_core library
@@ -360,6 +367,11 @@
TARGET_LINK_LIBRARIES(qgis_core ${SQLITE3_LIBRARY})
ENDIF (WITH_INTERNAL_SPATIALITE)
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+ TARGET_LINK_LIBRARIES(qgis_core ${SPATIALINDEX_LIBRARY})
+ENDIF (NOT WITH_INTERNAL_SPATIALINDEX)
+
+
IF (APPLE)
SET_TARGET_PROPERTIES(qgis_core PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE )
ENDIF (APPLE)
--- qgis-1.7.1/cmake/FindSpatialindex.cmake 1970-01-01 01:00:00.000000000 +0100
+++ ../BUILD/qgis-1.7.1/cmake/FindSpatialindex.cmake 2011-10-16 16:17:07.043202653 +0200
@@ -0,0 +1,41 @@
+# Find Spatialindex
+# ~~~~~~~~
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+# Once run this will define:
+#
+# SPATIALINDEX_FOUND = system has Spatialindex lib
+# SPATIALINDEX_LIBRARY = full path to the Spatialindex library
+# SPATIALINDEX_INCLUDE_DIR = where to find headers
+#
+
+
+FIND_PATH(SPATIALINDEX_INCLUDE_DIR NAMES SpatialIndex.h PATHS
+ /usr/include
+ /usr/local/include
+ "$ENV{LIB_DIR}/include"
+ "$ENV{INCLUDE}"
+ PATH_SUFFIXES spatialindex
+ )
+
+FIND_LIBRARY(SPATIALINDEX_LIBRARY NAMES spatialindex PATHS
+ /usr/lib
+ /usr/local/lib
+ "$ENV{LIB_DIR}/lib"
+ "$ENV{LIB}/lib"
+ )
+
+IF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
+ SET(SPATIALINDEX_FOUND TRUE)
+ENDIF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
+
+IF (SPATIALINDEX_FOUND)
+ IF (NOT SPATIALINDEX_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Spatialindex: ${SPATIALINDEX_LIBRARY}")
+ ENDIF (NOT SPATIALINDEX_FIND_QUIETLY)
+ELSE (SPATIALINDEX_FOUND)
+ IF (SPATIALINDEX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Spatialindex")
+ ENDIF (SPATIALINDEX_FIND_REQUIRED)
+ENDIF (SPATIALINDEX_FOUND)
--- qgis-1.7.1/src/core/spatialindex/qgsspatialindex.h 2011-09-24 01:38:02.000000000 +0200
+++ ../BUILD/qgis-1.7.1/src/core/spatialindex/qgsspatialindex.h 2011-10-16 16:21:28.682006432 +0200
@@ -22,6 +22,8 @@
{
class IStorageManager;
class ISpatialIndex;
+ class Region;
+ class Point;
namespace StorageManager
{
@@ -29,14 +31,6 @@
}
}
-namespace Tools
-{
- namespace Geometry
- {
- class Region;
- }
-}
-
class QgsFeature;
class QgsRectangle;
class QgsPoint;
@@ -82,9 +76,9 @@
protected:
- Tools::Geometry::Region rectToRegion( QgsRectangle rect );
+ SpatialIndex::Region rectToRegion( QgsRectangle rect );
- bool featureInfo( QgsFeature& f, Tools::Geometry::Region& r, long& id );
+ bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, long& id );
private:
--- qgis-1.7.1/src/core/spatialindex/qgsspatialindex.cpp 2011-09-24 01:38:02.000000000 +0200
+++ ../BUILD/qgis-1.7.1/src/core/spatialindex/qgsspatialindex.cpp 2011-10-16 17:06:45.806073042 +0200
@@ -66,7 +66,7 @@
RTree::RTreeVariant variant = RTree::RV_RSTAR;
// create R-tree
- long indexId;
+ SpatialIndex::id_type indexId;
mRTree = RTree::createNewRTree( *mStorage, fillFactor, indexCapacity,
leafCapacity, dimension, variant, indexId );
}
@@ -78,17 +78,17 @@
delete mStorageManager;
}
-Tools::Geometry::Region QgsSpatialIndex::rectToRegion( QgsRectangle rect )
+SpatialIndex::Region QgsSpatialIndex::rectToRegion( QgsRectangle rect )
{
double pt1[2], pt2[2];
pt1[0] = rect.xMinimum();
pt1[1] = rect.yMinimum();
pt2[0] = rect.xMaximum();
pt2[1] = rect.yMaximum();
- return Tools::Geometry::Region( pt1, pt2, 2 );
+ return Region( pt1, pt2, 2 );
}
-bool QgsSpatialIndex::featureInfo( QgsFeature& f, Tools::Geometry::Region& r, long& id )
+bool QgsSpatialIndex::featureInfo( QgsFeature& f, Region& r, long& id )
{
QgsGeometry *g = f.geometry();
if ( !g )
@@ -101,7 +101,7 @@
bool QgsSpatialIndex::insertFeature( QgsFeature& f )
{
- Tools::Geometry::Region r;
+ Region r;
long id;
if ( !featureInfo( f, r, id ) )
return false;
@@ -131,7 +131,7 @@
bool QgsSpatialIndex::deleteFeature( QgsFeature& f )
{
- Tools::Geometry::Region r;
+ Region r;
long id;
if ( !featureInfo( f, r, id ) )
return false;
@@ -145,7 +145,7 @@
QList<int> list;
QgisVisitor visitor( list );
- Tools::Geometry::Region r = rectToRegion( rect );
+ Region r = rectToRegion( rect );
mRTree->intersectsWithQuery( r, visitor );
@@ -160,7 +160,7 @@
double pt[2];
pt[0] = point.x();
pt[1] = point.y();
- Tools::Geometry::Point p( pt, 2 );
+ Point p( pt, 2 );
mRTree->nearestNeighborQuery( neighbors, p, visitor );