osgEarth 2.1.1
|
Public Member Functions | |
Feature (FeatureID fid=0L) | |
Feature (Geometry *geom, const Style &style=Style(), FeatureID fid=0L) | |
Feature (const Feature &rhs, const osg::CopyOp ©op=osg::CopyOp::DEEP_COPY_ALL) | |
META_Object (osgEarthFeatures, Feature) | |
FeatureID | getFID () const |
void | setGeometry (Symbology::Geometry *geom) |
Symbology::Geometry * | getGeometry () |
const Symbology::Geometry * | getGeometry () const |
const AttributeTable & | getAttrs () 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 |
Feature::Feature | ( | FeatureID | fid = 0L | ) |
Definition at line 140 of file Feature.cpp.
: _fid( fid ) { //NOP }
Definition at line 146 of file Feature.cpp.
Feature::Feature | ( | const Feature & | rhs, |
const osg::CopyOp & | copyop = osg::CopyOp::DEEP_COPY_ALL |
||
) |
Copy contructor
Definition at line 154 of file Feature.cpp.
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(); }
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(); }
optional<GeoInterpolation>& osgEarth::Features::Feature::geoInterp | ( | ) | [inline] |
Geodetic interpolation method.
Definition at line 147 of file Feature.
{ return _geoInterp; }
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] |
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; }
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; }
FeatureID Feature::getFID | ( | ) | const |
Definition at line 166 of file Feature.cpp.
{ return _fid; }
Symbology::Geometry* osgEarth::Features::Feature::getGeometry | ( | ) | [inline] |
const Symbology::Geometry* osgEarth::Features::Feature::getGeometry | ( | ) | const [inline] |
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; }
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; }
bool Feature::hasAttr | ( | const std::string & | name | ) | const |
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; }
void osgEarth::Features::Feature::setGeometry | ( | Symbology::Geometry * | geom | ) | [inline] |
AttributeTable osgEarth::Features::Feature::_attrs [protected] |
FeatureID osgEarth::Features::Feature::_fid [protected] |
osg::ref_ptr<Symbology::Geometry> osgEarth::Features::Feature::_geom [protected] |
optional<Style> osgEarth::Features::Feature::_style [protected] |