mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
- when creating geometry from WKT, upgrade dimensionality of geometry if coordinates are 3/4 dimensional - match dimensionality of collections to child dimensionality - fix area of curves was non-zero if curve is closed - don't consider m values when testing for curve closedness - add unit tests for closedness - add unit tests for CircularStrings, CompoundCurves, CurvePolygon, tests with geometries with Z/M values
99 lines
3.4 KiB
C++
99 lines
3.4 KiB
C++
/***************************************************************************
|
|
qgscurvev2.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 QGSCURVEV2_H
|
|
#define QGSCURVEV2_H
|
|
|
|
#include "qgsabstractgeometryv2.h"
|
|
#include "qgspointv2.h"
|
|
|
|
class QgsLineStringV2;
|
|
class QPainterPath;
|
|
|
|
/** \ingroup core
|
|
* \class QgsCurveV2
|
|
* \brief Abstract base class for curved geometry type
|
|
* \note added in QGIS 2.10
|
|
*/
|
|
class CORE_EXPORT QgsCurveV2: public QgsAbstractGeometryV2
|
|
{
|
|
public:
|
|
QgsCurveV2();
|
|
virtual ~QgsCurveV2();
|
|
|
|
/** Returns the starting point of the curve.
|
|
* @see endPoint
|
|
*/
|
|
virtual QgsPointV2 startPoint() const = 0;
|
|
|
|
/** Returns the end point of the curve.
|
|
* @see startPoint
|
|
*/
|
|
virtual QgsPointV2 endPoint() const = 0;
|
|
|
|
/** Returns true if the curve is closed.
|
|
*/
|
|
virtual bool isClosed() const;
|
|
|
|
/** Returns true if the curve is a ring.
|
|
*/
|
|
virtual bool isRing() const;
|
|
|
|
/** Returns a new line string geometry corresponding to a segmentized approximation
|
|
* of the curve.
|
|
*/
|
|
virtual QgsLineStringV2* curveToLine() const = 0;
|
|
|
|
/** Adds a curve to a painter path.
|
|
*/
|
|
virtual void addToPainterPath( QPainterPath& path ) const = 0;
|
|
|
|
/** Draws the curve as a polygon on the specified QPainter.
|
|
* @param p destination QPainter
|
|
*/
|
|
virtual void drawAsPolygon( QPainter& p ) const = 0;
|
|
|
|
/** Returns a list of points within the curve.
|
|
*/
|
|
virtual void points( QList<QgsPointV2>& pt ) const = 0;
|
|
|
|
/** Returns the number of points in the curve.
|
|
*/
|
|
virtual int numPoints() const = 0;
|
|
|
|
/** Calculates the area of the curve. Derived classes should override this
|
|
* to return the correct area of the curve.
|
|
*/
|
|
virtual void sumUpArea( double& sum ) const = 0;
|
|
|
|
virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord ) const override;
|
|
virtual bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const override;
|
|
|
|
/** Returns the point and vertex id of a point within the curve.
|
|
*/
|
|
virtual bool pointAt( int i, QgsPointV2& vertex, QgsVertexId::VertexType& type ) const = 0;
|
|
|
|
QgsAbstractGeometryV2* segmentize() const override;
|
|
|
|
virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const override { return numPoints(); }
|
|
virtual int ringCount( int /*part*/ = 0 ) const override { return numPoints() > 0 ? 1 : 0; }
|
|
virtual int partCount() const override { return numPoints() > 0 ? 1 : 0; }
|
|
virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const override;
|
|
};
|
|
|
|
#endif // QGSCURVEV2_H
|