IonicWind Software

IWBasic => General Questions => Topic started by: Egil on March 11, 2015, 05:42:05 AM

Title: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 05:42:05 AM
I have been trying  for a while to change the brightness of an image I use for client area background, but so far I have achieved... nothing.
Does anyone know how to do this?

I have a shareware doing this, there they call it "Change Transparency", but I suspect what they do is adjusting the client area brightness.
Title: Re: Changing brightness of a background image???
Post by: Brian on March 11, 2015, 05:53:27 AM
Egil,

I use XnView for manipulating / viewing all my pictures. It has the facility to change
the brightness of an image, which is real easy to use

Brian
Title: Re: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 06:13:28 AM
Thanks Brian,
I do the same myself, using PhotoFiltre.
I was not clear enough in my question, I want to do it inside my own program. So the contrast between background and what is drawn in the foreground can be adjusted to the personal taste of the user.


Title: Re: Changing brightness of a background image???
Post by: Andy on March 11, 2015, 06:39:14 AM
Hi Egil,

Could you try the background image as one image on it's own, and the foreground image as another.

Load the images, background first, then the foreground on top, use showimage to display them.

After that, use the SetControlColor command for the inital colour.

You could add a scrollbar which would send a message to Redraw either the foreground or background
depending on the value / position of the scrollbar?

Could that work?

Have a look at the ColorControls.iwb example - maybe that will give you a pointer?
or of course I could be completely wrong!

Andy.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 11, 2015, 08:46:01 AM
Egil,
Can you post me a screen shot of what you are wanting it to look like.
(Your actual program  with the image(s) would be better if that is possible)
If I'm understanding you correctly I've got an idea that might work for you.

Scheme didn't work.
I was trying to use a child window covering the client area and fading it in and ou but it also fades the client area in and out - so that's a no go.

You might have to look into something like the GDI+ library and modify your background during the WM_PAINT cycle.
Title: Re: Changing brightness of a background image???
Post by: Brian on March 11, 2015, 10:36:02 AM
Fletchie's control pack has a WinAlpha command, which, according to his blurb:

Blends a window to the given Alpha level, and optionally sets a transparent RGB value for the window

Don't know what kind of window, though...

Brian
Title: Re: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 10:51:07 AM
Thanks for trying Larry,

what I would like to do, is load an image into the client area and manipulate it to appear darker than the original, whithout changing the original image.
I will then print characters on top of this, using different colors. If you study the last image I uploaded in this thread: http://www.ionicwind.com/forums/index.php?topic=5609.msg41378#msg41378,  you'll se what I am going to use it for. In the posted example I use a shareware called PlanePLotter. One of the Map Options is called "Transparency". There I can make the image darker or lighter to make the contrast better between the text and the image. PlanePlotter is an excellent piece of work, and I have used it for around 15 years. But I need additional functionality, and do not need most of the the other functions, so I have started doing my own plotter program. This is something I have been working on for short periods at the time over the last couple of years, but haven't really needed it till now.

Just finished converting the CB code to IWB, and attach an archived version of what I have so far.  Still have to make code for reading several instances of the PC-HFDL decoder, and input the paths to the logfiles. I also plan to make the program able to send and receive data via UDP, to be able to easily exchange data with other decoding "freaks". (like me...  :D)

I can use an image editing program to manipulate the images before, loading them into my program, but if I manage to build that functionality into the program, it will be easier in the future to download special images from any map server.

Brian:
Sound like you have found the right way to do it. Why do I never remember that control pack?
I'll look into it right away.

Regards,
Egil


Title: Re: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 11:20:12 AM
The WinAlpha command changes transparency level of the whole window. But this must still be the way to go. I just have to find a way to limit the transparency to only include the client area.


Regards.
Egil
Title: Re: Changing brightness of a background image???
Post by: Brian on March 11, 2015, 12:18:19 PM
Egil,

Just downloaded your program, and straight away I noticed you could have just used:
GETBITMAPSIZE(handle,mapwidth,mapheight)
instead of the calculations you are doing

Brian
Title: Re: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 01:26:30 PM
I use it for the calculation of the scaling factor. Makes life easier when the picture is drawn full size after doubleclicking.
Later on I wil use scalefactors for both height and width, so "regular" resizing of the window can be used. I block this now just to get the logic right.

Regards,
Egil
Title: Re: Changing brightness of a background image???
Post by: Brian on March 11, 2015, 01:45:24 PM
Rearrange these words: In. Mouth. Foot.

I realised that after I sent the message - sorry!

Brian
Title: Re: Changing brightness of a background image???
Post by: Egil on March 11, 2015, 01:51:56 PM
No need to be sorry. I do it all the time...
But I blaim the dog.

Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 11, 2015, 07:38:50 PM
I'm looking into another idea Egil.  don't give up on me quite yet.

As a last resort you could create a dozen different versions of your image in an external editor and let your user pick which image they wanted to use.  If you make a project out of it then all the images are inside the exe and are never seen by the user as separate image files.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 11, 2015, 07:41:42 PM
Another possibility is to use 2d graphics and use your globe image as the background and all your planes as sprites.  Note sure about drawing your lines and such though..
Title: Re: Changing brightness of a background image???
Post by: Egil on March 12, 2015, 01:35:54 AM
Using an external image editor is one solution.
But since what I'm thinking of can be done with such an editor, I reckon it is possible to such do the same functionality using iwb.

I appreciate your efforts Larry, but please don't overdo it. It was never my intention to give anyone extra work.
But then, isn't challenges like this what our great hobby is all about? I just love it!


Egil


Title: Re: Changing brightness of a background image???
Post by: GWS on March 12, 2015, 10:24:39 AM
Hi,

This is very crude ..  ::) and I'm not very used to EBasic/IWB ..  This is currently in EBasic 'cos that's what I've got loaded.

It shows an image displayed as a sprite on a DX screen.

This is overlaid with an almost black sprite that can be alpha-blended with the background image.

Setting the dark sprite's alpha to 255 gives fully transparent, and the background image is bright.

Setting the alpha to a low value (say 20) blends the dark sprite fully to give a pretty near black image.

Use the Up and Down arrows to change the lightness (Up arrow) and darkness (Down Arow).

Don't know if this could be a starting point of what you need Egil ..  :)


' Test of darkening an image using an alpha blended black sprite
' Uses Direct X
'

DEF pBuffer,background as POINTER
def wW,wH,bval:int

wW = 1024
wH = 768

CREATESCREEN(wW,wH,32)

'Set the drawing mode for text
DRAWMODE BackBuffer,@TRANSPARENT
FRONTPEN BackBuffer,RGB(255,255,0)

background = LOADSPRITE(GETSTARTPATH + "a1.jpg")
spritedrawmode(background,@SCALED)
SpriteScaleFactor background,2.0

' load the dark sprite ..
dark = LOADSPRITE(GETSTARTPATH + "dark.jpg")

SpriteDrawMode dark, @alpha
bval = 255
SpriteAlpha dark, bval  :' set to max brightness initially

DO

if getkeystate(0x26) :' up arrow pressed - so increase brightness
bval = bval + 20
if bval > 255 then bval =255
endif

if getkeystate(0x28) :' down arrow pressed - so decrease brightness
bval = bval - 20
if bval < 20 then bval = 20  :' not lower than 20
endif

FILLSCREEN 0
WRITETEXT 0,0,"Press ESC to close"
WRITETEXT 300,0,"Use Up and Down Arrows to vary Darkness"

' Draw sprites
  DRAWSPRITEXY background,350,250

SpriteAlpha dark, bval
DRAWSPRITEXY dark,0,0

FLIP

UNTIL KEYDOWN(0x01)


FREESPRITE background
FREESPRITE dark

CLOSESCREEN
END


Using Direct X windows is a bit tricky ..

Best wishes, :)

Graham


Title: Re: Changing brightness of a background image???
Post by: Egil on March 12, 2015, 12:16:11 PM
Quote from: GWS on March 12, 2015, 10:24:39 AM
... Don't know if this could be a starting point of what you need Egil ..  :)

It is, and a very good one too, Thanks Graham!
I did not know what this method was called in english, but AlphaBlend was the word I needed. Have found a lot of text on MSDN on the subject, and a couple of useful API's. I will study it all carefully to see if I can find a way to use the information in my program.


Regards,
Egil


P.S.
Right now I am babysitting a little lady, who never stops to be impressed when I get messages from Winnie....  ;D


Title: Re: Changing brightness of a background image???
Post by: fasecero on March 12, 2015, 10:42:15 PM
I have checked some old code from myself and found the ImageFilter(...) function detailed below. Works only for bmp's with 24 or 32 bits and, in no way, is optimized for larger images.

The function works directly on the bitmap, so it's a good idea not to pass the original bitmap, but a copy instead. Calling the function more than one time with the same bitmap will lose color information.

The delta argument adds hue, saturation or brightness to positive values and removes these properties for negative values.

For example to add some brightess: ImageFilter(bitmap, 3, 0.10)



' property: 1 hue, 2 saturation, 3 value
' delta: (-359 to 359) for hue, (-1 to 1) for saturation or value
SUB ImageFilter(uint hbitmap, INT property, float delta)
BITMAP bmp
pointer buffer
float r, g, b
float h, s, v

' get the bitmap info
_GetObject(hbitmap, LEN(bmp), &bmp)

' get the pixels
int datalen = bmp.bmWidthBytes * bmp.bmHeight
buffer=AllocHeap(datalen)
_GetBitmapBits(hbitmap, datalen, buffer)

' do something with the pixels
pointer pixel = buffer
int pixelcount = bmp.bmWidth * bmp.bmHeight

float fWidth = 1.0/bmp.bmWidth

if (bmp.bmBitsPixel = 32)
settype pixel, RGBQUAD
int x = 0, i = 0

FOR i=1 TO pixelcount

b = *pixel.rgbBlue / 255.0
g = *pixel.rgbGreen / 255.0
r = *pixel.rgbRed / 255.0

RGBtoHSV(r, g, b, h, s, v)

SELECT property
CASE 1 : ModifyHueValue(h, delta)
CASE 2 : ModifyPixelValue(s, delta)
CASE 3 : ModifyPixelValue(v, delta)
ENDSELECT

HSVtoRGB(r, g, b, h, s, v)

*pixel.rgbBlue  = b *255
*pixel.rgbGreen = g *255
*pixel.rgbRed   = r *255

pixel += len(RGBQUAD)
' this is to keep track for bright
x++
if (x = bmp.bmWidth)
x = 0
endif
NEXT i

elseif (bmp.bmBitsPixel = 24)

settype pixel, RGBTRIPLE
x = 0

FOR i=1 TO pixelcount

b = *pixel.rgbtBlue / 255.0
g = *pixel.rgbtGreen / 255.0
r = *pixel.rgbtRed / 255.0

RGBtoHSV(r, g, b, h, s, v)

SELECT property
CASE 1 : ModifyHueValue(h, delta)
CASE 2 : ModifyPixelValue(s, delta)
CASE 3 : ModifyPixelValue(v, delta)
ENDSELECT

HSVtoRGB(r, g, b, h, s, v)

*pixel.rgbtBlue  = b *255
*pixel.rgbtGreen = g *255
*pixel.rgbtRed   = r *255

pixel += len(RGBTRIPLE)
x++
if (x = bmp.bmWidth)
x = 0
' next line aligned to WORD
pixel += (pixel & 1)
endif
NEXT i

else
endif
' set the bitmap info
_SetBitmapBits(hbitmap, datalen, buffer)
FreeHeap(buffer)
ENDSUB

