File Coverage

blib/lib/Rinchi/CIGIPP/SymbolControl.pm
Criterion Covered Total %
statement 109 154 70.7
branch 24 58 41.3
condition 6 18 33.3
subroutine 27 29 93.1
pod 25 25 100.0
total 191 284 67.2


line stmt bran cond sub pod time code
1             #
2             # Rinchi Common Image Generator Interface for Perl
3             # Class Identifier: f78b1310-200e-11de-bdc4-001c25551abc
4             # Author: Brian M. Ames
5             #
6              
7             package Rinchi::CIGIPP::SymbolControl;
8              
9 1     1   180 use 5.006;
  1         4  
  1         50  
10 1     1   8 use strict;
  1         3  
  1         39  
11 1     1   7 use warnings;
  1         1  
  1         40  
12 1     1   6 use Carp;
  1         1  
  1         3112  
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.01';
36              
37             # Preloaded methods go here.
38              
39             =head1 NAME
40              
41             Rinchi::CIGIPP::SymbolControl - Perl extension for the Common Image Generator
42             Interface - Symbol Control data packet.
43             data packet.
44             =head1 SYNOPSIS
45              
46             use Rinchi::CIGIPP::SymbolControl;
47             my $sym_ctl = Rinchi::CIGIPP::SymbolControl->new();
48              
49             $packet_type = $sym_ctl->packet_type();
50             $packet_size = $sym_ctl->packet_size();
51             $symbol_ident = $sym_ctl->symbol_ident(44253);
52             $inherit_color = $sym_ctl->inherit_color(Rinchi::CIGIPP->NotInherited);
53             $flash_control = $sym_ctl->flash_control(Rinchi::CIGIPP->RestartFlash);
54             $attach_state = $sym_ctl->attach_state(Rinchi::CIGIPP->Attach);
55             $symbol_state = $sym_ctl->symbol_state(Rinchi::CIGIPP->Visible);
56             $parent_symbol_ident = $sym_ctl->parent_symbol_ident(18590);
57             $surface_ident = $sym_ctl->surface_ident(34382);
58             $layer = $sym_ctl->layer(40);
59             $flash_duty_cycle = $sym_ctl->flash_duty_cycle(84);
60             $flash_period = $sym_ctl->flash_period(16.565);
61             $position_u = $sym_ctl->position_u(77.791);
62             $position_v = $sym_ctl->position_v(26.596);
63             $rotation = $sym_ctl->rotation(36.297);
64             $red = $sym_ctl->red(61);
65             $green = $sym_ctl->green(0);
66             $blue = $sym_ctl->blue(203);
67             $alpha = $sym_ctl->alpha(39);
68             $scale_u = $sym_ctl->scale_u(60.944);
69             $scale_v = $sym_ctl->scale_v(75.746);
70              
71             =head1 DESCRIPTION
72              
73             The Symbol Control packet is used to specify position, rotation, and other
74             attributes describing a symbol's state.
75              
76             A symbol must be defined before the Host sends a Symbol Control packet
77             referencing that symbol. Symbols may be predefined by the IG or may be created
78             by the Host sending any one of the symbol definition packets.
79              
80             Each symbol is identified by a unique Symbol ID value. When the IG receives a
81             Symbol Control packet, the packet will be applied to the symbol corresponding
82             to the specified symbol ID. If a symbol with that ID does not exist, then the
83             IG will ignore the packet. Each symbol must be created independently with its
84             own unique Symbol ID value even if two visually identical symbols are used.
85              
86             Symbols can be attached to one another in a hierarchical relationship. In such
87             a hierarchy, a child symbol's position and rotation are specified relative to
88             its parent symbol's local coordinate system. The Host needs only to control the
89             parent symbol's position and rotation in order to move all lower symbols in the
90             hierarchy as a group. No explicit manipulation of a child symbol's position and
91             rotation is necessary unless its position and rotation change with respect to
92             its parent. Additionally, a child symbol may inherit certain display states
93             from its parent.
94              
95             The Attach State attribute of the Symbol Control packet determines whether a
96             symbol is attached to a parent. If this attribute is set to Attach (1), the
97             symbol is attached to the symbol specified by the Parent Symbol ID attribute.
98              
99             The Symbol State field is used to control when a symbol is visible and when a
100             symbol's geometry is unloaded. When a symbol is created, that symbol is hidden
101             until the Host sends a Symbol Control packet with the Symbol State field set to
102             Visible (1). Any immediate children of that symbol either remain hidden or
103             become visible depending upon their individual states. The symbol and all of
104             its children can be hidden at any time by setting Symbol State to Hidden (0).
105             When the Symbol is no longer needed, Symbol State can be set to Destroyed (2)
106             to direct the IG to unload the symbol and free any associated resources. Any
107             children attached to the symbol are also destroyed.
108              
109             The Red, Blue, Green, and Alpha attributes define the color and transparency of
110             a symbol. Alternatively, child symbols may inherit these values directly from
111             their parents. If the Inherit Color attribute is set to Inherited (1), then the
112             Red, Blue, Green, and Alpha attributes are ignored and the values of the parent
113             are used. The Inherit Color attribute is ignored for top-level (i.e., root)
114             symbols.
115             A symbol may flash or blink as determined by the Flash Period and Flash Duty
116             Cycle Percentage attributes. The Flash Period attribute specifies the amount of
117             time between two consecutive flashes. The Flash Duty Cycle Percentage attribute
118             specifies the percentage of each flash cycle that the symbol is visible. If
119             this attribute is set to 100%, then no flashing occurs and the symbol is always
120             visible.
121             If a symbol's duty cycle is less than 100%, then any descendents (child
122             symbols, grandchildren, etc.) will inherit the symbol's duty cycle and flash
123             period. The Flash Duty Cycle Percentage and Flash Period attributes of the
124             descendents will be ignored. If a symbol flashes, then any descendents will
125             flash in synchronization with that symbol.
126              
127             If a symbol's flash period or duty cycle is changed, then that symbol's flash
128             cycle will be restarted.
129              
130             A symbol may be moved without resetting its flash cycle. If a Symbol Control
131             packet's Flash Control attribute is set to Continue (0), and if the Flash
132             Period and Flash Duty Cycle Percentage attributes have not changed for the
133             given symbol, then the symbol's flash cycle will not be reset. If the Flash
134             Control attribute is set to Reset (1), then the symbol's flash cycle will be
135             restarted from the beginning.
136              
137             The drawing order of symbols is determined by layer. Each symbol surface has
138             256 logical layers, which are rendered in order of increasing layer number. In
139             other words, symbols assigned to Layer 0 are drawn first, followed by the
140             symbols on Layer 1, then those on Layer 2, etc. Symbols on higher-numbered
141             layers may occult those on any lower-numbered layers. Symbols assigned to the
142             same layer will be drawn in order of increasing symbol ID.
143              
144             The position of a top-level (root) symbol is always specified with respect to
145             the surface's 2D coordinate system (see Section 3.4.5.1). The position of a
146             child symbol is always specified with respect to the parent symbol's local
147             coordinate system (see CIGI ICD Section 3.4.5.2).
148              
149             The Scale U and Scale V attributes specify a symbol's scale along the symbol's
150             local U and V axes, respectively. The symbol's apparent size is also affected
151             by any ancestors' scaling factors as described in CIGI ICD Section 3.4.5.2.
152              
153             Once a Symbol Control packet is sent to the IG, the state of the specified
154             symbol will not change again until another Symbol Control or Short Symbol
155             Control packet containing the same Symbol ID value is received, or until the
156             symbol is implicitly deleted.
157              
158             =head2 EXPORT
159              
160             None by default.
161              
162             #==============================================================================
163              
164             =item new $sym_ctl = Rinchi::CIGIPP::SymbolControl->new()
165              
166             Constructor for Rinchi::SymbolControl.
167              
168             =cut
169              
170             sub new {
171 1     1 1 51 my $class = shift;
172 1   33     8 $class = ref($class) || $class;
173              
174 1         23 my $self = {
175             '_Buffer' => '',
176             '_ClassIdent' => 'f78b1310-200e-11de-bdc4-001c25551abc',
177             '_Pack' => 'CCSCCSSCCffffCCCCff',
178             '_Swap1' => 'CCvCCvvCCVVVVCCCCVV',
179             '_Swap2' => 'CCnCCnnCCNNNNCCCCNN',
180             'packetType' => 34,
181             'packetSize' => 40,
182             'symbolIdent' => 0,
183             '_bitfields1' => 0, # Includes bitfields unused61, inheritColor, flashControl, attachState, and symbolState.
184             'inheritColor' => 0,
185             'flashControl' => 0,
186             'attachState' => 0,
187             'symbolState' => 0,
188             '_unused62' => 0,
189             'parentSymbolIdent' => 0,
190             'surfaceIdent' => 0,
191             'layer' => 0,
192             'flashDutyCycle' => 0,
193             'flashPeriod' => 0,
194             'positionU' => 0,
195             'positionV' => 0,
196             'rotation' => 0,
197             'red' => 0,
198             'green' => 0,
199             'blue' => 0,
200             'alpha' => 0,
201             'scaleU' => 0,
202             'scaleV' => 0,
203             };
204              
205 1 50       5 if (@_) {
206 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
207 0         0 $self->{'_Buffer'} = $_[0][0];
208             } elsif (ref($_[0]) eq 'HASH') {
209 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
210 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
211             }
212             }
213             }
214              
215 1         3 bless($self,$class);
216 1         5 return $self;
217             }
218              
219             #==============================================================================
220              
221             =item sub packet_type()
222              
223             $value = $sym_ctl->packet_type();
224              
225             Data Packet Identifier.
226              
227             This attribute identifies this data packet as the Symbol Control packet. The
228             value of this attribute must be 34.
229              
230             =cut
231              
232             sub packet_type() {
233 1     1 1 7 my ($self) = @_;
234 1         7 return $self->{'packetType'};
235             }
236              
237             #==============================================================================
238              
239             =item sub packet_size()
240              
241             $value = $sym_ctl->packet_size();
242              
243             Data Packet Size.
244              
245             This attribute indicates the number of bytes in this data packet. The value of
246             this attribute must be 40.
247              
248             =cut
249              
250             sub packet_size() {
251 1     1 1 6 my ($self) = @_;
252 1         3 return $self->{'packetSize'};
253             }
254              
255             #==============================================================================
256              
257             =item sub symbol_ident([$newValue])
258              
259             $value = $sym_ctl->symbol_ident($newValue);
260              
261             Symbol ID.
262              
263             This attribute specifies the symbol to which this packet is applied. This value
264             must be unique for each active symbol.
265              
266             =cut
267              
268             sub symbol_ident() {
269 1     1 1 6 my ($self,$nv) = @_;
270 1 50       5 if (defined($nv)) {
271 1         3 $self->{'symbolIdent'} = $nv;
272             }
273 1         3 return $self->{'symbolIdent'};
274             }
275              
276             #==============================================================================
277              
278             =item sub inherit_color([$newValue])
279              
280             $value = $sym_ctl->inherit_color($newValue);
281              
282             Inherit Color.
283              
284             This attribute specifies whether this symbol inherits its color from the symbol
285             to which it is attached. If color is inherited, then this symbol's color,
286             including the alpha component, is identical to the current color of the parent
287             symbol. Note that the current color of the parent symbol may be inherited from
288             another symbol.
289              
290             If Attach State is set to Detach (0), this attribute is ignored.
291              
292             NotInherited 0
293             Inherited 1
294              
295             =cut
296              
297             sub inherit_color() {
298 1     1 1 2 my ($self,$nv) = @_;
299 1 50       4 if (defined($nv)) {
300 1 50 33     88 if (($nv==0) or ($nv==1)) {
301 1         3 $self->{'inheritColor'} = $nv;
302 1         3 $self->{'_bitfields1'} |= ($nv << 4) &0x10;
303             } else {
304 0         0 carp "inherit_color must be 0 (NotInherited), or 1 (Inherited).";
305             }
306             }
307 1         4 return (($self->{'_bitfields1'} & 0x10) >> 4);
308             }
309              
310             #==============================================================================
311              
312             =item sub flash_control([$newValue])
313              
314             $value = $sym_ctl->flash_control($newValue);
315              
316             Flash Control.
317              
318             This attribute specifies whether the flash cycle is continued from its present
319             point or whether it is restarted at the beginning.
320              
321             This attribute is ignored if either Flash Duty Cycle Percentage or Flash Period
322             is changed. This attribute may also be ignored if Flash Duty Cycle Percentage
323             is set to 0 or 100.
324              
325             ContinueFlash 0
326             RestartFlash 1
327              
328             =cut
329              
330             sub flash_control() {
331 1     1 1 2 my ($self,$nv) = @_;
332 1 50       5 if (defined($nv)) {
333 1 50 33     8 if (($nv==0) or ($nv==1)) {
334 1         3 $self->{'flashControl'} = $nv;
335 1         2 $self->{'_bitfields1'} |= ($nv << 3) &0x08;
336             } else {
337 0         0 carp "flash_control must be 0 (ContinueFlash), or 1 (RestartFlash).";
338             }
339             }
340 1         3 return (($self->{'_bitfields1'} & 0x08) >> 3);
341             }
342              
343             #==============================================================================
344              
345             =item sub attach_state([$newValue])
346              
347             $value = $sym_ctl->attach_state($newValue);
348              
349             Attach State.
350              
351             This attribute specifies whether the symbol should be attached as a child to a
352             parent symbol.
353              
354             If this attribute is set to Detach (0), then the symbol becomes or remains a
355             top-level (non-child) symbol. The Parent Symbol attribute is ignored. The U
356             Position, V Position, and Rotation attributes specify the symbol's position and
357             rotation relative to the symbol surface's local coordinate system (see CIGI ICD
358             Section 3.4.5.1).
359              
360             If this attribute is set to Attach (1), then the symbol becomes or remains
361             attached to the symbol specified by the Parent Symbol ID attribute. The U
362             Position, V Position, and Rotation attributes specify the symbol's position and
363             rotation relative to the parent symbol's local coordinate system (see Section
364             3.4.5.2).
365             The attach state of a symbol may be changed at any time. The attachment or
366             detachment takes place immediately and remains in effect until changed with
367             another Symbol Control packet or Short Symbol Control packet.
368              
369             Detach 0
370             Attach 1
371              
372             =cut
373              
374             sub attach_state() {
375 1     1 1 3 my ($self,$nv) = @_;
376 1 50       4 if (defined($nv)) {
377 1 50 33     7 if (($nv==0) or ($nv==1)) {
378 1         2 $self->{'attachState'} = $nv;
379 1         3 $self->{'_bitfields1'} |= ($nv << 2) &0x04;
380             } else {
381 0         0 carp "attach_state must be 0 (Detach), or 1 (Attach).";
382             }
383             }
384 1         3 return (($self->{'_bitfields1'} & 0x04) >> 2);
385             }
386              
387             #==============================================================================
388              
389             =item sub symbol_state([$newValue])
390              
391             $value = $sym_ctl->symbol_state($newValue);
392              
393             Symbol State.
394              
395             This attribute specifies whether the symbol should be hidden, visible, or
396             destroyed. This attribute may be set to one of the following values:
397              
398             Hidden – The symbol is hidden from view; however, it can be positioned,
399             rotated, and scaled. It can also be attached to another symbol as a child. It
400             can also be used as a parent by other symbols, although any children are also
401             hidden.
402             Visible – The symbol is drawn on the surface. It can be positioned, rotated,
403             and scaled. It can also be attached to another symbol as a child. It can also
404             be used as a parent by other symbols.
405              
406             Destroyed – The symbol is deleted and any system resources are freed. Any
407             children are also destroyed. All other attributes in this packet are ignored.
408              
409             Note: Although the Symbol Control packet supports destruction of symbols, it is
410             recommended that the Short Symbol Control packet be used for this purpose since
411             all other attributes are ignored.
412              
413             Hidden 0
414             Visible 1
415             Destroyed 2
416              
417             =cut
418              
419             sub symbol_state() {
420 1     1 1 2 my ($self,$nv) = @_;
421 1 50       5 if (defined($nv)) {
422 1 50 33     10 if (($nv==0) or ($nv==1) or ($nv==2)) {
      33        
423 1         10 $self->{'symbolState'} = $nv;
424 1         20 $self->{'_bitfields1'} |= $nv &0x03;
425             } else {
426 0         0 carp "symbol_state must be 0 (Hidden), 1 (Visible), or 2 (Destroyed).";
427             }
428             }
429 1         5 return ($self->{'_bitfields1'} & 0x03);
430             }
431              
432             #==============================================================================
433              
434             =item sub parent_symbol_ident([$newValue])
435              
436             $value = $sym_ctl->parent_symbol_ident($newValue);
437              
438             Parent Symbol ID.
439              
440             This attribute specifies the parent for the symbol. If the Attach State
441             attribute is set to Detach (0), this attribute is ignored.
442              
443             The value of this attribute may be changed without first detaching the symbol
444             from its existing parent.
445              
446             If the specified parent symbol is invalid, no change in the attachment will be made.
447              
448             =cut
449              
450             sub parent_symbol_ident() {
451 1     1 1 7 my ($self,$nv) = @_;
452 1 50       4 if (defined($nv)) {
453 1         3 $self->{'parentSymbolIdent'} = $nv;
454             }
455 1         3 return $self->{'parentSymbolIdent'};
456             }
457              
458             #==============================================================================
459              
460             =item sub surface_ident([$newValue])
461              
462             $value = $sym_ctl->surface_ident($newValue);
463              
464             Surface ID.
465              
466             This attribute specifies the symbol surface on which the symbol is drawn.
467              
468             If the symbol is a child, then the top-level parent symbol's surface is used
469             and this attribute is ignored.
470              
471             If the specified surface is invalid and this symbol is not a child, then the
472             symbol will not be drawn.
473              
474             =cut
475              
476             sub surface_ident() {
477 1     1 1 6 my ($self,$nv) = @_;
478 1 50       4 if (defined($nv)) {
479 1         2 $self->{'surfaceIdent'} = $nv;
480             }
481 1         4 return $self->{'surfaceIdent'};
482             }
483              
484             #==============================================================================
485              
486             =item sub layer([$newValue])
487              
488             $value = $sym_ctl->layer($newValue);
489              
490             Layer.
491              
492             This attribute specifies the layer to which the symbol is assigned. Layers are
493             drawn in order of increasing layer number. For example, Layer 0 will be drawn
494             first, followed by Layer 1, etc. Symbols on higher-numbered layers may occlude
495             symbols on lower-numbered layers. If two or more symbols occupy the same layer,
496             then the symbols are drawn in order of increasing symbol ID.
497              
498             Note that any two siblings in a symbol hierarchy may or may not be assigned to
499             the same layer or to adjacent layers.
500              
501             =cut
502              
503             sub layer() {
504 1     1 1 5 my ($self,$nv) = @_;
505 1 50       4 if (defined($nv)) {
506 1         2 $self->{'layer'} = $nv;
507             }
508 1         3 return $self->{'layer'};
509             }
510              
511             #==============================================================================
512              
513             =item sub flash_duty_cycle([$newValue])
514              
515             $value = $sym_ctl->flash_duty_cycle($newValue);
516              
517             Flash Duty Cycle Percentage.
518              
519             This attribute specifies the duty cycle for a flashing symbol. This is the
520             percentage of one flash cycle that the symbol will be visible.
521              
522             If this value is set to zero (0), then the symbol is always invisible. If this
523             value is set to 100%, then the symbol is always visible.
524              
525             This attribute is ignored if this symbol inherits flashing behavior.
526              
527             =cut
528              
529             sub flash_duty_cycle() {
530 1     1 1 6 my ($self,$nv) = @_;
531 1 50       4 if (defined($nv)) {
532 1         9 $self->{'flashDutyCycle'} = $nv;
533             }
534 1         2 return $self->{'flashDutyCycle'};
535             }
536              
537             #==============================================================================
538              
539             =item sub flash_period([$newValue])
540              
541             $value = $sym_ctl->flash_period($newValue);
542              
543             Flash Period.
544              
545             This attribute specifies the duration of a single flash cycle.
546              
547             This attribute is ignored if Flash Duty Cycle Percentage is set to 0% or 100%.
548              
549             This attribute is ignored if the symbol inherits its flashing behavior from its parent.
550              
551             =cut
552              
553             sub flash_period() {
554 1     1 1 5 my ($self,$nv) = @_;
555 1 50       3 if (defined($nv)) {
556 1         3 $self->{'flashPeriod'} = $nv;
557             }
558 1         4 return $self->{'flashPeriod'};
559             }
560              
561             #==============================================================================
562              
563             =item sub position_u([$newValue])
564              
565             $value = $sym_ctl->position_u($newValue);
566              
567             Position U.
568              
569             This attribute specifies the U component of the symbol's position.
570              
571             For top-level (non-child) symbols, this position is defined with respect to the
572             symbol surface's 2D coordinate system as described in CIGI ICD Section 3.4.5.1.
573              
574             For child symbols, this position is defined with respect to the parent symbol's
575             local coordinate system as described in CIGI ICD Section 3.4.5.2.
576              
577             =cut
578              
579             sub position_u() {
580 1     1 1 6 my ($self,$nv) = @_;
581 1 50       5 if (defined($nv)) {
582 1         2 $self->{'positionU'} = $nv;
583             }
584 1         3 return $self->{'positionU'};
585             }
586              
587             #==============================================================================
588              
589             =item sub position_v([$newValue])
590              
591             $value = $sym_ctl->position_v($newValue);
592              
593             Position V.
594              
595             This attribute specifies the V component of the symbol's position.
596              
597             For top-level (non-child) symbols, this position is defined with respect to the
598             symbol surface's 2D coordinate system as described in CIGI ICD Section 3.4.5.1.
599              
600             For child symbols, this position is defined with respect to the parent symbol's
601             local coordinate system as described in Section 3.4.5.2.
602              
603             =cut
604              
605             sub position_v() {
606 1     1 1 4 my ($self,$nv) = @_;
607 1 50       5 if (defined($nv)) {
608 1         9 $self->{'positionV'} = $nv;
609             }
610 1         3 return $self->{'positionV'};
611             }
612              
613             #==============================================================================
614              
615             =item sub rotation([$newValue])
616              
617             $value = $sym_ctl->rotation($newValue);
618              
619             Rotation.
620              
621             This attribute specifies a rotation for the symbol. This rotation is always
622             counter-clockwise about the symbol's local origin.
623              
624             Note that each child symbol is oriented relative to its parent's local
625             coordinate system.
626              
627             =cut
628              
629             sub rotation() {
630 1     1 1 12 my ($self,$nv) = @_;
631 1 50       5 if (defined($nv)) {
632 1         2 $self->{'rotation'} = $nv;
633             }
634 1         4 return $self->{'rotation'};
635             }
636              
637             #==============================================================================
638              
639             =item sub red([$newValue])
640              
641             $value = $sym_ctl->red($newValue);
642              
643             Red.
644              
645             This attribute specifies the red component of the symbol's color.
646              
647             This value is ignored if Inherit Color is set to inherit (1).
648              
649             =cut
650              
651             sub red() {
652 1     1 1 6 my ($self,$nv) = @_;
653 1 50       4 if (defined($nv)) {
654 1         2 $self->{'red'} = $nv;
655             }
656 1         3 return $self->{'red'};
657             }
658              
659             #==============================================================================
660              
661             =item sub green([$newValue])
662              
663             $value = $sym_ctl->green($newValue);
664              
665             Green.
666              
667             This attribute specifies the green component of the symbol's color.
668              
669             This value is ignored if Inherit Color is set to inherit (1).
670              
671             =cut
672              
673             sub green() {
674 1     1 1 5 my ($self,$nv) = @_;
675 1 50       5 if (defined($nv)) {
676 1         3 $self->{'green'} = $nv;
677             }
678 1         3 return $self->{'green'};
679             }
680              
681             #==============================================================================
682              
683             =item sub blue([$newValue])
684              
685             $value = $sym_ctl->blue($newValue);
686              
687             Blue.
688              
689             This attribute specifies the blue component of the symbol's color.
690              
691             This value is ignored if Inherit Color is set to inherit (1).
692              
693             =cut
694              
695             sub blue() {
696 1     1 1 6 my ($self,$nv) = @_;
697 1 50       4 if (defined($nv)) {
698 1         12 $self->{'blue'} = $nv;
699             }
700 1         4 return $self->{'blue'};
701             }
702              
703             #==============================================================================
704              
705             =item sub alpha([$newValue])
706              
707             $value = $sym_ctl->alpha($newValue);
708              
709             Alpha.
710              
711             This attribute specifies the alpha component of the symbol's color. A value of
712             zero (0) corresponds to fully transparent; a value of 255 corresponds to fully
713             opaque.
714             This value is ignored if Inherit Color is set to inherit (1).
715              
716             =cut
717              
718             sub alpha() {
719 1     1 1 7 my ($self,$nv) = @_;
720 1 50       4 if (defined($nv)) {
721 1         3 $self->{'alpha'} = $nv;
722             }
723 1         4 return $self->{'alpha'};
724             }
725              
726             #==============================================================================
727              
728             =item sub scale_u([$newValue])
729              
730             $value = $sym_ctl->scale_u($newValue);
731              
732             Scale U.
733              
734             This attribute specifies the scaling factor of the symbol along the symbol's
735             local U axis. A value less than 1.0 will cause the symbol to be reduced in
736             size. A value greater than 1.0 will cause the symbol to be increased in size.
737              
738             Note that a symbol's actual size and shape will be affected by the symbol's
739             scaling factors, as well as those of any ancestor symbols.
740              
741             =cut
742              
743             sub scale_u() {
744 1     1 1 6 my ($self,$nv) = @_;
745 1 50       4 if (defined($nv)) {
746 1         2 $self->{'scaleU'} = $nv;
747             }
748 1         3 return $self->{'scaleU'};
749             }
750              
751             #==============================================================================
752              
753             =item sub scale_v([$newValue])
754              
755             $value = $sym_ctl->scale_v($newValue);
756              
757             Scale V.
758              
759             This attribute specifies the scaling factor of the symbol along the symbol's
760             local V axis. A value less than 1.0 will cause the symbol to be reduced in
761             size. A value greater than 1.0 will cause the symbol to be increased in size.
762              
763             Note that a symbol's actual size and shape will be affected by the symbol's
764             scaling factors, as well as those of any ancestor symbols.
765              
766             =cut
767              
768             sub scale_v() {
769 1     1 1 6 my ($self,$nv) = @_;
770 1 50       4 if (defined($nv)) {
771 1         2 $self->{'scaleV'} = $nv;
772             }
773 1         10 return $self->{'scaleV'};
774             }
775              
776             #==========================================================================
777              
778             =item sub pack()
779              
780             $value = $sym_ctl->pack();
781              
782             Returns the packed data packet.
783              
784             =cut
785              
786             sub pack($) {
787 1     1 1 5 my $self = shift ;
788            
789 1         10 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
790             $self->{'packetType'},
791             $self->{'packetSize'},
792             $self->{'symbolIdent'},
793             $self->{'_bitfields1'}, # Includes bitfields unused61, inheritColor, flashControl, attachState, and symbolState.
794             $self->{'_unused62'},
795             $self->{'parentSymbolIdent'},
796             $self->{'surfaceIdent'},
797             $self->{'layer'},
798             $self->{'flashDutyCycle'},
799             $self->{'flashPeriod'},
800             $self->{'positionU'},
801             $self->{'positionV'},
802             $self->{'rotation'},
803             $self->{'red'},
804             $self->{'green'},
805             $self->{'blue'},
806             $self->{'alpha'},
807             $self->{'scaleU'},
808             $self->{'scaleV'},
809             );
810              
811 1         5 return $self->{'_Buffer'};
812             }
813              
814             #==========================================================================
815              
816             =item sub unpack()
817              
818             $value = $sym_ctl->unpack();
819              
820             Unpacks the packed data packet.
821              
822             =cut
823              
824             sub unpack($) {
825 0     0 1   my $self = shift @_;
826            
827 0 0         if (@_) {
828 0           $self->{'_Buffer'} = shift @_;
829             }
830 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'});
831 0           $self->{'packetType'} = $a;
832 0           $self->{'packetSize'} = $b;
833 0           $self->{'symbolIdent'} = $c;
834 0           $self->{'_bitfields1'} = $d; # Includes bitfields unused61, inheritColor, flashControl, attachState, and symbolState.
835 0           $self->{'_unused62'} = $e;
836 0           $self->{'parentSymbolIdent'} = $f;
837 0           $self->{'surfaceIdent'} = $g;
838 0           $self->{'layer'} = $h;
839 0           $self->{'flashDutyCycle'} = $i;
840 0           $self->{'flashPeriod'} = $j;
841 0           $self->{'positionU'} = $k;
842 0           $self->{'positionV'} = $l;
843 0           $self->{'rotation'} = $m;
844 0           $self->{'red'} = $n;
845 0           $self->{'green'} = $o;
846 0           $self->{'blue'} = $p;
847 0           $self->{'alpha'} = $q;
848 0           $self->{'scaleU'} = $r;
849 0           $self->{'scaleV'} = $s;
850              
851 0           $self->{'inheritColor'} = $self->inherit_color();
852 0           $self->{'flashControl'} = $self->flash_control();
853 0           $self->{'attachState'} = $self->attach_state();
854 0           $self->{'symbolState'} = $self->symbol_state();
855              
856 0           return $self->{'_Buffer'};
857             }
858              
859             #==========================================================================
860              
861             =item sub byte_swap()
862              
863             $obj_name->byte_swap();
864              
865             Byte swaps the packed data packet.
866              
867             =cut
868              
869             sub byte_swap($) {
870 0     0 1   my $self = shift @_;
871            
872 0 0         if (@_) {
873 0           $self->{'_Buffer'} = shift @_;
874             } else {
875 0           $self->pack();
876             }
877 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'});
878              
879 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);
880 0           $self->unpack();
881              
882 0           return $self->{'_Buffer'};
883             }
884              
885             1;
886             __END__