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

Revision 13041, 1.9 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14
15#include "Exception.h"
16#include "VolumeLocator.h"
17#include "Object.h"
18
19using namespace ive;
20
21void VolumeLocator::write(DataOutputStream* out)
22{
23    // Write Locator's identification.
24    out->writeInt(IVEVOLUMELOCATOR);
25
26    // If the osg class is inherited by any other class we should also write this to file.
27    osg::Object*  object = dynamic_cast<osg::Object*>(this);
28    if (object)
29        ((ive::Object*)(object))->write(out);
30    else
31        out_THROW_EXCEPTION("VolumeLocaotr::write(): Could not cast this osgVolume::Locator to an osg::Object.");
32
33    out->writeMatrixd(getTransform());
34}
35
36void VolumeLocator::read(DataInputStream* in)
37{
38    // Peek on Locator's identification.
39    int id = in->peekInt();
40    if(id != IVEVOLUMELOCATOR)
41    {
42        in_THROW_EXCEPTION("VolumeLocator::read(): Expected Locator identification.");
43    }
44
45    // Read Locator's identification.
46    id = in->readInt();
47
48    // If the osg class is inherited by any other class we should also read this from file.
49    osg::Object*  object = dynamic_cast<osg::Object*>(this);
50    if(object)
51        ((ive::Object*)(object))->read(in);
52    else
53        in_THROW_EXCEPTION("VolumeLocator::read(): Could not cast this osgVolume::Locator to an osg::Object.");
54
55    setTransform(in->readMatrixd());
56
57}
Note: See TracBrowser for help on using the browser.