source: trunk/src/translate_points.m @ 310

Last change on this file since 310 was 36, checked in by sommeria, 15 years ago

-get_field: functions called by ACTION in the GUI get_field put in the subdirectory get_field (like for series)
-help put in the subdir uvmat_doc, help call in uvmat, civ, geometry calib modified accordingly

File size: 5.5 KB
Line 
1%'translate_points': associated with GUI translate_points.fig to display message boxes, for error, warning or input calls
2% translate_points(title,display)
3%
4% OUTPUT:
5% answer  (text string)= 'yes', 'No', 'cancel', or the text string introduced as input
6%
7%INPUT:
8% title: string indicating the type of message box:
9%          title= 'INPUT_TXT','CONFIMATION' ,'ERROR', 'WARNING', 'INPUT_Y-N', default = 'INPUT_TXT' (the title is displayed in the upper bar of the fig).
10%          if title='INPUT_TXT', input data is asked in an edit box
11%          if title='CONFIMATION'', 'ERROR', 'WARNING', the figure remains  opened until a button 'OK' is pressed
12%          if title='INPUT_Y-N', an answer Yes/No is requested
13% display, displayed text
14% default_answer: default answer in the edit box (only used with title='INPUT_TXT')
15
16function varargout = translate_points(varargin)
17
18% Last Modified by GUIDE v2.5 05-Jan-2010 19:31:33
19
20% Begin initialization code - DO NOT EDIT
21gui_Singleton = 1;
22gui_State = struct('gui_Name',       mfilename, ...
23                   'gui_Singleton',  gui_Singleton, ...
24                   'gui_OpeningFcn', @translate_points_OpeningFcn, ...
25                   'gui_OutputFcn',  @translate_points_OutputFcn, ...
26                   'gui_LayoutFcn',  [] , ...
27                   'gui_Callback',   []);
28if nargin && ischar(varargin{1})
29    gui_State.gui_Callback = str2func(varargin{1});
30end
31
32if nargout
33    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
34else
35    gui_mainfcn(gui_State, varargin{:});
36end
37% End initialization code - DO NOT EDIT
38
39
40% --- Executes just before translate_points is made visible.
41function translate_points_OpeningFcn(hObject, eventdata, handles,input_shift)
42% This function has no output args, see OutputFcn.
43
44% Choose default command line output for translate_points
45handles.output = 'Cancel';
46
47% Update handles structure
48guidata(hObject, handles);
49testNo=0;
50testCancel=1;
51testinputstring=0;
52icontype='quest';%default question icon (text input asked)
53
54% Determine the position of the dialog - centered on the screen
55FigPos=get(0,'DefaultFigurePosition');
56OldUnits = get(hObject, 'Units');
57set(hObject, 'Units', 'pixels');
58OldPos = get(hObject,'Position');
59FigWidth = OldPos(3);
60FigHeight = OldPos(4);
61ScreenUnits=get(0,'Units');
62set(0,'Units','pixels');
63ScreenSize=get(0,'ScreenSize');
64set(0,'Units',ScreenUnits);
65
66FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
67FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
68FigPos(3:4)=[FigWidth FigHeight];
69set(hObject, 'Position', FigPos);
70set(hObject, 'Units', OldUnits);
71
72% Show a question icon from dialogicons.mat - variables questIconData and questIconMap
73load dialogicons.mat
74eval(['IconData=' icontype 'IconData;'])
75eval(['IconCMap=' icontype 'IconMap;'])
76questIconMap(256,:) = get(handles.figure1, 'Color');
77Img=image(IconData, 'Parent', handles.axes1);
78set(handles.figure1, 'Colormap', IconCMap);
79set(handles.axes1, ...
80    'Visible', 'off', ...
81    'YDir'   , 'reverse'       , ...
82    'XLim'   , get(Img,'XData'), ...
83    'YLim'   , get(Img,'YData')  ...
84    );
85
86if exist('input_shift','var') && ~isempty(input_shift)
87   set(handles.x_shift,'String',num2str(input_shift(1)));
88   if numel(input_shift)>=2
89    set(handles.y_shift,'String',num2str(input_shift(2)));
90   end
91   if numel(input_shift)>=3
92    set(handles.z_shift,'String',num2str(input_shift(3)));
93   end
94end
95
96set(handles.figure1,'WindowStyle','modal')% Make% Make the GUI modal
97% UIWAIT makes translate_points wait for user response (see UIRESUME)
98uiwait(handles.figure1);
99
100
101% --- Outputs from this function are returned to the command line.
102function varargout = translate_points_OutputFcn(hObject, eventdata, handles)
103
104% Get default command line output from handles structure
105varargout{1}=[0 0 0];%default
106if ~isequal(handles.output,'Cancel')
107    x_shift=str2num(get(handles.x_shift,'String'));
108    y_shift=str2num(get(handles.y_shift,'String'));
109    z_shift=str2num(get(handles.z_shift,'String'));
110    if ~isempty(x_shift)
111        varargout{1}(1)=x_shift;
112    end
113    if ~isempty(y_shift)
114        varargout{1}(2)=y_shift;
115    end
116    if ~isempty(z_shift)
117        varargout{1}(3)=z_shift;
118    end
119end
120% The figure can be deleted now
121delete(handles.figure1);
122
123% --- Executes on button press in OK.
124function OK_Callback(hObject, eventdata, handles)
125handles.output = get(hObject,'String');
126guidata(hObject, handles);% Update handles structure
127uiresume(handles.figure1);
128
129% --- Executes on button press in Cancel.
130function Cancel_Callback(hObject, eventdata, handles)
131handles.output = get(hObject,'String');
132guidata(hObject, handles); % Update handles structure
133uiresume(handles.figure1);
134
135% --- Executes when user attempts to close figure1.
136function figure1_CloseRequestFcn(hObject, eventdata, handles)
137if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
138    % The GUI is still in UIWAIT, us UIRESUME
139    uiresume(handles.figure1);
140else
141    % The GUI is no longer waiting, just close it
142    delete(handles.figure1);
143end
144
145% --- Executes on key press over figure1 with no controls selected.
146function figure1_KeyPressFcn(hObject, eventdata, handles)
147% Check for "enter" or "escape"
148if isequal(get(hObject,'CurrentKey'),'escape')
149    % User said no by hitting escape
150    handles.output = 'Cancel';
151   
152    % Update handles structure
153    guidata(hObject, handles);
154   
155    uiresume(handles.figure1);
156end
157if isequal(get(hObject,'CurrentKey'),'return')
158    uiresume(handles.figure1);
159end   
160
161
162
Note: See TracBrowser for help on using the repository browser.