Removed unused QgsFeature::typeName() and QgsFeature::setTypeName()

This commit is contained in:
Martin Dobias 2012-10-13 13:06:57 +02:00
parent f217a7fb19
commit eb6d4d384d
11 changed files with 17 additions and 64 deletions

View File

@ -87,7 +87,7 @@ class QgsFeature
%End
//! Constructor
QgsFeature( qint64 id = 0, QString typeName = "" );
QgsFeature( qint64 id = 0 );
/** copy ctor needed due to internal pointer */
QgsFeature( const QgsFeature & rhs );
@ -107,16 +107,6 @@ class QgsFeature
*/
void setFeatureId( qint64 id );
/** returns the feature's type name
*/
QString typeName() const;
/** sets the feature's type name
*/
void setTypeName( QString typeName );
/**
* Get the attributes for this feature.
* @return A std::map containing the field name/value mapping

View File

@ -802,7 +802,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )
//
if ( layerWKBType == QGis::WKBPoint )
{
QgsFeature* f = new QgsFeature( 0, "WKBPoint" );
QgsFeature* f = new QgsFeature( 0 );
int size = 0;
char end = QgsApplication::endian();
@ -850,7 +850,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )
mNmea->disconnect( this, SLOT( displayGPSInformation( const QgsGPSInformation& ) ) );
//create QgsFeature with wkb representation
QgsFeature* f = new QgsFeature( 0, "WKBLineString" );
QgsFeature* f = new QgsFeature( 0 );
unsigned char* wkb;
int size;
char end = QgsApplication::endian();

View File

@ -116,7 +116,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
//grass provider has its own mechanism of feature addition
if ( provider->capabilities() & QgsVectorDataProvider::AddFeatures )
{
QgsFeature* f = new QgsFeature( 0, "WKBPoint" );
QgsFeature* f = new QgsFeature( 0 );
QgsGeometry *g = 0;
if ( layerWKBType == QGis::WKBPoint || layerWKBType == QGis::WKBPoint25D )
@ -201,7 +201,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
}
//create QgsFeature with wkb representation
QgsFeature* f = new QgsFeature( 0, "WKBLineString" );
QgsFeature* f = new QgsFeature( 0 );
QgsGeometry *g;

View File

@ -22,13 +22,12 @@ email : sherman at mrcc.com
* \brief Encapsulates a spatial feature with attributes
*/
QgsFeature::QgsFeature( QgsFeatureId id, QString typeName )
QgsFeature::QgsFeature( QgsFeatureId id )
: mFid( id )
, mGeometry( 0 )
, mOwnsGeometry( 0 )
, mValid( false )
, mDirty( 0 )
, mTypeName( typeName )
, mFields( 0 )
{
// NOOP
@ -41,7 +40,6 @@ QgsFeature::QgsFeature( QgsFeature const & rhs )
, mOwnsGeometry( false )
, mValid( rhs.mValid )
, mDirty( rhs.mDirty )
, mTypeName( rhs.mTypeName )
, mFields( rhs.mFields )
{
@ -62,7 +60,6 @@ QgsFeature & QgsFeature::operator=( QgsFeature const & rhs )
mDirty = rhs.mDirty;
mAttributes = rhs.mAttributes;
mValid = rhs.mValid;
mTypeName = rhs.mTypeName;
mFields = rhs.mFields;
// make sure to delete the old geometry (if exists)
@ -160,21 +157,6 @@ void QgsFeature::setFeatureId( QgsFeatureId id )
}
QString QgsFeature::typeName() const
{
return mTypeName;
} // QgsFeature::typeName
/** sets the feature's type name
*/
void QgsFeature::setTypeName( QString typeName )
{
mTypeName = typeName;
} // QgsFeature::typeName
void QgsFeature::setGeometry( const QgsGeometry& geom )
{
setGeometry( new QgsGeometry( geom ) );

View File

@ -107,7 +107,7 @@ class CORE_EXPORT QgsFeature
{
public:
//! Constructor
QgsFeature( QgsFeatureId id = QgsFeatureId(), QString typeName = "" );
QgsFeature( QgsFeatureId id = QgsFeatureId() );
/** copy ctor needed due to internal pointer */
QgsFeature( const QgsFeature & rhs );
@ -130,16 +130,6 @@ class CORE_EXPORT QgsFeature
*/
void setFeatureId( QgsFeatureId id );
/** returns the feature's type name
*/
QString typeName() const;
/** sets the feature's type name
*/
void setTypeName( QString typeName );
/**
* Get the attributes for this feature.
* @return A std::map containing the field name/value mapping
@ -285,9 +275,6 @@ class CORE_EXPORT QgsFeature
// TODO: still applies? [MD]
bool mDirty;
/// feature type name
QString mTypeName;
//! Optional field map for name-based attribute lookups
const QgsFieldMap* mFields;

View File

@ -675,8 +675,8 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
delete ct;
delete writer;
QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
.arg( fet.typeName() ).arg( e.what() );
QString msg = QObject::tr( "Failed to transform a point while drawing a feature with ID '%1'. Writing stopped. (Exception: %2)" )
.arg( fet.id() ).arg( e.what() );
QgsLogger::warning( msg );
if ( errorMessage )
*errorMessage = msg;

View File

@ -783,8 +783,8 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
catch ( const QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
.arg( fet.typeName() ).arg( cse.what() ) );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
.arg( fet.id() ).arg( cse.what() ) );
}
#ifndef Q_WS_MAC
++featureCount;
@ -933,8 +933,8 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo
catch ( const QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
.arg( fet.typeName() ).arg( cse.what() ) );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
.arg( fet.id() ).arg( cse.what() ) );
}
#ifndef Q_WS_MAC
++featureCount;
@ -1124,8 +1124,8 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Rendering stopped. %2" )
.arg( fet.typeName() ).arg( cse.what() ) );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Rendering stopped. %2" )
.arg( fet.id() ).arg( cse.what() ) );
return false;
}

View File

@ -292,8 +292,8 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
delete ct;
delete writer;
QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
.arg( fet.typeName() ).arg( e.what() );
QString msg = QObject::tr( "Failed to transform a point while drawing a feature with ID '%1'. Writing stopped. (Exception: %2)" )
.arg( fet.id() ).arg( e.what() );
QgsMessageLog::logMessage( msg, QObject::tr( "Vector import" ) );
if ( errorMessage )
*errorMessage += "\n" + msg;

View File

@ -114,7 +114,6 @@ void Regression1141::diacriticalTest()
// delete it in its dtor!
QgsGeometry * mypPointGeometry = QgsGeometry::fromPoint( myPoint );
QgsFeature myFeature;
myFeature.setTypeName( "WKBPoint" );
myFeature.setGeometry( mypPointGeometry );
myFeature.addAttribute( 0, 10 );
//

View File

@ -130,7 +130,6 @@ void TestQgsMapRenderer::initTestCase()
// delete it in its dtor!
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
QgsFeature myFeature;
myFeature.setTypeName( "WKBPolygon" );
myFeature.setGeometry( mypPolygonGeometry );
myFeature.addAttribute( 0, i );
//

View File

@ -176,7 +176,6 @@ void TestQgsVectorFileWriter::createLine()
// delete it in its dtor!
QgsGeometry * mypLineGeometry = QgsGeometry::fromPolyline( myPolyline );
QgsFeature myFeature;
myFeature.setTypeName( "WKBLineString" );
myFeature.setGeometry( mypLineGeometry );
myFeature.addAttribute( 0, "HelloWorld" );
//
@ -229,7 +228,6 @@ void TestQgsVectorFileWriter::createPolygon()
// delete it in its dtor!
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
QgsFeature myFeature;
myFeature.setTypeName( "WKBPolygon" );
myFeature.setGeometry( mypPolygonGeometry );
myFeature.addAttribute( 0, "HelloWorld" );
//
@ -289,7 +287,6 @@ void TestQgsVectorFileWriter::polygonGridTest()
// delete it in its dtor!
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
QgsFeature myFeature;
myFeature.setTypeName( "WKBPolygon" );
myFeature.setGeometry( mypPolygonGeometry );
myFeature.addAttribute( 0, "HelloWorld" );
//
@ -362,7 +359,6 @@ void TestQgsVectorFileWriter::projectedPlygonGridTest()
// delete it in its dtor!
QgsGeometry * mypPolygonGeometry = QgsGeometry::fromPolygon( myPolygon );
QgsFeature myFeature;
myFeature.setTypeName( "WKBPolygon" );
myFeature.setGeometry( mypPolygonGeometry );
myFeature.addAttribute( 0, "HelloWorld" );
//