From: John A. T. <ja...@ja...> - 2006-07-08 14:31:21
|
Ok, after looking at Iain's code, I propose the following: Extend the tile XML file to show additional exclusive track use and add necessary drawing data: <Tile id="62" colour="green" category="NY"> # position/rotation can be defaulted <Station id="1" type="City" slots="2" value="80" position="90,.4" rotation="0" /> <Station id="2" type="City" slots="2" value="80" position="270,.4" rotation="0" /> # gauge and level are defaulted, use shorter labels for size and parsing speed <Track from="1" to="A" /> <Track from="1" to="F" /> <Track from="2" to "E" /> <Track from="2" to "D" /> </Tile> <Tile id="Map-1841-Milano" colour="yellow" category="M"> <Annotation text="Milano" size="12pt" position="270,.7" justify="b" rotation="0" /> <Station id="1" type="City" slots="1" value="60" position="210,.6" /> <Track from="1" to "A"> <Excludes from="1" to "B" /> </Track> <Track from="1" to "B"> <Excludes from="1" to="A" /> </Track> </Tile> <Tile id="23" colour="green"> <Track from="A" to="D" /> <Track from="D" to="B" /> </Tile> <Tile id=16 colour="green"> <Track from="A" to "C" level="0"/> <Track from="B" to "D" level="2"/> </Tile> <Tile id="Map-1830-Altoona" colour="fixed"> <Station id="1" type="City" slots="1" value="10" reservedtoken="PRR" /> <Track from="E" to="1" /> <Track from="B" to="1" /> <Track from="B" to="E"> <Draw from="E" to="[210,.25]" radius="-.25" /> <Draw from="[210,.25]" to="[300,.25]" radius=".25" /> <Draw from="[300,.25]" to="B" radius="-.25" /> </Track> </Tile> Tile code defaults to the id if it is numeric, otherwise it defaults to "", can be overriden with code="603" etc. Note that for the #23 tile the excludes are automatically picked up since the edges overlap. Since 90% of the gauge will be normal, it makes sense to default that attribute (as well as level, which is only needed for tiles with overpasses). The Milano tile shows how extra excludes that wouldn't be known just from looking at the connectivity information are specified. The last tile shows how you can specify how to draw a particular piece of track if the default choices won't work (a negative radius means curving away from the center of the tile, positive means curve towards the center; leaving radius out means a straight line). If you are worried about intialization time (and automatically positioning elements that don't have a position specified is not a trivial task), this file could be built from a master file that contains all the tile definitions and filling in all the drawing and other defaulted information. Once you do that, this needs to be considered a generated file, but that is a good thing since otherwise you will have multiple copies of the same tile data that have to be updated and we know that means they won't be exactly the same. In addition to text annotations, we need to support other annotations as well, which would be used to show additional building costs or graphics added to the tile. In my perl code, I just supply arbitrary postscript code for them, but that won't work here. I suggest having something like <Annotation shape="xxx" position="a,r" scale="s"/> which references shape xxx defined elsewhere, either SVG to draw it or perhaps even custom code. It will be a lot less work to add the excludes that can't be deduced automatically than to do all the splitting of junctions into junction exits, and the resulting datastructure will be simpler as well. -- John A. Tamplin ja...@ja... 770/436-5387 HOME 4116 Manson Ave Smyrna, GA 30082-3723 |