diff --git a/comp/src/gb.map/.component b/comp/src/gb.map/.component index 5dcf26fce..a2eda9fd1 100644 --- a/comp/src/gb.map/.component +++ b/comp/src/gb.map/.component @@ -1,6 +1,6 @@ [Component] Key=gb.map -Version=3.17.90 +Version=3.18.90 State=1 Authors=Fabien Bodard Needs=Form,ImageIO diff --git a/comp/src/gb.map/.project b/comp/src/gb.map/.project index 05bbf6719..8c9d32baa 100644 --- a/comp/src/gb.map/.project +++ b/comp/src/gb.map/.project @@ -1,8 +1,8 @@ # Gambas Project File 3.0 Title=gb.map -Startup=Form6 +Startup=Form7 Icon=.hidden/control/mapview.png -Version=3.17.90 +Version=3.18.90 VersionFile=1 Component=gb.image Component=gb.gui diff --git a/comp/src/gb.map/.src/Map.class b/comp/src/gb.map/.src/Map.class index 4e2d34265..9aac122f7 100644 --- a/comp/src/gb.map/.src/Map.class +++ b/comp/src/gb.map/.src/Map.class @@ -170,7 +170,8 @@ End Private Sub Center_Write(Value As MapPoint) - 'Print Value.Lat, Value.Lon + 'Can't be null + If IsNull(Value) Then Return $mpCenter = Value SetBoxes diff --git a/comp/src/gb.map/.src/Tests/Form7.class b/comp/src/gb.map/.src/Tests/Form7.class index d88d901f0..f5baf4d70 100644 --- a/comp/src/gb.map/.src/Tests/Form7.class +++ b/comp/src/gb.map/.src/Tests/Form7.class @@ -1,9 +1 @@ ' Gambas class file - - -Public Sub Form_Open() - - MapView1.Map.AddTile("OpenStreetMap", "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", Null, "OpenStreetMap1").Copyright = "© OpenStreetMap contributors" - Dim hLayer As New _BalloonLayer - MapView.Map._AddMapLayer("test", hLayer) -End diff --git a/comp/src/gb.map/.src/Types/MapPoint.class b/comp/src/gb.map/.src/Types/MapPoint.class index c3f90d5e5..88bfe2220 100644 --- a/comp/src/gb.map/.src/Types/MapPoint.class +++ b/comp/src/gb.map/.src/Types/MapPoint.class @@ -209,3 +209,27 @@ Static Public Function GetCenter(hPoints As MapPoint[]) As MapPoint Catch End + +''Get string representation in decimal of a mappoint. +Static Public Sub ToString(hMp As MapPoint) As String + + Return CStr(hMp.Lat) & ", " & CStr(hMp.Lon) + +End + + +''Get a MapPoint from a string representation in decimal. +Static Public Sub FromString(sMp As String) As MapPoint + + Dim a As String[] = Scan(sMp, "*,*") + + 'if not able to get the values then return null + If IsNull(a) Then Return + + 'if not 2 value then return null + If a.Count < 2 Then Return + + 'Try to convert str to float values + Try Return MapPoint(CFloat(a[0]), CFloat(a[1])) + +End diff --git a/comp/src/gb.map/.src/_MapShape.class b/comp/src/gb.map/.src/_MapShape.class index 585ceda31..74da45904 100644 --- a/comp/src/gb.map/.src/_MapShape.class +++ b/comp/src/gb.map/.src/_MapShape.class @@ -49,7 +49,7 @@ Public Sub _Load() Dim hMap As Map = Me._GetMap() Dim pt1, pt2 As Point - + $aInView.Clear For i As Integer = 0 To $aShapes.Max If Not ($aShapes[i].Type = _Point) Then @@ -80,7 +80,7 @@ End Public Sub AddPoint(Key As String, Points As MapPoint, Optional {Color} As Integer, Optional Icon As Image) As _MapShapeItem If $aShapeNames.Exist(Key) Then Error.Raise("This key already exist") - + If IsNull(Points) Then Error.Raise("Points is null") Dim hItem As New _MapShapeItem(Key) As "Item" If Not IsMissing(Icon) Then hItem.Image = Icon @@ -207,6 +207,7 @@ Public Sub Draw() Dim iAlpha As Integer If $aShapes.Count = 0 Then Return + For i As Integer = 0 To $aInView.Max 'TODO: Check opacity