osgEarth 2.1.1
Public Member Functions

osgEarth::Symbology::LineString Class Reference

Inheritance diagram for osgEarth::Symbology::LineString:
Collaboration diagram for osgEarth::Symbology::LineString:

List of all members.

Public Member Functions

 LineString (int capacity=0)
 LineString (const LineString &rhs)
 LineString (const Vec3dVector *toCopy)
double getLength () const
bool getSegment (double length, osg::Vec3d &start, osg::Vec3d &end)
virtual Type getType () const
virtual bool isValid () const

Detailed Description

An ordered set of points forming a single contiguous line string.

Definition at line 198 of file Geometry.


Constructor & Destructor Documentation

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

Definition at line 201 of file Geometry.

: Geometry( capacity ) { }
LineString::LineString ( const LineString rhs)

Definition at line 359 of file Geometry.cpp.

                                              :
Geometry( rhs )
{
    //nop
}
LineString::LineString ( const Vec3dVector toCopy)

Definition at line 365 of file Geometry.cpp.

                                                :
Geometry( data )
{
    //nop
}

Member Function Documentation

double LineString::getLength ( ) const

Definition at line 372 of file Geometry.cpp.

{
    double length = 0;
    for (unsigned int i = 0; i < size()-1; ++i)
    {
        osg::Vec3d current = (*this)[i];
        osg::Vec3d next    = (*this)[i+1];
        length += (next - current).length();
    }
    return length;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LineString::getSegment ( double  length,
osg::Vec3d &  start,
osg::Vec3d &  end 
)

Definition at line 385 of file Geometry.cpp.

{
    double pos = 0;
    for (unsigned int i = 0; i < size()-1; ++i)
    {
        osg::Vec3d current = (*this)[i];
        osg::Vec3d next    = (*this)[i+1];
        pos += (next - current).length();
        if (pos > length)
        {
            start = current;
            end = next;
            return true;
        }
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements osgEarth::Symbology::Geometry.

Definition at line 209 of file Geometry.

virtual bool osgEarth::Symbology::LineString::isValid ( ) const [inline, virtual]

Reimplemented from osgEarth::Symbology::Geometry.

Definition at line 210 of file Geometry.

{ return size() >= 2; }

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