osgEarth 2.1.1
Public Member Functions | Protected Attributes

seamless::GeoPatch Class Reference

Inheritance diagram for seamless::GeoPatch:
Collaboration diagram for seamless::GeoPatch:

List of all members.

Public Member Functions

 GeoPatch ()
 GeoPatch (const osgEarth::TileKey &key)
 GeoPatch (const GeoPatch &rhs, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 META_Node (seamless, GeoPatch)
virtual float getEdgeError (const osg::Vec3 &eye, int edge)
void setGeographic (Geographic *)
GeographicgetGeographic () const

Protected Attributes

int _face
double _edgeLengths [4]
osg::Vec2d _faceCoords [4]

Detailed Description

Definition at line 36 of file GeoPatch.


Constructor & Destructor Documentation

seamless::GeoPatch::GeoPatch ( )

Definition at line 32 of file GeoPatch.cpp.

{
    _face = -1;
    std::fill(&_edgeLengths[0], &_edgeLengths[4], 0.0);

}
seamless::GeoPatch::GeoPatch ( const osgEarth::TileKey key)

Definition at line 39 of file GeoPatch.cpp.

{
    // When an arc on the cube grid is subdivided, this is the largest
    // ratio of the lengths of the parent arc and its longest
    // child. The ratio goes to .5 as the arcs are further subdivided
    // at higher LODs. The error threshold is set to this value to
    // insure that the triles that share an edge will display the same
    // LOD when the enclosing patches are from different LODs.
    setErrorThreshold(.5371);
    const GeoExtent& extent = key.getExtent();
    double xMin = extent.xMin(), yMin = extent.yMin(),
        xMax = extent.xMax(), yMax = extent.yMax();
    euler::cubeToFace(xMin, yMin, xMax, yMax, _face);
    Vec2d faceCoords[4];
    _faceCoords[0][0] = xMin; _faceCoords[0][1] = yMin;
    _faceCoords[1][0] = xMax; _faceCoords[1][1] = yMin;
    _faceCoords[2][0] = xMax; _faceCoords[2][1] = yMax;
    _faceCoords[3][0] = xMin; _faceCoords[3][1] = yMax;
    for (int i = 0; i < 4; ++i)
        _edgeLengths[i] = euler::arcLength(_faceCoords[i],
                                           _faceCoords[(i + 1) % 4], _face);
}

Here is the call graph for this function:

seamless::GeoPatch::GeoPatch ( const GeoPatch rhs,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

Member Function Documentation

float seamless::GeoPatch::getEdgeError ( const osg::Vec3 &  eye,
int  edge 
) [virtual]

Reimplemented from seamless::Patch.

Definition at line 69 of file GeoPatch.cpp.

{
    // Hack to get back to face parameters and world coordinates.
    Transform* parent = static_cast<Transform*>(getParent(0));
    PatchGroup* pgroup = static_cast<PatchGroup*>(parent->getParent(0));
    Matrix worldMat;
    parent->computeLocalToWorldMatrix(worldMat, 0);
    Vec3d worldEye = Vec3d(eye) * worldMat;
    double d = euler::distanceToSegment(worldEye, _faceCoords[edge],
                                        _faceCoords[(edge + 1) % 4], _face);
    return _patchSet->getPrecisionFactor() * _edgeLengths[edge] / d;
}

Here is the call graph for this function:

Geographic * seamless::GeoPatch::getGeographic ( ) const

Definition at line 87 of file GeoPatch.cpp.

{
    return static_cast<Geographic*>(_patchSet.get());
}
seamless::GeoPatch::META_Node ( seamless  ,
GeoPatch   
)
void seamless::GeoPatch::setGeographic ( Geographic geo)

Definition at line 82 of file GeoPatch.cpp.

{
    _patchSet = geo;
}

Here is the caller graph for this function:


Member Data Documentation

double seamless::GeoPatch::_edgeLengths[4] [protected]

Definition at line 51 of file GeoPatch.

int seamless::GeoPatch::_face [protected]

Definition at line 50 of file GeoPatch.

osg::Vec2d seamless::GeoPatch::_faceCoords[4] [protected]

Definition at line 52 of file GeoPatch.


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