You can't save any of the osgEarth types as IVE.  The only thing you can do
is write a MapNode to another earth file.

Jason


On Tue, Oct 1, 2013 at 7:42 AM, Han <[email protected]> wrote:

>
> Code:
>
> #include <osg/Notify>
> #include <osgViewer/Viewer>
> #include <osgEarthUtil/EarthManipulator>
> #include <osgEarthUtil/ExampleResources>
> #include <osgEarthAnnotation/ModelNode>
>
> #include <osgEarthAnnotation/PlaceNode>
>
>
> int main()
> {
>         int argc = 2;
>         char* argv[2];
>         argv[0] = "*.exe";
>         argv[1] =
> "D:\\RUNTIME\\osgearth-3.0.1-2.4\\Release\\tests\\gdal_tiff.earth";
>
>         osg::ArgumentParser arguments( &argc, argv );
>         osg::ref_ptr<osgViewer::Viewer> viewer=new
> osgViewer::Viewer(arguments);
>         osg::ref_ptr<osg::Group> group=new osg::Group;
>
>         viewer->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(
> false, false );
>
>         osg::ref_ptr<osgEarth::Util::EarthManipulator> em=new
> osgEarth::Util::EarthManipulator;
>         viewer->setCameraManipulator(em);
>
>         osg::ref_ptr<osg::Node>
> earthFileNode=osgEarth::Util::MapNodeHelper().load(arguments,viewer);
>         osgEarth::MapNode* mapNode =
> osgEarth::MapNode::findMapNode(earthFileNode);
>
>         group->addChild(earthFileNode);
>
>         //add Annotation:
>         osgEarth::Symbology::Style AnnotationStyle;
>
> AnnotationStyle.getOrCreate<osgEarth::IconSymbol>()->url()->setLiteral(
> "D:/EARTH/data/images/PNG/placemark32.png" );
>
> AnnotationStyle.getOrCreate<osgEarth::Annotation::TextSymbol>()->size()
> =50.0;
>         const osgEarth::SpatialReference*
> geoSRS=mapNode->getMapSRS()->getGeographicSRS();
>         osg::ref_ptr<osgEarth::Annotation::PlaceNode> pn=new
> osgEarth::Annotation::PlaceNode(mapNode,osgEarth::GeoPoint(geoSRS, -74.00,
> 40.71), "New York", AnnotationStyle);
>         group->addChild(pn);
>
>         //output Annotation:
>
> osgDB::Registry::instance()->writeNode(*pn,"Annotation.ive",osgDB::Registry::instance()->getOptions());
>
>
>     if ( earthFileNode )
>     {
>         viewer->setSceneData( group );
>
>         viewer->getCamera()->setNearFarRatio(0.00002);
>         viewer->getCamera()->setSmallFeatureCullingPixelSize(-1.0f);
>
>         viewer->run();
>     }
>
>     return 0;
> }
>
>
>
>
>
>
> then, i get errer:
> Error writing IVE image: StateSet::write(): Unknown StateAttribute:
> VirtualProgram
>
>
> How can i ?
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=56558#56558
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to