取消
顯示結果 
搜尋替代 
您的意思是: 

map display as switches

已解決!
前往解決方案

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 積分
1 條訊息(共 16 條)
8,168 檢視

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 積分
2 條訊息(共 16 條)
8,159 檢視

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!
3 條訊息(共 16 條)
8,147 檢視
解決方案
接受者 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 積分
4 條訊息(共 16 條)
8,141 檢視
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 積分
5 條訊息(共 16 條)
8,133 檢視

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
6 條訊息(共 16 條)
8,096 檢視
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!"
7 條訊息(共 16 條)
8,093 檢視

....

 

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
8 條訊息(共 16 條)
8,087 檢視

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
9 條訊息(共 16 條)
8,072 檢視

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 積分
10 條訊息(共 16 條)
8,042 檢視