资源简介
无人机航路规划
代码片段和文件信息
%% get_axis_handle
%
% *Description*: This will extract an axes handle from a valid figure (or
% axes) handle else it will return an error
%% Function Call
%
% *Inputs:*
%
% _current_figORaxes_ (double) an axis or a figure handle or something else
%
% *Outputs:*
%
% _curr_axis_ (double) an axes handle for plotting
%
% _curr_figure_ (double) the handle for the figure holding this axis
%
function [curr_axis curr_figure] = get_axis_handle(current_figORaxes)
if nargin == 0
uiwait(msgbox(‘You have not provided a figure so I will create one this may cause unexpected results‘));
current_figORaxes = gcf;
end
% If this fails then it is likely the figure or axes has been closed so open a new one
try strcmp(get(current_figORaxes‘type‘)‘axes‘);
catch ME_1
display(ME_1);
figure(current_figORaxes);
end
curr_axis=0; %#ok
if strcmp(get(current_figORaxes‘type‘)‘axes‘)
curr_axis=current_figORaxes;
elseif strcmp(get(current_figORaxes‘type‘)‘figure‘)
curr_axis=[];
%get all children from figure
curr_children=get(current_figORaxes‘Children‘);
%find an axes in the figure
for curr_child=1:length(curr_children)
if strcmp(get(curr_children(curr_child)‘type‘)‘axes‘)
curr_axis=curr_children(curr_child);
end
end
%if there are none then create one and use the handle to that one
if isempty(curr_axis)
curr_axis=gca(current_figORaxes);
end
else
error(‘You passed an invalid handle which is neither figure nor axes handle‘);
end
if isempty(getappdata(curr_axis‘axis_setup‘))
hold(curr_axis‘on‘)
axis(curr_axis‘equal‘);
view(curr_axis3);
set(curr_axis‘DrawMode‘‘fast‘);
setappdata(curr_axis‘axis_setup‘true)
try set(get(curr_axis‘Parent‘)‘Renderer‘‘opengl‘); end %#ok
end
if isempty(getappdata(curr_axis‘camlight_state‘)) || strcmp(getappdata(curr_axis‘camlight_state‘)‘off‘)
lightPosition = getappdata(curr_axis‘lightPosition‘);
if isempty(lightPosition)
lightPosition = [1 1 1];
setappdata(curr_axis‘lightPosition‘lightPosition);
end
light(‘Position‘lightPosition‘style‘‘infinite‘‘Parent‘curr_axis);
setappdata(curr_axis‘camlight_state‘‘on‘);
end
%set the current axis to the be the current inside the figure which owns it
set(get(curr_axis‘Parent‘)‘CurrentAxes‘curr_axis);
drawnow();
if nargout==2
curr_figure = get(curr_axis‘Parent‘);
end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-03 10:03 20131031_RRT\
文件 42112 2013-11-01 00:47 20131031_RRT\RrtPlanner.m
文件 6409 2012-11-30 11:19 20131031_RRT\RrtPlannerTests.m
文件 1246 2012-11-30 11:19 20131031_RRT\Usage.txt
文件 2854 2012-11-29 20:07 20131031_RRT\get_axis_handle.m
文件 1305 2014-02-12 14:37 20131031_RRT\license.txt
文件 948 2012-11-29 20:07 20131031_RRT\obstacles.txt
文件 1460 2012-11-30 11:19 20131031_RRT\obstacles2.txt
文件 2048 2012-11-30 11:19 20131031_RRT\obstacles3.txt
文件 1552 2012-11-30 11:19 20131031_RRT\obstacles4.txt
- 上一篇:CDR2017免登录补丁
- 下一篇:条码字体-扫描专用
评论
共有 条评论