Skip to content

Commit 7431eb8

Browse files
committedMar 15, 2013
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 6afd9f4 + 3b9c688 commit 7431eb8

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed
 

‎src/core/qgsexpression.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static QVariant fcnGeomFromWKT( const QVariantList& values, QgsFeature*, QgsExpr
770770
else
771771
return QVariant();
772772
}
773-
static QVariant fcnGeomFromGML2( const QVariantList& values, QgsFeature*, QgsExpression* parent )
773+
static QVariant fcnGeomFromGML( const QVariantList& values, QgsFeature*, QgsExpression* parent )
774774
{
775775
QString gml = getStringValue( values.at( 0 ), parent );
776776
QgsGeometry* geom = QgsOgcUtils::geometryFromGML( gml );
@@ -1087,7 +1087,7 @@ const QList<QgsExpression::Function*> &QgsExpression::Functions()
10871087
<< new StaticFunction( "$y", 0, fcnY, QObject::tr( "Geometry" ), "" , true )
10881088
<< new StaticFunction( "$geometry", 0, fcnGeometry, QObject::tr( "Geometry" ), "" , true )
10891089
<< new StaticFunction( "geomFromWKT", 1, fcnGeomFromWKT, QObject::tr( "Geometry" ) )
1090-
<< new StaticFunction( "geomFromGML2", 1, fcnGeomFromGML2, QObject::tr( "Geometry" ) )
1090+
<< new StaticFunction( "geomFromGML", 1, fcnGeomFromGML, QObject::tr( "Geometry" ) )
10911091
<< new StaticFunction( "bbox", 2, fcnBbox, QObject::tr( "Geometry" ) )
10921092
<< new StaticFunction( "disjoint", 2, fcnDisjoint, QObject::tr( "Geometry" ) )
10931093
<< new StaticFunction( "intersects", 2, fcnIntersects, QObject::tr( "Geometry" ) )

‎src/core/qgsogcutils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ QgsRectangle QgsOgcUtils::rectangleFromGMLEnvelope( const QDomNode& envelopeNode
942942
if ( !conversionSuccess )
943943
return rect;
944944

945-
elem = lowerCornerList.at( 0 ).toElement();
945+
elem = upperCornerList.at( 0 ).toElement();
946946
if ( elem.hasAttribute( "srsDimension" ) )
947947
{
948948
srsDimension = elem.attribute( "srsDimension" ).toInt( &conversionSuccess );
@@ -1605,7 +1605,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDom
16051605

16061606
QgsExpression::NodeList *opArgs = new QgsExpression::NodeList();
16071607
opArgs->append( new QgsExpression::NodeFunction( QgsExpression::functionIndex( "$geometry" ), new QgsExpression::NodeList() ) );
1608-
opArgs->append( new QgsExpression::NodeFunction( QgsExpression::functionIndex( "geomFromGML2" ), gml2Args ) );
1608+
opArgs->append( new QgsExpression::NodeFunction( QgsExpression::functionIndex( "geomFromGML" ), gml2Args ) );
16091609

16101610
return new QgsExpression::NodeFunction( opIdx, opArgs );
16111611
}
@@ -2110,20 +2110,20 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
21102110
otherGeomElem = QgsOgcUtils::geometryToGML( geom, doc );
21112111
delete geom;
21122112
}
2113-
else if ( otherFnDef->name() == "geomFromGML2" )
2113+
else if ( otherFnDef->name() == "geomFromGML" )
21142114
{
21152115
QgsExpression::Node* firstFnArg = otherFn->args()->list()[0];
21162116
if ( firstFnArg->nodeType() != QgsExpression::ntLiteral )
21172117
{
2118-
errorMessage = "geomFromGML2: argument must be string literal";
2118+
errorMessage = "geomFromGML: argument must be string literal";
21192119
return QDomElement();
21202120
}
21212121

21222122
QDomDocument geomDoc;
21232123
QString gml = static_cast<const QgsExpression::NodeLiteral*>( firstFnArg )->value().toString();
21242124
if ( !geomDoc.setContent( gml, true ) )
21252125
{
2126-
errorMessage = "geomFromGML2: unable to parse XML";
2126+
errorMessage = "geomFromGML: unable to parse XML";
21272127
return QDomElement();
21282128
}
21292129

‎tests/src/core/testqgsexpression.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,18 @@ class TestQgsExpression: public QObject
571571
QTest::newRow( "geomFromWKT Polygon" ) << "geomFromWKT('" + QgsGeometry::fromPolygon( polygon )->exportToWkt() + "')" << ( void* ) QgsGeometry::fromPolygon( polygon ) << false;
572572

573573
// GML Point
574-
QTest::newRow( "GML Point (coordinates)" ) << "geomFromGML2('<gml:Point><gml:coordinates>123,456</gml:coordinates></gml:Point>')" << ( void * ) QgsGeometry::fromPoint( point ) << false;
574+
QTest::newRow( "GML Point (coordinates)" ) << "geomFromGML('<gml:Point><gml:coordinates>123,456</gml:coordinates></gml:Point>')" << ( void * ) QgsGeometry::fromPoint( point ) << false;
575575
// gml:pos if from GML3
576-
//QTest::newRow( "GML Point (pos)" ) << "geomFromGML2('<gml:Point srsName=\"foo\"><gml:pos srsDimension=\"2\">123 456</gml:pos></gml:Point>')" << ( void * ) QgsGeometry::fromPoint( point ) << false;
576+
QTest::newRow( "GML Point (pos)" ) << "geomFromGML('<gml:Point srsName=\"foo\"><gml:pos srsDimension=\"2\">123 456</gml:pos></gml:Point>')" << ( void * ) QgsGeometry::fromPoint( point ) << false;
577577

578578
// GML Box
579579
QgsRectangle rect( 135.2239, 34.4879, 135.8578, 34.8471 );
580-
QTest::newRow( "GML Box" ) << "geomFromGML2('<gml:Box srsName=\"foo\"><gml:coordinates>135.2239,34.4879 135.8578,34.8471</gml:coordinates></gml:Box>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
580+
QTest::newRow( "GML Box" ) << "geomFromGML('<gml:Box srsName=\"foo\"><gml:coordinates>135.2239,34.4879 135.8578,34.8471</gml:coordinates></gml:Box>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
581581
// Envelope is from GML3 ?
582-
//QTest::newRow( "GML Envelope" ) << "geomFromGML2('<gml:Envelope>"
583-
// "<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
584-
// "<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
585-
// "</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
582+
QTest::newRow( "GML Envelope" ) << "geomFromGML('<gml:Envelope>"
583+
"<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
584+
"<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
585+
"</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
586586
}
587587

588588
void eval_geometry_constructor()

‎tests/src/core/testqgsogcutils.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ void TestQgsOgcUtils::testExpressionFromOgcFilter_data()
172172
"</Filter>" )
173173
<< QString( "FIRST_NAME IS NULL" );
174174

