[QGIS Commit] r10392 - in trunk/qgis: python/core src/core src/gui
src/ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Mar 21 17:53:52 EDT 2009
Author: cfarmer
Date: 2009-03-21 17:53:52 -0400 (Sat, 21 Mar 2009)
New Revision: 10392
Modified:
trunk/qgis/python/core/qgsgeometry.sip
trunk/qgis/src/core/qgsgeometry.cpp
trunk/qgis/src/core/qgsgeometry.h
trunk/qgis/src/gui/qgsgenericprojectionselector.cpp
trunk/qgis/src/ui/qgsgenericprojectionselectorbase.ui
Log:
adds both simplify and centroid to qgsgeometry -> these will be used by the qgsanalysis branch
Modified: trunk/qgis/python/core/qgsgeometry.sip
===================================================================
--- trunk/qgis/python/core/qgsgeometry.sip 2009-03-21 21:33:39 UTC (rev 10391)
+++ trunk/qgis/python/core/qgsgeometry.sip 2009-03-21 21:53:52 UTC (rev 10392)
@@ -224,6 +224,14 @@
of segments used to approximate curves */
QgsGeometry* buffer(double distance, int segments) /Factory/;
+ /** Returns a simplified version of this geometry using a specified tolerance value */
+ QgsGeometry* simplify(double tolerance) /Factory/;
+
+ /** Returns the center of mass of a geometry
+ * @note for line based geometries, the center point of the line is returned,
+ * and for point based geometries, the point itself is returned */
+ QgsGeometry* centroid() /Factory/;
+
/** Returns the smallest convex polygon that contains all the points in the geometry. */
QgsGeometry* convexHull() /Factory/;
Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp 2009-03-21 21:33:39 UTC (rev 10391)
+++ trunk/qgis/src/core/qgsgeometry.cpp 2009-03-21 21:53:52 UTC (rev 10392)
@@ -132,8 +132,10 @@
#define GEOSGetInteriorRingN(g,i) GEOSGetInteriorRingN( (GEOSGeometry *)g, i )
#define GEOSDisjoint(g0,g1) GEOSDisjoint( (GEOSGeometry *)g0, (GEOSGeometry*)g1 )
#define GEOSIntersection(g0,g1) GEOSIntersection( (GEOSGeometry*) g0, (GEOSGeometry*)g1 )
-#define GEOSBuffer(g, d, s) GEOSBuffer( (GEOSGeometry*) g, d, s)
-#define GEOSArea(g, a) GEOSArea( (GEOSGeometry*) g, a)
+#define GEOSBuffer(g, d, s) GEOSBuffer( (GEOSGeometry*) g, d, s )
+#define GEOSArea(g, a) GEOSArea( (GEOSGeometry*) g, a )
+#define GEOSSimplify(g, t) GEOSSimplify( (GEOSGeometry*) g, t )
+#define GEOSGetCentroid(g) GEOSGetCentroid( (GEOSGeometry*) g )
#define GEOSCoordSeq_getSize(cs,n) GEOSCoordSeq_getSize( (GEOSCoordSequence *) cs, n )
#define GEOSCoordSeq_getX(cs,i,x) GEOSCoordSeq_getX( (GEOSCoordSequence *)cs, i, x )
@@ -5328,6 +5330,40 @@
CATCH_GEOS( 0 )
}
+QgsGeometry* QgsGeometry::simplify( double tolerance )
+{
+ if ( mGeos == NULL )
+ {
+ exportWkbToGeos();
+ }
+ if ( !mGeos )
+ {
+ return 0;
+ }
+ try
+ {
+ return fromGeosGeom( GEOSSimplify( mGeos, tolerance ) );
+ }
+ CATCH_GEOS( 0 )
+}
+
+QgsGeometry* QgsGeometry::centroid()
+{
+ if ( mGeos == NULL )
+ {
+ exportWkbToGeos();
+ }
+ if ( !mGeos )
+ {
+ return 0;
+ }
+ try
+ {
+ return fromGeosGeom( GEOSGetCentroid( mGeos ) );
+ }
+ CATCH_GEOS( 0 )
+}
+
QgsGeometry* QgsGeometry::convexHull()
{
if ( mGeos == NULL )
@@ -5450,7 +5486,6 @@
CATCH_GEOS( 0 )
}
-
QList<QgsGeometry*> QgsGeometry::asGeometryCollection()
{
if ( mGeos == NULL )
Modified: trunk/qgis/src/core/qgsgeometry.h
===================================================================
--- trunk/qgis/src/core/qgsgeometry.h 2009-03-21 21:33:39 UTC (rev 10391)
+++ trunk/qgis/src/core/qgsgeometry.h 2009-03-21 21:53:52 UTC (rev 10392)
@@ -128,8 +128,6 @@
bool isMultipart();
-
-
double distance( QgsGeometry& geom );
/**
@@ -269,6 +267,14 @@
/** Returns a buffer region around this geometry having the given width and with a specified number
of segments used to approximate curves */
QgsGeometry* buffer( double distance, int segments );
+
+ /** Returns a simplified version of this geometry using a specified tolerance value */
+ QgsGeometry* simplify( double tolerance );
+
+ /** Returns the center of mass of a geometry
+ * @note for line based geometries, the center point of the line is returned,
+ * and for point based geometries, the point itself is returned */
+ QgsGeometry* centroid();
/** Returns the smallest convex polygon that contains all the points in the geometry. */
QgsGeometry* convexHull();
Modified: trunk/qgis/src/gui/qgsgenericprojectionselector.cpp
===================================================================
--- trunk/qgis/src/gui/qgsgenericprojectionselector.cpp 2009-03-21 21:33:39 UTC (rev 10391)
+++ trunk/qgis/src/gui/qgsgenericprojectionselector.cpp 2009-03-21 21:53:52 UTC (rev 10392)
@@ -40,7 +40,7 @@
{
// Set up text edit pane
QString format( "<h2>%1</h2>%2 %3" );
- QString header = tr( "Define this layer's projection:" );
+ QString header = tr( "Define this layer's coordinate reference system:" );
QString sentence1 = tr( "This layer appears to have no projection specification." );
QString sentence2 = tr( "By default, this layer will now have its projection set to that of the project, "
"but you may override this by selecting a different projection below." );
Modified: trunk/qgis/src/ui/qgsgenericprojectionselectorbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsgenericprojectionselectorbase.ui 2009-03-21 21:33:39 UTC (rev 10391)
+++ trunk/qgis/src/ui/qgsgenericprojectionselectorbase.ui 2009-03-21 21:53:52 UTC (rev 10392)
@@ -10,10 +10,12 @@
</rect>
</property>
<property name="windowTitle" >
- <string>Projection Selector</string>
+ <string>Coordinate Reference System Selector</string>
</property>
<property name="windowIcon" >
- <iconset/>
+ <iconset>
+ <normaloff/>
+ </iconset>
</property>
<property name="modal" >
<bool>true</bool>
@@ -53,7 +55,7 @@
<item row="2" column="0" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
More information about the QGIS-commit
mailing list