#include <CigiHatHotXRespV3_2.h>
Inheritance diagram for CigiHatHotXRespV3_2:
Public Member Functions | |
CigiHatHotXRespV3_2 () | |
virtual | ~CigiHatHotXRespV3_2 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
virtual int | GetCnvt (CigiVersionID &CnvtVersion, CigiCnvtInfoType::Type &CnvtInfo) |
int | SetHostFrame (const Cigi_uint8 HostFrameIn, bool bndchk=true) |
Cigi_uint8 | GetHostFrame (void) const |
int | SetHat (const double HatIn, bool bndchk=true) |
double | GetHat (void) const |
int | SetHot (const double HotIn, bool bndchk=true) |
double | GetHot (void) const |
int | SetMaterial (const Cigi_uint32 MaterialIn, bool bndchk=true) |
Cigi_uint32 | GetMaterial (void) const |
int | SetNormAz (const float NormAzIn, bool bndchk=true) |
float | GetNormAz (void) const |
int | SetNormEl (const float NormElIn, bool bndchk=true) |
float | GetNormEl (void) const |
Definition at line 60 of file CigiHatHotXRespV3_2.h.
CigiHatHotXRespV3_2::CigiHatHotXRespV3_2 | ( | ) |
General Constructor
Definition at line 69 of file CigiHatHotXRespV3_2.cpp.
References CIGI_HAT_HOT_XRESP_PACKET_ID_V3_2, CIGI_HAT_HOT_XRESP_PACKET_SIZE_V3_2, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, CigiBaseHatHotResp::Material, CigiBasePacket::MinorVersion, CigiBaseHatHotResp::NormAz, CigiBaseHatHotResp::NormEl, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, CigiBaseHatHotResp::Valid, CigiBasePacket::Version, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.
00070 { 00071 00072 PacketID = CIGI_HAT_HOT_XRESP_PACKET_ID_V3_2; 00073 PacketSize = CIGI_HAT_HOT_XRESP_PACKET_SIZE_V3_2; 00074 Version = 3; 00075 MinorVersion = 2; 00076 00077 HatHotID = 0; 00078 Valid = false; 00079 ReqType = HAT; 00080 HostFrame = 0; 00081 Hat = 0.0; 00082 Hot = 0.0; 00083 Material = 0; 00084 NormAz = 0.0; 00085 NormEl = 0.0; 00086 VldHat = false; 00087 VldHot = false; 00088 00089 }
CigiHatHotXRespV3_2::~CigiHatHotXRespV3_2 | ( | ) | [virtual] |
int CigiHatHotXRespV3_2::GetCnvt | ( | CigiVersionID & | CnvtVersion, | |
CigiCnvtInfoType::Type & | CnvtInfo | |||
) | [virtual] |
A virtual Conversion Information function. This function provides conversion information for this packet.
CnvtVersion | - The CIGI version to which this packet is being converted. | |
CnvtInfo | - The information needed for conversion |
Reimplemented from CigiBasePacket.
Definition at line 239 of file CigiHatHotXRespV3_2.cpp.
References CIGI_HAT_HOT_XRESP_PACKET_ID_V3, CIGI_HAT_RESP_PACKET_ID_V1, CIGI_HOT_RESP_PACKET_ID_V2, CIGI_SUCCESS, CigiVersionID::CigiMajorVersion, CigiCnvtInfoType::CigiCnvtInfoStruct::CnvtPacketID, CigiCnvtInfoType::CigiCnvtInfoStruct::ProcID, and CigiProcessType::ProcStd.
00241 { 00242 CnvtInfo.ProcID = CigiProcessType::ProcStd; 00243 00244 switch(CnvtVersion.CigiMajorVersion) 00245 { 00246 case 1: 00247 CnvtInfo.CnvtPacketID = CIGI_HAT_RESP_PACKET_ID_V1; 00248 break; 00249 case 2: 00250 CnvtInfo.CnvtPacketID = CIGI_HOT_RESP_PACKET_ID_V2; 00251 break; 00252 default: 00253 // The Packet ID for all V3 HatHotXResp are the same ID 00254 CnvtInfo.CnvtPacketID = CIGI_HAT_HOT_XRESP_PACKET_ID_V3; 00255 break; 00256 } 00257 00258 return(CIGI_SUCCESS); 00259 }
double CigiHatHotXRespV3_2::GetHat | ( | void | ) | const [inline] |
Gets the Hat value.
Definition at line 165 of file CigiHatHotXRespV3_2.h.
00165 { return(Hat); }
Cigi_uint8 CigiHatHotXRespV3_2::GetHostFrame | ( | void | ) | const [inline] |
Gets the host frame value.
Definition at line 143 of file CigiHatHotXRespV3_2.h.
00143 { return(HostFrame); }
double CigiHatHotXRespV3_2::GetHot | ( | void | ) | const [inline] |
Gets the Hot value.
Definition at line 187 of file CigiHatHotXRespV3_2.h.
00187 { return(Hot); }
Cigi_uint32 CigiHatHotXRespV3_2::GetMaterial | ( | void | ) | const [inline] |
Gets the Material value.
Definition at line 208 of file CigiHatHotXRespV3_2.h.
00208 { return(Material); }
float CigiHatHotXRespV3_2::GetNormAz | ( | void | ) | const [inline] |
Gets the NormAz value.
Definition at line 226 of file CigiHatHotXRespV3_2.h.
00226 { return(NormAz); }
float CigiHatHotXRespV3_2::GetNormEl | ( | void | ) | const [inline] |
Gets the NormEl value.
Definition at line 244 of file CigiHatHotXRespV3_2.h.
00244 { return(NormEl); }
int CigiHatHotXRespV3_2::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 3
Base | - A pointer to the instance of the packet to be packed. (Downcast to CigiBasePacket) | |
Buff | - A pointer to the current pack point. | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseHatHotResp.
Definition at line 106 of file CigiHatHotXRespV3_2.cpp.
References PackPointerUnion::c, PackPointerUnion::d, PackPointerUnion::f, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, PackPointerUnion::l, CigiBaseHatHotResp::Material, CigiBaseHatHotResp::NormAz, CigiBaseHatHotResp::NormEl, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, PackPointerUnion::s, CigiBaseHatHotResp::Valid, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.
00107 { 00108 PackPointer CDta; 00109 00110 CigiBaseHatHotResp * Data = ( CigiBaseHatHotResp *)Base; 00111 00112 CDta.c = Buff; 00113 00114 *CDta.c++ = PacketID; 00115 *CDta.c++ = PacketSize; 00116 00117 *CDta.s++ = Data->HatHotID; 00118 00119 bool tValid = Data->Valid; 00120 if(!Data->VldHat && !Data->VldHot) 00121 tValid = false; 00122 00123 Cigi_uint8 HDta = (tValid) ? 0x01 : 0; 00124 HDta |= (Data->HostFrame << 4) & 0xf0; 00125 00126 *CDta.c++ = HDta; 00127 *CDta.c++ = 0; 00128 *CDta.s++ = 0; 00129 00130 if(tValid) 00131 { 00132 if(Data->VldHat) 00133 *CDta.d++ = Data->Hat; 00134 else 00135 *CDta.d++ = 0.0; 00136 00137 if(Data->VldHot) 00138 *CDta.d++ = Data->Hot; 00139 else 00140 *CDta.d++ = 0.0; 00141 00142 *CDta.l++ = Data->Material; 00143 *CDta.f++ = Data->NormAz; 00144 *CDta.f++ = Data->NormEl; 00145 00146 } 00147 else 00148 { 00149 *CDta.d++ = 0.0; 00150 *CDta.d++ = 0.0; 00151 *CDta.l++ = 0; 00152 *CDta.f++ = 0.0f; 00153 *CDta.f++ = 0.0f; 00154 } 00155 00156 00157 *CDta.l++ = 0; 00158 00159 return(PacketSize); 00160 00161 }
int CigiHatHotXRespV3_2::SetHat | ( | const double | HatIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Hat with bound checking control
HatIn | - Height above terrain result | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 155 of file CigiHatHotXRespV3_2.h.
References CIGI_SUCCESS.
00156 { 00157 Hat = HatIn; 00158 VldHat = true; 00159 return(CIGI_SUCCESS); 00160 }
int CigiHatHotXRespV3_2::SetHostFrame | ( | const Cigi_uint8 | HostFrameIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the HostFrame with bound checking control
HostFrameIn | - The host frame when the hat/hot was calculated. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 134 of file CigiHatHotXRespV3_2.h.
References CIGI_SUCCESS.
00135 { 00136 HostFrame = HostFrameIn; 00137 return(CIGI_SUCCESS); 00138 }
int CigiHatHotXRespV3_2::SetHot | ( | const double | HotIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Hot with bound checking control
HotIn | - Height of terrain result | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 177 of file CigiHatHotXRespV3_2.h.
References CIGI_SUCCESS.
00178 { 00179 Hot = HotIn; 00180 VldHot = true; 00181 return(CIGI_SUCCESS); 00182 }
int CigiHatHotXRespV3_2::SetMaterial | ( | const Cigi_uint32 | MaterialIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Material with bound checking control
MaterialIn | - Material Code of the test point | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 199 of file CigiHatHotXRespV3_2.h.
References CIGI_SUCCESS.
00200 { 00201 Material = MaterialIn; 00202 return(CIGI_SUCCESS); 00203 }
int CigiHatHotXRespV3_2::SetNormAz | ( | const float | NormAzIn, | |
bool | bndchk = true | |||
) |
Sets the NormAz with bound checking control
NormAzIn | - The Azimuth from true north of the normal vector of the polygon which contains the test point. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 271 of file CigiHatHotXRespV3_2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseHatHotResp::NormAz.
00272 { 00273 00274 #ifndef CIGI_NO_BND_CHK 00275 if(bndchk && ((NormAzIn < -180.0)||(NormAzIn > 180.0))) 00276 { 00277 #ifndef CIGI_NO_EXCEPT 00278 throw CigiValueOutOfRangeException("NormAz",(float)NormAzIn,-180.0,180.0); 00279 #endif 00280 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00281 } 00282 #endif 00283 00284 NormAz = NormAzIn; 00285 return(CIGI_SUCCESS); 00286 00287 }
int CigiHatHotXRespV3_2::SetNormEl | ( | const float | NormElIn, | |
bool | bndchk = true | |||
) |
Sets the NormEl with bound checking control
NormElIn | - The Elevation of the normal vector of the polygon which contains the test point. | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 293 of file CigiHatHotXRespV3_2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseHatHotResp::NormEl.
00294 { 00295 00296 #ifndef CIGI_NO_BND_CHK 00297 if(bndchk && ((NormElIn < -90.0)||(NormElIn > 90.0))) 00298 { 00299 #ifndef CIGI_NO_EXCEPT 00300 throw CigiValueOutOfRangeException("NormEl",(float)NormElIn,-90.0,90.0); 00301 #endif 00302 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00303 } 00304 #endif 00305 00306 NormEl = NormElIn; 00307 return(CIGI_SUCCESS); 00308 00309 }
int CigiHatHotXRespV3_2::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 3
Buff | - A pointer to the current pack point. | |
Swap | - N/A for V1 & V2 | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseHatHotResp.
Definition at line 166 of file CigiHatHotXRespV3_2.cpp.
References PackPointerUnion::c, CigiSwap2(), CigiSwap4(), CigiSwap8(), PackPointerUnion::d, PackPointerUnion::f, CigiBaseHatHotResp::HAT, CigiBaseHatHotResp::Hat, CigiBaseHatHotResp::HatHotID, CigiBaseHatHotResp::HostFrame, CigiBaseHatHotResp::Hot, PackPointerUnion::l, CigiBaseHatHotResp::Material, CigiBaseHatHotResp::NormAz, CigiBaseHatHotResp::NormEl, CigiBasePacket::PacketSize, CigiBaseHatHotResp::ReqType, PackPointerUnion::s, CigiBaseHatHotResp::Valid, CigiBaseHatHotResp::VldHat, and CigiBaseHatHotResp::VldHot.
00167 { 00168 PackPointer CDta; 00169 00170 CDta.c = Buff; 00171 00172 CDta.c += 2; // Step over packet id and size 00173 00174 if(!Swap) 00175 { 00176 HatHotID = *CDta.s++; 00177 00178 Cigi_uint8 HDta = *CDta.c++; 00179 Valid = ((HDta & 0x01) != 0); 00180 HostFrame = (Cigi_uint8)((HDta >> 4) & 0x0f); 00181 00182 CDta.c += 3; 00183 00184 Hat = *CDta.d++; 00185 Hot = *CDta.d++; 00186 Material = *CDta.l++; 00187 NormAz = *CDta.f++; 00188 NormEl = *CDta.f++; 00189 00190 if(Valid) 00191 { 00192 VldHat = true; 00193 VldHot = true; 00194 } 00195 else 00196 { 00197 VldHat = false; 00198 VldHot = false; 00199 } 00200 } 00201 else 00202 { 00203 CigiSwap2(&HatHotID, CDta.s++); 00204 00205 Cigi_uint8 HDta = *CDta.c++; 00206 Valid = ((HDta & 0x01) != 0); 00207 HostFrame = (Cigi_uint8)((HDta >> 4) & 0x0f); 00208 00209 CDta.c += 3; 00210 00211 CigiSwap8(&Hat, CDta.d++); 00212 CigiSwap8(&Hot, CDta.d++); 00213 CigiSwap4(&Material, CDta.l++); 00214 CigiSwap4(&NormAz, CDta.f++); 00215 CigiSwap4(&NormEl, CDta.f++); 00216 00217 if(Valid) 00218 { 00219 VldHat = true; 00220 VldHot = true; 00221 } 00222 else 00223 { 00224 VldHat = false; 00225 VldHot = false; 00226 } 00227 } 00228 00229 ReqType = HAT; // For Cigi Version 1 and 2 compatibility 00230 00231 return(PacketSize); 00232 00233 }