Skip to content

Commit 6d48f11

Browse files
committedJul 14, 2013
wfs server: fix multilinestring parsing
1 parent b7bdb4c commit 6d48f11

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed
 

‎src/core/qgsfeature.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ void QgsFeature::setGeometryAndOwnership( unsigned char *geom, size_t length )
159159
setGeometry( g );
160160
}
161161

162-
void QgsFeature::setFields( const QgsFields* fields, bool initAttributes )
162+
void QgsFeature::setFields( const QgsFields* fields, bool init )
163163
{
164164
mFields = fields;
165-
if ( initAttributes )
165+
if ( init )
166166
{
167-
this->initAttributes( fields->count() );
167+
initAttributes( fields->count() );
168168
}
169169
}
170170

‎src/core/qgsogcutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo
450450
{
451451
for ( int i = 0; i < lineStringMemberList.size(); ++i )
452452
{
453-
QDomNodeList lineStringNodeList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "LineString" );
453+
QDomNodeList lineStringNodeList = lineStringMemberList.at( i ).toElement().elementsByTagNameNS( GML_NAMESPACE, "LineString" );
454454
if ( lineStringNodeList.size() < 1 )
455455
{
456456
return 0;

‎src/mapserver/qgswfsserver.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,9 +1423,11 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
14231423
QDomNodeList featNodes = actionElem.childNodes();
14241424
for ( int l = 0; l < featNodes.count(); l++ )
14251425
{
1426-
// Create feature for this layer
1427-
QgsFeature* f = new QgsFeature();
1426+
// Add the feature to the layer
1427+
// and store it to put it's Feature Id in the response
1428+
inFeatList << QgsFeature( fields );
14281429

1430+
// Create feature for this layer
14291431
QDomElement featureElem = featNodes.at( l ).toElement();
14301432

14311433
QDomNode currentAttributeChild = featureElem.firstChild();
@@ -1447,23 +1449,21 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
14471449
const QgsField& field = fields[fieldMapIt.value()];
14481450
QString attrValue = currentAttributeElement.text();
14491451
int attrType = field.type();
1450-
if ( attrType == 2 )
1451-
f->setAttribute( fieldMapIt.value(), attrValue.toInt() );
1452-
else if ( attrType == 6 )
1453-
f->setAttribute( fieldMapIt.value(), attrValue.toDouble() );
1452+
QgsDebugMsg( QString( "attr: name=%1 idx=%2 value=%3" ).arg( attrName ).arg( fieldMapIt.value() ).arg( attrValue ) );
1453+
if ( attrType == QVariant::Int )
1454+
inFeatList.last().setAttribute( fieldMapIt.value(), attrValue.toInt() );
1455+
else if ( attrType == QVariant::Double )
1456+
inFeatList.last().setAttribute( fieldMapIt.value(), attrValue.toDouble() );
14541457
else
1455-
f->setAttribute( fieldMapIt.value(), attrValue );
1458+
inFeatList.last().setAttribute( fieldMapIt.value(), attrValue );
14561459
}
14571460
else //a geometry attribute
14581461
{
1459-
f->setGeometry( QgsOgcUtils::geometryFromGML( currentAttributeElement ) );
1462+
inFeatList.last().setGeometry( QgsOgcUtils::geometryFromGML( currentAttributeElement ) );
14601463
}
14611464
}
14621465
currentAttributeChild = currentAttributeChild.nextSibling();
14631466
}
1464-
// Add the feature to th layer
1465-
// and store it to put it's Feature Id in the response
1466-
inFeatList.append( *f );
14671467
}
14681468
}
14691469
}

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,8 +2190,8 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
21902190
result = mConnectionRO->PQexecPrepared( "getid", params );
21912191
if ( result.PQresultStatus() != PGRES_TUPLES_OK )
21922192
{
2193-
QgsDebugMsg( QString( "Exception thrown due to PQexecPrepared of 'getid' returning != PGRES_COMMAND_OK (%1 != expected %2)" )
2194-
.arg( result.PQresultStatus() ).arg( PGRES_COMMAND_OK ) );
2193+
QgsDebugMsg( QString( "Exception thrown due to PQexecPrepared of 'getid' returning != PGRES_TUPLES_OK (%1 != expected %2)" )
2194+
.arg( result.PQresultStatus() ).arg( PGRES_TUPLES_OK ) );
21952195
throw PGException( result );
21962196
}
21972197
// TODO: watch out for NULL , handle somehow
@@ -2207,7 +2207,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
22072207
int expected_status = ( mSpatialColType == sctTopoGeometry ) ? PGRES_TUPLES_OK : PGRES_COMMAND_OK;
22082208
if ( result.PQresultStatus() != expected_status )
22092209
{
2210-
QgsDebugMsg( QString( "Exception thrown due to PQexecPrepared of 'getid' returning != PGRES_COMMAND_OK (%1 != expected %2)" )
2210+
QgsDebugMsg( QString( "Exception thrown due to PQexecPrepared of 'updatefeatures' returning %1 != expected %2" )
22112211
.arg( result.PQresultStatus() ).arg( expected_status ) );
22122212
throw PGException( result );
22132213
}

‎src/providers/wfs/qgswfsprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ void QgsWFSProvider::handleException( const QDomDocument& serverResponse )
16511651
QDomElement exceptionElem = serverResponse.documentElement();
16521652
if ( exceptionElem.isNull() )
16531653
{
1654-
pushError( QObject::tr( "empty response" ).arg( exceptionElem.tagName() ) );
1654+
pushError( QObject::tr( "empty response" ) );
16551655
return;
16561656
}
16571657

0 commit comments

Comments
 (0)
Please sign in to comment.