25 #include <QStringList>    26 #include <QTextStream>    30 #include <netinet/in.h>    46     bool honourAxisOrientation,
    47     bool invertAxisOrientation )
    50     , mGMLVersion( gmlVersion )
    51     , mFilterVersion( filterVersion )
    52     , mGeometryName( geometryName )
    54     , mInvertAxisOrientation( invertAxisOrientation )
    55     , mFilterPrefix(( filterVersion == 
QgsOgcUtils::FILTER_FES_2_0 ) ? 
"fes" : 
"ogc" )
    56     , mPropertyName(( filterVersion == 
QgsOgcUtils::FILTER_FES_2_0 ) ? 
"ValueReference" : 
"PropertyName" )
    66       mInvertAxisOrientation = !mInvertAxisOrientation;
    76   if ( !( geomType == 
"Point" || geomType == 
"LineString" || geomType == 
"Polygon" ||
    77           geomType == 
"MultiPoint" || geomType == 
"MultiLineString" || geomType == 
"MultiPolygon" ||
    78           geomType == 
"Box" || geomType == 
"Envelope" ) )
    81     if ( geometryChild.
isNull() )
    85     geometryTypeElement = geometryChild.
toElement();
    86     geomType = geometryTypeElement.
tagName();
    89   if ( !( geomType == 
"Point" || geomType == 
"LineString" || geomType == 
"Polygon" ||
    90           geomType == 
"MultiPoint" || geomType == 
"MultiLineString" || geomType == 
"MultiPolygon" ||
    91           geomType == 
"Box" || geomType == 
"Envelope" ) )
    94   if ( geomType == 
"Point" )
    96     return geometryFromGMLPoint( geometryTypeElement );
    98   else if ( geomType == 
"LineString" )
   100     return geometryFromGMLLineString( geometryTypeElement );
   102   else if ( geomType == 
"Polygon" )
   104     return geometryFromGMLPolygon( geometryTypeElement );
   106   else if ( geomType == 
"MultiPoint" )
   108     return geometryFromGMLMultiPoint( geometryTypeElement );
   110   else if ( geomType == 
"MultiLineString" )
   112     return geometryFromGMLMultiLineString( geometryTypeElement );
   114   else if ( geomType == 
"MultiPolygon" )
   116     return geometryFromGMLMultiPolygon( geometryTypeElement );
   118   else if ( geomType == 
"Box" )
   122   else if ( geomType == 
"Envelope" )
   135   QString xml = 
QString( 
"<tmp xmlns=\"%1\" xmlns:gml=\"%1\">%2</tmp>" ).
arg( GML_NAMESPACE, xmlString );
   152     if ( readGMLCoordinates( pointCoordinate, coordElement ) != 0 )
   160     if ( posList.
size() < 1 )
   165     if ( readGMLPositions( pointCoordinate, posElement ) != 0 )
   171   if ( pointCoordinate.
size() < 1 )
   177   char e = htonl( 1 ) != 1;
   178   double x = point_it->x();
   179   double y = point_it->y();
   180   int size = 1 + 
sizeof( int ) + 2 * 
sizeof( 
double );
   183   unsigned char* wkb = 
new unsigned char[size];
   186   memcpy( &( wkb )[wkbPosition], &e, 1 );
   188   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   189   wkbPosition += 
sizeof( int );
   190   memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   191   wkbPosition += 
sizeof( double );
   192   memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   207     if ( readGMLCoordinates( lineCoordinates, coordElement ) != 0 )
   215     if ( posList.
size() < 1 )
   220     if ( readGMLPositions( lineCoordinates, posElement ) != 0 )
   226   char e = htonl( 1 ) != 1;
   227   int size = 1 + 2 * 
sizeof( int ) + lineCoordinates.
size() * 2 * 
sizeof( double );
   230   unsigned char* wkb = 
new unsigned char[size];
   234   int nPoints = lineCoordinates.
size();
   237   memcpy( &( wkb )[wkbPosition], &e, 1 );
   239   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   240   wkbPosition += 
sizeof( int );
   241   memcpy( &( wkb )[wkbPosition], &nPoints, 
sizeof( 
int ) );
   242   wkbPosition += 
sizeof( int );
   245   for ( iter = lineCoordinates.
begin(); iter != lineCoordinates.
end(); ++iter )
   249     memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   250     wkbPosition += 
sizeof( double );
   251     memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   252     wkbPosition += 
sizeof( double );
   268   if ( !outerBoundaryList.
isEmpty() ) 
   271     if ( coordinatesElement.
isNull() )
   275     if ( readGMLCoordinates( exteriorPointList, coordinatesElement ) != 0 )
   279     ringCoordinates.
push_back( exteriorPointList );
   283     for ( 
int i = 0; i < innerBoundaryList.
size(); ++i )
   287       if ( coordinatesElement.
isNull() )
   291       if ( readGMLCoordinates( interiorPointList, coordinatesElement ) != 0 )
   295       ringCoordinates.
push_back( interiorPointList );
   302     if ( exteriorList.
size() < 1 ) 
   307     if ( posElement.
isNull() )
   311     if ( readGMLPositions( exteriorPointList, posElement ) != 0 )
   315     ringCoordinates.
push_back( exteriorPointList );
   319     for ( 
int i = 0; i < interiorList.
size(); ++i )
   323       if ( posElement.
isNull() )
   327       if ( readGMLPositions( interiorPointList, posElement ) != 0 )
   331       ringCoordinates.
push_back( interiorPointList );
   336   int nrings = ringCoordinates.
size();
   343     npoints += it->size();
   345   int size = 1 + 2 * 
sizeof( int ) + nrings * 
sizeof( 
int ) + 2 * npoints * 
sizeof( double );
   348   unsigned char* wkb = 
new unsigned char[size];
   351   char e = htonl( 1 ) != 1;
   353   int nPointsInRing = 0;
   357   memcpy( &( wkb )[wkbPosition], &e, 1 );
   359   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   360   wkbPosition += 
sizeof( int );
   361   memcpy( &( wkb )[wkbPosition], &nrings, 
sizeof( 
int ) );
   362   wkbPosition += 
sizeof( int );
   365     nPointsInRing = it->size();
   366     memcpy( &( wkb )[wkbPosition], &nPointsInRing, 
sizeof( 
int ) );
   367     wkbPosition += 
sizeof( int );
   370     for ( iter = it->begin(); iter != it->end(); ++iter )
   375       memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   376       wkbPosition += 
sizeof( double );
   377       memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   378       wkbPosition += 
sizeof( double );
   392   if ( pointMemberList.
size() < 1 )
   400   for ( 
int i = 0; i < pointMemberList.
size(); ++i )
   404     if ( pointNodeList.
size() < 1 )
   410     if ( !coordinatesList.
isEmpty() )
   412       currentPoint.
clear();
   413       if ( readGMLCoordinates( currentPoint, coordinatesList.
at( 0 ).
toElement() ) != 0 )
   417       if ( currentPoint.
size() < 1 )
   428       if ( posList.
size() < 1 )
   432       currentPoint.
