function varargout = Dijkstra_GUI(varargin)
%% code by 胡健雄 2011-12-01 793567016@qq.com
% DIJKSTRA_GUI M-file for Dijkstra_GUI.fig
% DIJKSTRA_GUI, by itself, creates a new DIJKSTRA_GUI or raises the existing
% singleton*.
%
% H = DIJKSTRA_GUI returns the handle to a new DIJKSTRA_GUI or the handle to
% the existing singleton*.
%
% DIJKSTRA_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DIJKSTRA_GUI.M with the given input arguments.
%
% DIJKSTRA_GUI('Property','Value',...) creates a new DIJKSTRA_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Dijkstra_GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Dijkstra_GUI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Dijkstra_GUI
% Last Modified by GUIDE v2.5 31-Jan-2012 23:58:26
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Dijkstra_GUI_OpeningFcn, ...
'gui_OutputFcn', @Dijkstra_GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Dijkstra_GUI is made visible.
function Dijkstra_GUI_OpeningFcn(hObject, ~, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Dijkstra_GUI (see VARARGIN)
% Choose default command line output for Dijkstra_GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Dijkstra_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%%
global G e C_r CDC
%%
movegui(gcf,'center');
h1=findall(0,'type','uipushtool');
set(h1,'visible','off');
h2=findall(0,'type','uitoggletool');
h2=[h2(1);h2(2);h2(3);h2(5);h2(9)];
set(h2,'visible','off');
%%
hWaitbar=waitbar(0,'正在绘制,请等待...','WindowStyle','modal');
graphdata;
datacursormode on;cla;
%描绘道路分布图
for i=1:size(G,1)
plot([e(G(i,1),1),e(G(i,2),1)],[e(G(i,1),2),e(G(i,2),2)],...
'Linestyle','-','Color',C_r(G(i,1),:)),hold on;
plot(e(G(i,1),1),e(G(i,1),2),'Marker','*','Color',C_r(G(i,1),:)),hold on;
plot(e(G(i,2),1),e(G(i,2),2),'Marker','*','Color',C_r(G(i,2),:)),hold on;
waitbar(i/size(G,1),hWaitbar);
end
axis equal;
dcm_obj=datacursormode(hObject);
set(dcm_obj,'UpdateFcn',@myupdatefcn);
setappdata(hObject,'isPressed',false);
CDC=[];
delete(hWaitbar);
% --- Outputs from this function are returned to the command line.
function varargout = Dijkstra_GUI_OutputFcn(~, ~, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function Start_Callback(~, ~, ~)
% hObject handle to Start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Start as text
% str2double(get(hObject,'String')) returns contents of Start as a double
% --- Executes during object creation, after setting all properties.
function Start_CreateFcn(hObject, ~, ~)
% hObject handle to Start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Finate_Callback(~, ~, ~)
% hObject handle to Finate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Finate as text
% str2double(get(hObject,'String')) returns contents of Finate as a double
% --- Executes during object creation, after setting all properties.
function Finate_CreateFcn(hObject, ~, ~)
% hObject handle to Finate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Radius_Callback(~, ~, ~)
% hObject handle to Radius (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Radius as text
% str2double(get(hObject,'String')) returns contents of Radius as a double
% --- Executes during object creation, after setting all properties.
function Radius_CreateFcn(hObject, ~, ~)
% hObject handle to Radius (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Distance_Callback(~, ~, ~)
% hObject handle to Distance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Distance as text
% str2double(get(hObject,'String')) returns contents of Distance as a double
% --- Executes during object creation, after setting all properties.
function Distance_CreateFcn(hObject, ~, ~)
% hObject handle to Distance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit1_Callback(~, ~, ~)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, ~, ~)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background o