📄 topview.m
字号:
end% --------------------------------------------------------------------
function C2_z_edit_Callback(hObject, eventdata, handles)handles.config.C2(3) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P1_x_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P1_x_edit_Callback(hObject, eventdata, handles)handles.config.P1(1) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P1_y_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P1_y_edit_Callback(hObject, eventdata, handles)handles.config.P1(2) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P1_z_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P1_z_edit_Callback(hObject, eventdata, handles)handles.config.P1(3) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P2_x_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P2_x_edit_Callback(hObject, eventdata, handles)handles.config.P2(1) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P2_y_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P2_y_edit_Callback(hObject, eventdata, handles)handles.config.P2(2) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function P2_z_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function P2_z_edit_Callback(hObject, eventdata, handles)handles.config.P2(3) = str2num(get(hObject,'String'));
handles = update_topview(handles);
set_axis_limmits(handles);
handles.config.type = 'General Surface Array';
set(handles.Config_popup,'String', handles.config.type);
guidata(hObject, handles);
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function CP_x_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function CP_x_edit_Callback(hObject, eventdata, handles)
x = str2double(get(handles.CP_x_edit,'string'));
if ishandle(handles.topview.current_apex{3})
handles.config.(handles.topview.current_apex{1})(handles.topview.current_apex{2},1) = x;
set(handles.topview.current_apex{3},'xdata',x);
handles = update_topview(handles);
guidata(hObject,handles);
end
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function CP_y_edit_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
function CP_y_edit_Callback(hObject, eventdata, handles)
y = str2double(get(handles.CP_y_edit,'string'));
if ishandle(handles.topview.current_apex{3})
handles.config.(handles.topview.current_apex{1})(handles.topview.current_apex{2},2) = y;
set(handles.topview.current_apex{3},'ydata',y);
handles = update_topview(handles);
guidata(hObject,handles);
end
% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function Config_popup_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --------------------------------------------------------------------
% --- Executes on selection change in Config_popup.function Config_popup_Callback(hObject, eventdata, handles)% --------------------------------------------------------------------
% --- Executes on button press in Cancel_button.function Cancel_button_Callback(hObject, eventdata, handles)handles.output = 'Cancel';
uiresume(handles.figure1);
% --------------------------------------------------------------------
% --- Executes on button press in OK_button.function OK_button_Callback(hObject, eventdata, handles)handles.output = handles.config;
guidata(hObject,handles);
uiresume(handles.figure1);
%delete(handles.figure1);
% --------------------------------------------------------------------
% --- Executes on button press in Add_button.function Add_button_Callback(hObject, eventdata, handles)% --------------------------------------------------------------------
% --- Executes on button press in Delete_button.function Delete_button_Callback(hObject, eventdata, handles)
if handles.topview.current_apex{2}~=0
delete(handles.topview.(handles.topview.current_apex{1})(handles.topview.current_apex{2}));
handles.topview.(handles.topview.current_apex{1})(handles.topview.current_apex{2}) = [];
handles.config.(handles.topview.current_apex{1})(handles.topview.current_apex{2},:) = [];
handles.topview.current_apex{2} = handles.topview.current_apex{2}-1;
if handles.topview.current_apex{2} == 0 & isempty(handles.config.(handles.topview.current_apex{1}));
delete(handles.topview.current_apex{3});
else
if handles.topview.current_apex{2} == 0
handles.topview.current_apex{2} = 1;
end
set(handles.topview.current_apex{3},'xdata',...
handles.config.(handles.topview.current_apex{1})(handles.topview.current_apex{2},1),...
'ydata',handles.config.(handles.topview.current_apex{1})(handles.topview.current_apex{2},2));
end
handles = update_topview(handles);
guidata(hObject,handles);
end% --------------------------------------------------------------------
% --- Executes during object creation, after setting all properties.function figure1_CreateFcn(hObject, eventdata, handles)% --------------------------------------------------------------------
% --- Executes on mouse press over axes background.function axes1_ButtonDownFcn(hObject, eventdata, handles)
click_type = get(gcbf,'SelectionType');
switch click_type
case{'normal'} % left click
disp(['New Point ... Left click!']);
CurrentPoint = round(mean(get(gca,'CurrentPoint')).*10)./10;
set(handles.CP_x_edit,'string',num2str(CurrentPoint(1)));
set(handles.CP_y_edit,'string',num2str(CurrentPoint(2)));
handles = add_apex(handles,CurrentPoint(1:2),handles.topview.current_apex{1});
set(gcbf,'WindowButtonMotionFcn',{@apex_move_Callback,...
handles.topview.current_apex{1}});
set(gcbf,'WindowButtonUpFcn',@ButtonUpFcn);
case{'extend'} % Shift - left
case{'alt'} % Ctrl - left
case{'open'} % Double click
end
guidata(hObject,handles);
% --------------------------------------------------------------------
% --- Executes on mouse press over apex.
function apex_ButtonDownFcn(hObject, eventdata, wire)%, handles)
handles = guidata(hObject);
click_type = get(gcbf,'SelectionType');
switch click_type
case{'normal'} % left click
disp(['Apex ... Left click!']);
if ~isfield(handles.config,wire) | isempty(handles.config.(wire))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -