Opis rada



Univerzitet Crne GorePomorski fakultet KotorStudijski program: Pomorske naukeUpotreba GIS tehnologija u pomorstvu(GRUPA 2)?lanovi grupe: Mentor: prof. dr Radovan Stojanovi?Sava ?u?ur 2/17Stefan Jokanovi? 3/17Mario Marvu?i? 8/17Milo? Mitrovi? 11/17Andrija Pejovi? 16/17Dra?ko Nenezi? 17/17Kotor, decembar 2017Sadr?aj TOC \o "1-3" \h \z \u 1.Opis rada PAGEREF _Toc503966707 \h 12.Uputstvo za kori??enje PAGEREF _Toc503966708 \h 13.Prilog 1: Matlab kod programa PAGEREF _Toc503966709 \h 3Opis radaU ovom radu zadatak je bio napraviti kod u Matlab programu koji u?itava shp fajl koji prikazuje ili svjetsku obalnu mapu ili mapu Evrope. Mi smo se odlu?ili na shp fajl koji u?itava obalne konture Evrope. Na internetu smo prona?li izvore iz kojih smo preuzeli shp fajl. Tako?e programski kod omogu?ava u?itavanje pozicija plovila ukucavanjem odre?enih kordinata u odgovaraju?im poljima kao i odabir vrste plovila koje se nalazi na zadatoj poziciji. Jo? jedno polje nam tako?e omogu?ava upisivanje imena plovila.Uputstvo za kori??enjeNakon ?to se fajlovi programskog koda ubace u odgovaraju?i direktorijum u Matlabu, potrebno ih je pokrenuti, konkretno za GRUPU 2 potrebno je aktivirati fajl drugi.m pritiskom na opciju RUN. Nakon toga dolazi do pojavljivanja slede?eg intefejsa:Slika 1: Po?etni interfejsNakon ovoga potrebno je pritisnuti dugem U?itaj mapu kako bi se u?itao shp fajl koji prikazuje obalne konture Evrope, onda mo?emo pristupiti uno?enju geografske ?irine i geografske du?ine u odgovaraju?im poljima. Nakon toga mo?emo unjeti ime plovila i odabrati vrstu plovila. Kada smo naveli sve potrebne informacije pritiskom na dugme Dodaj imamo prikaz pozicije plovila na mapi. Na slede?oj slici imamo potpuni prikaz kako funkcioni?e programski kod.Slika 2: Prikaz shp fajla gdje se u?itavaju kordinate plovila.Tako?e razli?itim markerima obilje?avaju se razli?iti tipovi broda. Prilog 1: Matlab kod programafunction varargout = drugi(varargin)% DRUGI MATLAB code for drugi.fig% DRUGI, by itself, creates a new DRUGI or raises the existing% singleton*.%% H = DRUGI returns the handle to a new DRUGI or the handle to% the existing singleton*.%% DRUGI('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in DRUGI.M with the given input arguments.%% DRUGI('Property','Value',...) creates a new DRUGI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before drugi_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to drugi_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 drugi % Last Modified by GUIDE v2.5 22-Dec-2017 19:29:21 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @drugi_OpeningFcn, ... 'gui_OutputFcn', @drugi_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 drugi is made visible.function drugi_OpeningFcn(hObject, eventdata, 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 drugi (see VARARGIN) % Choose default command line output for drugihandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes drugi wait for user response (see UIRESUME)% uiwait(handles.figure1); % --- Outputs from this function are returned to the command line.function varargout = drugi_OutputFcn(hObject, eventdata, 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 structurevarargout{1} = handles.output; % --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles) %ovo je dio koda za ucitavanje coastline mape evrope i ucitava se na klik%Ucitaj mapup = worldmap('Europe')load coastlinesgeoshow(coastlat,coastlon) %dio koda da se mapa prikazuje samo sa lijeve strane da se ne preklapa sa%panelom za unosenje plovilarect = [0.01, 0.25, 0.7, 0.70];set(p, 'Position', rect) %ovo je dio koda za ucitavanje plovila iz shp fajlaP=shaperead('plovila.shp');brPlovila=length(P);% for petlja koja dodaje jedno po jedno plovilo na mapu i ispisuje naziv% plovilafor n = 1:brPlovila % kada se plovilo cuva u shp fajlu cuvaju se i ime tip markera i boja % radi priakza kasnije geoshow(P(n).X, P(n).Y, 'Marker', P(n).Marker, 'MarkerEdgeColor', P(n).Color) textm(P(n).X, (P(n).Y)+0.01, P(n).Name); end % hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % --- Executes on slider movement.function slider1_Callback(hObject, eventdata, handles)% hObject handle to slider1 (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,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of slider % --- Executes during object creation, after setting all properties.function slider1_CreateFcn(hObject, eventdata, handles)% hObject handle to slider1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]);end function latitude_input_Callback(hObject, eventdata, handles)% hObject handle to latitude_input (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 latitude_input as text% str2double(get(hObject,'String')) returns contents of latitude_input as a double % --- Executes during object creation, after setting all properties.function latitude_input_CreateFcn(hObject, eventdata, handles)% hObject handle to latitude_input (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 longitude_input_Callback(hObject, eventdata, handles)% hObject handle to longitude_input (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 longitude_input as text% str2double(get(hObject,'String')) returns contents of longitude_input as a double % --- Executes during object creation, after setting all properties.function longitude_input_CreateFcn(hObject, eventdata, handles)% hObject handle to longitude_input (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 % --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % dio koda za dodavanje novog plovila lat = str2double(get(handles.latitude_input, 'string')); % uzima latlon = str2double(get(handles.longitude_input, 'string')); % uzima longime = get(handles.name_input,'string'); % uzima imepopupindex = get(handles.popupmenu1, 'value'); % kupi vrijednost iz padajuce liste %i to dalje odredjuje tip plovila marker i boju%Marker moze imati neku od sl vrijednosti:%'+' | 'o' | '*' | '.' | 'x' | 'square' | 'diamond' | 'v' | '^' | '>' | '<' |%'pentagram' | 'hexagram' | 'none'switch popupindex case 1 tip_plovila = 'Nepoznato'; color = 'm'; marker = '^'; case 2 tip_plovila = 'Jahta'; color = 'blue'; marker = 'diamond'; case 3 tip_plovila = 'Kruzer'; color = 'red'; marker = '*'; case 4 tip_plovila = 'Tanker'; color = 'green'; marker = 'o'; case 5 tip_plovila = 'Ostala plovila'; color = 'yellow'; marker = 'x'; end % dio za iscrtavanje markerageoshow(lat, lon, 'Marker', marker, 'MarkerEdgeColor', color)textm(lat, lon + 0.01, ime);% dio za dodavanje markera u shp fajlp = mappoint(shaperead('plovila.shp'));p = append(p,lat, lon, 'Name', ime,'TipPlovila',tip_plovila, 'Marker',marker,'Color',color);shapewrite(p,'plovila'); % --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: popupmenu 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 name_input_Callback(hObject, eventdata, handles)% hObject handle to name_input (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 name_input as text% str2double(get(hObject,'String')) returns contents of name_input as a double % --- Executes during object creation, after setting all properties.function name_input_CreateFcn(hObject, eventdata, handles)% hObject handle to name_input (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 uitoggletool11_ClickedCallback(hObject, eventdata, handles) % hObject handle to uitoggletool11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches