How can I hide the "Az: El:" readout while rotating an axes object?

9 visualizaciones (últimos 30 días)
Josh G.
Josh G. el 14 de Feb. de 2019
Editada: Josh G. el 29 de Oct. de 2020
I'm designing a programmatic GUI with a popup window to illustrate how azimuth and elevation are defined. This illustration is in the form of axes that can be rotated by the user with some text underneath describing various terms.
Azimuth (in my use case) is defined as the angle measured clockwise from the positive y axis, but MATLAB's camera defines azimuth as the angle measured counterclockwise from the negative y axis. As a result, there is no way for me to change the plot (e.g. plotting the "positive y axis" on the negative y axis and hiding labels) such that both azimuth and elevation are measured the same for the camera and my use case.
The problem is, when the user rotates the axes object, a readout of camera azimuth and elevation is displayed in the lower left corner of the figure. I'd like to keep users from being confused by an az/el readout that doesn't match what is displayed in the plot. I've tried putting a uipanel over that part of the figure, but the az/el readout just appears over it as soon as I rotate the plot.
Can I hide this readout by turning off a property or covering it up with something else?

Respuesta aceptada

Josh G.
Josh G. el 14 de Feb. de 2019
Editada: Josh G. el 14 de Feb. de 2019
I've solved this, so I'll describe the solution in case anyone else wants to do this.
In my GUI, I had to enable rotation manually by using rotate3d. On a mouse drag, this function writes the camera azimuth and elevation to the current uimode's ModeStateData.textBoxText property, which is then displayed at the bottom left of the current figure. ModeStateData is a struct with a field textState set equal to 1. Setting this field equal to 0 turns off the az/el readout.
To do this in a gui, you'll have to get access to the uimode object handled by rotate3d. From a blog post on undocumentedmatlab.com, I found that this was possible using the uigetmodemanager function. The fix is a simple two lines:
hManager = uigetmodemanager(yourFigure);
hManager.CurrentMode.ModeStateData.textState = 0;
  3 comentarios
Peter Cervelli
Peter Cervelli el 24 de Oct. de 2019
Although this:
hManager.CurrentMode.ModeStateData.textState = 0;
prevents text from appearing, there's still a white rectangle that clobbers whatever information you may wish to display in the lower left hand corner of the active figure. Moreover, this was sometimes causing an error:
Error using matlab.ui.control.UIControl/set
Invalid or deleted object.
Error in rotate3d>rotaButtonUpFcn (line 696)
set(rotaObj.ModeStateData.textBoxText,'Visible','off');
Perhaps because setting hManager.CurrentMode.ModeStateData.textState to 0 deletes the text object? I settled on the workaround of defining a function for the rotate3d ActionPreCallback that sets the Visible property of the offending text object to off:
function rotate3d_ActionPreCallback(v,~,~)
hm = uigetmodemanager(v.h.figure);
hm.CurrentMode.ModeStateData.textBoxText.Visible = 'off';
end
This seems to work for my purposes.
Josh G.
Josh G. el 29 de Oct. de 2020
Editada: Josh G. el 29 de Oct. de 2020
Peter,
Just over a year later this question showed up as the top search result for a problem I was still having with hiding the Az/El text. As the GUI I'm developing has become heavier and heavier, setting textState to 0 has become unreliable; doing it too quickly results in the value being set but without any effect. I tried several hacks with adding pauses up to as long as 4 seconds to "let all of the data get where it needed to be," all of which worked at first and then stopped working over time.
Your solution is far more elegant and I've switched to it with great results. I'm not sure what v.h.figure refers to in your callback, but for me it works using v alone since that corresponds to my figure handle for the whole GUI.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Array Geometries and Analysis en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by