clear();
   433       if ( readGMLPositions( currentPoint, posList.
at( 0 ).
toElement() ) != 0 )
   437       if ( currentPoint.
size() < 1 )
   445   int nPoints = pointList.
size(); 
   450   int size = 1 + 2 * 
sizeof( int ) + pointList.
size() * ( 2 * 
sizeof( double ) + 1 + 
sizeof( 
int ) );
   453   unsigned char* wkb = 
new unsigned char[size];
   456   char e = htonl( 1 ) != 1;
   459   memcpy( &( wkb )[wkbPosition], &e, 1 );
   461   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   462   wkbPosition += 
sizeof( int );
   463   memcpy( &( wkb )[wkbPosition], &nPoints, 
sizeof( 
int ) );
   464   wkbPosition += 
sizeof( int );
   468     memcpy( &( wkb )[wkbPosition], &e, 1 );
   470     memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   471     wkbPosition += 
sizeof( int );
   473     memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   474     wkbPosition += 
sizeof( double );
   476     memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   477     wkbPosition += 
sizeof( double );
   502   if ( !lineStringMemberList.
isEmpty() ) 
   504     for ( 
int i = 0; i < lineStringMemberList.
size(); ++i )
   507       if ( lineStringNodeList.
size() < 1 )
   511       currentLineStringElement = lineStringNodeList.
at( 0 ).
toElement();
   512       currentCoordList = currentLineStringElement.
elementsByTagNameNS( GML_NAMESPACE, 
"coordinates" );
   513       if ( !currentCoordList.
isEmpty() )
   516         if ( readGMLCoordinates( currentPointList, currentCoordList.
at( 0 ).
toElement() ) != 0 )
   520         lineCoordinates.
push_back( currentPointList );
   525         if ( currentPosList.
size() < 1 )
   530         if ( readGMLPositions( currentPointList, currentPosList.
at( 0 ).
toElement() ) != 0 )
   534         lineCoordinates.
push_back( currentPointList );
   541     if ( !lineStringList.
isEmpty() ) 
   543       for ( 
int i = 0; i < lineStringList.
size(); ++i )
   545         currentLineStringElement = lineStringList.
at( i ).
toElement();
   546         currentCoordList = currentLineStringElement.
elementsByTagNameNS( GML_NAMESPACE, 
"coordinates" );
   547         if ( !currentCoordList.
isEmpty() )
   550           if ( readGMLCoordinates( currentPointList, currentCoordList.
at( 0 ).
toElement() ) != 0 )
   554           lineCoordinates.
push_back( currentPointList );
   560           if ( currentPosList.
size() < 1 )
   565           if ( readGMLPositions( currentPointList, currentPosList.
at( 0 ).
toElement() ) != 0 )
   569           lineCoordinates.
push_back( currentPointList );
   579   int nLines = lineCoordinates.
size();
   584   int size = ( lineCoordinates.
size() + 1 ) * ( 1 + 2 * 
sizeof( 
int ) );
   587     size += it->size() * 2 * 
sizeof( double );
   591   unsigned char* wkb = 
new unsigned char[size];
   594   char e = htonl( 1 ) != 1;
   598   memcpy( &( wkb )[wkbPosition], &e, 1 );
   600   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   601   wkbPosition += 
sizeof( int );
   602   memcpy( &( wkb )[wkbPosition], &nLines, 
sizeof( 
int ) );
   603   wkbPosition += 
sizeof( int );
   607     memcpy( &( wkb )[wkbPosition], &e, 1 );
   609     memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   610     wkbPosition += 
sizeof( int );
   611     nPoints = it->size();
   612     memcpy( &( wkb )[wkbPosition], &nPoints, 
sizeof( 
int ) );
   613     wkbPosition += 
sizeof( int );
   619       memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   620       wkbPosition += 
sizeof( double );
   621       memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   622       wkbPosition += 
sizeof( double );
   656   for ( 
int i = 0; i < polygonMemberList.
size(); ++i )
   659     currentPolygonMemberElement = polygonMemberList.
at( i ).
toElement();
   661     if ( polygonList.
size() < 1 )
   665     currentPolygonElement = polygonList.
at( 0 ).
toElement();
   668     outerBoundaryList = currentPolygonElement.
elementsByTagNameNS( GML_NAMESPACE, 
"outerBoundaryIs" );
   669     if ( !outerBoundaryList.
isEmpty() )
   671       currentOuterBoundaryElement = outerBoundaryList.
at( 0 ).
toElement();
   674       linearRingNodeList = currentOuterBoundaryElement.
elementsByTagNameNS( GML_NAMESPACE, 
"LinearRing" );
   675       if ( linearRingNodeList.
size() < 1 )
   679       currentLinearRingElement = linearRingNodeList.
at( 0 ).
toElement();
   680       currentCoordinateList = currentLinearRingElement.
elementsByTagNameNS( GML_NAMESPACE, 
"coordinates" );
   681       if ( currentCoordinateList.
size() < 1 )
   685       if ( readGMLCoordinates( ringCoordinates, currentCoordinateList.
at( 0 ).
toElement() ) != 0 )
   689       currentPolygonList.
push_back( ringCoordinates );
   693       for ( 
int j = 0; j < innerBoundaryList.
size(); ++j )
   696         currentInnerBoundaryElement = innerBoundaryList.
at( j ).
toElement();
   697         linearRingNodeList = currentInnerBoundaryElement.
elementsByTagNameNS( GML_NAMESPACE, 
"LinearRing" );
   698         if ( linearRingNodeList.
size() < 1 )
   702         currentLinearRingElement = linearRingNodeList.
at( 0 ).
toElement();
   703         currentCoordinateList = currentLinearRingElement.
elementsByTagNameNS( GML_NAMESPACE, 
"coordinates" );
   704         if ( currentCoordinateList.
size() < 1 )
   708         if ( readGMLCoordinates( ringCoordinates, currentCoordinateList.
at( 0 ).
toElement() ) != 0 )
   712         currentPolygonList.
push_back( ringCoordinates );
   719       if ( exteriorList.
size() < 1 )
   724       currentExteriorElement = exteriorList.
at( 0 ).
toElement();
   727       linearRingNodeList = currentExteriorElement.
elementsByTagNameNS( GML_NAMESPACE, 
"LinearRing" );
   728       if ( linearRingNodeList.
size() < 1 )
   732       currentLinearRingElement = linearRingNodeList.
at( 0 ).
toElement();
   734       if ( currentPosList.
size() < 1 )
   738       if ( readGMLPositions( ringPositions, currentPosList.
at( 0 ).
toElement() ) != 0 )
   742       currentPolygonList.
push_back( ringPositions );
   746       for ( 
int j = 0; j < interiorList.
size(); ++j )
   749         currentInteriorElement = interiorList.
at( j ).
toElement();
   750         linearRingNodeList = currentInteriorElement.
