Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
ad0e7f0c
Commit
ad0e7f0c
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
ajout de tsg_header.m
Gère dynamiquement le masque de saisie des paramètres globaux
parent
bb36082b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsg_util/tsg_header.m
+227
-0
227 additions, 0 deletions
tsg_util/tsg_header.m
with
227 additions
and
0 deletions
tsg_util/tsg_header.m
0 → 100644
+
227
−
0
View file @
ad0e7f0c
function
error
=
tsg_header
(
hTsgGUI
)
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
%
% Output
% ------
% error .............. 1: OK ; -1 : an error occured
% $Id$
error
=
-
1
;
% Get the data from the application GUI
% -------------------------------------
tsg
=
getappdata
(
hTsgGUI
,
'tsg_data'
);
% Define uicontrol start position
% -------------------------------
left
=
.
01
;
bottom
=
.
95
;
inc_x
=
0.5
;
inc_y
=
0.03
;
% set default uicontrol size
% --------------------------
default_height
=
0.018
;
default_length
=
.
1
;
% Get global attributes list from class tsg_nc with file 'tsg_ncattr.csv'
% -----------------------------------------------------------------------
nca
=
tsg_nc
(
'tsg_ncattr.csv'
);
nca_keys
=
keys
(
nca
);
% header Uicontrols in a new figure
% ---------------------------------
hHeaderFig
=
figure
(
...
'BackingStore'
,
'off'
,
...
'Name'
,
'TSG GLOBAL ATTRIBUTES'
,
...
'NumberTitle'
,
'off'
,
...
'Resize'
,
'on'
,
...
'Menubar'
,
'none'
,
...
'Toolbar'
,
'none'
,
...
'Tag'
,
'GLOBAL_ATTRIBUTES'
,
...
'Visible'
,
'on'
,
...
'Units'
,
'normalized'
,
...
'Position'
,
get
(
hTsgGUI
,
'Position'
),
...
'Color'
,
get
(
0
,
'DefaultUIControlBackgroundColor'
));
% bg = [0.92549 0.913725 0.847059] = get( 0, 'DefaultUIControlBackgroundColor' );
% Display fields from class
% -------------------------
for
i
=
1
:
numel
(
nca_keys
)
% get key, use {} for cell
key
=
nca_keys
{
i
};
% get all structure for the key
s
=
get
(
nca
,
key
);
% check for empty field and replace them by default value
% -------------------------------------------------------
if
isempty
(
s
.
length
),
s
.
length
=
default_length
;
end
;
if
isempty
(
s
.
height
),
s
.
height
=
default_height
;
end
;
% display dynamic uicontrol text
% use of char function prevent error when field is empty [] => ''
% ---------------------------------------------------------------
uicontrol
(
...
'Parent'
,
hHeaderFig
,
...
'Units'
,
'normalized'
,
...
'Style'
,
'Text'
,
...
'HorizontalAlignment'
,
'left'
,
...
'Position'
,[
left
,
bottom
,
.
8
,
.
0135
],
...
'TooltipString'
,
char
(
s
.
comment
),
...
'String'
,
char
(
s
.
name
)
);
% display dynamic uicontrol
% -------------------------
ui
=
uicontrol
(
...
'Parent'
,
hHeaderFig
,
...
'Units'
,
'normalized'
,
...
'BackgroundColor'
,
'w'
,
...
'Style'
,
char
(
s
.
uicontrolType
),
...
'HorizontalAlignment'
,
char
(
s
.
horizontalAlignment
),
...
'Position'
,[
left
+.
09
,
bottom
,
s
.
length
,
s
.
height
],
...
'String'
,
char
(
s
.
string
),
...
'Value'
,
s
.
value
,
...
'Tag'
,
key
);
% set dynamically uicontrol
% -------------------------
switch
s
.
uicontrolType
case
'popupmenu'
str
=
cellstr
(
get
(
ui
,
'String'
));
ind
=
strfind
(
str
,
tsg
.
(
key
));
for
k
=
1
:
numel
(
ind
)
if
~
isempty
(
ind
{
k
})
set
(
ui
,
'value'
,
k
);
end
end
case
'edit'
set
(
ui
,
'string'
,
tsg
.
(
key
));
end
% Check vertical position of last uicontrol and creation new colomn
% -----------------------------------------------------------------
bottom
=
bottom
-
inc_y
;
if
bottom
<
.
15
bottom
=
0.95
;
left
=
left
+
inc_x
;
end
end
% CONTINUE PUSH BUTTON
% --------------------
% The Continue (valid) button
uicontrol
(
...
'Parent'
,
hHeaderFig
,
...
'Style'
,
'pushbutton'
,
...
'Units'
,
'normalized'
,
...
'Position'
,[
.
05
,
.
1
,
.
05
,
.
02
],
...
'String'
,
'Continue'
,
...
'Interruptible'
,
'off'
,
...
'BusyAction'
,
'cancel'
,
...
'Tag'
,
'PUSH_BUTTON'
,
...
'Callback'
,
@
continueCallback
);
% CANCEL PUSH BUTTON
% ------------------
% The cancel button
uicontrol
(
...
'Parent'
,
hHeaderFig
,
...
'Style'
,
'pushbutton'
,
...
'Units'
,
'normalized'
,
...
'Position'
,[
.
15
,
.
1
,
.
05
,
.
02
],
...
'String'
,
'Cancel'
,
...
'Interruptible'
,
'off'
,
...
'BusyAction'
,
'cancel'
,
...
'Tag'
,
'PUSH_BUTTON'
,
...
'Callback'
,
@
cancelCallback
);
% Build structure container for graphic handles with tag property defined.
% ------------------------------------------------------------------------
data
=
guihandles
(
hHeaderFig
);
% record data struct in application data object
% ---------------------------------------------
%guidata(hHeaderFig, data);
% stop execution until push-button Continue was press
% ---------------------------------------------------
uiwait
(
hHeaderFig
);
%% Nested callback
function
continueCallback
(
obj
,
event
)
% get uicontrol filelds and populate tsg structure
% ------------------------------------------------
tsg
.
PLATFORM_NAME
=
get
(
data
.
PLATFORM_NAME
,
'string'
);
tsg
.
SHIP_CALL_SIGN
=
get
(
data
.
SHIP_CALL_SIGN
,
'string'
);
tsg
.
SHIP_MMSI
=
get
(
data
.
SHIP_MMSI
,
'string'
);
tsg
.
TSG_TYPE
=
get
(
data
.
TSG_TYPE
,
'string'
);
tsg
.
TSG_TYPE
=
tsg
.
TSG_TYPE
(
get
(
data
.
TSG_TYPE
,
'value'
),:);
tsg
.
TSG_NUMBER
=
get
(
data
.
TSG_NUMBER
,
'string'
);
tsg
.
TINT_TYPE
=
get
(
data
.
TINT_TYPE
,
'string'
);
tsg
.
TINT_TYPE
=
tsg
.
TINT_TYPE
(
get
(
data
.
TINT_TYPE
,
'value'
),:);
tsg
.
TINT_NUMBER
=
get
(
data
.
TINT_NUMBER
,
'string'
);
tsg
.
DATA_TYPE
=
get
(
data
.
DATA_TYPE
,
'string'
);
tsg
.
DATA_MODE
=
get
(
data
.
DATA_MODE
,
'string'
);
tsg
.
DATA_MODE
=
tsg
.
DATA_MODE
(
get
(
data
.
DATA_MODE
,
'value'
),:);
tsg
.
SAMPLING_PERIOD
=
get
(
data
.
SAMPLING_PERIOD
,
'string'
);
tsg
.
PROCESSING_STATUS
=
get
(
data
.
PROCESSING_STATUS
,
'string'
);
tsg
.
DATE_START
=
get
(
data
.
DATE_START
,
'string'
);
tsg
.
DATE_END
=
get
(
data
.
DATE_END
,
'string'
);
tsg
.
SOUTH_LATX
=
get
(
data
.
SOUTH_LATX
,
'string'
);
tsg
.
NORTH_LATX
=
get
(
data
.
NORTH_LATX
,
'string'
);
tsg
.
WEST_LONX
=
get
(
data
.
WEST_LONX
,
'string'
);
tsg
.
EAST_LONX
=
get
(
data
.
EAST_LONX
,
'string'
);
tsg
.
FORMAT_VERSION
=
get
(
data
.
FORMAT_VERSION
,
'string'
);
tsg
.
DATE_CREATION
=
get
(
data
.
DATE_CREATION
,
'string'
);
tsg
.
DATE_UPDATE
=
get
(
data
.
DATE_UPDATE
,
'string'
);
tsg
.
DATA_RESTRICTIONS
=
get
(
data
.
DATA_RESTRICTIONS
,
'string'
);
tsg
.
COMMENT
=
get
(
data
.
COMMENT
,
'string'
);
tsg
.
PROJECT_NAME
=
get
(
data
.
PROJECT_NAME
,
'string'
);
tsg
.
PI_NAME
=
get
(
data
.
PI_NAME
,
'string'
);
tsg
.
DATA_CENTRE
=
get
(
data
.
DATA_CENTRE
,
'string'
);
tsg
.
DATA_ACQUISITION
=
get
(
data
.
DATA_ACQUISITION
,
'string'
);
tsg
.
PROCESSING_CENTRE
=
get
(
data
.
PROCESSING_CENTRE
,
'string'
);
tsg
.
PROCESSING_STATES
=
get
(
data
.
PROCESSING_STATES
,
'string'
);
% Save tsg structure
% ------------------
setappdata
(
hTsgGUI
,
'tsg_data'
,
tsg
);
% close windows (replace call to uiresume(hHeaderFig))
% ----------------------------------------------------
close
(
hHeaderFig
);
% flushes the event queue and updates the figure window
% -----------------------------------------------------
drawnow
;
% return no error code (true)
% ---------------------------
error
=
1
;
end
function
cancelCallback
(
obj
,
event
)
% close windows
% -------------
close
(
hHeaderFig
);
% flushes the event queue and updates the figure window
% -----------------------------------------------------
drawnow
;
% return error code (no change)
% -----------------------------
error
=
-
1
;
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment