Skip to content
Snippets Groups Projects
Commit 8719046f authored by Nicola Vigano's avatar Nicola Vigano
Browse files

GtGauge: cleaned a little (but really a little :D)

parent ff3279c5
No related branches found
No related tags found
No related merge requests found
......@@ -28,16 +28,16 @@ properties
index;
format;
nDel;
nDel;
extraText;
updateFunc;
delFunc;
progressFunc;
end % end of properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PUBLIC METHODS
%%% PUBLIC METHODS
methods (Access = public)
function obj = GtGauge(limits, title, varargin)
par.style = 'count';
......@@ -45,17 +45,17 @@ methods (Access = public)
par.verbose = true;
par.args_to_title = {};
par = parse_pv_pairs(par, varargin);
obj = obj@GtConditionalOutput(par.verbose);
obj.steps = 0;
obj.index = 0;
obj.nDel = 0;
obj.extraText = [];
obj.args_to_title = par.args_to_title;
switch numel(limits(:))
case 1
case 1
obj.first = 1;
obj.last = limits(1);
obj.steps = limits(1);
......@@ -63,12 +63,12 @@ methods (Access = public)
obj.first = limits(1);
obj.last = limits(2);
obj.steps = limits(2) - limits(1) + 1;
otherwise
gtError('GtGauge:wrong_gauge_limits', ...
'Limits are sized 1 (0 to limit) or 2 (limits(1) to limits(2)!');
end
% Style
obj.progressFunc = @(x)round(x);%handle([]);
obj.style = par.style;
......@@ -88,7 +88,7 @@ methods (Access = public)
else
obj.title = title;
end
% Start right now or not
if (logical(par.start))
obj.start();
......@@ -99,7 +99,7 @@ methods (Access = public)
delete@handle(obj);
clear obj;
end
function rePrint(obj)
obj.start();
obj.nDel = 0;
......@@ -118,25 +118,15 @@ methods (Access = public)
end
end
%function setCounterAndDisplay(obj, newCounter)
% obj.index = newCounter - obj.first + 1;
% obj.updateFunc();
%end
function setExtraText(obj, str)
obj.extraText = [' ' str];
end
%function finish(obj)
% obj.doFinish();
%end
end % end of public methods
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PROTECTED METHODS
%%% PROTECTED METHODS
methods (Access = protected)
function start(obj)
if ~isempty(obj.args_to_title)
obj.fprintf(obj.title, obj.args_to_title{:});
......@@ -163,9 +153,9 @@ methods (Access = protected)
progress = 100 / obj.steps;
obj.progressFunc = @(x)round(x * progress);
end
function setCount(obj)
obj.style = 'count';
obj.style = 'count';
nDigits = uint64(round(log10(double(obj.steps))) + 1);
digitsStr = ['%' num2str(nDigits) 'd'];
if (obj.first == 1)
......@@ -181,7 +171,7 @@ methods (Access = protected)
obj.progressFunc = @(x)round(x + obj.first - 1);
end
end
function doUpdate(obj)
obj.delFunc(obj.nDel);
output = [obj.format obj.extraText];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment