CIGIPP/SymbolCircleDefinition.pm

filter: Statementstmt 62.7% 116 / 185 Branchbran 29.3% 17 / 58 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 86.6% 26 / 30 Podpod 100% 12 / 12 totaltotal 57.3% 175 / 305 CC 38 SCAR 20.5
CC
38
Cov
54%
unpack
20.0
new
19.6
new
19.6
CRAP 7.8
« CIGIPP/TerrestrialSurfaceConditionsResponse.pm ↑ Summary CIGIPP/ImageGeneratorMessage.pm »
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 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::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 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
159 2 my $class = shift;
160 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
161  
162 2 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 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
181 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
182 0 $self->{'_Buffer'} = $_[0][0];
183 } elsif (ref($_[0]) eq 'HASH') {
184 0 foreach my $attr (keys %{$_[0]}) {
185 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
186 }
187 }
188 }
189  
190 2 bless($self,$class);
191 2 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 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
208 2 my ($self) = @_;
209 2 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 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
226 2 my ($self,$nv) = @_;
227 # if (defined($nv)) {
228 # $self->{'packetSize'} = $nv;
229 # }
230 2 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 2 ▶sub symbol_ident() {
Subroutine symbol_ident: called CC=2 SCAR=7.0
Pod documented
250 2 my ($self,$nv) = @_;
251 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
252 2 $self->{'symbolIdent'} = $nv;
253 }
254 2 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 2 ▶sub drawing_style() {
Subroutine drawing_style: called CC=4 SCAR=15.5
Pod documented
274 2 my ($self,$nv) = @_;
275 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
276 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
277 2 $self->{'drawingStyle'} = $nv;
278 2 $self->{'_bitfields1'} |= $nv &0x01;
279 } else {
280 0 carp "drawing_style must be 0 (DrawingStyleLine), or 1 (DrawingStyleFill).";
281 }
282 }
283 2 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 2 ▶sub stipple_pattern() {
Subroutine stipple_pattern: called CC=2 SCAR=7.0
Pod documented
312 2 my ($self,$nv) = @_;
313 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
314 2 $self->{'stipplePattern'} = $nv;
315 }
316 2 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 2 ▶sub line_width() {
Subroutine line_width: called CC=2 SCAR=7.0
Pod documented
340 2 my ($self,$nv) = @_;
341 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
342 2 $self->{'lineWidth'} = $nv;
343 }
344 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 2 ▶sub stipple_pattern_length() {
Subroutine stipple_pattern_length: called CC=2 SCAR=7.0
Pod documented
367 2 my ($self,$nv) = @_;
368 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
369 2 $self->{'stipplePatternLength'} = $nv;
370 }
371 2 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 4 ▶sub circle() {
Subroutine circle: called CC=5 SCAR=18.1
Pod documented
385 4 my ($self,$index,$nv) = @_;
386 4 ▶ if (defined($index) and $index < 9) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $index and $index < 9) { } 4 0 4
Condition33%1/3
defined $index and $index < 9
!ll&&!rl&&r
004
MC/DC0%0/2
defined $index and $index < 9
defined $index $index < 9
Truth table33%1/3
A and B
A= defined $indexB= $index < 9
ABresult
0X0
100
111
387 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
388 4 $self->{'_circle'}[$index] = $nv;
389 4 my $sz = 40 + 24 * $index;
390 4 ▶ $self->{'packetSize'} = $sz if ($sz > $self->{'packetSize'});
Branch: 1 branch
BranchTrueFalseTotal
if $sz > $self->{"packetSize"} 4 0 4
391 }
392 4 return $self->{'_circle'}[$index];
393 } else {
394 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 4 ▶sub pack($) {
Subroutine pack: called CC=2 SCAR=6.9
Pod documented
409 4 my $self = shift ;
410
411 $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 4 $self->{'stipplePatternLength'},
420 );
421 4 my $buffer = $self->{'_Buffer'};
422 4 foreach my $circle (@{$self->{'_circle'}}) {
423 5 $buffer .= $circle->pack();
424 }
425  
426 4 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 0 ▶sub unpack($) {
Subroutine unpack: not called CC=4 SCAR=30.0
Pod documented
440 0 my $self = shift @_;
441  
442 0 my $cbuffer;
443 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
444 0 my $buf = shift @_;
445 0 $self->{'_Buffer'} = substr($buf,0,16);
446 0 $self->{'_circle'} = [];
447 0 $cbuffer = substr($buf,16);
448 }
449 0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
450 0 $self->{'packetType'} = $a;
451 0 $self->{'packetSize'} = $b;
452 0 $self->{'symbolIdent'} = $c;
453 0 $self->{'_bitfields1'} = $d; # Includes bitfields unused55, and drawingStyle.
454 0 $self->{'_unused56'} = $e;
455 0 $self->{'stipplePattern'} = $f;
456 0 $self->{'lineWidth'} = $g;
457 0 $self->{'stipplePatternLength'} = $h;
458  
459 0 $self->{'drawingStyle'} = $self->drawing_style();
460  
461 0 my $index = 0;
462 0 ▶ while(length($cbuffer) >= 24) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $cbuffer >= 24) 0 0 0
463 0 ▶ $self->circle($index,Rinchi::CIGIPP::SymbolCircle->new())unless (defined($self->circle($index)));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->circle($index) 0 0 0
464 0 $self->circle($index)->unpack(substr($cbuffer,0,24));
465 0 $cbuffer = substr($cbuffer,24);
466 0 $index++;
467 }
468 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 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=3 SCAR=24.8
Pod documented
482 0 my $self = shift @_;
483
484 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
485 0 $self->{'_Buffer'} = shift @_;
486 } else {
487 0 $self->pack();
488 }
489 0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
490  
491 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h);
492 0 foreach my $circle (@{$self->{'_circle'}}) {
493 0 $circle->byte_swap();
494 }
495  
496 0 $self->unpack();
497  
498 0 return $self->{'_Buffer'};
499 }
500  
501 #==========================================================================
502  
503 package Rinchi::CIGIPP::SymbolCircle;
504  
505 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
506 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
507 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
508 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
509  
510 2 require Exporter;
511  
512 2 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 2 our %EXPORT_TAGS = ( 'all' => [ qw(
522
523 ) ] );
524  
525 2 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
526  
527 2 our @EXPORT = qw(
528
529 );
530  
531 2 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 4 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
542 4 my $class = shift;
543 4 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
544  
545 4 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 4 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 4 4
560 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
561 0 $self->{'_Buffer'} = $_[0][0];
562 } elsif (ref($_[0]) eq 'HASH') {
563 0 foreach my $attr (keys %{$_[0]}) {
564 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
565 }
566 }
567 }
568  
569 4 bless($self,$class);
570 4 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 4 ▶sub center_u() {
Subroutine center_u: called CC=2 SCAR=7.0
588 4 my ($self,$nv) = @_;
589 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
590 4 $self->{'centerU'} = $nv
591 }
592 4 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 4 ▶sub center_v() {
Subroutine center_v: called CC=2 SCAR=7.0
610 4 my ($self,$nv) = @_;
611 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
612 4 $self->{'centerV'} = $nv
613 }
614 4 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 4 ▶sub radius() {
Subroutine radius: called CC=2 SCAR=7.0
637 4 my ($self,$nv) = @_;
638 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
639 4 $self->{'radius'} = $nv
640 }
641 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 4 ▶sub inner_radius() {
Subroutine inner_radius: called CC=2 SCAR=7.0
662 4 my ($self,$nv) = @_;
663 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
664 4 $self->{'innerRadius'} = $nv
665 }
666 4 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 4 ▶sub start_angle() {
Subroutine start_angle: called CC=2 SCAR=7.0
686 4 my ($self,$nv) = @_;
687 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
688 4 $self->{'startAngle'} = $nv
689 }
690 4 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 4 ▶sub end_angle() {
Subroutine end_angle: called CC=2 SCAR=7.0
710 4 my ($self,$nv) = @_;
711 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 4 0 4
712 4 $self->{'endAngle'} = $nv
713 }
714 4 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 5 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
728 5 my $self = shift ;
729
730 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
731 $self->{'centerU'},
732 $self->{'centerV'},
733 $self->{'radius'},
734 $self->{'innerRadius'},
735 $self->{'startAngle'},
736 5 $self->{'endAngle'}
737 );
738  
739 5 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 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
753 0 my $self = shift @_;
754
755 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
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 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
783 0 my $self = shift @_;
784
785 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
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 2 1;
801 __END__
« CIGIPP/TerrestrialSurfaceConditionsResponse.pm ↑ Summary CIGIPP/ImageGeneratorMessage.pm »