April 29, 2024, 10:36:25 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Changing brightness of a background image???

Started by Egil, March 11, 2015, 05:42:05 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

LarryMc

But I don't need a 'month' file.
I need a file every minute if you want new data displayed on the screen every minute.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

You are probably right, it is easier to read  from acomplete file instead of checking for, and copying, new lines to that date based file.
Please call that file "newdata.txt", so shall I make another routine that will refresh it every time the file based on dates are updated. We'll then need some kind of flag to signal that the file has been used for updating the map, to bes sure I write only unread data into it.

OK?
Support Amateur Radio  -  Have a ham  for dinner!

Egil

Larry,

If you wonder why I have to write new data to two files, it's because I still have to use som other utility programs for statistics e.t.c., that  all are hard coded yo read the logfiles produced by PC-HFDL.
That program makes new logfiles with names that follow the UTC days.

Egil
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

ok, sounds like a plan
we'll figure out the "trigger" later
now I can go ahead with my coding
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Larry,

Is it ok for you that i write each line of the "newdata.txt file so they only hold lines containing:
timestamp (hh:mm:ss) in UTC, flight ID and position ( in the format found in the logs you have on hand, after lines prededed with [HFNPDU PERFORMANCE]

Like this:
14:40:44 UTC Flight ID = ABW715  LAT 54 30 6  N  LON 19 57 40  E

Then I'll make  routines so "your" file only holds planes that we receive traffic from regularly, and delete those that for some reason has "disappeared". Since the planes send position reports approximately every 10 minutes, I will delete them after 15 minutes if no traffic is heard from a plane during that time. Just to give some slack for propagation changes, or for a plane changing frequenscy or Ground Station between two reprot  transmissions.

Plan to use a string array containing timestamps and and plane ID's to hold, and update, this information.

The above line contains flightnumber as the ID, but if no flightnumber is received we can use Callsigns (tailnumbers) or ICAO-mumbers (6 byte hexadecimal numbers) for the ID.

Should make things easieir for your code, or what?




Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

This format is fine:

Quote[HFNPDU FREQUENCY DATA]
14:40:44 UTC Flight ID = ABW715  LAT 54 30 6  N  LON 19 57 40  E

Are you going to add the ground station active freq info also like this:
QuoteSHANNON - IRELAND UTC LOCKED Active freqs (Hz)    10081 KHz     8942 KHz
AGANA - GUAM UTC LOCKED Active freqs (Hz)    21928 KHz    11306 KHz     8927 KHz
CANARIAS - SPAIN  UTC LOCKED Active freqs (Hz)    21955 KHz    13303 KHz
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

April 20, 2015, 12:24:49 PM #131 Last Edit: April 20, 2015, 12:29:51 PM by Egil
I plan to make the active planes file with each line like this:
14:40:44 UTC Flight ID = ABW715  LAT 54 30 6  N  LON 19 57 40  E

The lines will be sorted using the time stamps, so the top of the list is the oldest, and the last line allways the newest report.
That will make it easy to delete the outdated reports.

Will also update the Groundstation list int the mentioned format. Just kHz, and not in Hz as given in the broadcasts.


PS:
My neighbour have been out diving, and he caught a lot of Cod and Pollock. He left a couple in my kitchen zink, so now I'm going to cook some Cod. Caught less than an hour ago! After eating that, I'll be half asleep.... ;D ;D ;D
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

ok, I'm confused again.
1st let's talk ground station
when you say this
QuoteWill also update the Groundstation list int the mentioned format. Just kHz, and not in Hz as given in the broadcasts.
are you talking about the one that I used to display the groundstation names on the map and have finished the code for or the active freq list that really doesn't exist yet that would take care of this
QuoteSHANNON - IRELAND UTC LOCKED Active freqs (Hz)    10081 KHz     8942 KHz
AGANA - GUAM UTC LOCKED Active freqs (Hz)    21928 KHz    11306 KHz     8927 KHz
CANARIAS - SPAIN  UTC LOCKED Active freqs (Hz)    21955 KHz    13303 KHz

2nd the airplane list.
before we were talking about giving me a file with a minutes worth of data that I could use the new data and compare it to previous data (that I would store) for a given plane to figure out the heading.
Now you're talking about time stamping and 10 minutes and 15 minutes.

I guess I'm just super hard headed today and I'm not seeing the big picture.
Can you try to explain it to me again.  I can only plot a point period. timestamp has no bearing on the actual plotting.
Wait :o
Is it that you are thinking of me working backwards through your entries newest to oldest to get my 2 points for calculating  heading? And that is the only reason you are placing the time stamps there.

Am I close?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

I think I'm the the super hard headed today, Larry.....


-1-
The  ground station list will be in exactly the format you have in your post:
Quote
SHANNON - IRELAND UTC LOCKED Active freqs (Hz)    10081 KHz     8942 KHz
AGANA - GUAM UTC LOCKED Active freqs (Hz)    21928 KHz    11306 KHz     8927 KHz
CANARIAS - SPAIN  UTC LOCKED Active freqs (Hz)    21955 KHz    13303 KHz

I'll supply an updated list whenever there are any changes. So we'll need a flag to signal that update has been taking place.

-2-
I'm working on a routine for making a file contnaining only position reports that are newer than 15 minutes, this file will be updated every five seconds, and will be sorted, so it contains only  valid reports.
If rthe reports are oldlere than 15 minutes, this means that the plane is "out of range" or has landed. This is something we can not control. And I meant this file "newdata.txt" to be used for updating the plots once a minute. Planes not contained in this list must be deleted from the map.

Hope we are still talking the same language. Now I'll have a late dinner, and turn the pc off.
Tomorrow, we'll drive to Molde for a checkup of my arm. So will be away most of the day.
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Egil

Just had what I call a "brain fart' (an idea)
you don't have to worry about sorting the airplane position records at all
you don't even have to glean the data from the way it is currently written to your monthly files

I can very quickly read the file march28.txt file (which was almost 500K) and store it in a hidden sorting listview
I just have to figure out how to handle midnite rollover but that shouldn't be a problem.
But that will let me handle how many minutes/hours to store entries for path history calculations

Same thing with the active freq from ground stations - I can pull that out also so you don't have to do anything with that either.

So all I need you to do is just provide a file every minute (or whatever update period you want) with info that looks exactly like the march28.txt/april18.txt files you gave me.  And my code can take care of it from there.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Larry:

Sounds fine to me. And if you take a look at the LogFix code (posted in another thread some days ago). I haven't that code on this laptop. But in LogFix  is a sub generating the correct lognames, and the date rollover is taken care of in the main loop. In fact the logfiles you have copies of have their lognames generated by that routines.
I sent you an email yesterday(?) containing an unregistered copy of PC-HFDL, which also have several logfiles from testing done here with "virtual audio cables". That version of PC-HFDL is fully working, but as long as it is not licenced, it works only 15 minutes and stop. Then you have to start it again. But in 15 minutes you have plenty of time to se how it woorks, and there is a help file in there explaining how it works. There is one error in that file though, it says that there is no log-off procedure in the system. But log-off procedures exist, and are used. As you can see in the log files.

Arrived to Bergen very delayed, so came too late to get anything done today. I do not know how much I am able to check the webmail, when I'm here, but I'll try to do it every night at this time.


Take care.

Egil
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Quote from: Egil on April 21, 2015, 01:56:57 PM
...look at the LogFix code....date rollover is taken care....
Not really as I was concerned with. I was referring to instances I saw in the txt file itself where the individual timestamps for 3 consectutive plane entries looked like this:

14:40:44 UTC Flight ID = ABW715  ...
10:24:17 UTC Flight ID = STU1234  ...
14:41:45 UTC Flight ID = ABW715 ...

Seems like you said something about the Russians not using UTC time in their transmissions or something like that.
Do we just assume it is current if it is in the transfer file you send me during this minute update?

The reason I say that. In the logfile folders that you sent me with PC-HFDL there were March09.txt-March30.txt files.
In those files there were blocks of data separated by lines that looked like these:

Quote----------------------------------------------------------[30/03/2015 12:11]

----------------------------------------------------------[30/03/2015 12:12]
but there are multiple events happening during those minute intervals that occur outside that time period.
Are the events you are going to put in the update file for me going to be just the events that occur in the last minute?
If not, what do you see it being?


Quote from: Egil on April 21, 2015, 01:56:57 PM
...sent you ...unregistered copy of PC-HFDL...fully working... see how it works...
All I can see is some vertical lines scrolling across the screen.  Remember, I have no reciever. ;)

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Just assume they all use current UTC time when sending the reports, I have been  ccheckin this earlier, and it seems to be correct.


