Hi all,
I'm develpoing a small tool using google COM API (I know it's obsolete somehow but it works though)and one of the tasks it does it's to get coordinates from a specific point.
I'm using this method:
//////////////////////////////////
GetPointOnTerrainFromScreenCoords(0,0)
Info about the method:
This method allows an external application to query the geolocation and terrain altitude of a point in the 3D viewpoint identified by its normalized screen coordinates (screen_x, screen_y), ranging from (-1, -1) to (+1, +1) inclusive.
Here are some examples:
(-1, -1) - bottom left hand corner of the screen.
(0,0) - center of the screen.
(1, 1) - top right hand corner of the screen.
//////////////////////////////////
to get the coordinates of the center screen but what I need is to get the coordinates based on the mouse cursor, I've spent much time searching to get the code in C# but I haven't found anything but this delphi code:
+LButton::
GE := ComObjCreate("GoogleEarth.ApplicationGE")
CoordMode, Mouse, Relative
Sleep, 100
MouseGetPos,MouseX ,MouseY , WhichWindow, WhichControl
ControlGetPos, RendX, RendY, RendW, RendH, %WhichControl%, ahk_id %WhichWindow%
ParamX := (((2*(MouseX - RendX)) / RendW ) - 1)
ParamY := -(((2*(MouseY - RendY)) / RendH ) - 1)
CursPos := GE.GetPointOnTerrainFromScreenCoords(ParamX,ParamY)
CursLat := CursPos.Latitude
CursLong := CursPos.Longitude
CursAlt := CursPos.Altitude
clipboard := Curslat . "," . CursLong . "," . CursAlt
msgbox, CursLat %CursLat%`nCursLong %CursLong%`nCursAlt %CursAlt%
So what I need now is to convert this block into C# so that I can use it knoing that I havent foung any working converting tool..
Much Thanks.