Bug in EarthFile.cpp writeCache

classic Classic list List threaded Threaded
2 messages Options
Evan Andersen Evan Andersen
Reply | Threaded
Open this post in threaded view
|

Bug in EarthFile.cpp writeCache

I believe I've found a bug in the writeCache function in EarthFile.cpp.  The runOffCacheOnly and reprojectBeforeCaching values are being written out to the earth file as binary values.  My corrected version of the function is below.

Evan

static void
writeCache( const CacheConfig& cache, XmlElement* e_cache )
{
    e_cache->getAttrs()[ATTR_TYPE] =
        cache.getType() == CacheConfig::TYPE_DISABLED?  "disabled" :
        cache.getType() == CacheConfig::TYPE_TILECACHE? "tilecache" :
        cache.getType() == CacheConfig::TYPE_TMS? "tms" :
        "tms";

    if ( cache.runOffCacheOnly().isSet() )
    {
        e_cache->getAttrs()[ATTR_CACHE_ONLY] = toString(cache.runOffCacheOnly().get());
    }

    if ( cache.reprojectBeforeCaching().isSet() )
    {
        e_cache->getAttrs()[ATTR_REPROJECT_BEFORE_CACHING] = toString(cache.reprojectBeforeCaching().get());
    }

    //Add all the properties
    for (Properties::const_iterator i = cache.getProperties().begin(); i != cache.getProperties().end(); i++ )
    {
        e_cache->addSubElement(i->first, i->second);
    }
}
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: Bug in EarthFile.cpp writeCache

Hi Evan,

I've merged your changes and committed them, thanks for catching those!

Jason

On Fri, Aug 14, 2009 at 7:00 PM, Evan Andersen (via Nabble) <[hidden email]> wrote:
I believe I've found a bug in the writeCache function in EarthFile.cpp.  The runOffCacheOnly and reprojectBeforeCaching values are being written out to the earth file as binary values.  My corrected version of the function is below.

Evan

static void
writeCache( const CacheConfig& cache, XmlElement* e_cache )
{
    e_cache->getAttrs()[ATTR_TYPE] =
        cache.getType() == CacheConfig::TYPE_DISABLED?  "disabled" :
        cache.getType() == CacheConfig::TYPE_TILECACHE? "tilecache" :
        cache.getType() == CacheConfig::TYPE_TMS? "tms" :
        "tms";

    if ( cache.runOffCacheOnly().isSet() )
    {
        e_cache->getAttrs()[ATTR_CACHE_ONLY] = toString(cache.runOffCacheOnly().get());
    }

    if ( cache.reprojectBeforeCaching().isSet() )
    {
        e_cache->getAttrs()[ATTR_REPROJECT_BEFORE_CACHING] = toString(cache.reprojectBeforeCaching().get());
    }

    //Add all the properties
    for (Properties::const_iterator i = cache.getProperties().begin(); i != cache.getProperties().end(); i++ )
    {
        e_cache->addSubElement(i->first, i->second);
    }
}



View message @ http://n2.nabble.com/Bug-in-EarthFile.cpp-writeCache-tp3447898p3447898.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.