-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added jvm and colormap visualziation help functions
- Loading branch information
Matthias Treder
committed
Sep 7, 2012
1 parent
13fd828
commit c932979
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function jvm= jvm_hideFig | ||
|
||
a= sscanf(getfield(ver('MATLAB'), 'Release'), '(R%d)'); | ||
v= version('-java'); | ||
if isempty(strfind(v, 'not enabled')) % && a>=2009, | ||
jvm.fig= gcf; | ||
jvm.visible= get(jvm.fig, 'Visible'); | ||
set(jvm.fig, 'Visible','off'); | ||
else | ||
jvm= []; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function jvm_restoreFig(jvm, varargin) | ||
|
||
% opt= propertylist2struct(varargin{:}); | ||
opt = opt_proplistToStruct(varargin{:}); | ||
opt= opt_setDefaults(opt, {'fig_hidden', 0}); | ||
|
||
if ~isempty(jvm) && ~opt.fig_hidden, | ||
set(jvm.fig, 'Visible',jvm.visible); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function yesorno= visutil_isColormapUsed(hf) | ||
%ISCOLORMAPUSED - Determines whether the figure's colormap is in use | ||
% | ||
%Description: | ||
% This function determines whether there is some child of the specified | ||
% figure that uses the figure's colormap. Since all subplots of one | ||
% figure all share a common colormap (figure property), this information | ||
% is important when one wants to add a new image with a local colormap | ||
% without destroying other subplots on the figure. In this case the | ||
% function image_local_cmap can be used. | ||
% | ||
%Usage: | ||
%YESORNO= iscolormapused(<HF>); | ||
% | ||
%Input: | ||
% HF: Handle of the figure. If none is specified the current figure | ||
% is inspected, i.e., default gcf. | ||
% | ||
%Example: | ||
% clf; subplot(1,3,1); plot(randn(100,2)); | ||
% iscolormapused | ||
% subplot(1,3,2); | ||
% patch([0 1 1 0],[0 0 1 1], [1 0.1 0.7]); %% specify color directly | ||
% iscolormapused | ||
% subplot(1,3,3); | ||
% patch([0 1 1 0],[0 0 1 1], 2); %% specify color by indexing into colormap | ||
% iscolormapused | ||
% | ||
%See also image_local_cmap. | ||
|
||
if nargin==0, | ||
hf= gcf; | ||
end | ||
|
||
if isfield(get(hf),'CData') && ~isempty(get(hf,'CData')), | ||
yesorno= 1; | ||
return; | ||
end | ||
|
||
hc= get(hf, 'children'); | ||
yesorno= 0; | ||
|
||
ii= 0; | ||
while ~yesorno && ii<length(hc), | ||
ii= ii+1; | ||
yesorno= visutil_isColormapUsed(hc(ii)); | ||
end |