LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a map and compass

Can anyone please assist?
 
I need to create a map and on it indicate the direction to which an antenna is pointing.  The antenna is under control from the main CVI GUI using RS232 control - that part is working OK, and I can create a 'picture' map into which a 'jpg' map from Google Earth can be loaded.  The 'north' aspect of the map will always be pointing towards the top of the screen.
The problem comes when I try to draw a line on the map to indicate the direction that the antenna is pointing.   Can anyone help on how the  0 - 360 (-180 - 0 -+180) degrees about which the antenna can be controlled can be transferred to the map, drawing just a a line from a specific point on the map, reaching out to the actual periphery of the map?
 
Also, is there any way that a mouse click on the map could be converted into the 'degrees' to which the antenna has to be moved to point at that specific location on the map?
 
Many thanks in anticpation of some assistance,
 
Allen Cherry
0 Kudos
Message 1 of 3
(3,392 Views)
You could try changing your picture control to a canvas control on which lines can be easily drawn. Take a look at canvas.prj sample (<cvidir>\samples\userint folder) for an example of intercepting mouse coordinates on the canvas and line plotting on it.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,374 Views)

Hello,

I would agree with Roberto and use a canvas function to try and do this. Load the bitmap onto the canvas, then by using GetRelativeMouseState you will be able to extract the mouse co-ordinates from the canvas control you wish to target. When you get the X and the Y co-ords of the position you wish to compare against a set point you will need to calculate the difference of the X and Y values and using Complex numbers by converting the rectangular components to polar you will be returned a magnitude and an angle. Use ToPolar to achieve this found in the Advanced Analysis Library > Complex Operations >  Complex Numbers. Also by getting the X and Y components you will be able to draw lines, etc on your canvas.

If you are unsure of how complex numbers will work for you use the LabWindows/CVI Help files or look here

Hope this helps!

Tom
NIUK

0 Kudos
Message 3 of 3
(3,352 Views)