[Gpredict-svn] SF.net SVN: gpredict:[896] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-09-07 23:32:04
|
Revision: 896
http://gpredict.svn.sourceforge.net/gpredict/?rev=896&view=rev
Author: aa1vs
Date: 2011-09-07 23:31:58 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
Update progress bar calculation for tle update.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/tle-update.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-09-07 01:17:30 UTC (rev 895)
+++ trunk/ChangeLog 2011-09-07 23:31:58 UTC (rev 896)
@@ -2,6 +2,13 @@
* ChangeLog
* src/tle-update.c
+ Update progress bar calculation for tle update.
+
+
+2011-09-07 Charles Suprin <hamaa1vs at gmail.com>
+
+ * ChangeLog
+ * src/tle-update.c
Save status for new satellites.
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2011-09-07 01:17:30 UTC (rev 895)
+++ trunk/src/tle-update.c 2011-09-07 23:31:58 UTC (rev 896)
@@ -296,15 +296,31 @@
}
if (progress != NULL) {
-
- /* calculate and saturate fraction
- (number of sats in TLE files is greater
- than the number of sats in link table)
- */
- fraction = start + (1.0-start) * ((gdouble) total) / ((gdouble) num);
- if (fraction >= 0.95)
- fraction = 0.98;
-
+ /* two different calculations for completeness depending on whether
+ we are adding new satellites or not. */
+ if (sat_cfg_get_bool (SAT_CFG_BOOL_TLE_ADD_NEW)) {
+ /* In this case we are possibly processing more than num satellites
+ How many more? We do not know yet. Worst case is g_hash_table_size more.
+
+ As we update skipped and updated we can reduce the denominator count
+ as those are in both pools (files and hash table). When we have processed
+ all the files, updated and skipped are completely correct and the progress
+ is correct. It may be correct sooner if the missed satellites are the
+ last files to process.
+
+ Until then, if we eliminate the ones that are updated and skipped from being
+ double counted, our progress will shown will always be less or equal to our
+ true progress since the denominator will be larger than is correct.
+
+ Advantages to this are that the progress bar does not stall close to
+ finished when there are a large number of new satellites.
+ */
+ fraction = start + (1.0-start) * ((gdouble) total) /
+ ((gdouble) num + g_hash_table_size(data) - updated - skipped);
+ } else {
+ /* here we only process satellites we have have files for so divide by num */
+ fraction = start + (1.0-start) * ((gdouble) total) / ((gdouble) num);
+ }
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
fraction);
@@ -644,7 +660,7 @@
if (!silent && (progress != NULL)) {
/* complete download corresponds to 50% */
- fraction = start + (0.5-start) * i / (2.0 * numfiles);
+ fraction = start + (0.5-start) * i / (1.0 * numfiles);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), fraction);
/* Force the drawing queue to be processed otherwise there will
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|