I have a map consisting of a number of lines. I'd like to draw these lines on my screen every so often (using a Handler
to update the data every 100 ms, so I'm thinking I can update the screen in that update()
method).
I found a couple of questions that cover how to draw lines using Canvas#DrawLine()
, but they both take direct screen pixel coordinates (unless I misunderstood).
Say I want to draw a 500m x [however much fits on the longer screen axis to preserve scale] portion of the map on my screen (I can use all of my screen), how would I translate my xyz coordintates from the map into screen coordinates for drawing? Is there some clever way of doing this except to look up screen resolution and calculating everything as fractions of that?
For simplicity, assume each line can be found in an ArrayList<Line>
with Line
having methods getX()
and getY()
.
Edit: I would also like to be able to draw different lines with different colours depending on some condition.