#include <CigiWeatherCtrlV3.h>
Inheritance diagram for CigiWeatherCtrlV3:
Public Member Functions | |
CigiWeatherCtrlV3 () | |
virtual | ~CigiWeatherCtrlV3 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
int | SetRegionID (const Cigi_uint16 RegionIDIn, bool bndchk=true) |
Cigi_uint16 | GetRegionID (void) const |
int | SetLayerID (const Cigi_uint8 LayerIDIn, bool bndchk=true) |
Cigi_uint8 | GetLayerID (void) const |
int | SetHumidity (const Cigi_uint8 HumidityIn, bool bndchk=true) |
Cigi_uint8 | GetHumidity (void) const |
int | SetRandomLightningEn (const bool RandomLightningEnIn, bool bndchk=true) |
bool | GetRandomLightningEn (void) const |
int | SetCloudType (const CloudTypeGrp CloudTypeIn, bool bndchk=true) |
CloudTypeGrp | GetCloudType (void) const |
int | SetScope (const ScopeGrp ScopeIn, bool bndchk=true) |
ScopeGrp | GetScope (void) const |
int | SetVertWindSp (const float VertWindSpIn, bool bndchk=true) |
float | GetVertWindSp (void) const |
int | SetWindDir (const float WindDirIn, bool bndchk=true) |
float | GetWindDir (void) const |
int | SetBaroPress (const float BaroPressIn, bool bndchk=true) |
float | GetBaroPress (void) const |
int | SetAerosol (const float AerosolIn, bool bndchk=true) |
float | GetAerosol (void) const |
Definition at line 61 of file CigiWeatherCtrlV3.h.
CigiWeatherCtrlV3::CigiWeatherCtrlV3 | ( | ) |
General Constructor
Definition at line 67 of file CigiWeatherCtrlV3.cpp.
References CigiBaseWeatherCtrl::Aerosol, CigiBaseWeatherCtrl::AirTemp, CigiBaseWeatherCtrl::BaroPress, CigiBaseWeatherCtrl::BaseElev, CIGI_WEATHER_CTRL_PACKET_ID_V3, CIGI_WEATHER_CTRL_PACKET_SIZE_V3, CigiBaseWeatherCtrl::CloudType, CigiBaseWeatherCtrl::Coverage, CigiBaseWeatherCtrl::EntityID, CigiBaseWeatherCtrl::Global, CigiBaseWeatherCtrl::HorizWindSp, CigiBaseWeatherCtrl::Humidity, CigiBaseWeatherCtrl::LayerID, CigiBasePacket::MinorVersion, CigiBaseWeatherCtrl::None, CigiBaseWeatherCtrl::Opacity, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseWeatherCtrl::PhenomenonType, CigiBaseWeatherCtrl::RandomLightningEn, CigiBaseWeatherCtrl::RandomWindsEn, CigiBaseWeatherCtrl::RegionID, CigiBaseWeatherCtrl::Scope, CigiBaseWeatherCtrl::ScudEn, CigiBaseWeatherCtrl::ScudFreq, CigiBaseWeatherCtrl::Severity, CigiBaseWeatherCtrl::Thickness, CigiBaseWeatherCtrl::Transition, CigiBasePacket::Version, CigiBaseWeatherCtrl::VertWindSp, CigiBaseWeatherCtrl::VisibilityRng, CigiBaseWeatherCtrl::WeatherEn, and CigiBaseWeatherCtrl::WindDir.
00068 { 00069 00070 PacketID = CIGI_WEATHER_CTRL_PACKET_ID_V3; 00071 PacketSize = CIGI_WEATHER_CTRL_PACKET_SIZE_V3; 00072 Version = 3; 00073 MinorVersion = 0; 00074 00075 EntityID = 0; 00076 RegionID = 0; 00077 LayerID = 0; 00078 Humidity = 0; 00079 PhenomenonType = 0; 00080 WeatherEn = false; 00081 ScudEn = false; 00082 RandomWindsEn = false; 00083 RandomLightningEn = false; 00084 CloudType = None; 00085 Scope = Global; 00086 Severity = 0; 00087 AirTemp = 0.0; 00088 VisibilityRng = 0.0; 00089 Opacity = 0.0; 00090 ScudFreq = 0.0; 00091 Coverage = 0.0; 00092 BaseElev = 0.0; 00093 Thickness = 0.0; 00094 Transition = 0.0; 00095 HorizWindSp = 0.0; 00096 VertWindSp = 0.0; 00097 WindDir = 0.0; 00098 BaroPress = 1013.25; 00099 Aerosol = 0.0; 00100 00101 }
CigiWeatherCtrlV3::~CigiWeatherCtrlV3 | ( | ) | [virtual] |
float CigiWeatherCtrlV3::GetAerosol | ( | void | ) | const [inline] |
Gets the Aerosol value.
Definition at line 316 of file CigiWeatherCtrlV3.h.
00316 { return(Aerosol); }
float CigiWeatherCtrlV3::GetBaroPress | ( | void | ) | const [inline] |
Gets the BaroPress value.
Definition at line 295 of file CigiWeatherCtrlV3.h.
00295 { return(BaroPress); }
CloudTypeGrp CigiWeatherCtrlV3::GetCloudType | ( | void | ) | const [inline] |
Gets the CloudType value.
Definition at line 216 of file CigiWeatherCtrlV3.h.
00216 { return(CloudType); }
Cigi_uint8 CigiWeatherCtrlV3::GetHumidity | ( | void | ) | const [inline] |
Gets the Humidity value.
Definition at line 162 of file CigiWeatherCtrlV3.h.
00162 { return(Humidity); }
Cigi_uint8 CigiWeatherCtrlV3::GetLayerID | ( | void | ) | const [inline] |
Gets the LayerID value.
Definition at line 145 of file CigiWeatherCtrlV3.h.
00145 { return(LayerID); }
bool CigiWeatherCtrlV3::GetRandomLightningEn | ( | void | ) | const [inline] |
Gets the RandomLightningEn value.
Definition at line 183 of file CigiWeatherCtrlV3.h.
00183 { return(RandomLightningEn); }
Cigi_uint16 CigiWeatherCtrlV3::GetRegionID | ( | void | ) | const [inline] |
Gets the RegionID value.
Definition at line 128 of file CigiWeatherCtrlV3.h.
00128 { return(RegionID); }
ScopeGrp CigiWeatherCtrlV3::GetScope | ( | void | ) | const [inline] |
Gets the Scope value.
Definition at line 236 of file CigiWeatherCtrlV3.h.
00236 { return(Scope); }
float CigiWeatherCtrlV3::GetVertWindSp | ( | void | ) | const [inline] |
Gets the WindDirEl value.
Definition at line 257 of file CigiWeatherCtrlV3.h.
00257 { return(VertWindSp); }
float CigiWeatherCtrlV3::GetWindDir | ( | void | ) | const [inline] |
Gets the WindDirAz value.
Definition at line 274 of file CigiWeatherCtrlV3.h.
00274 { return(WindDir); }
int CigiWeatherCtrlV3::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 CigiBaseWeatherCtrl.
Definition at line 118 of file CigiWeatherCtrlV3.cpp.
References CigiBaseWeatherCtrl::Aerosol, CigiBaseWeatherCtrl::AirTemp, CigiBaseWeatherCtrl::BaroPress, CigiBaseWeatherCtrl::BaseElev, PackPointerUnion::c, CigiBaseWeatherCtrl::CloudType, CigiBaseWeatherCtrl::Coverage, CigiBaseWeatherCtrl::EntityID, PackPointerUnion::f, CigiBaseWeatherCtrl::Global, CigiBaseWeatherCtrl::HorizWindSp, CigiBaseWeatherCtrl::Humidity, CigiBaseWeatherCtrl::LayerID, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseWeatherCtrl::RandomLightningEn, CigiBaseWeatherCtrl::RandomWindsEn, CigiBaseWeatherCtrl::Regional, CigiBaseWeatherCtrl::RegionID, PackPointerUnion::s, CigiBaseWeatherCtrl::Scope, CigiBaseWeatherCtrl::ScudEn, CigiBaseWeatherCtrl::ScudFreq, CigiBaseWeatherCtrl::Severity, CigiBaseWeatherCtrl::Thickness, CigiBaseWeatherCtrl::Transition, CigiBaseWeatherCtrl::VertWindSp, CigiBaseWeatherCtrl::VisibilityRng, CigiBaseWeatherCtrl::WeatherEn, and CigiBaseWeatherCtrl::WindDir.
00119 { 00120 PackPointer CDta; 00121 00122 CigiBaseWeatherCtrl * Data = ( CigiBaseWeatherCtrl *)Base; 00123 00124 CDta.c = Buff; 00125 00126 *CDta.c++ = PacketID; 00127 *CDta.c++ = PacketSize; 00128 00129 if(Data->Scope == Global) 00130 *CDta.s++ = 0; 00131 else if(Data->Scope == Regional) 00132 *CDta.s++ = Data->RegionID; 00133 else 00134 *CDta.s++ = Data->EntityID; 00135 00136 *CDta.c++ = Data->LayerID; 00137 *CDta.c++ = Data->Humidity; 00138 00139 Cigi_uint8 HDta = (Data->WeatherEn) ? 0x01 : 0x00; 00140 HDta |= (Data->ScudEn) ? 0x02 : 0x00; 00141 HDta |= (Data->RandomWindsEn) ? 0x04 : 0x00; 00142 HDta |= (Data->RandomLightningEn) ? 0x08 : 0x00; 00143 HDta |= (Data->CloudType << 4) & 0xf0; 00144 00145 *CDta.c++ = HDta; 00146 00147 HDta = Data->Scope & 0x03; 00148 HDta |= (Data->Severity << 2) & 0x1c; 00149 00150 *CDta.c++ = HDta; 00151 00152 *CDta.f++ = Data->AirTemp; 00153 *CDta.f++ = Data->VisibilityRng; 00154 *CDta.f++ = Data->ScudFreq; 00155 *CDta.f++ = Data->Coverage; 00156 *CDta.f++ = Data->BaseElev; 00157 *CDta.f++ = Data->Thickness; 00158 *CDta.f++ = Data->Transition; 00159 *CDta.f++ = Data->HorizWindSp; 00160 *CDta.f++ = Data->VertWindSp; 00161 00162 float Wndir = Data->WindDir; 00163 if(Wndir > 180.0) 00164 Wndir -= 360.0; 00165 *CDta.f++ = Wndir; 00166 00167 *CDta.f++ = Data->BaroPress; 00168 *CDta.f++ = Data->Aerosol; 00169 00170 return(PacketSize); 00171 00172 }
int CigiWeatherCtrlV3::SetAerosol | ( | const float | AerosolIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Aerosol with bound checking control
AerosolIn | - Aerosol consentration | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 307 of file CigiWeatherCtrlV3.h.
References CIGI_SUCCESS.
00308 { 00309 Aerosol = AerosolIn; 00310 return(CIGI_SUCCESS); 00311 }
int CigiWeatherCtrlV3::SetBaroPress | ( | const float | BaroPressIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the BaroPress with bound checking control
BaroPressIn | - Barometric pressure | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 286 of file CigiWeatherCtrlV3.h.
References CIGI_SUCCESS.
00287 { 00288 BaroPress = BaroPressIn; 00289 return(CIGI_SUCCESS); 00290 }
int CigiWeatherCtrlV3::SetCloudType | ( | const CloudTypeGrp | CloudTypeIn, | |
bool | bndchk = true | |||
) |
Sets the CloudType with bound checking control
CloudTypeIn | - Cloud type specification None=0 Altocumulus=1 Altostratus=2 Cirrocumulus=3 Cirrostratus=4 Cirrus=5 Cumulonimbus=6 Cumulus=7 Nimbostratus=8 Stratocumulus=9 Stratus=10 DefA=11 DefB=12 DefC=13 DefD=14 DefE=15 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 310 of file CigiWeatherCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseWeatherCtrl::CloudType.
00311 { 00312 00313 #ifndef CIGI_NO_BND_CHK 00314 if(bndchk && ((CloudTypeIn < 0)||(CloudTypeIn > 15))) 00315 { 00316 #ifndef CIGI_NO_EXCEPT 00317 throw CigiValueOutOfRangeException("CloudType",(CloudTypeGrp)CloudTypeIn,0,15); 00318 #endif 00319 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00320 } 00321 #endif 00322 00323 CloudType = CloudTypeIn; 00324 return(CIGI_SUCCESS); 00325 00326 }
int CigiWeatherCtrlV3::SetHumidity | ( | const Cigi_uint8 | HumidityIn, | |
bool | bndchk = true | |||
) |
Sets the Humidity with bound checking control
HumidityIn | - The weather area's humidity | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 288 of file CigiWeatherCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseWeatherCtrl::Humidity.
00289 { 00290 00291 #ifndef CIGI_NO_BND_CHK 00292 if(bndchk && ((HumidityIn < 0)||(HumidityIn > 100))) 00293 { 00294 #ifndef CIGI_NO_EXCEPT 00295 throw CigiValueOutOfRangeException("Humidity",(Cigi_uint8)HumidityIn,0,100); 00296 #endif 00297 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00298 } 00299 #endif 00300 00301 Humidity = HumidityIn; 00302 return(CIGI_SUCCESS); 00303 00304 }
int CigiWeatherCtrlV3::SetLayerID | ( | const Cigi_uint8 | LayerIDIn, | |
bool | bndchk = true | |||
) |
Sets the LayerID with bound checking control
LayerIDIn | - Layer ID | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 277 of file CigiWeatherCtrlV3.cpp.
References CIGI_SUCCESS, and CigiBaseWeatherCtrl::LayerID.
00278 { 00279 LayerID = LayerIDIn; 00280 00281 return(CIGI_SUCCESS); 00282 }
int CigiWeatherCtrlV3::SetRandomLightningEn | ( | const bool | RandomLightningEnIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the RandomLightningEn with bound checking control
RandomLightningEnIn | - Random lightning enable | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 174 of file CigiWeatherCtrlV3.h.
References CIGI_SUCCESS.
00175 { 00176 RandomLightningEn = RandomLightningEnIn; 00177 return(CIGI_SUCCESS); 00178 }
int CigiWeatherCtrlV3::SetRegionID | ( | const Cigi_uint16 | RegionIDIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the RegionID with bound checking control
RegionIDIn | - Region ID | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 119 of file CigiWeatherCtrlV3.h.
References CIGI_SUCCESS.
00120 { 00121 RegionID = RegionIDIn; 00122 return(CIGI_SUCCESS); 00123 }
int CigiWeatherCtrlV3::SetScope | ( | const ScopeGrp | ScopeIn, | |
bool | bndchk = true | |||
) |
Sets the Scope with bound checking control
ScopeIn | - Weather effects scope Global=0 Regional=1 Entity=2 | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 332 of file CigiWeatherCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseWeatherCtrl::Scope.
00333 { 00334 00335 #ifndef CIGI_NO_BND_CHK 00336 if(bndchk && ((ScopeIn < 0)||(ScopeIn > 2))) 00337 { 00338 #ifndef CIGI_NO_EXCEPT 00339 throw CigiValueOutOfRangeException("Scope",(ScopeGrp)ScopeIn,0,2); 00340 #endif 00341 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00342 } 00343 #endif 00344 00345 Scope = ScopeIn; 00346 return(CIGI_SUCCESS); 00347 00348 }
int CigiWeatherCtrlV3::SetVertWindSp | ( | const float | VertWindSpIn, | |
bool | bndchk = true | |||
) | [inline] |
Sets the VertWindSp with bound checking control
VertWindSpIn | - Verticle Wind Speed | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 248 of file CigiWeatherCtrlV3.h.
References CIGI_SUCCESS.
00249 { 00250 VertWindSp = VertWindSpIn; 00251 return(CIGI_SUCCESS); 00252 }
int CigiWeatherCtrlV3::SetWindDir | ( | const float | WindDirIn, | |
bool | bndchk = true | |||
) |
Sets the WindDir with bound checking control
WindDirIn | - Wind direction | |
bndchk | - Enables (true) or disables (false) bounds checking. |
Definition at line 354 of file CigiWeatherCtrlV3.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseWeatherCtrl::WindDir.
00355 { 00356 00357 #ifndef CIGI_NO_BND_CHK 00358 if(bndchk && ((WindDirIn < -180.0)||(WindDirIn > 180.0))) 00359 { 00360 #ifndef CIGI_NO_EXCEPT 00361 throw CigiValueOutOfRangeException("WindDir",(float)WindDirIn,-180.0,180.0); 00362 #endif 00363 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00364 } 00365 #endif 00366 00367 WindDir = WindDirIn; 00368 return(CIGI_SUCCESS); 00369 00370 }
int CigiWeatherCtrlV3::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 CigiBaseWeatherCtrl.
Definition at line 177 of file CigiWeatherCtrlV3.cpp.
References CigiBaseWeatherCtrl::Aerosol, CigiBaseWeatherCtrl::AirTemp, CigiBaseWeatherCtrl::BaroPress, CigiBaseWeatherCtrl::BaseElev, PackPointerUnion::c, CigiSwap2(), CigiSwap4(), CigiBaseWeatherCtrl::CloudType, CigiBaseWeatherCtrl::Coverage, CigiBaseWeatherCtrl::Entity, CigiBaseWeatherCtrl::EntityID, PackPointerUnion::f, CigiBaseWeatherCtrl::HorizWindSp, CigiBaseWeatherCtrl::Humidity, CigiBaseWeatherCtrl::LayerID, CigiBaseWeatherCtrl::Opacity, CigiBasePacket::PacketSize, CigiBaseWeatherCtrl::PhenomenonType, CigiBaseWeatherCtrl::RandomLightningEn, CigiBaseWeatherCtrl::RandomWindsEn, CigiBaseWeatherCtrl::RegionID, PackPointerUnion::s, CigiBaseWeatherCtrl::Scope, CigiBaseWeatherCtrl::ScudEn, CigiBaseWeatherCtrl::ScudFreq, CigiBaseWeatherCtrl::Severity, CigiBaseWeatherCtrl::Thickness, CigiBaseWeatherCtrl::Transition, CigiBaseWeatherCtrl::VertWindSp, CigiBaseWeatherCtrl::VisibilityRng, CigiBaseWeatherCtrl::WeatherEn, and CigiBaseWeatherCtrl::WindDir.
00178 { 00179 PackPointer CDta; 00180 00181 static Cigi_uint8 PhenTbl[10] = { 3,1,2,2,4,5,5,5,6,6 }; 00182 00183 CDta.c = Buff; 00184 00185 CDta.c += 2; // Step over packet id and size 00186 00187 if(!Swap) 00188 { 00189 EntityID = *CDta.s++; 00190 LayerID = *CDta.c++; 00191 Humidity = *CDta.c++; 00192 00193 Cigi_uint8 HDta = *CDta.c++; 00194 WeatherEn = ((HDta & 0x01) != 0); 00195 ScudEn = ((HDta & 0x02) != 0); 00196 RandomWindsEn = ((HDta & 0x04) != 0); 00197 RandomLightningEn = ((HDta & 0x08) != 0); 00198 CloudType = (CloudTypeGrp)((HDta >> 4) & 0x0f); 00199 00200 HDta = *CDta.c++; 00201 Scope = (ScopeGrp)(HDta & 0x03); 00202 Severity = (HDta >> 2) & 0x07; 00203 00204 AirTemp = *CDta.f++; 00205 VisibilityRng = *CDta.f++; 00206 ScudFreq = *CDta.f++; 00207 Coverage = *CDta.f++; 00208 BaseElev = *CDta.f++; 00209 Thickness = *CDta.f++; 00210 Transition = *CDta.f++; 00211 HorizWindSp = *CDta.f++; 00212 VertWindSp = *CDta.f++; 00213 WindDir = *CDta.f++; 00214 BaroPress = *CDta.f++; 00215 Aerosol = *CDta.f++; 00216 } 00217 else 00218 { 00219 CigiSwap2(&EntityID, CDta.s++); 00220 LayerID = *CDta.c++; 00221 Humidity = *CDta.c++; 00222 00223 Cigi_uint8 HDta = *CDta.c++; 00224 WeatherEn = ((HDta & 0x01) != 0); 00225 ScudEn = ((HDta & 0x02) != 0); 00226 RandomWindsEn = ((HDta & 0x04) != 0); 00227 RandomLightningEn = ((HDta & 0x08) != 0); 00228 CloudType = (CloudTypeGrp)((HDta >> 4) & 0x0f); 00229 00230 HDta = *CDta.c++; 00231 Scope = (ScopeGrp)(HDta & 0x03); 00232 Severity = (HDta >> 2) & 0x07; 00233 00234 CigiSwap4(&AirTemp, CDta.f++); 00235 CigiSwap4(&VisibilityRng, CDta.f++); 00236 CigiSwap4(&ScudFreq, CDta.f++); 00237 CigiSwap4(&Coverage, CDta.f++); 00238 CigiSwap4(&BaseElev, CDta.f++); 00239 CigiSwap4(&Thickness, CDta.f++); 00240 CigiSwap4(&Transition, CDta.f++); 00241 CigiSwap4(&HorizWindSp, CDta.f++); 00242 CigiSwap4(&VertWindSp, CDta.f++); 00243 CigiSwap4(&WindDir, CDta.f++); 00244 CigiSwap4(&BaroPress, CDta.f++); 00245 CigiSwap4(&Aerosol, CDta.f++); 00246 } 00247 00248 RegionID = EntityID; 00249 00250 if(Scope == Entity) 00251 PhenomenonType = 0; 00252 else if(LayerID < 10) 00253 { 00254 PhenomenonType = PhenTbl[LayerID]; 00255 } 00256 else 00257 PhenomenonType = LayerID; 00258 00259 Opacity = ((VisibilityRng/70000.0f)*100.0f); 00260 00261 00262 00263 return(PacketSize); 00264 00265 }