/usr/include/qgis/qgslinestringv2.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | /***************************************************************************
qgslinestringv2.h
-----------------
begin : September 2014
copyright : (C) 2014 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSLINESTRINGV2_H
#define QGSLINESTRINGV2_H
#include "qgscurvev2.h"
#include "qgswkbptr.h"
#include <QPolygonF>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsgeometry.cpp.
* See details in QEP #17
****************************************************************************/
/** \ingroup core
* \class QgsLineStringV2
* \brief Line string geometry type, with support for z-dimension and m-values.
* \note added in QGIS 2.10
*/
class CORE_EXPORT QgsLineStringV2: public QgsCurveV2
{
public:
QgsLineStringV2();
~QgsLineStringV2();
bool operator==( const QgsCurveV2& other ) const override;
bool operator!=( const QgsCurveV2& other ) const override;
/** Returns the specified point from inside the line string.
* @param i index of point, starting at 0 for the first point
*/
QgsPointV2 pointN( int i ) const;
/** Returns the x-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0
* @returns x-coordinate of node, or 0.0 if index is out of bounds
* @see setXAt()
*/
double xAt( int index ) const;
/** Returns the y-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0
* @returns y-coordinate of node, or 0.0 if index is out of bounds
* @see setYAt()
*/
double yAt( int index ) const;
/** Returns the z-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0
* @returns z-coordinate of node, or 0.0 if index is out of bounds or the line
* does not have a z dimension
* @see setZAt()
*/
double zAt( int index ) const;
/** Returns the m value of the specified node in the line string.
* @param index index of node, where the first node in the line is 0
* @returns m value of node, or 0.0 if index is out of bounds or the line
* does not have m values
* @see setMAt()
*/
double mAt( int index ) const;
/** Sets the x-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0. Corresponding
* node must already exist in line string.
* @param x x-coordinate of node
* @see xAt()
*/
void setXAt( int index, double x );
/** Sets the y-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0. Corresponding
* node must already exist in line string.
* @param y y-coordinate of node
* @see yAt()
*/
void setYAt( int index, double y );
/** Sets the z-coordinate of the specified node in the line string.
* @param index index of node, where the first node in the line is 0. Corresponding
* node must already exist in line string, and the line string must have z-dimension.
* @param z z-coordinate of node
* @see zAt()
*/
void setZAt( int index, double z );
/** Sets the m value of the specified node in the line string.
* @param index index of node, where the first node in the line is 0. Corresponding
* node must already exist in line string, and the line string must have m values.
* @param m m value of node
* @see mAt()
*/
void setMAt( int index, double m );
/** Resets the line string to match the specified list of points. The line string will
* inherit the dimensionality of the first point in the list.
* @param points new points for line string. If empty, line string will be cleared.
*/
void setPoints( const QgsPointSequenceV2 &points );
/** Appends the contents of another line string to the end of this line string.
* @param line line to append. Ownership is not transferred.
*/
void append( const QgsLineStringV2* line );
/** Adds a new vertex to the end of the line string.
* @param pt vertex to add
*/
void addVertex( const QgsPointV2& pt );
/** Closes the line string by appending the first point to the end of the line, if it is not already closed.*/
void close();
/** Returns a QPolygonF representing the line string.
*/
QPolygonF asQPolygonF() const;
/** Returns the geometry converted to the more generic curve type QgsCompoundCurveV2
@return the converted geometry. Caller takes ownership*/
QgsAbstractGeometryV2* toCurveType() const override;
//reimplemented methods
virtual QString geometryType() const override { return "LineString"; }
virtual int dimension() const override { return 1; }
virtual QgsLineStringV2* clone() const override;
virtual void clear() override;
virtual bool fromWkb( QgsConstWkbPtr wkb ) override;
virtual bool fromWkt( const QString& wkt ) override;
int wkbSize() const override;
unsigned char* asWkb( int& binarySize ) const override;
QString asWkt( int precision = 17 ) const override;
QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const override;
QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const override;
QString asJSON( int precision = 17 ) const override;
//curve interface
virtual double length() const override;
virtual QgsPointV2 startPoint() const override;
virtual QgsPointV2 endPoint() const override;
/** Returns a new line string geometry corresponding to a segmentized approximation
* of the curve.
* @param tolerance segmentation tolerance
* @param toleranceType maximum segmentation angle or maximum difference between approximation and curve*/
virtual QgsLineStringV2* curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override;
int numPoints() const override;
virtual int nCoordinates() const override { return mX.size(); }
void points( QgsPointSequenceV2 &pt ) const override;
void draw( QPainter& p ) const override;
void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QTransform& t ) override;
void addToPainterPath( QPainterPath& path ) const override;
void drawAsPolygon( QPainter& p ) const override;
virtual bool insertVertex( QgsVertexId position, const QgsPointV2& vertex ) override;
virtual bool moveVertex( QgsVertexId position, const QgsPointV2& newPos ) override;
virtual bool deleteVertex( QgsVertexId position ) override;
virtual QgsLineStringV2* reversed() const override;
double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const override;
bool pointAt( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const override;
virtual QgsPointV2 centroid() const override;
void sumUpArea( double& sum ) const override;
double vertexAngle( QgsVertexId vertex ) const override;
virtual bool addZValue( double zValue = 0 ) override;
virtual bool addMValue( double mValue = 0 ) override;
virtual bool dropZValue() override;
virtual bool dropMValue() override;
bool convertTo( QgsWKBTypes::Type type ) override;
protected:
virtual QgsRectangle calculateBoundingBox() const override;
private:
QVector<double> mX;
QVector<double> mY;
QVector<double> mZ;
QVector<double> mM;
void importVerticesFromWkb( const QgsConstWkbPtr& wkb );
/** Resets the line string to match the line string in a WKB geometry.
* @param type WKB type
* @param wkb WKB representation of line geometry
*/
void fromWkbPoints( QgsWKBTypes::Type type, const QgsConstWkbPtr& wkb );
friend class QgsPolygonV2;
};
#endif // QGSLINESTRINGV2_H
|