175-
QTest::newRow( "bbox" ) << QString(
175+
QTest::newRow( "bbox with GML2 Box" ) << QString(
176176
"<Filter>"
177177
"<BBOX><PropertyName>Name>NAME</PropertyName><gml:Box srsName='foo'>"
178178
"<gml:coordinates>135.2239,34.4879 135.8578,34.8471</gml:coordinates></gml:Box></BBOX>"
179179
"</Filter>" )
180-
<< QString( "bbox($geometry, geomFromGML2('<Box srsName=\"foo\"><coordinates>135.2239,34.4879 135.8578,34.8471</coordinates></Box>'))" );
180+
<< QString( "bbox($geometry, geomFromGML('<Box srsName=\"foo\"><coordinates>135.2239,34.4879 135.8578,34.8471</coordinates></Box>'))" );
181181

182182
QTest::newRow( "Intersects" ) << QString(
183183
"<Filter>"
@@ -188,7 +188,7 @@ void TestQgsOgcUtils::testExpressionFromOgcFilter_data()
188188
"</gml:Point>"
189189
"</Intersects>"
190190
"</Filter>" )
191-
<< QString( "intersects($geometry, geomFromGML2('<Point><coordinates>123,456</coordinates></Point>'))" );
191+
<< QString( "intersects($geometry, geomFromGML('<Point><coordinates>123,456</coordinates></Point>'))" );
192192
}
193193

194194
void TestQgsOgcUtils::testExpressionFromOgcFilter()
@@ -319,7 +319,7 @@ void TestQgsOgcUtils::testExpressionToOgcFilter_data()
319319
"</ogc:Intersects>"
320320
"</ogc:Filter>" );
321321

322-
QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML2('<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>'))" ) << QString(
322+
QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML('<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>'))" ) << QString(
323323
"<ogc:Filter>"
324324
"<ogc:Contains>"
325325
"<ogc:PropertyName>geometry</ogc:PropertyName>"
@@ -328,7 +328,9 @@ void TestQgsOgcUtils::testExpressionToOgcFilter_data()
328328
"</ogc:Filter>" );
329329

330330
/*
331-
QTest::newRow( "bbox" ) << QString( "bbox(13.0983, )") << QString(
331+
QTest::newRow( "bbox with GML3 Envelope" )
332+
<< QString( "bbox($geometry, geomFromGML('<gml:Envelope><gml:lowerCorner>13.0983 31.5899</gml:lowerCorner><gml:upperCorner>35.5472 42.8143</gml:upperCorner></gml:Envelope>'))" )
333+
<< QString(
332334
"<ogc:Filter>"
333335
"<ogc:BBOX>"
334336
"<ogc:PropertyName>Geometry</ogc:PropertyName>"

0 commit comments

Comments
 (0)
Please sign in to comment.