mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-06 00:05:02 -05:00
Mark QgsLineStringV2 as a critical class
Now has as close to 100% unit test coverage as possible
This commit is contained in:
parent
7eb1133bc5
commit
22af16a1fb
@ -26,6 +26,13 @@
|
||||
#include <QDomDocument>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
QgsLineStringV2::QgsLineStringV2(): QgsCurveV2()
|
||||
{
|
||||
mWkbType = QgsWKBTypes::LineString;
|
||||
@ -72,6 +79,12 @@ void QgsLineStringV2::fromWkbPoints( QgsWKBTypes::Type type, const QgsConstWkbPt
|
||||
importVerticesFromWkb( wkb );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
bool QgsLineStringV2::fromWkt( const QString& wkt )
|
||||
{
|
||||
clear();
|
||||
@ -106,6 +119,12 @@ unsigned char* QgsLineStringV2::asWkb( int& binarySize ) const
|
||||
return geomPtr;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
QString QgsLineStringV2::asWkt( int precision ) const
|
||||
{
|
||||
QString wkt = wktTypeStr() + ' ';
|
||||
@ -149,6 +168,12 @@ QString QgsLineStringV2::asJSON( int precision ) const
|
||||
return "{\"type\": \"LineString\", \"coordinates\": " + QgsGeometryUtils::pointsToJSON( pts, precision ) + '}';
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
double QgsLineStringV2::length() const
|
||||
{
|
||||
double length = 0;
|
||||
@ -181,6 +206,12 @@ QgsPointV2 QgsLineStringV2::endPoint() const
|
||||
return pointN( numPoints() - 1 );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
QgsLineStringV2* QgsLineStringV2::curveToLine() const
|
||||
{
|
||||
return static_cast<QgsLineStringV2*>( clone() );
|
||||
@ -234,6 +265,12 @@ QgsPointV2 QgsLineStringV2::pointN( int i ) const
|
||||
return QgsPointV2( t, x, y, z, m );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
double QgsLineStringV2::xAt( int index ) const
|
||||
{
|
||||
if ( index >= 0 && index < mX.size() )
|
||||
@ -292,6 +329,12 @@ void QgsLineStringV2::setMAt( int index, double m )
|
||||
mM[ index ] = m;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::points( QList<QgsPointV2>& pts ) const
|
||||
{
|
||||
pts.clear();
|
||||
@ -353,6 +396,12 @@ void QgsLineStringV2::setPoints( const QList<QgsPointV2>& points )
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::append( const QgsLineStringV2* line )
|
||||
{
|
||||
if ( !line )
|
||||
@ -407,6 +456,12 @@ QgsLineStringV2* QgsLineStringV2::reversed() const
|
||||
return copy;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::draw( QPainter& p ) const
|
||||
{
|
||||
p.drawPolyline( asQPolygonF() );
|
||||
@ -446,6 +501,12 @@ QPolygonF QgsLineStringV2::asQPolygonF() const
|
||||
return points;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d )
|
||||
{
|
||||
double* zArray = mZ.data();
|
||||
@ -480,6 +541,12 @@ void QgsLineStringV2::transform( const QTransform& t )
|
||||
mBoundingBox = QgsRectangle();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
bool QgsLineStringV2::insertVertex( const QgsVertexId& position, const QgsPointV2& vertex )
|
||||
{
|
||||
if ( position.vertex < 0 || position.vertex > mX.size() )
|
||||
@ -547,6 +614,12 @@ bool QgsLineStringV2::deleteVertex( const QgsVertexId& position )
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::addVertex( const QgsPointV2& pt )
|
||||
{
|
||||
if ( mWkbType == QgsWKBTypes::Unknown || mX.isEmpty() )
|
||||
@ -607,6 +680,12 @@ double QgsLineStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmen
|
||||
return sqrDist;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
bool QgsLineStringV2::pointAt( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const
|
||||
{
|
||||
if ( node < 0 || node >= numPoints() )
|
||||
@ -656,6 +735,12 @@ QgsPointV2 QgsLineStringV2::centroid() const
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::sumUpArea( double& sum ) const
|
||||
{
|
||||
int maxIndex = numPoints() - 1;
|
||||
@ -694,6 +779,12 @@ void QgsLineStringV2::importVerticesFromWkb( const QgsConstWkbPtr& wkb )
|
||||
mBoundingBox = QgsRectangle(); //set bounding box invalid
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
void QgsLineStringV2::close()
|
||||
{
|
||||
if ( numPoints() < 1 || isClosed() )
|
||||
@ -746,6 +837,12 @@ double QgsLineStringV2::vertexAngle( const QgsVertexId& vertex ) const
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* This class is considered CRITICAL and any change MUST be accompanied with
|
||||
* full unit tests.
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
bool QgsLineStringV2::addZValue( double zValue )
|
||||
{
|
||||
if ( QgsWKBTypes::hasZ( mWkbType ) )
|
||||
|
@ -22,6 +22,12 @@
|
||||
#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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user