elementsByTagNameNS( GML_NAMESPACE, 
"LinearRing" );
   751         if ( linearRingNodeList.
size() < 1 )
   755         currentLinearRingElement = linearRingNodeList.
at( 0 ).
toElement();
   757         if ( currentPosList.
size() < 1 )
   761         if ( readGMLPositions( ringPositions, currentPosList.
at( 0 ).
toElement() ) != 0 )
   765         currentPolygonList.
push_back( ringPositions );
   768     multiPolygonPoints.
push_back( currentPolygonList );
   771   int nPolygons = multiPolygonPoints.
size();
   775   int size = 1 + 2 * 
sizeof( int );
   779     size += 1 + 2 * 
sizeof( int );
   782       size += 
sizeof( int ) + 2 * iter->size() * 
sizeof( double );
   787   unsigned char* wkb = 
new unsigned char[size];
   789   char e = htonl( 1 ) != 1;
   796   memcpy( &( wkb )[wkbPosition], &e, 1 );
   798   memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   799   wkbPosition += 
sizeof( int );
   800   memcpy( &( wkb )[wkbPosition], &nPolygons, 
sizeof( 
int ) );
   801   wkbPosition += 
sizeof( int );
   807     memcpy( &( wkb )[wkbPosition], &e, 1 );
   809     memcpy( &( wkb )[wkbPosition], &type, 
sizeof( 
int ) );
   810     wkbPosition += 
sizeof( int );
   812     memcpy( &( wkb )[wkbPosition], &nRings, 
sizeof( 
int ) );
   813     wkbPosition += 
sizeof( int );
   816       nPointsInRing = iter->size();
   817       memcpy( &( wkb )[wkbPosition], &nPointsInRing, 
sizeof( 
int ) );
   818       wkbPosition += 
sizeof( int );
   823         memcpy( &( wkb )[wkbPosition], &x, 
sizeof( 
double ) );
   824         wkbPosition += 
sizeof( double );
   825         memcpy( &( wkb )[wkbPosition], &y, 
sizeof( 
double ) );
   826         wkbPosition += 
sizeof( double );
   856   bool conversionSuccess;
   861     tupel_coords = ( *it ).
split( coordSeparator, QString::SkipEmptyParts );
   862     if ( tupel_coords.
size() < 2 )
   866     x = tupel_coords.
at( 0 ).toDouble( &conversionSuccess );
   867     if ( !conversionSuccess )
   871     y = tupel_coords.
at( 1 ).toDouble( &conversionSuccess );
   872     if ( !conversionSuccess )
   886   if ( boxElem.
tagName() != 
"Box" )
   894     coordSeparator = bElem.
attribute( 
"cs" );
   898     tupelSeparator = bElem.
attribute( 
"ts" );
   902   bool ok1, ok2, ok3, ok4;
   908   if ( ok1 && ok2 && ok3 && ok4 )
   923   bool conversionSuccess;
   924   int posSize = pos.
size();
   926   int srsDimension = 2;
   929     srsDimension = elem.
attribute( 
"srsDimension" ).
toInt( &conversionSuccess );
   930     if ( !conversionSuccess )
   937     srsDimension = elem.
attribute( 
"dimension" ).
toInt( &conversionSuccess );
   938     if ( !conversionSuccess )
   944   for ( 
int i = 0; i < posSize / srsDimension; i++ )
   946     x = pos.
at( i * srsDimension ).toDouble( &conversionSuccess );
   947     if ( !conversionSuccess )
   951     y = pos.
at( i * srsDimension + 1 ).toDouble( &conversionSuccess );
   952     if ( !conversionSuccess )
   967   if ( envelopeElem.
tagName() != 
"Envelope" )
   971   if ( lowerCornerList.
size() < 1 )
   975   if ( upperCornerList.
size() < 1 )
   978   bool conversionSuccess;
   979   int srsDimension = 2;
   984     srsDimension = elem.
attribute( 
"srsDimension" ).
toInt( &conversionSuccess );
   985     if ( !conversionSuccess )
   992     srsDimension = elem.
attribute( 
"dimension" ).
toInt( &conversionSuccess );
   993     if ( !conversionSuccess )
  1000   double xmin = bString.
section( 
' ', 0, 0 ).
toDouble( &conversionSuccess );
  1001   if ( !conversionSuccess )
  1003   double ymin = bString.
section( 
' ', 1, 1 ).
toDouble( &conversionSuccess );
  1004   if ( !conversionSuccess )
  1010     srsDimension = elem.
attribute( 
"srsDimension" ).
toInt( &conversionSuccess );
  1011     if ( !conversionSuccess )
  1018     srsDimension = elem.
attribute( 
"dimension" ).
toInt( &conversionSuccess );
  1019     if ( !conversionSuccess )
  1025   Q_UNUSED( srsDimension );
  1027   bString = elem.
text();
  1028   double xmax = bString.
section( 
' ', 0, 0 ).
toDouble( &conversionSuccess );
  1029   if ( !conversionSuccess )
  1031   double ymax = bString.
section( 
' ', 1, 1 ).
toDouble( &conversionSuccess );
  1032   if ( !conversionSuccess )
  1043   return rectangleToGMLBox( box, doc, 
QString(), 
false, precision );
  1048     bool invertAxisOrientation,
  1083   return rectangleToGMLEnvelope( env, doc, 
QString(), 
false, precision );
  1088     bool invertAxisOrientation,
  1124   return geometryToGML( geometry, doc, ( format == 
"GML2" ) ? GML_2_1_2 : GML_3_2_1, 
QString(), 
false, 
QString(), precision );
  1130                                         bool invertAxisOrientation,
  1134   if ( !geometry || !geometry->
asWkb() )
  1144   bool hasZValue = 
false;
  1158   if ( gmlVersion != GML_2_1_2 )
  1160     switch ( geometry->
wkbType() )
  1184     switch ( geometry->
wkbType() )
  1190         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1198         if ( invertAxisOrientation )
  1215         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1223         for ( 
int idx = 0; idx < nPoints; ++idx )
  1227           if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1231           wkbPtr.readHeader();
  1234           if ( invertAxisOrientation )
  1245             wkbPtr += 
sizeof( double );
  1250         return multiPointElem;
  1259         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1270         for ( 
int idx = 0; idx < nPoints; ++idx )
  1278           if ( invertAxisOrientation )
  1286             wkbPtr += 
sizeof( double );
  1292         return lineStringElem;
  1301         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1302           multiLineStringElem.
setAttribute( 
"gml:id", gmlIdBase );
  1304           multiLineStringElem.
setAttribute( 
"srsName", srsName );
  1309         for ( 
int jdx = 0; jdx < nLines; jdx++ )
  1313           if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1316           wkbPtr.readHeader();
  1323           for ( 
int idx = 0; idx < nPoints; idx++ )
  1331             if ( invertAxisOrientation )
  1340               wkbPtr += 
sizeof( double );
  1346           lineStringMemberElem.
appendChild( lineStringElem );
  1347           multiLineStringElem.
