More tests + GUI
[ltsps.git] / drawCities.m
blob6711cf53108b614b03fbae59c44e4cbdf78be9f3
1 function drawCities (coordsMatrix)
2     % drawCities
3     % description: Draws a dot on the map for each city.
4     % author: Laurens Van Houtven <lvh@laurensvh.be>
5     % date: 3 Oct 2008
6     
7     % Extract coordinate vectors for easy access.
8     xCoords = coordsMatrix(:,2);
9     yCoords = coordsMatrix(:,3);
10     
11     cla;    
12     xAxisMin = 0; yAxisMin = 0;
13     [xAxisMax yAxisMax] = getAxisMaximums(xCoords, yCoords);
14     
15     plot(xCoords, yCoords, 'or'); % draw red circles
16     axis([xAxisMin xAxisMax yAxisMin yAxisMax]);
17     
18     
19     hold on;
20     drawnow;
21 end
23 function [xAxisMax, yAxisMax] = getAxisMaximums (xCoords, yCoords)
24     % getAxisMaximums
25     % description: Tries to find decent axis maximums for the given data.
26     % author: Laurens Van Houtven <lvh@laurensvh.be>
27     % date: 3 Oct 2008
28     
29     % Verbosity for debugging purposes.
30     VERBOSE = 0;
31     
32     if max(xCoords) < 100
33         xAxisMax = (ceil(max(xCoords)/10)+1)*10;
34     else
35         xAxisMax = (ceil(max(xCoords)/100)+1)*100;
36     end
37     
38     if max(yCoords) < 100
39         yAxisMax = (ceil(max(yCoords)/10)+1)*10;
40     else
41         yAxisMax = (ceil(max(yCoords)/100)+1)*100;
42     end         
43     
44     if VERBOSE
45         display(xAxisMax);
46         display(yAxisMax);
47     end
48 end