osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Symbology::MultiGeometry Class Reference

Inheritance diagram for osgEarth::Symbology::MultiGeometry:
Collaboration diagram for osgEarth::Symbology::MultiGeometry:

List of all members.

Public Member Functions

 MultiGeometry ()
 MultiGeometry (const GeometryCollection &parts)
 MultiGeometry (const MultiGeometry &rhs)
virtual Type getType () const
virtual Type getComponentType () const
virtual int getTotalPointCount () const
virtual unsigned getNumComponents () const
virtual unsigned getNumGeometries () const
virtual GeometrycloneAs (const Geometry::Type &newType) const
virtual bool isValid () const
virtual Bounds getBounds () const
GeometryCollectiongetComponents ()
const GeometryCollectiongetComponents () const

Protected Attributes

GeometryCollection _parts

Detailed Description

A collection of multiple geometries (aka, a "multi-part" geometry).

Definition at line 291 of file Geometry.


Constructor & Destructor Documentation

osgEarth::Symbology::MultiGeometry::MultiGeometry ( ) [inline]

Definition at line 294 of file Geometry.

{ }

Here is the caller graph for this function:

MultiGeometry::MultiGeometry ( const GeometryCollection parts)

Definition at line 592 of file Geometry.cpp.

                                                              :
_parts( parts )
{
    //nop
}
MultiGeometry::MultiGeometry ( const MultiGeometry rhs)

Definition at line 585 of file Geometry.cpp.

                                                       :
Geometry( rhs )
{
    for( GeometryCollection::const_iterator i = rhs._parts.begin(); i != rhs._parts.end(); ++i )
        _parts.push_back( i->get()->clone() ); //i->clone() ); //osg::clone<Geometry>( i->get() ) );
}

Member Function Documentation

Geometry * MultiGeometry::cloneAs ( const Geometry::Type newType) const [virtual]

Converts this geometry to another type. This function will return "this" if the type is the same, and will return NULL if the conversion is impossible.

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 635 of file Geometry.cpp.

{
    MultiGeometry* multi = new MultiGeometry();
    for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
    {
        Geometry* part = i->get()->cloneAs( i->get()->getType() );
        if ( part ) multi->getComponents().push_back( part );
    }
    return multi;
}

Here is the call graph for this function:

Bounds MultiGeometry::getBounds ( ) const [virtual]

Gets the bounds of this geometry

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 624 of file Geometry.cpp.

{
    Bounds bounds;
    for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
    {
        bounds.expandBy( i->get()->getBounds() );
    }
    return bounds;
}

Here is the call graph for this function:

GeometryCollection& osgEarth::Symbology::MultiGeometry::getComponents ( ) [inline]

Definition at line 312 of file Geometry.

{ return _parts; }

Here is the caller graph for this function:

const GeometryCollection& osgEarth::Symbology::MultiGeometry::getComponents ( ) const [inline]

Definition at line 313 of file Geometry.

{ return _parts; }
Geometry::Type MultiGeometry::getComponentType ( ) const [virtual]

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 599 of file Geometry.cpp.

{
    // dicey.
    return _parts.size() > 0 ? _parts.front()->getType() : TYPE_UNKNOWN;
}
virtual unsigned osgEarth::Symbology::MultiGeometry::getNumComponents ( ) const [inline, virtual]

Gets the total number of geometry components

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 302 of file Geometry.

{ return _parts.size(); }
unsigned MultiGeometry::getNumGeometries ( ) const [virtual]

Gets the total number of geometries; it is the total of all parts of all components. Also can be seen as the number of Geometry objects that would be returned by a full GeometryIterator.

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 615 of file Geometry.cpp.

{
    unsigned total = 0;
    for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
        total += i->get()->getNumGeometries();
    return total;
}
int MultiGeometry::getTotalPointCount ( ) const [virtual]

Gets the total number of points in this geometry.

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 606 of file Geometry.cpp.

{
    int total = 0;
    for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
        total += i->get()->getTotalPointCount();
    return total;
}
virtual Type osgEarth::Symbology::MultiGeometry::getType ( ) const [inline, virtual]

Implements osgEarth::Symbology::Geometry.

Definition at line 299 of file Geometry.

bool MultiGeometry::isValid ( ) const [virtual]

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 647 of file Geometry.cpp.

{
    if ( _parts.size() == 0 )
        return false;

    bool valid = true;
    for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end() && valid; ++i )
    {
        if ( !i->get()->isValid() )
            valid = false;
    }
    return valid;
}

Member Data Documentation

Definition at line 316 of file Geometry.


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