root/OpenSceneGraph/trunk/src/osgPlugins/ive/EllipsoidModel.cpp @ 13041

Revision 13041, 2.0 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/**********************************************************************
2 *
3 *    FILE:            EllipsoidModel.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::EllipsoidModel in binary format to disk.
6 *
7 *    CREATED BY:        Auto generated by iveGenerator
8 *                    and later modified by Rune Schmidt Jensen.
9 *
10 *    HISTORY:        Created 23.4.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "Object.h"
17#include "EllipsoidModel.h"
18#include "ConvexPlanarPolygon.h"
19
20using namespace ive;
21
22void EllipsoidModel::write(DataOutputStream* out){
23    // Write EllipsoidModel's identification.
24    out->writeInt(IVEELLIPSOIDMODEL);
25    // If the osg class is inherited by any other class we should also write this to file.
26    osg::Object*  obj = dynamic_cast<osg::Object*>(this);
27    if(obj){
28        ((ive::Object*)(obj))->write(out);
29    }
30    else
31        out_THROW_EXCEPTION("EllipsoidModel::write(): Could not cast this osg::EllipsoidModel to an osg::Object.");
32    // Write EllipsoidModel's properties.
33
34    out->writeDouble(getRadiusEquator());
35    out->writeDouble(getRadiusPolar());
36
37}
38
39void EllipsoidModel::read(DataInputStream* in){
40    // Peek on EllipsoidModel's identification.
41    int id = in->peekInt();
42    if(id == IVEELLIPSOIDMODEL){
43        // Read EllipsoidModel's identification.
44        id = in->readInt();
45        // If the osg class is inherited by any other class we should also read this from file.
46        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
47        if(obj){
48            ((ive::Object*)(obj))->read(in);
49        }
50        else
51            in_THROW_EXCEPTION("EllipsoidModel::read(): Could not cast this osg::EllipsoidModel to an osg::Object.");
52        // Read EllipsoidModel's properties
53
54        setRadiusEquator(in->readDouble());
55        setRadiusPolar(in->readDouble());
56
57
58    }
59    else{
60        in_THROW_EXCEPTION("EllipsoidModel::read(): Expected EllipsoidModel identification.");
61    }
62}
Note: See TracBrowser for help on using the browser.