osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Symbology::Polygon Class Reference

Inheritance diagram for osgEarth::Symbology::Polygon:
Collaboration diagram for osgEarth::Symbology::Polygon:

List of all members.

Public Member Functions

 Polygon (int capacity=0)
 Polygon (const Polygon &rhs)
 Polygon (const Vec3dVector *toCopy)
virtual Type getType () const
virtual int getTotalPointCount () const
virtual unsigned getNumGeometries () const
virtual bool contains2D (double x, double y) const
virtual void open ()
RingCollectiongetHoles ()
const RingCollectiongetHoles () const

Protected Attributes

RingCollection _holes

Detailed Description

A Polygon is a geometry that consists of one outer boundary Ring, and zero or more inner "hole" rings. The boundary ring is would CCW, and the inner "holes" are wound CW.

Definition at line 262 of file Geometry.


Constructor & Destructor Documentation

osgEarth::Symbology::Polygon::Polygon ( int  capacity = 0) [inline]

Definition at line 265 of file Geometry.

: Ring( capacity ) { }
Polygon::Polygon ( const Polygon rhs)

Definition at line 535 of file Geometry.cpp.

                                     :
Ring( rhs )
{
    for( RingCollection::const_iterator r = rhs._holes.begin(); r != rhs._holes.end(); ++r )
        _holes.push_back( new Ring(*r->get()) );
}
Polygon::Polygon ( const Vec3dVector toCopy)

Definition at line 542 of file Geometry.cpp.

                                          :
Ring( data )
{
    //nop
}

Member Function Documentation

bool Polygon::contains2D ( double  x,
double  y 
) const [virtual]

Reimplemented from osgEarth::Symbology::Ring.

Definition at line 558 of file Geometry.cpp.

{
    // first check the outer ring
    if ( !Ring::contains2D(x, y) )
        return false;

    // then check each inner ring (holes). Point has to be inside the outer ring, 
    // but NOT inside any of the holes
    for( RingCollection::const_iterator i = _holes.begin(); i != _holes.end(); ++i )
    {
        if ( i->get()->contains2D(x, y) )
            return false;
    }

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const RingCollection& osgEarth::Symbology::Polygon::getHoles ( ) const [inline]

Definition at line 282 of file Geometry.

{ return _holes; }
RingCollection& osgEarth::Symbology::Polygon::getHoles ( ) [inline]

Definition at line 281 of file Geometry.

{ return _holes; }

Here is the caller graph for this function:

virtual unsigned osgEarth::Symbology::Polygon::getNumGeometries ( ) const [inline, 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 273 of file Geometry.

{ return 1 + _holes.size(); }
int Polygon::getTotalPointCount ( ) const [virtual]

Gets the total number of points in this geometry.

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 549 of file Geometry.cpp.

{
    int total = Ring::getTotalPointCount();
    for( RingCollection::const_iterator i = _holes.begin(); i != _holes.end(); ++i )
        total += i->get()->getTotalPointCount();
    return total;
}

Here is the caller graph for this function:

virtual Type osgEarth::Symbology::Polygon::getType ( ) const [inline, virtual]

Reimplemented from osgEarth::Symbology::Ring.

Definition at line 270 of file Geometry.

void Polygon::open ( ) [virtual]

Reimplemented from osgEarth::Symbology::Ring.

Definition at line 576 of file Geometry.cpp.

{
    Ring::open();
    for( RingCollection::const_iterator i = _holes.begin(); i != _holes.end(); ++i )
        (*i)->open();
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 285 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