mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
adds both simplify and centroid to qgsgeometry -> these will be used by the qgsanalysis branch
git-svn-id: http://svn.osgeo.org/qgis/trunk@10392 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
3eed5f144e
commit
1e7c7e86f2
@ -224,6 +224,14 @@ not disjoint with existing polygons of the feature*/
|
||||
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/;
|
||||
|
||||
|
@ -132,8 +132,10 @@ static GEOSInit geosinit;
|
||||
#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 @@ QgsGeometry* QgsGeometry::buffer( double distance, int segments )
|
||||
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 @@ QgsGeometry* QgsGeometry::symDifference( QgsGeometry* geometry )
|
||||
CATCH_GEOS( 0 )
|
||||
}
|
||||
|
||||
|
||||
QList<QgsGeometry*> QgsGeometry::asGeometryCollection()
|
||||
{
|
||||
if ( mGeos == NULL )
|
||||
|
@ -128,8 +128,6 @@ class CORE_EXPORT QgsGeometry
|
||||
bool isMultipart();
|
||||
|
||||
|
||||
|
||||
|
||||
double distance( QgsGeometry& geom );
|
||||
|
||||
/**
|
||||
@ -269,6 +267,14 @@ class CORE_EXPORT QgsGeometry
|
||||
/** 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();
|
||||
|
@ -40,7 +40,7 @@ void QgsGenericProjectionSelector::setMessage( QString theMessage )
|
||||
{
|
||||
// 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." );
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user