File Coverage

blib/lib/Rinchi/CIGIPP/SymbolCircleDefinition.pm
Criterion Covered Total %
statement 103 172 59.8
branch 17 56 30.3
condition 4 12 33.3
subroutine 26 30 86.6
pod 12 12 100.0
total 162 282 57.4


line stmt bran cond sub pod time code
1             #
2             # Rinchi Common Image Generator Interface for Perl
3             # Class Identifier: f78b05be-200e-11de-bdbf-001c25551abc
4             # Author: Brian M. Ames
5             #
6              
7             package Rinchi::CIGIPP::SymbolCircleDefinition;
8              
9 1     1   25 use 5.006;
  1         4  
  1         46  
10 1     1   7 use strict;
  1         2  
  1         37  
11 1     1   6 use warnings;
  1         3  
  1         35  
12 1     1   6 use Carp;
  1         2  
  1         2054  
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::SymbolCircleDefinition - Perl extension for the Common Image
42             Generator Interface - Symbol Circle Definition data packet.
43             data packet.
44             =head1 SYNOPSIS
45              
46             use Rinchi::CIGIPP::SymbolCircleDefinition;
47             my $sym_circ = Rinchi::CIGIPP::SymbolCircleDefinition->new();
48              
49             $packet_type = $sym_circ->packet_type();
50             $packet_size = $sym_circ->packet_size(144);
51             $symbol_ident = $sym_circ->symbol_ident(64120);
52             $drawing_style = $sym_circ->drawing_style(Rinchi::CIGIPP->DrawingStyleLine);
53             $stipple_pattern = $sym_circ->stipple_pattern(0x1F1F);
54             $line_width = $sym_circ->line_width(1.125);
55             $stipple_pattern_length = $sym_circ->stipple_pattern_length(21.99115);
56              
57             my $circle0 = Rinchi::CIGIPP::SymbolCircle->new();
58             $sym_circ->circle(0, $circle0);
59             $circle0->center_u(0.0);
60             $circle0->center_v(0.0);
61             $circle0->radius(7.0);
62             $circle0->inner_radius(4.0);
63             $circle0->start_angle(45);
64             $circle0->end_angle(135);
65              
66             my $circle1 = Rinchi::CIGIPP::SymbolCircle->new();
67             $sym_circ->circle(1, $circle1);
68             $circle1->center_u(0.0);
69             $circle1->center_v(0.0);
70             $circle1->radius(10.0);
71             $circle1->inner_radius(7.0);
72             $circle1->start_angle(135);
73             $circle1->end_angle(45);
74              
75             =head1 DESCRIPTION
76              
77             The Symbol Circle Definition packet is used to create a single circle or arc.
78             This packet can also be used to create a composite symbol composed of up to 9
79             circles and/or arcs. Note that this section uses the term "circle" to refer to
80             both circles and arcs unless otherwise indicated.
81              
82             Each circle symbol is identified by a Symbol ID value that is unique from all
83             other symbols (including text and line symbols). Every symbol must be created
84             independently with its own unique Symbol ID, even if two or more symbols are
85             visually identical.
86              
87             Once a Symbol Circle Definition packet describing a circle symbol is sent to
88             the IG, that symbol's type may not be changed. If a Symbol Text Definition,
89             Symbol Line Definition, or Symbol Clone packet is received specifying the same
90             Symbol ID but a different type, then the existing circle symbol will be
91             destroyed along with any children and a new symbol will be created using the
92             new definition packet.
93              
94             The center of each circle is located at a point (u, v) on the symbol's 2D
95             coordinate system (see CIGI ICD Section 3.4.5.2) as defined by the Center U and
96             Center V attributes. The radius of the circle is specified in scaled symbol
97             surface units by the Radius attribute. Note that if the symbol surface's 2D
98             coordinate system is defined such that horizontal units are not the same length
99             as vertical units, then a circle will appear as an ellipse and an arc will
100             appear as an elliptical arc.
101              
102             The Start Angle and End Angle attributes define the endpoints of the curve.
103             These angles are measured counter-clockwise from the symbol's +U axis. If these
104             two values are equal, then the symbol defines a full circle. If these two
105             values are not equal, then the symbol defines an arc. For circles, it is
106             recommended that values of 0.0 be used for consistency and to avoid
107             floating-point errors.
108              
109             A circle can either be drawn as a curved line along the circumference or be
110             filled, depending upon the value of the Drawing Style attribute. If Drawing
111             Style is set to Line (0), then a curve is drawn from the start angle to the end
112             angle with the specified Radius. The Inner Radius attribute is ignored.
113              
114             A curved line's pen attributes are defined by the Line Width, Stipple Pattern,
115             and Stipple Pattern Length attributes.
116              
117             Line Width specifies the thickness of the line in scaled symbol surface units.
118             Note that if the surface's horizontal and vertical units are not equal in size,
119             then curved lines will not appear to be uniform in thickness.
120              
121             The Stipple Pattern attribute defines a bit mask to be applied to the line: if
122             a bit is set (1) then the section of the curve corresponding to that bit will
123             be drawn; if the bit is cleared (0) then the corresponding section will not be
124             drawn. If the value of this attribute is 0xFFFF, then the line is solid.
125              
126             The length of each section is equal to 1/16 of the length specified by the
127             Stipple Pattern Length attribute. This attribute defines the length of the
128             stipple pattern in terms of scaled symbol surface units. If the curved line is
129             longer than the stipple pattern length, then the pattern is repeated.
130              
131             Note that the end-cap style of a curved line is implementation-dependent and
132             may optionally be controlled with a Component Control packet.
133              
134             If Drawing Style is set to Fill (1), then the circle is drawn as a filled
135             region defined by the Start Angle, End Angle, Radius, and Inner Radius
136             attributes. Note that if the Inner Radius attribute is 0.0, then the circle is
137             completely filled.
138              
139             The Line Width, Stipple Pattern, and Stipple Pattern Length attributes are
140             ignored for filled circle symbols.
141              
142             When the IG creates a new symbol, that symbol is always hidden by default. The
143             symbol is not made visible until the Host sends a Symbol Control packet or
144             Short Symbol Control packet with the Symbol State attribute set to Visible (1).
145              
146             =head2 EXPORT
147              
148             None by default.
149              
150             #==============================================================================
151              
152             =item new $sym_circ = Rinchi::CIGIPP::SymbolCircleDefinition->new()
153              
154             Constructor for Rinchi::SymbolCircleDefinition.
155              
156             =cut
157              
158             sub new {
159 1     1 1 55 my $class = shift;
160 1   33     9 $class = ref($class) || $class;
161              
162 1         16 my $self = {
163             '_Buffer' => '',
164             '_ClassIdent' => 'f78b05be-200e-11de-bdbf-001c25551abc',
165             '_Pack' => 'CCSCCSff',
166             '_Swap1' => 'CCvCCvVV',
167             '_Swap2' => 'CCnCCnNN',
168             'packetType' => 31,
169             'packetSize' => 16,
170             'symbolIdent' => 0,
171             '_bitfields1' => 0, # Includes bitfields unused55, and drawingStyle.
172             'drawingStyle' => 0,
173             '_unused56' => 0,
174             'stipplePattern' => 0,
175             'lineWidth' => 0,
176             'stipplePatternLength' => 0,
177             '_circle' => [],
178             };
179              
180 1 50       6 if (@_) {
181 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
182 0         0 $self->{'_Buffer'} = $_[0][0];
183             } elsif (ref($_[0]) eq 'HASH') {
184 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
185 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
186             }
187             }
188             }
189              
190 1         4 bless($self,$class);
191 1         4 return $self;
192             }
193              
194             #==============================================================================
195              
196             =item sub packet_type()
197              
198             $value = $sym_circ->packet_type();
199              
200             Data Packet Identifier.
201              
202             This attribute identifies this data packet as the Symbol Circle Definition
203             packet. The value of this attribute must be 31.
204              
205             =cut
206              
207             sub packet_type() {
208 1     1 1 8 my ($self) = @_;
209 1         8 return $self->{'packetType'};
210             }
211              
212             #==============================================================================
213              
214             =item sub packet_size([$newValue])
215              
216             $value = $sym_circ->packet_size($newValue);
217              
218             Data Packet Size.
219              
220             This attribute indicates the number of bytes in this data packet. The value of
221             this attribute must be an even multiple of 8 ranging from 16 to 232.
222              
223             =cut
224              
225             sub packet_size() {
226 1     1 1 7 my ($self,$nv) = @_;
227             # if (defined($nv)) {
228             # $self->{'packetSize'} = $nv;
229             # }
230 1         4 return $self->{'packetSize'};
231             }
232              
233             #==============================================================================
234              
235             =item sub symbol_ident([$newValue])
236              
237             $value = $sym_circ->symbol_ident($newValue);
238              
239             Symbol ID.
240              
241             This attribute specifies the identifier of the symbol that is being defined.
242              
243             This identifier must be unique among all existing symbols. If a symbol with the
244             specified identifier already exists, then that symbol and any children will be
245             destroyed and a new symbol created.
246              
247             =cut
248              
249             sub symbol_ident() {
250 1     1 1 6 my ($self,$nv) = @_;
251 1 50       4 if (defined($nv)) {
252 1         3 $self->{'symbolIdent'} = $nv;
253             }
254 1         3 return $self->{'symbolIdent'};
255             }
256              
257             #==============================================================================
258              
259             =item sub drawing_style([$newValue])
260              
261             $value = $sym_circ->drawing_style($newValue);
262              
263             Drawing Style.
264              
265             This attribute specifies whether the circles and arcs defined in this packet
266             are defined as curved lines or filled volumes.
267              
268             DrawingStyleLine 0
269             DrawingStyleFill 1
270              
271             =cut
272              
273             sub drawing_style() {
274 1     1 1 2 my ($self,$nv) = @_;
275 1 50       4 if (defined($nv)) {
276 1 50 33     6 if (($nv==0) or ($nv==1)) {
277 1         3 $self->{'drawingStyle'} = $nv;
278 1         4 $self->{'_bitfields1'} |= $nv &0x01;
279             } else {
280 0         0 carp "drawing_style must be 0 (DrawingStyleLine), or 1 (DrawingStyleFill).";
281             }
282             }
283 1         12 return ($self->{'_bitfields1'} & 0x01);
284             }
285              
286             #==============================================================================
287              
288             =item sub stipple_pattern([$newValue])
289              
290             $value = $sym_circ->stipple_pattern($newValue);
291              
292             Stipple Pattern.
293              
294             This attribute specifies the dash pattern used when drawing the curved line of
295             a circle or arc.
296              
297             Each curved line is divided into sections that are 1/32 of the length specified
298             by the Stipple Pattern Length attribute. The stipple pattern is a bit mask that
299             is used when drawing the sections. If a bit is set (1) then section
300             corresponding to that bit will be drawn; if the bit is cleared (0) then the
301             corresponding section will not be drawn.
302              
303             If the value of this attribute is 0xFFFF, then the line will be solid.
304              
305             If the line is longer than the stipple pattern length, the pattern is repeated.
306              
307             This value is ignored if the Drawing Style attribute is set to Fill (1).
308              
309             =cut
310              
311             sub stipple_pattern() {
312 1     1 1 6 my ($self,$nv) = @_;
313 1 50       5 if (defined($nv)) {
314 1         2 $self->{'stipplePattern'} = $nv;
315             }
316 1         3 return $self->{'stipplePattern'};
317             }
318              
319             #==============================================================================
320              
321             =item sub line_width([$newValue])
322              
323             $value = $sym_circ->line_width($newValue);
324              
325             Line Width.
326              
327             This attribute specifies the thickness of the line used to draw the circles and
328             arcs. This thickness is measured in symbol surface units and will be scaled if
329             the symbol is scaled (see CIGI ICD Section 3.4.5.2).
330              
331             Note that if the symbol surface's horizontal and vertical units are not the
332             same size, then horizontal, diagonal, and vertical lines will not appear to be
333             the same thickness.
334              
335             This attribute is ignored if the Drawing Style attribute is set to Fill (1).
336              
337             =cut
338              
339             sub line_width() {
340 1     1 1 6 my ($self,$nv) = @_;
341 1 50       4 if (defined($nv)) {
342 1         3 $self->{'lineWidth'} = $nv;
343             }
344 1         2 return $self->{'lineWidth'};
345             }
346              
347             #==============================================================================
348              
349             =item sub stipple_pattern_length([$newValue])
350              
351             $value = $sym_circ->stipple_pattern_length($newValue);
352              
353             Stipple Pattern Length.
354              
355             This attribute specifies the length of one complete repetition of the stipple
356             pattern. This length is measured in symbol surface units and will be scaled if
357             the symbol is scaled (see CIGI ICD Section 3.4.5.2).
358              
359             If a line is longer than the stipple pattern length, then the pattern is
360             repeated along that line.
361              
362             This attribute is ignored if the Drawing Style attribute is set to Fill (1).
363              
364             =cut
365              
366             sub stipple_pattern_length() {
367 1     1 1 6 my ($self,$nv) = @_;
368 1 50       3 if (defined($nv)) {
369 1         3 $self->{'stipplePatternLength'} = $nv;
370             }
371 1         3 return $self->{'stipplePatternLength'};
372             }
373              
374             #==============================================================================
375              
376             =item sub circle($index,[$newCircle])
377              
378             $circle = $sym_circ->circle($index,$newCircle);
379              
380             Circle Array.
381              
382             =cut
383              
384             sub circle() {
385 2     2 1 10 my ($self,$index,$nv) = @_;
386 2 50 33     25 if (defined($index) and $index < 9) {
387 2 50       5 if (defined($nv)) {
388 2         4 $self->{'_circle'}[$index] = $nv;
389 2         6 my $sz = 40 + 24 * $index;
390 2 50       8 $self->{'packetSize'} = $sz if ($sz > $self->{'packetSize'});
391             }
392 2         6 return $self->{'_circle'}[$index];
393             } else {
394 0         0 return undef;
395             }
396             }
397              
398             #==========================================================================
399              
400             =item sub pack()
401              
402             $value = $sym_circ->pack();
403              
404             Returns the packed data packet.
405              
406             =cut
407              
408             sub pack($) {
409 3     3 1 14 my $self = shift ;
410            
411 3         19 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
412             $self->{'packetType'},
413             $self->{'packetSize'},
414             $self->{'symbolIdent'},
415             $self->{'_bitfields1'}, # Includes bitfields unused55, and drawingStyle.
416             $self->{'_unused56'},
417             $self->{'stipplePattern'},
418             $self->{'lineWidth'},
419             $self->{'stipplePatternLength'},
420             );
421 3         6 my $buffer = $self->{'_Buffer'};
422 3         4 foreach my $circle (@{$self->{'_circle'}}) {
  3         8  
423 3         6 $buffer .= $circle->pack();
424             }
425              
426 3         10 return $buffer;
427             }
428              
429             #==========================================================================
430              
431             =item sub unpack()
432              
433             $value = $sym_circ->unpack();
434              
435             Unpacks the packed data packet.
436              
437             =cut
438              
439             sub unpack($) {
440 0     0 1 0 my $self = shift @_;
441              
442 0         0 my $cbuffer;
443 0 0       0 if (@_) {
444 0         0 my $buf = shift @_;
445 0         0 $self->{'_Buffer'} = substr($buf,0,16);
446 0         0 $self->{'_circle'} = [];
447 0         0 $cbuffer = substr($buf,16);
448             }
449 0         0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
450 0         0 $self->{'packetType'} = $a;
451 0         0 $self->{'packetSize'} = $b;
452 0         0 $self->{'symbolIdent'} = $c;
453 0         0 $self->{'_bitfields1'} = $d; # Includes bitfields unused55, and drawingStyle.
454 0         0 $self->{'_unused56'} = $e;
455 0         0 $self->{'stipplePattern'} = $f;
456 0         0 $self->{'lineWidth'} = $g;
457 0         0 $self->{'stipplePatternLength'} = $h;
458              
459 0         0 $self->{'drawingStyle'} = $self->drawing_style();
460              
461 0         0 my $index = 0;
462 0         0 while(length($cbuffer) >= 24) {
463 0 0       0 $self->circle($index,Rinchi::CIGIPP::SymbolCircle->new())unless (defined($self->circle($index)));
464 0         0 $self->circle($index)->unpack(substr($cbuffer,0,24));
465 0         0 $cbuffer = substr($cbuffer,24);
466 0         0 $index++;
467             }
468 0         0 return $self->pack();
469             }
470              
471             #==========================================================================
472              
473             =item sub byte_swap()
474              
475             $obj_name->byte_swap();
476              
477             Byte swaps the packed data packet.
478              
479             =cut
480              
481             sub byte_swap($) {
482 0     0 1 0 my $self = shift @_;
483            
484 0 0       0 if (@_) {
485 0         0 $self->{'_Buffer'} = shift @_;
486             } else {
487 0         0 $self->pack();
488             }
489 0         0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
490              
491 0         0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h);
492 0         0 foreach my $circle (@{$self->{'_circle'}}) {
  0         0  
493 0         0 $circle->byte_swap();
494             }
495              
496 0         0 $self->unpack();
497              
498 0         0 return $self->{'_Buffer'};
499             }
500              
501             #==========================================================================
502              
503             package Rinchi::CIGIPP::SymbolCircle;
504              
505 1     1   111 use 5.006;
  1         5  
  1         140  
