QGIS API Documentation
2.2.0-Valmiera
|
A class to represent a point geometry. More...
#include <qgspoint.h>
Public Member Functions | |
QgsPoint () | |
Default constructor. | |
QgsPoint (const QgsPoint &p) | |
QgsPoint (double x, double y) | |
~QgsPoint () | |
void | setX (double x) |
void | setY (double y) |
void | set (double x, double y) |
double | x () const |
double | y () const |
QString | toString () const |
String representation of the point (x,y) | |
QString | toString (int thePrecision) const |
As above but with precision for string representation of a point. | |
QString | toDegreesMinutesSeconds (int thePrecision) const |
Return a string representation as degrees minutes seconds. | |
QString | toDegreesMinutes (int thePrecision) const |
Return a string representation as degrees minutes. | |
QString | wellKnownText () const |
double | sqrDist (double x, double y) const |
Returns the squared distance between this point and x,y. | |
double | sqrDist (const QgsPoint &other) const |
Returns the squared distance between this and other point. | |
double | sqrDistToSegment (double x1, double y1, double x2, double y2, QgsPoint &minDistPoint, double epsilon=DEFAULT_SEGMENT_EPSILON) const |
Returns the minimum distance between this point and a segment. | |
double | azimuth (const QgsPoint &other) |
Calculates azimut between this point and other one (clockwise in degree, starting from north) | |
bool | operator== (const QgsPoint &other) |
equality operator | |
bool | operator!= (const QgsPoint &other) const |
Inequality operator. | |
void | multiply (const double &scalar) |
Multiply x and y by the given value. | |
int | onSegment (const QgsPoint &a, const QgsPoint &b) const |
Test if this point is on the segment defined by points a, b. | |
QgsPoint & | operator= (const QgsPoint &other) |
Assignment. | |
QgsVector | operator- (QgsPoint p) const |
QgsPoint & | operator+= (const QgsVector &v) |
QgsPoint & | operator-= (const QgsVector &v) |
QgsPoint | operator+ (const QgsVector &v) const |
QgsPoint | operator- (const QgsVector &v) const |
Private Attributes | |
double | m_x |
x coordinate | |
double | m_y |
y coordinate |
Friends | |
uint | qHash (const QgsPoint &pnt) |
A class to represent a point geometry.
Currently no Z axis / 2.5D support is implemented.
Definition at line 63 of file qgspoint.h.
|
inline |
Default constructor.
Definition at line 67 of file qgspoint.h.
QgsPoint::QgsPoint | ( | const QgsPoint & | p | ) |
|
inline |
Create a point from x,y coordinates
x | x coordinate |
y | y coordinate |
Definition at line 77 of file qgspoint.h.
|
inline |
Definition at line 81 of file qgspoint.h.
double QgsPoint::azimuth | ( | const QgsPoint & | other | ) |
void QgsPoint::multiply | ( | const double & | scalar | ) |
Multiply x and y by the given value.
Definition at line 231 of file qgspoint.cpp.
bool QgsPoint::operator!= | ( | const QgsPoint & | other | ) | const |
Definition at line 185 of file qgspoint.h.
References QgsVector::x(), and QgsVector::y().
Definition at line 183 of file qgspoint.h.
Definition at line 182 of file qgspoint.h.
Definition at line 186 of file qgspoint.h.
References QgsVector::x(), and QgsVector::y().
Definition at line 184 of file qgspoint.h.
bool QgsPoint::operator== | ( | const QgsPoint & | other | ) |
|
inline |
Sets the x and y value of the point
Definition at line 101 of file qgspoint.h.
Referenced by QgsGeometry::closestVertex(), QgsClipper::intersect(), QgsLabel::labelPoint(), and QgsMapToPixel::transform().
|
inline |
Sets the x value of the point
x | x coordinate |
Definition at line 87 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsRasterProjector::calcHelper(), QgsGeometryAnalyzer::clipSegmentByRange(), QgsTransectSample::closestSegmentPoints(), QgsRasterLayer::draw(), QgsPalLabeling::drawLabel(), QgsComposerMap::gridAnnotationString(), QgsGeometryAnalyzer::locateAlongSegment(), QgsLabel::renderLabel(), QgsVectorLayer::snapPoint(), and sqrDistToSegment().
|
inline |
Sets the y value of the point
y | y coordinate |
Definition at line 95 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsRasterProjector::calcHelper(), QgsGeometryAnalyzer::clipSegmentByRange(), QgsTransectSample::closestSegmentPoints(), QgsPalLabeling::drawLabel(), QgsComposerMap::gridAnnotationString(), QgsGeometryAnalyzer::locateAlongSegment(), QgsLabel::renderLabel(), QgsVectorLayer::snapPoint(), and sqrDistToSegment().
double QgsPoint::sqrDist | ( | double | x, |
double | y | ||
) | const |
Returns the squared distance between this point and x,y.
Definition at line 186 of file qgspoint.cpp.
References m_x, m_y, x(), and y().
Referenced by QgsRasterProjector::calcSrcRowsCols(), QgsRasterProjector::checkCols(), QgsPointSample::checkMinDistance(), QgsRasterProjector::checkRows(), QgsTransectSample::closestSegmentPoints(), QgsGeometry::closestVertex(), QgsGeometry::closestVertexWithContext(), QgsTolerance::computeMapUnitPerPixel(), QgsSnapper::snapPoint(), sqrDist(), sqrDistToSegment(), QgsGeometry::sqrDistToVertexAt(), and QgsAnnotationItem::updateBalloon().
double QgsPoint::sqrDist | ( | const QgsPoint & | other | ) | const |
Returns the squared distance between this and other point.
Definition at line 191 of file qgspoint.cpp.
double QgsPoint::sqrDistToSegment | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
QgsPoint & | minDistPoint, | ||
double | epsilon = DEFAULT_SEGMENT_EPSILON |
||
) | const |
Returns the minimum distance between this point and a segment.
Definition at line 267 of file qgspoint.cpp.
References m_x, m_y, qgsDoubleNear(), setX(), setY(), and sqrDist().
Referenced by QgsTransectSample::closestSegmentPoints(), QgsGeometry::closestSegmentWithContext(), and QgsAnnotationItem::updateBalloon().
QString QgsPoint::toDegreesMinutes | ( | int | thePrecision | ) | const |
Return a string representation as degrees minutes.
Its up to the calling function to ensure that this point can be meaningfully represented in this form.
Definition at line 162 of file qgspoint.cpp.
Referenced by QgsComposerMap::gridAnnotationString().
QString QgsPoint::toDegreesMinutesSeconds | ( | int | thePrecision | ) | const |
Return a string representation as degrees minutes seconds.
Its up to the calling function to ensure that this point can be meaningfully represented in this form.
Definition at line 137 of file qgspoint.cpp.
Referenced by QgsComposerMap::gridAnnotationString().
QString QgsPoint::toString | ( | ) | const |
String representation of the point (x,y)
Definition at line 121 of file qgspoint.cpp.
Referenced by QgsMapToolZoom::canvasReleaseEvent(), QgsGeometryValidator::checkRingIntersections(), QgsGeometry::closestSegmentWithContext(), QgsRasterProjector::cpToString(), QgsMapToolIdentify::featureDerivedAttributes(), QgsMapToolIdentify::identifyRasterLayer(), QgsMapToolIdentify::identifyVectorLayer(), QgsDistanceArea::measureLine(), operator<<(), QgsGeometry::sqrDistToVertexAt(), and QgsGeometryValidator::validatePolyline().
QString QgsPoint::toString | ( | int | thePrecision | ) | const |
QString QgsPoint::wellKnownText | ( | ) | const |
Return the well known text representation for the point. The wkt is created without an SRID.
Definition at line 181 of file qgspoint.cpp.
References m_x, m_y, and qgsDoubleToString().
|
inline |
Get the x value of the point
Definition at line 110 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRasterProjector::approximateSrcRowCol(), azimuth(), QgsDistanceArea::bearing(), QgsRasterProjector::calcHelper(), QgsRasterProjector::calcSrcExtent(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsRasterProjector::checkCols(), QgsRasterProjector::checkRows(), QgsTransectSample::closestSegmentPoints(), QgsGeometry::closestSegmentWithContext(), QgsDistanceArea::computeDistanceBearing(), QgsComposition::computeWorldFileParameters(), QgsRectangle::contains(), createGeosPoint(), QgsGeometryAnalyzer::createOffsetGeometry(), QgsGeometryAnalyzer::createPointOffset(), QgsTransectSample::createSample(), QgsGeometryValidator::distLine2Point(), QgsVectorLayer::draw(), QgsRasterDrawer::drawImage(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelBackground(), QgsPalLabeling::drawLabelCandidateRect(), QgsPalLabeling::drawLabeling(), QgsPalLabeling::drawLabelShadow(), QgsMapToolIdentify::featureDerivedAttributes(), QgsMapTip::fetchFeature(), QgsGml::getPointWKB(), QgsRasterDataProvider::identify(), QgsMapToolIdentify::identifyRasterLayer(), QgsMapToolIdentify::identifyVectorLayer(), QgsPalGeometry::info(), QgsVectorLayerEditUtils::insertSegmentVerticesForSnap(), QgsGeometryValidator::intersectLines(), QgsLabelSearchTree::label(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsSpatialIndex::nearestNeighbor(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::overviewExtentChanged(), QgsComposerMap::paint(), QgsRubberBand::paint(), QgsMapCanvas::panActionEnd(), QgsGeometryValidator::pointInRing(), QgsPoint(), QgsPalLabeling::registerDiagramFeature(), QgsPalLayerSettings::registerFeature(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsPointDisplacementRenderer::searchRect(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsHtmlAnnotationItem::setFeatureForMapPosition(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsRasterLayerSaveAsDialog::setResolution(), QgsRubberBand::setToCanvasRectangle(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), sqrDist(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), toString(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), and QgsAnnotationItem::updateBalloon().
|
inline |
Get the y value of the point
Definition at line 118 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRasterProjector::approximateSrcRowCol(), azimuth(), QgsDistanceArea::bearing(), QgsRasterProjector::calcHelper(), QgsRasterProjector::calcSrcExtent(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsRasterProjector::checkCols(), QgsRasterProjector::checkRows(), QgsTransectSample::closestSegmentPoints(), QgsGeometry::closestSegmentWithContext(), QgsDistanceArea::computeDistanceBearing(), QgsComposition::computeWorldFileParameters(), QgsRectangle::contains(), createGeosPoint(), QgsGeometryAnalyzer::createOffsetGeometry(), QgsGeometryAnalyzer::createPointOffset(), QgsTransectSample::createSample(), QgsGeometryValidator::distLine2Point(), QgsVectorLayer::draw(), QgsRasterDrawer::drawImage(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelBackground(), QgsPalLabeling::drawLabelCandidateRect(), QgsPalLabeling::drawLabeling(), QgsPalLabeling::drawLabelShadow(), QgsMapToolIdentify::featureDerivedAttributes(), QgsMapTip::fetchFeature(), QgsGml::getPointWKB(), QgsRasterDataProvider::identify(), QgsMapToolIdentify::identifyRasterLayer(), QgsMapToolIdentify::identifyVectorLayer(), QgsPalGeometry::info(), QgsVectorLayerEditUtils::insertSegmentVerticesForSnap(), QgsGeometryValidator::intersectLines(), QgsLabelSearchTree::label(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsSpatialIndex::nearestNeighbor(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::overviewExtentChanged(), QgsComposerMap::paint(), QgsRubberBand::paint(), QgsMapCanvas::panActionEnd(), QgsGeometryValidator::pointInRing(), QgsPoint(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsPointDisplacementRenderer::searchRect(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsHtmlAnnotationItem::setFeatureForMapPosition(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsRasterLayerSaveAsDialog::setResolution(), QgsRubberBand::setToCanvasRectangle(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), sqrDist(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), toString(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), and QgsAnnotationItem::updateBalloon().
|
friend |
Definition at line 216 of file qgspoint.h.
|
private |
x coordinate
Definition at line 191 of file qgspoint.h.
Referenced by azimuth(), multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), qHash(), sqrDist(), sqrDistToSegment(), toDegreesMinutes(), toDegreesMinutesSeconds(), toString(), and wellKnownText().
|
private |
y coordinate
Definition at line 194 of file qgspoint.h.
Referenced by azimuth(), multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), qHash(), sqrDist(), sqrDistToSegment(), toDegreesMinutes(), toDegreesMinutesSeconds(), toString(), and wellKnownText().