19 #include <QDomDocument> 54 QRegExp rx(
"([-+]?\\d?\\.?\\d+\\s+\\S+)", Qt::CaseInsensitive );
58 while (( pos = rx.indexIn(
string, pos ) ) != -1 )
61 pos += rx.matchedLength();
64 QMap<int, QStringList> map;
65 map.insert( 1, QStringList() <<
"second" <<
"seconds" <<
QObject::tr(
"second|seconds",
"list of words separated by | which reference years" ).split(
"|" ) );
66 map.insert( 0 + MINUTE, QStringList() <<
"minute" <<
"minutes" <<
QObject::tr(
"minute|minutes",
"list of words separated by | which reference minutes" ).split(
"|" ) );
67 map.insert( 0 + HOUR, QStringList() <<
"hour" <<
"hours" <<
QObject::tr(
"hour|hours",
"list of words separated by | which reference minutes hours" ).split(
"|" ) );
68 map.insert( 0 + DAY, QStringList() <<
"day" <<
"days" <<
QObject::tr(
"day|days",
"list of words separated by | which reference days" ).split(
"|" ) );
69 map.insert( 0 + WEEKS, QStringList() <<
"week" <<
"weeks" <<
QObject::tr(
"week|weeks",
"wordlist separated by | which reference weeks" ).split(
"|" ) );
70 map.insert( 0 + MONTHS, QStringList() <<
"month" <<
"months" <<
QObject::tr(
"month|months",
"list of words separated by | which reference months" ).split(
"|" ) );
71 map.insert( 0 + YEARS, QStringList() <<
"year" <<
"years" <<
QObject::tr(
"year|years",
"list of words separated by | which reference years" ).split(
"|" ) );
73 foreach ( QString match, list )
75 QStringList split = match.split( QRegExp(
"\\s+" ) );
77 double value = split.at( 0 ).toDouble( &ok );
84 foreach (
int duration, map.keys() )
86 foreach ( QString name, map[duration] )
88 if ( match.contains( name, Qt::CaseInsensitive ) )
97 seconds += value * duration;
112 return ( mSeconds == other.mSeconds );
146 case False:
return 0;
154 #define TVL_True QVariant(1) 155 #define TVL_False QVariant(0) 156 #define TVL_Unknown QVariant() 163 if ( v.type() == QVariant::Int )
return true;
164 if ( v.type() == QVariant::UInt )
return true;
165 if ( v.type() == QVariant::LongLong )
return true;
166 if ( v.type() == QVariant::ULongLong )
return true;
167 if ( v.type() == QVariant::Double )
return false;
168 if ( v.type() == QVariant::String ) {
bool ok; v.toString().toInt( &ok );
return ok; }
173 if ( v.type() == QVariant::Double )
return true;
174 if ( v.type() == QVariant::Int )
return true;
175 if ( v.type() == QVariant::UInt )
return true;
176 if ( v.type() == QVariant::LongLong )
return true;
177 if ( v.type() == QVariant::ULongLong )
return true;
178 if ( v.type() == QVariant::String )
181 double val = v.toString().toDouble( &ok );
182 ok = ok && qIsFinite( val ) && !qIsNaN( val );
190 return v.type() == QVariant::DateTime || v.type() == QVariant::Date ||
191 v.type() == QVariant::Time;
201 if ( v.type() == QVariant::String )
208 inline bool isNull(
const QVariant& v ) {
return v.isNull(); }
213 #define ENSURE_NO_EVAL_ERROR { if (parent->hasEvalError()) return QVariant(); } 214 #define SET_EVAL_ERROR(x) { parent->setEvalErrorString(x); return QVariant(); } 223 "=",
"<>",
"<=",
">=",
"<",
">",
"~",
"LIKE",
"NOT LIKE",
"ILIKE",
"NOT ILIKE",
"IS",
"IS NOT",
224 "+",
"-",
"*",
"/",
"//",
"%",
"^",
240 return value.toString();
246 double x = value.toDouble( &ok );
247 if ( !ok || qIsNaN( x ) || !qIsFinite( x ) )
258 qint64 x = value.toLongLong( &ok );
272 QDateTime d = value.toDateTime();
286 QDate d = value.toDate();
300 QTime t = value.toTime();
318 if ( inter.isValid() )
360 if ( value.isNull() )
363 if ( value.type() == QVariant::Int )
364 return value.toInt() != 0 ?
True :
False;
367 double x = value.toDouble( &ok );
381 return QVariant( sqrt( x ) );
387 return QVariant( fabs( val ) );
393 return QVariant( sin( x ) );
398 return QVariant( cos( x ) );
403 return QVariant( tan( x ) );
408 return QVariant( asin( x ) );
413 return QVariant( acos( x ) );
418 return QVariant( atan( x ) );
424 return QVariant( atan2( y, x ) );
429 return QVariant( exp( x ) );
436 return QVariant( log( x ) );
443 return QVariant( log10( x ) );
449 if ( x <= 0 || b <= 0 )
451 return QVariant( log( x ) / log( b ) );
461 double f = ( double )qrand() / RAND_MAX;
462 return QVariant( min + f * ( max - min ) );
472 return QVariant( min + ( qrand() % (
int )( max - min + 1 ) ) );
483 if ( domainMin >= domainMax )
490 if ( val >= domainMax )
494 else if ( val <= domainMin )
500 double m = ( rangeMax - rangeMin ) / ( domainMax - domainMin );
501 double c = rangeMin - ( domainMin * m );
504 return QVariant( m * val + c );
516 if ( domainMin >= domainMax )
528 if ( val >= domainMax )
532 else if ( val <= domainMin )
538 return QVariant((( rangeMax - rangeMin ) / pow( domainMax - domainMin, exponent ) ) * pow( val - domainMin, exponent ) + rangeMin );
547 for (
int i = 1; i < values.length(); ++i )
550 if ( testVal > maxVal )
556 return QVariant( maxVal );
565 for (
int i = 1; i < values.length(); ++i )
568 if ( testVal < minVal )
574 return QVariant( minVal );
584 if ( testValue <= minValue )
586 return QVariant( minValue );
588 else if ( testValue >= maxValue )
590 return QVariant( maxValue );
594 return QVariant( testValue );
601 return QVariant( floor( x ) );
607 return QVariant( ceil( x ) );
612 return QVariant(
getIntValue( values.at( 0 ), parent ) );
630 foreach (
const QVariant &value, values )
632 if ( value.isNull() )
641 return QVariant( str.toLower() );
646 return QVariant( str.toUpper() );
651 QStringList elems = str.split(
" " );
652 for (
int i = 0; i < elems.size(); i++ )
654 if ( elems[i].size() > 1 )
655 elems[i] = elems[i].left( 1 ).toUpper() + elems[i].mid( 1 ).toLower();
657 return QVariant( elems.join(
" " ) );
663 return QVariant( str.trimmed() );
668 if ( values.length() == 2 || values.length() == 3 )
673 if ( !str.isEmpty() && wrap != 0 )
676 QString delimiterstr;
677 if ( values.length() == 3 ) delimiterstr =
getStringValue( values.at( 2 ), parent );
678 if ( delimiterstr.isEmpty() ) delimiterstr =
" ";
679 int delimiterlength = delimiterstr.length();
681 QStringList lines = str.split(
"\n" );
682 int strlength, strcurrent, strhit, lasthit;
684 for (
int i = 0; i < lines.size(); i++ )
686 strlength = lines[i].length();
691 while ( strcurrent < strlength )
698 strhit = lines[i].lastIndexOf( delimiterstr, strcurrent + wrap );
699 if ( strhit == lasthit || strhit == -1 )
702 strhit = lines[i].indexOf( delimiterstr, strcurrent + qAbs( wrap ) );
708 strhit = lines[i].indexOf( delimiterstr, strcurrent + qAbs( wrap ) );
712 newstr.append( lines[i].midRef( strcurrent, strhit - strcurrent ) );
713 newstr.append(
"\n" );
714 strcurrent = strhit + delimiterlength;
718 newstr.append( lines[i].midRef( strcurrent ) );
719 strcurrent = strlength;
722 if ( i < lines.size() - 1 ) newstr.append(
"\n" );
725 return QVariant( newstr );
735 return QVariant( str.length() );
742 return QVariant( str.replace( before, after ) );
750 QRegExp re( regexp );
756 return QVariant( str.replace( re, after ) );
764 QRegExp re( regexp );
770 return QVariant( str.contains( re ) ? 1 : 0 );
778 QRegExp re( regexp );
786 ( void )re.indexIn( str );
787 if ( re.captureCount() > 0 )
790 return QVariant( re.capturedTexts()[1] );
794 return QVariant(
"" );
800 return QUuid::createUuid().toString();
808 return QVariant( str.mid( from -1, len ) );
819 return f ? QVariant((
int )f->
id() ) : QVariant();
824 return f ? QVariant::fromValue( *f ) : QVariant();
836 foreach (
const QVariant &value, values )
846 return string.indexOf( QRegExp(
getStringValue( values.at( 1 ), parent ) ) );
853 return string.right( pos );
860 return string.left( pos );
866 int length =
getIntValue( values.at( 1 ), parent );
868 return string.leftJustified( length, fill.at( 0 ), true );
874 int length =
getIntValue( values.at( 1 ), parent );
876 return string.rightJustified( length, fill.at( 0 ), true );
882 for (
int n = 1; n < values.length(); n++ )
892 return QVariant( QDateTime::currentDateTime() );
897 return QVariant(
getDateValue( values.at( 0 ), parent ) );
902 return QVariant(
getTimeValue( values.at( 0 ), parent ) );
907 return QVariant::fromValue(
getInterval( values.at( 0 ), parent ) );
920 QVariant value = values.at( 0 );
924 return QVariant( inter.
days() );
929 return QVariant( d1.date().day() );
935 QVariant value = values.at( 0 );
939 return QVariant( inter.
years() );
944 return QVariant( d1.date().year() );
950 QVariant value = values.at( 0 );
954 return QVariant( inter.
months() );
959 return QVariant( d1.date().month() );
965 QVariant value = values.at( 0 );
969 return QVariant( inter.
weeks() );
974 return QVariant( d1.date().weekNumber() );
980 QVariant value = values.at( 0 );
984 return QVariant( inter.
hours() );
989 return QVariant( d1.time().hour() );
995 QVariant value = values.at( 0 );
999 return QVariant( inter.
minutes() );
1004 return QVariant( d1.time().minute() );
1010 QVariant value = values.at( 0 );
1014 return QVariant( inter.
seconds() );
1019 return QVariant( d1.time().second() );
1024 #define ENSURE_GEOM_TYPE(f, g, geomtype) if (!f) return QVariant(); \ 1025 QgsGeometry* g = f->geometry(); \ 1026 if (!g || g->type() != geomtype) return QVariant(); 1032 if ( g->isMultipart() )
1034 return g->asMultiPoint()[ 0 ].x();
1038 return g->asPoint().x();
1044 if ( g->isMultipart() )
1046 return g->asMultiPoint()[ 0 ].y();
1050 return g->asPoint().y();
1060 idx += polyline.count();
1062 if ( idx < 0 || idx >= polyline.count() )
1067 return QVariant( QPointF( polyline[idx].x(), polyline[idx].y() ) );
1072 QVariant v =
pointAt( values, f, parent );
1073 if ( v.type() == QVariant::PointF )
1074 return QVariant( v.toPointF().x() );
1080 QVariant v =
pointAt( values, f, parent );
1081 if ( v.type() == QVariant::PointF )
1082 return QVariant( v.toPointF().y() );
1090 return QVariant::fromValue( *geom );
1098 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1106 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1134 QVariant result = geomBounds ? QVariant::fromValue( *geomBounds ) : QVariant();
1225 if ( values.length() < 2 || values.length() > 3 )
1231 if ( values.length() == 3 )
1235 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1243 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1251 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1260 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1268 return QVariant( fGeom.
distance( sGeom ) );
1275 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1284 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1293 QVariant result = geom ? QVariant::fromValue( *geom ) : QVariant();
1299 if ( values.length() < 1 || values.length() > 2 )
1304 if ( values.length() == 2 )
1307 return QVariant( wkt );
1313 if ( values.length() == 2 )
1316 double scaler = pow( 10.0,
getIntValue( values.at( 1 ), parent ) );
1317 return QVariant( qRound( number * scaler ) / scaler );
1320 if ( values.length() == 1 )
1322 double number =
getIntValue( values.at( 0 ), parent );
1323 return QVariant( qRound( number ) ).toInt();
1339 return QVariant( parent->
scale() );
1345 int places =
getIntValue( values.at( 1 ), parent );
1351 return QString(
"%L1" ).arg( value, 0,
'f', places );
1358 return dt.toString( format );
1364 int green =
getIntValue( values.at( 1 ), parent );
1366 QColor color = QColor( red, green, blue );
1367 if ( ! color.isValid() )
1370 color = QColor( 0, 0, 0 );
1373 return QString(
"%1,%2,%3" ).arg( color.red() ).arg( color.green() ).arg( color.blue() );
1380 QVariant value = node->
eval( parent, f );
1382 if ( value.toBool() )
1384 node =
getNode( values.at( 1 ), parent );
1386 value = node->
eval( parent, f );
1391 node =
getNode( values.at( 2 ), parent );
1393 value = node->
eval( parent, f );
1402 int green =
getIntValue( values.at( 1 ), parent );
1404 int alpha =
getIntValue( values.at( 3 ), parent );
1405 QColor color = QColor( red, green, blue, alpha );
1406 if ( ! color.isValid() )
1409 color = QColor( 0, 0, 0 );
1421 return QColor( 0, 0, 0 ).name();
1424 QColor color = mRamp->color( value );
1431 double hue =
getIntValue( values.at( 0 ), parent ) / 360.0;
1433 double saturation =
getIntValue( values.at( 1 ), parent ) / 100.0;
1435 double lightness =
getIntValue( values.at( 2 ), parent ) / 100.0;
1437 QColor color = QColor::fromHslF( hue, saturation, lightness );
1439 if ( ! color.isValid() )
1442 color = QColor( 0, 0, 0 );
1445 return QString(
"%1,%2,%3" ).arg( color.red() ).arg( color.green() ).arg( color.blue() );
1451 double hue =
getIntValue( values.at( 0 ), parent ) / 360.0;
1453 double saturation =
getIntValue( values.at( 1 ), parent ) / 100.0;
1455 double lightness =
getIntValue( values.at( 2 ), parent ) / 100.0;
1457 double alpha =
getIntValue( values.at( 3 ), parent ) / 255.0;
1459 QColor color = QColor::fromHslF( hue, saturation, lightness, alpha );
1460 if ( ! color.isValid() )
1462 parent->
setEvalErrorString(
QObject::tr(
"Cannot convert '%1:%2:%3:%4' to color" ).arg( hue ).arg( saturation ).arg( lightness ).arg( alpha ) );
1463 color = QColor( 0, 0, 0 );
1471 double hue =
getIntValue( values.at( 0 ), parent ) / 360.0;
1473 double saturation =
getIntValue( values.at( 1 ), parent ) / 100.0;
1475 double value =
getIntValue( values.at( 2 ), parent ) / 100.0;
1477 QColor color = QColor::fromHsvF( hue, saturation, value );
1479 if ( ! color.isValid() )
1482 color = QColor( 0, 0, 0 );
1485 return QString(
"%1,%2,%3" ).arg( color.red() ).arg( color.green() ).arg( color.blue() );
1491 double hue =
getIntValue( values.at( 0 ), parent ) / 360.0;
1493 double saturation =
getIntValue( values.at( 1 ), parent ) / 100.0;
1495 double value =
getIntValue( values.at( 2 ), parent ) / 100.0;
1497 double alpha =
getIntValue( values.at( 3 ), parent ) / 255.0;
1499 QColor color = QColor::fromHsvF( hue, saturation, value, alpha );
1500 if ( ! color.isValid() )
1502 parent->
setEvalErrorString(
QObject::tr(
"Cannot convert '%1:%2:%3:%4' to color" ).arg( hue ).arg( saturation ).arg( value ).arg( alpha ) );
1503 color = QColor( 0, 0, 0 );
1511 double cyan =
getIntValue( values.at( 0 ), parent ) / 100.0;
1513 double magenta =
getIntValue( values.at( 1 ), parent ) / 100.0;
1515 double yellow =
getIntValue( values.at( 2 ), parent ) / 100.0;
1517 double black =
getIntValue( values.at( 3 ), parent ) / 100.0;
1519 QColor color = QColor::fromCmykF( cyan, magenta, yellow, black );
1521 if ( ! color.isValid() )
1524 color = QColor( 0, 0, 0 );
1527 return QString(
"%1,%2,%3" ).arg( color.red() ).arg( color.green() ).arg( color.blue() );
1533 double cyan =
getIntValue( values.at( 0 ), parent ) / 100.0;
1535 double magenta =
getIntValue( values.at( 1 ), parent ) / 100.0;
1537 double yellow =
getIntValue( values.at( 2 ), parent ) / 100.0;
1539 double black =
getIntValue( values.at( 3 ), parent ) / 100.0;
1541 double alpha =
getIntValue( values.at( 4 ), parent ) / 255.0;
1543 QColor color = QColor::fromCmykF( cyan, magenta, yellow, black, alpha );
1544 if ( ! color.isValid() )
1546 parent->
setEvalErrorString(
QObject::tr(
"Cannot convert '%1:%2:%3:%4:%5' to color" ).arg( cyan ).arg( magenta ).arg( yellow ).arg( black ).arg( alpha ) );
1547 color = QColor( 0, 0, 0 );
1563 return QVariant::fromValue( *geom );
1574 if ( ! s.createFromOgcWmsCrs( sAuthId ) )
1575 return QVariant::fromValue( fGeom );
1578 return QVariant::fromValue( fGeom );
1582 return QVariant::fromValue( fGeom );
1594 if ( layersByName.size() > 0 )
1607 int attributeId = vl->fieldNameIndex( attribute );
1608 if ( attributeId == -1 )
1613 const QVariant& attVal = values.at( 2 );
1624 if ( fet.
attribute( attributeId ) == attVal )
1626 return QVariant::fromValue( fet );
1668 <<
"abs" <<
"sqrt" <<
"cos" <<
"sin" <<
"tan" 1669 <<
"asin" <<
"acos" <<
"atan" <<
"atan2" 1670 <<
"exp" <<
"ln" <<
"log10" <<
"log" 1671 <<
"round" <<
"rand" <<
"randf" <<
"max" <<
"min" <<
"clamp" 1672 <<
"scale_linear" <<
"scale_exp" <<
"floor" <<
"ceil" 1673 <<
"toint" <<
"toreal" <<
"tostring" 1674 <<
"todatetime" <<
"todate" <<
"totime" <<
"tointerval" 1675 <<
"coalesce" <<
"regexp_match" <<
"$now" <<
"age" <<
"year" 1676 <<
"month" <<
"week" <<
"day" <<
"hour" 1677 <<
"minute" <<
"second" <<
"lower" <<
"upper" 1678 <<
"title" <<
"length" <<
"replace" <<
"trim" <<
"wordwrap" 1679 <<
"regexp_replace" <<
"regexp_substr" 1680 <<
"substr" <<
"concat" <<
"strpos" <<
"left" 1681 <<
"right" <<
"rpad" <<
"lpad" 1682 <<
"format_number" <<
"format_date" 1683 <<
"color_rgb" <<
"color_rgba" <<
"ramp_color" 1684 <<
"color_hsl" <<
"color_hsla" <<
"color_hsv" <<
"color_hsva" 1685 <<
"color_cymk" <<
"color_cymka" 1686 <<
"xat" <<
"yat" <<
"$area" 1687 <<
"$length" <<
"$perimeter" <<
"$x" <<
"$y" 1688 <<
"$rownum" <<
"$id" <<
"$scale" <<
"_specialcol_";
1867 static bool initialized =
false;
1875 QList< QPair<QString, QString> > lst;
1876 lst << qMakePair( QString(
"$page" ), QString(
"Composer" ) );
1877 lst << qMakePair( QString(
"$feature" ), QString(
"Atlas" ) );
1878 lst << qMakePair( QString(
"$numpages" ), QString(
"Composer" ) );
1879 lst << qMakePair( QString(
"$numfeatures" ), QString(
"Atlas" ) );
1880 lst << qMakePair( QString(
"$atlasfeatureid" ), QString(
"Atlas" ) );
1881 lst << qMakePair( QString(
"$atlasgeometry" ), QString(
"Atlas" ) );
1882 lst << qMakePair( QString(
"$atlasfeature" ), QString(
"Atlas" ) );
1883 lst << qMakePair( QString(
"$map" ), QString(
"Composer" ) );
1885 QList< QPair<QString, QString> >::const_iterator it = lst.constBegin();
1886 for ( ; it != lst.constEnd(); ++it )
1910 QList<Function*> defs;
1922 return QString(
"\"%1\"" ).arg( name.replace(
"\"",
"\"\"" ) );
1927 text.replace(
"'",
"''" );
1928 text.replace(
'\\',
"\\\\" );
1929 text.replace(
'\n',
"\\n" );
1930 text.replace(
'\t',
"\\t" );
1931 return QString(
"'%1'" ).arg( text );
1942 for (
int i = 0; i < count; i++ )
1944 if ( QString::compare( name,
Functions()[i]->name(), Qt::CaseInsensitive ) == 0 )
1977 return QStringList();
1982 for (
int i = 0; i < columns.count(); i++ )
1984 QString col = columns.at( i );
1985 for (
int j = i + 1; j < columns.count(); j++ )
1987 if ( QString::compare( col, columns[j], Qt::CaseInsensitive ) == 0 )
1990 columns.removeAt( j-- );
2072 const QMap<QString, QVariant> *substitutionMap,
const QgsDistanceArea *distanceArea )
2074 QString expr_action;
2076 QMap<QString, QVariant> savedValues;
2077 if ( substitutionMap )
2080 for ( QMap<QString, QVariant>::const_iterator sit = substitutionMap->begin(); sit != substitutionMap->end(); ++sit )
2083 if ( !oldValue.isNull() )
2084 savedValues.insert( sit.key(), oldValue );
2092 while ( index < action.size() )
2094 QRegExp rx = QRegExp(
"\\[%([^\\]]+)%\\]" );
2096 int pos = rx.indexIn( action, index );
2101 index = pos + rx.matchedLength();
2102 QString to_replace = rx.cap( 1 ).trimmed();
2109 expr_action += action.mid( start, index - start );
2131 expr_action += action.mid( start, index - start );
2135 QgsDebugMsg(
"Expression result is: " + result.toString() );
2136 expr_action += action.mid( start, pos - start ) + result.toString();
2139 expr_action += action.mid( index );
2142 for ( QMap<QString, QVariant>::const_iterator sit = savedValues.begin(); sit != savedValues.end(); ++sit )
2154 double convertedValue = text.toDouble( &ok );
2157 return convertedValue;
2163 convertedValue = result.toDouble( &ok );
2166 return fallbackValue;
2168 return convertedValue;
2177 QString msg;
bool first =
true;
2178 foreach (
Node* n, mList )
2180 if ( !first ) msg +=
", ";
else first =
false;
2191 QVariant val = mOperand->eval( parent, f );
2212 Q_ASSERT( 0 &&
"unknown unary operation" );
2219 return mOperand->prepare( parent, fields );
2224 return QString(
"%1 %2" ).arg(
UnaryOperatorText[mOp] ).arg( mOperand->dump() );
2231 QVariant vL = mOpLeft->eval( parent, f );
2233 QVariant vR = mOpRight->eval( parent, f );
2239 if ( vL.type() == QVariant::String && vR.type() == QVariant::String )
2243 return QVariant( sL + sR );
2259 if ( mOp ==
boMod && iR == 0 )
2262 return QVariant( computeInt( iL, iR ) );
2273 return QVariant( computeDateTimeFromInterval( dL, &iL ) );
2280 if (( mOp ==
boDiv || mOp ==
boMod ) && fR == 0. )
2282 return QVariant( computeDouble( fL, fR ) );
2292 return QVariant( qFloor( fL / fR ) );
2301 return QVariant( pow( fL, fR ) );
2340 int diff = QString::compare( sL, sR );
2363 equal = QString::compare( sL, sR ) == 0;
2386 QString esc_regexp = QRegExp::escape( regexp );
2388 esc_regexp.replace(
"%",
".*" );
2389 esc_regexp.replace(
"_",
"." );
2390 matches = QRegExp( esc_regexp, mOp ==
boLike || mOp ==
boNotLike ? Qt::CaseSensitive : Qt::CaseInsensitive ).exactMatch( str );
2394 matches = QRegExp( regexp ).indexIn( str ) != -1;
2412 return QVariant( sL + sR );
2425 case boEQ:
return diff == 0;
2426 case boNE:
return diff != 0;
2427 case boLT:
return diff < 0;
2428 case boGT:
return diff > 0;
2429 case boLE:
return diff <= 0;
2430 case boGE:
return diff >= 0;
2431 default: Q_ASSERT(
false );
return false;
2441 case boMul:
return x*y;
2442 case boDiv:
return x/y;
2443 case boMod:
return x%y;
2444 default: Q_ASSERT(
false );
return 0;
2454 default: Q_ASSERT(
false );
return QDateTime();
2464 case boMul:
return x*y;
2465 case boDiv:
return x/y;
2466 case boMod:
return fmod( x,y );
2467 default: Q_ASSERT(
false );
return 0;
2474 bool resL = mOpLeft->prepare( parent, fields );
2475 bool resR = mOpRight->prepare( parent, fields );
2476 return resL && resR;
2521 Q_ASSERT( 0 &&
"unexpected binary operator" );
2531 fmt += lOp && lOp->
precedence() < precedence() ?
"(%1)" :
"%1";
2533 fmt += rOp && rOp->
precedence() <= precedence() ?
"(%3)" :
"%3";
2535 return fmt.arg( mOpLeft->dump() ).arg(
BinaryOperatorText[mOp] ).arg( mOpRight->dump() );
2542 if ( mList->count() == 0 )
2544 QVariant v1 = mNode->eval( parent, f );
2549 bool listHasNull =
false;
2551 foreach (
Node* n, mList->list() )
2553 QVariant v2 = n->
eval( parent, f );
2571 equal = QString::compare( s1, s2 ) == 0;
2588 bool res = mNode->prepare( parent, fields );
2589 foreach (
Node* n, mList->list() )
2591 res = res && n->
prepare( parent, fields );
2598 return QString(
"%1 IN (%2)" ).arg( mNode->dump() ).arg( mList->dump() );
2608 QVariantList argValues;
2611 foreach (
Node* n, mArgs->list() )
2617 v = QVariant::fromValue( n );
2621 v = n->
eval( parent, f );
2623 if (
isNull( v ) && fd->
name() !=
"coalesce" )
2626 argValues.append( v );
2631 QVariant res = fd->
func( argValues, f, parent );
2643 foreach (
Node* n, mArgs->list() )
2645 res = res && n->
prepare( parent, fields );
2657 return QString(
"%1(%2)" ).arg( fd->
name() ).arg( mArgs ? mArgs->dump() : QString() );
2668 return functionColumns;
2671 foreach (
Node* n, mArgs->list() )
2677 return functionColumns.toSet().toList();
2695 if ( mValue.isNull() )
2698 switch ( mValue.type() )
2700 case QVariant::Int:
return QString::number( mValue.toInt() );
2701 case QVariant::Double:
return QString::number( mValue.toDouble() );
2702 case QVariant::String:
return quotedString( mValue.toString() );
2703 default:
return QObject::tr(
"[unsupported type;%1; value:%2]" ).arg( mValue.typeName() ).arg( mValue.toString() );
2718 return QVariant(
"[" + mName +
"]" );
2723 for (
int i = 0; i < fields.
count(); ++i )
2725 if ( QString::compare( fields[i].name(), mName, Qt::CaseInsensitive ) == 0 )
2738 return QRegExp(
"^[A-Za-z_\x80-\xff][A-Za-z0-9_\x80-\xff]*$" ).exactMatch( mName ) ? mName :
quotedColumnRef( mName );
2745 foreach (
WhenThen* cond, mConditions )
2760 QVariant vElse = mElseExp->eval( parent, f );
2772 foreach (
WhenThen* cond, mConditions )
2776 if ( !res )
return false;
2780 return mElseExp->prepare( parent, fields );
2787 QString msg = QString(
"CASE" );
2788 foreach (
WhenThen* cond, mConditions )
2793 msg += QString(
" ELSE %1" ).arg( mElseExp->dump() );
2794 msg += QString(
" END" );
2801 foreach (
WhenThen* cond, mConditions )
2807 lst += mElseExp->referencedColumns();
2814 foreach (
WhenThen* cond, mConditions )
2821 if ( mElseExp && mElseExp->needsGeometry() )
2854 return gGroups.value( name, name );
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
QgsFeatureId id() const
Get the feature id for this feature.
static QVariant fcnDifference(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnCombine(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
Class for parsing and evaluation of expressions (formerly called "search strings").
static int functionIndex(QString name)
static QVariant fcnAge(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnColorHsv(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual QStringList referencedColumns() const =0
bool hasEvalError() const
Returns true if an error occurred when evaluating last input.
Wrapper for iterator of features from vector data provider or vector layer.
static QVariant fcnCeil(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnLog10(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnDistance(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsExpression::Interval fromString(QString string)
static QVariant fcnFeatureId(const QVariantList &, const QgsFeature *f, QgsExpression *)
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
virtual QString dump() const override
static QVariant fcnAsin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QStringList referencedColumns() const
Get list of columns referenced by the expression.
static QVariant fcnMin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnTrim(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnLeft(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static bool unregisterFunction(QString name)
static QString quotedColumnRef(QString name)
return quoted column reference (in double quotes)
static QVariant fcnLog(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnYat(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
static QVariant fcnMinute(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnRight(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool lazyEval()
True if this function should use lazy evaluation.
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
QgsGeometry * combine(QgsGeometry *geometry)
Returns a geometry representing all the points in this geometry and other (a union geometry operation...
static QVariant fcnYMax(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnReplace(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QVariant evaluate(const QgsFeature *f=NULL)
Evaluate the feature and return the result.
void initGeomCalculator()
static QVariant fcnTouches(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool compare(double diff)
A abstract base class for defining QgsExpression functions.
bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes.
double yMaximum() const
Get the y maximum value (top side of rectangle)
static QVariant fcnGeomLength(const QVariantList &, const QgsFeature *f, QgsExpression *parent)
static QVariant fcnScale(const QVariantList &, const QgsFeature *, QgsExpression *parent)
double computeDouble(double x, double y)
virtual QString dump() const =0
static QDate getDateValue(const QVariant &value, QgsExpression *parent)
QVector< QgsPoint > QgsPolyline
polyline is represented as a vector of points
static QVariant fcnFloor(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
static QString helptext(QString name)
static QVariant fcnXMin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
static QVariant fcnFormatDate(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnIf(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
static QgsMapLayerRegistry * instance()
QgsExpression()
Used by QgsOgcUtils to create an empty.
static QVariant fcnToTime(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnSqrt(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnIntersects(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnNow(const QVariantList &, const QgsFeature *, QgsExpression *)
QVariant fcnRampColor(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool crosses(const QgsGeometry *geometry) const
Test for if geometry crosses another (uses GEOS)
Container of fields for a vector layer.
static QVariant fcnSin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnContains(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnToInt(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields)=0
QgsExpression::Node * parseExpression(const QString &str, QString &parserErrorMsg)
static QVariant fcnToDateTime(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QString group(QString group)
static QTime getTimeValue(const QVariant &value, QgsExpression *parent)
QString dump() const
Return the expression string that represents this QgsExpression.
bool isDoubleSafe(const QVariant &v)
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static QVariant fcnStrpos(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnYMin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static TVL getTVLValue(const QVariant &value, QgsExpression *parent)
int currentRowNumber()
Return the number used for $rownum special column.
static QVariant fcnBuffer(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static bool isValid(const QString &text, const QgsFields &fields, QString &errorMessage)
QgsGeometry * difference(QgsGeometry *geometry)
Returns a geometry representing the points making up this geometry that do not make up other...
static QVariant fcnYear(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnFormatString(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
int computeInt(int x, int y)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
virtual QString dump() const override
static QVariant fcnToString(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnCrosses(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnToInterval(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QgsGeometry * centroid()
Returns the center of mass of a geometry.
static QVariant fcnTan(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsGeometry getGeometry(const QVariant &value, QgsExpression *parent)
#define ENSURE_NO_EVAL_ERROR
QString mParserErrorString
virtual QString dump() const override
static QVariant fcnLower(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QString encodeColor(QColor color)
static QVariant fcnAbs(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnCos(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnCoalesce(const QVariantList &values, const QgsFeature *, QgsExpression *)
static QVariant fcnCentroid(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static const QStringList & BuiltinFunctions()
static const QList< Function * > & Functions()
static QVariant fcnToReal(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnGetGeometry(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static bool isFunctionName(QString name)
static QVariant fcnIntersection(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool createFromOgcWmsCrs(QString theCrs)
Set up this CRS from the given OGC CRS.
static QHash< QString, QString > gFunctionHelpTexts
static int functionCount()
Returns the number of functions defined in the parser.
virtual bool needsGeometry() const override
void acceptVisitor(Visitor &v) const
entry function for the visitor pattern
bool contains(const QgsPoint *p) const
Test for containment of a point (uses GEOS)
static QVariant fcnTransformGeometry(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
static QVariant fcnAttribute(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnLPad(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant pointAt(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
QgsDistanceArea * geomCalculator()
Return calculator used for distance and area calculations (used by internal functions) ...
static QVariant fcnOverlaps(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnHour(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
const QgsVectorColorRampV2 * colorRampRef(QString name) const
return a const pointer to a symbol (doesn't create new instance)
QgsGeometry * buffer(double distance, int segments)
Returns a buffer region around this geometry having the given width and with a specified number of se...
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
static QVariant fcnFeature(const QVariantList &, const QgsFeature *f, QgsExpression *)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
double xMaximum() const
Get the x maximum value (right side of rectangle)
double measurePerimeter(QgsGeometry *geometry)
measures perimeter of polygon
virtual QString dump() const override
double measure(QgsGeometry *geometry)
general measurement (line distance or polygon area)
static bool registerFunction(Function *function)
static QVariant fcnAtan2(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QgsGeometry * convexHull()
Returns the smallest convex polygon that contains all the points in the geometry. ...
static QVariant fncColorHsla(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsGeometry * geometryFromGML(const QString &xmlString)
static method that creates geometry from GML
#define SET_EVAL_ERROR(x)
bool needsGeometry() const
Returns true if the expression uses feature geometry for some computation.
bool overlaps(const QgsGeometry *geometry) const
Test for if geometry overlaps another (uses GEOS)
static QHash< QString, QString > gGroups
static QgsStyleV2 * defaultStyle()
return default application-wide style
virtual QVariant func(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)=0
bool operator==(const QgsExpression::Interval &other) const
static bool hasSpecialColumn(const QString &name)
Check whether a special column exists.
static QVariant fcnGeomPerimeter(const QVariantList &, const QgsFeature *f, QgsExpression *parent)
virtual QString dump() const override
This class wraps a request for features to a vector layer (or directly its vector data provider)...
static QVariant fcnY(const QVariantList &, const QgsFeature *f, QgsExpression *)
static QVariant fcnRndF(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static const QString AllAttributes
QDateTime computeDateTimeFromInterval(QDateTime d, QgsExpression::Interval *i)
int count() const
Return number of items.
static QVariant fcnGeomToWKT(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnGetFeature(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnSpecialColumn(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QList< Function * > gmFunctions
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
static QVariant fcnWordwrap(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
virtual QString dump() const
static QVariant fcnLength(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QString name()
The name of the function.
static QVariant tvl2variant(TVL v)
#define ENSURE_GEOM_TYPE(f, g, geomtype)
static QVariant fcnMonth(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnTitle(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool isIntervalSafe(const QVariant &v)
QgsGeometry * intersection(QgsGeometry *geometry)
Returns a geometry representing the points shared by this geometry and other.
static QVariant fcnRPad(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static int getIntValue(const QVariant &value, QgsExpression *parent)
static QVariant fcnToDate(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fncColorRgba(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnBbox(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnBoundsWidth(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QList< QgsMapLayer * > mapLayersByName(QString layerName)
Retrieve a pointer to a loaded layer by name.
static QVariant fcnGeomArea(const QVariantList &, const QgsFeature *f, QgsExpression *parent)
static QVariant fcnAcos(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f)=0
static QString getStringValue(const QVariant &value, QgsExpression *)
static QVariant fcnWithin(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsFeature getFeature(const QVariant &value, QgsExpression *parent)
virtual QStringList referencedColumns() const
static QVariant fcnGeometry(const QVariantList &, const QgsFeature *f, QgsExpression *)
void setEvalErrorString(QString str)
Set evaluation error (used internally by evaluation functions)
static double getDoubleValue(const QVariant &value, QgsExpression *parent)
QgsGeometry * symDifference(QgsGeometry *geometry)
Returns a Geometry representing the points making up this Geometry that do not make up other...
static QVariant fcnGeomFromGML(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
General purpose distance and area calculator.
static QMap< QString, QString > gmSpecialColumnGroups
virtual QString dump() const override
QgsRectangle boundingBox()
Returns the bounding box of this feature.
static QVariant fcnBounds(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnWeek(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnRegexpReplace(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool isIntSafe(const QVariant &v)
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
static QVariant fcnConcat(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool isDateTimeSafe(const QVariant &v)
static const char * UnaryOperatorText[]
static QgsExpression::Interval invalidInterVal()
static QVariant fcnXat(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
static QVariant fcnUpper(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnLinearScale(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsExpression::Node * getNode(const QVariant &value, QgsExpression *parent)
static QVariant fncColorHsva(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
static QList< Function * > specialColumns()
Returns a list of special Column definitions.
static QVariant fcnDay(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
int params()
The number of parameters this function takes.
static QVariant fcnX(const QVariantList &, const QgsFeature *f, QgsExpression *)
static QVariant fcnClamp(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
Class for storing a coordinate reference system (CRS)
virtual QStringList referencedColumns() const override
bool within(const QgsGeometry *geometry) const
Test for if geometry is within another (uses GEOS)
virtual bool prepare(QgsExpression *parent, const QgsFields &fields) override
static QVariant fcnRegexpMatch(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnSubstr(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnFormatNumber(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnXMax(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
support for visitor pattern - algorithms dealing with the expressions may be implemented without modi...
static QString quotedString(QString text)
return quoted string (in single quotes)
static QgsGeometry * fromRect(const QgsRectangle &rect)
construct geometry from a rectangle
static QVariant fcnExpScale(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
int transform(const QgsCoordinateTransform &ct)
Transform this geometry as described by CoordinateTransform ct.
static QVariant fcnPi(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
virtual bool needsGeometry() const =0
static QVariant fcnSeconds(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QgsGeometry * fromWkt(QString wkt)
static method that creates geometry from Wkt
void setGeomCalculator(const QgsDistanceArea &calc)
Sets the geometry calculator used in evaluation of expressions,.
static QStringList gmBuiltinFunctions
static QVariant fcnColorHsl(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
virtual QVariant eval(QgsExpression *parent, const QgsFeature *f) override
bool disjoint(const QgsGeometry *geometry) const
Test for if geometry is disjoint of another (uses GEOS)
static QVariant fncColorCmyka(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnUuid(const QVariantList &, const QgsFeature *, QgsExpression *)
bool touches(const QgsGeometry *geometry) const
Test for if geometry touch another (uses GEOS)
static QVariant fcnMax(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant specialColumn(const QString &name)
Return the value of the given special column or a null QVariant if undefined.
static QVariant fcnRowNumber(const QVariantList &, const QgsFeature *, QgsExpression *parent)
static void initFunctionHelp()
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
static QVariant fcnConvexHull(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnRnd(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnColorRgb(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
void setValid(bool valid)
static void setSpecialColumn(const QString &name, QVariant value)
Assign a special column.
static QVariant fcnGeomFromWKT(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool nextFeature(QgsFeature &f)
static QVariant fcnColorCmyk(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnExp(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
Geometry is not required. It may still be returned if e.g. required for a filter condition.
static QVariant fcnAtan(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
double width() const
Width of the rectangle.
bool intersects(const QgsRectangle &r) const
Test for intersection with a rectangle (uses GEOS)
Represents a vector layer which manages a vector based data sets.
static QVariant fcnBoundsHeight(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
QString parserErrorString() const
Returns parser error.
QgsFeatureRequest & setFlags(Flags flags)
Set flags that affect how features will be fetched.
static double evaluateToDouble(const QString &text, const double fallbackValue)
Attempts to evaluate a text string as an expression to a resultant double value.
double xMinimum() const
Get the x minimum value (left side of rectangle)
virtual QStringList referencedColumns() const override
QString evalErrorString() const
Returns evaluation error.
QString exportToWkt(const int &precision=17) const
Exports the geometry to WKT.
virtual void accept(Visitor &v) const =0
static QVariant fcnSymDifference(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
bool isNull(const QVariant &v)
virtual QString dump() const override
static QVariant fcnLn(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnRegexpSubstr(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
static QVariant fcnDisjoint(const QVariantList &values, const QgsFeature *, QgsExpression *parent)
void setEllipsoidalMode(bool flag)
sets whether coordinates must be projected to ellipsoid before measuring
double height() const
Height of the rectangle.
static QgsExpression::Interval getInterval(const QVariant &value, QgsExpression *parent, bool report_error=false)
static QDateTime getDateTimeValue(const QVariant &value, QgsExpression *parent)
static QVariant fcnRound(const QVariantList &values, const QgsFeature *f, QgsExpression *parent)
double distance(QgsGeometry &geom)
static void unsetSpecialColumn(const QString &name)
Unset a special column.
static const char * BinaryOperatorText[]
static QString replaceExpressionText(const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, const QMap< QString, QVariant > *substitutionMap=0, const QgsDistanceArea *distanceArea=0)
This function currently replaces each expression between [% and %] in the string with the result of i...
static QMap< QString, QVariant > gmSpecialColumns