QGIS API Documentation
2.2.0-Valmiera
|
A class for the creation of transect sample lines based on a set of strata polygons and baselines. More...
#include <qgstransectsample.h>
Public Types | |
enum | DistanceUnits { Meters, StrataUnits } |
Public Member Functions | |
QgsTransectSample (QgsVectorLayer *strataLayer, QString strataIdAttribute, QString minDistanceAttribute, QString nPointsAttribute, DistanceUnits minDistUnits, QgsVectorLayer *baselineLayer, bool shareBaseline, QString baselineStrataId, const QString &outputPointLayer, const QString &outputLineLayer, const QString &usedBaselineLayer, double minTransectLength=0.0) | |
~QgsTransectSample () | |
int | createSample (QProgressDialog *pd) |
Private Member Functions | |
QgsTransectSample () | |
QgsGeometry * | findBaselineGeometry (QVariant strataId) |
Static Private Member Functions | |
static bool | otherTransectWithinDistance (QgsGeometry *geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex &sIndex, const QMap< QgsFeatureId, QgsGeometry * > &lineFeatureMap, QgsDistanceArea &da) |
Returns true if another transect is within the specified minimum distance. | |
static bool | closestSegmentPoints (QgsGeometry &g1, QgsGeometry &g2, double &dist, QgsPoint &pt1, QgsPoint &pt2) |
Finds the closest points between two line segments. | |
static QgsGeometry * | closestMultilineElement (const QgsPoint &pt, QgsGeometry *multiLine) |
Returns a copy of the multiline element closest to a point (caller takes ownership) | |
static QgsGeometry * | clipBufferLine (QgsGeometry *stratumGeom, QgsGeometry *clippedBaseline, double tolerance) |
Returns clipped buffer line. |
Private Attributes | |
QgsVectorLayer * | mStrataLayer |
QString | mStrataIdAttribute |
QString | mMinDistanceAttribute |
QString | mNPointsAttribute |
QgsVectorLayer * | mBaselineLayer |
bool | mShareBaseline |
QString | mBaselineStrataId |
QString | mOutputPointLayer |
QString | mOutputLineLayer |
QString | mUsedBaselineLayer |
DistanceUnits | mMinDistanceUnits |
double | mMinTransectLength |
A class for the creation of transect sample lines based on a set of strata polygons and baselines.
Definition at line 16 of file qgstransectsample.h.
Definition at line 20 of file qgstransectsample.h.
QgsTransectSample::QgsTransectSample | ( | QgsVectorLayer * | strataLayer, |
QString | strataIdAttribute, | ||
QString | minDistanceAttribute, | ||
QString | nPointsAttribute, | ||
DistanceUnits | minDistUnits, | ||
QgsVectorLayer * | baselineLayer, | ||
bool | shareBaseline, | ||
QString | baselineStrataId, | ||
const QString & | outputPointLayer, | ||
const QString & | outputLineLayer, | ||
const QString & | usedBaselineLayer, | ||
double | minTransectLength = 0.0 |
||
) |
Definition at line 15 of file qgstransectsample.cpp.
QgsTransectSample::~QgsTransectSample | ( | ) |
Definition at line 28 of file qgstransectsample.cpp.
|
private |
Definition at line 24 of file qgstransectsample.cpp.
|
staticprivate |
Returns clipped buffer line.
Iteratively applies reduced tolerances if the result is not a single line
stratumGeom | stratum polygon |
clippedBaseline | base line geometry clipped to the stratum |
tolerance | buffer distance (in layer units) |
Definition at line 538 of file qgstransectsample.cpp.
References QgsGeometry::asMultiPolygon(), QgsGeometry::asPolygon(), QgsGeometry::buffer(), QgsGeometry::fromMultiPolyline(), QgsGeometry::fromPolygon(), QgsGeometry::intersection(), QgsGeometry::intersects(), QgsGeometry::isMultipart(), QGis::Line, size, QgsGeometry::type(), QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QgsGeometry::wkbType(), and QGis::WKBUnknown.
Referenced by createSample().
|
staticprivate |
Returns a copy of the multiline element closest to a point (caller takes ownership)
Definition at line 503 of file qgstransectsample.cpp.
References QgsGeometry::asMultiPolyline(), QgsGeometry::distance(), QgsGeometry::fromPoint(), QgsGeometry::fromPolyline(), QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, and QgsGeometry::wkbType().
Referenced by createSample().
|
staticprivate |
Finds the closest points between two line segments.
g1 | first input geometry. Must be a linestring with two vertices |
g2 | second input geometry. Must be a linestring with two vertices |
dist | out: distance between the segments |
pt1 | out: closest point on first geometry |
pt2 | out: closest point on secont geometry |
Definition at line 381 of file qgstransectsample.cpp.
References QgsGeometry::asPolyline(), qgsDoubleNear(), QgsPoint::setX(), QgsPoint::setY(), QgsPoint::sqrDist(), QgsPoint::sqrDistToSegment(), QGis::WKBLineString, QGis::WKBLineString25D, QgsGeometry::wkbType(), QgsPoint::x(), and QgsPoint::y().
Referenced by otherTransectWithinDistance().
int QgsTransectSample::createSample | ( | QProgressDialog * | pd | ) |
Definition at line 32 of file qgstransectsample.cpp.
References QgsVectorFileWriter::addFeature(), QgsFields::append(), QgsGeometry::asPoint(), QgsFeature::attribute(), QgsDistanceArea::bearing(), clipBufferLine(), closestMultilineElement(), QgsGeometry::closestSegmentWithContext(), QgsMapLayer::crs(), QGis::DecimalDegrees, QgsGeometry::distance(), QgsCoordinateReferenceSystem::EpsgCrsId, QgsVectorLayer::featureCount(), QgsFields::field(), findBaselineGeometry(), QgsGeometry::fromPolyline(), QgsFeature::geometry(), QgsFeature::geometryAndOwnership(), QgsVectorLayer::getFeatures(), QgsVectorFileWriter::hasError(), QgsSpatialIndex::insertFeature(), QgsGeometry::interpolate(), QgsGeometry::intersection(), QgsMapLayer::isValid(), QgsGeometry::length(), M_PI, QgsCoordinateReferenceSystem::mapUnits(), mBaselineLayer, MD_RAND_MAX, QgsDistanceArea::measure(), Meters, mMinDistanceAttribute, mMinDistanceUnits, mMinTransectLength, mNPointsAttribute, mOutputLineLayer, mOutputPointLayer, mStrataIdAttribute, mStrataLayer, mt_rand(), mt_srand(), mUsedBaselineLayer, QgsFeatureIterator::nextFeature(), QgsVectorFileWriter::NoError, otherTransectWithinDistance(), QgsVectorLayer::pendingFields(), QgsFeature::setAttribute(), QgsDistanceArea::setEllipsoidalMode(), QgsFeature::setGeometry(), QgsDistanceArea::setSourceCrs(), QgsFeatureRequest::setSubsetOfAttributes(), QgsCoordinateReferenceSystem::srsid(), QgsField::type(), QGis::WKBLineString, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBPoint, QgsGeometry::wkbType(), QGis::WKBUnknown, QgsPoint::x(), and QgsPoint::y().
|
private |
Definition at line 322 of file qgstransectsample.cpp.
References QgsFeature::attribute(), QgsFeature::geometryAndOwnership(), QgsVectorLayer::getFeatures(), mBaselineLayer, mBaselineStrataId, mShareBaseline, QgsFeatureIterator::nextFeature(), and QgsVectorLayer::pendingFields().
Referenced by createSample().
|
staticprivate |
Returns true if another transect is within the specified minimum distance.
Definition at line 342 of file qgstransectsample.cpp.
References QgsGeometry::boundingBox(), QgsGeometry::buffer(), closestSegmentPoints(), QgsSpatialIndex::intersects(), and QgsDistanceArea::measureLine().
Referenced by createSample().
|
private |
Definition at line 47 of file qgstransectsample.h.
Referenced by createSample(), and findBaselineGeometry().
|
private |
Definition at line 49 of file qgstransectsample.h.
Referenced by findBaselineGeometry().
|
private |
Definition at line 44 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 55 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 57 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 45 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 52 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 51 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 48 of file qgstransectsample.h.
Referenced by findBaselineGeometry().
|
private |
Definition at line 43 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 42 of file qgstransectsample.h.
Referenced by createSample().
|
private |
Definition at line 53 of file qgstransectsample.h.
Referenced by createSample().