Effacer les filtres
Effacer les filtres

How to incorporate axesm-based maps in an app

4 vues (au cours des 30 derniers jours)
Kurt
Kurt le 22 Déc 2023
Commenté : Kurt le 3 Jan 2024
I am interested in creating axesm-based maps:
h = axesm('MapProjection','mercator')
However, there appears to be no way to tie the axesm object back to a parent app container:
h = axesm(app,'MapProjection','mercator') % doesn't work
I need to reference the various app components, for example:
app.panel.earth = axesm(app.panel,"Geoid",grs80, "Grid", "on"); % or something
There are lots of examples of how to use the other axes(), but not so much for axesm.
I intend to create, move and destroy lines in the app. I know how to do this in a UIAxes component, storing the line segments in Children. But axesm still throws me. I started with this example, but now I need to fold it into a GUI app:

Réponse acceptée

Walter Roberson
Walter Roberson le 22 Déc 2023
There is no straight-forward way of doing this. axesm() does not have anything similar to a 'Parent' property. axesm() is written in terms of gca
To use axesm with a uifigure() you need to work around the fact that uifigure HandleVisibility is Off
fig = ancestor(app.panel, 'figure');
fig.HandleVisibility = 'on';
Then you have to have an axes within the panel, and make it the current axes
ax = findobj(app.panel, 'type', 'axes');
if isempty(ax)
ax = axes(app.panel);
end
fig.CurrentAxes = ax(1);
Then you can axesm
h = axesm('MapProjection','mercator');
  1 commentaire
Kurt
Kurt le 3 Jan 2024
This is great! Encapsulating the axesm() with an axes makes it dual-purpose, and I can do UIAxes-type functions on it. Thanks.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop uifigure-Based Apps dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by