The datablocks ending with the mentioned lines and a date/timestamp occurs when messages lasting for more than one timeslot are sent.
The update file will allways contain data that occured the last minute.

The vertical lines are showing the time slots. They are all numbered, and slot number 0, is the GroundStation Squitterbroadcast.


Egil


PS.
Having  trouble with the internet connection from this location, and have to use a proxy server  to be able to connect to IW. Don't understand why...
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

I've got the basic code written to read the one-minute updates and display the plane locations on the screen.
(I haven't finished the direction code yet)

The attached shows the whole earth display, and the two levels of zoom  without the direction pointers.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

The attached shows the whole earth display, and the two levels of zoom  with the direction pointers(randomly generated at this time).

As you can see it tends to look very cluttered in places .

And this will present problems if you are wanting to click on a single plane and see its call sign and heading.

The only solution would be is to have a popup window that would list all the plane in the general area.
I'm open to suggestions.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

And this image has the pointers shown based upon the calculation from previous and current location.

The ones with no pointer means I only have one data point for that plane
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Update
Egil has been out of town taking care of personal business the last few days.

In the mean time( after the previous posting of the pictures) I have been working on the code to allow selecting a ground station or an airplane.

I've got the code in to allow the user to press the "g" key to select a ground station and a "p" to select a plane.
Since planes can be very close together I added code to fine tune the cursor position with the arrow keys.

Using the ground station routine as my pattern(since I have a fixed set of known coordinates to compare against) I'm now working on the code to convert the cursor location to the lat and long so I can use it for comparison in my search routine.
I haven't got it exactly the way I want it yet.
I need 3 versions of it; one for the 3 different versions of the map were are using.

Then I can use the same calculations for the planes.  It's beginning to be pretty neat.

I know Egil mentioned using all this basic code and adapting it to other sorts of applications.
I don't know if he mentioned it or not but I was thinking it might be pretty neat for ham operators like him and Graham.
When they contact someone they could have a database that they put their call-sign in and location and have it plot a point on the map.  And if you had a freq monitoring setup like Egil it could tell you when people come on the air with a symbol on the map.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Quote from: LarryMc on April 24, 2015, 10:52:22 PMI know Egil mentioned using all this basic code and adapting it to other sorts of applications.
I don't know if he mentioned it or not but I was thinking it might be pretty neat for ham operators like him and Graham.
When they contact someone they could have a database that they put their call-sign in and location and have it plot a point on the map.  And if you had a freq monitoring setup like Egil it could tell you when people come on the air with a symbol on the map.

Thats right, and since many of the forum members are radio amateurs, I hope they'll use this code to come up with their own ideas, and share them with us.


Larry:

The ceremony will take place wednesday afternoon, and I hope to be back home by thursday night.

Early this morning I decided  to make some plotting routines using standard IWB code, just to be able to compare.
The plotted "groundstations" are just  given "random" positions by me...
Plotting 200 planes once a second, using random positions and courses, is faster than I thought.
I use a fast laptop (3.3GHz), so do not know how the code acts on slower computers.

For this example, I have reduced brightness of the original map with 60%, using a photo editor.


How do you like the shapes and colors?


Egil


PS:
Have to use a proxy to get out on the web from this hotel, and they would not allow attachments, so here is the code, and you have to reduce brightness of the map yourself, otherwise the shapes will not whow very good.


AutoDefine "Off"

def win:window 
def i,run,mapleft,maptop,pw,ph,wwidth,wheight:int 
FILE handle

wwidth=1084
wheight=580

' Create a window .. 
OpenWindow win,0,0,wwidth,wheight,@minbox,0,"IWB Skeleton Window",&messages 

GETCLIENTSIZE win,mapleft,maptop,pw,ph ' finding available area for drawing

handle = LOADIMAGE ("world3.jpg", @IMGSCALABLE)

' show working image on screen ..
SHOWIMAGE win,handle,@IMGSCALABLE,0,0,pw,ph 

' frontpen win,rgb(255,255,0)
setfont win,"Tahoma",7,400
drawmode win,@TRANSPARENT

PlotGndStn(win,150,150,"GROUND",140,198,254)
PlotGndStn(win,350,73,"GROUND",140,198,254)
PlotGndStn(win,480,79,"GROUND",140,198,254)
PlotGndStn(win,150,500,"GROUND",140,198,254)
PlotGndStn(win,570,250,"GROUND",140,198,254)
PlotGndStn(win,850,450,"GROUND",140,198,254)

for i = 1 to 20 ' Number of planes to plot
PlotPlanes(win,rand(10,pw-10),rand(10,ph-10),0,255,255,rand(-100,35),15,172,172,128,"UAL59")
next i

starttimer win,5000


run = 1 
WAITUNTIL run = 0 
stoptimer win
CLOSEWINDOW win
END 

SUB messages(),int
SELECT @class

case @idtimer

SHOWIMAGE win,handle,@IMGSCALABLE,0,0,pw,ph 
PlotGndStn(win,150,150,"GROUND",140,198,254)
PlotGndStn(win,350,73,"GROUND",140,198,254)
PlotGndStn(win,480,79,"GROUND",140,198,254)
PlotGndStn(win,150,500,"GROUND",140,198,254)
PlotGndStn(win,570,250,"GROUND",140,198,254)
PlotGndStn(win,850,450,"GROUND",140,198,254)


'whandle = gethdc(win)
for i = 1 to 200 ' Number of planes to plot
PlotPlanes(win,rand(10,pw-10),rand(10,ph-10),0,255,255,rand(-100,35),15,172,172,128,"SIA59")

next i
'RELEASEHDC(win,whandle)


CASE @idcreate 
centerwindow win   

CASE @idclosewindow
run = 0 
ENDSELECT 
RETURN  0
EndSub

'
'------------------------------------------------------------------------------------------------------
' USE:
' x,y      = center of shape
' sr,sg,sb = color of shape (RGB)
' course  = planes direction of travel in 10 degrees intervalls. (calculated_course/10)
' Pass value -1 if the course is not known.
' (course found by calculating direction from last to present position)
' headline = length of line indicating planes course
' lr,lg,lb = color of headline (RGB)
' flight = flight number as string (if known else "")
'------------------------------------------------------------------------------------------------------
sub PlotPlanes(window wnd,int x,int y,int sr,int sg,int sb,int course,int headline,_
int lr, int lg,int lb,string flight)

Move wnd,x,y

if course > -1 '  Which means that we have calculated the course
frontpen wnd,rgb(lr,lg,lb)
LINETO wnd,x+headline * cosd(course*10),y+headline * sind(course*10)
endif

frontpen wnd,rgb(sr,sg,sb)
SETLINESTYLE(wnd,@LSSOLID,1)

line(wnd,x, y-3, x-3, y, rgb(sr,sg,sb))
line(wnd,x-3, y, x, y+3, rgb(sr,sg,sb))
line(wnd,x, y+3, x+3, y, rgb(sr,sg,sb))
line(wnd,x+3, y, x, y-3, rgb(sr,sg,sb))

line(wnd,x, y-2, x-2, y, rgb(sr,sg,sb))
line(wnd,x-2, y, x, y+2, rgb(sr,sg,sb))
line(wnd,x, y+2, x+2, y, rgb(sr,sg,sb))
line(wnd,x+2, y, x, y-2, rgb(sr,sg,sb))

move wnd,x+5,y-5
frontpen wnd,rgb(255,255,94)
print win,flight

RETURN
ENDSUB
'------------------------------------------------------------------------------------------------------

'
'------------------------------------------------------------------------------------------------------
' USE:
' x,y   = position
' stnID = Name of Ground Station
' R,G,B = color
'------------------------------------------------------------------------------------------------------
sub PlotGndStn(window wnd,int x,int y,string stnID,int R,int G,int B)
DEF tWidth, tHeight:INT

GETTEXTSIZE wnd, stnID, tWidth, tHeight
'setfont win,"Tahoma",7,600
'drawmode win,@TRANSPARENT
frontpen wnd,rgb(R,G,B)
SETLINESTYLE(wnd,@LSSOLID,1)
line(wnd,x, y-2, x-4, y+2, rgb(R,G,B))
line(wnd,x-4, y+2, x+4, y+2, rgb(R,G,B))
line(wnd,x+4, y+2, x, y-2, rgb(R,G,B))

move wnd,x-(tWidth/2),y-15
print win,stnID
return
endsub
'------------------------------------------------------------------------------------------------------

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

The symbols and colors look fine to me.
If you want to use them I will go ahead and switch in my code.
Let me know.
I do think we need to have a setup option that allows the User to pick the colors they want for the various symbols and text.

As for using IWB code to draw the symbols as opposed to the GDI+  commands.
It appears either will do the job.
If you want to use IWB code I can switch it out pretty fast.
Let me know.
Remember this is your program and you will be maintaining the code.

What you can't get rid of is the DeVil library or you won't be able to adjust the map contrast and scaling the images.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

QuoteThe symbols and colors look fine to me.
If you want to use them I will go ahead and switch in my code.
Let me know.

Yes please!



QuoteI do think we need to have a setup option that allows the User to pick the colors they want for the various symbols and text.

Very good idea, I'll look into it when I get back home.


QuoteAs for using IWB code to draw the symbols as opposed to the GDI+  commands.
It appears either will do the job.
If you want to use IWB code I can switch it out pretty fast.
Let me know.

Let's keep it the way it is now. I did that code just to see how effective such simple code would be.
Maybe I'll offer the idea to the very young gentlemen that use the free version of CB for a school project on programming. They are going to plot ships passing the island (AIS). (Seems like their largest problem is that their english skills are not good enough to fully understand the user manual)

Forgot to bring  with me a copy of the code I was working on at home, but then there has not been much time left for hobby activities.
But got a phonecall last night from a friend in Oslo, also doing HFDL decoding. He chose the "Verbose Logging" alternative in PC-HFDL program, and logged the activities when he was sleeping. He called back this morning and said that all the planes not using UTC when reporting their positions, preceeded by "[HFNPDU PERRFORMANCE]", Verbose listing showed that they all transmitted the code for "Not locked to UTC".
To us this means that we can use our own timestamps to all decoded information used in the program. And that was good news, as I have never thought of checking this myself. So when I get home, I'll make a Verbose logging myself, to check if there are other "hidden" information in there we can use in a future update.


Regards,
Egil.
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

This screenshot shows your new symbols in my code.
I'm also using your new world.jpg(lighter version) as the basic background.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

this shows your new plane symbols in the 3 different map versions with text to side
data is from a real monthly .txt file
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

this shows your new plane symbols in the 3 different map versions without text to side
data is from a real monthly .txt file

This is with 160+ planes showing but you can see we still see on the greatest zoom we still have  overlapping clusters.

I need to look into zooming a little more.
Mainly to see what I can do without having to restart the program.
But also to see what the map looks like going in to x4. to see what you think.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

I looked into greater magnification.  Scrolling is super, super slow and is not practical

I did a research looking at google maps.
google.maps generates an image on the fly for embedding in a web page via a url.
I looked into creating a hidden window with an ATTACHEDBROWSER.
Was going to see if I could find a way to save the generated image so I could display it and paint our planes on it.
Since the html page has no actual image name on it the only way to save the image is to right click and select "save-as" so that was a dead end.

Then I tried the idea of a transparent window over the html window.  But as you make the transparent window more transparent anything painted on it gets more transparent(planes, etc.). Also, there's the issue of scrolling; or the lack thereof.
So another dead end.

So, right now, I think the best I can do is like I originally suggested.  When you click on a plane a window will open and list all the planes in the vicinity, their call-signs, locations, and headings(if known).
As always, I'm open to suggestions.

Deduce that the only way to use the google maps is to have mapview display everything in an html page.  The symbols(of some sort) can be sent to google as part of the command for them to generate the map.  From what I can tell, with the number of URL commands we would be generating (1 a minute) plus the size of the commands with all the symbols we would be in the category of paying customers as opposed to free users of their maps.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Hi Larry,

I have given up on using Google maps. ended up with the same results as you. And that's the main reason for using the map I sent you.
Then for the overlapping planes, this happens usually when planes pass each others in different directions, and when they are waiting to get landing clearances in the vicinity of large  airports. Therefore the overlapping usually do not last for very long, and is not really a problem.

By the way, the pictures are looking great now!


Egil
Support Amateur Radio  -  Have a ham  for dinner!