' r,g,b values are from 0 to 1
' h = [0,360], s = [0,1], v = [0,1]
' if s == 0, then h = -1 (undefined)
sub RGBtoHSV( float r, float g, float b, float h BYREF, float s BYREF, float v BYREF)
float min, max, delta

IF r < g THEN min = r ELSE min = g
IF min  < b THEN min = min ELSE min = b

IF r > g THEN max = r ELSE max = g
IF max  > b THEN max = max ELSE max = b

v = max ' v
delta = max - min
if( max <> 0 ) then
s = delta / max ' s
else
' r = g = b = 0 ' s = 0, v is undefined
s = 0
h = -1
return
ENDIF

if( r = max ) THEN
h = ( g - b ) / delta ' between yellow & magenta
elseif( g = max ) THEN
h = 2 + ( b - r ) / delta ' between cyan & yellow
else
h = 4 + ( r - g ) / delta ' between magenta & cyan
endif

h *= 60 ' degrees
if( h < 0 ) THEN h += 360
endsub

sub HSVtoRGB( float r byref, float g byref, float b byref, float h, float s, float v )
int i
float f, p, q, t
if( s = 0 ) then
' achromatic (grey)
r = g = b = v
return
endif

h /= 60 ' sector 0 to 5
i = floor( h )
f = h - i ' factorial part of h
p = v * ( 1 - s )
q = v * ( 1 - s * f )
t = v * ( 1 - s * ( 1 - f ) )
select( i )
case 0:
r = v
g = t
b = p
case 1:
r = q
g = v
b = p
case 2:
r = p
g = v
b = t
case 3:
r = p
g = q
b = v
case 4:
r = t
g = p
b = v
default: ' case 5:
r = v
g = p
b = q
endselect
endsub

SUB ModifyPixelValue(float value BYREF, float delta)
value = value + delta

IF value > 1 THEN value = 1
IF value < 0 THEN value = 0
ENDSUB

SUB ModifyHueValue(float value BYREF, float delta)
value = value + delta

IF value > 359 THEN value = 359
IF value < 0 THEN value = 0
ENDSUB



Title: Re: Changing brightness of a background image???
Post by: Egil on March 13, 2015, 03:40:17 AM
Thanks fasecero for the great code snippet!

I have noticed that most maps available for download from the present mapservers, are either in the different GPS manufacturer's proprietary formats, or in the PNG or JPG formats.
But I guess that if the structures of the different pictorial formats are taken into account, your technique should also work in other formats than BMP.

When I started this part of my project, I knew absolutely nothing about graphic formats and how to manipulate pictures, but now I am beginning to understand that it is a large, and complex, theme. So I have still much to learn....

But think I'll take a break this weekend, and watch TV with some of my friends. Just to "clean" my poor old brain. There is biathlon in Finland, skijumping in Trondheim (Norway), and cycling (Paris - Nice) in France. You know, all these important things I really can't afford to miss... :D ;D ;D

Title: Re: Changing brightness of a background image???
Post by: GWS on March 13, 2015, 01:47:56 PM
Hi,

Here's the direct way of darkening an image  ;D - pixel by pixel .. :P

It's a bit crude, and does have the snag that it takes a second or two ..  ::)

The original image is loaded offscreen top right, to maintain it's original brightness.

Maybe the darkening could be speeded up a bit, or perhaps processed offscreen - and then presented onscreen when ready.

Anyway, here's my rough and ready code, and the image ..


' Test for Image Brightness

def w:window
def wstyle:int

wstyle = @minbox
wW = 600
wH = 400

' open a window ..
openwindow w,-wW,0,wW,wH,wstyle,0,"IWBasic Test",&messages
setwindowcolor w,rgb(5,60,90)
centerwindow w

control w,@BUTTON,"Exit",(wW-70)/2,310,70,30,0,1
control w,@BUTTON,"Darker",150,270,70,30,0,2
control w,@BUTTON,"Lighter",380,270,70,30,0,3

pic = LOADIMAGE(GETSTARTPATH + "a1.jpg", 4)
'save original image off screen to the top right.. the image is 300 by 200 pixels.
showimage w,pic,4,wW,0
' show working image on screen ..
showimage w,pic,4,150,50

light = 1.0 :' full brightness

run = 1

WAITUNTIL run = 0
deleteimage pic,4
CLOSEWINDOW w
END

SUB messages(),int
select @class
case @idclosewindow
run = 0
case @idcontrol
select @controlID
case 1
run = 0
case 2 :' Darker

light = light - 0.2
if (light < 0.0) then light = 0.0

for i = wW to wW + 300
for j = 0 to 200
clr = GETPIXEL(w, i ,j)
' Extract red, green and blue
pr = clr & 0x0000FF
pg = (clr & 0x00FF00) / 256
pb = (clr & 0xFF0000) / 65536

pr = pr*light
if pr < 10 then pr = 10
pg = pg*light
if pg < 10 then pg = 10
pb = pb*light
if pb < 10 then pb = 10
' show darker image on screen
pset w,i-wW+150,j+50,rgb(pr,pg,pb)
next j
next i

case 3 :' Lighter

light = light + 0.2
if (light > 1.0) then light = 1.0

for i = wW to wW + 300
for j = 0 to 200
clr = GETPIXEL(w, i ,j)
' Extract red, green and blue
pr = clr & 0x0000FF
pg = (clr & 0x00FF00) / 256
pb = (clr & 0xFF0000) / 65536

pr = pr*light
if pr > 255 then pr = 255
pg = pg*light
if pg > 255 then pg = 255
pb = pb*light
if pb > 255 then pb = 255

pset w,i-wW+150,j+50,rgb(pr,pg,pb)
next j
next i

endselect

endselect
RETURN(0)
endsub



Best wishes, :)

Graham

Title: Re: Changing brightness of a background image???
Post by: Egil on March 13, 2015, 02:58:28 PM
Graham, you never stop to amaze me!

This is excactly what I needed. And since once the darkening level is found, it can be saved in a cfg file, and then use this value to process the map offscreen before showing it next time the program is started.
And off course make it possible to change later, via a menu...

This is an excellent way to demonstrate how simple, yet effective, things can be done. You really did it again!

Thank you very much.


Regards,
Egil


Title: Re: Changing brightness of a background image???
Post by: ckoehn on March 13, 2015, 05:25:56 PM
One more thing...

This is based on Grahams code with saperos speed trick..
' Test for Image Brightness

def w:window
def wstyle:int

wstyle = @minbox
wW = 600
wH = 400

' open a window ..
openwindow w,-wW,0,wW,wH,wstyle,0,"IWBasic Test",&messages
setwindowcolor w,rgb(5,60,90)
centerwindow w

control w,@BUTTON,"Exit",(wW-70)/2,310,70,30,0,1
control w,@BUTTON,"Darker",150,270,70,30,0,2
control w,@BUTTON,"Lighter",380,270,70,30,0,3

pic = LOADIMAGE(GETSTARTPATH + "a1.jpg", 4)
'save original image off screen to the top right.. the image is 300 by 200 pixels.
showimage w,pic,4,wW,0
' show working image on screen ..
showimage w,pic,4,150,50

light = 1.0 :' full brightness

run = 1

WAITUNTIL run = 0
deleteimage pic,4
CLOSEWINDOW w
END

SUB messages(),int
select @class
case @idclosewindow
run = 0
case @idcontrol
int hdcOld = w.m_hPrintDC
w.m_hPrintDC = GETHDC(w)

select @controlID
case 1
run = 0
case 2 :' Darker

light = light - 0.2
if (light < 0.0) then light = 0.0

For i = wW to wW + 300
for j = 0 to 200
clr = GETPIXEL(w, i ,j)
' Extract red, green and blue
pr = (clr & 0x0000FF)
pg = ((clr & 0x00FF00) / 256)
pb = ((clr & 0xFF0000) / 65536)

pr = pr*light
if pr < 10 then pr = 10
pg = pg*light
if pg < 10 then pg = 10
pb = pb*light
if pb < 10 then pb = 10
' show darker image on screen
pset w,i-wW+150,j+50,rgb(pr,pg,pb)

next j
next i

case 3 :' Lighter

light = light + 0.2
if (light > 1.0) then light = 1.0

for i = wW to wW + 300
for j = 0 to 200
clr = GETPIXEL(w, i ,j)
' Extract red, green and blue
pr = clr & 0x0000FF
pg = (clr & 0x00FF00) / 256
pb = (clr & 0xFF0000) / 65536

pr = pr*light
if pr > 255 then pr = 255
pg = pg*light
if pg > 255 then pg = 255
pb = pb*light
if pb > 255 then pb = 255

pset w,i-wW+150,j+50,rgb(pr,pg,pb)
next j
next i
endselect
int hdc = w.m_hPrintDC
w.m_hPrintDC = hdcOld
RELEASEHDC(w, hdc)

endselect
RETURN(0)
endsub


Later,
Clint
Title: Re: Changing brightness of a background image???
Post by: GWS on March 13, 2015, 08:48:37 PM
Oh, thanks Clint .. that makes a huge difference  ;D ;D

I'd remembered there was such a method, but I'd forgotten how it was done.

Excellent ..  :)

Graham
Title: Re: Changing brightness of a background image???
Post by: Egil on March 14, 2015, 05:59:25 AM
Thanks Clint!

When I think of it, sapero always had a trick up his sleeve, and it alway made a difference. I really miss him!

And when you guys have been twisting your brains to help me out, we have been out fishing.  Some old navy friends and me usually get together a weekend this time of the year for an "all boys - all sports" event. The activities are strictly sports related... fishing, diving, watching sports events on the TV, telling all sorts of stories ( and some of the wifes would add: "drinking too much beer" ...hehe).
The sea was a little rough for diving along the reef, but we  got a lot of fish. Cod, saithe and redfish. I just put the redfish in a tray with plenty of salt, so tomorrow we'll have salted redfish for dinner.

So the rest of the weekend will be of the "no computers" kind.


Regards,
Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 14, 2015, 07:59:34 AM
Clint:
I had been playing with what you are doing. It works pretty good with a small window.
Your example was with a 600x400 window.

When I use Egil's 3600x1800 jpg image of the world with a full screen window on my 1920x1080 display it takes about 2 secs for the image to change colors after you click the button.
And the other drawback I see to that scheme is that the incremental change is fixed in the program but it could be made as a user defined parameter.
==========================
With my current effort I've got something working that changes the color, for all practical purposes, instantly, and, can be implemented with a slider control for very fine shade control.  Also, zoom control can be multi-level with double-clicking left/right mouse buttons or context menu or a slider control like the shade control.  All of this impacts only the image; there's no alpha blending etc.

Whatever scaling/zoom methods are used will have to be applied to plane placement within the client area.

Right now I'm modifying Egil's Mapview app he posted to incorporate my efforts.  Oh, did I forget to mention that, as usual, I'm using something somebody else adapted about 7 years ago and not something I created(and Sapero and PT weren't involved  ;) )
==========================

Egil:
I'm pretty sure this is exactly what you were looking for.
Title: Re: Changing brightness of a background image???
Post by: ckoehn on March 14, 2015, 08:14:32 AM
I'm waiting for your code... :)

So much to learn, so little time....

Later,
Clint
Title: Re: Changing brightness of a background image???
Post by: Egil on March 14, 2015, 12:26:53 PM
Quote from: LarryMc on March 14, 2015, 07:59:34 AM
Egil:
I'm pretty sure this is exactly what you were looking for.

Sounds great Larry!
Looking forward to see your code. ;D ;D

