This is really to big to be a snippet but I was not sure where to put it.
I have had a lot of fun with this and I thought that others might like to see what can be done with Hollywood.
This uses Royale but it could easily be made to be cross platform.
Check out developers.google.com/maps/documentation/staticmaps/ for more info.
Here we go.
Code: Select all
@VERSION 6,0
@REQUIRE "MUIRoyale"
@APPTITLE "Mapper"
@APPVERSION "$VER: 1.0 (01.05.15)"
@APPCOPYRIGHT "©2015, George Leo den Hollander"
@APPAUTHOR "Leo den Hollander"
@APPDESCRIPTION "GOOGLE MAPPING PROGRAM"
; Check out developers.google.com/maps/documentation/staticmaps/
@DISPLAY {Hidden = True}
DTW = getattribute(#Display,0,#AttrMaxWidth)
DTH = getattribute(#Display,0,#AttrMaxHeight)
xml$ = ReplaceStr(FileToString("Mapper.xml"), "%DTW", DTW)
xml$ = ReplaceStr(xml$, "%DTH", DTH)
if DTW > 1024
IWsize = 1024
endif
if DTH > 950
IHsize = 900
endif
createbrush(1,IWsize,IHsize)
Lat$ = "-29.30001"
Long$ = "134.00001"
MapAddress$ = Lat$..","..Long$
Zoom = 4
Global Markers$ = "markers=size:tiny"
MapType = 2
Dim LLdata[101]
Function GetMap(Mapaddress$,Zoom,Maptype,Markers$)
mui.set("Editor","contents","")
openconnection(0,"maps.google.com",80)
Request2$="/maps/api/staticmap?center="..Mapaddress$.."&"..Markers$.."&zoom="..strstr(zoom).."&size=512x475&scale=2"
if MapType = 0
Type$ = "roadmap"
elseif MapType = 1
Type$ = "satellite"
elseif MapType = 2
Type$ = "terrain"
elseif MapType = 3
Type$ = "hybrid"
endif
Request2$ = Request2$ .. "&maptype="..Type$
Request2$ = Request2$ .. "&sensor=false"
Request$ ="GET " .. Request2$ .. " HTTP/1.0" .. "\r\n"
Request$ = Request$ .. "Content-Type: application/x-www-form-urlencoded; charset=iso-8859-1" .. "\r\n"
Request$ = Request$ .. "Host: maps.google.com" .. "\r\n" .. "\r\n"
NLA = val(Lat$)
Lat$=strstr(NLA,4)
mui.set("latitude","contents",Lat$)
NLO = val(Long$)
Long$=strstr(NLO,4)
mui.set("longitude","contents",Long$)
mui.set("Output","contents","")
sendcount = SendData(0,Request$)
mui.set("Output","contents",Request$)
InData$, dwBytes, done = receiveData(0,#RECEIVEALL)
CloseConnection(0)
st = findstr(InData$,"\r\n\r\n")
words = leftstr(indata$,st)
mui.set("Editor","contents",words)
pic = midstr(indata$,st+4,dwBytes-st+4)
stringtofile(pic,"RAM:Google.png")
loadbrush(1,"RAM:Google.png",{width=1024,height=900})
mui.set("normal","Brush",1)
EndFunction
Function LoadinData()
Datafile$ = ""
Datafile$ = FileRequest("Open a File","",#REQ_NORMAL,"","")
If Datafile$ <> ""
x= 1
Openfile(2,Datafile$,#MODE_READ)
mui.set("File","contents",DataFile$)
for d$ in FileLines(DataFile$)
LLdata[x] = d$
x=x+1
next
closefile(2)
x=x-1
Convert$= ""
for t = 1 to x step 4
if t > 3 and LLdata[t] = "C2" and LLdata[t-4] = "C1"
MC$ = "&markers=size:mid|color:blue|"
elseif LLdata[t] = "C3" and LLdata[t-4] = "C2"
MC$ = "&markers=size:mid|color:green|"
elseif LLdata[t] = "C4" and LLdata[t-4] = "C3"
MC$ = "&markers=size:mid|color:purple|"
elseif LLdata[t] = "C5" and LLdata[t-4] = "C4"
MC$ = "&markers=size:mid|color:white|"
else
MC$ = ""
endif
LB$ = ""
if LLdata[t+1]<>""
LB$ = "label:"..LLdata[t+1].."|"
endif
Convert$ = Convert$..MC$..LB$..LLdata[t+2]..","..LLdata[t+3].."|"
next
Markers$ = "&markers=size:mid|color:red|"..Convert$
; valid colours red blue green purple yellow orange gray black brown white
; valid sizes tiny mid small
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Endif
EndFunction
Function p_MUIEvent(id) ; * Joint event handler for MUI buttons and menus ***********************************
Switch id
Case "Home":
Lat$ = "-29.30001"
Long$ = "134.00001"
MapAddress$ = Lat$..","..Long$
Zoom = 4
Markers$ = "markers=size:tiny"
MapType = 0
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "down":
Latval = val(lat$)
d=80
for z = 1 to zoom
d=d/2
next
Lat$= strstr(Latval-d,4)
mui.set("file","contents",Lat$)
MapAddress$ = Lat$..","..Long$
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "up":
Latval = val(lat$)
u=80
for z = 1 to zoom
u=u/2
next
Lat$= strstr(Latval+u,4)
MapAddress$ = Lat$..","..Long$
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "left":
Longval = val(Long$)
l=80
for z = 1 to zoom
l=l/2
next
Long$= strstr(Longval-l,4)
MapAddress$ = Lat$..","..Long$
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "right":
Longval = val(Long$)
r=80
for z = 1 to zoom
r=r/2
next
Long$= strstr(Longval+r,4)
MapAddress$ = Lat$..","..Long$
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "Set":
Lat$ = mui.get("CenterLat","Contents")
Long$ = mui.get("Centerlong","Contents")
MapAddress$ = Lat$..","..Long$
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
Case "Load":
LoadinData()
Case "Quit":
End
EndSwitch
EndFunction
Function p_EventFunc(msg)
Switch msg.action
Case "MUIRoyale":
Switch msg.attribute
Case "CloseRequest":
End
Case "Pressed":
p_MUIEvent(msg.id)
Case "Active":
Switch msg.id
Case "Type":
MapType = mui.Get("Type", "active", msg.triggervalue)
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
endswitch
Case "Level"
Switch msg.id
Case "zoom":
zoom = msg.triggervalue
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
EndSwitch
Endswitch
Case "HideWindow":
MUI.Set("app", "iconified", True)
Case "ShowWindow":
MUI.Set("app", "iconified", False)
EndSwitch
EndFunction
mui.CreateGui([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="Map">
]] .. xml$ .. "</application>")
; listen to these events!
InstallEventHandler({MUIRoyale = p_EventFunc, HideWindow = p_EventFunc, ShowWindow = p_EventFunc})
EscapeQuit(True)
GetMap(Mapaddress$,Zoom,Maptype,Markers$)
; main loop!
Repeat
WaitEvent
Forever
Code: Select all
<window title=" Google Mapper" id="window" width="%DTW" height="%DTH" notify="closerequest" >
<vgroup background="pre_ShadowFill">
<vgroup>
<hgroup>
<image id="normal" source="Brush: 1"/>
<vgroup frame="group">
<label centered="1">\33bGOOGLE MAPPER</label>
<rectangle maxheight="5"/>
<button id="Home" notify="pressed">HOME</button>
<rectangle maxheight="20"/>
<label leftaligned="true">LATITUDE</label>
<string id="Latitude" contents=""/>
<label leftaligned="true">LONGATUDE</label>
<string id="Longitude" contents=""/>
<label leftaligned="true">ZOOM</label>
<slider id="zoom" notify="level" level="4" min="1" max="20"/>
<rectangle maxheight="10"/>
<button id="up" notify="pressed">Move Map Up</button>
<button id="down" notify="pressed">Move Map Down</button>
<button id="left" notify="pressed">Move MapLeft</button>
<button id="right" notify="pressed">Move Map Right</button>
<rectangle maxheight="20"/>
<label leftaligned="true"> Manual Set- Center of Map</label>
<hgroup>
<label leftaligned="true"> Lat </label>
<string id="CenterLat" contents=""/>
<label leftaligned="true"> Long </label>
<string id="CenterLong" contents=""/>
</hgroup>
<button id="Set" notify="pressed">Set Lat Long</button>
<rectangle/>
<label leftaligned="true">MAP TYPE</label>
<cycle id="Type" notify="Active">
<item>Road Map</item>
<item>Satalite</item>
<item>Terrain</item>
<item>Hybrid</item>
</cycle>
<rectangle/>
<texteditor Id="Editor" Contents="" rows="15" scrollbar="true"/>
<rectangle maxheight="20"/>
<button id="Load" notify="pressed">Load Data File</button>
<string id="File" contents=""/>
</vgroup>
</hgroup>
<string id="Output" maxlen="2000" contents=""/>
</vgroup>
</vgroup>
</window>
Code: Select all
C1
A
-32.95853361
116.3187218
C2
B
-35.65263456
118.32189876
C3
C
-34.35855368
116.3189344
C4
1
-34.05853361
117.3189344
Basic Instruction to follow in next post.
No Promises, No Warranties.
Cheers
Leo