osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Features::Feature Class Reference

Inheritance diagram for osgEarth::Features::Feature:
Collaboration diagram for osgEarth::Features::Feature:

List of all members.

Public Member Functions

 Feature (FeatureID fid=0L)
 Feature (Geometry *geom, const Style &style=Style(), FeatureID fid=0L)
 Feature (const Feature &rhs, const osg::CopyOp &copyop=osg::CopyOp::DEEP_COPY_ALL)
 META_Object (osgEarthFeatures, Feature)
FeatureID getFID () const
void setGeometry (Symbology::Geometry *geom)
Symbology::GeometrygetGeometry ()
const Symbology::GeometrygetGeometry () const
const AttributeTablegetAttrs () const
void set (const std::string &name, const std::string &value)
void set (const std::string &name, double value)
void set (const std::string &name, int value)
void set (const std::string &name, bool value)
bool hasAttr (const std::string &name) const
std::string getString (const std::string &name) const
double getDouble (const std::string &name, double defaultValue=0.0) const
int getInt (const std::string &name, int defaultValue=0) const
bool getBool (const std::string &name, bool defaultValue=false) const
optional< Style > & style ()
const optional< Style > & style () const
optional< GeoInterpolation > & geoInterp ()
const optional
< GeoInterpolation > & 
geomInterp () const
double eval (NumericExpression &expr) const
const std::string & eval (StringExpression &expr) const

Protected Attributes

FeatureID _fid
osg::ref_ptr< Symbology::Geometry_geom
AttributeTable _attrs
optional< Style_style
optional< GeoInterpolation_geoInterp

Detailed Description

Basic building block of vector feature data.

Definition at line 106 of file Feature.


Constructor & Destructor Documentation

Feature::Feature ( FeatureID  fid = 0L)

Definition at line 140 of file Feature.cpp.

                                :
_fid( fid )
{
    //NOP
}
Feature::Feature ( Geometry geom,
const Style style = Style(),
FeatureID  fid = 0L 
)

Definition at line 146 of file Feature.cpp.

                                                                    :
_geom ( geom ),
_fid  ( fid )
{
    if ( !style.empty() )
        _style = style;
}
Feature::Feature ( const Feature rhs,
const osg::CopyOp &  copyop = osg::CopyOp::DEEP_COPY_ALL 
)

Copy contructor

Definition at line 154 of file Feature.cpp.

                                                              :
_fid      ( rhs._fid ),
_attrs    ( rhs._attrs ),
_style    ( rhs._style ),
_geoInterp( rhs._geoInterp )
{
    if ( rhs._geom.valid() )
        //_geom = dynamic_cast<Geometry*>( copyOp( rhs._geom.get() ) );
        _geom = rhs._geom->clone();
}

Member Function Documentation

double Feature::eval ( NumericExpression expr) const

populates the variables of an expression with attribute values and evals the expression.

Definition at line 238 of file Feature.cpp.

{
    const NumericExpression::Variables& vars = expr.variables();
    for( NumericExpression::Variables::const_iterator i = vars.begin(); i != vars.end(); ++i )
        expr.set( *i, getDouble(i->first, 0.0)); //osgEarth::as<double>(getAttr(i->first),0.0) );
    return expr.eval();
}

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string & Feature::eval ( StringExpression expr) const

populates the variables of an expression with attribute values and evals the expression.

Definition at line 247 of file Feature.cpp.

{
    const StringExpression::Variables& vars = expr.variables();
    for( StringExpression::Variables::const_iterator i = vars.begin(); i != vars.end(); ++i )
        expr.set( *i, getString(i->first) ); //getAttr(i->first) );
    return expr.eval();
}

Here is the call graph for this function:

optional<GeoInterpolation>& osgEarth::Features::Feature::geoInterp ( ) [inline]

Geodetic interpolation method.

Definition at line 147 of file Feature.

{ return _geoInterp; }

Here is the caller graph for this function:

const optional<GeoInterpolation>& osgEarth::Features::Feature::geomInterp ( ) const [inline]

