Skip to content

Commit

Permalink
Rename QgsPolygonV2 to QgsPolygon
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent 81586d2 commit b6f46ea
Show file tree
Hide file tree
Showing 65 changed files with 283 additions and 283 deletions.
6 changes: 3 additions & 3 deletions python/core/geometry/qgsabstractgeometry.sip
Expand Up @@ -35,8 +35,8 @@ class QgsAbstractGeometry
sipType = sipType_QgsCompoundCurve;
else if ( qgsgeometry_cast<QgsTriangle *>( sipCpp ) != nullptr )
sipType = sipType_QgsTriangle;
else if ( qgsgeometry_cast<QgsPolygonV2 *>( sipCpp ) != nullptr )
sipType = sipType_QgsPolygonV2;
else if ( qgsgeometry_cast<QgsPolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsMultiPointV2 *>( sipCpp ) != nullptr )
Expand Down Expand Up @@ -396,7 +396,7 @@ Returns the centroid of the geometry
virtual QgsAbstractGeometry *toCurveType() const = 0 /Factory/;
%Docstring
Returns the geometry converted to the more generic curve type.
E.g. QgsLineString -> QgsCompoundCurve, QgsPolygonV2 -> QgsCurvePolygon,
E.g. QgsLineString -> QgsCompoundCurve, QgsPolygon -> QgsCurvePolygon,
QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygonV2 -> QgsMultiSurface
:return: the converted geometry. Caller takes ownership
:rtype: QgsAbstractGeometry
Expand Down
6 changes: 3 additions & 3 deletions python/core/geometry/qgscurvepolygon.sip
Expand Up @@ -61,7 +61,7 @@ class QgsCurvePolygon: QgsSurface

virtual double perimeter() const;

virtual QgsPolygonV2 *surfaceToPolygon() const /Factory/;
virtual QgsPolygon *surfaceToPolygon() const /Factory/;

virtual QgsAbstractGeometry *boundary() const /Factory/;

Expand All @@ -81,13 +81,13 @@ class QgsCurvePolygon: QgsSurface
:rtype: QgsCurve
%End