appendChild( lineStringMemberElem );
  1349         return multiLineStringElem;
  1358         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1367         if ( numRings == 0 ) 
  1370         int *ringNumPoints = 
new int[numRings]; 
  1372         for ( 
int idx = 0; idx < numRings; idx++ )
  1374           QString boundaryName = ( gmlVersion == GML_2_1_2 ) ? 
"gml:outerBoundaryIs" : 
"gml:exterior";
  1377             boundaryName = ( gmlVersion == GML_2_1_2 ) ? 
"gml:innerBoundaryIs" : 
"gml:interior";
  1384           ringNumPoints[idx] = nPoints;
  1388           for ( 
int jdx = 0; jdx < nPoints; jdx++ )
  1396             if ( invertAxisOrientation )
  1404               wkbPtr += 
sizeof( double );
  1413         delete [] ringNumPoints;
  1423         if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1429         wkbPtr >> numPolygons;
  1431         for ( 
int kdx = 0; kdx < numPolygons; kdx++ )
  1435           if ( gmlVersion == GML_3_2_1 && !gmlIdBase.
isEmpty() )
  1438           wkbPtr.readHeader();
  1443           for ( 
int idx = 0; idx < numRings; idx++ )
  1445             QString boundaryName = ( gmlVersion == GML_2_1_2 ) ? 
"gml:outerBoundaryIs" : 
"gml:exterior";
  1448               boundaryName = ( gmlVersion == GML_2_1_2 ) ? 
"gml:innerBoundaryIs" : 
"gml:interior";
  1458             for ( 
int jdx = 0; jdx < nPoints; jdx++ )
  1466               if ( invertAxisOrientation )
  1475                 wkbPtr += 
sizeof( double );
  1484             multiPolygonElem.
appendChild( polygonMemberElem );
  1487         return multiPolygonElem;
  1502   return geometryToGML( geometry, doc, 
"GML2", precision );
  1513   for ( ; pointIt != points.
constEnd(); ++pointIt )
  1532   if ( points.
size() > 1 )
  1538   for ( ; pointIt != points.
constEnd(); ++pointIt )
  1569   while ( !cssElem.
isNull() )
  1571     cssName = cssElem.
attribute( 
"name", 
"not_found" );
  1572     if ( cssName != 
"not_found" )
  1574       elemText = cssElem.
text();
  1575       if ( cssName == 
"fill" )
  1579       else if ( cssName == 
"fill-opacity" )
  1582         double opacity = elemText.
toDouble( &ok );
  1606     expr->
d->mParserErrorString = 
QString();
  1615   while ( !childElem.
isNull() )
  1622       expr->
d->mParserErrorString = errorMsg;
  1627     if ( !expr->
d->mRootNode )
  1629       expr->
d->mRootNode = node;
  1640   expr->
d->mExp = expr->
dump();
  1681     return "PropertyIsLike";
  1697     spatialOps << 
"BBOX" << 
"Intersects" << 
"Contains" << 
"Crosses" << 
"Equals"  1698     << 
"Disjoint" << 
"Overlaps" << 
"Touches" << 
"Within";
  1701   return spatialOps.
contains( tagName );
  1714     return nodeBinaryOperatorFromOgcFilter( element, errorMessage );
  1720     return nodeSpatialOperatorFromOgcFilter( element, errorMessage );
  1725   if ( element.
tagName() == 
"Not" )
  1727     return nodeNotFromOgcFilter( element, errorMessage );
  1729   else if ( element.
tagName() == 
"PropertyIsNull" )
  1731     return nodePropertyIsNullFromOgcFilter( element, errorMessage );
  1733   else if ( element.
tagName() == 
"Literal" )
  1735     return nodeLiteralFromOgcFilter( element, errorMessage );
  1737   else if ( element.
tagName() == 
"Function" )
  1739     return nodeFunctionFromOgcFilter( element, errorMessage );
  1741   else if ( element.
tagName() == 
"PropertyName" )
  1743     return nodeColumnRefFromOgcFilter( element, errorMessage );
  1745   else if ( element.
tagName() == 
"PropertyIsBetween" )
  1747     return nodeIsBetweenFromOgcFilter( element, errorMessage );
  1750   errorMessage += 
QObject::tr( 
"unable to convert '%1' element to a valid expression: it is not supported yet or it has invalid arguments" ).
arg( element.
tagName() );
  1775   QgsExpression::Node *expr = nodeFromOgcFilter( operandElem, errorMessage ), *leftOp = expr;
  1779       errorMessage = 
QObject::tr( 
"invalid left operand for '%1' binary operator" ).
arg( element.
tagName() );
  1789         errorMessage = 
QObject::tr( 
"invalid right operand for '%1' binary operator" ).
arg( element.
tagName() );
  1799         wildCard = element.
attribute( 
"wildCard" );
  1804         singleChar = element.
attribute( 
"singleChar" );
  1813       if ( !wildCard.
isEmpty() && wildCard != 
"%" )
  1815         oprValue.
replace( 
'%', 
"\\%" );
  1818           oprValue.
replace( 0, 1, 
"%" );
  1822         while (( pos = rx.
indexIn( oprValue, pos ) ) != -1 )
  1824           oprValue.
replace( pos + 1, 1, 
"%" );
  1827         oprValue.
replace( escape + wildCard, wildCard );
  1829       if ( !singleChar.
isEmpty() && singleChar != 
"_" )
  1831         oprValue.
replace( 
'_', 
"\\_" );
  1834           oprValue.
replace( 0, 1, 
"_" );
  1838         while (( pos = rx.
indexIn( oprValue, pos ) ) != -1 )
  1840           oprValue.
replace( pos + 1, 1, 
"_" );
  1843         oprValue.
replace( escape + singleChar, singleChar );
  1845       if ( !escape.
isEmpty() && escape != 
"\\" )
  1847         oprValue.
replace( escape + escape, escape );
  1855   if ( expr == leftOp )
  1881     if ( childElem.
tagName() != 
"PropertyName" )
  1884       childElem.
save( gml2Stream, 0 );
  1894     errorMessage = 
QObject::tr( 
"No OGC Geometry found" );
  1909   if ( element.
tagName() != 
"Not" )
  1943     while ( !operandElem.
isNull() )
  1976   while ( !childNode.
isNull() )
  1980     if ( childNode.
nodeType() == QDomNode::ElementNode )
  1984       operand = nodeFromOgcFilter( operandElem, errorMessage );
  1990         errorMessage = 
QObject::tr( 
"'%1' is an invalid or not supported content for ogc:Literal" ).
arg( operandElem.
tagName() );
  2033   if ( element.
isNull() || element.
tagName() != 
"PropertyName" )
  2050   while ( !operandElem.
isNull() )
  2052     if ( operandElem.
tagName() == 
"LowerBoundary" )
  2055       lowerBound = nodeFromOgcFilter( lowerBoundElem, errorMessage );
  2057     else if ( operandElem.
tagName() ==  
"UpperBoundary" )
  2060       upperBound = nodeFromOgcFilter( upperBoundElem, errorMessage );
  2067       operand = nodeFromOgcFilter( operandElem, errorMessage );
  2068       operand2 = nodeFromOgcFilter( operandElem, errorMessage );
  2071     if ( operand && lowerBound && operand2 && upperBound )
  2077   if ( !operand || !lowerBound || !operand2 || !upperBound )
  2088     errorMessage = 
