A KML file can have a lot of different items in it and can have nested folders to organize the data. How is the KML data loaded from a file added to the scene? Will osgEarth create a hierarchy of scene nodes that more or less matches the organization of the KML file?
What I'm ultimately after is the ability to create a tree view of the KML files that are loaded to let the user go in to turn layers on and off rather than simply toggling the entire KML file and all of its contents on and off.
So I loaded a sample KML file that had two Folders (siblings, not nested), and then I wrote the osg::Node to file, and it does look like it's creating a separate osg::Group for each Folder. It does not appear that the Folder names get applied to the Folder Groups. I'm guessing this wouldn't be very difficult to add to the KML driver.
So looking at the KML plugin, it does get the name from the Folder (for any feature, really) and sets it on the AnnotationData, just not on the node (KML_Feature.cpp, line 61, osgEarth 2.7). This didn't get written to the .osg file, so I just didn't see it.
That's probably good enough I think? Does this sound like the right approach to build a tree view of a loaded KML file, to just recursively parse the top level osg::Node that gets returned and read the AnnotationData for each osg::Group?