line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78aba5a-200e-11de-bda3-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::ConformalClampedEntityControl; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
28
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
58
|
|
10
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
11
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2239
|
|
12
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2444
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
) ] ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our @EXPORT = qw( |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Preloaded methods go here. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Rinchi::CIGIPP::ConformalClampedEntityControl - Perl extension for the Common |
42
|
|
|
|
|
|
|
Image Generator Interface - Conformal Clamped Entity Control data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::ConformalClampedEntityControl; |
47
|
|
|
|
|
|
|
my $ccent_ctl = Rinchi::CIGIPP::ConformalClampedEntityControl->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $ccent_ctl->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $ccent_ctl->packet_size(); |
51
|
|
|
|
|
|
|
$entity_ident = $ccent_ctl->entity_ident(57935); |
52
|
|
|
|
|
|
|
$yaw = $ccent_ctl->yaw(39.75); |
53
|
|
|
|
|
|
|
$latitude = $ccent_ctl->latitude(57.645); |
54
|
|
|
|
|
|
|
$longitude = $ccent_ctl->longitude(70.599); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The Conformal Clamped Entity Control packet is used to set spatial data for |
59
|
|
|
|
|
|
|
conformal, ground- or ocean-clamped entities. This packet is offered as a |
60
|
|
|
|
|
|
|
lightweight alternative to the Entity Control packet. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Because the entity type and other necessary attributes are not specified in |
63
|
|
|
|
|
|
|
this packet, it may not be used to instantiate (create) an entity. Before using |
64
|
|
|
|
|
|
|
this packet to manipulate an entity, the Host must first instantiate that |
65
|
|
|
|
|
|
|
entity by sending an Entity Control packet and should set the Ground/Ocean |
66
|
|
|
|
|
|
|
Clamp attribute to Conformal (2). If a non-existent entity is referenced by a |
67
|
|
|
|
|
|
|
Conformal Clamped Entity Control packet, the packet will be ignored. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
An entity's current roll, pitch, and altitude offsets (specified in the last |
70
|
|
|
|
|
|
|
Entity Control packet referencing the entity) will be maintained when the IG |
71
|
|
|
|
|
|
|
receives a Conformal Clamped Entity Control packet describing that entity. If |
72
|
|
|
|
|
|
|
this packet is applied to an unclamped or non-conformal clamped entity, its |
73
|
|
|
|
|
|
|
current absolute roll, pitch, and altitude will be maintained. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 EXPORT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
None by default. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#============================================================================== |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item new $ccent_ctl = Rinchi::CIGIPP::ConformalClampedEntityControl->new() |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Constructor for Rinchi::ConformalClampedEntityControl. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub new { |
88
|
1
|
|
|
1
|
1
|
229
|
my $class = shift; |
89
|
1
|
|
33
|
|
|
7
|
$class = ref($class) || $class; |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
10
|
my $self = { |
92
|
|
|
|
|
|
|
'_Buffer' => '', |
93
|
|
|
|
|
|
|
'_ClassIdent' => 'f78aba5a-200e-11de-bda3-001c25551abc', |
94
|
|
|
|
|
|
|
'_Pack' => 'CCSfdd', |
95
|
|
|
|
|
|
|
'_Swap1' => 'CCvVVVVV', |
96
|
|
|
|
|
|
|
'_Swap2' => 'CCnNNNNN', |
97
|
|
|
|
|
|
|
'packetType' => 3, |
98
|
|
|
|
|
|
|
'packetSize' => 24, |
99
|
|
|
|
|
|
|
'entityIdent' => 0, |
100
|
|
|
|
|
|
|
'yaw' => 0, |
101
|
|
|
|
|
|
|
'latitude' => 0, |
102
|
|
|
|
|
|
|
'longitude' => 0, |
103
|
|
|
|
|
|
|
}; |
104
|
|
|
|
|
|
|
|
105
|
1
|
50
|
|
|
|
4
|
if (@_) { |
106
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
108
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
109
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
110
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
1
|
|
|
|
|
3
|
bless($self,$class); |
116
|
1
|
|
|
|
|
3
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#============================================================================== |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item sub packet_type() |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$value = $ccent_ctl->packet_type(); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Data Packet Identifier. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This attribute identifies this data packet as the Conformal Clamped Entity |
128
|
|
|
|
|
|
|
Control packet. The value of this attribute must be 3. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub packet_type() { |
133
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
134
|
1
|
|
|
|
|
7
|
return $self->{'packetType'}; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#============================================================================== |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item sub packet_size() |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$value = $ccent_ctl->packet_size(); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Data Packet Size. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. Thevalue of |
146
|
|
|
|
|
|
|
this attribute must be 24. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub packet_size() { |
151
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
152
|
1
|
|
|
|
|
3
|
return $self->{'packetSize'}; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
#============================================================================== |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item sub entity_ident([$newValue]) |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$value = $ccent_ctl->entity_ident($newValue); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Entity ID. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This attribute epresents the entity to which this packet will be applied. A |
164
|
|
|
|
|
|
|
value of zero (0) corresponds to the Ownship. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub entity_ident() { |
169
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
170
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
171
|
1
|
|
|
|
|
2
|
$self->{'entityIdent'} = $nv; |
172
|
|
|
|
|
|
|
} |
173
|
1
|
|
|
|
|
5
|
return $self->{'entityIdent'}; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
#============================================================================== |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item sub yaw([$newValue]) |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
$value = $ccent_ctl->yaw($newValue); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Yaw. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This attribute specifies the instantaneous heading of the entity as measured |
185
|
|
|
|
|
|
|
from True North. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub yaw() { |
190
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
191
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
192
|
1
|
50
|
33
|
|
|
8
|
if (($nv>=0) and ($nv<=360.0)) { |
193
|
1
|
|
|
|
|
3
|
$self->{'yaw'} = $nv; |
194
|
|
|
|
|
|
|
} else { |
195
|
0
|
|
|
|
|
0
|
carp "yaw must be from 0.0 to +360.0."; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
} |
198
|
1
|
|
|
|
|
3
|
return $self->{'yaw'}; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
#============================================================================== |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item sub latitude([$newValue]) |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$value = $ccent_ctl->latitude($newValue); |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Latitude. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This attribute specifies the entity's geodetic latitude. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub latitude() { |
214
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
215
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
216
|
1
|
50
|
33
|
|
|
13
|
if (($nv>=-90) and ($nv<=90.0)) { |
217
|
1
|
|
|
|
|
2
|
$self->{'latitude'} = $nv; |
218
|
|
|
|
|
|
|
} else { |
219
|
0
|
|
|
|
|
0
|
carp "latitude must be from -90.0 to +90.0."; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
} |
222
|
1
|
|
|
|
|
3
|
return $self->{'latitude'}; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
#============================================================================== |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=item sub longitude([$newValue]) |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
$value = $ccent_ctl->longitude($newValue); |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Longitude. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
This attribute specifies the entity's geodetic longitude. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub longitude() { |
238
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
239
|
1
|
50
|
|
|
|
7
|
if (defined($nv)) { |
240
|
1
|
50
|
33
|
|
|
15
|
if (($nv>=-180.0) and ($nv<=180.0)) { |
241
|
1
|
|
|
|
|
3
|
$self->{'longitude'} = $nv; |
242
|
|
|
|
|
|
|
} else { |
243
|
0
|
|
|
|
|
0
|
carp "longitude must be from -180.0 to +180.0."; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} |
246
|
1
|
|
|
|
|
4
|
return $self->{'longitude'}; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
#========================================================================== |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=item sub pack() |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
$value = $ccent_ctl->pack(); |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Returns the packed data packet. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=cut |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub pack($) { |
260
|
1
|
|
|
1
|
1
|
5
|
my $self = shift ; |
261
|
|
|
|
|
|
|
|
262
|
1
|
|
|
|
|
7
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
263
|
|
|
|
|
|
|
$self->{'packetType'}, |
264
|
|
|
|
|
|
|
$self->{'packetSize'}, |
265
|
|
|
|
|
|
|
$self->{'entityIdent'}, |
266
|
|
|
|
|
|
|
$self->{'yaw'}, |
267
|
|
|
|
|
|
|
$self->{'latitude'}, |
268
|
|
|
|
|
|
|
$self->{'longitude'}, |
269
|
|
|
|
|
|
|
); |
270
|
|
|
|
|
|
|
|
271
|
1
|
|
|
|
|
3
|
return $self->{'_Buffer'}; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
#========================================================================== |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=item sub unpack() |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
$value = $ccent_ctl->unpack(); |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Unpacks the packed data packet. |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=cut |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub unpack($) { |
285
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
286
|
|
|
|
|
|
|
|
287
|
0
|
0
|
|
|
|
|
if (@_) { |
288
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
289
|
|
|
|
|
|
|
} |
290
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
291
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
292
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
293
|
0
|
|
|
|
|
|
$self->{'entityIdent'} = $c; |
294
|
0
|
|
|
|
|
|
$self->{'yaw'} = $d; |
295
|
0
|
|
|
|
|
|
$self->{'latitude'} = $e; |
296
|
0
|
|
|
|
|
|
$self->{'longitude'} = $f; |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
#========================================================================== |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item sub byte_swap() |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub byte_swap($) { |
312
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
313
|
|
|
|
|
|
|
|
314
|
0
|
0
|
|
|
|
|
if (@_) { |
315
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
316
|
|
|
|
|
|
|
} else { |
317
|
0
|
|
|
|
|
|
$self->pack(); |
318
|
|
|
|
|
|
|
} |
319
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
320
|
|
|
|
|
|
|
|
321
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$f,$e,$h,$g); |
322
|
0
|
|
|
|
|
|
$self->unpack(); |
323
|
|
|
|
|
|
|
|
324
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
1; |
328
|
|
|
|
|
|
|
__END__ |