4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Terrain/RasterMap.hpp"
25 #include "Terrain/HeightMatrix.hpp"
26 #include "Projection/WindowProjection.hpp"
27 #include "Screen/Layout.hpp"
28 #include "OS/Args.hpp"
29 #include "OS/PathName.hpp"
30 #include "Compatibility/path.h"
31 #include "Operation/Operation.hpp"
37 unsigned Layout::scale_1024
= 1024;
39 int main(int argc
, char **argv
)
41 Args
args(argc
, argv
, "PATH");
42 const tstring map_path
= args
.ExpectNextT();
46 _tcscpy(jp2_path
, map_path
.c_str());
47 _tcscat(jp2_path
, _T(DIR_SEPARATOR_S
) _T("terrain.jp2"));
50 _tcscpy(j2w_path
, map_path
.c_str());
51 _tcscat(j2w_path
, _T(DIR_SEPARATOR_S
) _T("terrain.j2w"));
53 NullOperationEnvironment operation
;
54 RasterMap
map(jp2_path
, j2w_path
, NULL
, operation
);
55 if (!map
.IsDefined()) {
56 fprintf(stderr
, "failed to load map\n");
61 map
.SetViewCenter(map
.GetMapCenter(), fixed(50000));
62 } while (map
.IsDirty());
64 fixed radius
= fixed(50000);
65 WindowProjection projection
;
66 projection
.SetScreenSize({640, 480});
67 projection
.SetScaleFromRadius(radius
);
68 projection
.SetGeoLocation(map
.GetMapCenter());
69 projection
.SetScreenOrigin(320, 240);
70 projection
.UpdateScreenBounds();
74 matrix
.Fill(map
, projection
.GetScreenBounds(),
75 projection
.GetScreenWidth(), projection
.GetScreenHeight(),
78 matrix
.Fill(map
, projection
, 1, false);