views:

44

answers:

1

Hi guys

How would you go about implementing a map of this type in Silverlight? The map would be interactive and stations would be clickable.

http://www.afn.org/~alplatt/tube.html

Would you draw it in blend? Import a vector image? I guess the choice is very important because pathfinding algorithms need to be able to calculate distances/fares between stations (based on their XY location, presumably, haven't decided yet).

Just looking for different ideas and opinions.

Thanks

+2  A: 

I'd take the vector approach. Capture the x,y coordinates of the stations and the control points for the paths of the rail lines into static data in the code. Create lightweight objects (not UserControls) for each rail line segment and station, and let them render themselves and handle their own mouse clicks. Define a rail line as a collection of rail segments and stations.

For pathfinding, the last thing you want is to use pixels to figure out how to get from A to B. You only need a tree of connected nodes representing the connections between stations, then use tree traversal to find all paths between two stations. For a limited number of stations & paths, you could also precalculate the valid station combinations and paths - just like the train schedule tables.

dthorpe
Yeah, that seems like the best solution out there. Rail line data would be stored in XML. Thanks.
VexXtreme