[Gpredict-svn] SF.net SVN: gpredict:[101] trunk/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2008-09-09 17:57:44
|
Revision: 101 http://gpredict.svn.sourceforge.net/gpredict/?rev=101&view=rev Author: csete Date: 2008-09-09 17:57:54 +0000 (Tue, 09 Sep 2008) Log Message: ----------- Added support for variable twilight threshold in prediction of satellite visibility. Modified Paths: -------------- trunk/src/sat-cfg.c trunk/src/sat-cfg.h trunk/src/sat-pref-conditions.c trunk/src/sat-vis.c Modified: trunk/src/sat-cfg.c =================================================================== --- trunk/src/sat-cfg.c 2008-09-07 11:07:03 UTC (rev 100) +++ trunk/src/sat-cfg.c 2008-09-09 17:57:54 UTC (rev 101) @@ -177,6 +177,7 @@ { "PREDICT", "MULTI_PASS_COL", MULTI_PASS_COL_DEFAULTS}, { "PREDICT", "SAVE_FORMAT", 0}, { "PREDICT", "SAVE_CONTENTS", 0}, + { "PREDICT", "TWILIGHT_THRESHOLD", -6}, { "SKY_AT_GLANCE", "TIME_SPAN_HOURS", 8}, { "SKY_AT_GLANCE", "COLOUR_01", 0x3c46c8}, { "SKY_AT_GLANCE", "COLOUR_02", 0x00500a}, Modified: trunk/src/sat-cfg.h =================================================================== --- trunk/src/sat-cfg.h 2008-09-07 11:07:03 UTC (rev 100) +++ trunk/src/sat-cfg.h 2008-09-09 17:57:54 UTC (rev 101) @@ -100,6 +100,7 @@ SAT_CFG_INT_PRED_MULTI_COL, /*!< Visible columns in multi-pass dialog */ SAT_CFG_INT_PRED_SAVE_FORMAT, /*!< Last used save format for predictions */ SAT_CFG_INT_PRED_SAVE_CONTENTS, /*!< Last selection for save file contents */ + SAT_CFG_INT_PRED_TWILIGHT_THLD, /*!< Twilight zone threshold */ SAT_CFG_INT_SKYATGL_TIME, /*!< Time span for sky at a glance predictions */ SAT_CFG_INT_SKYATGL_COL_01, /*!< Colour 1 in sky at a glance predictions */ SAT_CFG_INT_SKYATGL_COL_02, /*!< Colour 2 in sky at a glance predictions */ Modified: trunk/src/sat-pref-conditions.c =================================================================== --- trunk/src/sat-pref-conditions.c 2008-09-07 11:07:03 UTC (rev 100) +++ trunk/src/sat-pref-conditions.c 2008-09-09 17:57:54 UTC (rev 101) @@ -40,6 +40,7 @@ static GtkWidget *lookahead; static GtkWidget *res; static GtkWidget *nument; +static GtkWidget *twspin; static gboolean dirty = FALSE; /* used to check whether any changes have occurred */ static gboolean reset = FALSE; @@ -66,7 +67,7 @@ dirty = FALSE; reset = FALSE; - table = gtk_table_new (9, 3, FALSE); + table = gtk_table_new (12, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 10); gtk_table_set_col_spacings (GTK_TABLE (table), 5); @@ -261,7 +262,60 @@ GTK_SHRINK, 0, 0); + /* separator */ + gtk_table_attach (GTK_TABLE (table), + gtk_hseparator_new (), + 0, 3, 9, 10, + GTK_FILL | GTK_EXPAND, + GTK_SHRINK, + 0, 0); + /* satellite visibility */ + label = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (label), _("<b>Satellite Visibility:</b>")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, 10, 11, + GTK_FILL, + GTK_SHRINK, + 0, 0); + + /* twilight threshold */ + label = gtk_label_new (_("Twilight threshold")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, 11, 12, + GTK_FILL, + GTK_SHRINK, + 0, 0); + twspin = gtk_spin_button_new_with_range (-18, 0, 1); + gtk_widget_set_tooltip_text (twspin, + _("Satellites are only considered visible if the elevation "\ + "of the Sun is below the specified threshold.\n"\ + " \342\200\242 Astronomical: -18\302\260 to -12\302\260\n"\ + " \342\200\242 Nautical: -12\302\260 to -6\302\260\n"\ + " \342\200\242 Civil: -6\302\260 to 0\302\260")); + gtk_spin_button_set_digits (GTK_SPIN_BUTTON (twspin), 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (twspin), TRUE); + gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (twspin), FALSE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (twspin), + sat_cfg_get_int (SAT_CFG_INT_PRED_TWILIGHT_THLD)); + g_signal_connect (G_OBJECT (twspin), "value-changed", + G_CALLBACK (spin_changed_cb), NULL); + gtk_table_attach (GTK_TABLE (table), twspin, + 1, 2, 11, 12, + GTK_FILL, + GTK_SHRINK, + 0, 0); + label = gtk_label_new (_("[deg]")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, + 2, 3, 11, 12, + GTK_FILL | GTK_EXPAND, + GTK_SHRINK, + 0, 0); + + /* create vertical box */ vbox = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 20); @@ -301,6 +355,8 @@ gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (res))); sat_cfg_set_int (SAT_CFG_INT_PRED_NUM_ENTRIES, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (nument))); + sat_cfg_set_int (SAT_CFG_INT_PRED_TWILIGHT_THLD, + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (twspin))); dirty = FALSE; } @@ -310,6 +366,7 @@ sat_cfg_reset_int (SAT_CFG_INT_PRED_LOOK_AHEAD); sat_cfg_reset_int (SAT_CFG_INT_PRED_RESOLUTION); sat_cfg_reset_int (SAT_CFG_INT_PRED_NUM_ENTRIES); + sat_cfg_reset_int (SAT_CFG_INT_PRED_TWILIGHT_THLD); reset = FALSE; } @@ -380,6 +437,8 @@ sat_cfg_get_int_def (SAT_CFG_INT_PRED_RESOLUTION)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (nument), sat_cfg_get_int_def (SAT_CFG_INT_PRED_NUM_ENTRIES)); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (twspin), + sat_cfg_get_int_def (SAT_CFG_INT_PRED_TWILIGHT_THLD)); /* reset flags */ Modified: trunk/src/sat-vis.c =================================================================== --- trunk/src/sat-vis.c 2008-09-07 11:07:03 UTC (rev 100) +++ trunk/src/sat-vis.c 2008-09-09 17:57:54 UTC (rev 101) @@ -31,6 +31,7 @@ #include "sgpsdp/sgp4sdp4.h" #include "gtk-sat-data.h" #include "sat-vis.h" +#include "sat-cfg.h" static gchar VIS2CHR[SAT_VIS_NUM] = { '-', 'V', 'D', 'E'}; @@ -56,6 +57,7 @@ { gboolean sat_sun_status; gdouble sun_el; + gdouble threshold; gdouble eclipse_depth; sat_vis_t vis = SAT_VIS_NONE; vector_t zero_vector = {0,0,0,0}; @@ -86,10 +88,12 @@ sat_sun_status = TRUE; } - sun_el = Degrees (solar_set.el); if (sat_sun_status) { - if (sun_el <= -12.0 && sat->el >= 0.0) + sun_el = Degrees (solar_set.el); + threshold = (gdouble) sat_cfg_get_int (SAT_CFG_INT_PRED_TWILIGHT_THLD); + + if (sun_el <= threshold && sat->el >= 0.0) vis = SAT_VIS_VISIBLE; else vis = SAT_VIS_DAYLIGHT; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |