-
Notifications
You must be signed in to change notification settings - Fork 0
/
VMF.txt
287 lines (226 loc) · 7.99 KB
/
VMF.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
The VMF format is a convenient ASCII vector map format which has been
designed to work with sunclock. It has been originally inspired by the
algorithms used by xearth ((C) Kirk Lauritz Johnson) to encode Earth
regions - however, many changes have been introduced later, so that not
much of the original settings remain ...
We now come to the precise VMF specifications
=============================
INITIAL SIGNATURE OF THE FILE
=============================
>>> %!VMF is the initial signature for the format
========
COMMENTS
========
Any character % indicates a comment until a newline character is found.
Comments can be included anywhere (in general at the beginning of a new line.)
======
COLORS
======
The first data to be specified at the top of the VMF file should be a
list of colors, either in the form explicit RGB values (#rrggbb
where rr, gg, bb are 2 place hexadecimal values standing respectively
for red, green, blue in the range 0..255) or conventional names of
colors, in the format understood by the XAllocNamedColor() Xlib routine.
Each color occupies one line, and the end of the list is indicated by a
semicolon ;
Then come a default color, indicated by its index in the range
0 .. num_colors. This is the color which will be used if there is no
other match from the list of colors.
The next data are the palette values, given in the form
(color --> list of codes):
>>> c0 j1 j2 j3 ...
>>> c1 k1 k2 ...
>>> c2 l1 l2 l3 l4
>>> c4 ...
>>> (etc)
>>> cN u1 u2 ...
>>> ;
Do not forget the final semicolon to indicate that the palette values are
complete. The meaning of this is that codes j1 j2 j3 will be attributed
color 0 (first listed color), codes k1 k2 will be attributed color 1
(second listed color), etc. All c* values should be in the range
0 .. num_colors-1
The next value is the "background value", that is the color code which will
be affected to all pixels, before the codes are modified by drawing objects
on the map (thus initially the screen is entirely filled with this color).
====================
RANGE OF COORDINATES
====================
Follows a line starting with the keyword "range" and indicating four
float values:
>>> range <phi_min> <phi_max> <theta_min> <theta_max>
which sets the range in which the latitude phi and longitude vary, e.g. :
>>> range -90.0 90.0 -180.0 180.0
=======================
OPTIONAL OPTIONS / DATA
=======================
Then come a number of optional options and flags and arrays of curves /
filled areas / text labels in any succession. The positions are specified
by arrays of coordinate values, given as pairs (phi, theta) of latitude
and longitude of points on Earth in decimal degrees, with -90 <= phi <= 90
and (ususally) -180 <= theta <= 180 (the latter is not absolutely
required since longitudes are taken mod 360 degrees). They are just
Such arrays are meant to represent piecewise linear curves, which can be
either open or closed, filled as regions or just represented as continuous
lines. The syntax is as follows
>>> #<index> <color_value>
>>> phi1 theta1 phi2 theta2 phi3 theta3 ...
>>> ;
where <index> is an arbitrary nonnegative integer (normally the actual
rank of the curve by increasing order in the file, but the VMF format
does not check this), and <color_value> is an arbitrary (positive or
negative) integer. The end of the array of coordinates is indicated by
a semicolon (usually starting a new line). In between, the coordinates
are just float values separated by blank spaces or new lines (no
parentheses nor commas should be used).
===============
DRAWING OPTIONS
===============
The drawing options (to be set before a curve or filled area is started) are
>>> fillmode 2 % fill curves
>>> closedcurves % close the curves before filling
Other options :
>>> fillmode 0 % draw line (no filling)
>>> fillmode 1 % draw line (alternate algorithm)
>>> opencurves % don't close the path before drawing a line
>>> zoomwidth <val> % don't draw unless zoom.width >= value
>>> zoomheight <val> % don't draw unless zoom.height >= value
Normally, the curves should be non-self-intersecting and traced in a
counter-clockwise orientation (in case of a filled area, reversing the
orientation is equivalent to taking the opposite of the value
<color_value> representing the color code).
If a point is contained in several overlapping domains bounded by the
specified curves, the "color value" obtained at that point is (as a
consequence of the filling algorithm) the sum of the <color_value>'s
corresponding to each curve, plus the background value.
(If there are many domains overlapping randomly, it may then be advisable
to use powers of 2 as color values, so that the combination produces
a result that is unique to those combinations of domains.)
The practical limit on the code values is 2^15-1.
=====
FLAGS
=====
Sunclock sets a "vmfflag" value (default value 0xFFFFFFFF = -1) whose
purpose is to enable/disable sections of the VMF file according to
the vmfflag value, using an AND test. The value of the flag can be set
e.g. as follows :
>>> flag 4
Then if vmfflag&4 is non zero, the following section will be drawn,
otherwise it will be ignored.
The zeroth order bit (i.e. &1) determines whether features which have their
own zeroth bit set are to be drawn in clock window mode (versus map mode -
if the zeroth bit is not set, the feature will always be drawn, whether
the window is in map mode or not).
===========
TEXT LABELS
===========
Finally, here is the syntax for putting text labels
>>> label 1720 14 0 -87.000 165.000
>>> +11 timezone
>>> ;
This is the label of index 1719 (value irrelevant), color 14, in position 0
(-1=on the left, 0=centered, 1=on the right), at coordinates
phi=latitude=-87.0, theta=longitude=165.0
whose string value is "+11 timezone". Multi-line labels are allowed.
In order to disable the new line character (so that no line break
appears, the last character of the line should be \
Any initial blank space of each line is removed (if one insists on
starting by a blank space, the line should start with two blank spaces).
The label terminates when ; is met as the first character of the line.
===========
END OF FILE
===========
Not surprinsingl, the end of the file is marked by the keyword "end"
========================
A TYPICAL SAMPLE OF DATA
========================
%!VMF
% Vector Map Format for Sunclock
%
% List of colors
#BFEFFF % 0 LightBlue1
#FFFACD % 1 LemonChiffon
#FFFF69 % 2 LightYellow
#BEB208 % 3 DarkGold
#86CB28 % 4 YellowGreen
#D7EB00 % 5 GreenGold
#8CCD8C % 6 LightGreen3
#CD7054 % 7 Salmon3
#EE8262 % 8 Salmon2
#DEB887 % 9 Burlywood
#F4A460 % 10 SandyBrown
#000000 % 11 Black
#0000FF % 12 Blue
#FF0000 % 13 Red
#000000 % 14 Black
;
% Default color
0
% Palette (possibly several codes for each color: ci j1 j2 j3 ... )
c0 0
c1 1
c2 2
c3 3
c4 4
c5 5
c6 6
c7 7
c8 8
c9 9
c10 10
c11 11
c12 12
c13 13
;
% Background value
1
% Coordinate range (latitude, longitude)
range -90 90 -180 180
% List of closed curves of land areas & lakes
% Set internal flag
flag 2
% Fill mode = fill areas within closed curves
fillmode 2
closedcurves
#0 3
21.364 -157.706 21.568 -157.862 21.642 -158.075 21.456 -158.211
21.383 -158.017 21.252 -157.823 ;
#1 3
21.159 -156.871 21.196 -157.065 21.085 -157.279 21.103 -157.065
21.048 -156.871
;
% Fill mode = fill areas within closed curves
fillmode 2
closedcurves
#0 3
21.364 -157.706 21.568 -157.862 21.642 -158.075 21.456 -158.211
21.383 -158.017 21.252 -157.823 ;
#1 -4
21.159 -156.871 21.196 -157.065 21.085 -157.279 21.103 -157.065
21.048 -156.871
;
%% Note : putting 0 as color is equivalent to disabling the curve)
% Fill mode = draw open curves
fillmode 0
opencurves
#1565 13
90.000 -157.512 70.964 -157.512
;
#1566 13
90.000 -142.503 79.997 -142.503 69.972 -142.503
;
% Write a few labels (with flag = 9)
flag 9
label 1708 14 0 -87.000 0.000
0
;
label 1709 14 0 -87.000 15.000
+1
;
label 1710 14 0 -87.000 30.000
+2
;
label 1711 14 0 -87.000 45.000
+3
;
end