Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all articles
Browse latest Browse all 3384

Commented Unassigned: Custom marker not rendering on lower zoom levels [16109]

$
0
0
I am having trouble viewing a custom marker at lower zoom levels i.e. the marker builds fine and displays on my control at higher zoom levels, but disappears as you zoom out in the control. Is this a bug or a problem with my coding (any help would be appreciated)?

Standard custom marker template code:
```
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports GMap.NET
Imports GMap.NET.WindowsForms
Imports System.Windows.Forms


Public Class GmapCustomRadiusMarker
Inherits GMapMarker

Private gcrm_radius As Integer
Private gcrm_outlinePen As Pen
Private gcrm_fillBrush As Brush
Private gcrm_fill As Boolean
Private gcrm_control As GMapControl
Private gcrm_scale As String


Public Sub New(markerPoint As PointLatLng, Radius As Integer, OutlinePenSpecs As Pen, FillBrushSpecs As Brush, FillArea As Boolean, scale As String)
MyBase.New(markerPoint)
gcrm_outlinePen = OutlinePenSpecs
gcrm_fillBrush = FillBrushSpecs
gcrm_radius = Radius
gcrm_fill = FillArea
gcrm_scale = scale
End Sub

Public Overrides Sub OnRender(graphicsObject As Graphics)
Dim R As Integer
graphicsObject.SmoothingMode = SmoothingMode.AntiAlias
graphicsObject.CompositingQuality = CompositingQuality.GammaCorrected


If gcrm_scale = "metre" Then
R = CInt((gcrm_radius) / Overlay.Control.MapProvider.Projection.GetGroundResolution(Overlay.Control.Zoom, Position.Lat)) * 2
ElseIf gcrm_scale = "mile" Then
R = CInt(((gcrm_radius) / Overlay.Control.MapProvider.Projection.GetGroundResolution(Overlay.Control.Zoom, Position.Lat)) * 2) * 1621
Else
''gcrm_scale = "kilometre"
R = CInt(((gcrm_radius) / Overlay.Control.MapProvider.Projection.GetGroundResolution(Overlay.Control.Zoom, Position.Lat)) * 2) * 1000
''MsgBox("Zoom level: " + Convert.ToString(Overlay.Control.MapProvider.Projection.GetGroundResolution))
End If


If gcrm_fill = True Then
graphicsObject.FillEllipse(gcrm_fillBrush, New System.Drawing.Rectangle(LocalPosition.X - R \ 2, LocalPosition.Y - R \ 2, R, R))
End If
graphicsObject.DrawEllipse(gcrm_outlinePen, New System.Drawing.Rectangle(MyBase.LocalPosition.X - R \ 2, MyBase.LocalPosition.Y - R \ 2, R, R))
End Sub
End Class
```
Instantiating the class:
```
Dim alphaAmount As Double = 0.5

radiusMarkerOverlay = New GMapOverlay("searchRadius")
Dim semiTransBrush As New SolidBrush(Color.FromArgb(Convert.ToInt32(255 * alphaAmount), Color.BlueViolet))
Dim radiusMarker = New GmapCustomRadiusMarker(referenceLocation, refRadius, Pens.Black, semiTransBrush, True, "kilometre")

radiusMarkerOverlay.Markers.Add(radiusMarker)
ctrlGmap.Overlays.Add(radiusMarkerOverlay)
```

Comments: Hm, thats strange, maybe ground resolution isn't correct?

Viewing all articles
Browse latest Browse all 3384


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>