And just for the record, the code I posted is an early prototype. Use of the present map size was choosen to simplify the scaling for the HFDL application. Sometime in the future, I probably have to change that scheme, especially if I decide to use calibrated from Google or Open Streetmaps.
Google have a size restriction for their downloadable maps, max size is 1280 x 950 pixels.  Have not yet found the correct values for Open Steetmap. But anyway I am not allowed to download a simple calibrated map, showing the whole world, from any of them.
The map I use now, is open source, and I can do whatever I do with it. But at the cost of very large map files.

But there are plenty of tasks to do before I have to decide to stick to the present map, or make it possible to download restricted size maps from whithin the program...

Now I turn the computer fully off, and go back to my guests...
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 14, 2015, 09:38:05 PM
Something has come up and I've got to quick working on this.
In the attached zip is all the files needed to create the included modified mapview exe file.

I've added a menu with options to lighten/darken the background image; should have zero affect on anything else drawn on the window but I haven tried it yet.
Also added menu option to show how zoom in/out on an image is done.
This zooming is not compatible with Egil's scrolling scheme but it possiblibly can be adaptd with some careful thouth and work.

This uses the DeVil image library. the 3 dll files have to always be in the same folder at the exe that uses them.
the contents of the include and libs folders have to be placed in the iwbdev include and libs folders in order to be able to compile.

For some reason I I haven't as yet gotten the initial image to scale to the full image fitting the client area as yet.
However, double clicking tin the client area perform's Egil's zoom to the proper location on the earth map on the first double click.  Haven't checked a 2nd double click.

If you are in a double click zoom clicking a light/dark shade will currently take you out of double click zoom.  That's because I'm currently trying to do too many things in the one Imaage update() function.

Maybe one of you will want to pick this up and see what you can do with it.  This library will handle a lot of different file types but it converts all of them into bitmaps internally.

And it appears to me that this can be done with any image library of your choosing that allows you to adjust the contrast of the image like this.;

Sorry I couldn't stay on this right now.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 15, 2015, 11:12:37 AM
Thanks Larry!

I will study your code very carefully, but not until tomorrow ...
It's been a long weekend with very little sleep, so tonight I am going two take it easy. But we had a great weekend!
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 12:29:23 AM
Had a little time and I figured out how to make the initial image scale properly.

Also, I've learned enough that your(Egil) life will be much, much simpiler if you stick to your current one level of zoom you've already implemented.

I'll try to get a cleaned up source file posed within the next 18-24 hours that will work a little better.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 16, 2015, 06:45:21 AM
I tried using the DeVil image library three years ago, when I first started to experiment with these ideas. At that time I used MiniBASIC for coding. I found it very difficult to load a large image and show it in a smaller client area when IL was used.
MiniBasic had the  same functionality as IWB, scaling down an image automaticly when showing it in a client area smaller than the image. But when using IL this functionality was lost. I also had some problems with the image color balance when trying the program on a small netbook running XP.

It seem to behave the same way now, using IL and Larry's code on my Win7/64 system.

I will use the next couple of days to experiment a little with the suggestions you guys have come up with, to decide what method to use.

If I manage to make a map viewing system that can be easily manipulated, and plot position data onto in a  fast and easy way, I plan to use the same setup for three different applications. The one I am working on now, plotting plane positions retrieved from the PC-HFDL Arinc decoding software, another one plotting amateur radio satellite orbits and the third, for finding amateur radio callsign prefixes, and calculating antenna beamheadings and distances from your own position to the countries using these prefixes, and maybe add "greysone" plotting.

I attach an image showing a "side effect" of the decoding hobby. It is a screendump published by another decoding hobbyist (I beleive he is in Germany), showing what impact the fighting in Ukraine has on international air traffic...
This map is produced by a freeware program called "PosFix".


Regards,
Egil.

Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 09:00:18 AM
I've been up all night and have learned some more.
From the previous code I posted you know I'm using the DeVil free lib.

Here's the difficult part. Development of DeVil stopped in March 2009 and a lot of the on-line documentation and forum support has disappeared.  The docs that are available are what I'd call 'skimpy' because all the commands are not covered.  
Todd Riggins way, way back wrote wrappers for the original IBasic and he combined some of the DeVil functions into a single command.  With those wrappers and his example I only knew how how to use one image at a time at a time.  Years ago I had used this library to make an image editor for my genealogy work and it worked pretty good since I only dealt with one image at a time.

Anyway, with Egil's program, with this lib and the example I had to work with, I had to figure out how do I have one image and scale it two different sizes considering the scaling normally accomplished with SHOWIMAGE doesn't work because the library forces you to convert all images to bitmaps internally and autoscaling just doesn't work.

The real problem is that the way Todd wrote his wrappers there is no way to tell the difference between multiple images. If you load a 2nd image it over writes the first internally.

So, right now I've got a scheme that when you start the program it loads the image, applies the scaling and displays the image. Then when you switch to zoom it deletes the image, reloads with no scaling and displays the zoomed portion of the image.  Then it reverses the process when switching out of zoom mode.

When in zoom mode and panning there is no need to reload.  I wound up at this point through a bunch of trial and error attempts.  I can get this back to one image but when I zoom in the image becomes way too pix-elated so it is going to take two images. So I'm leaving my current in place

After getting that working it was time to get the scaling working with this code..  I put all the code in for a trackbar control but it was a whole lot of stuff for just a little functionality so I took it back out.  I added 2 entities  to the popup menu.  The problem here is that the command to adj the contrast of an image is a value RELATIVE to it's current contrast and not an ABSOLUTE value.  So, there is no way for me to set the contrast in zoom mode and then have that same contrast appear in the non-zoom mode image and vice-versa.
While looking in the only docs in a section  that uses commands that aren't used in the only example I had to go by I was led to believe that the lib was capable of handling multiple images at one time.  I looked in the include files and the commands were there.  I started search high and low.  On sourceforge I found an index page with all the commands listed. Of course, when I clicked the links I got a 404 error; no such page.

Then I had some luck. On the CodingMonkeys site(which I happen to own;duh) there was an old example that was set up to use only use one image but the setup was structured using the commands I need (for the most part)

This is how I believe it will allow me to solve my problems.
1. I only have to load each image one time per app run
2. Contrast adj will be made to both images at the same time regardless of which is showing
3. When app is closed image is saved so contrast is saved for next run. could be saved as alt image to orig for restore feature.

All this considered it's going to take me a while to sort through this so I'm sure not not going to meet my previously set deadline.  Especially after staying up all night and a personal issue I'm dealing with.

But I'll get something to you guys as soon as I can.  I'm personally interested in seeing this work.

P.S Hope all this rambling makes sense.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 09:13:22 AM
Quote from: Egil on March 16, 2015, 06:45:21 AM
It seem to behave the same way now, using IL and Larry's code on my Win7/64 system.
Are you saying your image dosen't look right on your computer?

This what it looks like on mine.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 16, 2015, 09:24:26 AM
This is what your code looks like with me. The first one is when the program is started, and the second is the result of doubleclicking approximately on Barrow, Alaska.


Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 16, 2015, 09:30:21 AM
QuoteOn the CodingMonkeys site(which I happen to own;duh) there was an old example....

There are tons of good examples on CodingMonkeys. I have learnt a lot by studying some of them.
I feel that the site deserves much more attention by active users. For me the IB Code Archive has been a real goldmine.


Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 09:31:30 AM
I thought I had explained in the post that that's what that version looked like.

Sorry

The attached is a newer mapview.exe.
Replace the one you just ran and see.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 09:37:41 AM
When you run it
zoom somewhere
right click to bring up popup menu
click on either inc or dec contrast
image will lighten each time

if you get out of zoom right now nothing has changed and won't change as far as contrast
Title: Re: Changing brightness of a background image???
Post by: Egil on March 16, 2015, 10:22:33 AM
Quote from: LarryMc on March 16, 2015, 09:31:30 AM
I thought I had explained in the post that that's what that version looked like.

You had explained it... but when I saw your pictures, the enthusiast in me took over, and forgot all about it.... ;D
When trying your new exe we get the same pictures!

Great work Larry, I really appreciate it!


Regards,
Egil


Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 16, 2015, 10:25:32 AM
so, read my last novel and give me some time and I think we can whip this thing.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 16, 2015, 10:41:41 AM
Quote from: LarryMc on March 16, 2015, 10:25:32 AM
so, read my last novel ....

I just did (again), and I like the way you think. It's a little different from what I had in mind, but that's no problem.
And for the deadline you mention... For me this is a "having fun" project, so there is no hurry.


Egil
Title: Re: Changing brightness of a background image???
Post by: Egil on March 17, 2015, 06:04:52 AM
LarryMc:

A couple of friends passed by here today, and dropped in for a cup of coffee. They are both C++ programmers, and was very interrested in the mapview program.
When I told them that you were working with the deVil library, they both said that we will be bether off with a more up to date, and still actively maintained graphic library.
They reccommended Freeimage: http://freeimage.sourceforge.net/, which they use at the company they work for.
It is free, and open source, and the last update was only a couple of days ago.

I will download it and study the documentation, to see if this library is easier to implement with IWB.


Regards,
Egil.

Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 17, 2015, 08:09:52 AM
I glanced at it but I'm zero help at converting from c++ to IWB.
If you are prolific at converting then I'd tend to agree with your friends in the long term.

However, last night before I went to bed I believe I finally figured out DeVil handles multiple images.
And it appears it will be rather easy (and simple) to solve all my issues.
After some breakfast I'm going to start modifying your mapviewer to see how it goes.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 17, 2015, 11:58:16 PM
Problems solved!!!
DeVil allows me to load multiple images.
The process that allows that facilitates the ability to select one loaded image and do whatever you want to it and then select the other and do to it as you will in any sort of random order.

So, I loaded the world.jpg into both internal images and scaled the one to show the whole world.
Based upon Egil's 'scaled' flag I convert the proper image to a bitmap and display it on the screen.
Since one of the 2 images is always selected it made the contrast code easy, again based on the 'scaled' flag.
When the contrast option is clicked I apply the adjustment directly to the currently selected(and visible image) and then select the non visible image, apply the same adjustment and then reselect the visible image  without ever switching the visible image.  Works like a champ.

To see it work simply unzip and replace the mapview.iwb file in my original upload with this one.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 02:18:12 AM
Now it works much better than I ever expected Larry!

Leaving for Oslo right now, but I'll return tonight (it's 0920 local time now), and will check it out more then.

