필터 지우기
필터 지우기

How to add to a figure a second set of 3D axes insensitive to rotate3d, pan, zoom?

조회 수: 1 (최근 30일)
Dear All,
I have a plot3 object (3D surface) in a figure that I can (and often have to) freely rotate3d, pan, zoom. I need to add text to the figure that would be still with respect to rotate3d, pan, zoom (would look like caption on TV). Here is the relevant code portion:
figure;
plot3(surface..)
...
panHandle = pan(gcf);
rotateHandle = rotate3d(gcf);
zoomHandle = zoom(gcf);
set(rotateHandle,'ActionPreCallback',@rotationStarted);
set(rotateHandle,'ActionPostCallback',@rotationDone);
rotateHandle.Enable='on';
set(zoomHandle,'ActionPreCallback',@zoomStarted)
set(zoomHandle,'ActionPostCallback',@zoomEnded)
zoomHandle.Enable='on';
set(panHandle,'ActionPreCallback',@panStarted)
set(panHandle,'ActionPostCallback',@panEnded)
panHandle.Enable='on';
function rotationStarted(~,rotateHandle)
for i=1:length(Handle)
set(Handle{i},'visible','off');
end
end
function rotationDone(~,rotateHandle)
for i=1:length(Handle)
set(Handle{i},'visible','on');
end
end
function zoomStarted(~,zoomHandle)
for i=1:length(Handle)
set(Handle{i},'visible','off');
end
end
function zoomEnded(~,zoomHandle)
for i=1:length(Handle)
set(Handle{i},'visible','on');
end
end
function panStarted(~,panHandle)
for i=1:length(Handle)
set(Handle{i},'visible','off');
end
end
function panEnded(~, panHandle)
for i=1:length(Handle)
set(Handle{i},'visible','on');
end
end
I thought that the natural way is to add a second set of 3D axes identical to the plot3 object ones, however which would not be subject to rotate3d, pan, zoom (ie. restrict the rotation handles to axes1 instead of gcf), and add text to this second axis set.
Please advise, thank you,
Octavian.

채택된 답변

Stephen23
Stephen23 2015년 2월 24일
편집: Stephen23 2015년 2월 26일
I did something very similar to this in a FEX submssion:
Run the function cubehelix_view: you can see how the warning text is always static, even when the 3D axes are clickable and rotatable. This text is actually on some 2D axes, invisible and infront of the 3D axes, and so does not move when the 3D axes are rotated or panned.
Simply add the static axes in front of the zoomable axes (either after creating the zoomable axes, or using uistack to adjust the order), then change its axes properties :
  • Visible -> off
  • HitTest -> off
  • PickableParts -> none
  댓글 수: 3
Stephen23
Stephen23 2015년 2월 25일
편집: Stephen23 2015년 2월 25일
I'm glad it worked for you. PickableParts seems to be a new feature. It doesn't exist in my version either, so I wouldn't worry about it!
Mike Garrity
Mike Garrity 2015년 2월 25일
The PickableParts property was added in R2014b so that you could control the visibility and pickability separately. If you don't set PickableParts, then it will just match your setting for Visible. I think that's fine for what you're trying to do here.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by