root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/CoordinateSystemNode.cpp @ 13041

Revision 13041, 1.8 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include "osg/CoordinateSystemNode"
2
3#include "osgDB/Registry"
4#include "osgDB/Input"
5#include "osgDB/Output"
6
7using namespace osg;
8using namespace osgDB;
9
10// forward declare functions to use later.
11bool CoordinateSystemNode_readLocalData(Object& obj, Input& fr);
12bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw);
13
14// register the read and write functions with the osgDB::Registry.
15REGISTER_DOTOSGWRAPPER(CoordinateSystemNode)
16(
17    new osg::CoordinateSystemNode,
18    "CoordinateSystemNode",
19    "Object Node CoordinateSystemNode Group",
20    &CoordinateSystemNode_readLocalData,
21    &CoordinateSystemNode_writeLocalData
22);
23
24bool CoordinateSystemNode_readLocalData(Object& obj, Input& fr)
25{
26    bool iteratorAdvanced = false;
27
28    CoordinateSystemNode& csn = static_cast<CoordinateSystemNode&>(obj);
29
30    if (fr.matchSequence("Format %s"))
31    {
32        const char* str = fr[1].getStr();
33        if (str) csn.setFormat(str);
34
35        iteratorAdvanced = true;
36        fr+=2;
37    }
38
39    if (fr.matchSequence("CoordinateSystem %s"))
40    {
41        const char* str = fr[1].getStr();
42        if (str) csn.setCoordinateSystem(str);
43
44        iteratorAdvanced = true;
45        fr+=2;
46    }
47
48    static ref_ptr<EllipsoidModel> s_ellipsoidModel = new EllipsoidModel;
49
50    EllipsoidModel* em = static_cast<EllipsoidModel*>(fr.readObjectOfType(*s_ellipsoidModel));
51    if (em) csn.setEllipsoidModel(em);
52
53    return iteratorAdvanced;
54}
55
56
57bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw)
58{
59    const CoordinateSystemNode& csn = static_cast<const CoordinateSystemNode&>(obj);
60
61    fw.indent()<<"Format "<<fw.wrapString(csn.getFormat())<<std::endl;
62    fw.indent()<<"CoordinateSystem "<<fw.wrapString(csn.getCoordinateSystem())<<std::endl;
63
64    if (csn.getEllipsoidModel())
65    {
66        fw.writeObject(*csn.getEllipsoidModel());
67    }
68
69    return true;
70}
Note: See TracBrowser for help on using the browser.