I am trying write render for OSM on C#. I haven't trouble with drawing areas, house and roads, but i can't understand how drawing street names. Can you tell me algorithm for drawing label street. Or specify on opensource project where i can read them. asked 24 May '13, 08:43 amirkin |
Drawing labels is indeed difficult but you can take a look at one of the many rendering softwares available for OSM to get an idea. According to this list there is no open source rendering software for OSM written in C# yet. answered 24 May '13, 09:01 scai ♦ |
I don't no of a specific one but if it was a programming problem given to me I'd first work out the style I wanted to achive do I need it writen in a straight line or bending with the road if its a straight line do I need it spun around to lie in some relation to the road or just lying to the alignment of the paper with no regard to the road direction. Once I'd worked out the co-ordenates that line goes and chosen a point lying along the line to act as a base point. I could then work out the angle of the line and corrisponding angle that my style would like to offset the text away from the road. Find cordinates for that offset line then referance the straight txt to that point in the normal method your graphics system dose it (note text base point might need a conversion if the offset point is say to the middle of the text and the graphics system uses the start of the line. Now thats the easy option sort of described how to do genericly to do curves I'd get the system to calculate multiple offset lines around the point I want the text to go then form a curve onto those end points and then try either a built in option to place text on a curve or without that luxuary I'd try playing at putting each letter and symbol at a point given along the dirved line note I'd think of spaceing futher along the line when the curve is tight or the relitive dictance between each letter looks mathimaticaly to small (ie too close). I've not done it for real yet but hopefully these ideas might help you sus out your problem remeber its mainly geomatry and commonsence in graphics ploting. Goodluck! answered 20 Apr '15, 21:54 Govanus |