Hello;
i'm trying to define my own Polygon implementation, adding an inernal marker that will add Tool Tip functionnality, however i faced two problems:
first , the GoogleMarker with image type None do not render (value of Bitmap can not be null).
second , the marker when set with some image, do not render in it's position.
i'm trying to define my own Polygon implementation, adding an inernal marker that will add Tool Tip functionnality, however i faced two problems:
first , the GoogleMarker with image type None do not render (value of Bitmap can not be null).
second , the marker when set with some image, do not render in it's position.
<Serializable>
Public Class GLPolygonMarker
Inherits GMap.NET.WindowsForms.GMapPolygon
Implements ISerializable, IGLCustomMarker
'Ctor:
Public Sub New(points As List(Of GMap.NET.PointLatLng), Optional name As String = "Polygone")
MyBase.New(points, name)
If points Is Nothing OrElse points.Count = 0 Then
Throw New ArgumentException("List Of Points Emty or Missing", "Points")
End If
Me.IsHitTestVisible = False
_Type = GLCustomMarkerType.Polygon
_Id = "S" & DateTime.Now.ToUniqueId()
Me.Color = New GLSerialColor(Drawing.Color.Azure) With {.Alpha = 100}
Me.Border = New GLSerialPen(Drawing.Color.DarkBlue, 1, Drawing2D.DashStyle.Solid)
_TTMarker = New GMap.NET.WindowsForms.Markers.GMarkerGoogle(MyBase.Points.Item(0), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_small)
End Sub
'Id :
Private _Id As String
Public ReadOnly Property Id As String Implements IGLCustomMarker.Id
Get
Return _Id
End Get
End Property
'Type:
Private _Type As GLCustomMarkerType
Public ReadOnly Property Type As GLCustomMarkerType Implements IGLCustomMarker.Type
Get
Return _Type
End Get
End Property
'Name :
Public Property PName As String Implements IGLCustomMarker.Name
Get
Return Me.Name
End Get
Set(value As String)
If String.IsNullOrWhiteSpace(value) = False Then
Me.Name = value
End If
End Set
End Property
'Pen:
Private _Border As GLSerialPen
Public Property Border As GLSerialPen Implements IGLCustomMarker.Border
Get
Return _Border
End Get
Set(value As GLSerialPen)
_Border = value
Me.Stroke = value.ToDotNetPen
End Set
End Property
'Color:
Private _Color As GLSerialColor
Public Property Color As GLSerialColor Implements IGLCustomMarker.Color
Get
Return _Color
End Get
Set(value As GLSerialColor)
_Color = value
Me.Fill = New SolidBrush(_Color.ToDotNetColor)
End Set
End Property
'Tooltip:
Private _TTMarker As GMap.NET.WindowsForms.Markers.GMarkerGoogle
Public Property TTText As String Implements IGLCustomMarker.TTText
Get
Return _TTMarker.ToolTipText
End Get
Set(value As String)
_TTMarker.ToolTipText = value
End Set
End Property
Public Property TTMode As GMap.NET.WindowsForms.MarkerTooltipMode Implements IGLCustomMarker.TTMode
Get
Return _TTMarker.ToolTipMode
End Get
Set(value As GMap.NET.WindowsForms.MarkerTooltipMode)
_TTMarker.ToolTipMode = value
End Set
End Property
'Drawing:
Public Overrides Sub OnRender(g As Graphics)
MyBase.OnRender(g)
_TTMarker.OnRender(g)
End Sub
'Serialization:
Public Overloads Sub GetObjectData(info As SerializationInfo, context As StreamingContext) Implements ISerializable.GetObjectData
MyBase.GetObjectData(info, context)
info.AddValue("ID", _Id)
info.AddValue("Color", _Color, GetType(GLSerialColor))
info.AddValue("Border", _Border, GetType(GLSerialPen))
info.AddValue("TTText", _TTMarker.ToolTipText)
info.AddValue("TTMode", CType(_TTMarker.ToolTipMode, Byte))
End Sub
Public Sub New(info As SerializationInfo, context As StreamingContext)
MyBase.New(info, context)
_Type = GLCustomMarkerType.Polygon
_Id = info.GetString("ID")
Me.Color = CType(info.GetValue("Color", GetType(GLSerialColor)), GLSerialColor)
Me.Border = CType(info.GetValue("Border", GetType(GLSerialPen)), GLSerialPen)
Dim points As GMap.NET.PointLatLng() = CType(info.GetValue("Points", GetType(GMap.NET.PointLatLng())), GMap.NET.PointLatLng())
_TTMarker = New GMap.NET.WindowsForms.Markers.GMarkerGoogle(points(0), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_small)
_TTMarker.ToolTipText = info.GetString("TTText")
_TTMarker.ToolTipMode = CType(info.GetByte("TTMode"), GMap.NET.WindowsForms.MarkerTooltipMode)
End Sub
End Class
can any one help me please