' This module implements the Geodesix function calls Option Explicit Function AddressBar(onoff As String) As String AddressBar = CallGeodesix("addressbar", onoff) End Function Function Clicked() As String Clicked = CallGeodesix("clicked", "") End Function Sub Default() CallGeodesix "default", "" End Sub Sub DrawCircle(ByVal id As Integer, _ ByVal lat As Double, _ ByVal lng As Double, _ ByVal radius As Double, _ ByVal text As String, _ ByVal strokecolour As String, _ ByVal strokeopacity As Double, _ ByVal strokeweight As Integer, _ ByVal fillcolour As String, _ ByVal fillopacity As String) CallGeodesix "drawcircle", id & "," & lat & "," & lng & "," & radius & ",""" & _ text & """,""" & strokecolour & """," & strokeopacity & "," & _ strokeweight & ",""" & fillcolour & """," & fillopacity End Sub Sub DrawDirections(ByVal id As Integer, _ ByRef points() As Double, _ ByVal mode As String, _ ByVal strokecolour As String, _ ByVal strokeopacity As Double, _ ByVal strokeweight As Integer, _ ByVal suppressInfoWindows As Boolean, _ ByVal suppressMarkers As Boolean) CallGeodesix "drawdirections", id & "," & """" & SerialiseJSON(points) & """,""" & mode & """,""" & _ strokecolour & """," & strokeopacity & "," & _ strokeweight & "," & suppressInfoWindows & "," & suppressMarkers End Sub Sub DrawKML(ByVal id As Integer, _ ByVal kmlurl As String, _ ByVal text As String, _ ByVal strokecolour As String, _ ByVal strokeopacity As Double, _ ByVal strokeweight As Integer, _ ByVal fillcolour As String, _ ByVal fillopacity As Double) CallGeodesix "drawkml", id & "," & """" & kmlurl & """,""" & text & """,""" & _ strokecolour & """," & strokeopacity & "," & _ strokeweight & ",""" & fillcolour & """," & fillopacity End Sub Sub DrawLegend(id As Integer, _ html As String, _ position As String) CallGeodesix "drawlegend", id & ",""" & html & """,""" & position & """" End Sub Function LongString(s As String) If Len(s) < 255 Then LongString = s Else Dim ans As String ans = "" Dim chunk As String Do While s <> "" chunk = Left(s, 25) chunk = """" & DoubleQuote(chunk) & """" ans = ans & " & " & chunk s = Mid(s, 26) Loop End If LongString = Mid(ans, 3) End Function Sub DrawInfoWindow(ByVal id As Integer, _ ByVal lat As Double, _ ByVal lng As Double, _ ByVal content As String) CallGeodesix "drawinfowindow", id & "," & lat & "," & lng & ",""" & content & """" End Sub Sub DrawLine(ByVal id As Integer, _ lat1 As Double, _ lon1 As Double, _ lat2 As Double, _ lon2 As Double, _ text As String, _ strokecolour As String, _ strokeopacity As Double, _ strokeweight As Integer) CallGeodesix "drawline", id & "," & lat1 & "," & lon1 & "," & lat2 & "," & lon2 & _ ",""" & text & """,""" & strokecolour & """," & strokeopacity & "," & strokeweight End Sub Sub DrawMarker(ByVal id As Integer, _ ByVal lat As Double, _ ByVal lng As Double, _ ByVal icon As String, _ ByVal title As String) CallGeodesix "drawmarker", id & "," & lat & "," & lng & ",""" & icon & """,""" & title & """" End Sub Sub DrawPolygon(ByVal id As Integer, _ ByRef points() As Double, _ ByVal text As String, _ ByVal strokecolour As String, _ ByVal strokeopacity As Double, _ ByVal strokeweight As Integer, _ ByVal fillcolour As String, _ ByVal fillopacity As Double) CallGeodesix "drawpolygon", id & "," & """" & SerialiseJSON(points) & """,""" & text & """,""" & _ strokecolour & """," & strokeopacity & "," & _ strokeweight & ",""" & fillcolour & """," & fillopacity End Sub Sub DrawPolyLine(ByVal id As Integer, _ ByRef points() As Double, _ ByVal text As String, _ ByVal colour As String, _ ByVal opacity As Double, _ ByVal weight As Integer) CallGeodesix "drawpolyline", id & "," & """" & SerialiseJSON(points) & """,""" & text & """,""" & _ colour & """," & opacity & "," & weight End Sub Function Help(onoff As String) Help = CallGeodesix("help", """" & onoff & """") End Function Function Language(newLangauge As String) Language = CallGeodesix("language", """" & newLangauge & """") End Function Sub Navigate(URL As String) CallGeodesix "navigate", """" & URL & """" End Sub Function Overlay(id, onoff As String) Overlay = CallGeodesix("overlay", id & "," & """" & onoff & """") End Function Function position(newPosition As String) position = CallGeodesix("position", """" & newPosition & """") End Function Function RegionBias(newRegionBias As String) RegionBias = CallGeodesix("regionbias", """" & newRegionBias & """") End Function Function Showing() Showing = CallGeodesix("showing", "") End Function Sub ShowLocation(place As String) CallGeodesix "showlocation", """" & place & """" End Sub Sub ShowSheet(sheet As String) CallGeodesix "showsheet", """" & sheet & """" End Sub Function TaskPane(onoff As String) TaskPane = CallGeodesix("taskpane", """" & onoff & """") End Function Function TaskPaneMenu(onoff As String) TaskPaneMenu = CallGeodesix("taskpanemenu", """" & onoff & """") End Function Function URL() URL = CallGeodesix("url", "") End Function Sub ZoomToContent() CallGeodesix "zoomtocontent", "" End Sub Function SerialiseJSON(arr As Variant) As String Dim result As String Dim a As Variant For Each a In arr result = result & "," & a Next SerialiseJSON = "[" & Mid(result, 2) & "]" End Function Function CallGeodesix(verb As String, args As String) As String Dim eval As String Dim result As String If args = "" Then eval = "=Geodesix(" & quote(verb) & ","""")" Else eval = "=Geodesix(" & quote(verb) & "," & args & ")" End If On Error Resume Next result = Application.Evaluate(eval) If Err = 0 Then If Left(result, 1) = "!" Then ' failed result = Mid(result, 2) MsgBox result Err.Raise 65000, "GeodesiX", result End If CallGeodesix = result Else MsgBox Err.Description CallGeodesix = Err.Description End If End Function Function DoubleQuote(s As String) As String DoubleQuote = Replace(s, """", """""") End Function Function quote(s As String) As String quote = """" & s & """" End Function