QObject::tr( 
"missing some required sub-elements in ogc:PropertyIsBetween" );
  2101   if ( element.
tagName() != 
"PropertyIsNull" )
  2121   return expressionToOgcFilter( exp, doc, GML_2_1_2, FILTER_OGC_1_0,
  2122                                 "geometry", 
QString(), 
false, 
false, errorMessage );
  2127   return expressionToOgcExpression( exp, doc, GML_2_1_2, FILTER_OGC_1_0,
  2128                                     "geometry", 
QString(), 
false, 
false, errorMessage );
  2137     bool honourAxisOrientation,
  2138     bool invertAxisOrientation,
  2144   QgsOgcUtilsExprToFilter utils( doc, gmlVersion, filterVersion, geometryName, srsName, honourAxisOrientation, invertAxisOrientation );
  2148   if ( exprRootElem.
isNull() )
  2152     ( filterVersion == FILTER_FES_2_0 ) ?
  2158     if ( gmlVersion == GML_3_2_1 )
  2174     bool honourAxisOrientation,
  2175     bool invertAxisOrientation,
  2188       QgsOgcUtilsExprToFilter utils( doc, gmlVersion, filterVersion, geometryName, srsName, honourAxisOrientation, invertAxisOrientation );
  2194       if ( !exprRootElem.
isNull() )
  2196         return exprRootElem;
  2201       *errorMessage = 
QObject::tr( 
"Node type not supported in expression translation: %1" ).
arg( node->
nodeType() );
  2212     bool honourAxisOrientation,
  2213     bool invertAxisOrientation,
  2221                                          layerProperties, honourAxisOrientation, invertAxisOrientation,
  2222                                          mapUnprefixedTypenameToPrefixedTypename );
  2226   if ( exprRootElem.
isNull() )
  2230     ( filterVersion == FILTER_FES_2_0 ) ?
  2236     if ( gmlVersion == GML_3_2_1 )
  2254       return expressionUnaryOperatorToOgcFilter( static_cast<const QgsExpression::NodeUnaryOperator*>( node ) );
  2256       return expressionBinaryOperatorToOgcFilter( static_cast<const QgsExpression::NodeBinaryOperator*>( node ) );
  2258       return expressionInOperatorToOgcFilter( static_cast<const QgsExpression::NodeInOperator*>( node ) );
  2260       return expressionFunctionToOgcFilter( static_cast<const QgsExpression::NodeFunction*>( node ) );
  2262       return expressionLiteralToOgcFilter( static_cast<const QgsExpression::NodeLiteral*>( node ) );
  2264       return expressionColumnRefToOgcFilter( static_cast<const QgsExpression::NodeColumnRef*>( node ) );
  2277   if ( !mErrorMessage.
isEmpty() )
  2281   switch ( node->
op() )
  2294         mErrorMessage = 
QObject::tr( 
"This use of unary operator not implemented yet" );
  2315   if ( !mErrorMessage.
isEmpty() )
  2349   if ( !mErrorMessage.
isEmpty() )
  2392     case QVariant::Double:
  2395     case QVariant::String:
  2421   if ( node->
list()->
list().size() == 1 )
  2430     if ( !mErrorMessage.
isEmpty() )
  2453   if ( binSpatialOps.
isEmpty() )
  2455     binSpatialOps.
insert( 
"disjoint", 
"Disjoint" );
  2456     binSpatialOps.
insert( 
"intersects", 
"Intersects" );
  2457     binSpatialOps.
insert( 
"touches", 
"Touches" );
  2458     binSpatialOps.
insert( 
"crosses", 
"Crosses" );
  2459     binSpatialOps.
insert( 
"contains", 
"Contains" );
  2460     binSpatialOps.
insert( 
"overlaps", 
"Overlaps" );
  2461     binSpatialOps.
insert( 
"within", 
"Within" );
  2463   return binSpatialOps;
  2483   return fd->
name() == 
"$geometry";
  2495     if ( fnDef->
name() == 
"geom_from_wkt" )
  2513   if ( fd->
name() == 
"intersects_bbox" )
  2516     Q_ASSERT( argNodes.
count() == 2 ); 
  2542       mErrorMessage = 
QObject::tr( 
"<BBOX> is currently supported only in form: bbox($geometry, geomFromWKT('...'))" );
  2550     Q_ASSERT( argNodes.
count() == 2 ); 
  2554       otherNode = argNodes[1];
  2556       otherNode = argNodes[0];
  2559       mErrorMessage = 
QObject::tr( 
"Unable to translate spatial operator: at least one must refer to geometry." );
  2568       mErrorMessage = 
QObject::tr( 
"spatial operator: the other operator must be a geometry constructor function" );
  2574     if ( otherFnDef->
name() == 
"geom_from_wkt" )
  2579         mErrorMessage = 
QObject::tr( 
"geom_from_wkt: argument must be string literal" );
  2585                       QString( 
"qgis_id_geom_%1" ).arg( mGeomId ) );
  2589     else if ( otherFnDef->
name() == 
"geom_from_gml" )
  2594         mErrorMessage = 
QObject::tr( 
"geom_from_gml: argument must be string literal" );
  2602         mErrorMessage = 
QObject::tr( 
"geom_from_gml: unable to parse XML" );
  2611       mErrorMessage = 
QObject::tr( 
"spatial operator: unknown geometry constructor function" );
  2627     mErrorMessage = 
QObject::tr( 
"Special columns/constants are not supported." );
  2637     if ( !mErrorMessage.
isEmpty() )
  2652     bool honourAxisOrientation,
  2653     bool invertAxisOrientation,
  2657     , mGMLVersion( gmlVersion )
  2658     , mFilterVersion( filterVersion )
  2659     , mLayerProperties( layerProperties )
  2660     , mHonourAxisOrientation( honourAxisOrientation )
  2661     , mInvertAxisOrientation( invertAxisOrientation )
  2662     , mFilterPrefix(( filterVersion == 
QgsOgcUtils::FILTER_FES_2_0 ) ? 
"fes" : 
"ogc" )
  2663     , mPropertyName(( filterVersion == 
QgsOgcUtils::FILTER_FES_2_0 ) ? 
"ValueReference" : 
"PropertyName" )
  2665     , mMapUnprefixedTypenameToPrefixedTypename( mapUnprefixedTypenameToPrefixedTypename )
  2674       return toOgcFilter( static_cast<const QgsSQLStatement::NodeUnaryOperator*>( node ) );
  2676       return toOgcFilter( static_cast<const QgsSQLStatement::NodeBinaryOperator*>( node ) );
  2678       return toOgcFilter( static_cast<const QgsSQLStatement::NodeInOperator*>( node ) );
  2680       return toOgcFilter( static_cast<const QgsSQLStatement::NodeBetweenOperator*>( node ) );
  2682       return toOgcFilter( static_cast<const QgsSQLStatement::NodeFunction*>( node ) );
  2684       return toOgcFilter( static_cast<const QgsSQLStatement::NodeLiteral*>( node ) );
  2686       return toOgcFilter( static_cast<const QgsSQLStatement::NodeColumnRef*>( node ) );
  2688       return toOgcFilter( static_cast<const QgsSQLStatement::NodeSelect*>( node ) );
  2701   if ( !mErrorMessage.
isEmpty() )
  2705   switch ( node->
op() )
  2718         mErrorMessage = 
