Create a DEFAULT_ALTITUDE macro

It is set to 280.0, which is roughly the average altitude of dry land
This commit is contained in:
Gergely Polonkai 2014-08-17 09:36:30 +02:00
parent cb99af5a0d
commit cdb856d8ed
4 changed files with 6 additions and 4 deletions

View File

@ -18,6 +18,7 @@ AC_PATH_PROGS(UNZIP, [unzip])
have_geonames_perl_modules=no
AX_PROG_PERL_MODULES([XML::Writer IO::File], [have_geonames_perl_modules=yes], AC_MSG_WARN([XML::Writer and IO::File perl modules are required if you want to regenerate geodata.xml!]))
AC_SUBST([have_geonames_perl_modules])
AC_DEFINE([DEFAULT_ALTITUDE], [280.0], [Set this to the default altitude value, which is used if there is no value in geodata.xml])
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=astrognome
AC_SUBST(GETTEXT_PACKAGE)

View File

@ -11,6 +11,7 @@
#include <math.h>
#include <string.h>
#include "config.h"
#include "ag-db.h"
#include "ag-chart.h"
#include "placidus.h"
@ -1262,7 +1263,7 @@ AgChart *ag_chart_load_from_placidus_file(GFile *file,
chart = ag_chart_new_full(
timestamp,
real_long, real_lat, 280.0,
real_long, real_lat, DEFAULT_ALTITUDE,
GSWE_HOUSE_SYSTEM_PLACIDUS
);

View File

@ -955,8 +955,7 @@ ag_db_get_chart_data_by_id(AgDb *db, guint row_id, GError **err)
attributes = gda_data_model_get_attributes_at(result, COLUMN_ALTITUDE, 0);
if (attributes | GDA_VALUE_ATTR_IS_NULL) {
/* TODO: this value should be macroified */
save_data->altitude = 280.0;
save_data->altitude = DEFAULT_ALTITUDE;
} else {
save_data->altitude = g_value_get_double(value);
}

View File

@ -10,6 +10,7 @@
#include <swe-glib.h>
#include "config.h"
#include "ag-app.h"
#include "ag-window.h"
#include "ag-chart.h"
@ -574,7 +575,7 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything)
}
// TODO: So as this…
edit_data->altitude = 280.0;
edit_data->altitude = DEFAULT_ALTITUDE;
edit_data->year = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(priv->year)
);