source: trunk/src/translate_points.m @ 28

Last change on this file since 28 was 12, checked in by gostiaux, 14 years ago

The files from uvmat.2.2.beta that differed from the current version have been updated.
Now the /raid/soft/UVMAT/src should be operational

File size: 7.1 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% --- Executes just before translate_points is made visible.
40function translate_points_OpeningFcn(hObject, eventdata, handles,input_shift)
41% This function has no output args, see OutputFcn.
42
43% Choose default command line output for translate_points
44handles.output = 'Cancel';
45
46% Update handles structure
47guidata(hObject, handles);
48testNo=0;
49testCancel=1;
50testinputstring=0;
51icontype='quest';%default question icon (text input asked)
52
53% Determine the position of the dialog - centered on the screen
54FigPos=get(0,'DefaultFigurePosition');
55OldUnits = get(hObject, 'Units');
56set(hObject, 'Units', 'pixels');
57OldPos = get(hObject,'Position');
58FigWidth = OldPos(3);
59FigHeight = OldPos(4);
60ScreenUnits=get(0,'Units');
61set(0,'Units','pixels');
62ScreenSize=get(0,'ScreenSize');
63set(0,'Units',ScreenUnits);
64
65FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
66FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
67FigPos(3:4)=[FigWidth FigHeight];
68set(hObject, 'Position', FigPos);
69set(hObject, 'Units', OldUnits);
70
71% Show a question icon from dialogicons.mat - variables questIconData and questIconMap
72load dialogicons.mat
73eval(['IconData=' icontype 'IconData;'])
74eval(['IconCMap=' icontype 'IconMap;'])
75questIconMap(256,:) = get(handles.figure1, 'Color');
76Img=image(IconData, 'Parent', handles.axes1);
77set(handles.figure1, 'Colormap', IconCMap);
78set(handles.axes1, ...
79    'Visible', 'off', ...
80    'YDir'   , 'reverse'       , ...
81    'XLim'   , get(Img,'XData'), ...
82    'YLim'   , get(Img,'YData')  ...
83    );
84
85if exist('input_shift','var') && ~isempty(input_shift)
86   set(handles.x_shift,'String',num2str(input_shift(1)));
87   if numel(input_shift)>=2
88    set(handles.y_shift,'String',num2str(input_shift(2)));
89   end
90   if numel(input_shift)>=3
91    set(handles.z_shift,'String',num2str(input_shift(3)));
92   end
93end
94
95set(handles.figure1,'WindowStyle','modal')% Make% Make the GUI modal
96% UIWAIT makes translate_points wait for user response (see UIRESUME)
97uiwait(handles.figure1);
98
99
100% --- Outputs from this function are returned to the command line.
101function varargout = translate_points_OutputFcn(hObject, eventdata, handles)
102
103% Get default command line output from handles structure
104varargout{1}=[0 0 0];%default
105if ~isequal(handles.output,'Cancel')
106    x_shift=str2num(get(handles.x_shift,'String'));
107    y_shift=str2num(get(handles.y_shift,'String'));
108    z_shift=str2num(get(handles.z_shift,'String'));
109    if ~isempty(x_shift)
110        varargout{1}(1)=x_shift;
111    end
112    if ~isempty(y_shift)
113        varargout{1}(2)=y_shift;
114    end
115    if ~isempty(z_shift)
116        varargout{1}(3)=z_shift;
117    end
118end
119% The figure can be deleted now
120delete(handles.figure1);
121
122% --- Executes on button press in OK.
123function OK_Callback(hObject, eventdata, handles)
124handles.output = get(hObject,'String');
125guidata(hObject, handles);% Update handles structure
126uiresume(handles.figure1);
127
128% --- Executes on button press in Cancel.
129function Cancel_Callback(hObject, eventdata, handles)
130handles.output = get(hObject,'String');
131%handles.output = 'Cancel'
132guidata(hObject, handles); % Update handles structure
133% Use UIRESUME instead of delete because the OutputFcn needs
134% to get the updated handles structure.
135uiresume(handles.figure1);
136
137% --- Executes when user attempts to close figure1.
138function figure1_CloseRequestFcn(hObject, eventdata, handles)
139if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
140    % The GUI is still in UIWAIT, us UIRESUME
141    uiresume(handles.figure1);
142else
143    % The GUI is no longer waiting, just close it
144    delete(handles.figure1);
145end
146
147% --- Executes on key press over figure1 with no controls selected.
148function figure1_KeyPressFcn(hObject, eventdata, handles)
149% Check for "enter" or "escape"
150if isequal(get(hObject,'CurrentKey'),'escape')
151    % User said no by hitting escape
152    handles.output = 'Cancel';
153   
154    % Update handles structure
155    guidata(hObject, handles);
156   
157    uiresume(handles.figure1);
158end
159if isequal(get(hObject,'CurrentKey'),'return')
160    uiresume(handles.figure1);
161end   
162
163
164
165function edit5_Callback(hObject, eventdata, handles)
166% hObject    handle to edit5 (see GCBO)
167% eventdata  reserved - to be defined in a future version of MATLAB
168% handles    structure with handles and user data (see GUIDATA)
169
170% Hints: get(hObject,'String') returns contents of edit5 as text
171%        str2double(get(hObject,'String')) returns contents of edit5 as a double
172
173
174
175function edit6_Callback(hObject, eventdata, handles)
176% hObject    handle to edit6 (see GCBO)
177% eventdata  reserved - to be defined in a future version of MATLAB
178% handles    structure with handles and user data (see GUIDATA)
179
180% Hints: get(hObject,'String') returns contents of edit6 as text
181%        str2double(get(hObject,'String')) returns contents of edit6 as a
182%        double
183
184
185function edit7_Callback(hObject, eventdata, handles)
186% hObject    handle to edit7 (see GCBO)
187% eventdata  reserved - to be defined in a future version of MATLAB
188% handles    structure with handles and user data (see GUIDATA)
189
190% Hints: get(hObject,'String') returns contents of edit7 as text
191%        str2double(get(hObject,'String')) returns contents of edit7 as a double
192
193
194function edit8_Callback(hObject, eventdata, handles)
195% hObject    handle to edit8 (see GCBO)
196% eventdata  reserved - to be defined in a future version of MATLAB
197% handles    structure with handles and user data (see GUIDATA)
198
199% Hints: get(hObject,'String') returns contents of edit8 as text
200%        str2double(get(hObject,'String')) returns contents of edit8 as a double
201
202
Note: See TracBrowser for help on using the repository browser.