QObject::tr( 
"This use of unary operator not implemented yet" );
  2739   if ( !mErrorMessage.
isEmpty() )
  2773   if ( !mErrorMessage.
isEmpty() )
  2783     opText = 
"PropertyIsEqualTo";
  2785     opText = 
"PropertyIsNotEqualTo";
  2787     opText = 
"PropertyIsLessThanOrEqualTo";
  2789     opText = 
"PropertyIsGreaterThanOrEqualTo";
  2791     opText = 
"PropertyIsLessThan";
  2793     opText = 
"PropertyIsGreaterThan";
  2795     opText = 
"PropertyIsLike";
  2797     opText = 
"PropertyIsLike";
  2836     case QVariant::LongLong:
  2839     case QVariant::Double:
  2842     case QVariant::String:
  2865     if ( mMapUnprefixedTypenameToPrefixedTypename.
contains( tableName ) )
  2866       tableName = mMapUnprefixedTypenameToPrefixedTypename[tableName];
  2874   if ( node->
list()->
list().size() == 1 )
  2883     if ( !mErrorMessage.
isEmpty() )
  2927   if ( name.
size() > 3 && name.
mid( 0, 3 ).
compare( 
"ST_", Qt::CaseInsensitive ) == 0 )
  2928     nameCompare = name.
mid( 3 );
  2930   spatialOps << 
"BBOX" << 
"Intersects" << 
"Contains" << 
"Crosses" << 
"Equals"  2931   << 
"Disjoint" << 
"Overlaps" << 
"Touches" << 
"Within";
  2932   Q_FOREACH ( 
QString op, spatialOps )
  2934     if ( nameCompare.
compare( op, Qt::CaseInsensitive ) == 0 )
  2943   if ( name.
size() > 3 && name.
mid( 0, 3 ).
compare( 
"ST_", Qt::CaseInsensitive ) == 0 )
  2944     nameCompare = name.
mid( 3 );
  2945   if ( nameCompare.
compare( 
"DWithin", Qt::CaseInsensitive ) == 0 )
  2947   if ( nameCompare.
compare( 
"Beyond", Qt::CaseInsensitive ) == 0 )
  2969   if ( mLayerProperties.
size() != 0 &&
  2970        mLayerProperties.
at( 0 ).mGeometryAttribute.compare( col->
name(), Qt::CaseInsensitive ) == 0 )
  2972     return  mLayerProperties.
at( 0 ).mSRSName;
  2979     bool lastArgIsSRSName,
  2981     bool& axisInversion )
  2983   srsName = mCurrentSRSName;
  2984   axisInversion = mInvertAxisOrientation;
  2986   if ( lastArgIsSRSName )
  2991       mErrorMessage = 
QObject::tr( 
"%1: Last argument must be string or integer literal" ).
arg( mainNode->
name() );
  2995     if ( lit->
value().
type() == QVariant::Int )
  3009       if ( srsName.
startsWith( 
"EPSG:", Qt::CaseInsensitive ) )
  3021       axisInversion = !axisInversion;
  3031   if ( node->
name().
compare( 
"ST_GeometryFromText", Qt::CaseInsensitive ) == 0 )
  3034     if ( args.
size() != 1 && args.
size() != 2 )
  3036       mErrorMessage = 
QObject::tr( 
"Function %1 should have 1 or 2 arguments" ).
arg( node->
name() );
  3043       mErrorMessage = 
QObject::tr( 
"%1: First argument must be string literal" ).
arg( node->
name() );
  3049     if ( ! processSRSName( node, args, args.
size() == 2, srsName, axisInversion ) )
  3057                            QString( 
"qgis_id_geom_%1" ).arg( mGeomId ) );
  3070   if ( node->
name().
compare( 
"ST_MakeEnvelope", Qt::CaseInsensitive ) == 0 )
  3073     if ( args.
size() != 4 && args.
size() != 5 )
  3075       mErrorMessage = 
QObject::tr( 
"Function %1 should have 4 or 5 arguments" ).
arg( node->
name() );
  3081     for ( 
int i = 0; i < 4;i++ )
  3086         mErrorMessage = 
QObject::tr( 
"%1: Argument %2 must be numeric literal" ).
arg( node->
name() ).arg( i + 1 );
  3091       if ( lit->
value().
type() == QVariant::Int )
  3093       else if ( lit->
value().
type() == QVariant::LongLong )
  3095       else if ( lit->
value().
type() == QVariant::Double )
  3099         mErrorMessage = 
QObject::tr( 
"%1 Argument %2 must be numeric literal" ).
arg( node->
name() ).arg( i + 1 );
  3114     if ( ! processSRSName( node, args, args.
size() == 5, srsName, axisInversion ) )
  3127   if ( node->
name().
compare( 
"ST_GeomFromGML", Qt::CaseInsensitive ) == 0 )
  3130     if ( args.
size() != 1 )
  3132       mErrorMessage = 
QObject::tr( 
"Function %1 should have 1 argument" ).
arg( node->
name() );
  3139       mErrorMessage = 
QObject::tr( 
"%1: Argument must be string literal" ).
arg( node->
name() );
  3147       mErrorMessage = 
QObject::tr( 
"ST_GeomFromGML: unable to parse XML" );
  3161     if ( args.
size() != 2 )
  3163       mErrorMessage = 
QObject::tr( 
"Function %1 should have 2 arguments" ).
arg( node->
name() );
  3167     for ( 
int i = 0; i < 2; i ++ )
  3170            ( static_cast<const QgsSQLStatement::NodeFunction*>( args[i] )->name().compare( 
"ST_GeometryFromText", Qt::CaseInsensitive ) == 0 ||
  3171              static_cast<const QgsSQLStatement::NodeFunction*>( args[i] )->name().compare( 
"ST_MakeEnvelope", Qt::CaseInsensitive ) == 0 ) )
  3173         mCurrentSRSName = getGeometryColumnSRSName( args[1-i] );
  3184       if ( !mErrorMessage.
isEmpty() )
  3186         mCurrentSRSName.
clear();
  3193     mCurrentSRSName.
clear();
  3201     if ( args.
size() != 3 )
  3203       mErrorMessage = 
