LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

map display as switches

Solved!
Go to solution

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

0 Kudos
Message 1 of 16
(7,293 Views)

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

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 16
(7,284 Views)

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.


___________________
Try to take over the world!
Message 3 of 16
(7,272 Views)
Solution
Accepted by mikealder

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.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 16
(7,266 Views)
Many thanks for the ideas, I will have a play around later this evening - question is which one to try! although I do like the simplicity of chrisger method, but it is best to have the colour mask as a bmp rather than jpg to ensure the colour code is consistant across any given area, jpg tends to offer different codes near the boundry due to compression. At least I now have a way forwards and will decide which option is best for the application later tonight - many thanks for your time - appreciated - Mike
0 Kudos
Message 5 of 16
(7,258 Views)

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 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 16
(7,221 Views)
You also may think about using simple text indicators (you surely want to show the name of each county on the picture to the user). By clicking on one of the indicators you can retrieve the contents of the indicator by the "Value" property and thus the name of the county.
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 7 of 16
(7,218 Views)

....

 

How about customize a boolean for each county?

 

In the attached (LV 8.5), click on Suffolk to stop the demo.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 16
(7,212 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 16
(7,197 Views)

Hello Mike,

I made a test VI which uses the picture- VIs to determine the clicked polygon.

Hope it helps,

greets, Dave

Greets, Dave
0 Kudos
Message 10 of 16
(7,167 Views)