|
Revision 13041, 2.4 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 "VolumeImageLayer.h" |
|---|
| 16 | #include "VolumeLayer.h" |
|---|
| 17 | |
|---|
| 18 | #include <osgDB/ReadFile> |
|---|
| 19 | |
|---|
| 20 | using namespace ive; |
|---|
| 21 | |
|---|
| 22 | void VolumeImageLayer::write(DataOutputStream* out) |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | out->writeInt(IVEVOLUMEIMAGELAYER); |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | osgVolume::Layer* layer = dynamic_cast<osgVolume::Layer*>(this); |
|---|
| 29 | if (layer) |
|---|
| 30 | ((ive::VolumeLayer*)(layer))->write(out); |
|---|
| 31 | else |
|---|
| 32 | out_THROW_EXCEPTION("VolumeImageLayer::write(): Could not cast this osgVolume::ImageLayer to an osgVolume::Layer."); |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | IncludeImageMode imMode = out->getIncludeImageMode(getImage()); |
|---|
| 36 | |
|---|
| 37 | if (getFileName().empty() && imMode==IMAGE_REFERENCE_FILE) imMode = IMAGE_INCLUDE_DATA; |
|---|
| 38 | |
|---|
| 39 | out->writeChar(imMode); |
|---|
| 40 | out->writeImage(imMode,getImage()); |
|---|
| 41 | |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | void VolumeImageLayer::read(DataInputStream* in) |
|---|
| 45 | { |
|---|
| 46 | |
|---|
| 47 | int id = in->peekInt(); |
|---|
| 48 | if (id != IVEVOLUMEIMAGELAYER) |
|---|
| 49 | in_THROW_EXCEPTION("VolumeImageLayer::read(): Expected ImageLayer identification."); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | id = in->readInt(); |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | osgVolume::Layer* layer = dynamic_cast<osgVolume::Layer*>(this); |
|---|
| 56 | if (layer) |
|---|
| 57 | ((ive::VolumeLayer*)(layer))->read(in); |
|---|
| 58 | else |
|---|
| 59 | in_THROW_EXCEPTION("ImageLayer::read(): Could not cast this osgVolume::Layer to an osg::Group."); |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | IncludeImageMode includeImg = (IncludeImageMode)in->readChar(); |
|---|
| 63 | |
|---|
| 64 | if (includeImg==IMAGE_REFERENCE_FILE) |
|---|
| 65 | { |
|---|
| 66 | setFileName(in->readString()); |
|---|
| 67 | } |
|---|
| 68 | else |
|---|
| 69 | { |
|---|
| 70 | setImage(in->readImage(includeImg)); |
|---|
| 71 | } |
|---|
| 72 | } |
|---|