Skip to content
Permalink
Browse files

Merge pull request #1717 from manisandro/int_ogrwkbgeometrytype

Store result of OGR_FD_GetGeomType into a OGRwkbGeometryType, not in an int, ...
  • Loading branch information
jef-n committed Dec 2, 2014
2 parents d034a66 + 81895f9 commit 327f3e9c7306c9c36f0134ea4b3e5ba03e8dad2e
@@ -650,7 +650,7 @@ bool QgsVectorLayer::hasGeometryType() const

QGis::WkbType QgsVectorLayer::wkbType() const
{
return ( QGis::WkbType )( mWkbType );
return mWkbType;
}

QgsRectangle QgsVectorLayer::boundingBoxOfSelected()
@@ -2143,7 +2143,7 @@ bool QgsVectorLayer::deleteAttributes( QList<int> attrs )

qSort( attrs.begin(), attrs.end(), qGreater<int>() );

Q_FOREACH ( int attr, attrs )
Q_FOREACH( int attr, attrs )
{
if ( deleteAttribute( attr ) )
{
@@ -2839,7 +2839,7 @@ void QgsVectorLayer::uniqueValues( int index, QList<QVariant> &uniqueValues, int
if ( mEditBuffer )
{
QSet<QString> vals;
Q_FOREACH ( const QVariant& v, uniqueValues )
Q_FOREACH( const QVariant& v, uniqueValues )
{
vals << v.toString();
}
@@ -3565,13 +3565,13 @@ void QgsVectorLayer::invalidateSymbolCountedFlag()

void QgsVectorLayer::onRelationsLoaded()
{
Q_FOREACH ( QgsAttributeEditorElement* elem, mAttributeEditorElements )
Q_FOREACH( QgsAttributeEditorElement* elem, mAttributeEditorElements )
{
if ( elem->type() == QgsAttributeEditorElement::AeTypeContainer )
{
QgsAttributeEditorContainer* cont = dynamic_cast< QgsAttributeEditorContainer* >( elem );
QList<QgsAttributeEditorElement*> relations = cont->findElements( QgsAttributeEditorElement::AeTypeRelation );
Q_FOREACH ( QgsAttributeEditorElement* relElem, relations )
Q_FOREACH( QgsAttributeEditorElement* relElem, relations )
{
QgsAttributeEditorRelation* rel = dynamic_cast< QgsAttributeEditorRelation* >( relElem );
rel->init( QgsProject::instance()->relationManager() );
@@ -3627,7 +3627,7 @@ QDomElement QgsAttributeEditorContainer::toDomElement( QDomDocument& doc ) const
QDomElement elem = doc.createElement( "attributeEditorContainer" );
elem.setAttribute( "name", mName );

Q_FOREACH ( QgsAttributeEditorElement* child, mChildren )
Q_FOREACH( QgsAttributeEditorElement* child, mChildren )
{
elem.appendChild( child->toDomElement( doc ) );
}
@@ -3643,7 +3643,7 @@ QList<QgsAttributeEditorElement*> QgsAttributeEditorContainer::findElements( Qgs
{
QList<QgsAttributeEditorElement*> results;

Q_FOREACH ( QgsAttributeEditorElement* elem, mChildren )
Q_FOREACH( QgsAttributeEditorElement* elem, mChildren )
{
if ( elem->type() == type )
{
@@ -1735,7 +1735,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
QList< TabData > mTabs;

/** Geometry type as defined in enum WkbType (qgis.h) */
int mWkbType;
QGis::WkbType mWkbType;

/** Renderer object which holds the information about how to display the features */
QgsFeatureRendererV2 *mRendererV2;
@@ -140,7 +140,7 @@ static QgsOgrLayerItem* dataItemForLayer( QgsDataItem* parentItem, QString name,
OGRFeatureDefnH hDef = OGR_L_GetLayerDefn( hLayer );

QgsLayerItem::LayerType layerType = QgsLayerItem::Vector;
int ogrType = QgsOgrProvider::getOgrGeomType( hLayer );
OGRwkbGeometryType ogrType = QgsOgrProvider::getOgrGeomType( hLayer );
switch ( ogrType )
{
case wkbUnknown:
@@ -695,10 +695,10 @@ void QgsOgrProvider::setEncoding( const QString& e )
}

// This is reused by dataItem
int QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
OGRwkbGeometryType QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
{
OGRFeatureDefnH fdef = OGR_L_GetLayerDefn( ogrLayer );
int geomType = wkbUnknown;
OGRwkbGeometryType geomType = wkbUnknown;
if ( fdef )
{
geomType = OGR_FD_GetGeomType( fdef );
@@ -935,7 +935,7 @@ size_t QgsOgrProvider::layerCount() const
*/
QGis::WkbType QgsOgrProvider::geometryType() const
{
return ( QGis::WkbType ) geomType;
return static_cast<QGis::WkbType>( geomType );
}

/**
@@ -248,7 +248,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
virtual bool doesStrictFeatureTypeCheck() const { return false;}

/** return OGR geometry type */
static int getOgrGeomType( OGRLayerH ogrLayer );
static OGRwkbGeometryType getOgrGeomType( OGRLayerH ogrLayer );

/** Get single flatten geometry type */
static OGRwkbGeometryType ogrWkbSingleFlatten( OGRwkbGeometryType type );
@@ -325,7 +325,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
bool valid;
//! Flag to indicate that spatial intersect should be used in selecting features
bool mUseIntersect;
int geomType;
OGRwkbGeometryType geomType;
long featuresCounted;

//! Data has been modified - REPACK before creating a spatialindex

0 comments on commit 327f3e9

Please sign in to comment.
You can’t perform that action at this time.