Definition at line 148 of file Feature.

{ return _geoInterp; }
const AttributeTable& osgEarth::Features::Feature::getAttrs ( ) const [inline]

Definition at line 128 of file Feature.

{ return _attrs; }

Here is the caller graph for this function:

bool Feature::getBool ( const std::string &  name,
bool  defaultValue = false 
) const

Definition at line 231 of file Feature.cpp.

{
    AttributeTable::const_iterator i = _attrs.find(toLower(name));
    return i != _attrs.end()? i->second.getBool(defaultValue) : defaultValue;
}

Here is the call graph for this function:

double Feature::getDouble ( const std::string &  name,
double  defaultValue = 0.0 
) const

Definition at line 217 of file Feature.cpp.

{
    AttributeTable::const_iterator i = _attrs.find(toLower(name));
    return i != _attrs.end()? i->second.getDouble(defaultValue) : defaultValue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

FeatureID Feature::getFID ( ) const

Definition at line 166 of file Feature.cpp.

{
    return _fid;
}

Here is the caller graph for this function:

Symbology::Geometry* osgEarth::Features::Feature::getGeometry ( ) [inline]

Definition at line 124 of file Feature.

{ return _geom.get(); }

Here is the caller graph for this function:

const Symbology::Geometry* osgEarth::Features::Feature::getGeometry ( ) const [inline]

Definition at line 126 of file Feature.

{ return _geom.get(); }
int Feature::getInt ( const std::string &  name,
int  defaultValue = 0 
) const

Definition at line 224 of file Feature.cpp.

{
    AttributeTable::const_iterator i = _attrs.find(toLower(name));
    return i != _attrs.end()? i->second.getInt(defaultValue) : defaultValue;
}

Here is the call graph for this function:

std::string Feature::getString ( const std::string &  name) const

Definition at line 210 of file Feature.cpp.

{
    AttributeTable::const_iterator i = _attrs.find(toLower(name));
    return i != _attrs.end()? i->second.getString() : EMPTY_STRING;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Feature::hasAttr ( const std::string &  name) const

Definition at line 204 of file Feature.cpp.

{
    return _attrs.find(toLower(name)) != _attrs.end();
}

Here is the call graph for this function:

osgEarth::Features::Feature::META_Object ( osgEarthFeatures  ,
Feature   
)
void Feature::set ( const std::string &  name,
int  value 
)

Definition at line 188 of file Feature.cpp.

{
    AttributeValue& a = _attrs[name];
    a.first = ATTRTYPE_INT;
    a.second.intValue = value;
}
void Feature::set ( const std::string &  name,
double  value 
)

Definition at line 180 of file Feature.cpp.

{
    AttributeValue& a = _attrs[name];
    a.first = ATTRTYPE_DOUBLE;
    a.second.doubleValue = value;
}
void Feature::set ( const std::string &  name,
bool  value 
)

Definition at line 196 of file Feature.cpp.

{
    AttributeValue& a = _attrs[name];
    a.first = ATTRTYPE_BOOL;
    a.second.boolValue = value;
}
void Feature::set ( const std::string &  name,
const std::string &  value 
)

Definition at line 172 of file Feature.cpp.

{
    AttributeValue& a = _attrs[name];
    a.first = ATTRTYPE_STRING;
    a.second.stringValue = value;
}

Here is the caller graph for this function:

void osgEarth::Features::Feature::setGeometry ( Symbology::Geometry geom) [inline]

Definition at line 122 of file Feature.

{ _geom = geom; }

Here is the caller graph for this function:

const optional<Style>& osgEarth::Features::Feature::style ( ) const [inline]

Definition at line 144 of file Feature.

{ return _style; }
optional<Style>& osgEarth::Features::Feature::style ( ) [inline]

Embedded style.

Definition at line 143 of file Feature.

{ return _style; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 159 of file Feature.

Definition at line 157 of file Feature.

Definition at line 161 of file Feature.

Definition at line 158 of file Feature.

Definition at line 160 of file Feature.


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