Skip to content
Snippets Groups Projects
Commit e3314ddb authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

Remove @quality object and use tsg_nc classe with @tsg_nc/tsg_quality.csv file

Write @tsg_nc/tsg_quality.csv with new format id en endl line delimiter
Change tsg.qc.hash initialisation with @tsg_nc/tsg_quality.csv 
parent 423cde26
No related branches found
No related tags found
No related merge requests found
function display(this)
%$Id: display.m 53 2006-03-03 13:41:22Z jgrelet $
try
disp(struct(this));
catch
err ('quality', 'display', lasterr) ;
end
function result = get( self, varargin )
% quality/get -- get structure of "quality" object.
%
% Input
% -----
% self ........... instance of 'quality' object
% key ........... types
% member ........... attribute member
%
% Output
% ------
% result ........... structure for the key (hastable)
%
% if key dosn't exist, return empty struct
% $Id$
% Test variable argument list
% ---------------------------
switch (nargin)
% Return the list of key
% ----------------------
case 1
result = keys(self);
% Return for a valid key the hash (structure)
% -------------------------------------------
case 2
if ~isempty( find(strcmp(keys(self), varargin{1})))
result = get(self.hashtable, varargin{1});
else
result = {};
end
% Return the hash member value
% ----------------------------
case 3
% call method get for an hashtable object
result = get(self, varargin{1});
% test if third arg is a valid member of the struct in the hash
if ~isempty( find(strcmp(keys(self), varargin{1})) ) && ...
isfield(result,varargin{2})
result = result.(varargin{2});
else
result = {};
end
otherwise
error('Wrong input args');
end
function result = types(self)
% quality/types -- Get all the types currently being used in the internal
% quality hash
% result = types(self)
% $Id$
result = keys(self.hashtable);
NO_CONTROL;No control;0;k;on
GOOD;Good;1;b;on
PROBABLY_GOOD;Probably Good;2;g;on
PROBABLY_BAD;Probably bad;3;m;on
BAD;Bad;4;r;on
VALUE_CHANGED;Value changed;5;y;off
HARBOUR;Harbour;6;c;on
NOT_USED;Not used;7;w;off
INTERPOLATED_VALUE;Interpolated value;8;k;off
MISSING_VALUE;Missing value;9;k;off
function q = quality( varargin )
% QUALITY constructor function for QUALITY object
%
% Use: q = quality( <file> )
%
% by default: q = quality
% use @quality/quality.scv file
%
% example:
% Get all types get(q)
% get internal has get(q, 'NO_CONTROL')
% get specific value get(q, 'NO_CONTROL','code')
%
% $Id$
switch nargin
case 0 % create default object
file = 'quality.csv';
case 1
if( isa(varargin{1}, 'char'))
file = varargin{1};
else
error('Wrong input argument');
end
otherwise
error('Wrong number of input arguments');
end
if exist(file, 'file') ~= 2
disp(['The specified data file ' file ' does not exist ...']);
disp('Or is not in the directory which is on the MATLAB search path');
datagui_closereq_callback;
end
[type,label,code,color,state] = textread(...
file,'%s%s%d%s%s','delimiter',';');
q.file = which(file);
q.size = length(type);
types = hashtable;
for i=1:length(type)
s.label = label{i};
s.code = code(i);
s.color = color{i};
s.state = state{i};
types = put(types, type{i}, s);
end
q = class(q, 'quality', types );
% tsg_quality.csv: definition ( id + 6 members + endl & 16 separators ; actually)
% $Id$
%
id;type;label;code;color;state;endl
char;char;char;integer;char;char;char
#;NO_CONTROL;No control;0;k;on;#
#;GOOD;Good;1;b;on;#
#;PROBABLY_GOOD;Probably Good;2;g;on;#
#;PROBABLY_BAD;Probably bad;3;m;on;#
#;BAD;Bad;4;r;on;#
#;VALUE_CHANGED;Value changed;5;y;off;#
#;HARBOUR;Harbour;6;c;on;#
#;NOT_USED;Not used;7;w;off;#
#;INTERPOLATED_VALUE;Interpolated value;8;k;off;#
#;MISSING_VALUE;Missing value;9;k;off;#
......@@ -57,10 +57,10 @@ tsg.file.type = [];
% 9 Missing value
% Quality definition, we use a hashtable with a definition file
% @quality/quality.csv,
% located in @tsg_nc/tsg_quality.csv,
% use this file if you want add or modify quality context menu
% -------------------------------------------------------------
tsg.qc.hash = quality;
tsg.qc.hash = tsg_nc('tsg_quality.csv');
% set default code at startup
% ---------------------------
......
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