12-28-2008 06:11 AM
I have created each of the British county borders as numeric arrays for each of the coordinates, the coastline isn't too defined as it isn't required to be accurate in this area.
What I want to do is turn each of the county areas in to a clickable switch to control the application forcing the XY graph to re-load just the single county with other overlay information, any thoughts on how to make an irregular shaped object behave as a control without altering its appearance?
The attachment shows the map, it might look a little strange at the moment but Wales and Scotland are not currently included - Mike
Solved! Go to Solution.
12-28-2008 07:02 AM
There are a few steps to take. The vi.lib folder of LabVIEW has several VIs for dealing with XY coordinates and Rectangles. If you install OpenG toolkit these VIs are added to the OpenG palette. One of the VIs is 'Is point in rectangle' with that VI you can limit the number of Counties that are valid for a certain coordinate.
Ton
12-28-2008 08:29 AM
The attached VI should help you. It accepts a series of points (as a 2D array) and tells you whether a specific point is inside the resulting polygon.
Alternatively, you can create another picture off screen where you assign each county a different color and then you check the value of the pixel you clicked on and that tells you which county it's in. This has the advantage of not having to go over all the counties.
12-28-2008 09:37 AM
Hi there
you can use build in functions to get the value of a pixel in a picture control (see attachment).
Now you can create a copy of the image and fill the county areas with a unique colors using your favorite image manipulation application. Then create a look up table (i.e. a list of the countys and their colors) and find the county to the selected color in the displayed image.
12-28-2008 10:35 AM
12-29-2008 09:42 AM
Just some thoughts on this topic...
The off-screen picture approach can be simplified to a look-up table that is generated by the "off-screen" picture.
Not having an expresion to define a region elliminates using inside/outside checks in math.
Another idea:
Establish a center and a radius for a circle to over-lay each county. When the user clicks, find the closest center then verify its withing the specified radius. Yes this approach will not make it possible to click on one of the extreme corners of a county but should work if the user click near the center.
Ben
12-29-2008 09:51 AM
12-29-2008 10:31 AM
....
How about customize a boolean for each county?
In the attached (LV 8.5), click on Suffolk to stop the demo.
Ben
12-29-2008 10:59 AM
The attached example still uses a customized boolean but also takes advantage of re-positioning, re-sizing and showing the couty name. Click on Suffolk to see the effect.
Ben
12-29-2008 12:16 PM
Hello Mike,
I made a test VI which uses the picture- VIs to determine the clicked polygon.
Hope it helps,
greets, Dave