|
Revision 13041, 2.1 kB
(checked in by robert, 15 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | #include "Exception.h" |
|---|
| 15 | #include "VolumeSwitchProperty.h" |
|---|
| 16 | #include "VolumeCompositeProperty.h" |
|---|
| 17 | |
|---|
| 18 | #include <osgDB/ReadFile> |
|---|
| 19 | |
|---|
| 20 | using namespace ive; |
|---|
| 21 | |
|---|
| 22 | void VolumeSwitchProperty::write(DataOutputStream* out) |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | out->writeInt(IVEVOLUMESWITCHPROPERTY); |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | osgVolume::CompositeProperty* cp = dynamic_cast<osgVolume::CompositeProperty*>(this); |
|---|
| 29 | if (cp) |
|---|
| 30 | ((ive::VolumeCompositeProperty*)(cp))->write(out); |
|---|
| 31 | else |
|---|
| 32 | out_THROW_EXCEPTION("VolumeImageLayer::write(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); |
|---|
| 33 | |
|---|
| 34 | out->writeUInt(getActiveProperty()); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | void VolumeSwitchProperty::read(DataInputStream* in) |
|---|
| 38 | { |
|---|
| 39 | |
|---|
| 40 | int id = in->peekInt(); |
|---|
| 41 | if (id != IVEVOLUMESWITCHPROPERTY) |
|---|
| 42 | in_THROW_EXCEPTION("VolumeSwitchProperty::read(): Expected CompositeProperty identification."); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | id = in->readInt(); |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | osgVolume::CompositeProperty* cp = dynamic_cast<osgVolume::CompositeProperty*>(this); |
|---|
| 49 | if (cp) |
|---|
| 50 | ((ive::VolumeCompositeProperty*)(cp))->read(in); |
|---|
| 51 | else |
|---|
| 52 | in_THROW_EXCEPTION("VolumeImageLayer::read(): Could not cast this osgVolume::SwitchProperty to an osgVolume::CompositeProperty."); |
|---|
| 53 | |
|---|
| 54 | setActiveProperty(in->readUInt()); |
|---|
| 55 | } |
|---|