osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Symbology::Query Class Reference

Collaboration diagram for osgEarth::Symbology::Query:

List of all members.

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

Detailed Description

A query filter that you can use to limit a set of symbology to process.

Definition at line 33 of file Query.


Constructor & Destructor Documentation

Query::Query ( const Config conf = Config())

Definition at line 24 of file Query.cpp.

{
    mergeConfig( conf );
}

Member Function Documentation

optional<Bounds>& osgEarth::Symbology::Query::bounds ( ) [inline]

Sets the geospatial extent bounding this query.

Definition at line 41 of file Query.

{ return _bounds; }

Here is the caller graph for this function:

const optional<Bounds>& osgEarth::Symbology::Query::bounds ( ) const [inline]

Definition at line 42 of file Query.

{ return _bounds; }
Query Query::combineWith ( const Query other) const

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

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;
}

Here is the call graph for this function:

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 ) );
    }
}

Here is the call graph for this function:

const optional<osgEarth::TileKey>& osgEarth::Symbology::Query::tileKey ( ) const [inline]

Definition at line 50 of file Query.

{ return _tileKey; }
optional<osgEarth::TileKey>& osgEarth::Symbology::Query::tileKey ( ) [inline]

Sets a driver-specific query expression.

Definition at line 49 of file Query.

{ return _tileKey; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 64 of file Query.

Definition at line 65 of file Query.

Definition at line 66 of file Query.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines