osgEarth 2.1.1
Classes | Functions

seamless::anonymous_namespace{Geographic.cpp} Namespace Reference

Classes

struct  HeightFieldRequest
struct  ImageRequest
class  GeoPatchUpdateCallback

Functions

GeoHeightField mergeHeightFields (const GeoExtent &targetExtent, const GeoHeightFieldVector &hfs)
GeoImage mergeImages (const GeoExtent &targetExtent, const GeoImageVector &imgs)
GeoHeightField getGeoHeightField (MapFrame &mapf, const TileKey &key, int resolution)
bool crossesDateLine (const TileKey &key)
ClusterCullingCallback * createClusterCullingCallback (const Matrixd &transform, const Patch *patch, const EllipsoidModel *et)

Function Documentation

ClusterCullingCallback* seamless::anonymous_namespace{Geographic.cpp}::createClusterCullingCallback ( const Matrixd &  transform,
const Patch *  patch,
const EllipsoidModel *  et 
)

Definition at line 467 of file Geographic.cpp.

    {
        Vec3d dv = *itr;
        Vec3d v = dv + center_position;
        double lat, lon, height;

        et->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
                                      lat, lon, height);

        double d = sqrt(dv.x()*dv.x() + dv.y()*dv.y() + dv.z()*dv.z());
        double theta = acos(globe_radius / (globe_radius + fabs(height)));
        double phi = 2.0 * asin (d*0.5 / globe_radius); // d/globe_radius;
        double beta = theta + phi;
        double sb = sin(beta);
        double cb = cos(beta);
        double cutoff = osg::PI_2 - 0.1;

        //log(osg::INFO,"theta="<<theta<<"\tphi="<<phi<<" beta "<<beta);
        if (phi<cutoff && beta<cutoff)
        {
            float local_dot_product = -sb;
            float local_m = globe_radius*( 1.0/ cb - 1.0);
            float local_radius = static_cast<float>(globe_radius * sb / cb); // beta*globe_radius;
            min_dot_product = osg::minimum(min_dot_product, local_dot_product);
            max_cluster_culling_height = osg::maximum(max_cluster_culling_height,local_m);
            max_cluster_culling_radius = osg::maximum(max_cluster_culling_radius,local_radius);
        }
        else
        {
            //log(osg::INFO,"Turning off cluster culling for wrap around tile.");
            return 0;
        }
    }

    osg::ClusterCullingCallback* ccc = new osg::ClusterCullingCallback;

    ccc->set(center_position + center_normal*max_cluster_culling_height ,
             center_normal,
             min_dot_product,
             max_cluster_culling_radius);

    return ccc;
}
}

Node* Geographic::createPatchGroup(const string& filename,

Here is the caller graph for this function:

bool seamless::anonymous_namespace{Geographic.cpp}::crossesDateLine ( const TileKey key) [inline]

Definition at line 332 of file Geographic.cpp.

                          : public TaskRequest
{
GeoHeightField seamless::anonymous_namespace{Geographic.cpp}::getGeoHeightField ( MapFrame mapf,
const TileKey key,
int  resolution 
)

Definition at line 315 of file Geographic.cpp.

{

Here is the caller graph for this function:

GeoHeightField seamless::anonymous_namespace{Geographic.cpp}::mergeHeightFields ( const GeoExtent targetExtent,
const GeoHeightFieldVector hfs 
)

Definition at line 102 of file Geographic.cpp.

    {
        OE_FATAL << "mergeHeightFields expected 4 height fields\n";
        return GeoHeightField();
    }
    // List is in tile subkey quadrant order.
    // Assume the height fields all have the same dimensions
    unsigned targetCols = hfs[0].getHeightField()->getNumColumns() * 2 - 1;
    unsigned targetRows = hfs[0].getHeightField()->getNumRows() * 2 - 1;
    HeightField* targethf = new HeightField;
    targethf->allocate(targetCols, targetRows);
    GeoHeightField geo(targethf, targetExtent, 0);
    for (int i = 0; i < 4; ++i)
    {
        const HeightField* src = hfs[i].getHeightField();
        unsigned targetColumn
            = floor((hfs[i].getExtent().xMin() - targetExtent.xMin())
                    / targetExtent.width() * (targetCols - 1) + .5);
        unsigned targetRow
            = floor((hfs[i].getExtent().yMin() - targetExtent.yMin())
                    / targetExtent.height() * (targetRows - 1) + .5);
        for (unsigned sj = 0, tj = targetRow;
             sj < src->getNumRows() && tj < targetRows;
             ++sj, ++tj)
        {
            for (unsigned si = 0, ti = targetColumn;
             si < src->getNumColumns() && ti < targetCols;
             ++si, ++ti)
                targethf->setHeight(ti, tj, src->getHeight(si, sj));
        }
    }
    return geo;
}

GeoImage
mergeImages(const GeoExtent& targetExtent, const GeoImageVector& imgs)

Here is the caller graph for this function:

GeoImage seamless::anonymous_namespace{Geographic.cpp}::mergeImages ( const GeoExtent targetExtent,
const GeoImageVector imgs 
)

Definition at line 139 of file Geographic.cpp.

    {
        const GeoExtent& srcExtent = itr->getExtent();
        int dstx
            = floor((srcExtent.xMin() - targetExtent.xMin()) / targetExtent.width()
                    * numCols + .5);
        int dsty
            = floor((srcExtent.yMin() - targetExtent.yMin()) / targetExtent.height()
                    * numRows + .5);
        ImageUtils::copyAsSubImage(itr->getImage(), targetImage,
                                   dstx, dsty);
    }
    return GeoImage(targetImage, targetExtent);
}
}

// Create vertex arrays from the height field for a patch and install

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines