CIGIPP/ViewDefinition.pm

filter: Statementstmt 71.0% 130 / 183 Branchbran 43.0% 31 / 72 Conditioncond 33.3% 17 / 51 MC/DCmcdc 0.0% 0 / 29 Subroutinesub 93.1% 27 / 29 Podpod 100% 25 / 25 totaltotal 59.1% 230 / 389 CC 55 SCAR 17.9
CC
55
Cov
58%
new
19.6
mirror_mode
9.3
pixel_replication_mode
9.3
CRAP 6.0
« CIGIPP/MotionTrackerControl.pm ↑ Summary CIGIPP/HAT_HOTExtendedResponse.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78aeac0-200e-11de-bdb5-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::ViewDefinition;
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::ViewDefinition - Perl extension for the Common Image Generator
42 Interface - View Definition data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::ViewDefinition;
47 my $view_def = Rinchi::CIGIPP::ViewDefinition->new();
48  
49 $packet_type = $view_def->packet_type();
50 $packet_size = $view_def->packet_size();
51 $view_ident = $view_def->view_ident(6573);
52 $group_ident = $view_def->group_ident(45);
53 $mirror_mode = $view_def->mirror_mode(Rinchi::CIGIPP->None);
54 $bottom_enable = $view_def->bottom_enable(Rinchi::CIGIPP->Disable);
55 $top_enable = $view_def->top_enable(Rinchi::CIGIPP->Disable);
56 $right_enable = $view_def->right_enable(Rinchi::CIGIPP->Disable);
57 $left_enable = $view_def->left_enable(Rinchi::CIGIPP->Disable);
58 $far_enable = $view_def->far_enable(Rinchi::CIGIPP->Disable);
59 $near_enable = $view_def->near_enable(Rinchi::CIGIPP->Disable);
60 $view_type = $view_def->view_type(2);
61 $reorder = $view_def->reorder(Rinchi::CIGIPP->NoReorder);
62 $projection_type = $view_def->projection_type(Rinchi::CIGIPP->Perspective);
63 $pixel_replication_mode = $view_def->pixel_replication_mode(Rinchi::CIGIPP->None);
64 $near = $view_def->near(36.544);
65 $far = $view_def->far(79.657);
66 $left = $view_def->left(8.335);
67 $right = $view_def->right(1.447);
68 $top = $view_def->top(12.453);
69 $bottom = $view_def->bottom(36.497);
70  
71 =head1 DESCRIPTION
72  
73 The View Definition packet allows the Host to override the IG's default
74 configuration for a view. This packet is used to specify the projection type,
75 to define the size of the viewing volume, and to assign the view to a view
76 group. Refer to Section 3.2 of the CIGI ICD for details on these view characteristics.
77  
78 =head2 EXPORT
79  
80 None by default.
81  
82 #==============================================================================
83  
84 =item new $view_def = Rinchi::CIGIPP::ViewDefinition->new()
85  
86 Constructor for Rinchi::ViewDefinition.
87  
88 =cut
89  
90 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
91 2 my $class = shift;
92 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
93  
94 2 my $self = {
95 '_Buffer' => '',
96 '_ClassIdent' => 'f78aeac0-200e-11de-bdb5-001c25551abc',
97 '_Pack' => 'CCSCCCCffffff',
98 '_Swap1' => 'CCvCCCCVVVVVV',
99 '_Swap2' => 'CCnCCCCNNNNNN',
100 'packetType' => 21,
101 'packetSize' => 32,
102 'viewIdent' => 0,
103 'groupIdent' => 0,
104 '_bitfields1' => 0, # Includes bitfields mirrorMode, bottomEnable, topEnable, rightEnable, leftEnable, farEnable, and nearEnable.
105 'mirrorMode' => 0,
106 'bottomEnable' => 0,
107 'topEnable' => 0,
108 'rightEnable' => 0,
109 'leftEnable' => 0,
110 'farEnable' => 0,
111 'nearEnable' => 0,
112 '_bitfields2' => 0, # Includes bitfields viewType, reorder, projectionType, and pixelReplicationMode.
113 'viewType' => 0,
114 'reorder' => 0,
115 'projectionType' => 0,
116 'pixelReplicationMode' => 0,
117 '_unused34' => 0,
118 'near' => 0,
119 'far' => 0,
120 'left' => 0,
121 'right' => 0,
122 'top' => 0,
123 'bottom' => 0,
124 };
125  
126 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
127 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
128 0 $self->{'_Buffer'} = $_[0][0];
129 } elsif (ref($_[0]) eq 'HASH') {
130 0 foreach my $attr (keys %{$_[0]}) {
131 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
132 }
133 }
134 }
135  
136 2 bless($self,$class);
137 2 return $self;
138 }
139  
140 #==============================================================================
141  
142 =item sub packet_type()
143  
144 $value = $view_def->packet_type();
145  
146 Data Packet Identifier.
147  
148 This attribute identifies this data packet as the View Definition packet. The
149 value of this attribute must be 21.
150  
151 =cut
152  
153 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
154 2 my ($self) = @_;
155 2 return $self->{'packetType'};
156 }
157  
158 #==============================================================================
159  
160 =item sub packet_size()
161  
162 $value = $view_def->packet_size();
163  
164 Data Packet Size.
165  
166 This attribute indicates the number of bytes in this data packet. The value of
167 this attribute must be 32.
168  
169 =cut
170  
171 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
172 2 my ($self) = @_;
173 2 return $self->{'packetSize'};
174 }
175  
176 #==============================================================================
177  
178 =item sub view_ident([$newValue])
179  
180 $value = $view_def->view_ident($newValue);
181  
182 View ID.
183  
184 This attribute specifies the view to which the data in this packet will be applied.
185  
186 =cut
187  
188 2 ▶sub view_ident() {
Subroutine view_ident: called CC=2 SCAR=7.0
Pod documented
189 2 my ($self,$nv) = @_;
190 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
191 2 $self->{'viewIdent'} = $nv;
192 }
193 2 return $self->{'viewIdent'};
194 }
195  
196 #==============================================================================
197  
198 =item sub group_ident([$newValue])
199  
200 $value = $view_def->group_ident($newValue);
201  
202 Group ID.
203  
204 This attribute specifies the group to which the view is to be assigned. If this
205 value is zero (0), the view is not assigned to a group.
206  
207 =cut
208  
209 2 ▶sub group_ident() {
Subroutine group_ident: called CC=2 SCAR=7.0
Pod documented
210 2 my ($self,$nv) = @_;
211 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
212 2 $self->{'groupIdent'} = $nv;
213 }
214 2 return $self->{'groupIdent'};
215 }
216  
217 #==============================================================================
218  
219 =item sub mirror_mode([$newValue])
220  
221 $value = $view_def->mirror_mode($newValue);
222  
223 Mirror Mode.
224  
225 This attribute specifies the mirroring function to be performed on the view.
226 This feature is typically used to replicate the view of a mirrored surface such
227 as a rear view mirror.
228  
229 None 0
230 Horizontal 1
231 Vertical 2
232 HorizontalAndVertical 3
233  
234 =cut
235  
236 2 ▶sub mirror_mode() {
Subroutine mirror_mode: called CC=6 SCAR=22.3
Pod documented
237 2 my ($self,$nv) = @_;
238 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
239 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3) { } 2 0 2
Condition33%3/9
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/4
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
$nv == 0 $nv == 1 $nv == 2 $nv == 3
Truth table20%1/5
A or B or C or D
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3
ABCDresult
1XXX1
01XX1
001X1
00011
00000
240 2 $self->{'mirrorMode'} = $nv;
241 2 $self->{'_bitfields1'} |= ($nv << 6) &0xC0;
242 } else {
243 0 carp "mirror_mode must be 0 (None), 1 (Horizontal), 2 (Vertical), or 3 (HorizontalAndVertical).";
244 }
245 }
246 2 return (($self->{'_bitfields1'} & 0xC0) >> 6);
247 }
248  
249 #==============================================================================
250  
251 =item sub bottom_enable([$newValue])
252  
253 $value = $view_def->bottom_enable($newValue);
254  
255 Bottom Enable.
256  
257 This attribute specifies whether the bottom half-angle of the view frustum will
258 be set according to the value of the Bottom attribute within this packet. If
259 this attribute is set to Disable (0), the Bottom attribute will be ignored.
260  
261 Disable 0
262 Enable 1
263  
264 =cut
265  
266 2 ▶sub bottom_enable() {
Subroutine bottom_enable: called CC=4 SCAR=15.5
Pod documented
267 2 my ($self,$nv) = @_;
268 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
269 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
270 2 $self->{'bottomEnable'} = $nv;
271 2 $self->{'_bitfields1'} |= ($nv << 5) &0x20;
272 } else {
273 0 carp "bottom_enable must be 0 (Disable), or 1 (Enable).";
274 }
275 }
276 2 return (($self->{'_bitfields1'} & 0x20) >> 5);
277 }
278  
279 #==============================================================================
280  
281 =item sub top_enable([$newValue])
282  
283 $value = $view_def->top_enable($newValue);
284  
285 Top Enable.
286  
287 This attribute specifies whether the top half-angle of the view frustum will be
288 set according to the value of the Top attribute within this packet. If this
289 attribute is set to Disable (0), the Top attribute will be ignored.
290  
291 Disable 0
292 Enable 1
293  
294 =cut
295  
296 2 ▶sub top_enable() {
Subroutine top_enable: called CC=4 SCAR=15.5
Pod documented
297 2 my ($self,$nv) = @_;
298 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
299 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
300 2 $self->{'topEnable'} = $nv;
301 2 $self->{'_bitfields1'} |= ($nv << 4) &0x10;
302 } else {
303 0 carp "top_enable must be 0 (Disable), or 1 (Enable).";
304 }
305 }
306 2 return (($self->{'_bitfields1'} & 0x10) >> 4);
307 }
308  
309 #==============================================================================
310  
311 =item sub right_enable([$newValue])
312  
313 $value = $view_def->right_enable($newValue);
314  
315 Right Enable.
316  
317 This attribute specifies whether the right half-angle of the view frustum will
318 be set according to the value of the Right attribute within this packet. If
319 this attribute is set to Disable (0), the Right attribute will be ignored.
320  
321 Disable 0
322 Enable 1
323  
324 =cut
325  
326 2 ▶sub right_enable() {
Subroutine right_enable: called CC=4 SCAR=15.5
Pod documented
327 2 my ($self,$nv) = @_;
328 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
329 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
330 2 $self->{'rightEnable'} = $nv;
331 2 $self->{'_bitfields1'} |= ($nv << 3) &0x08;
332 } else {
333 0 carp "right_enable must be 0 (Disable), or 1 (Enable).";
334 }
335 }
336 2 return (($self->{'_bitfields1'} & 0x08) >> 3);
337 }
338  
339 #==============================================================================
340  
341 =item sub left_enable([$newValue])
342  
343 $value = $view_def->left_enable($newValue);
344  
345 Left Enable.
346  
347 This attribute specifies whether the left half-angle of the view frustum will
348 be set according to the value of the Left attribute within this packet. If this
349 attribute is set to Disable (0), the Left attribute will be ignored.
350  
351 Disable 0
352 Enable 1
353  
354 =cut
355  
356 2 ▶sub left_enable() {
Subroutine left_enable: called CC=4 SCAR=15.5
Pod documented
357 2 my ($self,$nv) = @_;
358 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
359 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
360 2 $self->{'leftEnable'} = $nv;
361 2 $self->{'_bitfields1'} |= ($nv << 2) &0x04;
362 } else {
363 0 carp "left_enable must be 0 (Disable), or 1 (Enable).";
364 }
365 }
366 2 return (($self->{'_bitfields1'} & 0x04) >> 2);
367 }
368  
369 #==============================================================================
370  
371 =item sub far_enable([$newValue])
372  
373 $value = $view_def->far_enable($newValue);
374  
375 Far Enable.
376  
377 This attribute specifies whether the far clipping plane will be set to the
378 value of the Far attribute within this packet. If this attribute is set to
379 Disable (0), the Far attribute will be ignored.
380  
381 Disable 0
382 Enable 1
383  
384 =cut
385  
386 2 ▶sub far_enable() {
Subroutine far_enable: called CC=4 SCAR=15.5
Pod documented
387 2 my ($self,$nv) = @_;
388 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
389 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
390 2 $self->{'farEnable'} = $nv;
391 2 $self->{'_bitfields1'} |= ($nv << 1) &0x02;
392 } else {
393 0 carp "far_enable must be 0 (Disable), or 1 (Enable).";
394 }
395 }
396 2 return (($self->{'_bitfields1'} & 0x02) >> 1);
397 }
398  
399 #==============================================================================
400  
401 =item sub near_enable([$newValue])
402  
403 $value = $view_def->near_enable($newValue);
404  
405 Near Enable.
406  
407 This attribute specifies whether the near clipping plane will be set to the
408 value of the Near attribute within this packet. If this attribute is set to
409 Disable (0), the Near attribute will be ignored.
410  
411 Disable 0
412 Enable 1
413  
414 =cut
415  
416 2 ▶sub near_enable() {
Subroutine near_enable: called CC=4 SCAR=15.5
Pod documented
417 2 my ($self,$nv) = @_;
418 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
419 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
420 2 $self->{'nearEnable'} = $nv;
421 2 $self->{'_bitfields1'} |= $nv &0x01;
422 } else {
423 0 carp "near_enable must be 0 (Disable), or 1 (Enable).";
424 }
425 }
426 2 return ($self->{'_bitfields1'} & 0x01);
427 }
428  
429 #==============================================================================
430  
431 =item sub view_type([$newValue])
432  
433 $value = $view_def->view_type($newValue);
434  
435 View Type.
436  
437 This attribute specifies an IG-defined type for the indicated view. For
438 example, a Host might switch a view type from out-the-window to IR for a given channel.
439  
440 =cut
441  
442 2 ▶sub view_type() {
Subroutine view_type: called CC=5 SCAR=19.1
Pod documented
443 2 my ($self,$nv) = @_;
444 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
445 2 ▶ if ($nv>=0 and $nv<=7 and int($nv) == $nv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv >= 0 and $nv <= 7 and int $nv == $nv) { } 2 0 2
Condition33%2/6
$nv >= 0 and $nv <= 7 and int $nv == $nv
!ll&&!rl&&r
002
$nv >= 0 and $nv <= 7
!ll&&!rl&&r
002
MC/DC0%0/3
$nv >= 0 and $nv <= 7 and int $nv == $nv
$nv >= 0 $nv <= 7 int $nv == $nv
Truth table25%1/4
A and B and C
A= $nv >= 0B= $nv <= 7C= int $nv == $nv
ABCresult
0XX0
10X0
1100
1111
446 2 $self->{'viewType'} = $nv;
447 2 $self->{'_bitfields2'} |= ($nv << 5) &0xE0;
448 } else {
449 0 carp "view_type must be an integer 0-7.";
450 }
451 }
452 2 return (($self->{'_bitfields2'} & 0xE0) >> 5);
453 }
454  
455 #==============================================================================
456  
457 =item sub reorder([$newValue])
458  
459 $value = $view_def->reorder($newValue);
460  
461 Reorder.
462  
463 This attribute specifies whether the view should be moved to the top of any
464 overlapping views. In cases where multiple overlapping views are moved to the
465 top, the last view specified gets priority.
466  
467 NoReorder 0
468 BringToTop 1
469  
470 =cut
471  
472 2 ▶sub reorder() {
Subroutine reorder: called CC=4 SCAR=15.5
Pod documented
473 2 my ($self,$nv) = @_;
474 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
475 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
476 2 $self->{'reorder'} = $nv;
477 2 $self->{'_bitfields2'} |= ($nv << 4) &0x10;
478 } else {
479 0 carp "reorder must be 0 (NoReorder), or 1 (BringToTop).";
480 }
481 }
482 2 return (($self->{'_bitfields2'} & 0x10) >> 4);
483 }
484  
485 #==============================================================================
486  
487 =item sub projection_type([$newValue])
488  
489 $value = $view_def->projection_type($newValue);
490  
491 Projection Type.
492  
493 This attribute specifies whether the view projection should be perspective or
494 orthographic parallel.
495  
496 Perspective 0
497 OrthographicParallel 1
498  
499 =cut
500  
501 2 ▶sub projection_type() {
Subroutine projection_type: called CC=4 SCAR=15.5
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) 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
505 2 $self->{'projectionType'} = $nv;
506 2 $self->{'_bitfields2'} |= ($nv << 3) &0x08;
507 } else {
508 0 carp "projection_type must be 0 (Perspective), or 1 (OrthographicParallel).";
509 }
510 }
511 2 return (($self->{'_bitfields2'} & 0x08) >> 3);
512 }
513  
514 #==============================================================================
515  
516 =item sub pixel_replication_mode([$newValue])
517  
518 $value = $view_def->pixel_replication_mode($newValue);
519  
520 Pixel Replication Mode.
521  
522 This attribute specifies the pixel replication function to be performed on the
523 view. This feature is typically used in sensor applications to perform
524 electronic zooming (i.e., pixel and line doubling).
525  
526 None 0
527 Replicate1x2 1
528 Replicate2x1 2
529 Replicate2x2 3
530  
531 =cut
532  
533 2 ▶sub pixel_replication_mode() {
Subroutine pixel_replication_mode: called CC=6 SCAR=22.3
Pod documented
534 2 my ($self,$nv) = @_;
535 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
536 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3) { } 2 0 2
Condition33%3/9
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/4
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
$nv == 0 $nv == 1 $nv == 2 $nv == 3
Truth table20%1/5
A or B or C or D
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3
ABCDresult
1XXX1
01XX1
001X1
00011
00000
537 2 $self->{'pixelReplicationMode'} = $nv;
538 2 $self->{'_bitfields2'} |= $nv &0x07;
539 } else {
540 0 carp "pixel_replication_mode must be 0 (None), 1 (Replicate1x2), 2 (Replicate2x1), or 3 (Replicate2x2).";
541 }
542 }
543 2 return ($self->{'_bitfields2'} & 0x07);
544 }
545  
546 #==============================================================================
547  
548 =item sub near([$newValue])
549  
550 $value = $view_def->near($newValue);
551  
552 Near.
553  
554 This attribute specifies the position of the view's near clipping plane. This
555 distance is measured along the viewing vector from the eyepoint to the plane.
556  
557 =cut
558  
559 2 ▶sub near() {
Subroutine near: called CC=2 SCAR=7.0
Pod documented
560 2 my ($self,$nv) = @_;
561 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
562 2 $self->{'near'} = $nv;
563 }
564 2 return $self->{'near'};
565 }
566  
567 #==============================================================================
568  
569 =item sub far([$newValue])
570  
571 $value = $view_def->far($newValue);
572  
573 Far.
574  
575 This attribute specifies the position of the view's far clipping plane. This
576 distance is measured along the viewing vector from the eyepoint to the plane.
577  
578 =cut
579  
580 2 ▶sub far() {
Subroutine far: called CC=2 SCAR=7.0
Pod documented
581 2 my ($self,$nv) = @_;
582 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
583 2 $self->{'far'} = $nv;
584 }
585 2 return $self->{'far'};
586 }
587  
588 #==============================================================================
589  
590 =item sub left([$newValue])
591  
592 $value = $view_def->left($newValue);
593  
594 Left.
595  
596 This attribute specifies the left half-angle of the view frustum. This value is
597 the measure of the angle formed at the view eyepoint between the viewing vector
598 and the frustum side.
599  
600 =cut
601  
602 2 ▶sub left() {
Subroutine left: called CC=2 SCAR=7.0
Pod documented
603 2 my ($self,$nv) = @_;
604 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
605 2 $self->{'left'} = $nv;
606 }
607 2 return $self->{'left'};
608 }
609  
610 #==============================================================================
611  
612 =item sub right([$newValue])
613  
614 $value = $view_def->right($newValue);
615  
616 Right.
617  
618 This attribute specifies the right half-angle of the view frustum. This value
619 is the measure of the angle formed at the view eyepoint between the viewing
620 vector and the frustum side.
621  
622 =cut
623  
624 2 ▶sub right() {
Subroutine right: 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->{'right'} = $nv;
628 }
629 2 return $self->{'right'};
630 }
631  
632 #==============================================================================
633  
634 =item sub top([$newValue])
635  
636 $value = $view_def->top($newValue);
637  
638 Top.
639  
640 This attribute specifies the top half-angle of the view frustum. This value is
641 the measure of the angle formed at the view eyepoint between the viewing vector
642 and the frustum side.
643  
644 =cut
645  
646 2 ▶sub top() {
Subroutine top: called CC=2 SCAR=7.0
Pod documented
647 2 my ($self,$nv) = @_;
648 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
649 2 $self->{'top'} = $nv;
650 }
651 2 return $self->{'top'};
652 }
653  
654 #==============================================================================
655  
656 =item sub bottom([$newValue])
657  
658 $value = $view_def->bottom($newValue);
659  
660 Bottom.
661  
662 This attribute specifies the bottom half-angle of the view frustum. This value
663 is the measure of the angle formed at the view eyepoint between the viewing
664 vector and the frustum side.
665  
666 =cut
667  
668 2 ▶sub bottom() {
Subroutine bottom: called CC=2 SCAR=7.0
Pod documented
669 2 my ($self,$nv) = @_;
670 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
671 2 $self->{'bottom'} = $nv;
672 }
673 2 return $self->{'bottom'};
674 }
675  
676 #==========================================================================
677  
678 =item sub pack()
679  
680 $value = $view_def->pack();
681  
682 Returns the packed data packet.
683  
684 =cut
685  
686 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
687 2 my $self = shift ;
688
689 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
690 $self->{'packetType'},
691 $self->{'packetSize'},
692 $self->{'viewIdent'},
693 $self->{'groupIdent'},
694 $self->{'_bitfields1'}, # Includes bitfields mirrorMode, bottomEnable, topEnable, rightEnable, leftEnable, farEnable, and nearEnable.
695 $self->{'_bitfields2'}, # Includes bitfields viewType, reorder, projectionType, and pixelReplicationMode.
696 $self->{'_unused34'},
697 $self->{'near'},
698 $self->{'far'},
699 $self->{'left'},
700 $self->{'right'},
701 $self->{'top'},
702 2 $self->{'bottom'},
703 );
704  
705 2 return $self->{'_Buffer'};
706 }
707  
708 #==========================================================================
709  
710 =item sub unpack()
711  
712 $value = $view_def->unpack();
713  
714 Unpacks the packed data packet.
715  
716 =cut
717  
718 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
719 0 my $self = shift @_;
720
721 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
722 0 $self->{'_Buffer'} = shift @_;
723 }
724 0 my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
725 0 $self->{'packetType'} = $a;
726 0 $self->{'packetSize'} = $b;
727 0 $self->{'viewIdent'} = $c;
728 0 $self->{'groupIdent'} = $d;
729 0 $self->{'_bitfields1'} = $e; # Includes bitfields mirrorMode, bottomEnable, topEnable, rightEnable, leftEnable, farEnable, and nearEnable.
730 0 $self->{'_bitfields2'} = $f; # Includes bitfields viewType, reorder, projectionType, and pixelReplicationMode.
731 0 $self->{'_unused34'} = $g;
732 0 $self->{'near'} = $h;
733 0 $self->{'far'} = $i;
734 0 $self->{'left'} = $j;
735 0 $self->{'right'} = $k;
736 0 $self->{'top'} = $l;
737 0 $self->{'bottom'} = $m;
738  
739 0 $self->{'mirrorMode'} = $self->mirror_mode();
740 0 $self->{'bottomEnable'} = $self->bottom_enable();
741 0 $self->{'topEnable'} = $self->top_enable();
742 0 $self->{'rightEnable'} = $self->right_enable();
743 0 $self->{'leftEnable'} = $self->left_enable();
744 0 $self->{'farEnable'} = $self->far_enable();
745 0 $self->{'nearEnable'} = $self->near_enable();
746 0 $self->{'viewType'} = $self->view_type();
747 0 $self->{'reorder'} = $self->reorder();
748 0 $self->{'projectionType'} = $self->projection_type();
749 0 $self->{'pixelReplicationMode'} = $self->pixel_replication_mode();
750  
751 0 return $self->{'_Buffer'};
752 }
753  
754 #==========================================================================
755  
756 =item sub byte_swap()
757  
758 $obj_name->byte_swap();
759  
760 Byte swaps the packed data packet.
761  
762 =cut
763  
764 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
765 0 my $self = shift @_;
766
767 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
768 0 $self->{'_Buffer'} = shift @_;
769 } else {
770 0 $self->pack();
771 }
772 0 my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
773  
774 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m);
775 0 $self->unpack();
776  
777 0 return $self->{'_Buffer'};
778 }
779  
780 2 1;
781 __END__
« CIGIPP/MotionTrackerControl.pm ↑ Summary CIGIPP/HAT_HOTExtendedResponse.pm »