Skip to content

Commit eb6d4d3

Browse files
committed
Removed unused QgsFeature::typeName() and QgsFeature::setTypeName()
1 parent f217a7f commit eb6d4d3

11 files changed

+17
-64
lines changed

python/core/qgsfeature.sip

+1-11
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class QgsFeature
8787
%End
8888

8989
//! Constructor
90-
QgsFeature( qint64 id = 0, QString typeName = "" );
90+
QgsFeature( qint64 id = 0 );
9191

9292
/** copy ctor needed due to internal pointer */
9393
QgsFeature( const QgsFeature & rhs );
@@ -107,16 +107,6 @@ class QgsFeature
107107
*/
108108
void setFeatureId( qint64 id );
109109

110-
111-
/** returns the feature's type name
112-
*/
113-
QString typeName() const;
114-
115-
116-
/** sets the feature's type name
117-
*/
118-
void setTypeName( QString typeName );
119-
120110
/**
121111
* Get the attributes for this feature.
122112
* @return A std::map containing the field name/value mapping

src/app/gps/qgsgpsinformationwidget.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )
802802
//
803803
if ( layerWKBType == QGis::WKBPoint )
804804
{
805-
QgsFeature* f = new QgsFeature( 0, "WKBPoint" );
805+
QgsFeature* f = new QgsFeature( 0 );
806806

807807
int size = 0;
808808
char end = QgsApplication::endian();
@@ -850,7 +850,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )
850850
mNmea->disconnect( this, SLOT( displayGPSInformation( const QgsGPSInformation& ) ) );
851851

852852
//create QgsFeature with wkb representation
853-
QgsFeature* f = new QgsFeature( 0, "WKBLineString" );
853+
QgsFeature* f = new QgsFeature( 0 );
854854
unsigned char* wkb;
855855
int size;
856856
char end = QgsApplication::endian();

src/app/qgsmaptooladdfeature.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
116116
//grass provider has its own mechanism of feature addition
117117
if ( provider->capabilities() & QgsVectorDataProvider::AddFeatures )
118118
{
119-
QgsFeature* f = new QgsFeature( 0, "WKBPoint" );
119+
QgsFeature* f = new QgsFeature( 0 );
120120

121121
QgsGeometry *g = 0;
122122
if ( layerWKBType == QGis::WKBPoint || layerWKBType == QGis::WKBPoint25D )
@@ -201,7 +201,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
201201
}
202202

203203
//create QgsFeature with wkb representation
204-
QgsFeature* f = new QgsFeature( 0, "WKBLineString" );
204+
QgsFeature* f = new QgsFeature( 0 );
205205

206206
QgsGeometry *g;
207207

src/core/qgsfeature.cpp

+1-19
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ email : sherman at mrcc.com
2222
* \brief Encapsulates a spatial feature with attributes
2323
*/
2424

