#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 | 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) const |
Returns the minimum distance between this point and a segment. | |
bool | operator== (const QgsPoint &other) |
equality operator | |
bool | operator!= (const QgsPoint &other) const |
Inequality operator. | |
QgsPoint & | operator= (const QgsPoint &other) |
Assignment. | |
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. | |
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 |
Currently no Z axis / 2.5D support is implemented.
Definition at line 61 of file qgspoint.h.
QgsPoint::QgsPoint | ( | ) | [inline] |
QgsPoint::QgsPoint | ( | const QgsPoint & | p | ) |
QgsPoint::QgsPoint | ( | double | x, | |
double | y | |||
) | [inline] |
Create a point from x,y coordinates
x | x coordinate | |
y | y coordinate |
Definition at line 75 of file qgspoint.h.
QgsPoint::~QgsPoint | ( | ) | [inline] |
Definition at line 79 of file qgspoint.h.
void QgsPoint::setX | ( | double | x | ) | [inline] |
Sets the x value of the point
x | x coordinate |
Definition at line 85 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsCentralPointPositionManager::findObjectPosition(), QgsLabel::renderLabel(), QgsVectorLayer::snapPoint(), and sqrDistToSegment().
void QgsPoint::setY | ( | double | y | ) | [inline] |
Sets the y value of the point
y | y coordinate |
Definition at line 93 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsCentralPointPositionManager::findObjectPosition(), QgsLabel::renderLabel(), QgsVectorLayer::snapPoint(), and sqrDistToSegment().
void QgsPoint::set | ( | double | x, | |
double | y | |||
) | [inline] |
Sets the x and y value of the point
Definition at line 99 of file qgspoint.h.
Referenced by QgsClipper::intersect(), QgsLabel::labelPoint(), and QgsMapToPixel::transform().
double QgsPoint::x | ( | ) | const [inline] |
Get the x value of the point
Definition at line 108 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRubberBand::addGeometry(), QgsDistanceArea::bearing(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsDistanceArea::computeDistanceBearing(), QgsRectangle::contains(), createGeosPoint(), QgsRasterImageBuffer::createNextPartImage(), distLine2Point(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), QgsRasterImageBuffer::drawPixelRectangle(), QgsRectangle::expand(), QgsMapTip::fetchFeature(), QgsRasterLayer::identify(), QgsPalGeometry::info(), QgsVectorLayer::insertSegmentVerticesForSnap(), intersectLines(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::paint(), QgsRasterLayer::paintImageToCanvas(), QgsMapCanvas::panActionEnd(), pointInRing(), QgsPoint(), QgsPalLayerSettings::registerFeature(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), QgsMapRenderer::splitLayersExtent(), sqrDist(), QgsMapTool::toCanvasCoordinates(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), and QgsAnnotationItem::updateBalloon().
double QgsPoint::y | ( | ) | const [inline] |
Get the y value of the point
Definition at line 116 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRubberBand::addGeometry(), QgsDistanceArea::bearing(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsDistanceArea::computeDistanceBearing(), QgsRectangle::contains(), createGeosPoint(), QgsRasterImageBuffer::createNextPartImage(), distLine2Point(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), QgsRasterImageBuffer::drawPixelRectangle(), QgsRectangle::expand(), QgsMapTip::fetchFeature(), QgsRasterLayer::identify(), QgsPalGeometry::info(), QgsVectorLayer::insertSegmentVerticesForSnap(), intersectLines(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::paint(), QgsRasterLayer::paintImageToCanvas(), QgsMapCanvas::panActionEnd(), pointInRing(), QgsPoint(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), QgsMapRenderer::splitLayersExtent(), sqrDist(), QgsMapTool::toCanvasCoordinates(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), and QgsAnnotationItem::updateBalloon().
QString QgsPoint::toString | ( | ) | const |
String representation of the point (x,y).
Definition at line 121 of file qgspoint.cpp.
Referenced by QgsMapToolZoom::canvasReleaseEvent(), QgsGeometry::checkRingIntersections(), QgsGeometry::closestSegmentWithContext(), QgsRasterLayer::identify(), operator<<(), QgsGeometry::sqrDistToVertexAt(), and QgsGeometry::validatePolyline().
QString QgsPoint::toString | ( | int | thePrecision | ) | const |
As above but with precision for string representation of a point.
Definition at line 130 of file qgspoint.cpp.
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.
QString QgsPoint::wellKnownText | ( | ) | const |
Return the well known text representation for the point. The wkt is created without an SRID.
Definition at line 163 of file qgspoint.cpp.
double QgsPoint::sqrDist | ( | double | x, | |
double | y | |||
) | const |
Returns the squared distance between this point and x,y.
Definition at line 168 of file qgspoint.cpp.
Referenced by 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 173 of file qgspoint.cpp.
double QgsPoint::sqrDistToSegment | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2, | |||
QgsPoint & | minDistPoint | |||
) | const |
Returns the minimum distance between this point and a segment.
Definition at line 242 of file qgspoint.cpp.
References m_x, m_y, setX(), setY(), and sqrDist().
Referenced by QgsGeometry::closestSegmentWithContext(), and QgsAnnotationItem::updateBalloon().
bool QgsPoint::operator== | ( | const QgsPoint & | other | ) |
bool QgsPoint::operator!= | ( | const QgsPoint & | other | ) | const |
void QgsPoint::multiply | ( | const double & | scalar | ) |
Definition at line 170 of file qgspoint.h.
Definition at line 171 of file qgspoint.h.
double QgsPoint::m_x [private] |
x coordinate
Definition at line 178 of file qgspoint.h.
Referenced by multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), sqrDist(), sqrDistToSegment(), toDegreesMinutesSeconds(), toString(), and wellKnownText().
double QgsPoint::m_y [private] |
y coordinate
Definition at line 181 of file qgspoint.h.
Referenced by multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), sqrDist(), sqrDistToSegment(), toDegreesMinutesSeconds(), toString(), and wellKnownText().