Was going to Oslo this morning for a meeting, but as soon as I got out of the plane in Oslo, I received a message saying that the meeting had been postponed...
Had to wait several hours for a plane back home. I just hate days like this. >:(


Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: talun on March 18, 2015, 07:26:55 AM
Hi Larry,

   the file mapview.zip contains only the compiled version and not the source code.....

bye

Sergio
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 07:47:18 AM
I really just meant to post the exe but just wrote the wrong words; but no harm.
The source code is going to change in the next few minutes.
I've started working on how to put the little airplanes on the screen with what I have learned.

Egil:
Approx how many data points are to expecting to have displayed on the screen and how often are you expecting all the data points to be updated?
Title: Re: Changing brightness of a background image???
Post by: Brian on March 18, 2015, 08:56:06 AM
Larry,

If you look at flightradar.com, as I have just done done, and zoom out to show the whole world,
it was showing 1,500 of 11,742 possible aeroplanes!

So, quite a lot, and if you do load flightradar up, you will see that the displayed planes
are sized according to the plane's size, and even shows little helicopters as well

Brian
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 09:20:49 AM
And Egil is wanting to plot all that  AND ground stations?
Title: Re: Changing brightness of a background image???
Post by: Brian on March 18, 2015, 09:34:49 AM
Larry,

Well, I did include everything, ground stations, aircraft on the ground, etc, just to see how many,
so just tracking in-flight planes, and maybe just around northern europe, may be easier

And it depends on what radar beacons you are tracking, as well

Brian
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 09:44:55 AM
I created a little plane pic and  used a random num generator for pos
It puts a 1,000 and 10,000 on there instantaneously.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 09:49:57 AM
Larry:

If you by data point means, planes plotted, I have experienced 100 to 150 individual planes per received channel at any instant, and was planning to use a maximum of 8 channels (max four internally on the same pc as  this program, and receive the rest via UDP).

I plan to update the plot once a minute.

The planes send their position reports at approximately 10 minutes intervalls, and the ground stations poll if the reports has not been received.
Every now and then the planes and the ground stations lose contact. When this happens the planes log into another ground station. And since the new channel often is not monitored here, I was thinking of making some kind of simple database to take care of this, and make a provision to delete planes that have gone out of range 15 minutes after it was last heard. (maybe this ought to be user defined)

Brian:

flightradar.com (http://flightradar.com) and their competitor planefinder.net  (http://planefinder.net) ( to which I am a contributor ), collect data from enthusiasts all over the world decoding transmissions from the secondary radar systems on the planes, and the ACARS system. Both are "short range" systems. And though it may look similar to the HFDL system, it is quite different. The HFDL system is a "long range" system.

Most newer planes today use CPDLC, which is a mix of satellite links and VDLM2 ( a "short rangne" VHF system, which is going to take over from the old ACARS system). Both these systems are very expensive, and  since all international planes are requested to have at least two such systems, many of them use HFDL (which is a relatively inexpensive system) for backup. And since a listener never will be able to hear shortwave transmissions from all over the world at the same time, I am not afraid of overloading the program.

Sitting in my shack monitoring, amongst others, chinese domestic fights, is at least to me, a challenge.


Egil
Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 10:03:05 AM
Quote from: LarryMc on March 18, 2015, 09:44:55 AM
I created a little plane pic and  used a random num generator for pos
It puts a 1,000 and 10,000 on there instantaneously.

I was not planning to use plane drawing in this program, they cover a much too large area of the map to give a sensible position. Instead I was thinking of a very small colored square indicating the position, with a short line, drawn from the center of this square, indicating the direction of the flight. And let the user chose the colors).
This is what the "professionals" use on their radar screens.

I realize that to others this project may seem insane, but for me it is a hobby, and what can be more important than that? And doing it, I learn a lot of programming... :D :D ;D


Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 10:38:34 AM
The 10 minute update will allow you to to process an unlimited amount of datapoints.  I'd say, based upon what I see right now 60-70,000 points would be no problem what so ever to locate and display a symbol.
multiple colored/sized planes and other symbols will be no problem.

You mentioned other maps like google maps - that's a problem

The only way I can make this work so you can have have more than two layers like you have now(full earth and one level of zoom) is for you to have a hi res image larger than your current 3600x1800 jpg you have now.

Having a square instead of a plane is no problem. I'll have to play around with the line to indicate heading since we're talking small and pixels. every 45 degrees is easy but in between is tough to show with just a few pixels.  I'll see if I can do it by rotating an image with a pointer on it.
As for allowing the user pick the color, it will have to be from a predefined set. The symbols will have to be pre-built in each available color. But that not really a problem.

Any other specific details you can give about how you envision this working(looking) will help as I proceed with the DeVil coding.  And this id encouraging me to learn what all  I can do with DeVil ;D ;D ;D
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 01:12:06 PM
I made a litle square with aline
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 01:15:56 PM
run this
Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 01:23:41 PM
The example map I have used so far is showing the whole world, but on Google Maps and on Open Streetmap you can download regional maps, with an attached calibration file (.clb). How such calibration files are suuposed to be used, you can see here: http://www.sailwx.info/maps/shipplotter.phtml?width=1200&height=600&lat=63.1&lon=7.5&radius=50&airports=2&cities=0
(http://www.sailwx.info/maps/shipplotter.phtml?width=1200&height=600&lat=63.1&lon=7.5&radius=50&airports=2&cities=0)
That page more or less explains itself.

Have not studied the Google Maps API, but since they limit the width of the maps you can download to 1268 pixels, I do not want to use them.
On OpenStreetmap it is possible to download regional maps similar to the maps in the supplied links, but with greater details in the maps. I have not yet studied how to download them. The size restrictions here, is max 4048 x 4048 pixels.

I reckon that if I enlarge a world map so only a small region of the world is shown, it should be an easy task to calculate the border positions for use in downloading a more "tailormade" regional map.
But for this HFDL application I think the way I'm doing it already has all the resolution needed.

It seems like the site I downloaded the map from, no longer exists. But the maps are based on NASA's Blue Marble Eart Maps (http://visibleearth.nasa.gov/view_cat.php?categoryID=1484 (http://visibleearth.nasa.gov/view_cat.php?categoryID=1484)).

Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 01:33:02 PM
Quote from: LarryMc on March 18, 2015, 01:15:56 PM
run this
Something along that line was what I was thinking of, but maybe with a color not as dominant as red...
Title: Re: Changing brightness of a background image???
Post by: Egil on March 18, 2015, 01:49:57 PM
Maybe something like this.... (4x4 pixels with tail 5 pixels long).
And the same size on the full world map.

It planned to draw these "on the run" when updating the plots. Have noticed that this can be done very fast by using ordinary drawing commands and draw wiith transparent background.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 05:15:26 PM
What about when you position and draw 3000 of them?
Also in your picture example it looks real neat with the line at a 45 degree angle and will look the same at 4 cardinal headings.
But when you start drawing a line at other angles it starts looking ragged

There's no calculation for the line with DeVil once you settle on a symbol; you just give it the angle and it rotates the symbol but the same problem with ragged lines is there.  I see that as an issue to be solved.

Note: I was using red because it shows what the symbol will look like so well.

I tried this one with a tear dropped shaped imaged but it still distorts it at some headings.
But look at the small subroutine that is generating all those.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 07:17:14 PM
I think you are right Egil; drawing the symbol with the regular command.
But I think a circle will look better than a circle so that the line will be from the center of the circle
Se below(and run attached
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 18, 2015, 07:59:18 PM
I guess what I need to do now is figure out how to mix GDI+ graphic commands with the DeVil commands.
GDI+ (which I used in my custom control tutorial has an ANTIALIASING mode for drawing that makes those ragged lines appear smooth to your eyes.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 19, 2015, 06:00:20 AM
Seeing your example immediately convinced me. Circles are better.
I was planning to use RECT and LINE, but guess CIRCLE and LINETO will work faster as I expect that LINETO then shares the startposition with the CIRCLE center.

For two days now, I have decoded traffic from Shannon - Ireland, collecting all traffic to a logfile. The shortwave radio conditions has been rather poor, due to heavy solar activity resulting in a lot of northern lights.  Now I am going to analyze the logfiles, to figure out what information to look for and retreive.

When I come to think of it, I have all sorts of plans in my head, but maybe it now is time to put these plans in a textfile, just to organize them properly. Guess this will ease the coding as well.

In a few hours I have to go to Trondheim. Going for an examination of my right hip, so the doctors can plan the upcoming surgery, and, to quote my good neighbour (who also is a doctor), " It's just like changing the brakes of a car, they have to order new spareparts before they can change the old ..."


Regards,
Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 20, 2015, 11:55:17 AM
The attached symbols are drawn with GDI+.  Now I just have to remember how to make them stay on the screen when you move another screen over them or minimize the sceen then open it back up.  And do that without without messing yp the background image.  This old brain of mine is getting old and tired,
Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 29, 2015, 06:49:34 AM
okay, the attached displays symbols for planes, ground stations, and base.
the symbols don't go away when the window is covered with something else.

Egil: now you've got a lot of work to do in writing code to read your database of 3 different types of data points
then converting the lat and long coordinates to scaled x/y to match the x/y of your 2 different image sizes so the point plot at the proper relative locations on both maps especially when scrolling.

But the core of the program is there for putting the stuff on the screen. ;)
Title: Re: Changing brightness of a background image???
Post by: Egil on March 29, 2015, 10:00:17 AM
Thanks Larry!

Things going "slow ahead" only here at the moment. Have problems typing because of the broken arm. But have used the time to set up the decoding software to log everything it decodes, and then looking through these logs every day. Till now I have only used the HFDL position reports, but have discoverred that there are lots of other information in there as well.

They have set me up for a hip replacement april 15th, and hope to get rid of the plaster before that.
But as you mentioned, I have lots of coding to plan and do now.

Thanks again Larry. I really appreciate the work you have done to help me with the graphics. And though the usual easter visitors have arrived (you know, children grandchildren etc), I thinkl I'll get around to study your  code.  :D


Regards,
Egil.


Title: Re: Changing brightness of a background image???
Post by: LarryMc on March 30, 2015, 01:46:04 PM
Egil:
To satisfy my curiosity could you send me a sample of one of your data files for me to look at?

If it's not a problem.
Title: Re: Changing brightness of a background image???
Post by: Egil on March 30, 2015, 03:40:53 PM
Quote from: LarryMc on March 30, 2015, 01:46:04 PM
Egil:
To satisfy my curiosity could you send me a sample of one of your data files for me to look at?

If it's not a problem.

Done
Title: Re: Changing brightness of a background image???
Post by: Egil on April 14, 2015, 10:25:34 AM
When testing how to convert positions given in degrees, minutes and seconds into decimal degrees, I discoverred that the scaling factor of the maps, came out faulty.
Redefining the variable sfactor to float did not rectify the problem. Changing the line:
sfactor = mapwidth/pw   ' Calculate scale factor
to this,:
sfactor = float(mapwidth)/float(pw)    ' Calculate scale factor
made the calculation correct.

Also realized why positioning of the mouse was not quite correct when enlarging the map. After correcting the scaling factor calulation, I had to change the lines:
mapleft = -(mx*sfactor) + (mx/2) 
maptop  = -(my*sfactor) + (my/2)


to  this:
mapleft = -(mx*sfactor) + mx
maptop  = -(my*sfactor) + my


The result is that the mouse now is positioned "right on" when the map is enlarged.

During the weekend I also made some routines for log file handling, collecting data from different files and put them in a new file for later manipulation by the map program and/or make a written log in a kind of grid.
The routines  was tested using a console mode program, but that turned out to be a real "CPU-hog". Therefore I made gui for the  routines, and compiled as windows program, and then the CPU use was just a small fraction of what it was before.
This was quite an eye opener to me.

I decided to make a somewhat better GUI for it, and compiled it as an independent program. And  since I am part of a group ofm decoding "freaks", where the other do pretty much the same way of decoding as myself, I sent copies to a  couple of them. They were quite happy with the tool, and have already been asked to expand the number of "channels" the program can collect data from.

Regards,
Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 14, 2015, 10:52:56 AM
Egil
Just before I started trying to help Andy with his compile time problem I believe I stumbled across the secret to your positioning calculation and it doesn't even require that you use your sfactor variable.

Later today I'll try to prove it works and if it does I'll post the code.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 14, 2015, 11:32:26 AM
That's great Larry!

I plan to prepare the code it such a way that it can use "calibration" files (ending with .clb). Such files are used by most suppliers of free to download maps.
Here is the content of the clb file describing the Google map below:

Point00,xy,0,0,in,deg,6,5.784068,N,0,0.175912,E
Point01,xy,1280,0,in,deg,6,5.784068,N,14,4.523948,E
Point02,xy,0,950,in,deg,4,20.807448,S,0,0.175912,E
Point03,xy,1280,950,in,deg,4,20.807448,S,14,4.523948,E


Larger maps often use 24 "calibration points" placed in a grid like pattern all over the map.

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 14, 2015, 01:22:03 PM
Well, that blows my code out of the water.
my work was based upon the text file that had records like this:
Quote[HFNPDU PERFORMANCE]
11:35:56  UTC  Flight ID = RJA121  LAT 49 4 49  N  LON 17 26 45  E
so I worked with
QuoteLAT 49 4 49  N  LON 17 26 45  E
or more precisely
Quote49 4 49  N  17 26 45  E
and passed those values as parameters to a subroutine.
The key to the whole thing is your map.
your map goes from 180W to 180E and from 90N to 90S
so all you have to do is convert the degrees to 0-100% of the image width
for the full map no further adjust is required
for zoomed in you have to adjust for the image offset

I set in 3 fixed points
0 degrees lat and lon
Abilene,Texas where I live
Oslo, Norway
I offset the 5 pixel square box by 3 so the center of the box is centered on the point

If you can explain
Point00,xy,0,0,in,deg,6,5.784068,N,0,0.175912,E
Point01,xy,1280,0,in,deg,6,5.784068,N,14,4.523948,E
Point02,xy,0,950,in,deg,4,20.807448,S,0,0.175912,E
Point03,xy,1280,950,in,deg,4,20.807448,S,14,4.523948,E
or tell me where to find the explaination

to me I'll see if I can make the adjustment
Title: Re: Changing brightness of a background image???
Post by: Egil on April 14, 2015, 02:26:59 PM
I did not remember the fact that others maybe never have heard of such calibrated maps, sorry about that.

The key is as follows:

Point00,xy,0,0,in,deg,6,5.784068,N,0,0.175912,E     =  Upper left corner of map, and position of that point in degrees and minutes with decimals. ( 6 degrees 5.784068 minutes North, and 0 degrees 0.175912 East )

Point01,xy,1280,0,in,deg,6,5.784068,N,14,4.523948,E = Upper right corner

Point02,xy,0,950,in,deg,4,20.807448,S,0,0.175912,E   =  Lower left corner

Point03,xy,1280,950,in,deg,4,20.807448,S,14,4.523948,E = Lower right  corner

So this describes a map with size 1280x950 pixels, with positions in Google's format.

Other such files do not use N,S,E and W for the directions. They use positive values for North latitudes and East longitudes, and negative values for South latitudes and and West longitudes. And to add to  the confusion these files often  use degrees and decimals of degrees instead. Such as maps from OpenStreetMaps and Mapquest. In all cases we need to obtain a licence key before we are alowed to download any maps with "taylormade" dimensions. Otherwise the largest  dimensions is 1280 x 950 pixels as in the Google example.
I have sent an email to MapQuest (OpenStreetMap) asking if it is possible obtain a free licence key to be included in a freeware program. If they accept such an arrangement, it will be an wasy matter to download maps at will from inside the program.
We can start from a calibrated small size worldmap and enlarge it, and let the present clientarea in the program set the size of the map. Then it also should be an easy matter calculating the position of the map boundaries, and if the map provider do not supply the calibration file, we can make it ourself using the information sent to download the map.

In Texas I only have been along the coast. Corpus Christi, Freeport, Galveston, Texas City, Baytown, Houston and also think that Port Arthur is in Texas. Was several times in each place during the time i did servicing and calibration all kinds of sensors and load computers onboard chemical tankers. One of my best visit over there was when I had to wat four days for a tanker to arrive. I leased a car in Texas City and went visiting a friend working at the Norwegian Seamans Church in Houston, and the day after we went down to Pasadena (??) and was lucky to get a guided tour at the NASA Space Center. I do not remember which year, but must be 30 - 35 years ago....


Regards,
Egil


Edit: forgot to ut in descrition of the positions, just in case.......  ;D
Title: Re: Changing brightness of a background image???
Post by: Egil on April 14, 2015, 03:37:16 PM
Quote from: LarryMc on April 14, 2015, 01:22:03 PM
Well, that blows my code out of the water.

Don't panic!

You have calulated the positions using the format the planes are transmitting them, which is very good. That was the part i was going to look at next. But you have solved that in a very nice way!

The other format is just needed when downloading a map from one of the mapservers, and only has to be recalculated into the format you have used once for every new map, as long as we use the calibration files, with filename paired with each jpg.
( World.jpg and World.clb)

Making  such code should be a walk in the park...

Just compiled your last masterpiece, and I like the way you have done it. Exactly what I was thinking of.
But I am unable to scroll the map south of equator.

It is close to midnight here, and I have been up since 0500 this morning, so think I'll better hit the bed, and study your code more thoroughly tomorrow.


Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 14, 2015, 03:47:13 PM
Forgot to say that it's best to stick to the present map until a licence key is obtained from one oof the mapservers. If that key is not free, I think I drop it, and use the present map.
For the dealing with airplane positions this is more thas sufficient.
I was planning to use the same code for ship positions (AIS decoding), but for that application the calibrated maps supplied by SailWx. Here is an example:
http://www.sailwx.info/maps/shipplotter.phtml?width=700&height=350&lat=63.13&lon=7.65&radius=30&airports=0&cities=0 (http://www.sailwx.info/maps/shipplotter.phtml?width=700&height=350&lat=63.13&lon=7.65&radius=30&airports=0&cities=0)
The shown map is based on the area around me.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 14, 2015, 04:25:56 PM
Two things:
Pt. Arthur is in Texas and is 17 miles from Beaumont Texas where I grew up in the swamps of Texas.

You couldn't move south of the equator because I improperly corrected your find edge calculation.
In your original calc you were using the width to limit the height.
It is now fixed correctly in the attached.

BTW, I have a scheme in mind of how to handle updates from planes to make them move across the map as you receive updates.
I'll see if I can dummy up an example for you in the next few days or so.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 15, 2015, 01:29:35 AM
Thanks Larry!

I only used the width to calculate the scalefactor. Because of the ratio between width and height in the map I presently use, the scale factor will be the  same as if I also calculated it using the height.

When thinking of the calibration file... the use of it it quite logical. The present map has a equidistant projection, but most other maps have other projections. The figures in the calibration file are used to somehow compensate for this.

Another matter is the present map. I only assume that the edges are 180W, 180E and the poles. But I do not know...
And with this map 1 degree  is 10 pixels wide and high, so it is not really needed to calculate the plane positions with a very high position. Degrees with one decimal would suffice. And my original plan was to stick to such a scheme just to learn how to do things properly for any improved resolution updates later.

But using maps covering just a small local area, the presision needed will be higher. But then it also be possible to use the program for plotting planes by decoding signals from the planes "secondary" radar transponders, which is what they use in the data collection for websites like FlightRadar24 and planefinder.net (http://planefinder.net). I contribute to planefinder.net.

Now I expect some visitors to arrive any moment,  so I will not be able to check in here till tonight (now it is 0900). And finally, I have also been in Beaumont,TX, but did not remember until you mentioned it.  :D :D


Regards,
Egil
Title: Re: Changing brightness of a background image???
Post by: Egil on April 16, 2015, 09:05:14 AM
LarryMc:

Your great interest in my map viewing project came as a surprise to me. And since I not yet had prepared any written plan for  the program, you have been kept more or less in the dark. This has never been my intention, so finally, I' try to make a description:


HFDL - short description:
==========================

HFDL is what Arinc is calling their shortwave dalatink service, available to the international airline companies.
Via a number of Ground Stations, spread all over the world, and interconnected via internet, this datalink network covers the whole globe. And since she shortwave radio propagation is constantly changing, The Ground Stations each is assigned a certain muber of frequencies the can use, and they change between them as needed, when propagation changes.

Each frequency in use, is very strictly controlled by the Ground Station.
The communication is "timeshared" in cycles which are divided into 13 "slots". Each cycle takes approximately 33 seconds.

The first of these timeslots is the "Squitter Broadcast". Each Squitter Broadcast contains the Ground Station ID, plus frequencies presently in use. In addition it contains IDs and frequencies for two additional Ground Stations.This additional stations info changes for each broadcast, and in five minutes all the other Ground Stations info has been supplied. The broadcast also specify which timeslot(s) are used for "household" (acknowledgements and assignments of slots for planes to use etc.)

The IDs and frequencies are not transmitted in "plain text". Instead station and frequencies numbers are used. And for all transmitted tata, in all slots, bitstuffing is extensively used. As a result, the transmissionsvery becomes very compact and effective.

The receiving end is responsible for decoding these data, using a system table for conversion to plain text. So for pilots and traffic controllers the system more or less appears as plain text communications.



Background for making this program:
====================================

Most of the hobbyists that plot planes by decoding shortwave radio signals, use the shareware PC-HFDL for decoding HFDL radio transmissions.
There are several other such programs that also can be used, but the price tags are rather high.

PC-HFDL prints the decoded data on the screen in addition of writing it to a log file. It can also communicate with other applications using a DDE link, but Microsoft does not recomend this method used. Therefore, if the decoded data is to be used by other applications, reading the PC-HFDL logfiles is the best way to do it.

The shareware "PlanePlotter" can read those logfiles, and most ot the hobbyists use that program to plot the position data on a map. But PlanePlotter is an "all singing all dancing" program, covering many other aspects of the decoding hobby, and was first made for direct decoding of VHF ACARS transmissions. But the last few years it is has changed to to mainly cover the needs of the folks wanting to plot planes (mostly military) that are not transmitting transponder signals in "mode B" and use "mode C" instead, e.g. no position data transmitted. So they cooperate in groups, using a multilateration technique to determine the plane positions. To obtain this, they feed PlanePlotter from ADSB decoders, receiving the 1090MHz transponder signals.
This possibility have done the PlanePlotter software less useful for HFDL fans.
(For more details on PlanePlotter, check: www.coaa.co.uk/planeplotter.htm )

But what HFDL decoding enthusiasts like me really want, is a program that can plot plane positions on a world map, with the posibility to enlarge the map to see more details during periods of heavy traffic, making the plots overlap each other.
And have the possibility to view the received data in a kind of grid, either "live" or later.



Preliminary program requirements:
==================================

1 - Read decoded data from multiple PC-HFDL logfiles.
   (running multiple instances of PC-HFDL)


2 - Ability to receive data via TCP/IP, using UDP.


3 - Save received "raw" data in a new logfile


4 - Parse new data and use the "Air IDs" to retreive:
   Flight ID    
   ICAO number
   Plane Callsign

   (Air ID is a unique number assigned to a plane each time
    it logs onto a new Ground Station, and is used on all
    transmissions tgo and from that Ground Station after a
    logon is acknowledged)


5 - Plotting decoded data to a world map.
   (Showing the whole world, and have ability to enlarge a
    specified area for more detail)


6 - Make some kind of temporary storage to register the time
   a plane was detected, and "delete" it from the plot if no
   transmissions are detected after a specified delay.


7 - List ID data with time stamps in some kind of grid.
   (Maybe this best is obtained by a second programme,
    using data from the new logfile)


8 - Update the grid whenever a new ID element is detected
   (see point 4 above)


9 - Possibility for sharing the data "live", using TCP/IP.
   (Not really needed, but can be added later)




EDIT: Almost forgot the next steps:
=========================


10 - Plot the ground stations in a different color than the planes.


11 - Retrieve Ground Station names and active frequencies from
     the squitter broadcasts.


12 - Show Ground Station names and frequencies by pressing a key
     when cursor is over it. Remove text when releasing key.


13 - Show plane ID's by pressing a key when cursor is over it.
     Remove text when releasing key.


( By changing  to an "ordinary" menu instead of the context menu,
  a mouse button can be used for steps 12 and 13)





Hope I don't sound too confused...


Regards,
Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 16, 2015, 02:09:46 PM
Got the graphics code so the ground station symbol and name is displayed. See attached.  I haven't attempted to build the database for the routine to update from. Do you want it to update directly from the System Table.txt you sent me a copy of?
I can make steps 10,11, and 12 happen from that if you like. Question: When you click a base station do you want the freq to overprint directly on the globe(harder) or do you want the info to show in a popup window(easiest).?

In the attached src file I added a men at the top of the app. with it you can turn the planes on/off, ground stations on/off, and what I think is the user's home station on/off from displaying. By adding a setup option later it will make it a lot easier to add all the options for colors and such and save then to an ini file.

And am I remembering correctly that the March28.txt file you gave me is typical of your source of information for plane position and that is what I need to decode and glean for position info? How often will you be getting these files and processing them?
Title: Re: Changing brightness of a background image???
Post by: Egil on April 16, 2015, 03:23:19 PM
Great Larry!

Exactly what I meant. The pictures look great, only hope Bev McEvan (author of PlanePlotter)  don't go bananas when he sees that we are  using the same symbol and colors as in his program....
BTW, I had a look in the PlanePlotter directory, and see that Bev uses the FeeImage library.

The log file I sent you is the output of PC-HFDL whithout any modifications. So that's what we have to deal with.
I almost feel ashamed of calling the program "LA2PJ's HFDL Viewer" since now you have done most of the hard  work. But I don't mind. Especially now when I have problems  with typing.
Have to give you all the credits in the User Guide. ;D ;D

I hope to rearrange some of my UDP routines tomorrow, making them ready to include in the program.


Egil


PS:
The Ground Stations can easily be loaded from a file, using the Menu choise shown in the picture.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 16, 2015, 04:47:11 PM
sketch me symbol(s) and scan them that you want to use and I'll make it happen.
All I was doing was building a code structure
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 16, 2015, 05:18:16 PM
changed the symbol, color and text location for ground station
changed the symbol and color for home station
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 16, 2015, 10:24:10 PM
I was giving some thought to these two items:
Quote12 - Show Ground Station names and frequencies by pressing a key
     when cursor is over it. Remove text when releasing key.

13 - Show plane ID's by pressing a key when cursor is over it.
     Remove text when releasing key.

Previously I had been thinking of extracting the lat and long info from your log files and storing it as it as
QuoteUA0101  LAT 55 27 32  N  LON 6 17 3  W
or more precisely
QuoteUA0101  55 27 32  N  6 17 3  W 127

Then when it is time to update the display I would read this internal data file(maybe a linked list) and feed the coordinates to the calc to get the x,y point to display. The 127 value shown above is the calculated heading based upon two consecutive locations so the pointer on the plane symbol can be positioned properly.

In order to click on a point on a screen and see if it is a plane or a ground station we'd have to reverse the process.
Take the x,y point, send it to a calc that converts it to a lat/long format and then go thru all the planes and ground stations looking for a close match.  In my opinion with rounding errors and such that would be hit and miss and extremely slow.

What I propose is that when extracting the info from the log file the conversion to the x,y coord be done at that time.
Then that would be stored as
Quote192, 204, UA0101  55 27 32  N  6 17 3  W 127
Then when it is time to display the only adj that needs to be made is for scaling.
And when single clicking a quick initial proximity search for close 'x' saved to a linked-list followed by a search of that linked-list for close 'y' gives you a match if there is one. (that thought process needs to be optimized).

I think this scheme would pretty much lock you in to these images though.  Let me know your thoughts before I spend time on the code.

Title: Re: Changing brightness of a background image???
Post by: Egil on April 17, 2015, 05:02:25 AM
Quote from: LarryMc on April 16, 2015, 10:24:10 PM

What I propose is that when extracting the info from the log file the conversion to the x,y coord be done at that time.
Then that would be stored as
Quote192, 204, UA0101  55 27 32  N  6 17 3  W 127
Then when it is time to display the only adj that needs to be made is for scaling.
And when single clicking a quick initial proximity search for close 'x' saved to a linked-list followed by a search of that linked-list for close 'y' gives you a match if there is one. (that thought process needs to be optimized).

I think this scheme would pretty much lock you in to these images though.  Let me know your thoughts before I spend time on the code.





That is a very good idea, and I like the idea of a linked list. I have no experience with such a list myself, only read about it. But reckon using a linked list wil be ideal for showing a chronological log in a grid.
And the map we use right now is ideal for this application. Why not just go ahead and get some experience with using this program, and think of possible changes when and if we ever think of other applications.

I can see several other applications where this sceme fits right in. I am always thinking amateurradio, so a program for satellite tracking (which ignited this idea), and a program for showing callsign areas, antenna beam directions, distance calculation and showing greyline. (Graham made such a program several years ago using CB)
And I am sure other can think of many other applications....


Having pc problems here today, if a compile displays warnings or errors, I am not allowed to  doubleclick them to inspect the line in question.  Instead a line saying Access denied. In addition I noticed that when trying to  run the LogFix program (posted in another  topic the other day), which I plan to incorporate in MapView, it does not write to the new logfile. And though I do not  get any error messages, I think that is part of the same problem. The LogFix program and four instances of the PC-HFDL decoder program have been running in the background for hours every day on this pc, just to be sure that all work ok, so do not undeerstand why this is happening now. So today there will be a lot of head scratching here...


Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 10:36:50 AM
I guess it seems I'm trying to take over your project but I'm really not.
I'm just trying to help you set up a framework for you to be able to do what you want to do.

Since I feel you will need an ini file to hold your configuration information I'm going to add those supporting subroutines.
That means I am going to change the basic structure of your program over to a "project".
In the long run it will make your program more modular and it will help you convert it to the other uses you mentioned later on.

So, I will proceed with the structure I described above which begins with reading and extracting aircraft info from the March28.txt file you gave me.

Title: Re: Changing brightness of a background image???
Post by: Egil on April 17, 2015, 12:22:26 PM
QuoteI guess it seems I'm trying to take over your project but I'm really not.
I'm just trying to help you set up a framework for you to be able to do what you want to do.

I have no such thoughts, Larry, and is grateful for all help I can get. Especcially now, with only one hand to do the typing. (In fact most of the time is spent correcting all the typos I do.... :-\)

QuoteSince I feel you will need an ini file to hold your configuration information I'm going to add those supporting subroutines.
That means I am going to change the basic structure of your program over to a "project".
In the long run it will make your program more modular and it will help you convert it to the other uses you mentioned later on.

You are most probably right. And I get a nice example on how to work with projects. The few former attempts to do that, have resulted in working with everything in one file because of all  the definitions I do wrong. I have read the tutorial you did on projects some months ago, but still I've not got it  right.


Here, I found my computer full of all sorts of crap. Seems it has been like that since wednesday morning. All my work on this pc since then have been reading and answering email, and using IWB. And found all the files I have used IWB to modify are more or less corrupt. So was several files in the IWB bin directory.
I had to uninstall IWB, and then do a proper cleanup on the computer, using JRT And WiseCare365. Then I chose a restore point from monday last. And after a cold restart of the computer, I found nothing wrong. So later tonight I will reinstall IWB. Last backup was made monday, and thereafter the latest restore point was made. So If I don't get things right now, I'll use the backup to restore the pc.

Probably got the malware when visiting some radio pages wednesday morning.m Followed some links that turned out to be bad when visiting a site on the qsl.net. And if I ever am lucky to meet a person making this cap, you know what I'm going to do... >:( >:(


Egil
Title: Re: Changing brightness of a background image???
Post by: Egil on April 17, 2015, 01:41:38 PM
Reinstalled IWB, and now it appears to work ok. But I still get the "No Access" message when trying to click on compiler warnings on the files made by LarryMc. Do not understand why.
Had to discard the UDP and LogFix routines I had modified for instertion in the MapView program. But that is no deal, as I still have the original files.

These two will be imported onto the project Larry is setting up. And in that connection I have one question: Can I use the global variables in these two files locally in each module, and only define as global those that have to be called from  or shared with the other modules? Or will there be a clash with variables using the same name?


Egil


Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 02:27:03 PM
if they are in different modules(source files) and haven't been made global then there should be no problem.
I'll be happy to help you merge the pieces into the "project" I am building(at this very moment) for you.

BTW, I sent you an email you need to respond to.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 03:08:36 PM
Attached is exe file where I've made the zoom in double of what it was. Let me know what you think.
With this level of zoom it will spread things out a little more but it slows scrolling down some.
you have 3 choices.
1. leave it like this
2. leave it like it was
3. give the user a menu option to switch to which to which ever one they like  ;D :o ;D
Title: Re: Changing brightness of a background image???
Post by: Egil on April 17, 2015, 04:19:22 PM
If it is not too much work, I kind of like option 3.

But I noticed a small snag, The positions are plotted a little south and west of their actual positions, and the error grows the further east on the map the positions are. I guess this comes  from rounding errors in the scaling of the pictures. This is ssomething we need to look into.

For the original size of the map (3600 x 1800 pixels) one degree is ten pixels wide both in N-S direction E-W. This means that degrees with one decimal is the highest resolution we can obtain when plotting.
So do you think converting the positions to degrees with one decimal before plotting will decrease update plot time?

Its over midnight here now, and I always wake up at five, so now I need some sleep.


Egil

Title: Re: Changing brightness of a background image???
Post by: Bill-Bo on April 17, 2015, 05:50:42 PM
LarryMc,

Mapview3 does not run for me. It cannot find the devil.dll.

Bill
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 05:56:29 PM
Quote from: Bill-Bo on April 17, 2015, 05:50:42 PM
LarryMc,

Mapview3 does not run for me. It cannot find the devil.dll.

Bill
you'll have to download one of the earliest zips in the thread that I posted to get all the other supporting files you need.
Or, if you had previously downloaded and compiled mapview just plug this exe file into that folder.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 06:00:35 PM
Quote from: Egil on April 17, 2015, 04:19:22 PM
If it is not too much work, I kind of like option 3.

But I noticed a small snag, The positions are plotted a little south and west of their actual positions, and the error grows the further east on the map the positions are. I guess this comes  from rounding errors in the scaling of the pictures. This is ssomething we need to look into.

I like option 3 also and had already decided I was going to put it in and let you take it out if you didn't like it.

I'll look into the position error and see what I can find.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 17, 2015, 10:39:35 PM
Quote from: Egil on April 17, 2015, 04:19:22 PM
But I noticed a small snag, The positions are plotted a little south and west of their actual positions, and the error grows the further east on the map the positions are.

Duh! ::) ::)
I never finish my conversion subroutine!!!

I haven't added the adjustment for minutes and secs yet.  Let me get that in there and see how close we are.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 03:55:04 AM
Larry:

As mentioned earlier, we have no guarantee  that the map edges are accurate. But we have to use this one, as long as none of the web map servers allow us to download a calibrated map showing the whole world. I guess this is one of the reasons why the "professionals" use zero longitude and the Equator as a reference. Possible errors near the edges are then half of the amount compared to using 180W 90N as reference.
But this is something we can somehow adjust ourselves when the program is completed. It is an easy task to adjust a pixel ot three by stretching or crimping height and width of the drawing and keeping the picture dimentions same as before. PlanePlotter uses another approach for this. They use a manual calibration routine, where the plotted items all are dragged around with the mouse, and when the user is satified, the program makes a new calibration file.

Anyway this application is not meant for navigation, so we must somehow accept some offset.


Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 05:11:19 AM
After finishing calc subroutine it looks spot on to me right now.

give me a couple of points you want to check and I'll plot them and post a screenshot.

I'm in he middle of building the 'project' and adding some features so it isn't a good time to send you the code.
Title: Re: Changing brightness of a background image???
Post by: Brian on April 18, 2015, 05:24:27 AM
I am most interested in this project, seeing as I run Flightradar24 most days, but I am finding
that this technical talk is going right above my head, and probably at cruising height!

Brian
Title: Re: Changing brightness of a background image???
Post by: Bill-Bo on April 18, 2015, 05:31:43 AM
LarryMc,

Okay, I'm straight now. There's one thing though. Why does a second window (black) behind and to the upper left?

Bill
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 06:01:09 AM
that's my trouble shooting console window.  when I need to see what a value is I just print it to that console window.
It won't be there in the finished product.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 06:03:27 AM
Quote from: Brian Pugh on April 18, 2015, 05:24:27 AM
I am most interested in this project, seeing as I run Flightradar24 most days, but I am finding
that this technical talk is going right above my head, and probably at cruising height!

Brian


above my head to but I'm faking it. ;D ;D
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 06:31:10 AM
Brian:

As a good englishman you should rather support and use a british project instead of FlightRadar24. There are a couple of clever young guys in the Southampton area running a competing website: planefinder.net (http://planefinder.net).
They are really nice guys, and as far as I know, they do programming for a living. And the plots from central parts of Norway and to some extent Sweden, are decoded and shared with them by yours truly. I have a small vertical antenna just outside my upstairs bedroom window, to feed the decoder which is just another fast AD converter plus some smart pc software, all british made. And for your information, all such kind of coding/decoding (HFDL, ADSB, AIS etc) rely heavily on bitstuffing.

I there is any interrest, I can post an EB console example I made several years ago, demonstrating what a 14 byte long NMEA-0183 sentence from an AIS-decoder really meant when converted to plain language. That was an eye opener to me, and showed how much information that really can be losslessly compressed into a small sentence just by manipulating bits.


Larry:

My smartphone GPS gives my location like this:

63 06.2700 N
007 39.0300 E

Converted to the format similar to what the planes use:

63 06 16 N
007 39 02 E

I have indicated my position with a red dot on the map below, so you can test it yourself when you get around to it. Done the same with the position of Oslo.


Egil

Title: Re: Changing brightness of a background image???
Post by: Brian on April 18, 2015, 06:46:47 AM
Egil

I'll have a look at that - didn't know who produced Flightradar24, anyway

Glad you called me "English" - whenever I am asked my nationality I always say English. To me,
British means you could be either English, Scottish, Welsh or Irish

Glad to say I am English, even though my surname is Welsh!

Brian
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 06:58:26 AM
Larry:
I have often noticed that some airliners never manage to set their flight computer clocks to UTC. Which means that the timestamps they transmit when reporting their positions are wrong. (The transmissions shown in the log preceded by [HFNPDU PERFORMANCE]). So maybe I shall replace all timestamps with the pc's system clock.

These are mostly east european and pakistani airliners, but also some charter plane companies from south america. Aeroflot planes, and other companies that was formerly asociated with them, extensively use Moscow time. And the others seem to pick a time by random.

I wonder if their passenger would trust these companies enough to fly with them if they knew that the companies' maintenance crews don't know how to set the flight cumputers right!

Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 07:02:37 AM
Quote from: Brian Pugh on April 18, 2015, 06:46:47 AM
Glad you called me "English" - whenever I am asked my nationality I always say English. To me,
British means you could be either English, Scottish, Welsh or Irish

Glad to say I am English, even though my surname is Welsh!

Brian

Well, I've been enough on the British Isles to know that nationality is a very important matter, but forunately most of "the others" are proud if I call them english. ;D ;D ;D
Except in Ireland...

Egil
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 09:33:49 AM
What do you think? The center of the triangle is the target.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 09:40:59 AM
for Oslo I was using 10 45 8 E 59 54 50 N

Looks pretty close to me
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 10:19:59 AM
That's close enough Larry, great!

Right now I'm having a look at the UDP routines. I have all the UDP routines in an inc file. and guess we can use that file directly when converting to a project. I am going to use them to set up a UDP "listener", listening for input on a single, specified port. These are routines that can be activated at program startup, and then forget them as the receiver works in the background in its own thread. Have to decide if UDP send routines also should be included. This may come in handy for people using decoders on multiple computers running PC-HFDL.

What do you think of a set of program routines that can be called automaticly if no config or ini file is present, then use a dialog to set up UDP, the wanted number of logfiles to read, and the paths to these logfiles and  paths to any other utility files, such as GroundStations, HomePosition and possibly a simple database of plane information collected from "the air". And by not restricting the mumber of logfiles to four, decoders using SDR receivers of the USB-stick kind, can use as many as they want, as long as they don't run out of CPU.
When all the parameters are set, the program can start. And then stop operations and get the setup dialog visible, to make any changes, and then save and start operations again.

Then, the next time the program starts the mentioned config file is used for operations.

I have tried to do part of this in the LogFix program posted in another  thread, a little clumsy, but it works. Tonight I'll try finish a simple user manual for the LogFix program, as several of the decoding enthusiasts already are using the program, and ask for a user guide.  Most of the LogFix routines need to be included in the MapView program.


Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 10:42:27 AM
Sounds like a plan except for code in an 'inc' file. We'll simply change that to an iwb file.
I've already added the code for reading/writing ini files so that is in place.

What I'm working on right now:
1) two different window sizes selectable by the user and optimized for the image size done
2) two different zoom levels selectable by the user (requires program restart) done
3) reading those selections from ini file done
4) reading display of a/c, base, home from ini file done
5) reading bg shading from ini file done
6) writing all the about values to ini file at appropriate time done
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 11:46:25 AM
OK Larry.

