Skip to content
Permalink
Browse files
Merge branch 'master' of git://github.com/qgis/Quantum-GIS
  • Loading branch information
Jean-Roc committed May 15, 2012
2 parents 2caba61 + a1255fc commit 07e4fb1534d4c3da43ff61437f312d3348836aa0
Showing with 31 additions and 12 deletions.
  1. +6 −3 cmake/FindGDAL.cmake
  2. +25 −9 python/plugins/fTools/tools/doSimplify.py
@@ -61,7 +61,7 @@ ELSE(WIN32)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
ENDIF (GDAL_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
@@ -97,7 +97,7 @@ ELSE(WIN32)
# According to INSTALL, 1.4.0+ is required
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))

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

IF (NOT GDAL_FIND_QUIETLY)
MESSAGE(STATUS "Found GDAL: ${GDAL_LIBRARY}")
FILE(READ ${GDAL_INCLUDE_DIR}/gdal_version.h gdal_version)
STRING(REGEX REPLACE "^.*GDAL_RELEASE_NAME +\"([^\"]+)\".*$" "\\1" GDAL_RELEASE_NAME "${gdal_version}")

MESSAGE(STATUS "Found GDAL: ${GDAL_LIBRARY} (${GDAL_RELEASE_NAME})")
ENDIF (NOT GDAL_FIND_QUIETLY)

ELSE (GDAL_FOUND)
@@ -161,11 +161,19 @@ def restoreGui( self ):

def geomVertexCount( geometry ):
geomType = geometry.type()
if geomType == 1: # line
points = geometry.asPolyline()
if geomType == QGis.Line:
if geometry.isMultipart():
pointsList = geometry.asMultiPolyline()
points = sum( pointsList, [] )
else:
points = geometry.asPolyline()
return len( points )
elif geomType == 2: # polygon
polylines = geometry.asPolygon()
elif geomType == QGis.Polygon:
if geometry.isMultipart():
polylinesList = geometry.asMultiPolygon()
polylines = sum( polylinesList, [] )
else:
polylines = geometry.asPolygon()
points = []
for l in polylines:
points.extend( l )
@@ -196,11 +204,19 @@ def densify( polyline, pointsNumber ):
def densifyGeometry( geometry, pointsNumber, isPolygon ):
output = []
if isPolygon:
rings = geometry.asPolygon()
for ring in rings:
ring = densify( ring, pointsNumber )
output.append( ring )
return QgsGeometry.fromPolygon( output )
if geometry.isMultipart():
polygons = geometry.asMultiPolygon()
for poly in polygons:
p = []
for ring in poly:
p.append( densify( ring, pointsNumber ) )
output.append( p )
return QgsGeometry.fromMultiPolygon( output )
else:
rings = geometry.asPolygon()
for ring in rings:
output.append( densify( ring, pointsNumber ) )
return QgsGeometry.fromPolygon( output )
else:
if geometry.isMultipart():
lines = geometry.asMultiPolyline()

0 comments on commit 07e4fb1

Please sign in to comment.