Quantum GIS API Documentation
1.7.4
|
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 | 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. | |
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. | |
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 |
A class to represent a point geometry.
Currently no Z axis / 2.5D support is implemented.
Definition at line 62 of file qgspoint.h.
QgsPoint::QgsPoint | ( | ) | [inline] |
Default constructor.
Definition at line 66 of file qgspoint.h.
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 76 of file qgspoint.h.
QgsPoint::~QgsPoint | ( | ) | [inline] |
Definition at line 80 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 214 of file qgspoint.cpp.
int QgsPoint::onSegment | ( | const QgsPoint & | a, |
const QgsPoint & | b | ||
) | const |
bool QgsPoint::operator!= | ( | const QgsPoint & | other | ) | const |
Definition at line 177 of file qgspoint.h.
References QgsVector::x(), and QgsVector::y().
Definition at line 175 of file qgspoint.h.
Definition at line 174 of file qgspoint.h.
Definition at line 178 of file qgspoint.h.
References QgsVector::x(), and QgsVector::y().
Definition at line 176 of file qgspoint.h.
bool QgsPoint::operator== | ( | const QgsPoint & | other | ) |
void QgsPoint::set | ( | double | x, |
double | y | ||
) | [inline] |
Sets the x and y value of the point
Definition at line 100 of file qgspoint.h.
Referenced by QgsClipper::intersect(), QgsLabel::labelPoint(), and QgsMapToPixel::transform().
void QgsPoint::setX | ( | double | x | ) | [inline] |
Sets the x value of the point
x | x coordinate |
Definition at line 86 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsRasterProjector::calcHelper(), QgsRasterLayer::draw(), 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 94 of file qgspoint.h.
Referenced by QgsAnnotationItem::_readXML(), QgsRasterProjector::calcHelper(), QgsCentralPointPositionManager::findObjectPosition(), 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 169 of file qgspoint.cpp.
References m_x, m_y, x(), and y().
Referenced by QgsRasterProjector::calcSrcRowsCols(), QgsRasterProjector::checkCols(), QgsRasterProjector::checkRows(), 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 174 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 250 of file qgspoint.cpp.
References doubleNear(), m_x, m_y, setX(), setY(), and sqrDist().
Referenced by QgsGeometry::closestSegmentWithContext(), and QgsAnnotationItem::updateBalloon().
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 138 of file qgspoint.cpp.
QString QgsPoint::toString | ( | ) | const |
String representation of the point (x,y)
Definition at line 122 of file qgspoint.cpp.
Referenced by QgsMapToolZoom::canvasReleaseEvent(), QgsGeometry::checkRingIntersections(), QgsGeometry::closestSegmentWithContext(), QgsRasterProjector::cpToString(), 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 131 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 164 of file qgspoint.cpp.
double QgsPoint::x | ( | ) | const [inline] |
Get the x value of the point
Definition at line 109 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRubberBand::addGeometry(), QgsRasterProjector::approximateSrcRowCol(), azimuth(), QgsDistanceArea::bearing(), QgsRasterProjector::calcHelper(), QgsRasterProjector::calcSrcExtent(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsRasterProjector::checkCols(), QgsRasterProjector::checkRows(), QgsDistanceArea::computeDistanceBearing(), QgsRectangle::contains(), createGeosPoint(), QgsRasterImageBuffer::createNextPartImage(), distLine2Point(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), QgsPalLabeling::drawLabeling(), QgsRasterImageBuffer::drawPixelRectangle(), QgsRectangle::expand(), QgsMapTip::fetchFeature(), QgsPalGeometry::info(), QgsVectorLayer::insertSegmentVerticesForSnap(), intersectLines(), QgsLabelSearchTree::label(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsSpatialIndex::nearestNeighbor(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::paint(), QgsMapCanvas::panActionEnd(), pointInRing(), QgsPoint(), QgsPalLabeling::registerDiagramFeature(), QgsPalLayerSettings::registerFeature(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsRubberBand::setToCanvasRectangle(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), QgsMapRenderer::splitLayersExtent(), sqrDist(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), QgsAnnotationItem::updateBalloon(), and QgsSearchTreeNode::valueAgainst().
double QgsPoint::y | ( | ) | const [inline] |
Get the y value of the point
Definition at line 117 of file qgspoint.h.
Referenced by QgsAnnotationItem::_writeXML(), QgsRubberBand::addGeometry(), QgsRasterProjector::approximateSrcRowCol(), azimuth(), QgsDistanceArea::bearing(), QgsRasterProjector::calcHelper(), QgsRasterProjector::calcSrcExtent(), QgsPalLayerSettings::calculateLabelSize(), QgsMapToolZoom::canvasReleaseEvent(), QgsRasterProjector::checkCols(), QgsRasterProjector::checkRows(), QgsDistanceArea::computeDistanceBearing(), QgsRectangle::contains(), createGeosPoint(), QgsRasterImageBuffer::createNextPartImage(), distLine2Point(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), QgsPalLabeling::drawLabeling(), QgsRasterImageBuffer::drawPixelRectangle(), QgsRectangle::expand(), QgsMapTip::fetchFeature(), QgsPalGeometry::info(), QgsVectorLayer::insertSegmentVerticesForSnap(), intersectLines(), QgsLabelSearchTree::label(), QgsComposerMap::mapPolygon(), QgsComposerMap::mapToItemCoords(), QgsDistanceArea::measureLine(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsSpatialIndex::nearestNeighbor(), onSegment(), operator!=(), operator=(), operator==(), operator==(), QgsComposerMap::paint(), QgsMapCanvas::panActionEnd(), pointInRing(), QgsPoint(), QgsLabel::renderLabel(), QgsRectangle::scale(), QgsRectangle::set(), QgsMapCanvas::setExtent(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsRubberBand::setToCanvasRectangle(), QgsGeometryAnalyzer::simpleMeasure(), QgsVectorLayer::snapWithContext(), sqrDist(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), QgsMapToPixel::transform(), QgsCoordinateTransform::transform(), QgsClipper::trimFeatureToBoundary(), QgsAnnotationItem::updateBalloon(), and QgsSearchTreeNode::valueAgainst().
double QgsPoint::m_x [private] |
x coordinate
Definition at line 183 of file qgspoint.h.
Referenced by azimuth(), multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), sqrDist(), sqrDistToSegment(), toDegreesMinutesSeconds(), toString(), and wellKnownText().
double QgsPoint::m_y [private] |
y coordinate
Definition at line 186 of file qgspoint.h.
Referenced by azimuth(), multiply(), onSegment(), operator!=(), operator-(), operator=(), operator==(), QgsPoint(), sqrDist(), sqrDistToSegment(), toDegreesMinutesSeconds(), toString(), and wellKnownText().