Seems like you are working much faster than me. :D :D
Because of the painkillers I have to use to calm down the hip pain, my brain is presently running slow ahead only...
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 18, 2015, 11:49:40 AM
Quote from: Egil on April 18, 2015, 11:46:25 AM
OK Larry.

Seems like you are working much faster than me. :D :D
Because of the painkillers I have to use to calm down the hip pain, my brain is presently running slow ahead only...

I'm just doing what I know how to do.  I'll hit a point where you'll be pretty much on your on before long because I don't have any radio recievers.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 18, 2015, 11:55:42 AM
I know..... :-\
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 19, 2015, 09:52:09 AM
TAAA-DAAA!!
Attached is the 'project'
I suggest you put the contents of the zip in a new folder.
It has a working ini file that remembers selected options between sessions.
User can select from 2 different window sizes and two different zoom levels
The dialog to allow the user to set their home base location is working.

I'm through with the basic home base code.
Later it will need error checking code added to make sure valid lat and long values are entered.

The next code I'll work on is to read the ground stations and their freq and displaying the info on the screen.
Might be a little slow this coming week.  My wife has cataract surgery thurs and if all goes well she'll have her other eye done a couple of weeks later.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 19, 2015, 10:42:09 AM
Thanks Larry!

You have done a really  great job. And I am going to learn a lot from seeing the way you code.
And you really deserve to take it easy for a while.
Myself have a lot of catching up to do  as well. I'm having an x-ray of my arm on tuesday, so hope to get rid of the anoying plaster on my arm at the same time.
Typing with this harness has been a nightmare. And I won' even mention how it has been at night, trying to sleep.