QObject::tr( 
"Function %1 should have 3 arguments" ).
arg( node->
name() );
  3207     for ( 
int i = 0; i < 2; i ++ )
  3210            ( static_cast<const QgsSQLStatement::NodeFunction*>( args[i] )->name().compare( 
"ST_GeometryFromText", Qt::CaseInsensitive ) == 0 ||
  3211              static_cast<const QgsSQLStatement::NodeFunction*>( args[i] )->name().compare( 
"ST_MakeEnvelope", Qt::CaseInsensitive ) == 0 ) )
  3213         mCurrentSRSName = getGeometryColumnSRSName( args[1-i] );
  3219     for ( 
int i = 0; i < 2; i++ )
  3222       if ( !mErrorMessage.
isEmpty() )
  3224         mCurrentSRSName.
clear();
  3230     mCurrentSRSName.
clear();
  3235       mErrorMessage = 
QObject::tr( 
"Function %1 3rd argument should be a numeric value or a string made of a numeric value followed by a string" ).
arg( node->
name() );
  3241       mErrorMessage = 
QObject::tr( 
"Function %1 3rd argument should be a numeric value or a string made of a numeric value followed by a string" ).
arg( node->
name() );
  3251       case QVariant::LongLong:
  3254       case QVariant::Double:
  3257       case QVariant::String:
  3260         for ( 
int i = 0; i < distance.
size(); i++ )
  3262           if ( !(( distance[i] >= 
'0' && distance[i] <= 
'9' ) || distance[i] == 
'-' || distance[i] == 
'.' || distance[i] == 
'e' || distance[i] == 
'E' ) )
  3265             distance = distance.
mid( 0, i );
  3293     if ( !mErrorMessage.
isEmpty() )
  3320     listElem.
append( eqElem );
  3323   if ( listElem.
size() == 1 )
  3327   else if ( listElem.
size() > 1 )
  3344     mMapTableAliasToNames[ node->
name()] = node->
name();
  3348     mMapTableAliasToNames[ node->
alias()] = node->
name();
  3357        ( node->
tables().size() != 1 || node->
joins().size() != 0 ) )
  3359     mErrorMessage = 
QObject::tr( 
"Joins are only supported with WFS 2.0" );
  3378     if ( !mErrorMessage.
isEmpty() )
  3380     listElem.
append( joinElem );
  3385   if ( node->
where() )
  3388     if ( !mErrorMessage.
isEmpty() )
  3390     listElem.
append( whereElem );
  3394   if ( listElem.
size() == 1 )
  3398   else if ( listElem.
size() > 1 )
 
QDomAttr createAttribute(const QString &name)
 
Class for parsing and evaluation of expressions (formerly called "search strings"). 
 
qlonglong toLongLong(bool *ok) const
 
static const QString GML32_NAMESPACE
 
virtual NodeType nodeType() const =0
Abstract virtual that returns the type of this node. 
 
A rectangle specified with double values. 
 
Internal use by QgsOgcUtils. 
 
QGis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.) 
 
QgsCoordinateReferenceSystem crsByOgcWmsCrs(const QString &ogcCrs) const
Returns the CRS from a given OGC WMS-format Coordinate Reference System string. 
 
QDomNodeList elementsByTagNameNS(const QString &nsURI, const QString &localName) const
 
void setValue(const QString &v)
 
bool contains(const Key &key) const
 
virtual NodeType nodeType() const =0
Abstract virtual that returns the type of this node. 
 
QDomNode appendChild(const QDomNode &newChild)
 
void setXMaximum(double x)
Set the maximum x value. 
 
Function with a name and arguments node. 
 
QgsOgcUtilsExprToFilter(QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, QgsOgcUtils::FilterVersion filterVersion, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation)
Constructor. 
 
static const QString FES_NAMESPACE
 
void push_back(const T &value)
 
Node * onExpr() const
On expression. 
 
static QString mapBinarySpatialToOgc(const QString &name)
 
void fromWkb(unsigned char *wkb, int length)
Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length...
 
QString attribute(const QString &name, const QString &defValue) const
 
A abstract base class for defining QgsExpression functions. 
 
QString nodeValue() const
 
static const char * BinaryOperatorText[]
 
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
 
QString dump() const
Return an expression string, constructed from the internal abstract syntax tree. 
 
QString escape(const QString &str)
 
const QString & errorMessage() const
Return the error message. 
 
Node * operand() const
Operand. 
 
const_iterator constEnd() const
 
const T & at(int i) const
 
bool contains(const QString &str, Qt::CaseSensitivity cs) const
 
QDomElement nextSiblingElement(const QString &tagName) const
 
static bool isGeometryColumn(const QgsExpression::Node *node)
 
bool GMLNamespaceUsed() const
Return whether the gml: namespace is used. 
 
A geometry is the spatial representation of a feature. 
 
WkbType
Used for symbology operations. 
 
static QDomElement rectangleToGMLBox(QgsRectangle *box, QDomDocument &doc, int precision=17)
Exports the rectangle to GML2 Box. 
 
QDomElement documentElement() const
 
QDomElement toOgcFilter(const QgsSQLStatement::Node *node)
Convert a SQL statement to a OGC filter. 
 
NodeType nodeType() const
 
NodeTableDef * tableDef() const
Table definition. 
 
Node * node() const
Variable at the left of BETWEEN. 
 
QString & remove(int position, int n)
 
QDomElement createElementNS(const QString &nsURI, const QString &qName)
 
Binary logical/arithmetical operator (AND, OR, =, +, ...) 
 
void setNamedColor(const QString &name)
 
double toDouble(bool *ok) const
 
Node * opLeft() const
Left operand. 
 
int wkbSize() const
Returns the size of the WKB in asWkb(). 
 
QString tr(const char *sourceText, const char *disambiguation, int n)
 
QString name() const
Return function name. 
 
QgsOgcUtilsSQLStatementToFilter(QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, QgsOgcUtils::FilterVersion filterVersion, const QList< QgsOgcUtils::LayerProperties > &layerProperties, bool honourAxisOrientation, bool invertAxisOrientation, const QMap< QString, QString > &mapUnprefixedTypenameToPrefixedTypename)
Constructor. 
 
static QMap< QString, QString > binarySpatialOpsMap()
 
static QgsRectangle rectangleFromGMLBox(const QDomNode &boxNode)
Read rectangle from GML2 Box. 
 
QDomNode nextSibling() const
 
QDomNode importNode(const QDomNode &importedNode, bool deep)
 
QList< QString > usingColumns() const
Columns referenced by USING. 
 
static QgsRectangle rectangleFromGMLEnvelope(const QDomNode &envelopeNode)
Read rectangle from GML3 Envelope. 
 
const Node * rootNode() const
Returns root node of the expression. Root node is null is parsing has failed. 
 
QDomElement toElement() const
 
bool GMLNamespaceUsed() const
Return whether the gml: namespace is used. 
 
static const QList< Function * > & Functions()
 
static int binaryOperatorFromTagName(const QString &tagName)
 
int indexIn(const QString &str, int offset, CaretMode caretMode) const
 
bool isNotIn() const
Whether this is a NOT IN operator. 
 
