[356] | 1 | %'translate_points': associated with GUI translate_points.fig to display translation parameters
|
---|
| 2 | %------------------------------------------------------------------------
|
---|
| 3 | % function T=translate_points(Tinput)
|
---|
| 4 | %------------------------------------------------------------------------
|
---|
[2] | 5 | % OUTPUT:
|
---|
[356] | 6 | % T=vector size(1,3), representing the translation components along x,y,z
|
---|
[809] | 7 | %
|
---|
| 8 | % INPUT:
|
---|
[356] | 9 | % Tinput: like T, used to prefil the GUI edit boxs
|
---|
[2] | 10 |
|
---|
[809] | 11 | %=======================================================================
|
---|
[1107] | 12 | % Copyright 2008-2022, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
|
---|
[809] | 13 | % http://www.legi.grenoble-inp.fr
|
---|
| 14 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
| 15 | %
|
---|
| 16 | % This file is part of the toolbox UVMAT.
|
---|
| 17 | %
|
---|
| 18 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
| 19 | % it under the terms of the GNU General Public License as published
|
---|
| 20 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 21 | % or (at your option) any later version.
|
---|
| 22 | %
|
---|
| 23 | % UVMAT is distributed in the hope that it will be useful,
|
---|
| 24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 26 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 27 | %=======================================================================
|
---|
| 28 |
|
---|
[2] | 29 | function varargout = translate_points(varargin)
|
---|
| 30 |
|
---|
| 31 | % Begin initialization code - DO NOT EDIT
|
---|
| 32 | gui_Singleton = 1;
|
---|
| 33 | gui_State = struct('gui_Name', mfilename, ...
|
---|
| 34 | 'gui_Singleton', gui_Singleton, ...
|
---|
| 35 | 'gui_OpeningFcn', @translate_points_OpeningFcn, ...
|
---|
| 36 | 'gui_OutputFcn', @translate_points_OutputFcn, ...
|
---|
| 37 | 'gui_LayoutFcn', [] , ...
|
---|
| 38 | 'gui_Callback', []);
|
---|
| 39 | if nargin && ischar(varargin{1})
|
---|
| 40 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
| 41 | end
|
---|
| 42 |
|
---|
| 43 | if nargout
|
---|
| 44 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
---|
| 45 | else
|
---|
| 46 | gui_mainfcn(gui_State, varargin{:});
|
---|
| 47 | end
|
---|
| 48 | % End initialization code - DO NOT EDIT
|
---|
| 49 |
|
---|
[36] | 50 |
|
---|
[2] | 51 | % --- Executes just before translate_points is made visible.
|
---|
| 52 | function translate_points_OpeningFcn(hObject, eventdata, handles,input_shift)
|
---|
| 53 | % This function has no output args, see OutputFcn.
|
---|
| 54 |
|
---|
| 55 | % Choose default command line output for translate_points
|
---|
| 56 | handles.output = 'Cancel';
|
---|
| 57 |
|
---|
| 58 | % Update handles structure
|
---|
| 59 | guidata(hObject, handles);
|
---|
| 60 | testNo=0;
|
---|
| 61 | testCancel=1;
|
---|
| 62 | testinputstring=0;
|
---|
| 63 | icontype='quest';%default question icon (text input asked)
|
---|
| 64 |
|
---|
| 65 | % Determine the position of the dialog - centered on the screen
|
---|
| 66 | FigPos=get(0,'DefaultFigurePosition');
|
---|
| 67 | OldUnits = get(hObject, 'Units');
|
---|
| 68 | set(hObject, 'Units', 'pixels');
|
---|
| 69 | OldPos = get(hObject,'Position');
|
---|
| 70 | FigWidth = OldPos(3);
|
---|
| 71 | FigHeight = OldPos(4);
|
---|
| 72 | ScreenUnits=get(0,'Units');
|
---|
| 73 | set(0,'Units','pixels');
|
---|
| 74 | ScreenSize=get(0,'ScreenSize');
|
---|
| 75 | set(0,'Units',ScreenUnits);
|
---|
| 76 |
|
---|
| 77 | FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
|
---|
| 78 | FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
|
---|
| 79 | FigPos(3:4)=[FigWidth FigHeight];
|
---|
| 80 | set(hObject, 'Position', FigPos);
|
---|
| 81 | set(hObject, 'Units', OldUnits);
|
---|
| 82 |
|
---|
| 83 | % Show a question icon from dialogicons.mat - variables questIconData and questIconMap
|
---|
| 84 | load dialogicons.mat
|
---|
| 85 | eval(['IconData=' icontype 'IconData;'])
|
---|
| 86 | eval(['IconCMap=' icontype 'IconMap;'])
|
---|
| 87 | questIconMap(256,:) = get(handles.figure1, 'Color');
|
---|
| 88 | Img=image(IconData, 'Parent', handles.axes1);
|
---|
| 89 | set(handles.figure1, 'Colormap', IconCMap);
|
---|
| 90 | set(handles.axes1, ...
|
---|
| 91 | 'Visible', 'off', ...
|
---|
| 92 | 'YDir' , 'reverse' , ...
|
---|
| 93 | 'XLim' , get(Img,'XData'), ...
|
---|
| 94 | 'YLim' , get(Img,'YData') ...
|
---|
| 95 | );
|
---|
| 96 |
|
---|
| 97 | if exist('input_shift','var') && ~isempty(input_shift)
|
---|
| 98 | set(handles.x_shift,'String',num2str(input_shift(1)));
|
---|
| 99 | if numel(input_shift)>=2
|
---|
| 100 | set(handles.y_shift,'String',num2str(input_shift(2)));
|
---|
| 101 | end
|
---|
| 102 | if numel(input_shift)>=3
|
---|
| 103 | set(handles.z_shift,'String',num2str(input_shift(3)));
|
---|
| 104 | end
|
---|
| 105 | end
|
---|
| 106 |
|
---|
| 107 | set(handles.figure1,'WindowStyle','modal')% Make% Make the GUI modal
|
---|
| 108 | % UIWAIT makes translate_points wait for user response (see UIRESUME)
|
---|
| 109 | uiwait(handles.figure1);
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | % --- Outputs from this function are returned to the command line.
|
---|
| 113 | function varargout = translate_points_OutputFcn(hObject, eventdata, handles)
|
---|
| 114 |
|
---|
| 115 | % Get default command line output from handles structure
|
---|
| 116 | varargout{1}=[0 0 0];%default
|
---|
| 117 | if ~isequal(handles.output,'Cancel')
|
---|
| 118 | x_shift=str2num(get(handles.x_shift,'String'));
|
---|
| 119 | y_shift=str2num(get(handles.y_shift,'String'));
|
---|
| 120 | z_shift=str2num(get(handles.z_shift,'String'));
|
---|
| 121 | if ~isempty(x_shift)
|
---|
| 122 | varargout{1}(1)=x_shift;
|
---|
| 123 | end
|
---|
| 124 | if ~isempty(y_shift)
|
---|
| 125 | varargout{1}(2)=y_shift;
|
---|
| 126 | end
|
---|
| 127 | if ~isempty(z_shift)
|
---|
| 128 | varargout{1}(3)=z_shift;
|
---|
| 129 | end
|
---|
| 130 | end
|
---|
| 131 | % The figure can be deleted now
|
---|
| 132 | delete(handles.figure1);
|
---|
| 133 |
|
---|
| 134 | % --- Executes on button press in OK.
|
---|
| 135 | function OK_Callback(hObject, eventdata, handles)
|
---|
| 136 | handles.output = get(hObject,'String');
|
---|
| 137 | guidata(hObject, handles);% Update handles structure
|
---|
| 138 | uiresume(handles.figure1);
|
---|
| 139 |
|
---|
| 140 | % --- Executes on button press in Cancel.
|
---|
| 141 | function Cancel_Callback(hObject, eventdata, handles)
|
---|
| 142 | handles.output = get(hObject,'String');
|
---|
| 143 | guidata(hObject, handles); % Update handles structure
|
---|
| 144 | uiresume(handles.figure1);
|
---|
| 145 |
|
---|
| 146 | % --- Executes when user attempts to close figure1.
|
---|
| 147 | function figure1_CloseRequestFcn(hObject, eventdata, handles)
|
---|
| 148 | if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
|
---|
| 149 | % The GUI is still in UIWAIT, us UIRESUME
|
---|
| 150 | uiresume(handles.figure1);
|
---|
| 151 | else
|
---|
| 152 | % The GUI is no longer waiting, just close it
|
---|
| 153 | delete(handles.figure1);
|
---|
| 154 | end
|
---|
| 155 |
|
---|
| 156 | % --- Executes on key press over figure1 with no controls selected.
|
---|
| 157 | function figure1_KeyPressFcn(hObject, eventdata, handles)
|
---|
| 158 | % Check for "enter" or "escape"
|
---|
| 159 | if isequal(get(hObject,'CurrentKey'),'escape')
|
---|
| 160 | % User said no by hitting escape
|
---|
| 161 | handles.output = 'Cancel';
|
---|
| 162 |
|
---|
| 163 | % Update handles structure
|
---|
| 164 | guidata(hObject, handles);
|
---|
| 165 |
|
---|
| 166 | uiresume(handles.figure1);
|
---|
| 167 | end
|
---|
| 168 | if isequal(get(hObject,'CurrentKey'),'return')
|
---|
| 169 | uiresume(handles.figure1);
|
---|
| 170 | end
|
---|
| 171 |
|
---|
| 172 |
|
---|
| 173 |
|
---|