CIGIPP/WeatherControl.pm

filter: Statementstmt 72.7% 139 / 191 Branchbran 43.2% 32 / 74 Conditioncond 33.3% 13 / 39 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 93.9% 31 / 33 Podpod 100% 29 / 29 totaltotal 62.8% 244 / 388 CC 52 SCAR 16.6
CC
52
Cov
61%
new
19.6
humidity
7.1
cloud_type
6.7
CRAP 5.3
« CIGIPP/ViewControl.pm ↑ Summary CIGIPP/CollisionDetectionVolumeDefinition.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78ad2ec-200e-11de-bdac-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::WeatherControl;
8  
9 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 require Exporter;
15  
16 2 our @ISA = qw(Exporter);
17  
18 # Items to export into callers namespace by default. Note: do not export
19 # names by default without a very good reason. Use EXPORT_OK instead.
20 # Do not simply export all your public functions/methods/constants.
21  
22 # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all';
23 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
24 # will save memory.
25 2 our %EXPORT_TAGS = ( 'all' => [ qw(
26
27 ) ] );
28  
29 2 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30  
31 2 our @EXPORT = qw(
32
33 );
34  
35 2 our $VERSION = '0.01';
36  
37 # Preloaded methods go here.
38  
39 =head1 NAME
40  
41 Rinchi::CIGIPP::WeatherControl - Perl extension for the Common Image Generator
42 Interface - Weather Control data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::WeatherControl;
47 my $wthr_ctl = Rinchi::CIGIPP::WeatherControl->new();
48  
49 $packet_type = $wthr_ctl->packet_type();
50 $packet_size = $wthr_ctl->packet_size();
51 $entity_ident = $wthr_ctl->entity_ident(22740);
52 $region_ident = $wthr_ctl->region_ident(59769);
53 $layer_ident = $wthr_ctl->layer_ident(131);
54 $humidity = $wthr_ctl->humidity(89);
55 $cloud_type = $wthr_ctl->cloud_type(Rinchi::CIGIPP->None);
56 $random_lightning_enable = $wthr_ctl->random_lightning_enable(Rinchi::CIGIPP->Disable);
57 $random_winds_enable = $wthr_ctl->random_winds_enable(Rinchi::CIGIPP->Disable);
58 $scud_enable = $wthr_ctl->scud_enable(Rinchi::CIGIPP->Enable);
59 $weather_enable = $wthr_ctl->weather_enable(Rinchi::CIGIPP->Enable);
60 $severity = $wthr_ctl->severity(2);
61 $weather_scope = $wthr_ctl->weather_scope(Rinchi::CIGIPP->RegionalScope);
62 $air_temperature = $wthr_ctl->air_temperature(15.426);
63 $visibility_range = $wthr_ctl->visibility_range(89.817);
64 $scud_frequency = $wthr_ctl->scud_frequency(2.31);
65 $coverage = $wthr_ctl->coverage(84.412);
66 $base_elevation = $wthr_ctl->base_elevation(47.967);
67 $thickness = $wthr_ctl->thickness(38.301);
68 $transition_band = $wthr_ctl->transition_band(70.407);
69 $horizontal_wind_speed = $wthr_ctl->horizontal_wind_speed(45.598);
70 $vertical_wind_speed = $wthr_ctl->vertical_wind_speed(85.529);
71 $wind_direction = $wthr_ctl->wind_direction(62.819);
72 $barometric_pressure = $wthr_ctl->barometric_pressure(82.459);
73 $aerosol_concentration = $wthr_ctl->aerosol_concentration(3.569);
74  
75 =head1 DESCRIPTION
76  
77 The Weather Control packet is used to control weather layers and weather
78 entities. Global weather layers have no distinct horizontal boundaries.
79 Atmospheric affects can be observed anywhere within the vertical range of the
80 layer. Regional weather layers occur only in areas defined by the Environmental
81 Region Control packet (CIGI ICD Section 4.1.11). Weather entities are entities
82 that represent meteorological phenomena.
83  
84 The Layer ID attribute specifies the global or regional weather layer whose
85 attributes are being set. If the Scope attribute is set to Global (0), the
86 weather layer exists everywhere over the database. If this attribute is set to
87 Region (1), the weather layer is bound to the region specified by the Region ID
88 attribute. Up to 256 weather layers may be defined globally, and up to 256
89 layers may be defined within each region. The Layer ID attribute is ignored for
90 weather entities.
91  
92 The Cloud Type attribute specifies the type of cloud found within a cloud layer
93 or entity. Each value may correspond to a specific cloud texture or model.
94 Values one through 10 are reserved for the most common general cloud types as
95 listed in Table 18. The remaining values can be used for mammatus clouds,
96 Kelvin-Helmholtz cloud effects, and other specific cloud phenomena.
97  
98 The vertical range of a weather layer is specified by the Base Elevation,
99 Thickness, and Transition Band attributes. Base Elevation specifies the
100 distance from Mean Sea Level to the bottom of the layer. Thickness is the
101 vertical height of the layer. Transition Band specifies the vertical height of
102 both the region above and below the layer through which visibility gradually
103 changes from that of the layer to that immediately outside the region.
104  
105 For weather entities, the Transition Band attribute can be used to specify a
106 threshold radius for partial penetration into a cloud model. The Base Elevation
107 and Thickness attributes are ignored for weather entities.
108  
109 The Scud Enable attribute specifies whether the layer produces scud effects
110 within the transition band. The Scud Frequency attribute defines how often scud
111 occurs. The placement of scud (i.e., above versus below the layer) depends upon
112 the IG implementation. Some systems allow this to be controlled via a Component
113 Control packet.
114  
115 The Horizontal Wind Speed, Vertical Wind Speed, and Wind Direction attributes
116 define the wind velocity within the weather layer or entity. These can be used
117 to specify surface winds or winds aloft, depending upon the base elevation and
118 thickness of the layer or the altitude of the weather entity. The Random Winds
119 Enable attribute causes the IG to create gusts of random duration and
120 frequency.
121 A typical effect of weather layers is the suspension of liquid or solid
122 particles in the air. The density of this particulate matter is specified by
123 the Aerosol Concentration attribute. The most common aerosol is liquid water,
124 but ice crystals, sand, and dust are also common. Weather layers may also be
125 used to create smoke, combat haze, and other man-made airborne contaminants.
126 Each layer can contain zero or one type of mutable aerosol; multiple aerosols
127 in a given space must be implemented as separate weather layers.
128  
129 Where weather layers overlap, atmospheric effects should be combined as as
130 described in the CIGI ICD.
131  
132 =head2 EXPORT
133  
134 None by default.
135  
136 #==============================================================================
137  
138 =item new $wthr_ctl = Rinchi::CIGIPP::WeatherControl->new()
139  
140 Constructor for Rinchi::WeatherControl.
141  
142 =cut
143  
144 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
145 2 my $class = shift;
146 2 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
147  
148 2 my $self = {
149 '_Buffer' => '',
150 '_ClassIdent' => 'f78ad2ec-200e-11de-bdac-001c25551abc',
151 '_Pack' => 'CCSCCCCffffffffffff',
152 '_Swap1' => 'CCvCCCCVVVVVVVVVVVV',
153 '_Swap2' => 'CCnCCCCNNNNNNNNNNNN',
154 'packetType' => 12,
155 'packetSize' => 56,
156 'regionEntityIdent' => 0,
157 'layerIdent' => 0,
158 'humidity' => 0,
159 '_bitfields1' => 0, # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
160 'cloudType' => 0,
161 'randomLightningEnable' => 0,
162 'randomWindsEnable' => 0,
163 'scudEnable' => 0,
164 'weatherEnable' => 0,
165 '_bitfields2' => 0, # Includes bitfields unused21, severity, and weatherScope.
166 'severity' => 0,
167 'weatherScope' => 0,
168 'airTemperature' => 0,
169 'visibilityRange' => 0,
170 'scudFrequency' => 0,
171 'coverage' => 0,
172 'baseElevation' => 0,
173 'thickness' => 0,
174 'transitionBand' => 0,
175 'horizontalWindSpeed' => 0,
176 'verticalWindSpeed' => 0,
177 'windDirection' => 0,
178 'barometricPressure' => 0,
179 'aerosolConcentration' => 0,
180 };
181  
182 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
183 0 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 0 0
elsif (ref $_[0] eq 'HASH') { } 0 0 0
184 0 $self->{'_Buffer'} = $_[0][0];
185 } elsif (ref($_[0]) eq 'HASH') {
186 0 foreach my $attr (keys %{$_[0]}) {
187 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
188 }
189 }
190 }
191  
192 2 bless($self,$class);
193 2 return $self;
194 }
195  
196 #==============================================================================
197  
198 =item sub packet_type()
199  
200 $value = $wthr_ctl->packet_type();
201  
202 Data Packet Identifier.
203  
204 This attribute identifies this data packet as the Weather Control packet. The
205 value of this attribute must be 12.
206  
207 =cut
208  
209 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
210 2 my ($self) = @_;
211 2 return $self->{'packetType'};
212 }
213  
214 #==============================================================================
215  
216 =item sub packet_size()
217  
218 $value = $wthr_ctl->packet_size();
219  
220 Data Packet Size.
221  
222 This attribute indicates the number of bytes in this data packet. The value of
223 this attribute must be 56.
224  
225 =cut
226  
227 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
228 2 my ($self) = @_;
229 2 return $self->{'packetSize'};
230 }
231  
232 #==============================================================================
233  
234 =item sub entity_ident([$newValue])
235  
236 $value = $wthr_ctl->entity_ident($newValue);
237  
238 Entity ID. (Weather Entities)
239  
240 This attribute specifies the entity to which the weather attributes in this
241 packet are applied.
242  
243 Note: Entity ID/Region ID is ignored if Scope is set to Global (0).
244  
245 =cut
246  
247 2 ▶sub entity_ident() {
Subroutine entity_ident: called CC=2 SCAR=7.0
Pod documented
248 2 my ($self,$nv) = @_;
249 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
250 2 $self->{'entityIdent'} = $nv;
251 }
252 2 return $self->{'entityIdent'};
253 }
254  
255 #==============================================================================
256  
257 =item sub region_ident([$newValue])
258  
259 $value = $wthr_ctl->region_ident($newValue);
260  
261 Region ID.
262  
263 This attribute specifies the region to which the weather layer is confined.
264  
265 Note: Entity ID/Region ID is ignored if Scope is set to Global (0).
266  
267 =cut
268  
269 2 ▶sub region_ident() {
Subroutine region_ident: called CC=2 SCAR=7.0
Pod documented
270 2 my ($self,$nv) = @_;
271 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
272 2 $self->{'regionIdent'} = $nv;
273 }
274 2 return $self->{'regionIdent'};
275 }
276  
277 #==============================================================================
278  
279 =item sub layer_ident([$newValue])
280  
281 $value = $wthr_ctl->layer_ident($newValue);
282  
283 Layer ID.
284  
285 This attribute specifies the weather layer to which the data in this packet are
286 applied. This attribute also determines the type of aerosol contained within
287 the layer.
288  
289 Values 0 through 9 are defined as standard weather layer types. Values beyond
290 this range are defined in the IG configuration.
291  
292 Note: This attribute is ignored if Scope is set to Entity (2).
293  
294 =cut
295  
296 2 ▶sub layer_ident() {
Subroutine layer_ident: called CC=2 SCAR=7.0
Pod documented
297 2 my ($self,$nv) = @_;
298 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
299 2 $self->{'layerIdent'} = $nv;
300 }
301 2 return $self->{'layerIdent'};
302 }
303  
304 #==============================================================================
305  
306 =item sub humidity([$newValue])
307  
308 $value = $wthr_ctl->humidity($newValue);
309  
310 Humidity.
311  
312 This attribute specifies the humidity, measured in percent, within the weather layer/entity.
313  
314 =cut
315  
316 2 ▶sub humidity() {
Subroutine humidity: called CC=5 SCAR=19.6
Pod documented
317 2 my ($self,$nv) = @_;
318 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
319 2 ▶ if ($nv>=0 and $nv<=100 and int($nv)==$nv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 0 and $nv <= 100 and int $nv == $nv) { } 2 0 2
Condition33%2/6
$nv >= 0 and $nv <= 100 and int $nv == $nv
!ll&&!rl&&r
002
$nv >= 0 and $nv <= 100
!ll&&!rl&&r
002
MC/DC0%0/3
$nv >= 0 and $nv <= 100 and int $nv == $nv
$nv >= 0 $nv <= 100 int $nv == $nv
Truth table25%1/4
A and B and C
A= $nv >= 0B= $nv <= 100C= int $nv == $nv
ABCresult
0XX0
10X0
1100
1111
320 2 $self->{'humidity'} = $nv;
321 } else {
322 0 carp "humidity must be an integer 0-100 (percent).";
323 }
324 }
325 2 return $self->{'humidity'};
326 }
327  
328 #==============================================================================
329  
330 =item sub cloud_type([$newValue])
331  
332 $value = $wthr_ctl->cloud_type($newValue);
333  
334 Cloud Type.
335  
336 This attribute specifies the type of clouds contained within the weather layer.
337 If the value of Layer ID does not correspond to a cloud layer, Cloud Type
338 should be set to None (0).
339  
340 None 0
341 Altocumulus 1
342 Altostratus 2
343 Cirrocumulus 3
344 Cirrostratus 4
345 Cirrus 5
346 Cumulonimbus 6
347 Cumulus 7
348 Nimbostratus 8
349 Stratocumulus 9
350 Stratus 10
351 Other1 11
352 Other2 12
353 Other3 13
354 Other4 14
355 Other5 15
356  
357 =cut
358  
359 2 ▶sub cloud_type() {
Subroutine cloud_type: called CC=5 SCAR=19.1
Pod documented
360 2 my ($self,$nv) = @_;
361 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
362 2 ▶ if ($nv>=0 and $nv<=15 and int($nv) == $nv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 0 and $nv <= 15 and int $nv == $nv) { } 2 0 2
Condition33%2/6
$nv >= 0 and $nv <= 15 and int $nv == $nv
!ll&&!rl&&r
002
$nv >= 0 and $nv <= 15
!ll&&!rl&&r
002
MC/DC0%0/3
$nv >= 0 and $nv <= 15 and int $nv == $nv
$nv >= 0 $nv <= 15 int $nv == $nv
Truth table25%1/4
A and B and C
A= $nv >= 0B= $nv <= 15C= int $nv == $nv
ABCresult
0XX0
10X0
1100
1111
363 2 $self->{'cloudType'} = $nv;
364 2 $self->{'_bitfields1'} |= ($nv << 4) &0xF0;
365 } else {
366 0 carp "cloud_type must be 0 (None), 1 (Altocumulus), 2 (Altostratus), 3 (Cirrocumulus), 4 (Cirrostratus), 5 (Cirrus), 6 (Cumulonimbus), 7 (Cumulus), 8 (Nimbostratus), 9 (Stratocumulus), 10 (Stratus), 11 (Other1), 12 (Other2), 13 (Other3), 14 (Other4), or 15 (Other5).";
367 }
368 }
369 2 return (($self->{'_bitfields1'} & 0xF0) >> 4);
370 }
371  
372 #==============================================================================
373  
374 =item sub random_lightning_enable([$newValue])
375  
376 $value = $wthr_ctl->random_lightning_enable($newValue);
377  
378 Random Lightning Enable.
379  
380 This attribute specifies whether the weather layer or entity exhibits random
381 lightning effects. The frequency and severity of the lightning varies according
382 to the Severity attribute.
383  
384 Disable 0
385 Enable 1
386  
387 =cut
388  
389 2 ▶sub random_lightning_enable() {
Subroutine random_lightning_enable: called CC=4 SCAR=15.5
Pod documented
390 2 my ($self,$nv) = @_;
391 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
392 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
393 2 $self->{'randomLightningEnable'} = $nv;
394 2 $self->{'_bitfields1'} |= ($nv << 3) &0x08;
395 } else {
396 0 carp "random_lightning_enable must be 0 (Disable), or 1 (Enable).";
397 }
398 }
399 2 return (($self->{'_bitfields1'} & 0x08) >> 3);
400 }
401  
402 #==============================================================================
403  
404 =item sub random_winds_enable([$newValue])
405  
406 $value = $wthr_ctl->random_winds_enable($newValue);
407  
408 Random Winds Enable.
409  
410 This attribute specifies whether a random frequency and duration should be
411 applied to the local wind effects.
412  
413 Disable 0
414 Enable 1
415  
416 =cut
417  
418 2 ▶sub random_winds_enable() {
Subroutine random_winds_enable: called CC=4 SCAR=15.5
Pod documented
419 2 my ($self,$nv) = @_;
420 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
421 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
422 2 $self->{'randomWindsEnable'} = $nv;
423 2 $self->{'_bitfields1'} |= ($nv << 2) &0x04;
424 } else {
425 0 carp "random_winds_enable must be 0 (Disable), or 1 (Enable).";
426 }
427 }
428 2 return (($self->{'_bitfields1'} & 0x04) >> 2);
429 }
430  
431 #==============================================================================
432  
433 =item sub scud_enable([$newValue])
434  
435 $value = $wthr_ctl->scud_enable($newValue);
436  
437 Scud Enable
438  
439 This attribute specifies whether weather layer produces scud effects within its
440 transition bands.
441  
442 Disable 0
443 Enable 1
444  
445 =cut
446  
447 2 ▶sub scud_enable() {
Subroutine scud_enable: called CC=4 SCAR=15.5
Pod documented
448 2 my ($self,$nv) = @_;
449 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
450 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
451 2 $self->{'scudEnable'} = $nv;
452 2 $self->{'_bitfields1'} |= ($nv << 1) &0x02;
453 } else {
454 0 carp "scud_enable must be 0 (Disable), or 1 (Enable).";
455 }
456 }
457 2 return (($self->{'_bitfields1'} & 0x02) >> 1);
458 }
459  
460 #==============================================================================
461  
462 =item sub weather_enable([$newValue])
463  
464 $value = $wthr_ctl->weather_enable($newValue);
465  
466 Weather Enable.
467  
468 This attribute specifies whether a weather layer/entity and its atmospheric
469 effects are enabled.
470  
471 Disable 0
472 Enable 1
473  
474 =cut
475  
476 2 ▶sub weather_enable() {
Subroutine weather_enable: called CC=4 SCAR=15.5
Pod documented
477 2 my ($self,$nv) = @_;
478 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
479 2 ▶ if (($nv==0) or ($nv==1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1) { } 2 0 2
Condition33%1/3
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0 $nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
ABresult
1X1
011
000
480 2 $self->{'weatherEnable'} = $nv;
481 2 $self->{'_bitfields1'} |= $nv &0x01;
482 } else {
483 0 carp "weather_enable must be 0 (Disable), or 1 (Enable).";
484 }
485 }
486 2 return ($self->{'_bitfields1'} & 0x01);
487 }
488  
489 #==============================================================================
490  
491 =item sub severity([$newValue])
492  
493 $value = $wthr_ctl->severity($newValue);
494  
495 Severity.
496  
497 This attribute specifies the severity of the weather layer/entity.
498  
499 =cut
500  
501 2 ▶sub severity() {
Subroutine severity: called CC=5 SCAR=19.1
Pod documented
502 2 my ($self,$nv) = @_;
503 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
504 2 ▶ if ($nv>=0 and $nv<=5 and int($nv)==$nv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 0 and $nv <= 5 and int $nv == $nv) { } 2 0 2
Condition33%2/6
$nv >= 0 and $nv <= 5 and int $nv == $nv
!ll&&!rl&&r
002
$nv >= 0 and $nv <= 5
!ll&&!rl&&r
002
MC/DC0%0/3
$nv >= 0 and $nv <= 5 and int $nv == $nv
$nv >= 0 $nv <= 5 int $nv == $nv
Truth table25%1/4
A and B and C
A= $nv >= 0B= $nv <= 5C= int $nv == $nv
ABCresult
0XX0
10X0
1100
1111
505 2 $self->{'severity'} = $nv;
506 2 $self->{'_bitfields2'} |= ($nv << 3) &0x18;
507 } else {
508 0 carp "severity must be an integer 0-5.";
509 }
510 }
511 2 return (($self->{'_bitfields2'} & 0x18) >> 3);
512 }
513  
514 #==============================================================================
515  
516 =item sub weather_scope([$newValue])
517  
518 $value = $wthr_ctl->weather_scope($newValue);
519  
520 Weather Scope.
521  
522 This attribute specifies whether the weather is global, regional, or assigned
523 to an entity. If this value is set to Regional (1), the layer is confined to
524 the region specified by Region ID. If this value is set to Entity (2), the
525 weather attributes are applied to the volume within the moving model specified
526 by Entity ID.
527  
528 GlobalScope 0
529 RegionalScope 1
530 EntityScope 2
531  
532 =cut
533  
534 2 ▶sub weather_scope() {
Subroutine weather_scope: called CC=5 SCAR=19.1
Pod documented
535 2 my ($self,$nv) = @_;
536 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
537 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2) { } 2 0 2
Condition33%2/6
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/3
$nv == 0 or $nv == 1 or $nv == 2
$nv == 0 $nv == 1 $nv == 2
Truth table25%1/4
A or B or C
A= $nv == 0B= $nv == 1C= $nv == 2
ABCresult
1XX1
01X1
0011
0000
538 2 $self->{'weatherScope'} = $nv;
539 2 $self->{'_bitfields2'} |= $nv &0x07;
540 } else {
541 0 carp "weather_scope must be 0 (GlobalScope), 1 (RegionalScope), or 2 (EntityScope).";
542 }
543 }
544 2 return ($self->{'_bitfields2'} & 0x07);
545 }
546  
547 #==============================================================================
548  
549 =item sub air_temperature([$newValue])
550  
551 $value = $wthr_ctl->air_temperature($newValue);
552  
553 Air Temperature.
554  
555 This attribute specifies the temperature, measered in degrees Celsius (°C),
556 within the weather layer/entity.
557  
558 =cut
559  
560 2 ▶sub air_temperature() {
Subroutine air_temperature: called CC=2 SCAR=7.0
Pod documented
561 2 my ($self,$nv) = @_;
562 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
563 2 $self->{'airTemperature'} = $nv;
564 }
565 2 return $self->{'airTemperature'};
566 }
567  
568 #==============================================================================
569  
570 =item sub visibility_range([$newValue])
571  
572 $value = $wthr_ctl->visibility_range($newValue);
573  
574 Visibility Range.
575  
576 This attribute specifies the visibility range, measured in meters, through the
577 weather layer/entity. This might correspond to Runway Visibility Range through
578 ground fog, for example.
579  
580 =cut
581  
582 2 ▶sub visibility_range() {
Subroutine visibility_range: called CC=2 SCAR=7.0
Pod documented
583 2 my ($self,$nv) = @_;
584 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
585 2 $self->{'visibilityRange'} = $nv;
586 }
587 2 return $self->{'visibilityRange'};
588 }
589  
590 #==============================================================================
591  
592 =item sub scud_frequency([$newValue])
593  
594 $value = $wthr_ctl->scud_frequency($newValue);
595  
596 Scud Frequency.
597  
598 This attribute specifies the frequency of scud within the transition bands
599 above and/or below a cloud or fog layer. A value of 0% produces no scud effect;
600 100% produces a solid effect.
601  
602 =cut
603  
604 2 ▶sub scud_frequency() {
Subroutine scud_frequency: called CC=2 SCAR=7.0
Pod documented
605 2 my ($self,$nv) = @_;
606 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
607 2 $self->{'scudFrequency'} = $nv;
608 }
609 2 return $self->{'scudFrequency'};
610 }
611  
612 #==============================================================================
613  
614 =item sub coverage([$newValue])
615  
616 $value = $wthr_ctl->coverage($newValue);
617  
618 Coverage.
619  
620 This attribute specifies the amount of area coverage for the weather layer.
621  
622 =cut
623  
624 2 ▶sub coverage() {
Subroutine coverage: called CC=2 SCAR=7.0
Pod documented
625 2 my ($self,$nv) = @_;
626 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
627 2 $self->{'coverage'} = $nv;
628 }
629 2 return $self->{'coverage'};
630 }
631  
632 #==============================================================================
633  
634 =item sub base_elevation([$newValue])
635  
636 $value = $wthr_ctl->base_elevation($newValue);
637  
638 Base Elevation.
639  
640 This attribute specifies the altitude of the base (bottom) of the weather
641 layer. This attribute is ignored if Scope is set to Entity (2).
642  
643 =cut
644  
645 2 ▶sub base_elevation() {
Subroutine base_elevation: called CC=2 SCAR=7.0
Pod documented
646 2 my ($self,$nv) = @_;
647 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
648 2 $self->{'baseElevation'} = $nv;
649 }
650 2 return $self->{'baseElevation'};
651 }
652  
653 #==============================================================================
654  
655 =item sub thickness([$newValue])
656  
657 $value = $wthr_ctl->thickness($newValue);
658  
659 Thickness.
660  
661 This attribute specifies the vertical thickness of the weather layer. The
662 altitude of the top of the layer is equal to this value plus that specified by
663 Base Elevation. This attribute is ignored if Scope is set to Entity (2).
664  
665 =cut
666  
667 2 ▶sub thickness() {
Subroutine thickness: called CC=2 SCAR=7.0
Pod documented
668 2 my ($self,$nv) = @_;
669 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
670 2 $self->{'thickness'} = $nv;
671 }
672 2 return $self->{'thickness'};
673 }
674  
675 #==============================================================================
676  
677 =item sub transition_band([$newValue])
678  
679 $value = $wthr_ctl->transition_band($newValue);
680  
681 Transition Band.
682  
683 This attribute specifies the height of a vertical transition band both above
684 and below the weather layer. This band produces a visibility gradient from the
685 layer's visibility to that immediately outside the transition band. This
686 attribute is ignored if Scope is set to Entity (2).
687  
688 =cut
689  
690 2 ▶sub transition_band() {
Subroutine transition_band: called CC=2 SCAR=7.0
Pod documented
691 2 my ($self,$nv) = @_;
692 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
693 2 $self->{'transitionBand'} = $nv;
694 }
695 2 return $self->{'transitionBand'};
696 }
697  
698 #==============================================================================
699  
700 =item sub horizontal_wind_speed([$newValue])
701  
702 $value = $wthr_ctl->horizontal_wind_speed($newValue);
703  
704 Horizontal Wind Speed.
705  
706 This attribute specifies the local wind speed parallel to the
707 ellipsoid-tangential reference plane.
708  
709 =cut
710  
711 2 ▶sub horizontal_wind_speed() {
Subroutine horizontal_wind_speed: called CC=2 SCAR=7.0
Pod documented
712 2 my ($self,$nv) = @_;
713 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
714 2 $self->{'horizontalWindSpeed'} = $nv;
715 }
716 2 return $self->{'horizontalWindSpeed'};
717 }
718  
719 #==============================================================================
720  
721 =item sub vertical_wind_speed([$newValue])
722  
723 $value = $wthr_ctl->vertical_wind_speed($newValue);
724  
725 Vertical Wind Speed.
726  
727 This attribute specifies the local vertical wind speed.
728  
729 Note: A positive value produces an updraft, while a negative value produces a downdraft.
730  
731 =cut
732  
733 2 ▶sub vertical_wind_speed() {
Subroutine vertical_wind_speed: called CC=2 SCAR=7.0
Pod documented
734 2 my ($self,$nv) = @_;
735 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
736 2 $self->{'verticalWindSpeed'} = $nv;
737 }
738 2 return $self->{'verticalWindSpeed'};
739 }
740  
741 #==============================================================================
742  
743 =item sub wind_direction([$newValue])
744  
745 $value = $wthr_ctl->wind_direction($newValue);
746  
747 Wind Direction.
748  
749 This attribute specifies the local wind direction.
750  
751 Note: This is the direction from which the wind is blowing.
752  
753 =cut
754  
755 2 ▶sub wind_direction() {
Subroutine wind_direction: called CC=2 SCAR=7.0
Pod documented
756 2 my ($self,$nv) = @_;
757 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
758 2 $self->{'windDirection'} = $nv;
759 }
760 2 return $self->{'windDirection'};
761 }
762  
763 #==============================================================================
764  
765 =item sub barometric_pressure([$newValue])
766  
767 $value = $wthr_ctl->barometric_pressure($newValue);
768  
769 Barometric Pressure.
770  
771 This attribute specifies the atmospheric pressure, measured in millibars (mb)
772 or hectopascals (hPa), within the weather layer or entity. The units are interchangeable.
773  
774 =cut
775  
776 2 ▶sub barometric_pressure() {
Subroutine barometric_pressure: called CC=2 SCAR=7.0
Pod documented
777 2 my ($self,$nv) = @_;
778 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
779 2 $self->{'barometricPressure'} = $nv;
780 }
781 2 return $self->{'barometricPressure'};
782 }
783  
784 #==============================================================================
785  
786 =item sub aerosol_concentration([$newValue])
787  
788 $value = $wthr_ctl->aerosol_concentration($newValue);
789  
790 Aerosol Concentration.
791  
792 This attribute specifies the concentration of water, smoke, dust, or other
793 particles suspended in the air.
794  
795 This attribute is provided primarily for sensor applications; any visual effect
796 is secondary and is IG- and layer-dependent.
797  
798 Note: The type of aerosol depends upon the layer ID of a weather layer, or the
799 entity type of a weather phenomenon entity.
800  
801 =cut
802  
803 2 ▶sub aerosol_concentration() {
Subroutine aerosol_concentration: called CC=2 SCAR=7.0
Pod documented
804 2 my ($self,$nv) = @_;
805 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
806 2 $self->{'aerosolConcentration'} = $nv;
807 }
808 2 return $self->{'aerosolConcentration'};
809 }
810  
811 #==========================================================================
812  
813 =item sub pack()
814  
815 $value = $wthr_ctl->pack();
816  
817 Returns the packed data packet.
818  
819 =cut
820  
821 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
822 2 my $self = shift ;
823
824 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
825 $self->{'packetType'},
826 $self->{'packetSize'},
827 $self->{'regionEntityIdent'},
828 $self->{'layerIdent'},
829 $self->{'humidity'},
830 $self->{'_bitfields1'}, # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
831 $self->{'_bitfields2'}, # Includes bitfields unused21, severity, and WthrScope.
832 $self->{'airTemperature'},
833 $self->{'visibilityRange'},
834 $self->{'scudFrequency'},
835 $self->{'coverage'},
836 $self->{'baseElevation'},
837 $self->{'thickness'},
838 $self->{'transitionBand'},
839 $self->{'horizontalWindSpeed'},
840 $self->{'verticalWindSpeed'},
841 $self->{'windDirection'},
842 $self->{'barometricPressure'},
843 2 $self->{'aerosolConcentration'},
844 );
845  
846 2 return $self->{'_Buffer'};
847 }
848  
849 #==========================================================================
850  
851 =item sub unpack()
852  
853 $value = $wthr_ctl->unpack();
854  
855 Unpacks the packed data packet.
856  
857 =cut
858  
859 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
860 0 my $self = shift @_;
861
862 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
863 0 $self->{'_Buffer'} = shift @_;
864 }
865 0 my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
866 0 $self->{'packetType'} = $a;
867 0 $self->{'packetSize'} = $b;
868 0 $self->{'regionEntityIdent'} = $c;
869 0 $self->{'layerIdent'} = $d;
870 0 $self->{'humidity'} = $e;
871 0 $self->{'_bitfields1'} = $f; # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
872 0 $self->{'_bitfields2'} = $g; # Includes bitfields unused21, severity, and WthrScope.
873 0 $self->{'airTemperature'} = $h;
874 0 $self->{'visibilityRange'} = $i;
875 0 $self->{'scudFrequency'} = $j;
876 0 $self->{'coverage'} = $k;
877 0 $self->{'baseElevation'} = $l;
878 0 $self->{'thickness'} = $m;
879 0 $self->{'transitionBand'} = $n;
880 0 $self->{'horizontalWindSpeed'} = $o;
881 0 $self->{'verticalWindSpeed'} = $p;
882 0 $self->{'windDirection'} = $q;
883 0 $self->{'barometricPressure'} = $r;
884 0 $self->{'aerosolConcentration'} = $s;
885  
886 0 $self->{'cloudType'} = $self->cloud_type();
887 0 $self->{'randomLightningEnable'} = $self->random_lightning_enable();
888 0 $self->{'randomWindsEnable'} = $self->random_winds_enable();
889 0 $self->{'scudEnable'} = $self->scud_enable();
890 0 $self->{'weatherEnable'} = $self->weather_enable();
891 0 $self->{'severity'} = $self->severity();
892 0 $self->{'weatherScope'} = $self->weather_scope();
893  
894 0 return $self->{'_Buffer'};
895 }
896  
897 #==========================================================================
898  
899 =item sub byte_swap()
900  
901 $obj_name->byte_swap();
902  
903 Byte swaps the packed data packet.
904  
905 =cut
906  
907 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
908 0 my $self = shift @_;
909
910 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
911 0 $self->{'_Buffer'} = shift @_;
912 } else {
913 0 $self->pack();
914 }
915 0 my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
916  
917 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s);
918 0 $self->unpack();
919  
920 0 return $self->{'_Buffer'};
921 }
922  
923 2 1;
924 __END__
« CIGIPP/ViewControl.pm ↑ Summary CIGIPP/CollisionDetectionVolumeDefinition.pm »