38 changes: 0 additions & 38 deletions src/core/qgsvectorlayerfeatureiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,42 +116,4 @@ class CORE_EXPORT QgsVectorLayerFeatureIterator : public QgsAbstractFeatureItera
QMap<QgsVectorLayer*, FetchJoinInfo> mFetchJoinInfo;
};

/***************************************************************************
QgsSimplifiedVectorLayerFeatureIterator class
----------------------
begin : December 2013
copyright : (C) 2013 by Alvaro Huarte
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

#include "qgsgeometrysimplifier.h"

//! Provides a specialized VectorLayerFeatureIterator for enable simplification of the geometries fetched
class CORE_EXPORT QgsSimplifiedVectorLayerFeatureIterator : public QgsVectorLayerFeatureIterator
{
public:
QgsSimplifiedVectorLayerFeatureIterator( QgsVectorLayer* layer, const QgsFeatureRequest& request, QgsAbstractGeometrySimplifier* simplifier );
~QgsSimplifiedVectorLayerFeatureIterator( );

protected:
//! fetch next feature, return true on success
virtual bool fetchFeature( QgsFeature& feature );

private:
//! Related geometry simplifier
QgsAbstractGeometrySimplifier* mSimplifier;
//! Indicates the related vector provider supports simplify the geometries before fecth the feature
bool mSupportsPresimplify;
};

/***************************************************************************/

#endif // QGSVECTORLAYERFEATUREITERATOR_H
2 changes: 1 addition & 1 deletion src/providers/ogr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

SET (OGR_SRCS qgsogrprovider.cpp qgsogrdataitems.cpp qgsogrfeatureiterator.cpp qgsogrmaptopixelgeometrysimplifier.cpp)
SET (OGR_SRCS qgsogrprovider.cpp qgsogrdataitems.cpp qgsogrfeatureiterator.cpp)

SET(OGR_MOC_HDRS qgsogrprovider.h qgsogrdataitems.h)

Expand Down
60 changes: 0 additions & 60 deletions src/providers/ogr/qgsogrfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )

if ( geom )
{
fetchedFeature( fet, geom );

// get the wkb representation
int memorySize = OGR_G_WkbSize( geom );
unsigned char *wkb = new unsigned char[memorySize];
Expand Down Expand Up @@ -276,61 +274,3 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )

return true;
}

//! Notified a new OGRFeatureH fecthed from data provider
void QgsOgrFeatureIterator::fetchedFeature( OGRFeatureH feature, OGRGeometryH geometry )
{
Q_UNUSED( feature );
Q_UNUSED( geometry );
}

/***************************************************************************
QgsOgrSimplifiedFeatureIterator class
----------------------
begin : December 2013
copyright : (C) 2013 by Alvaro Huarte
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

//! Provides a specialized FeatureIterator for enable simplification of the geometries
QgsOgrSimplifiedFeatureIterator::QgsOgrSimplifiedFeatureIterator( QgsOgrProvider* p, const QgsFeatureRequest& request )
: QgsOgrFeatureIterator( p, request )
, mSimplifier( NULL )
{
QgsFeatureRequest::Flags requestFlags = request.flags();

int simplifyFlags = QgsMapToPixelSimplifier::NoFlags;
if ( requestFlags & QgsFeatureRequest::SimplifyGeometry ) simplifyFlags |= QgsMapToPixelSimplifier::SimplifyGeometry;
if ( requestFlags & QgsFeatureRequest::SimplifyEnvelope ) simplifyFlags |= QgsMapToPixelSimplifier::SimplifyEnvelope;

if ( simplifyFlags != QgsMapToPixelSimplifier::NoFlags )
{
mSimplifier = new QgsOgrMapToPixelSimplifier( simplifyFlags, request.coordinateTransform(), request.mapToPixel(), request.mapToPixelTol() );
}
}
QgsOgrSimplifiedFeatureIterator::~QgsOgrSimplifiedFeatureIterator( )
{
if ( mSimplifier )
{
delete mSimplifier;
mSimplifier = NULL;
}
}

//! Notified a new OGRFeatureH fecthed from data provider
void QgsOgrSimplifiedFeatureIterator::fetchedFeature( OGRFeatureH feature, OGRGeometryH geometry )
{
if ( mSimplifier && ( mSimplifier->simplifyFlags() & ( QgsMapToPixelSimplifier::SimplifyGeometry | QgsMapToPixelSimplifier::SimplifyEnvelope ) ) )
{
mSimplifier->simplifyGeometry(( OGRGeometry* ) geometry );
}
QgsOgrFeatureIterator::fetchedFeature( feature, geometry );
}
40 changes: 0 additions & 40 deletions src/providers/ogr/qgsogrfeatureiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class QgsOgrFeatureIterator : public QgsAbstractFeatureIterator
//! Get an attribute associated with a feature
void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature & f, int attindex );

//! Notified a new OGRFeatureH fecthed from data provider
virtual void fetchedFeature( OGRFeatureH feature, OGRGeometryH geometry );

bool mFeatureFetched;

OGRDataSourceH ogrDataSource;
Expand All @@ -61,41 +58,4 @@ class QgsOgrFeatureIterator : public QgsAbstractFeatureIterator
bool mFetchGeometry;
};

/***************************************************************************
QgsOgrSimplifiedFeatureIterator class
----------------------
begin : December 2013
copyright : (C) 2013 by Alvaro Huarte
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

#include "qgsogrmaptopixelgeometrysimplifier.h"

class OGRRawPoint;
class OGRGeometry;

//! Provides a specialized FeatureIterator for enable simplification of the geometries fetched
class QgsOgrSimplifiedFeatureIterator : public QgsOgrFeatureIterator
{
public:
QgsOgrSimplifiedFeatureIterator( QgsOgrProvider* p, const QgsFeatureRequest& request );
~QgsOgrSimplifiedFeatureIterator( );

protected:
//! Notified a new OGRFeatureH fecthed from data provider
virtual void fetchedFeature( OGRFeatureH feature, OGRGeometryH geometry );

private:
//! Related geometry simplifier
QgsOgrMapToPixelSimplifier* mSimplifier;
};

#endif // QGSOGRFEATUREITERATOR_H
201 changes: 0 additions & 201 deletions src/providers/ogr/qgsogrmaptopixelgeometrysimplifier.cpp

This file was deleted.

54 changes: 0 additions & 54 deletions src/providers/ogr/qgsogrmaptopixelgeometrysimplifier.h

This file was deleted.

6 changes: 0 additions & 6 deletions src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,6 @@ void QgsOgrProvider::setRelevantFields( OGRLayerH ogrLayer, bool fetchGeometry,

QgsFeatureIterator QgsOgrProvider::getFeatures( const QgsFeatureRequest& request )
{
if ( request.flags() & ( QgsFeatureRequest::SimplifyGeometry | QgsFeatureRequest::SimplifyEnvelope ) )
return QgsFeatureIterator( new QgsOgrSimplifiedFeatureIterator( this, request ) );

return QgsFeatureIterator( new QgsOgrFeatureIterator( this, request ) );
}

Expand Down Expand Up @@ -1496,9 +1493,6 @@ int QgsOgrProvider::capabilities() const
ability &= ~( AddAttributes | DeleteFeatures );
}
}

// By default, supports simplification of geometries before fetch the OGR-feature.
ability |= SimplifyGeometries;
}

return ability;
Expand Down