From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rubber-band zoom for 2D picture

Solved!
Go to solution

Hi,

 

Instead of mouse wheel zoom, is it possible the rubber-band zoom to zoom the polar plot picture indicator?

 

Regards,

S Nagaraju

0 Kudos
Message 1 of 10
(2,820 Views)

The indicator is a plain 2D picture, so you can look for mouse-down events and interactively draw a rubber band.  Use a mouse-donw event to get the first corner, then a mouse-move event to draw a square between that corner and the mouse position. Redraw the zoomed area on mouse up, etc..

 

(for some ideas, see how I added an interactive selection circle is this old example.)

0 Kudos
Message 2 of 10
(2,794 Views)

Hello sir,

Thank you very much for the quick response. With your suggestion i have done up to some extent. Now I'm facing issue during mouse up event. The selected area is not able to adjust to the full picture.

Kindly check the enclosed VI and suggest me for further changes.

 

Regards,

S Nagaraju

 

 

0 Kudos
Message 3 of 10
(2,781 Views)

You did a good job getting a section of the picture, but you forgot to do any zooming.

 

You may need to add some special code so that when you scale it up, it picks a scale factor that allows your image subset to fit.  It is unlikely that you'll pick a rectangle with the same aspect ratio as  your picture indicator, so either one direction of the picture would get cut off, or the other direction will need to have a larger area shown than what you drew with the rectangle.

0 Kudos
Message 4 of 10
(2,776 Views)

@Sonti_11532 wrote:

Hello sir,

Thank you very much for the quick response. With your suggestion i have done up to some extent. Now I'm facing issue during mouse up event. The selected area is not able to adjust to the full picture.

Kindly check the enclosed VI and suggest me for further changes.

 

Regards,

S Nagaraju

 

 


I would do something like this:

rubber-band-zoom2.PNG

 

0 Kudos
Message 5 of 10
(2,760 Views)
Solution
Accepted by topic author Sonti_11532

Here is how I would do it with the zoom factor based on the relative sizes of the original picture and the zoom rectangle that doesn't cut anything off.

Message 6 of 10
(2,744 Views)

Hello sir,

 

Thank you very much for the solution. I have modified the VI as per my requirements because i'm having only one picture control and we can do the multi level zoom in the displayed area. I have observed few things 

1. The behavior is abnormal, If I do mouse down in the picture control and drag out of the picture then mouse up or vice-versa.

2. During Muse up event, the rectangle to be disappeared. I tried, but still rectangle is visible.

 

Kindly look in to the modified VI and suggest me for the changes.

 

Regards,

S Nagaraju.

0 Kudos
Message 7 of 10
(2,711 Views)
Solution
Accepted by topic author Sonti_11532

1.  Add a Mouse Leave Event.  In there you can put code that ends the entire mouse draw operation resetting your flags.

2.  (And you'll want this for #1 as well)  Put your terminal for the original polar plot inside the mouse up event and use a local variable outside for the one time you initialize the plot.  When you have a mouse up, send the original picture to the original plot.  This will give you a view without the rectangle that the mouse draw process created.

Message 8 of 10
(2,696 Views)

@RavensFan wrote:

Here is how I would do it with the zoom factor based on the relative sizes of the original picture and the zoom rectangle that doesn't cut anything off.


thank you!

0 Kudos
Message 9 of 10
(2,689 Views)

Thank you very much.

0 Kudos
Message 10 of 10
(2,672 Views)