Now I'll download your code and have a look at it.


Egil

Title: Re: Changing brightness of a background image???
Post by: Bill-Bo on April 19, 2015, 05:44:48 PM
Egil,

That planefinder.net site is outstanding!!

Bill
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 19, 2015, 10:26:00 PM
Egil

I'm using the file you created called System Table.txt as the input source data file for creating the ground station displays.
I have changed the name to SystemTable.txt (removed the space and placed the file in a subfolder called data under the folder mapview.exe is in.)
However you are generating that text file don't change it or you will destroy my code.
I'm decoding that file and creating an ini file that is loaded each time mapview is started and can also be updated at any other time you so desire.  Any time the display needs to be updated the ini file is looked at.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 01:08:29 AM
Do we have any idea what the max number of freq a ground station can have is?
In one picture you had the frq were displayed directly on the screen.
I think a popup window will be a lot better and less overall clutter, if you really need to see the freq.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 02:41:24 AM
Larry:

The max number of frequencies for each Ground Station is set by the system to 20.
As far as I remember,  the only station ever set up with that maximum is Riverhead - New York.

I attach systable49, which is the systable presently in use. This file is generated by PC-HFDL, and whenever there are changes in the GroundStation setup, a new such table is broadcast by the groundstations. Guess we are soon up for another change, as the present one has been in use for almost three years now. There are always several of the decoders manageto pick up the new files when they are transmitted, and they post their findings on the HFDL Yahoo Group. The actual file is in a binary format, and the plain text file is generated/translated from the binary one.

