Hi Wang Rui,
I think it'd be appropriate to change the
osgDB::containsServerAddress() to include the range of types supported
by the curl plugin as it's not the just curl plugin that uses the
test. I have added https, ftp and ftps as supported protocols to
Registry.
I didn't like the blanket acceptance of a filename by the curl plugin,
so I've introduced code into ReaderWriterCURL.cpp that only ignores
the abort, when no useful server file address has been found in the
database file path search list, when .curl extension is used. The
code now looks like:
std::string fileName(fullFileName);
std::string ext = osgDB::getFileExtension(fullFileName);
bool curl_ext = ext=="curl";
if (curl_ext)
{
fileName = osgDB::getNameLessExtension(fullFileName);
ext = osgDB::getFileExtension(fileName);
}
if (!osgDB::containsServerAddress(fileName))
{
if (options && !options->getDatabasePathList().empty())
{
if
(osgDB::containsServerAddress(options->getDatabasePathList().front()))
{
std::string newFileName =
options->getDatabasePathList().front() + "/" + fileName;
return readFile(objectType, newFileName,options);
}
}
// if user has explictly specified curl then we don't about at
this point,
// instead assume the curl can read it any way, if it doesn't explictly
// specify curl then we assume that the file is a local file
and not appropriate
// for the curl plugin to load.
if (!curl_ext) return ReadResult::FILE_NOT_HANDLED;
}
With these changes now checked in to svn/trunk all your example tests
work fine, but.. the one:
osgviewer www.openscenegraph.org/data/earth_bayarea/earth.ive.curl
Only works for the topmost tile, it doesn't load any high rest tiles.
Adding http:// in front makes things work, but I think this is
reasonable. Your own suggested changes wouldn't have addressed this
either. Personally I think app developers should be OK with passing
in valid addresses for databases.
An svn update will get these changes,
Robert.
On Thu, Aug 26, 2010 at 5:13 AM, Wang Rui <[email protected]> wrote:
> Hi Robert,
>
> Attachment is a very minor fix to the ReaderWriterCURL.cpp. I only
> made one remark to force to continue reading the file even the
> containsServerAddress() returns false. The registry currently only
> accepts the http protocol, and thus refuses the curl plugin to go on
> with files from ftp and other protocols, even they can be recognized
> and parsed by curl. After disabling the line, we can now work with FTP
> files, and addresses without a 'http://' prefix, by adding the .curl
> suffix at the end:
>
> osgviewer --image ftp://ftp.gnu.org/video/fry720.jpg.curl // OK
> osgviewer --image ftp://ftp.gnu.org/video/fry720.jpg // Failed
>
> osgviewer http://www.openscenegraph.org/data/earth_bayarea/earth.ive // OK
> osgviewer www.openscenegraph.org/data/earth_bayarea/earth.ive.curl // OK
> osgviewer www.openscenegraph.org/data/earth_bayarea/earth.ive
> // Failed
>
> I don't find any problems with this modification at present.
>
> Of course, registering new protocols to osgDB::Registry can also work.
> But I think it is a little more agility to have curl handle all of
> them.
>
> Cheers,
>
> Wang Rui
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org