AutoHotkey Community

It is currently May 26th, 2012, 8:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 13th, 2005, 10:59 am 
@ Invalid User
Quote:
m-tzone.jpg
Would you mind to provide that image ? Than there's a better chance we can have a look/test. Thx for your effort, much appreciated ! :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 10:09 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
right now I am edit that scipt for the full size image I got from the link of the first map, I am not don yet but I should be done in about 2 hours. And I am already seeing an issue. The image is very very large, is there some way I could have the coords shown based on the x0 y0 of the image so that adding a scroll feature to see different parts of the map would still have an acurrate GPS coord shown?

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 2:56 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
I have gotten the Scroll feature done and now cant get the mouse to calibrate on the map. It seems its just the concepts I cant get down....shame shame

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 4:54 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
ok here it is

Code:
; Displays ToolTip With GPS choords on map
ImgPosX = 0
ImgPosY = 0

HOffSet = 967
WOffSet = 1325
;-----------------------------
SetTimer, FindCoords, 50
Gui, +Resize
Gui, Add, Picture, vMap x0 y0 , C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
Gui, Show, x53 y191 h608 w1167, GPS Coords
;Return


FindCoords:
WinGetActiveStats, ActiveTitle, Width, Height, X, Y
;ToolTip,
If ActiveTitle = GPS Coords
{
   MouseGetPos, MouseX, MouseY
   MouseY -= 11 ;offset for the mouse due to the Title height
   MouseY -= %HOffSet% ;place 0,0 at proper coord on map
   MOuseX -= %WOffSet%

;--the problem lies here \|/7777777777777777777777777777777
   MouseY /= 3.141592
   MouseX /= 3.141592
;--the problem lies here /|\7777777777777777777777777777777

   Xcoord = %MouseX%
   Ycoord = %MOuseY%
;-----------Tell north south east and west value based on coord result
   If Xcoord < 0
   {
      EastWest = East
   }
   If Xcoord > 0
   {
      EastWest = West
   }
   If Xcoord = 0
   {
      EastWest =
   }
;----------------------------
   If Ycoord < 0
   {
      NorthSouth = South
   }   
   If Ycoord > 0
   {
      NorthSouth = North
   }
   If Ycoord = 0
   {
      NorthSouth =
   }
;--------------------------
   ToolTip, GPS COORDS `nLatitude= %EastWest% %Xcoord%`, Longitude= %NorthSouth% %Ycoord%
   Return
}
If ActiveTitle <> GPS Coords
{
   ToolTip,
   Return
}
Else
   Return
;---------------------------
;CONTROLS MAP TO SCROLL
;IN A DIRECTION
;
;CONTROL + ARROW to scroll
;---------------------------
;OffSet + 5 keeps the coords acurate even when scrolling
;---------------------------
^w:: ;UP
ImgPosY -= 5
HOffSet -= 5
GuiControl, Move, Map, x%ImgPosX% y%ImgPosY% ;C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
Return
;----------
^s:: ;DOWN
ImgPosY += 5
HOffSet += 5
GuiControl, Move, Map, x%ImgPosX% y%ImgPosY% ;C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
Return
;----------
^a:: ;LEFT
ImgPosX -= 5
WOffSet -= 5
GuiControl, Move, Map, x%ImgPosX% y%ImgPosY% ;C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
Return
;----------
^d:: ;RIGHT
ImgPosX += 5
WOffSet += 5
GuiControl, Move, Map, x%ImgPosX% y%ImgPosY% ;C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
Return

;--------RESIZE MAP TO WINDOW SIZE--------
;--------THIS IS COMMENTED OUT DUE TO RESIZING CAUSINGTHE GPS COORDS TO BECOME VERY INACCURATE
;GuiSize:
;SetEnv, W, *w%A_GuiWidth%
;SetEnv, H, *h%A_GuiHeight%
;GuiControl,,Map, %W% %H% C:\Documents and Settings\Owner\My Documents\My Pictures\m-tzone.jpg
;Return
;----------RESETS DEFAULT WINDOW SIZE------
!#R:: ;Win+Ctrl+R to resize map to default Size
WinMove, GPS Coords,,,, 1167, 608
Return


GuiClose:
ExitApp

