Skip to content

Commit 07e4fb1

Browse files
committed
Merge branch 'master' of git://github.com/qgis/Quantum-GIS
2 parents 2caba61 + a1255fc commit 07e4fb1

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

cmake/FindGDAL.cmake

+6-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ELSE(WIN32)
6161
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
6262
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
6363
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
64-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
64+
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
6565
ENDIF (GDAL_LIBRARY)
6666
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
6767
ENDIF ()
@@ -97,7 +97,7 @@ ELSE(WIN32)
9797
# According to INSTALL, 1.4.0+ is required
9898
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
9999
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
100-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
100+
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
101101

102102
# set INCLUDE_DIR to prefix+include
103103
EXEC_PROGRAM(${GDAL_CONFIG}
@@ -172,7 +172,10 @@ ENDIF (GDAL_INCLUDE_DIR AND GDAL_LIBRARY)
172172
IF (GDAL_FOUND)
173173

174174
IF (NOT GDAL_FIND_QUIETLY)
175-
MESSAGE(STATUS "Found GDAL: ${GDAL_LIBRARY}")
175+
FILE(READ ${GDAL_INCLUDE_DIR}/gdal_version.h gdal_version)
176+
STRING(REGEX REPLACE "^.*GDAL_RELEASE_NAME +\"([^\"]+)\".*$" "\\1" GDAL_RELEASE_NAME "${gdal_version}")
177+
178+
MESSAGE(STATUS "Found GDAL: ${GDAL_LIBRARY} (${GDAL_RELEASE_NAME})")
176179
ENDIF (NOT GDAL_FIND_QUIETLY)
177180

178181
ELSE (GDAL_FOUND)

python/plugins/fTools/tools/doSimplify.py

+25-9
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,19 @@ def restoreGui( self ):
161161

162162
def geomVertexCount( geometry ):
163163
geomType = geometry.type()
164-
if geomType == 1: # line
165-
points = geometry.asPolyline()
164+
if geomType == QGis.Line:
165+
if geometry.isMultipart():
166+
pointsList = geometry.asMultiPolyline()
167+
points = sum( pointsList, [] )
168+
else:
169+
points = geometry.asPolyline()
166170
return len( points )
167-
elif geomType == 2: # polygon
168-
polylines = geometry.asPolygon()
171+
elif geomType == QGis.Polygon:
172+
if geometry.isMultipart():
173+
polylinesList = geometry.asMultiPolygon()
174+
polylines = sum( polylinesList, [] )
175+
else:
176+
polylines = geometry.asPolygon()
169177
points = []
170178
for l in polylines:
171179
points.extend( l )
@@ -196,11 +204,19 @@ def densify( polyline, pointsNumber ):
196204
def densifyGeometry( geometry, pointsNumber, isPolygon ):
197205
output = []
198206
if isPolygon:
199-
rings = geometry.asPolygon()
200-
for ring in rings:
201-
ring = densify( ring, pointsNumber )
202-
output.append( ring )
203-
return QgsGeometry.fromPolygon( output )
207+
if geometry.isMultipart():
208+
polygons = geometry.asMultiPolygon()
209+
for poly in polygons:
210+
p = []
211+
for ring in poly:
212+
p.append( densify( ring, pointsNumber ) )
213+
output.append( p )
214+
return QgsGeometry.fromMultiPolygon( output )
215+
else:
216+
rings = geometry.asPolygon()
217+
for ring in rings:
218+
output.append( densify( ring, pointsNumber ) )
219+
return QgsGeometry.fromPolygon( output )
204220
else:
205221
if geometry.isMultipart():
206222
lines = geometry.asMultiPolyline()

0 commit comments

Comments
 (0)