osgEarth 2.1.1
Public Member Functions

osgEarth::Bounds Class Reference

List of all members.

Public Member Functions

 Bounds ()
 Bounds (double xmin, double ymin, double xmax, double ymax)
double width () const
double height () const
double depth () const
bool contains (double x, double y) const
bool contains (const Bounds &rhs) const
Bounds unionWith (const Bounds &rhs) const
Bounds intersectionWith (const Bounds &rhs) const
void expandBy (double x, double y)
void expandBy (double x, double y, double z)
void expandBy (const Bounds &rhs)
osg::Vec2d center2d () const
double radius2d () const
std::string toString () const
bool isValid () const
bool isEmpty () const
void transform (const SpatialReference *fromSRS, const SpatialReference *toSRS)

Detailed Description

An "anonymous" bounding extent (i.e., no geo reference information)

Definition at line 37 of file GeoData.


Constructor & Destructor Documentation

Bounds::Bounds ( )

Definition at line 41 of file GeoData.cpp.

               :
osg::BoundingBoxImpl<osg::Vec3d>( DBL_MAX, DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX, -DBL_MAX )
{
    //nop
}

Here is the caller graph for this function:

Bounds::Bounds ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)

Definition at line 47 of file GeoData.cpp.

                                                                  :
osg::BoundingBoxImpl<osg::Vec3d>( xmin, ymin, -DBL_MAX, xmax, ymax, DBL_MAX )
{
    //nop
}

Member Function Documentation

osg::Vec2d Bounds::center2d ( ) const

Definition at line 149 of file GeoData.cpp.

                       {
    osg::Vec3d c = center();
    return osg::Vec2d( c.x(), c.y() );
}

Here is the caller graph for this function:

bool Bounds::contains ( double  x,
double  y 
) const

Definition at line 60 of file GeoData.cpp.

{
    return 
        isValid() &&
        x >= xMin() && x <= xMax() && y >= yMin() && y <= yMax();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Bounds::contains ( const Bounds rhs) const

Definition at line 68 of file GeoData.cpp.

{
    return 
        isValid() && rhs.isValid() && 
        xMin() <= rhs.xMin() && xMax() >= rhs.xMax() &&
        yMin() <= rhs.yMin() && yMax() >= rhs.yMax();
}

Here is the call graph for this function:

double Bounds::depth ( ) const

Definition at line 144 of file GeoData.cpp.

                    {
    return zMax()-zMin();
}
void Bounds::expandBy ( double  x,
double  y 
)

Definition at line 77 of file GeoData.cpp.

Here is the caller graph for this function:

void Bounds::expandBy ( double  x,
double  y,
double  z 
)

Definition at line 83 of file GeoData.cpp.

Here is the call graph for this function:

void Bounds::expandBy ( const Bounds rhs)

Definition at line 89 of file GeoData.cpp.

Here is the call graph for this function:

double Bounds::height ( ) const

Definition at line 139 of file GeoData.cpp.

                     {
    return yMax()-yMin();
}

Here is the caller graph for this function:

Bounds Bounds::intersectionWith ( const Bounds rhs) const

Definition at line 113 of file GeoData.cpp.

{
    if ( valid() && !rhs.valid() ) return *this;
    if ( !valid() && rhs.valid() ) return rhs;

    if ( this->contains(rhs) ) return rhs;
    if ( rhs.contains(*this) ) return *this;

    if ( !intersects(rhs) ) return Bounds();

    double xmin, xmax, ymin, ymax;

    xmin = ( xMin() > rhs.xMin() && xMin() < rhs.xMax() ) ? xMin() : rhs.xMin();
    xmax = ( xMax() > rhs.xMin() && xMax() < rhs.xMax() ) ? xMax() : rhs.xMax();
    ymin = ( yMin() > rhs.yMin() && yMin() < rhs.yMax() ) ? yMin() : rhs.yMin();
    ymax = ( yMax() > rhs.yMin() && yMax() < rhs.yMax() ) ? yMax() : rhs.yMax();

    return Bounds(xmin, ymin, xmax, ymax);
}

Here is the call graph for this function:

bool osgEarth::Bounds::isEmpty ( ) const [inline]

Definition at line 57 of file GeoData.

{ return !isValid(); }
bool Bounds::isValid ( ) const

Definition at line 54 of file GeoData.cpp.

{
    return xMin() <= xMax() && yMin() <= yMax();
}

Here is the caller graph for this function:

double Bounds::radius2d ( ) const

Definition at line 155 of file GeoData.cpp.

                       {
    return (center2d() - osg::Vec2d(xMin(),yMin())).length();
}

Here is the call graph for this function:

std::string Bounds::toString ( ) const

Definition at line 160 of file GeoData.cpp.

                       {
    std::stringstream buf;
    buf << "(" << xMin() << "," << yMin() << " => " << xMax() << "," << yMax() << ")";
    std::string result = buf.str();
    return result;
}
void Bounds::transform ( const SpatialReference fromSRS,
const SpatialReference toSRS 
)

Definition at line 168 of file GeoData.cpp.

{
    from->transformExtent( to, _min.x(), _min.y(), _max.x(), _max.y() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bounds Bounds::unionWith ( const Bounds rhs) const

Definition at line 95 of file GeoData.cpp.

{
    if ( valid() && !rhs.valid() ) return *this;
    if ( !valid() && rhs.valid() ) return rhs;

    Bounds u;
    if ( intersects(rhs) ) {
        u.xMin() = xMin() >= rhs.xMin() && xMin() <= rhs.xMax() ? xMin() : rhs.xMin();
        u.xMax() = xMax() >= rhs.xMin() && xMax() <= rhs.xMax() ? xMax() : rhs.xMax();
        u.yMin() = yMin() >= rhs.yMin() && yMin() <= rhs.yMax() ? yMin() : rhs.yMin();
        u.yMax() = yMax() >= rhs.yMin() && yMax() <= rhs.yMax() ? yMax() : rhs.yMax();
        u.zMin() = zMin() >= rhs.zMin() && zMin() <= rhs.zMax() ? zMin() : rhs.zMin();
        u.zMax() = zMax() >= rhs.zMin() && zMax() <= rhs.zMax() ? zMax() : rhs.zMax();
    }
    return u;
}

Here is the call graph for this function:

double Bounds::width ( ) const

Definition at line 134 of file GeoData.cpp.

                    {
    return xMax()-xMin();
}

Here is the caller graph for this function:


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