line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78b0b0e-200e-11de-bdc1-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::SymbolLineDefinition; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
19
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
12
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2174
|
|
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::SymbolLineDefinition - Perl extension for the Common Image |
42
|
|
|
|
|
|
|
Generator Interface - Symbol Line Definition data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::SymbolLineDefinition; |
47
|
|
|
|
|
|
|
my $sym_line = Rinchi::CIGIPP::SymbolLineDefinition->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $sym_line->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $sym_line->packet_size(191); |
51
|
|
|
|
|
|
|
$symbol_ident = $sym_line->symbol_ident(19346); |
52
|
|
|
|
|
|
|
$primitive_type = $sym_line->primitive_type(Rinchi::CIGIPP->Point); |
53
|
|
|
|
|
|
|
$stipple_pattern = $sym_line->stipple_pattern(36348); |
54
|
|
|
|
|
|
|
$line_width = $sym_line->line_width(49.086); |
55
|
|
|
|
|
|
|
$stipple_pattern_length = $sym_line->stipple_pattern_length(16.425); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $vertex0 = Rinchi::CIGIPP::SymbolVertex->new(); |
58
|
|
|
|
|
|
|
$sym_line->vertex(0, $vertex0); |
59
|
|
|
|
|
|
|
$vertex0->vertex_u(0.0); |
60
|
|
|
|
|
|
|
$vertex0->vertex_v(0.0); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $vertex1 = Rinchi::CIGIPP::SymbolVertex->new(); |
63
|
|
|
|
|
|
|
$sym_line->vertex(1, $vertex1); |
64
|
|
|
|
|
|
|
$vertex1->vertex_u(10.0); |
65
|
|
|
|
|
|
|
$vertex1->vertex_v(0.0); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $vertex2 = Rinchi::CIGIPP::SymbolVertex->new(); |
68
|
|
|
|
|
|
|
$sym_line->vertex(2, $vertex2); |
69
|
|
|
|
|
|
|
$vertex2->vertex_u(10.0); |
70
|
|
|
|
|
|
|
$vertex2->vertex_v(10.0); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $vertex3 = Rinchi::CIGIPP::SymbolVertex->new(); |
73
|
|
|
|
|
|
|
$sym_line->vertex(3, $vertex3); |
74
|
|
|
|
|
|
|
$vertex3->vertex_u(20.0); |
75
|
|
|
|
|
|
|
$vertex3->vertex_v(10.0); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The Symbol Line Definition packet is used to define a set of line segments or |
80
|
|
|
|
|
|
|
points. This packet can be used to create points, lines, a line strip, a line |
81
|
|
|
|
|
|
|
loop, triangles, a triangle strip, or a triangle fan. Note that this section |
82
|
|
|
|
|
|
|
includes all of these primitives when referring to "line symbols." |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Each line symbol is identified by a Symbol ID value that is unique from all |
85
|
|
|
|
|
|
|
other symbols (including text and circle symbols). Every symbol must be created |
86
|
|
|
|
|
|
|
independently with its own unique Symbol ID, even if two or more symbols are |
87
|
|
|
|
|
|
|
visually identical. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Once a Symbol Line Definition packet describing a circle or composite symbol is |
90
|
|
|
|
|
|
|
sent to the IG, the definition of that symbol will not change. If any Symbol |
91
|
|
|
|
|
|
|
Text Definition, Symbol Circle Definition, Symbol Line Definition, or Symbol |
92
|
|
|
|
|
|
|
Clone packet specifying the same Symbol ID is then received, the existing |
93
|
|
|
|
|
|
|
symbol will be destroyed along with any children and a new symbol will be |
94
|
|
|
|
|
|
|
created using the new definition packet. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Every line symbol is defined as an ordered set of zero or more points. Each |
97
|
|
|
|
|
|
|
point is defined with respect to the symbol's 2D coordinate system (see CIGI |
98
|
|
|
|
|
|
|
ICD Section 3.4.5.2) by a pair of coordinates specified in the Vertex U and |
99
|
|
|
|
|
|
|
Vertex V attributes |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The method and order by which the points are connected is determined by the |
102
|
|
|
|
|
|
|
Primitive Type attribute. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The pen attributes of each line comprising a line symbol are defined by the |
105
|
|
|
|
|
|
|
Line Width, Stipple Pattern, and Stipple Pattern Length attributes. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Line Width specifies the thickness of the line in scaled symbol surface units. |
108
|
|
|
|
|
|
|
Note that if the surface's horizontal and vertical units are not equal in size, |
109
|
|
|
|
|
|
|
then horizontal, diagonal, and vertical lines will not appear to be the same |
110
|
|
|
|
|
|
|
thickness. |
111
|
|
|
|
|
|
|
The Stipple Pattern attribute defines a bit mask to be applied to the line: if |
112
|
|
|
|
|
|
|
a bit is set (1) then the section of the line corresponding to that bit will be |
113
|
|
|
|
|
|
|
drawn; if the bit is cleared (0) then the corresponding section will not be |
114
|
|
|
|
|
|
|
drawn. If the value of this attribute is 0xFFFF, then the line is solid. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The length of each section is equal to 1/32 of the length specified by the |
117
|
|
|
|
|
|
|
Stipple Pattern Length attribute. This attribute defines the length of the |
118
|
|
|
|
|
|
|
stipple pattern in terms of scaled symbol surface units. If the curved line is |
119
|
|
|
|
|
|
|
longer than the stipple pattern length, then the pattern is repeated. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The pen attributes are ignored for triangles, triangle strips, and triangle fans. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 EXPORT |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
None by default. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
#============================================================================== |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item new $sym_line = Rinchi::CIGIPP::SymbolLineDefinition->new() |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Constructor for Rinchi::SymbolLineDefinition. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub new { |
136
|
1
|
|
|
1
|
1
|
60
|
my $class = shift; |
137
|
1
|
|
33
|
|
|
7
|
$class = ref($class) || $class; |
138
|
|
|
|
|
|
|
|
139
|
1
|
|
|
|
|
12
|
my $self = { |
140
|
|
|
|
|
|
|
'_Buffer' => '', |
141
|
|
|
|
|
|
|
'_ClassIdent' => 'f78b0b0e-200e-11de-bdc1-001c25551abc', |
142
|
|
|
|
|
|
|
'_Pack' => 'CCSCCSff', |
143
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCvVV', |
144
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCnNN', |
145
|
|
|
|
|
|
|
'packetType' => 32, |
146
|
|
|
|
|
|
|
'packetSize' => 16, |
147
|
|
|
|
|
|
|
'symbolIdent' => 0, |
148
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields unused57, and primitiveType. |
149
|
|
|
|
|
|
|
'primitiveType' => 0, |
150
|
|
|
|
|
|
|
'_unused58' => 0, |
151
|
|
|
|
|
|
|
'stipplePattern' => 0, |
152
|
|
|
|
|
|
|
'lineWidth' => 0, |
153
|
|
|
|
|
|
|
'stipplePatternLength' => 0, |
154
|
|
|
|
|
|
|
'_vertex' => [], |
155
|
|
|
|
|
|
|
}; |
156
|
|
|
|
|
|
|
|
157
|
1
|
50
|
|
|
|
6
|
if (@_) { |
158
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
159
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
160
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
161
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
162
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
1
|
|
|
|
|
3
|
bless($self,$class); |
168
|
1
|
|
|
|
|
3
|
return $self; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
#============================================================================== |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item sub packet_type() |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
$value = $sym_line->packet_type(); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Data Packet Identifier. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
This attribute identifies this data packet as the Symbol Line Definition |
180
|
|
|
|
|
|
|
packet. The value of this attribute must be 32. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub packet_type() { |
185
|
1
|
|
|
1
|
1
|
7
|
my ($self) = @_; |
186
|
1
|
|
|
|
|
8
|
return $self->{'packetType'}; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
#============================================================================== |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item sub packet_size([$newValue]) |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$value = $sym_line->packet_size($newValue); |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Data Packet Size. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
198
|
|
|
|
|
|
|
this attribute must be an even multiple of 8 ranging from 16 to 248. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub packet_size() { |
203
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
204
|
|
|
|
|
|
|
# if (defined($nv)) { |
205
|
|
|
|
|
|
|
# $self->{'packetSize'} = $nv; |
206
|
|
|
|
|
|
|
# } |
207
|
1
|
|
|
|
|
3
|
return $self->{'packetSize'}; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
#============================================================================== |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item sub symbol_ident([$newValue]) |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$value = $sym_line->symbol_ident($newValue); |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Symbol ID. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This attribute specifies the identifier of the symbol that is being defined. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
This identifier must be unique among all existing symbols. If a symbol with the |
221
|
|
|
|
|
|
|
specified identifier already exists, then that symbol and any children will be |
222
|
|
|
|
|
|
|
destroyed and a new symbol created. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub symbol_ident() { |
227
|
1
|
|
|
1
|
1
|
8
|
my ($self,$nv) = @_; |
228
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
229
|
1
|
|
|
|
|
2
|
$self->{'symbolIdent'} = $nv; |
230
|
|
|
|
|
|
|
} |
231
|
1
|
|
|
|
|
4
|
return $self->{'symbolIdent'}; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
#============================================================================== |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item sub primitive_type([$newValue]) |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
$value = $sym_line->primitive_type($newValue); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Primitive Type. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This attribute specifies the type of point or line primitive used in this |
243
|
|
|
|
|
|
|
symbol. The possible primitives are described in enumeration LinePrimitiveType. |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Point 0 |
246
|
|
|
|
|
|
|
Line 1 |
247
|
|
|
|
|
|
|
LineStrip 2 |
248
|
|
|
|
|
|
|
LineLoop 3 |
249
|
|
|
|
|
|
|
Triangle 4 |
250
|
|
|
|
|
|
|
TriangleStrip 5 |
251
|
|
|
|
|
|
|
TriangleFan 6 |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=cut |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub primitive_type() { |
256
|
1
|
|
|
1
|
1
|
13
|
my ($self,$nv) = @_; |
257
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
258
|
1
|
50
|
33
|
|
|
6
|
if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6)) { |
|
|
|
33
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
259
|
1
|
|
|
|
|
3
|
$self->{'primitiveType'} = $nv; |
260
|
1
|
|
|
|
|
8
|
$self->{'_bitfields1'} |= $nv &0x0F; |
261
|
|
|
|
|
|
|
} else { |
262
|
0
|
|
|
|
|
0
|
carp "primitive_type must be 0 (Point), 1 (Line), 2 (LineStrip), 3 (LineLoop), 4 (Triangle), 5 (TriangleStrip), or 6 (TriangleFan)."; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
} |
265
|
1
|
|
|
|
|
3
|
return ($self->{'_bitfields1'} & 0x0F); |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
#============================================================================== |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item sub stipple_pattern([$newValue]) |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
$value = $sym_line->stipple_pattern($newValue); |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
Stipple Pattern.This attribute specifies the dash pattern used when drawing |
275
|
|
|
|
|
|
|
lines. |
276
|
|
|
|
|
|
|
Each line is divided into sections that are 1/32 of the length specified by the |
277
|
|
|
|
|
|
|
Stipple Pattern Length attribute. The stipple pattern is a bit mask that is |
278
|
|
|
|
|
|
|
used when drawing the sections. If a bit is set (1) then section corresponding |
279
|
|
|
|
|
|
|
to that bit will be drawn; if the bit is cleared (0) then the corresponding |
280
|
|
|
|
|
|
|
section will not be drawn. |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
If the value of this attribute is 0xFFFF, then the line will be solid. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
If the line is longer than the stipple pattern length, the pattern is repeated. |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
This value is ignored if the Primitive Type attribute is set to Point (0), |
287
|
|
|
|
|
|
|
Triangle (4), Triangle Strip (5), or Triangle Fan (6). |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=cut |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub stipple_pattern() { |
292
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
293
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
294
|
1
|
|
|
|
|
3
|
$self->{'stipplePattern'} = $nv; |
295
|
|
|
|
|
|
|
} |
296
|
1
|
|
|
|
|
3
|
return $self->{'stipplePattern'}; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
#============================================================================== |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item sub line_width([$newValue]) |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
$value = $sym_line->line_width($newValue); |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Line Width. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
For point primitives, this attribute specifies the diameter of each point in |
308
|
|
|
|
|
|
|
the symbol. |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
For line, line strip, and line loop primitives, this attribute specifies the |
311
|
|
|
|
|
|
|
thickness of each line in the symbol. |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
The value of this attribute is measured in symbol surface units and will be |
314
|
|
|
|
|
|
|
scaled if the symbol is scaled (see CIGI ICD Section 3.4.5.2). |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
Note that if the symbol surface's horizontal and vertical units are not the |
317
|
|
|
|
|
|
|
same size, then horizontal, diagonal, and vertical lines will not appear to be |
318
|
|
|
|
|
|
|
the same thickness. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
This value is ignored if the Primitive Type attribute is set to Triangle (4), |
321
|
|
|
|
|
|
|
Triangle Strip (5), or Triangle Fan (6). |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub line_width() { |
326
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
327
|
1
|
50
|
|
|
|
3
|
if (defined($nv)) { |
328
|
1
|
|
|
|
|
3
|
$self->{'lineWidth'} = $nv; |
329
|
|
|
|
|
|
|
} |
330
|
1
|
|
|
|
|
3
|
return $self->{'lineWidth'}; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
#============================================================================== |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item sub stipple_pattern_length([$newValue]) |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
$value = $sym_line->stipple_pattern_length($newValue); |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
Stipple Pattern Length. |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
This attribute specifies the length of one complete repetition of the stipple |
342
|
|
|
|
|
|
|
pattern. This length is measured in symbol surface units and will be scaled if |
343
|
|
|
|
|
|
|
the symbol is scaled (see CIGI ICD Section 3.4.5.2). |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
If a line is longer than the stipple pattern length, then the pattern is |
346
|
|
|
|
|
|
|
repeated along that line. |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
This attribute is ignored if the Drawing Style attribute is set to Fill (1). |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=cut |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
sub stipple_pattern_length() { |
353
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
354
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
355
|
1
|
|
|
|
|
3
|
$self->{'stipplePatternLength'} = $nv; |
356
|
|
|
|
|
|
|
} |
357
|
1
|
|
|
|
|
3
|
return $self->{'stipplePatternLength'}; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
#============================================================================== |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=item sub vertex($index,[$newValue]) |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
$value = $sym_line->vertex($index,$newValue); |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
Vertex Array. |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=cut |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub vertex() { |
371
|
4
|
|
|
4
|
1
|
16
|
my ($self,$index,$nv) = @_; |
372
|
4
|
50
|
33
|
|
|
21
|
if (defined($index) and $index < 9) { |
373
|
4
|
50
|
|
|
|
8
|
if (defined($nv)) { |
374
|
4
|
|
|
|
|
8
|
$self->{'_vertex'}[$index] = $nv; |
375
|
4
|
|
|
|
|
8
|
my $sz = 24 + 8 * $index; |
376
|
4
|
50
|
|
|
|
11
|
$self->{'packetSize'} = $sz if ($sz > $self->{'packetSize'}); |
377
|
|
|
|
|
|
|
} |
378
|
4
|
|
|
|
|
11
|
return $self->{'_vertex'}[$index]; |
379
|
|
|
|
|
|
|
} else { |
380
|
0
|
|
|
|
|
0
|
return undef; |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
#========================================================================== |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
=item sub pack() |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
$value = $sym_line->pack(); |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
Returns the packed data packet. |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=cut |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
sub pack($) { |
395
|
5
|
|
|
5
|
1
|
19
|
my $self = shift ; |
396
|
|
|
|
|
|
|
|
397
|
5
|
|
|
|
|
100
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
398
|
|
|
|
|
|
|
$self->{'packetType'}, |
399
|
|
|
|
|
|
|
$self->{'packetSize'}, |
400
|
|
|
|
|
|
|
$self->{'symbolIdent'}, |
401
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields unused57, and primitiveType. |
402
|
|
|
|
|
|
|
$self->{'_unused58'}, |
403
|
|
|
|
|
|
|
$self->{'stipplePattern'}, |
404
|
|
|
|
|
|
|
$self->{'lineWidth'}, |
405
|
|
|
|
|
|
|
$self->{'stipplePatternLength'} |
406
|
|
|
|
|
|
|
); |
407
|
5
|
|
|
|
|
9
|
my $buffer = $self->{'_Buffer'}; |
408
|
5
|
|
|
|
|
7
|
foreach my $vertex (@{$self->{'_vertex'}}) { |
|
5
|
|
|
|
|
10
|
|
409
|
10
|
|
|
|
|
20
|
$buffer .= $vertex->pack(); |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
5
|
|
|
|
|
17
|
return $buffer; |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
#========================================================================== |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=item sub unpack() |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
$value = $sym_line->unpack(); |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
Unpacks the packed data packet. |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=cut |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
sub unpack($) { |
426
|
0
|
|
|
0
|
1
|
0
|
my $self = shift @_; |
427
|
|
|
|
|
|
|
|
428
|
0
|
|
|
|
|
0
|
my $vbuffer; |
429
|
0
|
0
|
|
|
|
0
|
if (@_) { |
430
|
0
|
|
|
|
|
0
|
my $buf = shift @_; |
431
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = substr($buf,0,16); |
432
|
0
|
|
|
|
|
0
|
$self->{'_vertex'} = []; |
433
|
0
|
|
|
|
|
0
|
$vbuffer = substr($buf,16); |
434
|
|
|
|
|
|
|
} |
435
|
|
|
|
|
|
|
|
436
|
0
|
|
|
|
|
0
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
437
|
0
|
|
|
|
|
0
|
$self->{'packetType'} = $a; |
438
|
0
|
|
|
|
|
0
|
$self->{'packetSize'} = $b; |
439
|
0
|
|
|
|
|
0
|
$self->{'symbolIdent'} = $c; |
440
|
0
|
|
|
|
|
0
|
$self->{'_bitfields1'} = $d; # Includes bitfields unused57, and primitiveType. |
441
|
0
|
|
|
|
|
0
|
$self->{'_unused58'} = $e; |
442
|
0
|
|
|
|
|
0
|
$self->{'stipplePattern'} = $f; |
443
|
0
|
|
|
|
|
0
|
$self->{'lineWidth'} = $g; |
444
|
0
|
|
|
|
|
0
|
$self->{'stipplePatternLength'} = $h; |
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
0
|
$self->{'primitiveType'} = $self->primitive_type(); |
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
|
|
0
|
my $index = 0; |
449
|
0
|
|
|
|
|
0
|
while(length($vbuffer) >= 8) { |
450
|
0
|
0
|
|
|
|
0
|
$self->vertex($index,Rinchi::CIGIPP::SymbolVertex->new())unless (defined($self->vertex($index))); |
451
|
0
|
|
|
|
|
0
|
$self->vertex($index)->unpack(substr($vbuffer,0,8)); |
452
|
0
|
|
|
|
|
0
|
$vbuffer = substr($vbuffer,8); |
453
|
0
|
|
|
|
|
0
|
$index++; |
454
|
|
|
|
|
|
|
} |
455
|
0
|
|
|
|
|
0
|
return $self->pack(); |
456
|
|
|
|
|
|
|
} |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
#========================================================================== |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=item sub byte_swap() |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=cut |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub byte_swap($) { |
469
|
0
|
|
|
0
|
1
|
0
|
my $self = shift @_; |
470
|
|
|
|
|
|
|
|
471
|
0
|
0
|
|
|
|
0
|
if (@_) { |
472
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = shift @_; |
473
|
|
|
|
|
|
|
} else { |
474
|
0
|
|
|
|
|
0
|
$self->pack(); |
475
|
|
|
|
|
|
|
} |
476
|
0
|
|
|
|
|
0
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h); |
479
|
0
|
|
|
|
|
0
|
foreach my $vertex (@{$self->{'_vertex'}}) { |
|
0
|
|
|
|
|
0
|
|
480
|
0
|
|
|
|
|
0
|
$vertex->byte_swap(); |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
|
483
|
0
|
|
|
|
|
0
|
$self->unpack(); |
484
|
|
|
|
|
|
|
|
485
|
0
|
|
|
|
|
0
|
return $self->{'_Buffer'}; |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
#========================================================================== |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
package Rinchi::CIGIPP::SymbolVertex; |
491
|
|
|
|
|
|
|
|
492
|
1
|
|
|
1
|
|
29
|
use 5.006; |
|
1
|
|
|
|
|
89
|
|
|
1
|
|
|
|
|
129
|
|
493
|
1
|
|
|
1
|
|
15
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
494
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
495
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1067
|
|
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
require Exporter; |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
502
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
503
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
# This allows declaration use Rinchi::CIGIPP::SymbolVertex ':all'; |
506
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
507
|
|
|
|
|
|
|
# will save memory. |
508
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
) ] ); |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
our @EXPORT = qw( |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
); |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
#============================================================================== |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
=item new $vertex = Rinchi::CIGIPP::SymbolVertex->new() |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
Constructor for Rinchi::SymbolVertex. |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=cut |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
sub new { |
529
|
4
|
|
|
4
|
|
188
|
my $class = shift; |
530
|
4
|
|
33
|
|
|
22
|
$class = ref($class) || $class; |
531
|
|
|
|
|
|
|
|
532
|
4
|
|
|
|
|
28
|
my $self = { |
533
|
|
|
|
|
|
|
'_Buffer' => '', |
534
|
|
|
|
|
|
|
'_ClassIdent' => '090805fe-27b1-11de-96a9-001c25551abc', |
535
|
|
|
|
|
|
|
'_Pack' => 'ff', |
536
|
|
|
|
|
|
|
'_Swap1' => 'VV', |
537
|
|
|
|
|
|
|
'_Swap2' => 'NN', |
538
|
|
|
|
|
|
|
'vertexU' => 0, |
539
|
|
|
|
|
|
|
'vertexV' => 0, |
540
|
|
|
|
|
|
|
}; |
541
|
|
|
|
|
|
|
|
542
|
4
|
50
|
|
|
|
11
|
if (@_) { |
543
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
544
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
545
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
546
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
547
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
} |
551
|
|
|
|
|
|
|
|
552
|
4
|
|
|
|
|
10
|
bless($self,$class); |
553
|
4
|
|
|
|
|
10
|
return $self; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
#============================================================================== |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=item sub vertex_u([$newValue]) |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
$value = $vertex->vertex_u($newValue); |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
Vertex U. |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
This attribute specifies the u position of a vertex with respect to the |
565
|
|
|
|
|
|
|
symbol's local coordinate system. This position is measured in scaled |
566
|
|
|
|
|
|
|
symbol surface units (see CIGI ICD Section 3.4.5.2). |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
=cut |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
sub vertex_u() { |
571
|
4
|
|
|
4
|
|
15
|
my ($self,$nv) = @_; |
572
|
4
|
50
|
|
|
|
10
|
if (defined($nv)) { |
573
|
4
|
|
|
|
|
12
|
$self->{'vertexU'} = $nv |
574
|
|
|
|
|
|
|
} |
575
|
4
|
|
|
|
|
8
|
return $self->{'vertexU'}; |
576
|
|
|
|
|
|
|
} |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
#============================================================================== |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=item sub vertex_v([$newValue]) |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
$value = $vertex->vertex_v($newValue); |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
Vertex V. |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
This attribute specifies the v position of a vertex with respect to the |
587
|
|
|
|
|
|
|
symbol's local coordinate system. This position is measured in scaled |
588
|
|
|
|
|
|
|
symbol surface units (see CIGI ICD Section 3.4.5.2). |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=cut |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
sub vertex_v() { |
593
|
4
|
|
|
4
|
|
17
|
my ($self,$nv) = @_; |
594
|
4
|
50
|
|
|
|
11
|
if (defined($nv)) { |
595
|
4
|
|
|
|
|
5
|
$self->{'vertexV'} = $nv |
596
|
|
|
|
|
|
|
} |
597
|
4
|
|
|
|
|
8
|
return $self->{'vertexV'}; |
598
|
|
|
|
|
|
|
} |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
#========================================================================== |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=item sub pack() |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
$value = $vertex->pack(); |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
Returns the packed data packet. |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=cut |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
sub pack($) { |
611
|
10
|
|
|
10
|
|
10
|
my $self = shift ; |
612
|
|
|
|
|
|
|
|
613
|
10
|
|
|
|
|
24
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
614
|
|
|
|
|
|
|
$self->{'vertexU'}, |
615
|
|
|
|
|
|
|
$self->{'vertexV'} |
616
|
|
|
|
|
|
|
); |
617
|
|
|
|
|
|
|
|
618
|
10
|
|
|
|
|
28
|
return $self->{'_Buffer'}; |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
#========================================================================== |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=item sub unpack() |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
$value = $vertex->unpack(); |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
Unpacks the packed data packet. |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
=cut |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
sub unpack($) { |
632
|
0
|
|
|
0
|
|
|
my $self = shift @_; |
633
|
|
|
|
|
|
|
|
634
|
0
|
0
|
|
|
|
|
if (@_) { |
635
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
636
|
|
|
|
|
|
|
} |
637
|
0
|
|
|
|
|
|
my ($a,$b) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
638
|
|
|
|
|
|
|
|
639
|
0
|
|
|
|
|
|
$self->{'vertexU'} = $a; |
640
|
0
|
|
|
|
|
|
$self->{'vertexV'} = $b; |
641
|
|
|
|
|
|
|
|
642
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
643
|
|
|
|
|
|
|
} |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
#========================================================================== |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
=item sub byte_swap() |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
$vertex->byte_swap(); |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
Byte swaps the packed circle data. |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=cut |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub byte_swap($) { |
656
|
0
|
|
|
0
|
|
|
my $self = shift @_; |
657
|
|
|
|
|
|
|
|
658
|
0
|
0
|
|
|
|
|
if (@_) { |
659
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
660
|
|
|
|
|
|
|
} else { |
661
|
0
|
|
|
|
|
|
$self->pack(); |
662
|
|
|
|
|
|
|
} |
663
|
0
|
|
|
|
|
|
my ($a,$b) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
664
|
|
|
|
|
|
|
|
665
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b); |
666
|
0
|
|
|
|
|
|
$self->unpack(); |
667
|
|
|
|
|
|
|
|
668
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
669
|
|
|
|
|
|
|
} |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
#========================================================================== |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
1; |
674
|
|
|
|
|
|
|
__END__ |