osgEarth 2.1.1
|
Public Member Functions | |
Query (const Config &conf=Config()) | |
optional< Bounds > & | bounds () |
const optional< Bounds > & | bounds () const |
optional< std::string > & | expression () |
const optional< std::string > & | expression () const |
optional< osgEarth::TileKey > & | tileKey () |
const optional < osgEarth::TileKey > & | tileKey () const |
Query | combineWith (const Query &other) const |
virtual Config | getConfig () const |
void | mergeConfig (const Config &conf) |
Protected Attributes | |
optional< Bounds > | _bounds |
optional< std::string > | _expression |
optional< osgEarth::TileKey > | _tileKey |
A query filter that you can use to limit a set of symbology to process.
Definition at line 24 of file Query.cpp.
{ mergeConfig( conf ); }
Merges this query with another query, and returns the result
Definition at line 65 of file Query.cpp.
{ Query merged; // merge the expressions: bool lhsEmptyExpr = !_expression.isSet() || _expression->empty(); bool rhsEmptyExpr = !rhs.expression().isSet() || rhs.expression()->empty(); if ( !lhsEmptyExpr && !rhsEmptyExpr ) { std::stringstream buf; buf << "( " << *_expression << " ) AND ( " << *rhs.expression() << " )"; std::string str = buf.str(); merged.expression() = str; } else if ( lhsEmptyExpr && !rhsEmptyExpr ) { merged.expression() = *rhs.expression(); } else if ( !lhsEmptyExpr && rhsEmptyExpr ) { merged.expression() = *_expression; } // merge the bounds: if ( bounds().isSet() && rhs.bounds().isSet() ) { merged.bounds() = bounds()->intersectionWith( *rhs.bounds() ); } else if ( bounds().isSet() ) { merged.bounds() = *bounds(); } else if ( rhs.bounds().isSet() ) { merged.bounds() = *rhs.bounds(); } return merged; }
const optional<std::string>& osgEarth::Symbology::Query::expression | ( | ) | const [inline] |
Definition at line 46 of file Query.
{ return _expression; }
optional<std::string>& osgEarth::Symbology::Query::expression | ( | ) | [inline] |
Sets a driver-specific query expression.
Definition at line 45 of file Query.
{ return _expression; }
Config Query::getConfig | ( | ) | const [virtual] |
Definition at line 49 of file Query.cpp.
{ Config conf( "query" ); conf.addIfSet( "expr", _expression ); if ( _bounds.isSet() ) { Config bc( "extent" ); bc.add( "xmin", toString(_bounds->xMin()) ); bc.add( "ymin", toString(_bounds->yMin()) ); bc.add( "xmax", toString(_bounds->xMax()) ); bc.add( "ymax", toString(_bounds->yMax()) ); conf.add( bc ); } return conf; }
void Query::mergeConfig | ( | const Config & | conf | ) |
Definition at line 30 of file Query.cpp.
{ if ( !conf.getIfSet( "expr", _expression ) ) if ( !conf.getIfSet( "where", _expression ) ) if ( !conf.getIfSet( "sql", _expression ) ) conf.getIfSet( "expression", _expression ); Config b = conf.child( "extent" ); if( !b.empty() ) { _bounds = Bounds( b.value<double>( "xmin", 0.0 ), b.value<double>( "ymin", 0.0 ), b.value<double>( "xmax", 0.0 ), b.value<double>( "ymax", 0.0 ) ); } }
const optional<osgEarth::TileKey>& osgEarth::Symbology::Query::tileKey | ( | ) | const [inline] |
optional<osgEarth::TileKey>& osgEarth::Symbology::Query::tileKey | ( | ) | [inline] |
optional<Bounds> osgEarth::Symbology::Query::_bounds [protected] |
optional<std::string> osgEarth::Symbology::Query::_expression [protected] |