Exemplo n.º 1
0
void SelectionInfo::initialize(unsigned uiFirstLod, unsigned uiMaxLod, const Profile* profile, double mtrf)
{
    if (initialized())
    {
        OE_INFO << LC <<"Error: Selection Information already initialized"<<std::endl;
        return;
    }
    if (uiFirstLod>uiMaxLod)
    {
        OE_INFO << LC <<"Error: Inconsistent First and Max LODs"<<std::endl;
        return;
    }

    _uiFirstLOD = uiFirstLod;

    double fLodNear = 0;
    float fRatio = 1.0;

    _numLods = uiMaxLod+1u; // - uiFirstLod;

    _vecVisParams.resize(_numLods);

    for (unsigned lod = 0; lod <= uiMaxLod; ++lod)
    {
        TileKey key(lod, 0, 0, profile);
        GeoExtent e = key.getExtent();
        GeoCircle c = e.computeBoundingGeoCircle();
        double range = c.getRadius() * mtrf * 2.0;

        _vecVisParams[lod]._visibilityRange = range;
    }
    
    fLodNear = 0;
    double fPrevPos = fLodNear;
    for (int i=(int)(_numLods-1); i>=0; --i)
    {
        _vecVisParams[i]._fMorphEnd   = _vecVisParams[i]._visibilityRange;
        _vecVisParams[i]._fMorphStart = fPrevPos + (_vecVisParams[i]._fMorphEnd - fPrevPos) * _fMorphStartRatio;
        fPrevPos = _vecVisParams[i]._fMorphStart;
    }
}