| 1 | package VSG::VCD::Format; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | SVG::VCD::Format - format of .vcd (vertebral column description) files | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | *width: 800 | ||
| 10 | *height: 565 | ||
| 11 | Taxon: Apatosaurus louisae | ||
| 12 | Specimen: CM 3018 | ||
| 13 | Citation: Gilmore 1936:195 and plates 24-25 | ||
| 14 | Data: -----YVVVVVVVVV|VVVuuunnn- | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | Vertebral Column Description (VCD) format is line-oriented. Each line | ||
| 19 | has a self-contained meaning. | ||
| 20 | |||
| 21 | Comments are introduced by a hash character (C<#>) and run to the end | ||
| 22 | of the line. They are ignored. | ||
| 23 | |||
| 24 | Leading and trailing whitespace are ignored. | ||
| 25 | |||
| 26 | Blank lines (including those consisting only of spaces and/or | ||
| 27 | comments) ignored. | ||
| 28 | |||
| 29 | All other lines fall into one of two categories: | ||
| 30 | |||
| 31 | =over 4 | ||
| 32 | |||
| 33 | =item Configuration settings | ||
| 34 | |||
| 35 | These lines begin with an asterisk (C<*>). Each such line is of the | ||
| 36 | form C<*>I<property>C<:> I<value>. It sets the named property to the | ||
| 37 | specified value. Valid properties and their meanings are described | ||
| 38 | below. | ||
| 39 | |||
| 40 | =item Taxon data | ||
| 41 | |||
| 42 | All other lines are data. Each such line is of the form | ||
| 43 | I<property>C<:> I<value> with no leading asterisk. It provides data | ||
| 44 | about a specific taxon in the vertebral column diagram. Data is | ||
| 45 | described in detail below. | ||
| 46 | |||
| 47 | =back | ||
| 48 | |||
| 49 | Lines that do not match of either of these forms are invalid. | ||
| 50 | |||
| 51 | =head1 DATA | ||
| 52 | |||
| 53 | =over 4 | ||
| 54 | |||
| 55 | =item C<Taxon> | ||
| 56 | |||
| 57 | Specifies the name of a taxon which will appear in the diagram. The | ||
| 58 | data for each taxon begins with a C<Taxon> line. Following this, any | ||
| 59 | or all of the other three data lines may follow in any order. | ||
| 60 | |||
| 61 | =item C<Specimen> | ||
| 62 | |||
| 63 | Indicates the specimen number of the individual that is | ||
| 64 | described. Useful when multiple individuals of the same taxon are | ||
| 65 | included. | ||
| 66 | |||
| 67 | =item C<Citation> | ||
| 68 | |||
| 69 | Specifies the source of the observations in the C<Data> line: | ||
| 70 | typically either a citation of a published descriptive paper, or | ||
| 71 | "personal observation". At present, this is not used: the intention is | ||
| 72 | that a future version of VertFigure will include it in an auto-generated | ||
| 73 | caption. | ||
| 74 | |||
| 75 | =item C<Data> | ||
| 76 | |||
| 77 | Specifies the information about the individual vertebrae of the column | ||
| 78 | in question. The state of each vertebra is specified by a single | ||
| 79 | character, which can be anything at all. The way those states are | ||
| 80 | illustrated depends on how they are described by the | ||
| 81 | C<state->I<char>C<-color> | ||
| 82 | and | ||
| 83 | C<state->I<char>C<-polygon> | ||
| 84 | configuration settings described below. These can be configured in | ||
| 85 | such as way as to represent cervicals vs. dorsals, pneumatic | ||
| 86 | vs. apneumatic vertebrae, bifid vs. simple neural spines, or whatever | ||
| 87 | other characteristic is of interest. | ||
| 88 | |||
| 89 | Two characters in the data are special: | ||
| 90 | |||
| 91 | First, the hyphen (C<->) indicates that no data is available for the | ||
| 92 | vertebra in question, so nothing is drawn. | ||
| 93 | |||
| 94 | Second, the vertical bar (C<|>) indicates the anchor point: a position | ||
| 95 | within the vertebral column that is particular interest, such as the | ||
| 96 | cervicodorsal transition, or the dorsosacral transition. The anchor | ||
| 97 | points of all the vertebral columns will be horizontally aligned in | ||
| 98 | the output. | ||
| 99 | |||
| 100 | For consistency, in the configuration settings below this anchor point | ||
| 101 | is always referred to as the "cervico-dorsal" transition, the | ||
| 102 | vertebrae before it are referred to as "cervicals" and those after it | ||
| 103 | as "dorsals". But since these terms do not appear in the output, the | ||
| 104 | anchor point may be used as a different transition. | ||
| 105 | |||
| 106 | =back | ||
| 107 | |||
| 108 | =head1 CONFIGURATION SETTINGS | ||
| 109 | |||
| 110 | Each of these properties has a single global setting, which applies | ||
| 111 | across all taxa in the diagram. If a setting is set for a second time, | ||
| 112 | the new value replaces the old. | ||
| 113 | |||
| 114 | The following settings are recognised: | ||
| 115 | |||
| 116 | =over 4 | ||
| 117 | |||
| 118 | =item C<background> I<color> | ||
| 119 | |||
| 120 | If specified, then the emitted SVG file has a solid background in the | ||
| 121 | specified colour; otherwise, it is transparent. | ||
| 122 | |||
| 123 | The value can be any string that is interpreted as identifying a color | ||
| 124 | in SVG -- for example, a name such as C<red> or an RGB triple such as | ||
| 125 | C<rgb(0,193,252)>. | ||
| 126 | See http://www.w3.org/TR/SVG11/types.html#Color | ||
| 127 | |||
| 128 | =item C<box-color> I<color> [default: C<grey>] | ||
| 129 | |||
| 130 | The color of the boxes that outline each vertebra. Can be removed | ||
| 131 | altogether by setting it to the same as the background colour. | ||
| 132 | |||
| 133 | =item C<cervical-height> I<length> | ||
| 134 | |||
| 135 | The height of the boxes drawn to contain "cervical" vertebrae, | ||
| 136 | i.e. those before the anchor point. | ||
| 137 | |||
| 138 | The value can be any string that is interpreted as identifying a | ||
| 139 | length in SVG -- for example, | ||
| 140 | C<2em>, | ||
| 141 | C<100px> | ||
| 142 | or | ||
| 143 | C<2.4cm>. | ||
| 144 | See http://www.w3.org/TR/SVG11/types.html#Length | ||
| 145 | |||
| 146 | =item C<cervical-width> I<length> | ||
| 147 | |||
| 148 | The width of the boxes drawn to contain "cervical" vertebrae, | ||
| 149 | i.e. those before the anchor point. | ||
| 150 | |||
| 151 | =item C<cervico-dorsal-color> I<color> | ||
| 152 | |||
| 153 | If specified, this is the colour in which the vertical line through | ||
| 154 | the cervical-dorsal anchor points of the aligned vertebral columns is | ||
| 155 | drawn; otherwise, no line is drawn. | ||
| 156 | |||
| 157 | =item C<cervico-dorsal-offset> I<length> | ||
| 158 | |||
| 159 | The offset of the cervico-dorsal anchor point across the area of the | ||
| 160 | drawing. Should between 0 and I<width>. | ||
| 161 | |||
| 162 | =item C<dorsal-height-gradient> I<length> | ||
| 163 | |||
| 164 | If defined, the height of each successive dorsal vertebra exceeds that | ||
| 165 | of its predecessor by the specified amount. Can be used to produce | ||
| 166 | increasingly tall (or increasingly short if negative) dorsal | ||
| 167 | vertebrae. | ||
| 168 | |||
| 169 | There is currently no corresponding C<cervical-height-gradient> | ||
| 170 | setting. | ||
| 171 | |||
| 172 | =item C<dorsal-height> I<length> | ||
| 173 | |||
| 174 | |||
| 175 | The height of the boxes drawn to contain "dorsal" vertebrae, | ||
| 176 | i.e. those after the anchor point. | ||
| 177 | |||
| 178 | =item C<dorsal-width> I<length> | ||
| 179 | |||
| 180 | The width of the boxes drawn to contain "dorsal" vertebrae, | ||
| 181 | i.e. those after the anchor point. | ||
| 182 | |||
| 183 | =item C<font-family> I<font> | ||
| 184 | |||
| 185 | The font family to be used for captions, including taxa and specimen | ||
| 186 | numbers. Taxon names are rendered in the italic variant of the font, | ||
| 187 | specimen numbers in the regular font. To inhibit the use of italics | ||
| 188 | for a taxon name (e.g. because it's a clade or family rather than a | ||
| 189 | genus or species), precede it with a forward slash (C</>). | ||
| 190 | |||
| 191 | The font family may be specified by a list of family-names, as in SVG | ||
| 192 | and CSS. | ||
| 193 | See http://www.w3.org/TR/SVG11/types.html#DataTypeListOfFamilyNames | ||
| 194 | |||
| 195 | =item C<font-size> I<length> | ||
| 196 | |||
| 197 | The font size to be used for captions. | ||
| 198 | |||
| 199 | =item C<height> I<length> | ||
| 200 | |||
| 201 | The height of the entire picture to be generated. | ||
| 202 | |||
| 203 | =item C<state-X-color> I<color> | ||
| 204 | |||
| 205 | The states of individual vertebra, represented by single characters | ||
| 206 | and indicated by C<Data> lines, are defined by C<state-X-color> and | ||
| 207 | C<state-X-polygon> pairs of settings. C<state-X-color> specifies what | ||
| 208 | color to use for drawing vertebrae of the state corresponding with the | ||
| 209 | characters I<X>. | ||
| 210 | |||
| 211 | =item C<state-X-polygon> I<list-of-points> | ||
| 212 | |||
| 213 | This specifies how vertebrae with state I<X> are drawn within their | ||
| 214 | boxes. It is specified as a space-separated sequence of I<x>,I<y> | ||
| 215 | pairs, each representing a point within a notional 1.0-by-1.0 space; a | ||
| 216 | polyline between each of these points in order and returning to the | ||
| 217 | first point is drawn and filled in the colour specified by the | ||
| 218 | corresponding C<state-X-color> setting. | ||
| 219 | |||
| 220 | The x-coordinate runs from left to right; the y-coordinate runs from | ||
| 221 | top to bottom. | ||
| 222 | |||
| 223 | Examples: | ||
| 224 | |||
| 225 | C<0,0 0,1 1,1 1,0> simply fills the box with solid color. | ||
| 226 | |||
| 227 | C<0,0 0.5,1 1,0> draws a triangle pointing downwards. | ||
| 228 | |||
| 229 | C<0.1,0.3 0.9,0.5 0.1,0.7> draws a small, narrow triangle pointing to | ||
| 230 | the right. | ||
| 231 | |||
| 232 | =item C<taxon-height> I<length> | ||
| 233 | |||
| 234 | The vertical spacing between consecutive taxa. | ||
| 235 | |||
| 236 | =item C<text-y-offset> I<length> [default: C<0>] | ||
| 237 | |||
| 238 | The distance to move text (i.e. taxon-and-specimen captions) down the | ||
| 239 | drawing relative to the vertebrae (or up if the offset is | ||
| 240 | negative). This can be useful to tweak alignment depending on what | ||
| 241 | font-family and size are used. | ||
| 242 | |||
| 243 | =item C<width> I<length> | ||
| 244 | |||
| 245 | The width of the entire picture to be generated. | ||
| 246 | |||
| 247 | =back | ||
| 248 | |||
| 249 | =head1 EXAMPLES | ||
| 250 | |||
| 251 | See | ||
| 252 | C<examples/bifurcation/bifurcation.vcd> | ||
| 253 | and | ||
| 254 | C<examples/pbj/pbj.vcd> | ||
| 255 | in the distributon. (Note that the latter must be preprocessed by the | ||
| 256 | m4 macro processor.) | ||
| 257 | |||
| 258 | =head1 SEE ALSO | ||
| 259 | |||
| 260 | VertFigure - program for translating VCD files into SVG. | ||
| 261 | |||
| 262 | =head1 AUTHOR | ||
| 263 | |||
| 264 | Copyright (C) 2013-2014 by Mike Taylor E<lt>mike@miketaylor.org.ukE<gt> | ||
| 265 | |||
| 266 | =head1 LICENSE | ||
| 267 | |||
| 268 | GNU General Public Licence v3.0 | ||
| 269 | |||
| 270 | =cut | ||
| 271 | |||
| 272 | |||
| 273 | 1; |