virtual QgsPolygonV2 *toPolygon( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
virtual QgsPolygon *toPolygon( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
%Docstring
Returns a new polygon 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*
:rtype: QgsPolygonV2
:rtype: QgsPolygon
%End

virtual void setExteriorRing( QgsCurve *ring /Transfer/ );
Expand Down
8 changes: 4 additions & 4 deletions python/core/geometry/qgsellipse.sip
Expand Up @@ -202,11 +202,11 @@ The circumference of the ellipse using first approximation of Ramanujan.
:rtype: QgsPointSequence
%End

virtual QgsPolygonV2 *toPolygon( unsigned int segments = 36 ) const /Factory/;
virtual QgsPolygon *toPolygon( unsigned int segments = 36 ) const /Factory/;
%Docstring
Returns a segmented polygon.
\param segments Number of segments used to segment geometry.
:rtype: QgsPolygonV2
:rtype: QgsPolygon
%End

virtual QgsLineString *toLineString( unsigned int segments = 36 ) const /Factory/;
Expand All @@ -216,10 +216,10 @@ The circumference of the ellipse using first approximation of Ramanujan.
:rtype: QgsLineString
%End

virtual QgsPolygonV2 *orientedBoundingBox() const /Factory/;
virtual QgsPolygon *orientedBoundingBox() const /Factory/;
%Docstring
Returns the oriented minimal bounding box for the ellipse.
:rtype: QgsPolygonV2
:rtype: QgsPolygon
%End

virtual QgsRectangle boundingBox() const;
Expand Down
8 changes: 4 additions & 4 deletions python/core/geometry/qgspolygon.sip
Expand Up @@ -20,19 +20,19 @@ class QgsPolygonV2: QgsCurvePolygon
#include "qgspolygon.h"
%End
public:
QgsPolygonV2();
QgsPolygon();

virtual QString geometryType() const;

virtual QgsPolygonV2 *clone() const /Factory/;
virtual QgsPolygon *clone() const /Factory/;

virtual void clear();

virtual bool fromWkb( QgsConstWkbPtr &wkb );

virtual QByteArray asWkb() const;

virtual QgsPolygonV2 *surfaceToPolygon() const /Factory/;
virtual QgsPolygon *surfaceToPolygon() const /Factory/;


virtual QgsCurvePolygon *toCurveType() const /Factory/;
Expand Down Expand Up @@ -63,7 +63,7 @@ class QgsPolygonV2: QgsCurvePolygon

protected:

virtual QgsPolygonV2 *createEmptyWithSameType() const /Factory/;
virtual QgsPolygon *createEmptyWithSameType() const /Factory/;



Expand Down
4 changes: 2 additions & 2 deletions python/core/geometry/qgsregularpolygon.sip
Expand Up @@ -145,10 +145,10 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3
:rtype: QgsPointSequence
%End

QgsPolygonV2 *toPolygon() const /Factory/;
QgsPolygon *toPolygon() const /Factory/;
%Docstring
Returns as a polygon.
:rtype: QgsPolygonV2
:rtype: QgsPolygon
%End

QgsLineString *toLineString() const /Factory/;
Expand Down
4 changes: 2 additions & 2 deletions python/core/geometry/qgssurface.sip
Expand Up @@ -18,11 +18,11 @@ class QgsSurface: QgsAbstractGeometry
%End
public:

virtual QgsPolygonV2 *surfaceToPolygon() const = 0 /Factory/;
virtual QgsPolygon *surfaceToPolygon() const = 0 /Factory/;
%Docstring
Get a polygon representation of this surface.
Ownership is transferred to the caller.
:rtype: QgsPolygonV2
:rtype: QgsPolygon
%End

virtual QgsRectangle boundingBox() const;
Expand Down
2 changes: 1 addition & 1 deletion python/core/geometry/qgstriangle.sip
Expand Up @@ -68,7 +68,7 @@ class QgsTriangle : QgsPolygonV2
virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;


virtual QgsPolygonV2 *surfaceToPolygon() const /Factory/;
virtual QgsPolygon *surfaceToPolygon() const /Factory/;


virtual QgsCurvePolygon *toCurveType() const /Factory/;
Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology/qgssymbol.sip
Expand Up @@ -342,7 +342,7 @@ Generate symbol as image
:rtype: QPolygonF
%End

static void _getPolygon( QPolygonF &pts, QList<QPolygonF> &holes, QgsRenderContext &context, const QgsPolygonV2 &polygon, bool clipToExtent = true );
static void _getPolygon( QPolygonF &pts, QList<QPolygonF> &holes, QgsRenderContext &context, const QgsPolygon &polygon, bool clipToExtent = true );
%Docstring
Creates a polygon in screen coordinates from a QgsPolygonXYin map coordinates
%End
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/qgis/GeometryConvert.py
Expand Up @@ -206,22 +206,22 @@ def convertToPolygon(self, geom):
points.append(p)
linestring = QgsLineString(points)
linestring.close()
p = QgsPolygonV2()
p = QgsPolygon()
p.setExteriorRing(linestring)
return [QgsGeometry(p)]
elif QgsWkbTypes.geometryType(geom.wkbType()) == QgsWkbTypes.LineGeometry:
if QgsWkbTypes.isMultiType(geom):
parts = []
for i in range(geom.constGet().numGeometries()):
p = QgsPolygonV2()
p = QgsPolygon()
linestring = geom.constGet().geometryN(i).clone()
linestring.close()
p.setExteriorRing(linestring)
parts.append(QgsGeometry(p))
return QgsGeometry.collectGeometry(parts)
else:
# linestring to polygon
p = QgsPolygonV2()
p = QgsPolygon()
linestring = geom.constGet().clone()
linestring.close()
p.setExteriorRing(linestring)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/LinesToPolygons.py
Expand Up @@ -123,7 +123,7 @@ def getSurfaces(self, geometry):
else:
# not collection
if geometry.vertexCount() > 2:
surface = QgsPolygonV2()
surface = QgsPolygon()
surface.setExteriorRing(geometry.clone())
surfaces.append(surface)

Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgs3dutils.cpp
Expand Up @@ -113,7 +113,7 @@ void Qgs3DUtils::clampAltitudes( QgsLineString *lineString, AltitudeClamping alt
}


bool Qgs3DUtils::clampAltitudes( QgsPolygonV2 *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map )
bool Qgs3DUtils::clampAltitudes( QgsPolygon *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map )
{
if ( !polygon->is3D() )
polygon->addZValue( 0 );
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgs3dutils.h
Expand Up @@ -17,7 +17,7 @@
#define QGS3DUTILS_H

class QgsLineString;
class QgsPolygonV2;
class QgsPolygon;

#include "qgs3dmapsettings.h"
#include "qgsaabb.h"
Expand Down Expand Up @@ -67,7 +67,7 @@ class _3D_EXPORT Qgs3DUtils
//! Clamps altitude of vertices of a linestring according to the settings
static void clampAltitudes( QgsLineString *lineString, AltitudeClamping altClamp, AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map );
//! Clamps altitude of vertices of a polygon according to the settings
static bool clampAltitudes( QgsPolygonV2 *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map );
static bool clampAltitudes( QgsPolygon *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map );

//! Converts a 4x4 transform matrix to a string
static QString matrix4x4toString( const QMatrix4x4 &m );
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgstessellatedpolygongeometry.cpp
Expand Up @@ -65,15 +65,15 @@ QgsTessellatedPolygonGeometry::~QgsTessellatedPolygonGeometry()
qDeleteAll( mPolygons );
}

void QgsTessellatedPolygonGeometry::setPolygons( const QList<QgsPolygonV2 *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon )
void QgsTessellatedPolygonGeometry::setPolygons( const QList<QgsPolygon *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon )
{
qDeleteAll( mPolygons );
mPolygons = polygons;

QgsTessellator tesselator( origin.x(), origin.y(), mWithNormals );
for ( int i = 0; i < polygons.count(); ++i )
{
QgsPolygonV2 *polygon = polygons.at( i );
QgsPolygon *polygon = polygons.at( i );
float extr = extrusionHeightPerPolygon.isEmpty() ? extrusionHeight : extrusionHeightPerPolygon.at( i );
tesselator.addPolygon( *polygon, extr );
}
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgstessellatedpolygongeometry.h
Expand Up @@ -42,10 +42,10 @@ class QgsTessellatedPolygonGeometry : public Qt3DRender::QGeometry
~QgsTessellatedPolygonGeometry();

//! Initializes vertex buffer from given polygons. Takes ownership of passed polygon geometries
void setPolygons( const QList<QgsPolygonV2 *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon = QList<float>() );
void setPolygons( const QList<QgsPolygon *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon = QList<float>() );

private:
QList<QgsPolygonV2 *> mPolygons;
QList<QgsPolygon *> mPolygons;

Qt3DRender::QAttribute *mPositionAttribute = nullptr;
Qt3DRender::QAttribute *mNormalAttribute = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgstessellator.cpp
Expand Up @@ -222,7 +222,7 @@ static void _ringToPoly2tri( const QgsCurve *ring, const QgsPoint &ptFirst, cons
}
}

static bool _check_intersecting_rings( const QgsPolygonV2 &polygon )
static bool _check_intersecting_rings( const QgsPolygon &polygon )
{
// At this point we assume that input polygons are valid according to the OGC definition.
// This means e.g. no duplicate points, polygons are simple (no butterfly shaped polygon with self-intersection),
Expand Down Expand Up @@ -259,7 +259,7 @@ static bool _check_intersecting_rings( const QgsPolygonV2 &polygon )
}


void QgsTessellator::addPolygon( const QgsPolygonV2 &polygon, float extrusionHeight )
void QgsTessellator::addPolygon( const QgsPolygon &polygon, float extrusionHeight )
{
if ( !_check_intersecting_rings( polygon ) )
{
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgstessellator.h
Expand Up @@ -18,7 +18,7 @@

#include "qgis_3d.h"

class QgsPolygonV2;
class QgsPolygon;

#include <QVector>

Expand All @@ -41,7 +41,7 @@ class _3D_EXPORT QgsTessellator
QgsTessellator( double originX, double originY, bool addNormals );

//! Tessellates a triangle and adds its vertex entries to the output data array
void addPolygon( const QgsPolygonV2 &polygon, float extrusionHeight );
void addPolygon( const QgsPolygon &polygon, float extrusionHeight );

//! Returns array of triangle vertex data
QVector<float> data() const { return mData; }
Expand Down
6 changes: 3 additions & 3 deletions src/3d/symbols/qgsline3dsymbol_p.cpp
Expand Up @@ -101,7 +101,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::renderer( const Qgs3DM
QgsGeometry::JoinStyle joinStyle = QgsGeometry::JoinStyleRound;
double mitreLimit = 0;

QList<QgsPolygonV2 *> polygons;
QList<QgsPolygon *> polygons;
QgsFeature f;
QgsFeatureIterator fi = layer->getFeatures( request );
while ( fi.nextFeature( f ) )
Expand All @@ -122,7 +122,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::renderer( const Qgs3DM

if ( QgsWkbTypes::flatType( buffered->wkbType() ) == QgsWkbTypes::Polygon )
{
QgsPolygonV2 *polyBuffered = static_cast<QgsPolygonV2 *>( buffered );
QgsPolygon *polyBuffered = static_cast<QgsPolygon *>( buffered );
Qgs3DUtils::clampAltitudes( polyBuffered, symbol.altitudeClamping(), symbol.altitudeBinding(), symbol.height(), map );
polygons.append( polyBuffered );
}
Expand All @@ -133,7 +133,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::renderer( const Qgs3DM
{
QgsAbstractGeometry *partBuffered = mpolyBuffered->geometryN( i );
Q_ASSERT( QgsWkbTypes::flatType( partBuffered->wkbType() ) == QgsWkbTypes::Polygon );
QgsPolygonV2 *polyBuffered = static_cast<QgsPolygonV2 *>( partBuffered )->clone(); // need to clone individual geometry parts
QgsPolygon *polyBuffered = static_cast<QgsPolygon *>( partBuffered )->clone(); // need to clone individual geometry parts
Qgs3DUtils::clampAltitudes( polyBuffered, symbol.altitudeClamping(), symbol.altitudeBinding(), symbol.height(), map );
polygons.append( polyBuffered );
}
Expand Down
8 changes: 4 additions & 4 deletions src/3d/symbols/qgspolygon3dsymbol_p.cpp
Expand Up @@ -122,7 +122,7 @@ QgsPolygon3DSymbolEntityNode::QgsPolygon3DSymbolEntityNode( const Qgs3DMapSettin
Qt3DRender::QGeometryRenderer *QgsPolygon3DSymbolEntityNode::renderer( const Qgs3DMapSettings &map, const QgsPolygon3DSymbol &symbol, const QgsVectorLayer *layer, const QgsFeatureRequest &request )
{
QgsPointXY origin( map.originX(), map.originY() );
QList<QgsPolygonV2 *> polygons;
QList<QgsPolygon *> polygons;
QList<float> extrusionHeightPerPolygon; // will stay empty if not needed per polygon

QgsExpressionContext ctx( _expressionContext3D() );
Expand Down Expand Up @@ -155,9 +155,9 @@ Qt3DRender::QGeometryRenderer *QgsPolygon3DSymbolEntityNode::renderer( const Qgs
if ( hasDDExtrusion )
extrusionHeight = ddp.valueAsDouble( QgsAbstract3DSymbol::PropertyExtrusionHeight, ctx, extrusionHeight );

if ( const QgsPolygonV2 *poly = qgsgeometry_cast< const QgsPolygonV2 *>( g ) )
if ( const QgsPolygon *poly = qgsgeometry_cast< const QgsPolygon *>( g ) )
{
QgsPolygonV2 *polyClone = poly->clone();
QgsPolygon *polyClone = poly->clone();
Qgs3DUtils::clampAltitudes( polyClone, symbol.altitudeClamping(), symbol.altitudeBinding(), height, map );
polygons.append( polyClone );
if ( hasDDExtrusion )
Expand All @@ -169,7 +169,7 @@ Qt3DRender::QGeometryRenderer *QgsPolygon3DSymbolEntityNode::renderer( const Qgs
{
const QgsAbstractGeometry *g2 = mpoly->geometryN( i );
Q_ASSERT( QgsWkbTypes::flatType( g2->wkbType() ) == QgsWkbTypes::Polygon );
QgsPolygonV2 *polyClone = static_cast< const QgsPolygonV2 *>( g2 )->clone();
QgsPolygon *polyClone = static_cast< const QgsPolygon *>( g2 )->clone();
Qgs3DUtils::clampAltitudes( polyClone, symbol.altitudeClamping(), symbol.altitudeBinding(), height, map );
polygons.append( polyClone );
if ( hasDDExtrusion )
Expand Down
Expand Up @@ -197,7 +197,7 @@ namespace QgsGeometryCheckerUtils
return geom;
}

QList<const QgsLineString *> polygonRings( const QgsPolygonV2 *polygon )
QList<const QgsLineString *> polygonRings( const QgsPolygon *polygon )
{
QList<const QgsLineString *> rings;
if ( const QgsLineString *exterior = dynamic_cast<const QgsLineString *>( polygon->exteriorRing() ) )
Expand Down
Expand Up @@ -100,7 +100,7 @@ namespace QgsGeometryCheckerUtils
QgsAbstractGeometry *getGeomPart( QgsAbstractGeometry *geom, int partIdx );
const QgsAbstractGeometry *getGeomPart( const QgsAbstractGeometry *geom, int partIdx );

QList<const QgsLineString *> polygonRings( const QgsPolygonV2 *polygon );
QList<const QgsLineString *> polygonRings( const QgsPolygon *polygon );

void filter1DTypes( QgsAbstractGeometry *geom );

Expand Down
Expand Up @@ -50,7 +50,7 @@ void QgsGeometryLineLayerIntersectionCheck::collectErrors( QList<QgsGeometryChec
errors.append( new QgsGeometryCheckError( this, layerFeature, inter, QgsVertexId( iPart ), checkFeature.id() ) );
}
}
else if ( const QgsPolygonV2 *polygon = dynamic_cast<const QgsPolygonV2 *>( part ) )
else if ( const QgsPolygon *polygon = dynamic_cast<const QgsPolygon *>( part ) )
{
for ( const QgsLineString *ring : QgsGeometryCheckerUtils::polygonRings( polygon ) )
{
Expand Down
Expand Up @@ -197,7 +197,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i
poly->setExteriorRing( ringGeom1 );

// If original feature was a linear polygon, also create the new part as a linear polygon
QgsCurvePolygon *poly2 = dynamic_cast<QgsPolygonV2 *>( part ) ? new QgsPolygonV2() : new QgsCurvePolygon();
QgsCurvePolygon *poly2 = dynamic_cast<QgsPolygon *>( part ) ? new QgsPolygon() : new QgsCurvePolygon();
poly2->setExteriorRing( ringGeom2 );

// Reassing interiors as necessary
Expand Down
6 changes: 3 additions & 3 deletions src/app/dwg/qgsdwgimporter.cpp
Expand Up @@ -1556,7 +1556,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
QgsVector vs( v * 0.5 * staWidth );
QgsVector ve( v * 0.5 * endWidth );

QgsPolygonV2 poly;
QgsPolygon poly;
QgsLineString *ls = new QgsLineString();
ls->setPoints( QgsPointSequence()
<< QgsPoint( ps + vs )
Expand Down Expand Up @@ -1758,7 +1758,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
QgsVector vs( v * 0.5 * staWidth );
QgsVector ve( v * 0.5 * endWidth );

QgsPolygonV2 poly;
QgsPolygon poly;
QgsLineString *ls = new QgsLineString();
QgsPointSequence s;
s << QgsPoint( ps + vs );
Expand Down Expand Up @@ -2143,7 +2143,7 @@ void QgsDwgImporter::addSolid( const DRW_Solid &data )
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
setString( dfn, f, QStringLiteral( "hpattern" ), "SOLID" );

QgsPolygonV2 poly;
QgsPolygon poly;

// pt1 pt2
// pt3 pt4
Expand Down

0 comments on commit b6f46ea

Please sign in to comment.