|
Post by alexfish on Dec 13, 2022 13:16:33 GMT 1
Done Now tiding code base Screen Shot with canvas intact + picture Over are the Images in last few tests BR Alex Picky Attachments:
|
|
|
Post by alexfish on Dec 13, 2022 21:55:44 GMT 1
Lib Updated Post #1 Demo in archive ~ posted same BR Alex
|
|
|
Post by alexfish on Dec 15, 2022 7:09:41 GMT 1
Archive Update
ADDED Geo.bac
See Post #1
BR Alex
|
|
|
Post by alexfish on Dec 16, 2022 13:05:16 GMT 1
Fix Misc Bug Re Geo.bac Realease Geo1.0.bac POST #1
Full streetmap test
INCLUDE "includegtk.bac" INCLUDE Geo.bac '======================================================= HOME$ = GETENVIRON$("HOME") '======================================================= LOCAL res LOCAL DESTTILE$,TILE$ BB_MAPBOX.provider$ = "https://a.tile.openstreetmap.org" BB_MAPBOX.cache$ = "bacon-osm-maps"
GPS(54.48774,-0.61498,17)
win = WINDOW("test imager",400,300) RESIZABLE(win,TRUE) canvas = CANVAS(SCREENSIZE(0),SCREENSIZE(1)) ATTACH(win,canvas,0,25) ptry = -(512+256) ptrx = -256
FOR t = BB_MAPBOX.west TO BB_MAPBOX.east ptry=-512 FOR y = BB_MAPBOX.north TO BB_MAPBOX.south DESTTILE$ = HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png" TILE$ = BB_MAPBOX.provider$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png" IF FILEEXISTS(DESTTILE$) THEN
TILE$ =BB_MAPBOX.provider$ & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png" PRINT " URL$ " , TILE$
PICTURE(DESTTILE$,ptrx,ptry,256,256) ELSE MAKEDIR HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) res = CURL2FILE ( TILE$,DESTTILE$ IF FILEEXISTS(DESTTILE$) THEN PRINT "THIS " ,DESTTILE$ PICTURE(DESTTILE$,ptrx,ptry,256,256) END IF
END IF
INCR ptry,256 NEXT INCR ptrx,256 NEXT DISPLAY
BR Alex
|
|
|
Post by alexfish on Dec 16, 2022 13:50:54 GMT 1
Hi All A Maptiles function will be added to the lib Hence code will look like this INCLUDE "includegtk.bac" INCLUDE Geo.bac
'======================================================= HOME$ = GETENVIRON$("HOME") '=======================================================
BB_MAPBOX.provider$ = "https://a.tile.openstreetmap.org" BB_MAPBOX.cache$ = "bacon-osm-maps"
win = WINDOW("test imager",400,300) RESIZABLE(win,TRUE)
canvas = CANVAS(SCREENSIZE(0),SCREENSIZE(1)) ATTACH(win,canvas,0,25)
GPS(54.48774,-0.61498,17) MAPTILES(-246,-512)
DISPLAY Now Added the ScalerE & ScalerN Positions x&y to draw the gps Position + red outline of the tile See Picky's Had done a wrong , had x and y pos + 5 for the square Now = -5 -5 , see Second Picky of this app and the official LibOsm Beyond this bit for openstreetmaps, one can add seamap/marks or what ever design or features That will be for the user version : Re Center of GPS Hopeful update 'next week' Enjoy + BR Alex ADDED , from where I sit and a first, Over the Moon one can draw Cairo on HUG Default canvas
|
|
|
Post by alexfish on Dec 16, 2022 22:49:21 GMT 1
Hi All Geo1.0 updated
+
test functions now split so can use geo GPS / for data , TILES_GET to download TILES then MAPTILES:
MAPTILES TILES_GET Some bits to play with
TYPICAL Code + the two Functions / your gps position is blue circle inside the red circle Why Two , comment the Large circle , then find where you are ....
INCLUDE "includegtk.bac" INCLUDE Geo1.0.bac '======================================================= HOME$ = GETENVIRON$("HOME") FUNCTION TILES_GET()
LOCAL res LOCAL DESTTILE$,TILE$ LOCAL t, y FOR t = BB_MAPBOX.west TO BB_MAPBOX.east
FOR y = BB_MAPBOX.north TO BB_MAPBOX.south
DESTTILE$ = HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png" TILE$ =BB_MAPBOX.provider$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png"
IF FILEEXISTS(DESTTILE$) THEN
ELSE MAKEDIR HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" res = CURL2FILE ( TILE$,DESTTILE$) END IF NEXT NEXT RETURN TRUE END FUNCTION '======================================================= FUNCTION MAPTILES(int hug_xpos,int hug_ypos) LOCAL ptry LOCAL res,t,y LOCAL DESTTILE$,TILE$ LOCAL Cx,Cy FOR t = BB_MAPBOX.west TO BB_MAPBOX.east ptry = hug_ypos FOR y = BB_MAPBOX.north TO BB_MAPBOX.south
DESTTILE$ = HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png" TILE$ =BB_MAPBOX.provider$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" & STR$(y) & ".png"
IF FILEEXISTS(DESTTILE$) THEN
PICTURE(DESTTILE$,hug_xpos,ptry,256,256) SYNC() IF (BB_MAPBOX.hometilelat = y) AND (BB_MAPBOX.hometilelon = t) THEN Cx =hug_xpos+ BB_MAPBOX.Eposx Cy = ptry+BB_MAPBOX.Nposy END IF ELSE MAKEDIR HOME$ & "/" & BB_MAPBOX.cache$ & "/" & STR$(BB_MAPBOX.zoom) & "/" & STR$(t) & "/" res = CURL2FILE ( TILE$,DESTTILE$) END IF INCR ptry,256 NEXT INCR hug_xpos,256 NEXT CIRCLE("#FF0000",Cx-30,Cy-30,60,60,0) CIRCLE("#0000FF",Cx-5,Cy-5,10,10,0) CIRCLE("#0000FF",Cx-5,Cy-5,11,11,0) END SUB
'===================================================================== BB_MAPBOX.provider$ = "https://a.tile.openstreetmap.org" BB_MAPBOX.cache$ = "bacon-osm-maps" GPS(54.48774,-0.61498,19) PRINT "Please Wait getting Tiles" TILES_GET() PRINT "Loading Tiles"
win = WINDOW("test imager",400,300) RESIZABLE(win,TRUE) canvas = CANVAS(SCREENSIZE(0),SCREENSIZE(1)) ATTACH(win,canvas,0,25) MAPTILES(-128,-(512-138))
DISPLAY
|
|
|
Post by alexfish on Dec 17, 2022 16:30:36 GMT 1
Final Wrap on Geo : version 2.1 expected next week Here have the GPS location + the Coords Also of note: scroll map using UP,DOWN,LEFT,RIGHT Arrow keys ADDED have a Max canvas at canvas = CANVAS(4352,4352) and moves in the blink of an eye,+ gives great scope IE: field of view without Redraw of canvas unlike some other Nav/geo apps , also runs on pi at 20.4MBPicky of the bits ALL is HUG + Geo BR Alex Attachments:
|
|
|
Post by alexfish on Dec 23, 2022 19:41:52 GMT 1
MM!
seamap/mark
had some fun again with this site again. so not making as part of the lib or geo. Final update now next week : need to clean up seammap code + a bit of testing
I am entering this as a separate item, in this form hence up to the user to implement, also a in there is a suggested max load 200 maps as a max at one time, possible try 100 at first runs, or prepare to have a cuppa and 40 winks.
INCLUDE "includegtk.bac" '======================================================= HOME$ = GETENVIRON$("HOME") '=======================================================
' Map2Seamap using equal tile size images =================================== SUB Map2Seamap(source$,destination$)
LOCAL im1,im2,w,h im1 = gdk_pixbuf_new_from_file(destination$ , NULL) im2 = gdk_pixbuf_new_from_file(source$ , NULL)
w = gdk_pixbuf_get_width(im2) h = gdk_pixbuf_get_height(im2) IF w > 0 THEN
gdk_pixbuf_composite(im2,im1, 0, 0, w, h, 0,0, 1,1, 0,255) gdk_pixbuf_save (im1,destination$, "png", 0, NULL, NULL, NULL)
END IF g_object_unref(im1) g_object_unref(im2) END SUB '============================================================================= 'Advise : try batch of 200:http://tiles.openseamap.org/seamark is slow: avr 1 second: OSMDIR$= HOME$ & "/" & "bacon-osm-maps/"
myfile$ = WALK$(OSMDIR$, 1, ".+", TRUE, NL$) FOR item$ IN myfile$ STEP NL$ IF INSTR(item$,".png") AND NOT(INSTR(item$,"sea")) THEN RV$ = REVERSE$(item$) DR$ = REVERSE$(MID$(RV$,INSTR(RV$,"/"))) SEA$ = REPLACE$(DR$,"bacon-osm-maps","http://t1.tiles.openseamap.org/seamark") 'SEA$ = REPLACE$(DR$,"bacon-osm-maps","http://tiles.openseamap.org/seamark") SEA$ = MID$(SEA$,INSTR(SEA$,"http")) PNG$ = REVERSE$(MID$(RV$,1,INSTR(RV$,"/"))) PNGS$ = REPLACE$(PNG$,"/","sea") PNG$= REPLACE$(PNG$,"/","") SEA$ = SEA$ & PNG$ DR$ = DR$ & PNGS$ IF ( NOT(FILEEXISTS (DR$ ))) THEN PRINT "...................." PRINT DR$ , ":" ,item$ OPEN DR$ FOR WRITING AS download easyhandle = curl_easy_init() curl_global_init(CURL_GLOBAL_ALL) 'can test if needed 'curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, "bacon-osm-map") 'curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYHOST, 2L) curl_easy_setopt(easyhandle, CURLOPT_URL,SEA$) curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, NULL) curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, 1L) curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, download) success = curl_easy_perform(easyhandle) PRINT success curl_easy_cleanup(easyhandle) ' Close filehandle CLOSE FILE download IF success THEN PRINT "convert" Map2Seamap(DR$,item$) END IF END IF END IF NEXT
BR Alex
|
|
|
Post by alexfish on Dec 24, 2022 14:15:44 GMT 1
Can Finally show the difference between using standard hug Canvas to a hug imager canvas Till Next week screen shot 2 has win2 = DESIGNER(400,400,800,800) screen shot 3 Final test with maps possible self explanatory if have small screens IE smaller than 1920x1080 BR Alex
|
|
|
Post by alexfish on Dec 25, 2022 2:22:36 GMT 1
Updated lib Post#1 map demo included Now looking at tutorial Have Fun + BR Alex
|
|
|
Post by alexfish on Dec 25, 2022 8:07:43 GMT 1
before the tutorial starts This is nearing completion Hence will have Two Ready to Use Apps Using the DESIGNER widget Example code INCLUDE "includegtk.bac" INCLUDE "hugkeywords.bac" DECLARE WidgetSel
win = WINDOW("Gui Designer",600,400)
RESIZABLE(win,TRUE)
ico1 =G_ICON("media-seek-backward",4,22) ATTACH(win,ico1,3,3) CALLBACK(ico1,MOVE_IT) TOOLTIP(ico1,"Move Widget")
ico2 = G_ICON("media-seek-forward",4,22) ATTACH(win,ico2,30,3) CALLBACK(ico2,MOVIT_DOWN) TOOLTIP(ico2,"Move Widget DOWN")
ent = ENTRY("EDIT",200,25) ATTACH(win,ent,80,3) CALLBACK (ent,GetResult)
win2 = DESIGNER(490,600,900,400) ATTACH(win,win2,3,30)
ed = EDIT(450,600) ATTACH(win,ed,505,30)
DISPLAY
BR Alex Attachments:
|
|
|
Post by alexfish on Dec 27, 2022 0:23:52 GMT 1
GUI DESIGNER : Complete : POST#1
Very basic + has a terminal so can compile the code , the basic means,most widgets are represented by a BUTTON
so plenty of room for Improvements ... It be hot off the press. but does work , Docs = NONE but the icos have tool-tips
Window size set up Need a bit of Polish
Have Fun + BR Alex
|
|
|
Post by alexfish on Dec 27, 2022 14:32:49 GMT 1
Hi All Major update to Gui designer to GuiDesigner2 see POST#1 Picky Attachments:
|
|
|
Post by rikky on Dec 27, 2022 18:11:49 GMT 1
I get an
includegtk.bac:529:62: warning: implicit declaration of function ‘INDEX$’; did you mean ‘INTL$’? [-Wimplicit-function-declaration] compiling seamaps.bac
|
|
|
Post by alexfish on Dec 27, 2022 19:11:19 GMT 1
Hi Rik
I have done a Download of latest Archives esp note Imager4 was updated
the examples in Imager 4 compiles and Runs, so does the example at post #1
Can Post whole SUB code , line indicated 'includegtk.bac:529:62:'
Before Trying any updates
BR Alex
|
|