25-
QgsFeature::QgsFeature( QgsFeatureId id, QString typeName )
25+
QgsFeature::QgsFeature( QgsFeatureId id )
2626
: mFid( id )
2727
, mGeometry( 0 )
2828
, mOwnsGeometry( 0 )
2929
, mValid( false )
3030
, mDirty( 0 )
31-
, mTypeName( typeName )
3231
, mFields( 0 )
3332
{
3433
// NOOP
@@ -41,7 +40,6 @@ QgsFeature::QgsFeature( QgsFeature const & rhs )
4140
, mOwnsGeometry( false )
4241
, mValid( rhs.mValid )
4342
, mDirty( rhs.mDirty )
44-
, mTypeName( rhs.mTypeName )
4543
, mFields( rhs.mFields )
4644
{
4745

@@ -62,7 +60,6 @@ QgsFeature & QgsFeature::operator=( QgsFeature const & rhs )
6260
mDirty = rhs.mDirty;
6361
mAttributes = rhs.mAttributes;
6462
mValid = rhs.mValid;
65-
mTypeName = rhs.mTypeName;
6663
mFields = rhs.mFields;
6764

6865
// make sure to delete the old geometry (if exists)
@@ -160,21 +157,6 @@ void QgsFeature::setFeatureId( QgsFeatureId id )
160157
}
161158

162159

163-
QString QgsFeature::typeName() const
164-
{
165-
return mTypeName;
166-
} // QgsFeature::typeName
167-
168-
169-
170-
/** sets the feature's type name
171-
*/
172-
void QgsFeature::setTypeName( QString typeName )
173-
{
174-
mTypeName = typeName;
175-
} // QgsFeature::typeName
176-
177-
178160
void QgsFeature::setGeometry( const QgsGeometry& geom )
179161
{
180162
setGeometry( new QgsGeometry( geom ) );

src/core/qgsfeature.h

+1-14
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class CORE_EXPORT QgsFeature
107107
{
108108
public:
109109
//! Constructor
110-
QgsFeature( QgsFeatureId id = QgsFeatureId(), QString typeName = "" );
110+
QgsFeature( QgsFeatureId id = QgsFeatureId() );
111111

112112
/** copy ctor needed due to internal pointer */
113113
QgsFeature( const QgsFeature & rhs );
@@ -130,16 +130,6 @@ class CORE_EXPORT QgsFeature
130130
*/
131131
void setFeatureId( QgsFeatureId id );
132132

133-
134-
/** returns the feature's type name
135-
*/
136-
QString typeName() const;
137-
138-
139-
/** sets the feature's type name
140-
*/
141-
void setTypeName( QString typeName );
142-
143133
/**
144134
* Get the attributes for this feature.
145135
* @return A std::map containing the field name/value mapping
@@ -285,9 +275,6 @@ class CORE_EXPORT QgsFeature
285275
// TODO: still applies? [MD]
286276
bool mDirty;
287277

288-
/// feature type name
289-
QString mTypeName;
290-
291278
//! Optional field map for name-based attribute lookups
292279
const QgsFieldMap* mFields;
293280

src/core/qgsvectorfilewriter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
675675
delete ct;
676676
delete writer;
677677

678-
QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
679-
.arg( fet.typeName() ).arg( e.what() );
678+
QString msg = QObject::tr( "Failed to transform a point while drawing a feature with ID '%1'. Writing stopped. (Exception: %2)" )
679+
.arg( fet.id() ).arg( e.what() );
680680
QgsLogger::warning( msg );
681681
if ( errorMessage )
682682
*errorMessage = msg;

src/core/qgsvectorlayer.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
783783
catch ( const QgsCsException &cse )
784784
{
785785
Q_UNUSED( cse );
786-
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
787-
.arg( fet.typeName() ).arg( cse.what() ) );
786+
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
787+
.arg( fet.id() ).arg( cse.what() ) );
788788
}
789789
#ifndef Q_WS_MAC
790790
++featureCount;
@@ -933,8 +933,8 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo
933933
catch ( const QgsCsException &cse )
934934
{
935935
Q_UNUSED( cse );
936-
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
937-
.arg( fet.typeName() ).arg( cse.what() ) );
936+
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
937+
.arg( fet.id() ).arg( cse.what() ) );
938938
}
939939
#ifndef Q_WS_MAC
940940
++featureCount;
@@ -1124,8 +1124,8 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
11241124
catch ( QgsCsException &cse )
11251125
{
11261126
Q_UNUSED( cse );
1127-
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Rendering stopped. %2" )
1128-
.arg( fet.typeName() ).arg( cse.what() ) );
1127+
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Rendering stopped. %2" )
1128+
.arg( fet.id() ).arg( cse.what() ) );
11291129
return false;
11301130
}
11311131

src/core/qgsvectorlayerimport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
292292
delete ct;
293293
delete writer;
294294

295-
QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
296-
.arg( fet.typeName() ).arg( e.what() );
295+
QString msg = QObject::tr( "Failed to transform a point while drawing a feature with ID '%1'. Writing stopped. (Exception: %2)" )
296+
.arg( fet.id() ).arg( e.what() );
297297
QgsMessageLog::logMessage( msg, QObject::tr( "Vector import" ) );
298298
if ( errorMessage )
299299
*errorMessage += "\n" + msg;

tests/src/core/regression1141.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ void Regression1141::diacriticalTest()
114114
// delete it in its dtor!
115115
QgsGeometry * mypPointGeometry = QgsGeometry::fromPoint( myPoint );
116116
QgsFeature myFeature;
117-
myFeature.setTypeName( "WKBPoint" );
118117
myFeature.setGeometry( mypPointGeometry );
119118
myFeature.addAttribute( 0, 10 );
120119
//

tests/src/core/testqgsmaprenderer.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ void TestQgsMapRenderer::initTestCase()
130130
// delete it in its dtor!
131131
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
132132
QgsFeature myFeature;
133-
myFeature.setTypeName( "WKBPolygon" );
134133
myFeature.setGeometry( mypPolygonGeometry );
135134
myFeature.addAttribute( 0, i );
136135
//

tests/src/core/testqgsvectorfilewriter.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ void TestQgsVectorFileWriter::createLine()
176176
// delete it in its dtor!
177177
QgsGeometry * mypLineGeometry = QgsGeometry::fromPolyline( myPolyline );
178178
QgsFeature myFeature;
179-
myFeature.setTypeName( "WKBLineString" );
180179
myFeature.setGeometry( mypLineGeometry );
181180
myFeature.addAttribute( 0, "HelloWorld" );
182181
//
@@ -229,7 +228,6 @@ void TestQgsVectorFileWriter::createPolygon()
229228
// delete it in its dtor!
230229
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
231230
QgsFeature myFeature;
232-
myFeature.setTypeName( "WKBPolygon" );
233231
myFeature.setGeometry( mypPolygonGeometry );
234232
myFeature.addAttribute( 0, "HelloWorld" );
235233
//
@@ -289,7 +287,6 @@ void TestQgsVectorFileWriter::polygonGridTest()
289287
// delete it in its dtor!
290288
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
291289
QgsFeature myFeature;
292-
myFeature.setTypeName( "WKBPolygon" );
293290
myFeature.setGeometry( mypPolygonGeometry );
294291
myFeature.addAttribute( 0, "HelloWorld" );
295292
//
@@ -362,7 +359,6 @@ void TestQgsVectorFileWriter::projectedPlygonGridTest()
362359
// delete it in its dtor!
363360
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
364361
QgsFeature myFeature;
365-
myFeature.setTypeName( "WKBPolygon" );
366362
myFeature.setGeometry( mypPolygonGeometry );
367363
myFeature.addAttribute( 0, "HelloWorld" );
368364
//

0 commit comments

Comments
 (0)