The map really looks great!


Bill:
I agree! I have been taking part in collecting data for it since they started some years ago. And they have done a great job to achieve the present state of the site.




Egil
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 02:59:55 AM
Larry,
Almost forgot... A popup window would be the best.


At present I am studying your code, trying to understand how to use that graphics library, as that may come in handy for later projects. And think I am starting to see how things work.
But since the people that made that library, like us, had to use the windows API to make it, I can't help thinking that the  same routines could be done using plain IWB code. But at the same time I see that the library saves us a lot of time.
When this project is up and going, I think I'll experiment a little, to see how I can do such shape drawing routines myself. Frankly, I have been thinking of that for some time, but never got around to start.


Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 05:10:21 AM
I know you have probably already told me.
On the txt file containing plane positions, how often is that file created so that I'll have access to it to decode it so that I can update the display data?
Or is that data going to be fed to me real time from your listener code?
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 06:26:28 AM
Was planning to update planepositions once a minute, reading them from the logfile I sent you.

Each "channel" monitored (each instance of PC-HFDL) makes its own logfile. These files are checked every five seconds, and any new contents is appended to the logfile you read from.
Any input arriving at the UDP port we set up to "listen" to, will also be appended to this file.
By collecting all data in that particular logfile, allows for using the data with several other shareware programs, all using a file with that name as a data source.

Just for fun, I converted the only "shape" file i ever made for this purpose in MiniBASIC to IWBasic.
When compiled with IWB, and using the same world map, the shapes does not always fill with color when drawn. I do not understand why.
As the method plots fast, it is something I will look into when this program is finished. Do not know if I ever go to use it though. Posting the code below.


Egil





AutoDefine "Off"

def win:window  
def i,handle,run,wstyle,mapleft,maptop,pw,ph:int  
wstyle = @minbox '|@maxbox

' Create a window ..  
OpenWindow win,0,0,1000,500,@minbox,0,"IWB Skeleton Window",&messages  
run = 1  

GETCLIENTSIZE win,mapleft,maptop,pw,ph ' finding available area for drawing
handle = LOADIMAGE ("world.jpg", @IMGSCALABLE)
SHOWIMAGE win,handle,@IMGSCALABLE,0,0,pw,ph  
for i = 1 to 150 ' 150 planes to plot
PlotPlanes(win,rand(10,990),rand(10,490),0,255,0,rand(0,35),15,240, 220,182)
next i

WAITUNTIL run = 0  
CLOSEWINDOW win  
END  

SUB messages(),int
SELECT @class

CASE @idcreate  
centerwindow win  

CASE @idclosewindow  
run = 0  
ENDSELECT  
RETURN  0
EndSub

