www.gusucode.com > map 案例源码 matlab代码程序 > map/ManipulateDisplayedMapObjectsByNameExample.m

    %% Manipulate Displayed Map Objects By Name
% This example shows how to manipulate displayed map objects by name. Many
% functions assign descriptive names to the |Tag| property of the objects
% they create. The |namem| and related functions allow you to control the
% display of groups of similarly named objects, determine the names and
% change them, if desired, and use the name in calls to |get| and |set| .
%%
% Display a vector map of the world.
f = axesm('fournier')
framem on; 
gridm on;
plabel on; 
mlabel('MLabelParallel',0)
load coastlines
plotm(coastlat,coastlon,'k','Tag','Coastline')
%%
% List the names of the objects in the current axes using |namem| .
namem
%%
% Use |handlem| to get handles to graphic objects in the map. You use these
% handles to get or set object properties. For example, to change the line
% width of the coastline with |set| . If you call |handlem| with no
% arguments, it opens a graphical user interface that lists all the map
% axes objects. You can select objects interactively.
set(handlem('Coastline'),'LineWidth',2)
%%
% Change the colors of the meridian and parallel labels separately.
set(handlem('Mlabel'),'Color',[.5 .2 0])
set(handlem('Plabel'),'Color',[.2 .5 0])
%%
% Change the color of the labels to be the same.
setm(f,'fontcolor', [.4 .5 .6])
%%
% Use |handlem| specifying the |'all'| modifier to get a list of all text
% objects or all line objects.
t = handlem('alltext')
l = handlem('allline')