here is the problem...the earth is round, and I am looking at a flat image. so why doesnt dividing by pie give acurate coords? I need some help here, I am just no good at math and its concepts

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 5:15 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Dividing by pi? :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 6:32 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
yes the earth is round, so divide by pi

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 6:49 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
It doesn't make sense to me, but oh well.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 7:09 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
ok the earth is round, so divide by pie, now the mouse is calibrated at 0, 0 on the map, now every pix is 1 degree, this isnt right because on the map every 115 pix is 15 degree on the map....getting this thing to be dead on is alot of trial and error

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 7:23 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Wouldn't it be simpler to write a script that writes a script that maps each pixel to a coordinate individually? :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2005, 4:32 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
of course I cant get this thing accurate, the Y axis on this map isnt linear, DUH

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2005, 9:21 am 
Remember the initial subject: to get a map which shows where AHK users live on that planet (and yes, if it shows that most of them are neighbours of jonny (Minesotta) or Rajat (India) there's nothing against to found a native language speaking subforum :wink:)

The incredible toralf has coded a script based on this tool ---> [gnuplot].

8tung! These two files mentioned below (which are included within the gnuplot package, check the link above) have to be in the same directory/folder as the script!!!

---> wgnuplot.exe
---> world.dat

A text file with the users name, location, longitude and latitude has to be imported. It should look like this:
Code:
;User, Place, Longitude, Latitude
toralf, Stuttgart, 9.11E, 48.46N
BoBo, Frankturt/M, 8.40E, 50.07N
Thalon, Wels, 14.03E, 48.17N

For unknown reason the refresh of the created image isn't working properly :shock: . Nevertheless, once the GUI is reloaded the image shows up as expected. Go and tweak that code !!! :D

Code:
WinNameGui1 = AHK User Distribution MAP

Gui, 1:Add, Text, vTxtIntro w250, AHK Users and their location
Gui, 1:Add, ListView, r20 w250, User|Location|Longitude|Latitude
Gui, 1:Add, Button, Section gBtnImport, &Import list
Gui, 1:Add, Button, ys gBtnUpdate , &Update map
Gui, 1:Add, Button, ys gBtnClose , &Close
Gui, 1:Add, Picture, ym vPicDistroMap w600 h350, AHKdistroMap.png

Gui, 1:Show, , %WinNameGui1%
Return

BtnImport:
    Gui, 1:+OwnDialogs
    FileSelectFile, SelectedFile , 3, , Please select file with list of locations, Text files (*.txt)
    IfExist, %SelectedFile%
        GoSub, ReadFile
Return

ReadFile:
  LV_Delete()
  i = 0
  Loop, Read, %SelectedFile%
    {
      Line = %A_LoopReadLine%            ;remove spaces
      StringLeft, FirstChar, Line , 1
      If ( FirstChar = ";" )
          Continue
      StringSplit, Line, Line, `,
      LV_Add("",Line1,Line2,Line3,Line4)
      i++
    }
  GuiControl,1:,TxtIntro, %i% AHK Users and their location
  LV_ModifyCol()
Return

BtnUpdate:
  If (LV_GetCount() = 0)
      return
  GnuPlotScriptFilename = gnuplotfile
  PictureFileName = AHKdistroMap

  FileDelete, %GnuPlotScriptFilename%.gnuplot
  FileDelete, %GnuPlotScriptFilename%.cor
 
  FileAppend,
    (LTrim
       set terminal png transparent nocrop enhanced font arial 8 size 420,320
       set output '%PictureFileName%.png'
       set yzeroaxis lt 0 lw 1.000
       plot 'world.dat' with lines 3 4, '%GnuPlotScriptFilename%.cor' with points 1 2
     ), %GnuPlotScriptFilename%.gnuplot

  FileAppend, # latitude and longitude of AHK Users`n, %GnuPlotScriptFilename%.cor
  Loop, % LV_GetCount()        ;%
    {
      LV_GetText(User, A_index, 1)
      LV_GetText(Location, A_index, 2)
      LV_GetText(Longitude, A_index, 3)
      StringRight, Rose , Longitude, 1
      StringTrimRight, Longitude, Longitude, 1
      If (Rose = "W")
          Longitude := -1 * Longitude
      LV_GetText(Latitude, A_index, 4)
      StringRight, Rose , Latitude, 1
      StringTrimRight, Latitude, Latitude, 1
      If (Rose = "S")
          Latitude := -1 * Latitude
      FileAppend, %Longitude% %Latitude% # %User% at %Location%`n, %GnuPlotScriptFilename%.cor
    }
  FileAppend, #End of file`n, %GnuPlotScriptFilename%.cor
 
  runwait, wgnuplot.exe %GnuPlotScriptFilename%.gnuplot
  GuiControl, 1:, PicDistroMap, %PictureFileName%

  FileDelete, %GnuPlotScriptFilename%.gnuplot
  FileDelete, %GnuPlotScriptFilename%.cor
Return

BtnClose:
GuiEscape:
GuiClose:
    ExitApp
Return


If you wanna learn Deutsch (German) instead/as well, check the original thread --->[here]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2005, 11:40 am 
Offline

Joined: May 27th, 2005, 3:52 pm
Posts: 9
Hi,
Everyone how doesn't mind to make his location public is welcome to add himself to the list. Every once in a while we can update the picture.

Code:
;User, Place, Longitude, Latitude
toralf, Stuttgart, 9.11E, 48.46N
BoBo, Frankturt/M, 8.40E, 50.07N
Thalon, Wels, 14.03E, 48.17N
 , , ,
 , , ,


BTW: It's me, toralf. I'm using a public user Rajat has created (login: ahkuser password: ahkuser). So now you can edit this post, just login as "ahkuser".

Image
This picture is produced with this gnuplot script
Code:
set terminal png transparent nocrop enhanced font arial 8 size 420,320
set output '%PictureFileName%.png'
set yzeroaxis lt 0 lw 1.000
plot 'world.dat' with lines 3 4, '%GnuPlotScriptFilename%.cor' with points 1 2
Maybe there is someone out there who know hows gnuplot script and can make the image look more appealing.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, joetazz, Leef_me, Mickers, tidbit, tomoe_uehara, Yahoo [Bot] and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group