'
'------------------------------------------------------------------------------------------------------
' To call, use:
' x,y      = center of shape
' sr,sg,sb = color of shape (RGB)
' course   = planes direction of travel (restricted to 10 degrees intervalls)
' headline = length of line indicating planes course
' lr,lg,lb = color of headline (RGB)
'------------------------------------------------------------------------------------------------------
sub PlotPlanes(window wnd,int x,int y,int sr,int sg,int sb,int course,int headline ,int lr, int lg,int lb)
int hdc
move wnd,x,y
hdc = gethdc(wnd)
line(wnd,x, y-3, x-3, y, rgb(sr,sg,sb))
line(wnd,x-3, y, x, y+3)
line(wnd,x, y+3, x+3, y)
line(wnd,x+3, y, x, y-3)
' ReleaseHDC(wnd,hdc)

' hdc = gethdc(wnd)
FloodFill wnd,x,y,RGB(sr,sg,sb)
ReleaseHDC(wnd,hdc)
move wnd,x,y
frontpen wnd,rgb(lr,lg,lb)
LINETO wnd,x+headline * cosd(course*10),y+headline* sind(course*10)
RETURN
ENDSUB

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 06:40:11 AM
I also noticed in the file that the freq that the ground stations are currently using are being reported.
Are you wanting to capture that info so not only are all the freq listed in the popup window the in-use freq will be flagged also?
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 06:49:34 AM
Yes. The "squitter broadcasts", sent every 33 seconds, contains a station ID with active frequencies for the transmitting stations plus two other groundstastions. The two other graoundstations are changed for every broadcast, just by stepping through the stationlist.
All frequency changes are transmitted in these broadcasts, couple of minutes before they are changed. This way the planes software can can changne tom the new frequency or log on to another ground stations. But planes working on a channel that "dissapears", whether frequency change or radio propagation is the cause, have to change to a new frequency anyway, but if they catch the frequency change, this change s done more faster.


Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 06:58:58 AM
Since we'll only be updating the plane file every minute and the grnd stations are changing every 33 secs we'll be lagging just a bit behind.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 07:15:10 AM
The planefile can be upated after every update of the logfile, during the 5 seconds interval between two logfile updates.
Then the map is updated once a minute. We can update the map "live", but since there are at least four other programs collecting data for the logfile Mapview reads, things will be more relaxed this way.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 07:34:46 AM
okay, I'm getting confused about what information I'm pulling from what file and when.

I need a constant file name to pull data from.  Doesn't matter to me how many files or how you generate the files.
They also need to be in a constant format.

So far you have sent me these 3 files
QuoteSystem Table.txt
April18.txt
March28.txt

I used System Table.txt as my source file for creating my ini file I use in generating the ground station display.
I don't care where it came from or how you create it  but I need it to have a fixed name from now on or we're going to have to make its name a configuration option.

The other 2 files are the same format.  Right now that is the source of ALL my other information and I'm expecting you to provide me with a new file(with a constant name) every minute for me to read and process.
From that file I will get the plane ID and location, calculate the heading, and capture the current active freq of the ground stations.

Other than that I don't know anything about any other files or data.
How far mis-matched are we?


Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 08:02:44 AM
Most of the routines from the LogFix program (posted here: http://www.ionicwind.com/forums/index.php?topic=5629.0) will be included in the MapView program.

Below is the sub I use for generating logfile names that change with the UTC dates. This is the same naming convention PC-HFDL uses.
I call it like this:

def Log$:string

Log$ = LogName()




'
'-------------------------------------------------------------------------------
' SUB LogName(),string    
' Generates PC-HFDL logname
' 'windows.inc' must be included before calling
'-------------------------------------------------------------------------------
SUB LogName(),string
string month,day
int t_mnd
DEF n_mnd[12]:string
n_mnd = "January","February","March","April","May","June",_
"July","August","September","October","November","December"

SYSTEMTIME st
_GetSystemTime(st)
month = STR$(st.wMonth)
day = STR$(st.wDay)
t_mnd = val(month)
day = RIGHT$(day,2)
IF VAL(day) < 10 THEN day = "0" + RIGHT$(day,1)
RETURN n_mnd[t_mnd-1] + day + ".txt"
ENDSUB
'-------------------------------------------------------------------------------




But you are way ahead of me with the programming, and I have not yet come around to prepare that module.


Egil

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 08:58:51 AM
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.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 09:14:26 AM
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?
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 09:39:57 AM
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
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 09:47:50 AM
ok, sounds like a plan
we'll figure out the "trigger" later
now I can go ahead with my coding
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 11:05:39 AM
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?




Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 12:06:45 PM
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
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 12:24:49 PM
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
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 20, 2015, 01:03:59 PM
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?
Title: Re: Changing brightness of a background image???
Post by: Egil on April 20, 2015, 01:24:17 PM
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.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 21, 2015, 11:39:44 AM
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.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 21, 2015, 01:56:57 PM
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
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 21, 2015, 06:33:44 PM
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. ;)

Title: Re: Changing brightness of a background image???
Post by: Egil on April 22, 2015, 04:01:37 AM
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...
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 23, 2015, 07:31:56 AM
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.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 23, 2015, 07:38:17 AM
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.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 23, 2015, 08:56:06 AM
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
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 24, 2015, 10:52:22 PM
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.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 25, 2015, 04:28:09 AM
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
'------------------------------------------------------------------------------------------------------

Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 25, 2015, 08:41:41 AM
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.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 25, 2015, 10:07:17 AM
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.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 25, 2015, 06:40:44 PM
This screenshot shows your new symbols in my code.
I'm also using your new world.jpg(lighter version) as the basic background.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 25, 2015, 06:43:44 PM
this shows your new plane symbols in the 3 different map versions with text to side
data is from a real monthly .txt file
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 25, 2015, 06:52:12 PM
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.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 26, 2015, 12:01:35 AM
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.
Title: Re: Changing brightness of a background image???
Post by: Egil on April 26, 2015, 02:35:19 AM
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
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 26, 2015, 05:37:43 PM
FINALLY, got the subroutine algorithm finished that returns the lat/long of the mouse pointer when the 'g' or 'p' key is clicked regardless of which of the 3 map views is displayed.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 27, 2015, 07:13:27 AM
Finished ~90% of the code for displaying the flight info when you press the 'p' key while the cursor is over a plane symbol.
I used a Listbox control but it is giving me alignment problems on the text so I'll convert it over to a Listview and that will take care of that.

What I did discover is that there seems to be some sort of error in my calculation for the heading when the pointer is pointing to the 11 o'clock position(as you can see from the bogus number in the screen shot).  Will have to figure that out.

Won't get much else done today.  Have to go get my legs ultra sounded today to see if maybe we can balloon them to help the circulation and improve the feeling in my lower legs and feet.  Got to where my feet 'burn' almost all the time.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 27, 2015, 07:59:47 AM
with a listview
Title: Re: Changing brightness of a background image???
Post by: LarryMc on April 30, 2015, 12:44:32 PM
got the problem fixed; had to do with tan of 90 degrees (divide by zero)
addressed special cases hdg N,S,E,W, and not moving ns, or ew, or both.
added lat and lon to popup display.

now working on ground station popup and active freq.

when I get through with that I will post all the new code
probably tomorow
Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 02, 2015, 09:15:56 AM
Attached is the complete project.
Unzip to a new folder.
Popup windows work for both ground stations and planes.

on the ground stations I still need to extract the locked freq from the 1 minute update file and update the grnd.ini file so the ground station popup will show an "*" to the left of the active freq.
Title: Re: Changing brightness of a background image???
Post by: Egil on May 02, 2015, 11:25:08 AM
Thanks Larry!

This is a great way for me to learn working in projects mode. I have tried before,  but only half hearted, and have dropped working with projects as soon as I ran into trouble, and finished my code using a single file.

Returned back home thursday night (we are seven hours ahead of you here), and have not yet recoverred after all the stress in Bergen. Guess it will still take a couple of days before I am back in proper programming mood. And there is a lot of stuff in your project I have to study in detail trying to understand...
So please promise not to laugh when I start posting stupid questions.


Regards,
Egil.


Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 05, 2015, 10:56:55 PM
Finished the code that extracts the ground station active freqs. and stores the info in the grnd.ini file.
Since I'm using the same routine at startup as I do every minute to read the data update ( and right now my data file is for a whole day) it is making startup initilization a little slow.  When everything is done it will only be the last minutes worth of data so it won't be that slow.

I put the update routine in its own file called min_update.iwb. 

So now, when you put the cursor on a ground station symbol and hit the 'g' key the popup window will list all the freqs and the active freqs will have a '*' by the freq.

You can can unzip the attached on top on the previous code and all should be fine.
But the zip contains everything you need to put it in a completely new location.

I guess I through for now until you come up with a new requirement of some sort of need some sort of 'fix'.
Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 02:34:04 AM
Now you really deserve a little rest Larry!
You have done all the hard parts of this project, and I hope you will bear over with my presently slow working speed.
My poor brain has not yet absorbed all the finer details of your last posts. But now I am beginning to understand the way you think... :D
That makes it a little easier to follow your code.


Regards,
Egil


Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 04:28:10 AM
Larry,

Tried to compile your code for the first time just now. But I get several error messages saying that the file LList.inc can't be found.
Can't find this file in any of your postings, so when you get  the time, can you please post that file (and any other files starting with LList)?

Regards,
Egil.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 06:33:34 AM
I',m not using that file anywhere Egil.

Download my last upload and upload and unzip it in a new empty folder and try to compile the project.
If if won't compile then copy the contents of the output window and post it so I can see it.
Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 08:27:13 AM
My bad Egil ::) ::)
In the beginning I was planning on using a linked list but I never did.
In the globals.iwb file you can remove these two lines and every thing will be fine.
$use "LList.lib"
$include "LList.inc"

Sorry about that. :'(
Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 08:46:48 AM
Thanks Larry, will delete the two lines and try again.  ;D

When I fully understand what you have done, I'll start adding my own routines (and cross my fingers.... ::))
Laid on the couch most of the day here, but fortunately they are broadcasting cycling from Dunkerque.

Regards,
Egil.

Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 08:54:48 AM
When you get the code ready that will write the one-minute update file I'll show you how to trigger what I've done to read it and do the update.  Just let me know when you are ready.
Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 09:05:23 AM
Compiling fine now Larry, but warning about duplicate declarations (file attached).
Will let you know when I have finished including my code. But be warned, working rather slow here... But hen I guess you need a little vacation after all the hard work you've done for me. 8)
Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 09:16:09 AM
I don't get those warnings
I'll see if I can figure out why you are getting them.

I'm assuming you downloaded and installed IWB3.0 from your customers page?

can you tell me the time stamp and size on the two files so I can compare them against mine?
QuoteC:\Program Files (x86)\IWBDev3\include\unknwn.inc
C:\Program Files (x86)\IWBDev3\bin\iwbstd.incc
Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 09:23:29 AM
iwb2d.incc:  11.02.2011 - 7.50 kB
unknwn.inc: 13.04.2011 - 1.87 kB

I can download the Setup again, if there are any changes in these two files.


Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 09:33:28 AM
Downloaded the setup file again, and installed over the old one.
But the warning did not dissapear. The compiled program works pretty nice though, so I do not really care.


Regards,
Egil.

Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 11:31:33 AM
Quote from: Egil on May 06, 2015, 09:33:28 AM
The compiled program works pretty nice though, so I do not really care.
But I care ;)
I don't like stray warnings...
Title: Re: Changing brightness of a background image???
Post by: LarryMc on May 06, 2015, 12:13:18 PM
OK, found the problem. It only happens when using the windowssdk.inc file and the fix is already there but it was left out of 3.o by oversight.  It will be taken care of in the next (official)release.
Title: Re: Changing brightness of a background image???
Post by: Egil on May 06, 2015, 12:23:12 PM
Had issues like  this with the former IWB version, when both windows.inc and windowssdk.inc was included, but this is the very first time I have seen it with this version.

Egil