static bool isBinaryOperator(const QString &tagName)
 
static const char * UnaryOperatorText[]
 
Class for parsing SQL statements. 
 
QString number(int n, int base)
 
int count(const T &value) const
 
void append(const T &value)
 
static const QString GML_NAMESPACE
 
Node * opRight() const
Right operand. 
 
QString name() const
Table name. 
 
int toInt(bool *ok) const
 
QString alias() const
Table alias. 
 
static int functionIndex(const QString &name)
return index of the function in Functions array 
 
bool hasAttribute(const QString &name) const
 
static QString mapTernarySpatialToOgc(const QString &name)
 
void setAttribute(const QString &name, const QString &value)
 
static QgsGeometry * geometryFromGML(const QString &xmlString)
Static method that creates geometry from GML. 
 
int toInt(bool *ok, int base) const
 
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double. 
 
void setYMinimum(double y)
Set the minimum y value. 
 
Literal value (integer, integer64, double, string) 
 
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
 
Node * where() const
Return the where clause. 
 
QString name() const
The name of the column. 
 
Internal use by QgsOgcUtils. 
 
Node * node() const
Variable at the left of IN. 
 
QString name() const
The name of the function. 
 
Unary logicial/arithmetical operator ( NOT, - ) 
 
const unsigned char * asWkb() const
Returns the buffer containing this geometry in WKB format. 
 
const Node * rootNode() const
Returns root node of the statement. Root node is null is parsing has failed. 
 
BinaryOperator
list of binary operators 
 
QList< Node * > list()
Return list. 
 
static bool isBinarySpatialOperator(const QString &fnName)
 
QString mSRSName
SRS name. 
 
static QString tagNameForSpatialOperator(const QString &fnName)
 
A class to represent a point. 
 
bool hasChildNodes() const
 
bool isNotBetween() const
Whether this is a NOT BETWEEN operator. 
 
static const QMap< QString, int > & binaryOperatorsTagNamesMap()
 
BinaryOperator op() const
 
FilterVersion
OGC filter version. 
 
QDomText createTextNode(const QString &value)
 
QDomNode removeChild(const QDomNode &oldChild)
 
BinaryOperator op() const
Operator. 
 
NodeList * args() const
Return arguments. 
 
'X BETWEEN y and z' operator 
 
double yMinimum() const
Get the y minimum value (bottom side of rectangle) 
 
double xMaximum() const
Get the x maximum value (right side of rectangle) 
 
static const QString OGC_NAMESPACE
 
const QString & errorMessage() const
Return the error message. 
 
QVariant value() const
The value of the literal. 
 
const Key key(const T &value) const
 
Node * minVal() const
Minimum bound. 
 
static bool isSpatialOperator(const QString &tagName)
 
QString & replace(int position, int n, QChar after)
 
QString name() const
The name of the column. 
 
const_iterator constBegin() const
 
void save(QTextStream &str, int indent) const
 
static QDomElement SQLStatementToOgcFilter(const QgsSQLStatement &statement, QDomDocument &doc, GMLVersion gmlVersion, FilterVersion filterVersion, const QList< LayerProperties > &layerProperties, bool honourAxisOrientation, bool invertAxisOrientation, const QMap< QString, QString > &mapUnprefixedTypenameToPrefixedTypename, QString *errorMessage=nullptr)
Creates OGC filter XML element from the WHERE and JOIN clauses of a SQL statement. 
 
QDomNode firstChild() const
 
QString mid(int position, int n) const
 
static const char * UnaryOperatorText[]
 
BinaryOperator
list of binary operators 
 
QDomElement expressionNodeToOgcFilter(const QgsExpression::Node *node)
Convert an expression to a OGC filter. 
 
QDomNode cloneNode(bool deep) const
 
void setYMaximum(double y)
Set the maximum y value. 
 
static QDomElement expressionToOgcFilter(const QgsExpression &exp, QDomDocument &doc, QString *errorMessage=nullptr)
Creates OGC filter XML element. 
 
static QDomElement expressionToOgcExpression(const QgsExpression &exp, QDomDocument &doc, QString *errorMessage=nullptr)
Creates an OGC expression XML element. 
 
QDomAttr setAttributeNode(const QDomAttr &newAttr)
 
QList< NodeTableDef * > tables() const
Return the list of tables. 
 
QVariant value() const
The value of the literal. 
 
QDomElement firstChildElement(const QString &tagName) const
 
Class for storing a coordinate reference system (CRS) 
 
static QgsExpression * expressionFromOgcFilter(const QDomElement &element)
Parse XML with OGC filter into QGIS expression. 
 
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
 
static QgsGeometry * fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle. 
 
static QDomElement rectangleToGMLEnvelope(QgsRectangle *env, QDomDocument &doc, int precision=17)
Exports the rectangle to GML3 Envelope. 
 
double xMinimum() const
Get the x minimum value (left side of rectangle) 
 
static QgsGeometry * geometryFromConstExpr(const QgsExpression::Node *node)
 
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
 
static QString binaryOperatorToTagName(QgsExpression::BinaryOperator op)
 
QString mGeometryAttribute
Geometry attribute name. 
 
static QColor colorFromOgcFill(const QDomElement &fillElement)
Parse XML with OGC fill into QColor. 
 
void push_back(const T &value)
 
void setAlphaF(qreal alpha)
 
QString tableName() const
The name of the table. 
 
double yMaximum() const
Get the y maximum value (top side of rectangle) 
 
double toDouble(bool *ok) const
 
iterator insert(const Key &key, const T &value)
 
int params() const
The number of parameters this function takes. 
 
void append(Node *node)
Takes ownership of the provided node. 
 
QgsWKBTypes::Type readHeader() const
 
static QgsGeometry * fromWkt(const QString &wkt)
Creates a new geometry from a WKT string. 
 
void normalize()
Normalize the rectangle so it has non-negative width/height. 
 
const_iterator constEnd() const
 
QDomElement createElement(const QString &tagName)
 
const_iterator constBegin() const
 
UnaryOperator op() const
Operator. 
 
Node * maxVal() const
Maximum bound. 
 
'x IN (y, z)' operator 
 
int compare(const QString &other) const
 
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
 
The QgsOgcUtils class provides various utility functions for conversion between OGC (Open Geospatial ...
 
static QgsCRSCache * instance()
Returns a pointer to the QgsCRSCache singleton. 
 
static QDomElement geometryToGML(const QgsGeometry *geometry, QDomDocument &doc, GMLVersion gmlVersion, const QString &srsName, bool invertAxisOrientation, const QString &gmlIdBase, int precision=17)
Exports the geometry to GML. 
 
void setXMinimum(double x)
Set the minimum x value. 
 
NodeList * list() const
Values list. 
 
QDomNode at(int index) const
 
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
 
QList< NodeJoin * > joins() const
Return the list of joins. 
 
bool axisInverted() const
Returns whether axis is inverted (eg. 
 
const T value(const Key &key) const
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable. 
 
static const char * BinaryOperatorText[]