Hello! I’m developing in VB6, and I have code that draws a circle with a certain radius in meters, using ConvertDistance to make the conversion. Howerver, my code stopped working when I updated the ocx from 5.1.1.0 to 5.2
Here is the relevant part of the code, can anyone figure out why it doesn’t work anymore and what would be a workaround? Thanks!
*** On form load: ***
Map1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR
myId = tkTileProvider.ProviderCustom + 2
'Local server with openstreetmap tiles:
ans = Map1.Tiles.Providers.Add(myId, "Localhost Provider", "http://localhost/hot/{zoom}/{x}/{y}.png", tkTileProjection.SphericalMercator, 0, 16)
Map1.Tiles.ProviderId = myId
*** On the draw function ***
Dim m_Utils As New Utils
Dim valDist As Double, visDist As Double
Map1.ClearDrawings
Handle = Map1.NewDrawing(tkDrawReferenceList.dlSpatiallyReferencedList)
Map1.DegreesToProj sourceLon, sourceLat, X, Y
visDist = 3000
valDist = 200
ans = m_Utils.ConvertDistance(tkUnitsOfMeasure.umMeters, Map1.GeoProjection.LinearUnits, valDist)
valDist = valDist / Cos(sourceLat * PI / 180)
Map1.DrawWideCircle X, Y, valDist, RGB(120, 0, 0), False, 4, 255 'had to add alpha value 255 on v5.2, not optional
ans = m_Utils.ConvertDistance(tkUnitsOfMeasure.umMeters, Map1.GeoProjection.LinearUnits, visDist)
visDist= visDist/ Cos(sourceLat * PI / 180)
Map1.DrawWideCircle X, Y, visDist, RGB(0, 120, 0), False, 4, 255
Edit: To be more specific, the problem is that the circles don’t change their apparent radius when I change zoom levels in the map, they mantain ther size in pixels. Which shouldn’t happen, as I set dlSpatiallyReferencedList on the drawing layer.
Edit 2: I went back to v5.1.1 for now, and the same code is back to working as intended. I can stay with v5.1.1 for now, so this isn’t an urgent problem for me, but it’d be nice if it could be fixed (and then I can use the new alpha setting when drawing circles!)