506 1     1   9 use strict;
  1         3  
  1         35  
507 1     1   7 use warnings;
  1         1  
  1         36  
508 1     1   5 use Carp;
  1         3  
  1         1414  
509              
510             require Exporter;
511              
512             our @ISA = qw(Exporter);
513              
514             # Items to export into callers namespace by default. Note: do not export
515             # names by default without a very good reason. Use EXPORT_OK instead.
516             # Do not simply export all your public functions/methods/constants.
517              
518             # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all';
519             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
520             # will save memory.
521             our %EXPORT_TAGS = ( 'all' => [ qw(
522            
523             ) ] );
524              
525             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
526              
527             our @EXPORT = qw(
528            
529             );
530              
531             our $VERSION = '0.01';
532              
533             #==============================================================================
534              
535             =item new $circle = Rinchi::CIGIPP::SymbolCircle->new()
536              
537             Constructor for Rinchi::SymbolCircle.
538              
539             =cut
540              
541             sub new {
542 2     2   6103 my $class = shift;
543 2   33     12 $class = ref($class) || $class;
544              
545 2         35 my $self = {
546             '_Buffer' => '',
547             '_ClassIdent' => 'c4ea6364-2795-11de-a5b1-001c25551abc',
548             '_Pack' => 'ffffff',
549             '_Swap1' => 'VVVVVV',
550             '_Swap2' => 'NNNNNN',
551             'centerU' => 0,
552             'centerV' => 0,
553             'radius' => 0,
554             'innerRadius' => 0,
555             'startAngle' => 0,
556             'endAngle' => 0,
557             };
558              
559 2 50       6 if (@_) {
560 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
561 0         0 $self->{'_Buffer'} = $_[0][0];
562             } elsif (ref($_[0]) eq 'HASH') {
563 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
564 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
565             }
566             }
567             }
568              
569 2         6 bless($self,$class);
570 2         6 return $self;
571             }
572              
573             #==============================================================================
574              
575             =item sub center_u([$newValue])
576              
577             $value = $circle->center_u($newValue);
578              
579             Center U.
580              
581             This attribute specifies the u position of the circle's center with
582             respect to the symbol's local coordinate system. This position is
583             measured in scaled symbol surface units (see CIGI ICD Section 3.4.5.2).
584              
585             =cut
586              
587             sub center_u() {
588 2     2   10 my ($self,$nv) = @_;
589 2 50       5 if (defined($nv)) {
590 2         9 $self->{'centerU'} = $nv
591             }
592 2         5 return $self->{'centerU'};
593             }
594              
595             #==============================================================================
596              
597             =item sub center_v([$newValue])
598              
599             $value = $circle->center_v($newValue);
600              
601             Center V.
602              
603             This attribute specifies the v position of the circle's center with
604             respect to the symbol's local coordinate system. This position is
605             measured in scaled symbol surface units (see CIGI ICD Section 3.4.5.2).
606              
607             =cut
608              
609             sub center_v() {
610 2     2   8 my ($self,$nv) = @_;
611 2 50       6 if (defined($nv)) {
612 2         4 $self->{'centerV'} = $nv
613             }
614 2         5 return $self->{'centerV'};
615             }
616              
617             #==============================================================================
618              
619             =item sub radius([$newValue])
620              
621             $value = $circle->radius($newValue);
622              
623             Radius.
624              
625             For a filled circle or arc, this attribute specifies the distance from
626             the center of the circle to its outer circumference.
627              
628             For a line circle or arc, this attribute specifies the distance from the
629             center of the circle to the center ofthe curve.
630              
631             This value is measured in scaled symbol surface units(see CIGI ICD
632             Section 3.4.5.2).
633              
634             =cut
635              
636             sub radius() {
637 2     2   8 my ($self,$nv) = @_;
638 2 50       7 if (defined($nv)) {
639 2         5 $self->{'radius'} = $nv
640             }
641 2         4 return $self->{'radius'};
642             }
643              
644             #==============================================================================
645              
646             =item sub inner_radius([$newValue])
647              
648             $value = $circle->inner_radius($newValue);
649              
650             Inner Radius.
651              
652             For a filled circle or arc, this attribute specifies the distance from
653             the center of the circle to its inner boundary in scaled symbol surface
654             units (see CIGI ICD Section 3.4.5.2). The fill extends from the Inner
655             Radius to the Radius.
656              
657             For line circles and arcs, this attribute is ignored.
658              
659             =cut
660              
661             sub inner_radius() {
662 2     2   8 my ($self,$nv) = @_;
663 2 50       7 if (defined($nv)) {
664 2         4 $self->{'innerRadius'} = $nv
665             }
666 2         5 return $self->{'innerRadius'};
667             }
668              
669             #==============================================================================
670              
671             =item sub start_angle([$newValue])
672              
673             $value = $circle->start_angle($newValue);
674              
675             Start Angle.
676              
677             This attribute specifies the starting angle of the arc and is measured
678             counter-clockwise from the +U axis.
679              
680             If Start Angle is greater than End Angle, then the arc will cross the +U
681             axis.
682              
683             =cut
684              
685             sub start_angle() {
686 2     2   9 my ($self,$nv) = @_;
687 2 50       6 if (defined($nv)) {
688 2         4 $self->{'startAngle'} = $nv
689             }
690 2         11 return $self->{'startAngle'};
691             }
692              
693             #==============================================================================
694              
695             =item sub end_angle([$newValue])
696              
697             $value = $circle->end_angle($newValue);
698              
699             End Angle.
700              
701             This attribute specifies the ending angle of the arc and is measured
702             counter-clockwise from the +U axis.
703              
704             If Start Angle is greater than End Angle, then the arc will cross the +U
705             axis.
706              
707             =cut
708              
709             sub end_angle() {
710 2     2   10 my ($self,$nv) = @_;
711 2 50       6 if (defined($nv)) {
712 2         3 $self->{'endAngle'} = $nv
713             }
714 2         5 return $self->{'endAngle'};
715             }
716              
717             #==========================================================================
718              
719             =item sub pack()
720              
721             $value = $circle->pack();
722              
723             Returns the packed data packet.
724              
725             =cut
726              
727             sub pack($) {
728 3     3   6 my $self = shift ;
729            
730 3         13 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
731             $self->{'centerU'},
732             $self->{'centerV'},
733             $self->{'radius'},
734             $self->{'innerRadius'},
735             $self->{'startAngle'},
736             $self->{'endAngle'}
737             );
738              
739 3         10 return $self->{'_Buffer'};
740             }
741              
742             #==========================================================================
743              
744             =item sub unpack()
745              
746             $value = $circle->unpack();
747              
748             Unpacks the packed data packet.
749              
750             =cut
751              
752             sub unpack($) {
753 0     0     my $self = shift @_;
754            
755 0 0         if (@_) {
756 0           $self->{'_Buffer'} = shift @_;
757             }
758 0           my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
759 0           my $h = substr($self->{'_Buffer'},12);
760 0           $h =~ s/(\0+)$//;
761 0           my $i = $1;
762 0           $self->{'centerU'} = $a;
763 0           $self->{'centerV'} = $b;
764 0           $self->{'radius'} = $c;
765 0           $self->{'innerRadius'} = $d;
766 0           $self->{'startAngle'} = $e;
767 0           $self->{'endAngle'} = $f;
768              
769 0           return $self->{'_Buffer'};
770             }
771              
772             #==========================================================================
773              
774             =item sub byte_swap()
775              
776             $circle->byte_swap();
777              
778             Byte swaps the packed circle data.
779              
780             =cut
781              
782             sub byte_swap($) {
783 0     0     my $self = shift @_;
784            
785 0 0         if (@_) {
786 0           $self->{'_Buffer'} = shift @_;
787             } else {
788 0           $self->pack();
789             }
790 0           my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
791              
792 0           $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f);
793 0           $self->unpack();
794              
795 0           return $self->{'_Buffer'};
796             }
797              
798             #==============================================================================
799              
800             1;
801             __END__