2003-09-15 06:48:35 +08:00
|
|
|
/**********************************************************************
|
|
|
|
*
|
2005-11-17 23:03:51 +08:00
|
|
|
* FILE: AzimSector.cpp
|
2003-09-15 06:48:35 +08:00
|
|
|
*
|
2005-11-17 23:03:51 +08:00
|
|
|
* DESCRIPTION: Read/Write osgSim::AzimSector in binary format to disk.
|
2003-09-15 06:48:35 +08:00
|
|
|
*
|
2005-11-17 23:03:51 +08:00
|
|
|
* CREATED BY: Auto generated by iveGenerator.exe
|
|
|
|
* and later modified by Rune Schmidt Jensen.
|
2003-09-15 06:48:35 +08:00
|
|
|
*
|
2005-11-17 23:03:51 +08:00
|
|
|
* HISTORY: Created 9.9.2003
|
2003-09-15 06:48:35 +08:00
|
|
|
*
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#include "Exception.h"
|
|
|
|
#include "AzimSector.h"
|
|
|
|
|
|
|
|
using namespace ive;
|
|
|
|
|
|
|
|
void AzimSector::write(DataOutputStream* out){
|
2005-11-17 23:03:51 +08:00
|
|
|
// Write AzimSector's identification.
|
|
|
|
out->writeInt(IVEAZIMSECTOR);
|
|
|
|
// Write AzimSector's properties.
|
2003-09-15 06:48:35 +08:00
|
|
|
float minAzimuth, maxAzimuth, fadeAngle;
|
|
|
|
getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
2005-11-17 23:03:51 +08:00
|
|
|
out->writeFloat(minAzimuth);
|
|
|
|
out->writeFloat(maxAzimuth);
|
|
|
|
out->writeFloat(fadeAngle);
|
2003-09-15 06:48:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AzimSector::read(DataInputStream* in){
|
2005-11-17 23:03:51 +08:00
|
|
|
// Peek on AzimSector's identification.
|
|
|
|
int id = in->peekInt();
|
|
|
|
if(id == IVEAZIMSECTOR){
|
|
|
|
// Read AzimSector's identification.
|
|
|
|
id = in->readInt();
|
|
|
|
// Read AzimSector's properties
|
|
|
|
float minAzimuth = in->readFloat();
|
|
|
|
float maxAzimuth = in->readFloat();
|
|
|
|
float fadeAngle = in->readFloat();
|
2003-09-15 06:48:35 +08:00
|
|
|
setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
2005-11-17 23:03:51 +08:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
throw Exception("AzimSector::read(): Expected AzimSector identification.");
|
|
|
|
}
|
2003-09-15 06:48:35 +08:00
|
|
|
}
|