ThinkGeo.com    |     Documentation    |     Premium Support

GeoCanvas Drawing with Screen Coordinates

Hi,

I have an older program I’m trying to upgrade from v10 to v12. It has some custom layers and styles that I was drawing on the map. I was performing all my calculations in screen coordinates and then using GeoCanvas.DrawLine(List…) to draw my shapes on the map. In v12 it looks like I can only draw using world coordinates now. Is that correct, or am I missing something else? Do I really need to convert a ScreenPointF to a PointShape via ToWorldCoordinate, and then back into a ScreenPointF to use with DrawLine?

Thanks!
Tim

Hi Tim,

Which specific version are you using? I checked the source code of v12.0 and the latest version v12.3.10.4, and I found that DrawLine supports screen points, the fifth overload is the one you need.

DrawLine(IEnumerable<ScreenPointF> screenPoints, GeoPen linePen, DrawingLevel drawingLevel, float xOffset, float yOffset)

Thanks,
Leo

OK, I figured it out. I was converting to screen coordinates the wrong way. Once I started using MapUtil and canvas.CurrentWorldExtent, everything worked as expected.

Thanks for taking a look!

Hi Tim,

You’re welcome. I’m glad your problem was resolved. Let me you know if you have more questions.

Thanks,
Leo