source: trunk/src/translate_points.m @ 412

Last change on this file since 412 was 356, checked in by sommeria, 13 years ago

civ updated with new functions for opening files, consistently with uvmat
Bugs to be expected (use previous version then)

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