gpredict-svn Mailing List for Gpredict (Page 6)
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
You can subscribe to this list here.
2008 |
Jan
(24) |
Feb
|
Mar
(6) |
Apr
(14) |
May
(9) |
Jun
|
Jul
|
Aug
(25) |
Sep
(60) |
Oct
(26) |
Nov
|
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(2) |
Mar
(22) |
Apr
(61) |
May
(57) |
Jun
|
Jul
(3) |
Aug
(83) |
Sep
(35) |
Oct
(50) |
Nov
(28) |
Dec
(34) |
2010 |
Jan
(29) |
Feb
(15) |
Mar
(2) |
Apr
|
May
(6) |
Jun
(2) |
Jul
(24) |
Aug
(2) |
Sep
(9) |
Oct
(43) |
Nov
(22) |
Dec
(6) |
2011 |
Jan
(24) |
Feb
(22) |
Mar
(31) |
Apr
(13) |
May
(10) |
Jun
(10) |
Jul
(43) |
Aug
(12) |
Sep
(18) |
Oct
(33) |
Nov
(18) |
Dec
(4) |
From: <aa...@us...> - 2011-07-03 14:05:29
|
Revision: 840 http://gpredict.svn.sourceforge.net/gpredict/?rev=840&view=rev Author: aa1vs Date: 2011-07-03 14:05:23 +0000 (Sun, 03 Jul 2011) Log Message: ----------- Show catalog number in satellite selector. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-selector.c trunk/src/gtk-sat-selector.h trunk/src/mod-cfg.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-07-02 19:55:16 UTC (rev 839) +++ trunk/ChangeLog 2011-07-03 14:05:23 UTC (rev 840) @@ -1,5 +1,13 @@ -2011-06-29 Charles Suprin <hamaa1vs at gmail.com> +2011-07-03 Charles Suprin <hamaa1vs at gmail.com> + * src/gtk-sat-selector.c + * src/gtk-sat-selector.h + * src/mod-cfg.c + Show catalog number in satellite selector. + Address 3322786: Show More Information in Edit Module Sat Selection. + +2011-07-01 Charles Suprin <hamaa1vs at gmail.com> + * src/gtk-sat-map.c Add check on satellite map object allocation. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-07-02 19:55:16 UTC (rev 839) +++ trunk/NEWS 2011-07-03 14:05:23 UTC (rev 840) @@ -3,6 +3,7 @@ - New menu item in the module menu for selecting a satellite in all views. - Feature request 3141555: gpsd support. - Feature request 2130926: Change frequency using mouse wheel. Also for rotator controller. +- Feature request 3322786: Show More Information in Edit Module Sat Selection. - Applied and extended patch 3237220: natural sort for sat list in module config - Improve handling of decayed satellites. - Fixed bug 3250344: Win32 build not working with hamlib. Modified: trunk/src/gtk-sat-selector.c =================================================================== --- trunk/src/gtk-sat-selector.c 2011-07-02 19:55:16 UTC (rev 839) +++ trunk/src/gtk-sat-selector.c 2011-07-03 14:05:23 UTC (rev 840) @@ -916,18 +916,28 @@ { const gchar *searchstring; gchar *satname; + gint catnr; + gchar *catnrstr; gboolean selected; - + gboolean retval = FALSE; + gtk_tree_model_get( model, iter, GTK_SAT_SELECTOR_COL_NAME, &satname, -1 ); + gtk_tree_model_get( model, iter, GTK_SAT_SELECTOR_COL_CATNUM, &catnr, -1 ); gtk_tree_model_get( model, iter, GTK_SAT_SELECTOR_COL_SELECTED, &selected, -1 ); searchstring = gtk_entry_get_text( entry ); + catnrstr = g_strdup_printf("%d",catnr); + //printf("satname %s catnr %s searchstring %s\n",satname,catnrstr,searchstring); /*if it is already selected then remove it from the available list*/ if (selected) - return( FALSE); - if( gpredict_strcasestr( satname, searchstring ) != (char *)NULL ) - return( TRUE ); - else - return( FALSE ); + retval = FALSE; + else if( gpredict_strcasestr( satname, searchstring ) != (char *)NULL ) + retval = TRUE; + else if( gpredict_strcasestr( catnrstr, searchstring ) != (char *)NULL ) + retval = TRUE; + + g_free (catnrstr); + return (retval); + } /** \brief Searches through all the models for the given satellite and sets its selected value. Modified: trunk/src/gtk-sat-selector.h =================================================================== --- trunk/src/gtk-sat-selector.h 2011-07-02 19:55:16 UTC (rev 839) +++ trunk/src/gtk-sat-selector.h 2011-07-03 14:05:23 UTC (rev 840) @@ -57,7 +57,7 @@ -#define GTK_SAT_SELECTOR_DEFAULT_FLAGS (GTK_SAT_SELECTOR_FLAG_NAME | GTK_SAT_SELECTOR_COL_CATNUM) +#define GTK_SAT_SELECTOR_DEFAULT_FLAGS (GTK_SAT_SELECTOR_FLAG_NAME | GTK_SAT_SELECTOR_FLAG_CATNUM) #define GTK_TYPE_SAT_SELECTOR (gtk_sat_selector_get_type ()) Modified: trunk/src/mod-cfg.c =================================================================== --- trunk/src/mod-cfg.c 2011-07-02 19:55:16 UTC (rev 839) +++ trunk/src/mod-cfg.c 2011-07-03 14:05:23 UTC (rev 840) @@ -623,7 +623,7 @@ "text", GTK_SAT_SELECTOR_COL_CATNUM, NULL); gtk_tree_view_insert_column (GTK_TREE_VIEW (satlist), column, -1); - gtk_tree_view_column_set_visible (column, FALSE); + gtk_tree_view_column_set_visible (column, TRUE); /* epoch */ renderer = gtk_cell_renderer_text_new (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-07-02 19:55:22
|
Revision: 839 http://gpredict.svn.sourceforge.net/gpredict/?rev=839&view=rev Author: aa1vs Date: 2011-07-02 19:55:16 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Add check on mod->grid allocation. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-module.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-07-02 15:51:44 UTC (rev 838) +++ trunk/ChangeLog 2011-07-02 19:55:16 UTC (rev 839) @@ -3,7 +3,10 @@ * src/gtk-sat-map.c Add check on satellite map object allocation. + * src/gtk-sat-module.c + Add check on mod->grid allocation. + 2011-06-29 Charles Suprin <hamaa1vs at gmail.com> * src/tle-update.c Modified: trunk/src/gtk-sat-module.c =================================================================== --- trunk/src/gtk-sat-module.c 2011-07-02 15:51:44 UTC (rev 838) +++ trunk/src/gtk-sat-module.c 2011-07-02 19:55:16 UTC (rev 839) @@ -619,13 +619,19 @@ /* number of views: we have five numbers per view (type,left,right,top,bottom) */ module->nviews = length / 5; module->grid = g_try_new0 (gint, length); - - /* FIXME: we should check module->grid != NULL */ - - /* convert chars to integers */ - for (i = 0; i < length; i++) { - module->grid[i] = (gint) g_ascii_strtoll (buffv[i], NULL, 0); - //g_print ("%d: %s => %d\n", i, buffv[i], module->grid[i]); + + /* if we cannot allocate memory for the grid zero the views out and log */ + if ( module->grid != NULL ) { + /* convert chars to integers */ + for (i = 0; i < length; i++) { + module->grid[i] = (gint) g_ascii_strtoll (buffv[i], NULL, 0); + //g_print ("%d: %s => %d\n", i, buffv[i], module->grid[i]); + } + } else { + module->nviews = 0; + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Unable to allocate memory for grid."), + __FUNCTION__); } g_strfreev (buffv); @@ -1566,8 +1572,7 @@ guint i; guint xmax = 0; guint ymax = 0; - - + for (i = 0; i < module->nviews; i++) { xmax = MAX(xmax,module->grid[5*i+2]); ymax = MAX(ymax,module->grid[5*i+4]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-07-02 15:51:50
|
Revision: 838 http://gpredict.svn.sourceforge.net/gpredict/?rev=838&view=rev Author: aa1vs Date: 2011-07-02 15:51:44 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Add check on satellite map object allocation. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-map.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-30 01:45:58 UTC (rev 837) +++ trunk/ChangeLog 2011-07-02 15:51:44 UTC (rev 838) @@ -1,5 +1,11 @@ 2011-06-29 Charles Suprin <hamaa1vs at gmail.com> + * src/gtk-sat-map.c + Add check on satellite map object allocation. + + +2011-06-29 Charles Suprin <hamaa1vs at gmail.com> + * src/tle-update.c Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates. Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-06-30 01:45:58 UTC (rev 837) +++ trunk/src/gtk-sat-map.c 2011-07-02 15:51:44 UTC (rev 838) @@ -1775,6 +1775,13 @@ /* create and initialize a sat object */ obj = g_try_new (sat_map_obj_t, 1); + if ( obj == NULL ) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Cannot allocate memory for satellite %d."), + __FUNCTION__, sat->tle.catnr); + return; + } + obj->selected = FALSE; obj->showtrack = FALSE; obj->showcov = TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-30 01:46:04
|
Revision: 837 http://gpredict.svn.sourceforge.net/gpredict/?rev=837&view=rev Author: aa1vs Date: 2011-06-30 01:45:58 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates. Modified Paths: -------------- trunk/ChangeLog trunk/src/tle-update.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-26 16:38:33 UTC (rev 836) +++ trunk/ChangeLog 2011-06-30 01:45:58 UTC (rev 837) @@ -1,3 +1,9 @@ +2011-06-29 Charles Suprin <hamaa1vs at gmail.com> + + * src/tle-update.c + Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates. + + 2011-06-26 Charles Suprin <hamaa1vs at gmail.com> * src/sat-log.c Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-06-26 16:38:33 UTC (rev 836) +++ trunk/src/tle-update.c 2011-06-30 01:45:58 UTC (rev 837) @@ -599,25 +599,28 @@ "cache", G_DIR_SEPARATOR_S, files[i], NULL); outfile = g_fopen (locfile, "wb"); - curl_easy_setopt (curl, CURLOPT_WRITEDATA, outfile); - curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_write_func); + if (outfile != NULL) { + curl_easy_setopt (curl, CURLOPT_WRITEDATA, outfile); + curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_write_func); + + /* get file */ + res = curl_easy_perform (curl); + + if (res != CURLE_OK) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error fetching %s (%s)"), + __FUNCTION__, curfile, curl_easy_strerror (res)); + error = TRUE; + } + else { + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Successfully fetched %s"), + __FUNCTION__, curfile); + success++; + } + fclose (outfile); - /* get file */ - res = curl_easy_perform (curl); - - if (res != CURLE_OK) { - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Error fetching %s (%s)"), - __FUNCTION__, curfile, curl_easy_strerror (res)); - error = TRUE; } - else { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Successfully fetched %s"), - __FUNCTION__, curfile); - success++; - } - /* update progress indicator */ if (!silent && (progress != NULL)) { @@ -636,7 +639,6 @@ g_free (userconfdir); g_free (curfile); g_free (locfile); - fclose (outfile); } curl_easy_cleanup (curl); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-26 16:38:39
|
Revision: 836 http://gpredict.svn.sourceforge.net/gpredict/?rev=836&view=rev Author: aa1vs Date: 2011-06-26 16:38:33 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Fixed log retention and deletion. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/sat-log.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-26 03:58:08 UTC (rev 835) +++ trunk/ChangeLog 2011-06-26 16:38:33 UTC (rev 836) @@ -1,3 +1,9 @@ +2011-06-26 Charles Suprin <hamaa1vs at gmail.com> + + * src/sat-log.c + Fix log retention and deletion. + + 2011-06-25 Charles Suprin <hamaa1vs at gmail.com> * src/qth-data.c Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-06-26 03:58:08 UTC (rev 835) +++ trunk/NEWS 2011-06-26 16:38:33 UTC (rev 836) @@ -9,6 +9,7 @@ - Fixed bug 3294829: Program name wrong in desktop files. - Fixed bug 3309110: 100% on manual time adjustment. - Fixed bug 3272993: Issue controlling Yaesu FT-847. +- Fixed bug 3334657: Old log files not being saved. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/sat-log.c =================================================================== --- trunk/src/sat-log.c 2011-06-26 03:58:08 UTC (rev 835) +++ trunk/src/sat-log.c 2011-06-26 16:38:33 UTC (rev 836) @@ -146,16 +146,15 @@ void sat_log_close () { - if (initialised) { - sat_log_log (SAT_LOG_LEVEL_MSG, - _("%s: Session ended"), __FUNCTION__); + if (initialised) { + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Session ended"), __FUNCTION__); g_io_channel_shutdown (logfile, TRUE, NULL); g_io_channel_unref (logfile); logfile = NULL; - initialised = FALSE; - if (sat_cfg_get_bool (SAT_CFG_BOOL_KEEP_LOG_FILES)) { - log_rotate (); - } + initialised = FALSE; + /* Always call log_rotate to get rid of old logs */ + log_rotate (); } } @@ -290,32 +289,32 @@ glong then; /* time in sec corresponding to age */ gchar *confdir,*dirname,*fname1,*fname2; - - /* initialise some vars */ - g_get_current_time (&now); + /* get cleaning age; if age non-zero do not rename log */ + age = sat_cfg_get_int (SAT_CFG_INT_LOG_CLEAN_AGE); + + /* initialise some vars */ + g_get_current_time (&now); confdir = get_user_conf_dir (); dirname = g_strconcat (confdir, G_DIR_SEPARATOR_S, "logs", NULL); - fname1 = g_strconcat (dirname, G_DIR_SEPARATOR_S, "gpredict.log", NULL); - fname2 = g_strdup_printf ("%s%sgpredict-%ld.log", - dirname, G_DIR_SEPARATOR_S, now.tv_sec); + fname1 = g_strconcat (dirname, G_DIR_SEPARATOR_S, "gpredict.log", NULL); + fname2 = g_strdup_printf ("%s%sgpredict-%ld.log", + dirname, G_DIR_SEPARATOR_S, now.tv_sec); + + if (age > 0) + g_rename (fname1, fname2); + - g_rename (fname1, fname2); - - - /* get cleaning age; if age non-zero perform cleaning */ - age = sat_cfg_get_int (SAT_CFG_INT_LOG_CLEAN_AGE); - if (age > 0) { - - /* calculate age for files that should be removed */ - then = now.tv_sec - age; - clean_log_dir (dirname, then); - - } - - g_free (dirname); - g_free (fname1); - g_free (fname2); + /* calculate age for files that should be removed */ + then = now.tv_sec - age; + + /* cleanup every time as old log files should be deleted if they exist */ + clean_log_dir (dirname, then); + + + g_free (dirname); + g_free (fname1); + g_free (fname2); g_free (confdir); } @@ -353,7 +352,7 @@ vbuf = g_strsplit_set (fname, "-.", -1); - g_print ("%s <=> %s\n", vbuf[1], ages); + //g_print ("%s <=> %s\n", vbuf[1], ages); /* Remove file if too old */ if (g_ascii_strcasecmp (vbuf[1], ages) <= 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-26 03:58:14
|
Revision: 835 http://gpredict.svn.sourceforge.net/gpredict/?rev=835&view=rev Author: aa1vs Date: 2011-06-26 03:58:08 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Add support for gpsd 2.96 and cleanup comments. Modified Paths: -------------- trunk/ChangeLog trunk/src/qth-data.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-20 21:12:43 UTC (rev 834) +++ trunk/ChangeLog 2011-06-26 03:58:08 UTC (rev 835) @@ -1,3 +1,9 @@ +2011-06-25 Charles Suprin <hamaa1vs at gmail.com> + + * src/qth-data.c + Add support for gpsd 2.96 and cleanup comments. + + 2011-06-20 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-sat-map.c Modified: trunk/src/qth-data.c =================================================================== --- trunk/src/qth-data.c 2011-06-20 21:12:43 UTC (rev 834) +++ trunk/src/qth-data.c 2011-06-26 03:58:08 UTC (rev 835) @@ -227,7 +227,7 @@ qth->type = QTH_STATIC_TYPE; } - /*GPSD Port*/ + /* GPSD Port */ qth->gpsd_port = g_key_file_get_integer (qth->data, QTH_CFG_MAIN_SECTION, QTH_CFG_GPSD_PORT_KEY, @@ -361,7 +361,7 @@ QTH_CFG_GPSD_SERVER_KEY, qth->gpsd_server); } - /*gpsd port*/ + /* gpsd port */ g_key_file_set_integer (qth->data, QTH_CFG_MAIN_SECTION, QTH_CFG_GPSD_PORT_KEY, @@ -442,7 +442,7 @@ void qth_data_free (qth_t *qth) { - /*stop any updating*/ + /* stop any updating */ qth_data_update_stop(qth); if (qth->name) { @@ -484,14 +484,16 @@ */ gboolean qth_data_update(qth_t * qth, gdouble t) { gboolean retval = FALSE; +#ifdef HAS_LIBGPS guint num_loops=0; +#endif switch (qth->type) { case QTH_STATIC_TYPE: - /*never changes*/ + /* never changes */ break; case QTH_GPSD_TYPE: if (((t-qth->gpsd_update)>30.0/86400.0)&&(t-qth->gpsd_connected>30.0/86400.0)){ - /*if needed restart the gpsd interface*/ + /* if needed restart the gpsd interface */ qth_data_update_stop(qth); qth_data_update_init(qth); qth->gpsd_connected=t; @@ -515,8 +517,8 @@ break; } if(gps_poll(qth->gps_data) == 0){ - /*handling packet_set inline with - http://gpsd.berlios.de/client-howto.html + /* handling packet_set inline with + http://gpsd.berlios.de/client-howto.html */ if (qth->gps_data->set&PACKET_SET) { if (qth->gps_data->fix.mode >= MODE_2D) { @@ -548,17 +550,17 @@ break; case 5: #if GPSD_API_MAJOR_VERSION==5 - while(gps_waiting(qth->gps_data) == 1) { - /*see comment from above*/ - /*hopefully not needed but does not hurt anything.*/ + while(gps_waiting(qth->gps_data,0) == 1) { + /* see comment from above */ + /* hopefully not needed but does not hurt anything. */ num_loops++; if (num_loops>1000){ retval=FALSE; break; } if(gps_read(qth->gps_data) == 0){ - /*handling packet_set inline with - http://gpsd.berlios.de/client-howto.html + /* handling packet_set inline with + http://gpsd.berlios.de/client-howto.html */ if (qth->gps_data->set&PACKET_SET) { if (qth->gps_data->fix.mode >= MODE_2D) { @@ -600,7 +602,7 @@ default: break; } - /*check that data is valid*/ + /* check that data is valid */ qth_validate(qth); return retval; } @@ -618,7 +620,7 @@ switch (qth->type){ case QTH_STATIC_TYPE: - /*nothing to do. the data never updates*/ + /* nothing to do. the data never updates */ break; case QTH_GPSD_TYPE: #ifdef HAS_LIBGPS @@ -690,7 +692,7 @@ void qth_data_update_stop (qth_t *qth) { switch (qth->type) { case QTH_STATIC_TYPE: - /*nothing to do. the data never updates*/ + /* nothing to do. the data never updates */ break; case QTH_GPSD_TYPE: @@ -763,7 +765,7 @@ * \param qth the qth data structure to cleanup */ void qth_validate(qth_t*qth){ - /*check that the values are not set to nonsense such as nan or inf. if so error it and set to zero.*/ + /* check that the values are not set to nonsense such as nan or inf. if so error it and set to zero. */ if (!isnormal(qth->lat)){ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: QTH data had bogus lat %f"), @@ -784,7 +786,8 @@ qth->alt=0.0; } - /*check that qth->lat and qth->lon are in a reasonable range and if not wrap them back*/ + /* check that qth->lat and qth->lon are in a reasonable range + and if not wrap them back */ if (fabs(qth->lat)>90.0||fabs(qth->lon)>180.0) { sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: File contained bogus QTH data. Correcting: %s, %.4f, %.4f, %d"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-20 21:12:49
|
Revision: 834 http://gpredict.svn.sourceforge.net/gpredict/?rev=834&view=rev Author: aa1vs Date: 2011-06-20 21:12:43 +0000 (Mon, 20 Jun 2011) Log Message: ----------- Move log closing and module saving until after gtk has shutdown. Modified Paths: -------------- trunk/ChangeLog trunk/src/main.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-20 13:07:45 UTC (rev 833) +++ trunk/ChangeLog 2011-06-20 21:12:43 UTC (rev 834) @@ -4,7 +4,10 @@ * src/gtk-polar-view.c Change naos logic to avoid a daynum 2458849.5 (Y2021?) problem. + * src/main.c + Move log closing and module saving until after gtk has shut down. + 2011-06-19 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-sat-map.c Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2011-06-20 13:07:45 UTC (rev 833) +++ trunk/src/main.c 2011-06-20 21:12:43 UTC (rev 834) @@ -184,7 +184,14 @@ gtk_main (); - g_option_context_free(context); + g_option_context_free(context); + + sat_cfg_save (); + sat_log_close (); + sat_cfg_close (); + + + #ifdef WIN32 // Cleanup Windozze Sockets CloseWinSock2(); @@ -368,9 +375,6 @@ sat_cfg_set_int (SAT_CFG_INT_WINDOW_WIDTH, w); sat_cfg_set_int (SAT_CFG_INT_WINDOW_HEIGHT, h); */ - sat_cfg_save (); - sat_log_close (); - sat_cfg_close (); /* exit Gtk+ */ gtk_main_quit (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-20 13:07:51
|
Revision: 833 http://gpredict.svn.sourceforge.net/gpredict/?rev=833&view=rev Author: aa1vs Date: 2011-06-20 13:07:45 +0000 (Mon, 20 Jun 2011) Log Message: ----------- Change naos logic to avoid a daynum 2458849.5 (Y2021?) problem. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-polar-view.c trunk/src/gtk-sat-map.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-19 13:00:23 UTC (rev 832) +++ trunk/ChangeLog 2011-06-20 13:07:45 UTC (rev 833) @@ -1,3 +1,10 @@ +2011-06-20 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-sat-map.c + * src/gtk-polar-view.c + Change naos logic to avoid a daynum 2458849.5 (Y2021?) problem. + + 2011-06-19 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-sat-map.c Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-06-19 13:00:23 UTC (rev 832) +++ trunk/src/gtk-polar-view.c 2011-06-20 13:07:45 UTC (rev 833) @@ -150,7 +150,7 @@ polview->sats = NULL; polview->qth = NULL; polview->obj = NULL; - polview->naos = 2458849.5; + polview->naos = 0.0; polview->ncat = 0; polview->size = 0; polview->r = 0; @@ -693,7 +693,7 @@ else { /* reset data */ polv->counter = 1; - polv->naos = 2458849.5; + polv->naos = 0.0; polv->ncat = 0; /* update sats */ @@ -787,9 +787,11 @@ now = polv->tstamp; /* update next AOS */ - if ((sat->aos > now) && (sat->aos < polv->naos)) { - polv->naos = sat->aos; - polv->ncat = sat->tle.catnr; + if (sat->aos > now) { + if ((sat->aos < polv->naos)|| (polv->naos == 0.0)) { + polv->naos = sat->aos; + polv->ncat = sat->tle.catnr; + } } /* if sat is out of range */ Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-06-19 13:00:23 UTC (rev 832) +++ trunk/src/gtk-sat-map.c 2011-06-20 13:07:45 UTC (rev 833) @@ -170,7 +170,7 @@ satmap->sats = NULL; satmap->qth = NULL; satmap->obj = NULL; - satmap->naos = 2458849.5; + satmap->naos = 0.0; satmap->ncat = 0; satmap->tstamp = 2458849.5; satmap->x0 = 0; @@ -656,7 +656,7 @@ else { /* reset data */ satmap->counter = 1; - satmap->naos = 2458849.5; + satmap->naos = 0.0; satmap->ncat = 0; /* QTH */ @@ -1934,9 +1934,11 @@ now = satmap->tstamp; /* update next AOS */ - if ((sat->aos > now) && (sat->aos < satmap->naos)) { - satmap->naos = sat->aos; - satmap->ncat = sat->tle.catnr; + if (sat->aos > now) { + if ((sat->aos < satmap->naos)|| (satmap->naos == 0.0)) { + satmap->naos = sat->aos; + satmap->ncat = sat->tle.catnr; + } } obj = SAT_MAP_OBJ (g_hash_table_lookup (satmap->obj, catnum)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-19 13:00:29
|
Revision: 832 http://gpredict.svn.sourceforge.net/gpredict/?rev=832&view=rev Author: aa1vs Date: 2011-06-19 13:00:23 +0000 (Sun, 19 Jun 2011) Log Message: ----------- Remove decayed satellite object from hash. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-sat-map.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-08 02:22:04 UTC (rev 831) +++ trunk/ChangeLog 2011-06-19 13:00:23 UTC (rev 832) @@ -1,3 +1,9 @@ +2011-06-19 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-sat-map.c + Remove decayed satellite object from hash. + + 2011-06-07 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-polar-view.c: Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-06-08 02:22:04 UTC (rev 831) +++ trunk/src/gtk-sat-map.c 2011-06-19 13:00:23 UTC (rev 832) @@ -1962,6 +1962,8 @@ idx = goo_canvas_item_model_find_child (root,obj->range2); if (idx !=-1) goo_canvas_item_model_remove_child (root, idx); + g_hash_table_remove (satmap->obj, catnum); + g_free (obj); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-08 02:22:10
|
Revision: 831 http://gpredict.svn.sourceforge.net/gpredict/?rev=831&view=rev Author: aa1vs Date: 2011-06-08 02:22:04 +0000 (Wed, 08 Jun 2011) Log Message: ----------- Remove decayed satellites from polar view. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-polar-view.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-05 17:29:32 UTC (rev 830) +++ trunk/ChangeLog 2011-06-08 02:22:04 UTC (rev 831) @@ -1,3 +1,9 @@ +2011-06-07 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-polar-view.c: + Remove decayed satellites from polar view. + + 2011-06-05 Alexandru Csete <oz9aec at gmail.com> * src/gtk-rig-ctrl.c: Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-06-05 17:29:32 UTC (rev 830) +++ trunk/src/gtk-polar-view.c 2011-06-08 02:22:04 UTC (rev 831) @@ -793,7 +793,7 @@ } /* if sat is out of range */ - if (sat->el < 0.00) { + if ((sat->el < 0.00) || decayed(sat)) { obj = SAT_OBJ(g_hash_table_lookup (polv->obj, catnum)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2011-06-05 17:29:38
|
Revision: 830 http://gpredict.svn.sourceforge.net/gpredict/?rev=830&view=rev Author: csete Date: 2011-06-05 17:29:32 +0000 (Sun, 05 Jun 2011) Log Message: ----------- Add TX cycle function for full duplex radios. Fixes bug 3272993: Issue controlling Yaesu FT-847. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-rig-ctrl.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-04 23:37:21 UTC (rev 829) +++ trunk/ChangeLog 2011-06-05 17:29:32 UTC (rev 830) @@ -1,3 +1,10 @@ +2011-06-05 Alexandru Csete <oz9aec at gmail.com> + + * src/gtk-rig-ctrl.c: + Add TX cycle function for full duplex radios. + Fixes bug 3272993: Issue controlling Yaesu FT-847. + + 2011-06-04 Alexandru Csete <oz9aec at gmail.com> * src/gtk-rig-ctrl.c: Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-06-04 23:37:21 UTC (rev 829) +++ trunk/NEWS 2011-06-05 17:29:32 UTC (rev 830) @@ -8,6 +8,7 @@ - Fixed bug 3250344: Win32 build not working with hamlib. - Fixed bug 3294829: Program name wrong in desktop files. - Fixed bug 3309110: 100% on manual time adjustment. +- Fixed bug 3272993: Issue controlling Yaesu FT-847. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2011-06-04 23:37:21 UTC (rev 829) +++ trunk/src/gtk-rig-ctrl.c 2011-06-05 17:29:32 UTC (rev 830) @@ -108,6 +108,7 @@ static void exec_toggle_cycle (GtkRigCtrl *ctrl); static void exec_toggle_tx_cycle (GtkRigCtrl *ctrl); static void exec_duplex_cycle (GtkRigCtrl *ctrl); +static void exec_duplex_tx_cycle(GtkRigCtrl *ctrl); static void exec_dual_rig_cycle (GtkRigCtrl *ctrl); static gboolean set_freq_simplex (GtkRigCtrl *ctrl, gint sock, gdouble freq); static gboolean get_freq_simplex (GtkRigCtrl *ctrl, gint sock, gdouble *freq); @@ -1755,6 +1756,110 @@ } +/** \brief Execute TX cycle for full duplex radios. + * \param ctrl Pointer to the GtkRigCtrl structure. + * + * This is basically the same as exec_tx_cycle() except that there is no + * check for PTT since for full duplex radios we can always control the + * uplink frequency. + */ +static void exec_duplex_tx_cycle(GtkRigCtrl *ctrl) +{ + gdouble readfreq=0.0, tmpfreq, satfreqd, satfrequ; + gboolean dialchanged = FALSE; + + + /* Dial feedback: + If radio device is engaged read frequency from radio and compare it to the + last set frequency. If different, it means that user has changed frequency + on the radio dial => update transponder knob + + Note: If ctrl->lasttxf = 0.0 the sync has been invalidated (e.g. user pressed "tune") + and no need to execute the dial feedback. + */ + if ((ctrl->engaged) && (ctrl->lasttxf > 0.0)) { + + + if (!get_freq_toggle (ctrl, ctrl->sock, &readfreq)) { + /* error => use a passive value */ + readfreq = ctrl->lasttxf; + ctrl->errcnt++; + } + + if (fabs (readfreq - ctrl->lasttxf) >= 1.0) { + dialchanged = TRUE; + + /* user might have altered radio frequency => update transponder knob */ + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), readfreq); + ctrl->lasttxf = readfreq; + + /* doppler shift; only if we are tracking */ + if (ctrl->tracking) { + satfrequ = readfreq - ctrl->du + ctrl->conf->loup; + } + else { + satfrequ = readfreq + ctrl->conf->loup; + } + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), satfrequ); + + /* Follow with downlink if transponder is locked */ + if (ctrl->trsplock) { + track_uplink (ctrl); + } + } + } + + /* now, forward tracking */ + if (dialchanged) { + /* no need to forward track */ + return; + } + + /* If we are tracking, calculate the radio freq by applying both dopper shift + and tranverter LO frequency. If we are not tracking, apply only LO frequency. + */ + satfreqd = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqDown)); + satfrequ = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqUp)); + if (ctrl->tracking) { + /* downlink */ + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqDown), + satfreqd + ctrl->dd - ctrl->conf->lo); + /* uplink */ + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), + satfrequ + ctrl->du - ctrl->conf->loup); + } + else { + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqDown), + satfreqd - ctrl->conf->lo); + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), + satfrequ - ctrl->conf->loup); + } + + tmpfreq = gtk_freq_knob_get_value(GTK_FREQ_KNOB(ctrl->RigFreqUp)); + + /* if device is engaged, send freq command to radio */ + if ((ctrl->engaged) && (fabs(ctrl->lasttxf - tmpfreq) >= 1.0)) { + if (set_freq_toggle (ctrl, ctrl->sock, tmpfreq)) { + /* reset error counter */ + ctrl->errcnt = 0; + + /* give radio a chance to set frequency */ + g_usleep (WR_DEL); + + /* The actual frequency migh be different from what we have set because + the tuning step is larger than what we work with (e.g. FT-817 has a + smallest tuning step of 10 Hz). Therefore we read back the actual + frequency from the rig. */ + get_freq_toggle (ctrl, ctrl->sock, &tmpfreq); + ctrl->lasttxf = tmpfreq; + } + else { + ctrl->errcnt++; + } + } + +} + /** \brief Execute duplex mode cycle. * \param ctrl Pointer to the GtkRigCtrl widget. * @@ -1763,20 +1868,11 @@ */ static void exec_duplex_cycle (GtkRigCtrl *ctrl) { - if (ctrl->engaged) { - exec_rx_cycle (ctrl); - exec_toggle_tx_cycle (ctrl); - } - else { - /* still execute cycles to update UI widgets - * no data will be sent to RIG */ - exec_rx_cycle (ctrl); - /* toggle_tx does nothing when not engaged - * (was originally written for FT-817-like rigs) */ - exec_tx_cycle (ctrl); - } + exec_rx_cycle (ctrl); + exec_duplex_tx_cycle (ctrl); } + /** \brief Execute dual-rig cycle. * \param ctrl Pointer to the GtkRigCtrl widget. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2011-06-04 23:37:27
|
Revision: 829 http://gpredict.svn.sourceforge.net/gpredict/?rev=829&view=rev Author: csete Date: 2011-06-04 23:37:21 +0000 (Sat, 04 Jun 2011) Log Message: ----------- Attempt to fix bug #3272993: Issue controlling Yaesu FT-847. Coding style clean up. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-rig-ctrl.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-04 21:23:11 UTC (rev 828) +++ trunk/ChangeLog 2011-06-04 23:37:21 UTC (rev 829) @@ -1,3 +1,10 @@ +2011-06-04 Alexandru Csete <oz9aec at gmail.com> + + * src/gtk-rig-ctrl.c: + Attempt to fix bug #3272993: Issue controlling Yaesu FT-847. + Coding style clean up. + + 2011-06-04 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-sat-map.c @@ -4,6 +11,7 @@ * src/gtk-polar-view.c Reset satellite when reseting NAOS in sat-map and polar views. + 2011-05-31 Charles Suprin <hamaa1vs at gmail.com> * src/sgpsdp/sgp_time.c @@ -14,6 +22,7 @@ Fixes Bug 3309110: 100% on manual time adjustment. Fixes part of Ubuntu Bug #789691. + 2011-05-26 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-single-sat.c @@ -25,6 +34,7 @@ Save selected satellite in single sat view. Part of Feature Request: 3179738 + 2011-05-14 Charles Suprin <hamaa1vs at gmail.com> * data/trsp/25338.trsp @@ -32,6 +42,7 @@ * data/trsp/27543.trsp Update NOAA-15,-16,-17 transponder frequencies. + 2011-05-01 Alexandru Csete <oz9aec at gmail.com> * src/gtk-sat-module-popup.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2011-06-04 21:23:11 UTC (rev 828) +++ trunk/src/gtk-rig-ctrl.c 2011-06-04 23:37:21 UTC (rev 829) @@ -118,6 +118,7 @@ static gboolean get_ptt (GtkRigCtrl *ctrl, gint sock); static gboolean set_ptt (GtkRigCtrl *ctrl, gint sock, gboolean ptt); static gboolean set_vfo (GtkRigCtrl *ctrl, vfo_t vfo); +static gboolean setup_split(GtkRigCtrl *ctrl); static void update_count_down (GtkRigCtrl *ctrl, gdouble t); static gboolean open_rigctld_socket(radio_conf_t *conf, gint *sock); static gboolean close_rigctld_socket(gint *sock); @@ -1248,6 +1249,8 @@ break; case RIG_TYPE_DUPLEX: + /* set rig into SAT mode (hamlib needs it even if rig already in SAT) */ + setup_split(ctrl); exec_duplex_cycle (ctrl); break; @@ -1269,6 +1272,53 @@ } +/** \brief Setup VFOs for split operation (simplex or duplex) + * \param ctrl Pointer to the GtkRigCtrl structure. + * \return TRUE if the operation was succesful, FALSE if an error occurred. + * + * This function is used to setup the VFOs for split operation. For full + * duplex radios this will enable the SAT mode (True for FT847 but TBC for others). + * See bug #3272993 + */ +static gboolean setup_split(GtkRigCtrl *ctrl) +{ + gchar *buff; + gchar buffback[128]; + gboolean retcode; + + /* select TX VFO */ + switch (ctrl->conf->vfoUp) { + case VFO_A: + buff = g_strdup("S 1 A\x0a"); + break; + + case VFO_B: + buff = g_strdup("S 1 B\x0a"); + break; + + case VFO_MAIN: + buff = g_strdup("S 1 Main\x0a"); + break; + + case VFO_SUB: + buff = g_strdup("S 1 Sub\x0a"); + break; + + default: + sat_log_log(SAT_LOG_LEVEL_ERROR, + _("%s called but TX VFO is %d."), __FUNCTION__, ctrl->conf->vfoUp); + return FALSE; + } + + retcode=send_rigctld_command(ctrl, ctrl->sock, buff, buffback, 128); + + g_free(buff); + + return(check_set_response(buffback, retcode, __FUNCTION__)); + +} + + /** \brief Manage downlink frequency change callbacks. * \param knob Pointer to the GtkFreqKnob widget that received the signal. * \param data Pointer to the GtkRigCtrl structure. @@ -1709,22 +1759,20 @@ * \param ctrl Pointer to the GtkRigCtrl widget. * * This function executes a controller cycle when the device is of RIG_TYPE_DUPLEX. + * The RIG should already be in SAT mode. */ static void exec_duplex_cycle (GtkRigCtrl *ctrl) -{ +{ if (ctrl->engaged) { - /* Downlink */ - set_vfo (ctrl, ctrl->conf->vfoDown); exec_rx_cycle (ctrl); - - /* Uplink */ - set_vfo (ctrl, ctrl->conf->vfoUp); - exec_tx_cycle (ctrl); + exec_toggle_tx_cycle (ctrl); } else { /* still execute cycles to update UI widgets - no data will be sent to RIG */ + * no data will be sent to RIG */ exec_rx_cycle (ctrl); + /* toggle_tx does nothing when not engaged + * (was originally written for FT-817-like rigs) */ exec_tx_cycle (ctrl); } } @@ -2732,16 +2780,28 @@ return TRUE; } -/*simple function to sort the list of satellites in the combo box.*/ -static gint sat_name_compare (sat_t* a,sat_t*b){ +/** \brief Simple function to sort the list of satellites in the combo box. + * \return TBC + */ +static gint sat_name_compare (sat_t *a, sat_t *b) +{ return (gpredict_strcmp(a->nickname,b->nickname)); } -static gint rig_name_compare (const gchar* a,const gchar *b){ +/** \brief Simple function to sort the list of rigs in the combo box. + * \return TBC + */ +static gint rig_name_compare (const gchar *a, const gchar *b){ return (gpredict_strcmp(a,b)); } -static inline gboolean check_set_response (gchar *buffback,gboolean retcode,const gchar *function){ +/** \brief Check hamlib rigctld response + * \param buffback + * \param retcode + * \param function + * \return TRUE if the check was successful? + */ +static inline gboolean check_set_response (gchar *buffback, gboolean retcode, const gchar *function){ if (retcode==TRUE) if (strncmp(buffback,"RPRT 0",6)!=0) { sat_log_log (SAT_LOG_LEVEL_ERROR, @@ -2753,6 +2813,12 @@ return retcode; } +/** \brief Check hamlib rigctld response + * \param buffback + * \param retcode + * \param function + * \return TRUE if the check was successful? + */ static inline gboolean check_get_response (gchar *buffback,gboolean retcode,const gchar *function){ if (retcode==TRUE) if (strncmp(buffback,"RPRT",4)==0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-06-04 21:23:17
|
Revision: 828 http://gpredict.svn.sourceforge.net/gpredict/?rev=828&view=rev Author: aa1vs Date: 2011-06-04 21:23:11 +0000 (Sat, 04 Jun 2011) Log Message: ----------- Reset satellite when reseting NAOS in sat-map and polar views. Modified Paths: -------------- trunk/ChangeLog trunk/src/gtk-polar-view.c trunk/src/gtk-sat-map.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-05-30 11:16:51 UTC (rev 827) +++ trunk/ChangeLog 2011-06-04 21:23:11 UTC (rev 828) @@ -1,3 +1,9 @@ +2011-06-04 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-sat-map.c + * src/gtk-polar-view.c + Reset satellite when reseting NAOS in sat-map and polar views. + 2011-05-31 Charles Suprin <hamaa1vs at gmail.com> * src/sgpsdp/sgp_time.c Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-05-30 11:16:51 UTC (rev 827) +++ trunk/src/gtk-polar-view.c 2011-06-04 21:23:11 UTC (rev 828) @@ -694,6 +694,7 @@ /* reset data */ polv->counter = 1; polv->naos = 2458849.5; + polv->ncat = 0; /* update sats */ g_hash_table_foreach (polv->sats, update_sat, polv); Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-05-30 11:16:51 UTC (rev 827) +++ trunk/src/gtk-sat-map.c 2011-06-04 21:23:11 UTC (rev 828) @@ -657,6 +657,7 @@ /* reset data */ satmap->counter = 1; satmap->naos = 2458849.5; + satmap->ncat = 0; /* QTH */ /*update for accuracy*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-30 11:17:01
|
Revision: 827 http://gpredict.svn.sourceforge.net/gpredict/?rev=827&view=rev Author: aa1vs Date: 2011-05-30 11:16:51 +0000 (Mon, 30 May 2011) Log Message: ----------- Fix Bug 3309110: 100% on manual time adjustment. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-module-tmg.c trunk/src/sgpsdp/sgp4sdp4.h trunk/src/sgpsdp/sgp_time.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-05-26 21:54:12 UTC (rev 826) +++ trunk/ChangeLog 2011-05-30 11:16:51 UTC (rev 827) @@ -1,3 +1,13 @@ +2011-05-31 Charles Suprin <hamaa1vs at gmail.com> + + * src/sgpsdp/sgp_time.c + * src/sgpsdp/sgp4sdp4.h + * src/gtk-sat-module-tmg.c + Fix discrepancy in year convention with Time_to_UTC between Julian_Date + convention and mktime convention. + Fixes Bug 3309110: 100% on manual time adjustment. + Fixes part of Ubuntu Bug #789691. + 2011-05-26 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-single-sat.c Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-05-26 21:54:12 UTC (rev 826) +++ trunk/NEWS 2011-05-30 11:16:51 UTC (rev 827) @@ -5,8 +5,9 @@ - Feature request 2130926: Change frequency using mouse wheel. Also for rotator controller. - Applied and extended patch 3237220: natural sort for sat list in module config - Improve handling of decayed satellites. -- Fixed bug 3250344: Win32 uild not working with hamlib. +- Fixed bug 3250344: Win32 build not working with hamlib. - Fixed bug 3294829: Program name wrong in desktop files. +- Fixed bug 3309110: 100% on manual time adjustment. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-sat-module-tmg.c =================================================================== --- trunk/src/gtk-sat-module-tmg.c 2011-05-26 21:54:12 UTC (rev 826) +++ trunk/src/gtk-sat-module-tmg.c 2011-05-30 11:16:51 UTC (rev 827) @@ -483,7 +483,6 @@ gdouble slider; gdouble jd; - /* update time only if we are in manual time control */ if (!mod->throttle && !mod->reset) { @@ -513,7 +512,7 @@ /* convert UTC time to Julian Date */ if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) { /* convert local time to UTC */ - utim = Time_to_UTC (&tim); + Time_to_UTC (&tim, &utim); /* Convert to JD */ jd = Julian_Date (&utim); @@ -814,7 +813,7 @@ /* convert UTC time to Julian Date */ if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) { /* convert local time to UTC */ - utim = Time_to_UTC (&tim); + Time_to_UTC (&tim, &utim); /* Convert to JD */ jd = Julian_Date (&utim); @@ -869,7 +868,7 @@ /* convert UTC time to Julian Date */ if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) { /* convert local time to UTC */ - utim = Time_to_UTC (&tim); + Time_to_UTC (&tim, &utim); /* Convert to JD */ jd = Julian_Date (&utim); Modified: trunk/src/sgpsdp/sgp4sdp4.h =================================================================== --- trunk/src/sgpsdp/sgp4sdp4.h 2011-05-26 21:54:12 UTC (rev 826) +++ trunk/src/sgpsdp/sgp4sdp4.h 2011-05-30 11:16:51 UTC (rev 827) @@ -347,7 +347,7 @@ double Julian_Date(struct tm *cdate); void Date_Time(double jd, struct tm *cdate); int Check_Date(struct tm *cdate); -struct tm Time_to_UTC(struct tm *cdate); +void Time_to_UTC(struct tm *cdate, struct tm *odate); struct tm Time_from_UTC(struct tm *cdate); double JD_to_UTC(double jt); double JD_from_UTC(double jt); Modified: trunk/src/sgpsdp/sgp_time.c =================================================================== --- trunk/src/sgpsdp/sgp_time.c 2011-05-26 21:54:12 UTC (rev 826) +++ trunk/src/sgpsdp/sgp_time.c 2011-05-30 11:16:51 UTC (rev 827) @@ -241,13 +241,23 @@ /* The procedures JD_to_UTC and JD_from_UTC are used to */ /* do the same thing working directly with Julian dates. */ -struct tm -Time_to_UTC(struct tm *cdate) +void +Time_to_UTC(struct tm *cdate, struct tm *odate) { time_t tdate; - + /* + functions such as Julian_Date work with tm_year in being + the year since 0 AD and mktime uses it as the year since 1900 + + tm_isdst = -1 forces the mktime call to lookup the daylight + savings for the current timezone instead of using whatever + was in the structure when it was created. + */ + cdate->tm_year -= 1900; + cdate->tm_isdst = -1; tdate = mktime(cdate); - return( *gmtime(&tdate) ); + gmtime_r(&tdate,odate); + odate->tm_year += 1900; } /*Procedure Time_to_UTC*/ /*------------------------------------------------------------------*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-26 21:54:19
|
Revision: 826 http://gpredict.svn.sourceforge.net/gpredict/?rev=826&view=rev Author: aa1vs Date: 2011-05-26 21:54:12 +0000 (Thu, 26 May 2011) Log Message: ----------- Clarify comment. Modified Paths: -------------- trunk/src/gtk-sat-module.c Modified: trunk/src/gtk-sat-module.c =================================================================== --- trunk/src/gtk-sat-module.c 2011-05-26 13:00:50 UTC (rev 825) +++ trunk/src/gtk-sat-module.c 2011-05-26 21:54:12 UTC (rev 826) @@ -980,12 +980,47 @@ sat->los = find_los (sat, module->qth, daynum, maxdt); } - /*update aos if it was known and is stale*/ + /* + Update AOS and LOS for this satellite if it was known and is before + the current time. + + daynum is the current time in the module. + + The conditional aos < daynum is merely saying that aos occured + in the past. Therefore it cannot be the next event or aos/los + for that satellite. + + The conditional aos > 0.0 is a short hand for saying that the + aos was successfully computed before. find_aos returns 0.0 when it + cannot find an AOS. + + This code should not execute find_aos(los) if the conditional before + is triggered as the newly computed aos(los) should either be in + the future (aos > daynum) or (aos == 0 ). + + Single sat/list/event/map views all use these values and they + should be up to date. + + The above code is still required for dealing with circumstances + where the qth moves from someplace where the qth can have an AOS and + where qth does not and for satellites in parking orbits where the + AOS may be further than maxdt out results in aos==0.0 until the + next aos is closer than maxdt. It also prevents the aos from + being computed every pass through the module for the parking orbits. + + To be completely correct, when time can move forward and backwards + as it can with the time controller, the time the aos/los was + computed should be stored and associated with aos/los. That way + if daynum <time_computed, the aos can be recomputed as there is + no assurance that the current stored aos is the next aos. As a + practical matter the above code handles time reversing acceptably + for most circumstances. + + */ if (sat->aos > 0 && sat->aos < daynum) { maxdt = (gdouble) sat_cfg_get_int (SAT_CFG_INT_PRED_LOOK_AHEAD); sat->aos = find_aos (sat, module->qth, daynum, maxdt); } - /*update los if it was known is stale*/ if (sat->los > 0 && sat->los < daynum) { maxdt = (gdouble) sat_cfg_get_int (SAT_CFG_INT_PRED_LOOK_AHEAD); sat->los = find_los (sat, module->qth, daynum, maxdt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-26 13:00:56
|
Revision: 825 http://gpredict.svn.sourceforge.net/gpredict/?rev=825&view=rev Author: aa1vs Date: 2011-05-26 13:00:50 +0000 (Thu, 26 May 2011) Log Message: ----------- Save selected satellite in single satellite view. Modified Paths: -------------- trunk/ChangeLog trunk/src/config-keys.h trunk/src/gtk-sat-module.c trunk/src/gtk-single-sat.c trunk/src/sat-cfg.c trunk/src/sat-cfg.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/ChangeLog 2011-05-26 13:00:50 UTC (rev 825) @@ -1,3 +1,14 @@ +2011-05-26 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-single-sat.c + * src/config-keys.h + * src/sat-cfg.c + * src/sat-cfg.h + * src/gtk-sat-module.c + * src/gtk-single-sat.c + Save selected satellite in single sat view. + Part of Feature Request: 3179738 + 2011-05-14 Charles Suprin <hamaa1vs at gmail.com> * data/trsp/25338.trsp Modified: trunk/src/config-keys.h =================================================================== --- trunk/src/config-keys.h 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/src/config-keys.h 2011-05-26 13:00:50 UTC (rev 825) @@ -130,6 +130,7 @@ #define MOD_CFG_SINGLE_SAT_SECTION "SINGLE_SAT" #define MOD_CFG_SINGLE_SAT_REFRESH "REFRESH" #define MOD_CFG_SINGLE_SAT_FIELDS "FIELDS" +#define MOD_CFG_SINGLE_SAT_SELECT "SELECTED" /* event list */ #define MOD_CFG_EVENT_LIST_SECTION "EVENT_LIST" Modified: trunk/src/gtk-sat-module.c =================================================================== --- trunk/src/gtk-sat-module.c 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/src/gtk-sat-module.c 2011-05-26 13:00:50 UTC (rev 825) @@ -206,6 +206,8 @@ { GtkSatModule *module = GTK_SAT_MODULE (object); + /*save the configuration*/ + mod_cfg_save (module->name, module->cfgdata); /* stop timeout */ if (module->timerid > 0) @@ -977,9 +979,18 @@ sat->aos = find_aos (sat, module->qth, daynum, maxdt); sat->los = find_los (sat, module->qth, daynum, maxdt); + } + /*update aos if it was known and is stale*/ + if (sat->aos > 0 && sat->aos < daynum) { + maxdt = (gdouble) sat_cfg_get_int (SAT_CFG_INT_PRED_LOOK_AHEAD); + sat->aos = find_aos (sat, module->qth, daynum, maxdt); + } + /*update los if it was known is stale*/ + if (sat->los > 0 && sat->los < daynum) { + maxdt = (gdouble) sat_cfg_get_int (SAT_CFG_INT_PRED_LOOK_AHEAD); + sat->los = find_los (sat, module->qth, daynum, maxdt); } - /*data may have been updated by gpsd*/ obs_geodetic.lon = module->qth->lon * de2ra; obs_geodetic.lat = module->qth->lat * de2ra; @@ -1079,9 +1090,6 @@ _("%s: Module %s recevied CLOSE signal."), __FUNCTION__, name); - /* save configuration to ensure that dynamic data like state is stored */ - mod_cfg_save (module->name, module->cfgdata); - switch (module->state) { case GTK_SAT_MOD_STATE_DOCKED: @@ -1163,7 +1171,11 @@ __FUNCTION__, name, module->state); break; } + /* save configuration to ensure that dynamic data like state is stored */ + mod_cfg_save (module->name, module->cfgdata); + + /* appearantly, module will be destroyed when removed from notebook */ /* gtk_widget_destroy (GTK_WIDGET (module)); */ Modified: trunk/src/gtk-single-sat.c =================================================================== --- trunk/src/gtk-single-sat.c 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/src/gtk-single-sat.c 2011-05-26 13:00:50 UTC (rev 825) @@ -197,6 +197,10 @@ static void gtk_single_sat_destroy (GtkObject *object) { + GtkSingleSat *ssat = GTK_SINGLE_SAT(object); + sat_t *sat = SAT (g_slist_nth_data (ssat->sats, ssat->selected)); + g_key_file_set_integer (ssat->cfgdata,MOD_CFG_SINGLE_SAT_SECTION,MOD_CFG_SINGLE_SAT_SELECT,sat->tle.catnr); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -213,9 +217,8 @@ sat_t *sat; gchar *title; guint i; + gint selectedcatnum; - - widget = g_object_new (GTK_TYPE_SINGLE_SAT, NULL); GTK_SINGLE_SAT (widget)->update = gtk_single_sat_update; @@ -244,7 +247,12 @@ MOD_CFG_SINGLE_SAT_REFRESH, SAT_CFG_INT_SINGLE_SAT_REFRESH); GTK_SINGLE_SAT (widget)->counter = 1; - + + /* get selected catnum if available */ + selectedcatnum = mod_cfg_get_int (cfgdata, + MOD_CFG_SINGLE_SAT_SECTION, + MOD_CFG_SINGLE_SAT_SELECT, + SAT_CFG_INT_SINGLE_SAT_SELECT); /* popup button */ GTK_SINGLE_SAT (widget)->popup_button = gpredict_mini_mod_button ("gpredict-mod-popup.png", @@ -321,6 +329,9 @@ gtk_widget_show_all (widget); + if (selectedcatnum) { + gtk_single_sat_select_sat ( widget, selectedcatnum ); + } return widget; } Modified: trunk/src/sat-cfg.c =================================================================== --- trunk/src/sat-cfg.c 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/src/sat-cfg.c 2011-05-26 13:00:50 UTC (rev 825) @@ -174,6 +174,7 @@ { "MODULES", "POLAR_INFO_COLOUR", 0x00007FFF}, { "MODULES", "SINGLE_SAT_REFRESH", 1}, { "MODULES", "SINGLE_SAT_FIELDS", SINGLE_SAT_FIELD_DEF}, + { "MODULES", "SINGLE_SAT_SELECTED", 0}, { "MODULES", "EVENT_LIST_REFRESH", 1}, { "PREDICT", "MINIMUM_ELEV", 5}, { "PREDICT", "NUMBER_OF_PASSES", 10}, Modified: trunk/src/sat-cfg.h =================================================================== --- trunk/src/sat-cfg.h 2011-05-24 12:25:51 UTC (rev 824) +++ trunk/src/sat-cfg.h 2011-05-26 13:00:50 UTC (rev 825) @@ -96,6 +96,7 @@ SAT_CFG_INT_POLAR_INFO_COL, /*!< Info colour. */ SAT_CFG_INT_SINGLE_SAT_REFRESH, /*!< Single-sat refresh rate (cycle). */ SAT_CFG_INT_SINGLE_SAT_FIELDS, /*!< Single-sat fields. */ + SAT_CFG_INT_SINGLE_SAT_SELECT, /*!< Single-sat selected satellite. */ SAT_CFG_INT_EVENT_LIST_REFRESH, /*!< Event list refresh rate (cycle). */ SAT_CFG_INT_PRED_MIN_EL, /*!< Minimum elevation for passes. */ SAT_CFG_INT_PRED_NUM_PASS, /*!< Number of passes to predict. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-24 12:25:58
|
Revision: 824 http://gpredict.svn.sourceforge.net/gpredict/?rev=824&view=rev Author: aa1vs Date: 2011-05-24 12:25:51 +0000 (Tue, 24 May 2011) Log Message: ----------- Match intention of range ring in TODO file. Modified Paths: -------------- branches/ground_ring/ChangeLog branches/ground_ring/src/gtk-sat-map.c Modified: branches/ground_ring/ChangeLog =================================================================== --- branches/ground_ring/ChangeLog 2011-05-18 21:55:08 UTC (rev 823) +++ branches/ground_ring/ChangeLog 2011-05-24 12:25:51 UTC (rev 824) @@ -1,3 +1,8 @@ +2011-05-24 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-src-map.c + Change coverage ring of qth to match coverage of satellite. + 2011-05-14 Charles Suprin <hamaa1vs at gmail.com> * src/gtk-src-map.c Modified: branches/ground_ring/src/gtk-sat-map.c =================================================================== --- branches/ground_ring/src/gtk-sat-map.c 2011-05-18 21:55:08 UTC (rev 823) +++ branches/ground_ring/src/gtk-sat-map.c 2011-05-24 12:25:51 UTC (rev 824) @@ -2018,7 +2018,7 @@ SAT_CFG_INT_MAP_SAT_COV_COL); if (satmap->selected) { - update_obj(satmap->qthobj,satmap,col,covcol,satmap->qth->lon,satmap->qth->lat,NULL,2*satmap->selected->footprint); + update_obj(satmap->qthobj,satmap,col,covcol,satmap->qth->lon,satmap->qth->lat,NULL,satmap->selected->footprint); } else { update_obj(satmap->qthobj,satmap,col,covcol,satmap->qth->lon,satmap->qth->lat,NULL,0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-18 21:55:14
|
Revision: 823 http://gpredict.svn.sourceforge.net/gpredict/?rev=823&view=rev Author: aa1vs Date: 2011-05-18 21:55:08 +0000 (Wed, 18 May 2011) Log Message: ----------- Improve free routines. Modified Paths: -------------- branches/mlos/src/predict-tools.c Modified: branches/mlos/src/predict-tools.c =================================================================== --- branches/mlos/src/predict-tools.c 2011-05-18 21:53:51 UTC (rev 822) +++ branches/mlos/src/predict-tools.c 2011-05-18 21:55:08 UTC (rev 823) @@ -179,7 +179,7 @@ } /* don't use upper time limit */ - else { + else if (maxdt == 0.0) { /* coarse time steps */ while (sat->el < -1.0) { @@ -285,7 +285,7 @@ } /* don't use upper limit */ - else { + else if (maxdt == 0.0) { /* coarse steps */ while (sat->el >= 1.0) { @@ -313,7 +313,7 @@ lostime = t; } } - } + } return lostime; @@ -474,38 +474,43 @@ return passes; } -mlos_t * +/** \brief Predict first mutual contact starting at or after current time. + * \param sat Pointer to the satellite data. + * \param qth1 Pointer to the first location data. + * \param qth2 Pointer to the second location data. + * \param start Starting time. + * \param maxdt The maximum number of days to look ahead (0 for no limit). + * \return Pointer to a newly allocated pass_t structure or NULL if + * there was an error. + * This function assumes that you want a pass that achieves the + * minimum elevation of is configured for. + */mlos_t * get_mlos (sat_t *sat, qth_t *qth1, qth_t *qth2, gdouble start, gdouble maxdt) { - mlos_t *mlos; - pass_t *pass1,*pass2; - gdouble temptime; - gboolean valid=FALSE; - gboolean done=FALSE; - + mlos_t *mlos = NULL; + pass_t *pass1 = NULL,*pass2 = NULL; + gdouble temptime = -1; + gboolean valid = FALSE; + gboolean done = FALSE; + if (start <1){ + printf("Something funky going on\n"); + } /* get information on the first qth with that satellite */ predict_calc(sat,qth1,start); if (sat->el > 0.0) { pass1=get_current_pass(sat,qth1,start); } else { - pass1=get_pass(sat,qth1,start,maxdt); + pass1=get_pass_no_min_el(sat,qth1,start,maxdt); } /* for testing to make sure it matches sky at a glance */ - /* - done=TRUE; - valid=TRUE; - mlos->start=pass1->aos; - mlos->finish=pass1->los; - */ - predict_calc(sat,qth2,start); if (sat->el > 0.0) { pass2=get_current_pass(sat,qth2,start); } else { - pass2=get_pass(sat,qth2,start,maxdt); + pass2=get_pass_no_min_el(sat,qth2,start,maxdt); } if (maxdt>0.0) { @@ -513,16 +518,27 @@ if (pass1->los < pass2->aos){ /*pass1 finishs before pass2 starts*/ /*no overlap so no mlos*/ + printf("Pass 1 earlier %e %e %e\n", start, pass1->los, pass2->aos); temptime=pass2->aos; free_pass(pass1); - pass1=get_pass(sat,qth1,temptime,maxdt+start-temptime); + predict_calc(sat,qth1,temptime); + if (sat->el>0.0) + pass1=get_current_pass(sat,qth1,temptime); + else + pass1=get_pass(sat,qth1,temptime,maxdt+start-temptime); } else if (pass2->los < pass1->aos){ /*pass2 finishs before pass1 starts*/ /*no overlap so no mlos*/ + printf("Pass 2 earlier %e %e %e\n",start,pass1->aos, pass2->los); temptime=pass1->aos; free_pass(pass2); - pass2=get_pass(sat,qth2,temptime,maxdt+start-temptime); + predict_calc(sat,qth2,temptime); + if (sat->el>0.0) + pass2=get_current_pass(sat,qth2,temptime); + else + pass2=get_pass(sat,qth2,temptime,maxdt+start-temptime); } else { + /* there is overlap of the passes*/ mlos = g_new (mlos_t, 1); /*passes overlap*/ @@ -543,19 +559,23 @@ valid=TRUE; } + printf("Temptime no max %f\n",temptime); + if ((temptime < start)&& done==FALSE){ + printf("Something funky going on\n"); + } } } else { while (pass1 && pass2 && !done) { if (pass1->los < pass2->aos){ /*pass1 finishs before pass2 starts*/ /*no overlap so no mlos*/ - temptime=pass1->los+10.0/86400.0; + temptime=pass2->aos+10.0/86400.0; free_pass(pass1); pass1=get_pass(sat,qth1,temptime,maxdt); } else if (pass2->los < pass1->aos){ /*pass2 finishs before pass1 starts*/ /*no overlap so no mlos*/ - temptime=pass2->los+10.0/86400.0; + temptime=pass1->aos+10.0/86400.0; free_pass(pass2); pass2=get_pass(sat,qth2,temptime,maxdt); } else { @@ -579,7 +599,9 @@ valid=TRUE; } + printf("Temptime %f\n",temptime); } + } if (pass1) { free_pass(pass1); @@ -618,7 +640,7 @@ } gdouble find_maos(sat_t *sat, qth_t *qth1, qth_t *qth2, gdouble start, gdouble maxdt) { - mlos_t *temp; + mlos_t *temp=NULL; gdouble temptime = 0; temp = get_mlos(sat, qth1, qth2, start, maxdt); if (temp) { @@ -690,12 +712,17 @@ while (!done) { /* Find los of next pass or of current pass */ - if (maxdt>0.0) { - los = find_los (sat, qth, t0, start + maxdt-t0); // See if a pass is ongoing + if ((start+maxdt-t0)>0.0) { + los = find_los (sat, qth, t0, start + maxdt - t0); // See if a pass is ongoing aos = find_aos (sat, qth, t0, start + maxdt - t0); - } else { + } else if (maxdt == 0) { los = find_los (sat, qth, t0, maxdt); // See if a pass is ongoing aos = find_aos (sat, qth, t0, maxdt); + } else { + /* maxdt < 0 */ + los = 0.0; + aos = 0.0; + /* FIXME: should we log an error? */ } /* sat_log_log(SAT_LOG_LEVEL_MSG, "%s:%s:%d: found aos %f and los %f for t0=%f", */ /* __FILE__, */ @@ -704,13 +731,13 @@ /* aos, */ /* los, */ /* t0); */ - if (aos > los) { + if (aos >= los) { // los is from an currently happening pass, find previous aos aos = find_prev_aos(sat, qth, t0); } /* aos = 0.0 means no aos */ - if (aos == 0.0) { + if ((aos == 0.0)|| (los == 0.0) ){ done = TRUE; } @@ -1185,8 +1212,9 @@ mlos = g_slist_nth_data (mloses, i); - /* free element data */ - free_mlos (mlos); + if (mlos) + /* free element data */ + free_mlos (mlos); } @@ -1196,5 +1224,6 @@ } void free_mlos (mlos_t* mlos){ - g_free(mlos); + if (mlos) + g_free(mlos); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-18 21:53:58
|
Revision: 822 http://gpredict.svn.sourceforge.net/gpredict/?rev=822&view=rev Author: aa1vs Date: 2011-05-18 21:53:51 +0000 (Wed, 18 May 2011) Log Message: ----------- Remove SKG references. Modified Paths: -------------- branches/mlos/src/gtk-mlos-glance.c Modified: branches/mlos/src/gtk-mlos-glance.c =================================================================== --- branches/mlos/src/gtk-mlos-glance.c 2011-05-18 02:07:20 UTC (rev 821) +++ branches/mlos/src/gtk-mlos-glance.c 2011-05-18 21:53:51 UTC (rev 822) @@ -60,15 +60,15 @@ -#define SKG_DEFAULT_WIDTH 600 -#define SKG_DEFAULT_HEIGHT 300 -#define SKG_PIX_PER_SAT 10 -#define SKG_MARGIN 15 -#define SKG_FOOTER 50 +#define MLOSAG_DEFAULT_WIDTH 600 +#define MLOSAG_DEFAULT_HEIGHT 300 +#define MLOSAG_PIX_PER_SAT 10 +#define MLOSAG_MARGIN 15 +#define MLOSAG_FOOTER 50 static void gtk_mlos_glance_class_init (GtkMlosGlanceClass *class); -static void gtk_mlos_glance_init (GtkMlosGlance *skg); +static void gtk_mlos_glance_init (GtkMlosGlance *mlosag); static void gtk_mlos_glance_destroy (GtkObject *object); static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, @@ -101,13 +101,13 @@ gpointer data); -static GooCanvasItemModel* create_canvas_model (GtkMlosGlance *skg); +static GooCanvasItemModel* create_canvas_model (GtkMlosGlance *mlosag); static void create_sat (gpointer key, gpointer value, gpointer data); -static gdouble t2x (GtkMlosGlance *skg, gdouble t); -static gdouble x2t (GtkMlosGlance *skg, gdouble x); +static gdouble t2x (GtkMlosGlance *mlosag, gdouble t); +static gdouble x2t (GtkMlosGlance *mlosag, gdouble x); static GtkVBoxClass *parent_class = NULL; @@ -161,22 +161,22 @@ static void -gtk_mlos_glance_init (GtkMlosGlance *skg) +gtk_mlos_glance_init (GtkMlosGlance *mlosag) { - skg->sats = NULL; - skg->qth = NULL; - skg->passes = NULL; - skg->satlab = NULL; - skg->x0 = 0; - skg->y0 = 0; - skg->w = 0; - skg->h = 0; - skg->pps = 0; - skg->numsat = 0; - skg->numqth = 0; - skg->paircnt = 0; - skg->ts = 0.0; - skg->te = 0.0; + mlosag->sats = NULL; + mlosag->qth = NULL; + mlosag->passes = NULL; + mlosag->satlab = NULL; + mlosag->x0 = 0; + mlosag->y0 = 0; + mlosag->w = 0; + mlosag->h = 0; + mlosag->pps = 0; + mlosag->numsat = 0; + mlosag->numqth = 0; + mlosag->paircnt = 0; + mlosag->ts = 0.0; + mlosag->te = 0.0; } @@ -244,7 +244,7 @@ GtkWidget* gtk_mlos_glance_new (GHashTable *sats, qth_t *qth, GSList *groundstations, gdouble ts) { - GtkWidget *skg; + GtkWidget *mlosag; GooCanvasItemModel *root; GdkColor bg_color = {0, 0xFFFF, 0xFFFF, 0xFFFF}; guint number; @@ -254,93 +254,93 @@ number = g_hash_table_size (sats); if (number == 0) { /* no satellites */ - skg = gtk_label_new (_("This module has no satellites!")); + mlosag = gtk_label_new (_("This module has no satellites!")); - return skg; + return mlosag; } /* check that we have at least one groundstation */ number = g_slist_length (groundstations); if (number == 0) { /* no satellites */ - skg = gtk_label_new (_("This module has no other groundstations!")); + mlosag = gtk_label_new (_("This module has no other groundstations!")); - return skg; + return mlosag; } - skg = g_object_new (GTK_TYPE_MLOS_GLANCE, NULL); + mlosag = g_object_new (GTK_TYPE_MLOS_GLANCE, NULL); /* FIXME? */ - GTK_MLOS_GLANCE (skg)->sats = sats; - GTK_MLOS_GLANCE (skg)->grounds = groundstations; - GTK_MLOS_GLANCE (skg)->qth = qth; + GTK_MLOS_GLANCE (mlosag)->sats = sats; + GTK_MLOS_GLANCE (mlosag)->grounds = groundstations; + GTK_MLOS_GLANCE (mlosag)->qth = qth; /* get settings */ - GTK_MLOS_GLANCE (skg)->numsat = g_hash_table_size (sats); - GTK_MLOS_GLANCE (skg)->numqth = g_slist_length (groundstations); + GTK_MLOS_GLANCE (mlosag)->numsat = g_hash_table_size (sats); + GTK_MLOS_GLANCE (mlosag)->numqth = g_slist_length (groundstations); /* if ts = 0 use current time */ if (ts > 0.0) { - GTK_MLOS_GLANCE (skg)->ts = ts; + GTK_MLOS_GLANCE (mlosag)->ts = ts; } else { - GTK_MLOS_GLANCE (skg)->ts = get_current_daynum (); + GTK_MLOS_GLANCE (mlosag)->ts = get_current_daynum (); } - GTK_MLOS_GLANCE (skg)->te = GTK_MLOS_GLANCE (skg)->ts + + GTK_MLOS_GLANCE (mlosag)->te = GTK_MLOS_GLANCE (mlosag)->ts + sat_cfg_get_int (SAT_CFG_INT_SKYATGL_TIME)*(1.0/24.0); /* calculate preferred sizes */ - GTK_MLOS_GLANCE (skg)->w = SKG_DEFAULT_WIDTH; - GTK_MLOS_GLANCE (skg)->h = GTK_MLOS_GLANCE (skg)->numsat*GTK_MLOS_GLANCE(skg)->numqth * SKG_PIX_PER_SAT + - (GTK_MLOS_GLANCE (skg)->numsat*GTK_MLOS_GLANCE(skg)->numqth + 1) * SKG_MARGIN; - GTK_MLOS_GLANCE (skg)->pps = SKG_PIX_PER_SAT; + GTK_MLOS_GLANCE (mlosag)->w = MLOSAG_DEFAULT_WIDTH; + GTK_MLOS_GLANCE (mlosag)->h = GTK_MLOS_GLANCE (mlosag)->numsat*GTK_MLOS_GLANCE(mlosag)->numqth * MLOSAG_PIX_PER_SAT + + (GTK_MLOS_GLANCE (mlosag)->numsat*GTK_MLOS_GLANCE(mlosag)->numqth + 1) * MLOSAG_MARGIN; + GTK_MLOS_GLANCE (mlosag)->pps = MLOSAG_PIX_PER_SAT; /* create the canvas */ - GTK_MLOS_GLANCE (skg)->canvas = goo_canvas_new (); - g_object_set (G_OBJECT (GTK_MLOS_GLANCE(skg)->canvas), "has-tooltip", TRUE, NULL); - gtk_widget_modify_base (GTK_MLOS_GLANCE (skg)->canvas, GTK_STATE_NORMAL, &bg_color); - gtk_widget_set_size_request (GTK_MLOS_GLANCE (skg)->canvas, - GTK_MLOS_GLANCE (skg)->w, - GTK_MLOS_GLANCE (skg)->h + SKG_FOOTER); - goo_canvas_set_bounds (GOO_CANVAS (GTK_MLOS_GLANCE (skg)->canvas), 0, 0, - GTK_MLOS_GLANCE (skg)->w, - GTK_MLOS_GLANCE (skg)->h + SKG_FOOTER); + GTK_MLOS_GLANCE (mlosag)->canvas = goo_canvas_new (); + g_object_set (G_OBJECT (GTK_MLOS_GLANCE(mlosag)->canvas), "has-tooltip", TRUE, NULL); + gtk_widget_modify_base (GTK_MLOS_GLANCE (mlosag)->canvas, GTK_STATE_NORMAL, &bg_color); + gtk_widget_set_size_request (GTK_MLOS_GLANCE (mlosag)->canvas, + GTK_MLOS_GLANCE (mlosag)->w, + GTK_MLOS_GLANCE (mlosag)->h + MLOSAG_FOOTER); + goo_canvas_set_bounds (GOO_CANVAS (GTK_MLOS_GLANCE (mlosag)->canvas), 0, 0, + GTK_MLOS_GLANCE (mlosag)->w, + GTK_MLOS_GLANCE (mlosag)->h + MLOSAG_FOOTER); /* connect size-request signal */ - g_signal_connect (GTK_MLOS_GLANCE (skg)->canvas, "size-allocate", - G_CALLBACK (size_allocate_cb), skg); - g_signal_connect (GTK_MLOS_GLANCE (skg)->canvas, "item_created", - (GtkSignalFunc) on_item_created, skg); - g_signal_connect_after (GTK_MLOS_GLANCE (skg)->canvas, "realize", - (GtkSignalFunc) on_canvas_realized, skg); + g_signal_connect (GTK_MLOS_GLANCE (mlosag)->canvas, "size-allocate", + G_CALLBACK (size_allocate_cb), mlosag); + g_signal_connect (GTK_MLOS_GLANCE (mlosag)->canvas, "item_created", + (GtkSignalFunc) on_item_created, mlosag); + g_signal_connect_after (GTK_MLOS_GLANCE (mlosag)->canvas, "realize", + (GtkSignalFunc) on_canvas_realized, mlosag); - gtk_widget_show (GTK_MLOS_GLANCE (skg)->canvas); + gtk_widget_show (GTK_MLOS_GLANCE (mlosag)->canvas); /* Create the canvas model */ - root = create_canvas_model (GTK_MLOS_GLANCE (skg)); - goo_canvas_set_root_item_model (GOO_CANVAS (GTK_MLOS_GLANCE (skg)->canvas), root); + root = create_canvas_model (GTK_MLOS_GLANCE (mlosag)); + goo_canvas_set_root_item_model (GOO_CANVAS (GTK_MLOS_GLANCE (mlosag)->canvas), root); g_object_unref (root); /* add satellite passes */ - g_hash_table_foreach (GTK_MLOS_GLANCE (skg)->sats, create_sat, skg); + g_hash_table_foreach (GTK_MLOS_GLANCE (mlosag)->sats, create_sat, mlosag); - gtk_container_add (GTK_CONTAINER (skg), GTK_MLOS_GLANCE (skg)->canvas); + gtk_container_add (GTK_CONTAINER (mlosag), GTK_MLOS_GLANCE (mlosag)->canvas); - return skg; + return mlosag; } /** \brief Create the model for the GtkMlosGlance canvas - * \param skg Pointer to the GtkMlosGlance widget + * \param mlosag Pointer to the GtkMlosGlance widget */ static GooCanvasItemModel * -create_canvas_model (GtkMlosGlance *skg) +create_canvas_model (GtkMlosGlance *mlosag) { GooCanvasItemModel *root; GooCanvasItemModel *hrt,*hrl,*hrm; @@ -353,44 +353,44 @@ root = goo_canvas_group_model_new (NULL, NULL); /* cursor tracking line */ - skg->cursor = goo_canvas_polyline_model_new_line (root, - skg->x0, skg->y0, skg->x0, skg->h, + mlosag->cursor = goo_canvas_polyline_model_new_line (root, + mlosag->x0, mlosag->y0, mlosag->x0, mlosag->h, "stroke-color-rgba", 0x000000AF, "line-width", 0.5, NULL); /* time label */ - skg->timel = goo_canvas_text_model_new (root, "--:--", skg->x0 + 5, skg->y0, -1, GTK_ANCHOR_NW, + mlosag->timel = goo_canvas_text_model_new (root, "--:--", mlosag->x0 + 5, mlosag->y0, -1, GTK_ANCHOR_NW, "font", "Sans 8", "fill-color-rgba", 0x000000AF, NULL); /* footer */ - skg->footer = goo_canvas_rect_model_new (root, - skg->x0, skg->h, - skg->w, SKG_FOOTER, + mlosag->footer = goo_canvas_rect_model_new (root, + mlosag->x0, mlosag->h, + mlosag->w, MLOSAG_FOOTER, "fill-color-rgba", 0x00003FFF, "stroke-color-rgba", 0xFFFFFFFF, NULL); /* time ticks and labels */ if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) - skg->axisl = goo_canvas_text_model_new (root, _("TIME"), - skg->w / 2, skg->h + SKG_FOOTER - 5, + mlosag->axisl = goo_canvas_text_model_new (root, _("TIME"), + mlosag->w / 2, mlosag->h + MLOSAG_FOOTER - 5, -1, GTK_ANCHOR_S, "font", "Sans 9", "fill-color-rgba", 0xFFFFFFFF, NULL); else - skg->axisl = goo_canvas_text_model_new (root, _("UTC"), - skg->w / 2, skg->h + SKG_FOOTER - 5, + mlosag->axisl = goo_canvas_text_model_new (root, _("UTC"), + mlosag->w / 2, mlosag->h + MLOSAG_FOOTER - 5, -1, GTK_ANCHOR_S, "font", "Sans 9", "fill-color-rgba", 0xFFFFFFFF, NULL); /* get the first hour and first 30 min slot */ - th = ceil (skg->ts * 24.0) / 24.0; + th = ceil (mlosag->ts * 24.0) / 24.0; /* workaround for bug 1839140 (first hour incorrexct) */ th += 0.00069; @@ -398,7 +398,7 @@ /* the first 30 min tick can be either before or after the first hour tick */ - if ((th - skg->ts) > 0.0208333) { + if ((th - mlosag->ts) > 0.0208333) { tm = th - 0.0208333; } else { @@ -410,30 +410,30 @@ for (i = 0; i < n; i++) { /* hour tick */ - xh = t2x (skg, th); - hrt = goo_canvas_polyline_model_new_line (root, xh, skg->h, xh, skg->h + 10, + xh = t2x (mlosag, th); + hrt = goo_canvas_polyline_model_new_line (root, xh, mlosag->h, xh, mlosag->h + 10, "stroke-color-rgba", 0xFFFFFFFF, NULL); /* hour tick label */ daynum_to_str (buff, 3, "%H", th); - hrl = goo_canvas_text_model_new (root, buff, xh, skg->h + 12, + hrl = goo_canvas_text_model_new (root, buff, xh, mlosag->h + 12, -1, GTK_ANCHOR_N, "font", "Sans 8", "fill-color-rgba", 0xFFFFFFFF, NULL); /* 30 min tick */ - xm = t2x (skg, tm); - hrm = goo_canvas_polyline_model_new_line (root, xm, skg->h, xm, skg->h + 5, + xm = t2x (mlosag, tm); + hrm = goo_canvas_polyline_model_new_line (root, xm, mlosag->h, xm, mlosag->h + 5, "stroke-color-rgba", 0xFFFFFFFF, NULL); /* store canvas items */ - skg->majors = g_slist_append (skg->majors, hrt); - skg->labels = g_slist_append (skg->labels, hrl); - skg->minors = g_slist_append (skg->minors, hrm); + mlosag->majors = g_slist_append (mlosag->majors, hrt); + mlosag->labels = g_slist_append (mlosag->labels, hrl); + mlosag->minors = g_slist_append (mlosag->minors, hrm); th += 0.0416667; tm += 0.0416667; @@ -454,7 +454,7 @@ static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data) { - GtkMlosGlance *skg; + GtkMlosGlance *mlosag; GooCanvasPoints *pts; GooCanvasItem *obj; gint i,j,n; @@ -465,58 +465,57 @@ mlos_pass_t *skp; gdouble x,y,w,h; - if (GTK_WIDGET_REALIZED (widget)) { /* get graph dimensions */ - skg = GTK_MLOS_GLANCE (data); + mlosag = GTK_MLOS_GLANCE (data); - skg->w = allocation->width; - skg->h = allocation->height - SKG_FOOTER; - skg->x0 = 0; - skg->y0 = 0; + mlosag->w = allocation->width; + mlosag->h = allocation->height - MLOSAG_FOOTER; + mlosag->x0 = 0; + mlosag->y0 = 0; - skg->pps = (skg->h - SKG_MARGIN) / (g_slist_length(skg->satlab)) - SKG_MARGIN; + mlosag->pps = (mlosag->h - MLOSAG_MARGIN) / (g_slist_length(mlosag->satlab)) - MLOSAG_MARGIN; - goo_canvas_set_bounds (GOO_CANVAS (skg->canvas), 0, 0, + goo_canvas_set_bounds (GOO_CANVAS (mlosag->canvas), 0, 0, allocation->width, allocation->height); /* update cursor tracking line */ pts = goo_canvas_points_new (2); - pts->coords[0] = skg->x0; - pts->coords[1] = skg->y0; - pts->coords[2] = skg->x0; - pts->coords[3] = skg->h; - g_object_set (skg->cursor, "points", pts, NULL); + pts->coords[0] = mlosag->x0; + pts->coords[1] = mlosag->y0; + pts->coords[2] = mlosag->x0; + pts->coords[3] = mlosag->h; + g_object_set (mlosag->cursor, "points", pts, NULL); goo_canvas_points_unref (pts); /* time label */ - g_object_set (skg->timel, - "x", (gdouble) skg->x0 + 5, + g_object_set (mlosag->timel, + "x", (gdouble) mlosag->x0 + 5, NULL); /* update footer */ - g_object_set (skg->footer, - "x", (gdouble) skg->x0, - "y", (gdouble) skg->h, - "width", (gdouble) skg->w, - "height", (gdouble) SKG_FOOTER, + g_object_set (mlosag->footer, + "x", (gdouble) mlosag->x0, + "y", (gdouble) mlosag->h, + "width", (gdouble) mlosag->w, + "height", (gdouble) MLOSAG_FOOTER, NULL); - g_object_set (skg->axisl, - "x", (gdouble) (skg->w / 2), - "y", (gdouble) (skg->h + SKG_FOOTER - 5), + g_object_set (mlosag->axisl, + "x", (gdouble) (mlosag->w / 2), + "y", (gdouble) (mlosag->h + MLOSAG_FOOTER - 5), NULL); /* get the first hour and first 30 min slot */ - th = ceil (skg->ts * 24.0) / 24.0; + th = ceil (mlosag->ts * 24.0) / 24.0; /* workaround for bug 1839140 (first hour incorrexct) */ th += 0.00069; - if ((th - skg->ts) > 0.0208333) { + if ((th - mlosag->ts) > 0.0208333) { tm = th - 0.0208333; } else { @@ -526,35 +525,35 @@ /* the number of steps equals the number of hours */ n = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_TIME); for (i = 0; i < n; i++) { - xh = t2x (skg, th); + xh = t2x (mlosag, th); pts = goo_canvas_points_new (2); pts->coords[0] = xh; - pts->coords[1] = skg->h; + pts->coords[1] = mlosag->h; pts->coords[2] = xh; - pts->coords[3] = skg->h + 10; + pts->coords[3] = mlosag->h + 10; - obj = g_slist_nth_data (skg->majors, i); + obj = g_slist_nth_data (mlosag->majors, i); g_object_set (obj, "points", pts, NULL); goo_canvas_points_unref (pts); - obj = g_slist_nth_data (skg->labels, i); + obj = g_slist_nth_data (mlosag->labels, i); g_object_set (obj, "x", (gdouble) xh, - "y", (gdouble) (skg->h + 12), + "y", (gdouble) (mlosag->h + 12), NULL); /* 30 min tick */ - xm = t2x (skg, tm); + xm = t2x (mlosag, tm); pts = goo_canvas_points_new (2); pts->coords[0] = xm; - pts->coords[1] = skg->h; + pts->coords[1] = mlosag->h; pts->coords[2] = xm; - pts->coords[3] = skg->h + 5; + pts->coords[3] = mlosag->h + 5; - obj = g_slist_nth_data (skg->minors, i); + obj = g_slist_nth_data (mlosag->minors, i); g_object_set (obj, "points", pts, NULL); goo_canvas_points_unref (pts); @@ -564,7 +563,7 @@ } /* update pass items */ - n = g_slist_length (skg->passes); + n = g_slist_length (mlosag->passes); j = -1; curcat = 0; curqth = 1<<15; @@ -573,11 +572,11 @@ for (i = 0; i < n; i++) { /* get pass */ - skp = (mlos_pass_t *) g_slist_nth_data (skg->passes, i); + skp = (mlos_pass_t *) g_slist_nth_data (mlosag->passes, i); //printf("Reading MLOS from %f to %f.\n",skp->pass->start, skp->pass->finish); - x = t2x (skg, skp->pass->start); - w = t2x (skg, skp->pass->finish) - x; + x = t2x (mlosag, skp->pass->start); + w = t2x (mlosag, skp->pass->finish) - x; if (w>0) { /* new satellite qth pair? */ @@ -585,12 +584,12 @@ j++; curcat = skp->catnum; curqth = skp->qthnum; - y = j * (skg->pps + SKG_MARGIN) + SKG_MARGIN; - h = skg->pps; + y = j * (mlosag->pps + MLOSAG_MARGIN) + MLOSAG_MARGIN; + h = mlosag->pps; /* update label */ - obj = g_slist_nth_data (skg->satlab, j); - if (x > (skg->x0 + 100)) + obj = g_slist_nth_data (mlosag->satlab, j); + if (x > (mlosag->x0 + 100)) g_object_set (obj, "x", x-5, "y", y+h/2.0, "anchor", GTK_ANCHOR_E, NULL); else @@ -637,7 +636,7 @@ GdkEventMotion *event, gpointer data) { - GtkMlosGlance *skg = GTK_MLOS_GLANCE (data); + GtkMlosGlance *mlosag = GTK_MLOS_GLANCE (data); GooCanvasPoints *pts; gdouble t; gchar buff[6]; @@ -645,14 +644,14 @@ /* update cursor tracking line and time label */ pts = goo_canvas_points_new (2); pts->coords[0] = event->x; - pts->coords[1] = skg->y0; + pts->coords[1] = mlosag->y0; pts->coords[2] = event->x; - pts->coords[3] = skg->h; - g_object_set (skg->cursor, "points", pts, NULL); + pts->coords[3] = mlosag->h; + g_object_set (mlosag->cursor, "points", pts, NULL); goo_canvas_points_unref (pts); /* get time corresponding to x */ - t = x2t (skg, event->x); + t = x2t (mlosag, event->x); daynum_to_str (buff, 6, "%H:%M", t); @@ -662,22 +661,22 @@ => Currently disabled, time display stays in upper left corner */ /* - if (event->x > (skg->w / 2)) { - g_object_set (skg->timel, + if (event->x > (mlosag->w / 2)) { + g_object_set (mlosag->timel, "text", buff, "x", (gdouble) event->x - 5, "anchor", GTK_ANCHOR_NE, NULL); } else { - g_object_set (skg->timel, + g_object_set (mlosag->timel, "text", buff, "x", (gdouble) event->x + 5, "anchor", GTK_ANCHOR_NW, NULL); } */ - g_object_set (skg->timel, + g_object_set (mlosag->timel, "text", buff, NULL); @@ -733,7 +732,7 @@ gpointer data) { /* GooCanvasItemModel *model = goo_canvas_item_get_model (item); */ -/* GtkMlosGlance *skg = GTK_MLOS_GLANCE (data); */ +/* GtkMlosGlance *mlosag = GTK_MLOS_GLANCE (data); */ switch (event->button) { @@ -770,7 +769,6 @@ { GooCanvasItemModel *item_model = goo_canvas_item_get_model (item); - GtkMlosGlance *skg = GTK_MLOS_GLANCE (data); /* get pointer to pass_t structure */ mlos_t *pass = (mlos_t *) g_object_get_data(G_OBJECT(item_model), "pass"); @@ -794,7 +792,7 @@ // __FILE__, __FUNCTION__, pass->satname); /* show the pass details */ - //show_pass (pass->satname, skg->qth, new_pass, NULL); + //show_pass (pass->satname, mlosag->qth, new_pass, NULL); //break; @@ -825,7 +823,7 @@ gpointer data) { GooCanvasItemModel *item_model = goo_canvas_item_get_model (item); - GtkMlosGlance *skg = GTK_MLOS_GLANCE (data); + //GtkMlosGlance *mlosag = GTK_MLOS_GLANCE (data); /* get pointer to pass_t structure */ mlos_t *pass = (mlos_t *) g_object_get_data(G_OBJECT(item_model), "pass"); @@ -867,7 +865,7 @@ /** \brief Convert time value to x position. - * \param skg The GtkMlosGlance widget. + * \param mlosag The GtkMlosGlance widget. * \param t Julian dateuser is presented with brief info about the * satellite pass and a suggestion to click on the box for more info. * \return X coordinate. @@ -875,32 +873,32 @@ * No error checking is made to ensure that we are within visible range. * */ -static gdouble t2x (GtkMlosGlance *skg, gdouble t) +static gdouble t2x (GtkMlosGlance *mlosag, gdouble t) { gdouble frac; - frac = (t - skg->ts) / (skg->te - skg->ts); + frac = (t - mlosag->ts) / (mlosag->te - mlosag->ts); - return (skg->x0 + frac * skg->w); + return (mlosag->x0 + frac * mlosag->w); } /** \brief Convert x coordinate to Julian date. - * \param skg The GtkMlosGlance widget. + * \param mlosag The GtkMlosGlance widget. * \param x The X coordinate. * \return The Julian date corresponding to X. * * No error checking is made to ensure that we are within visible range. * */ -static gdouble x2t (GtkMlosGlance *skg, gdouble x) +static gdouble x2t (GtkMlosGlance *mlosag, gdouble x) { gdouble frac; - frac = (x - skg->x0) / skg->w; + frac = (x - mlosag->x0) / mlosag->w; - return (skg->ts + frac * (skg->te - skg->ts)); + return (mlosag->ts + frac * (mlosag->te - mlosag->ts)); } @@ -983,7 +981,7 @@ create_sat (gpointer key, gpointer value, gpointer data) { sat_t *sat = SAT(value); - GtkMlosGlance *skg = GTK_MLOS_GLANCE(data); + GtkMlosGlance *mlosag = GTK_MLOS_GLANCE(data); GSList *passes = NULL; gdouble maxdt; guint i,n,jj,m; @@ -1000,25 +998,24 @@ gchar losstr[100]; /* LOS time string */ /* get canvas root */ - root = goo_canvas_get_root_item_model (GOO_CANVAS (skg->canvas)); + root = goo_canvas_get_root_item_model (GOO_CANVAS (mlosag->canvas)); - get_colours (skg->paircnt++, &bcol, &fcol); + get_colours (mlosag->paircnt++, &bcol, &fcol); - maxdt = skg->te - skg->ts; - m = g_slist_length (skg->grounds); + maxdt = mlosag->te - mlosag->ts; + m = g_slist_length (mlosag->grounds); for (jj=0;jj<m;jj++){ - qth2 = QTH(g_slist_nth_data(skg->grounds,jj)); - //printf("Processing %s\n",qth2->name); + qth2 = QTH(g_slist_nth_data(mlosag->grounds,jj)); /* get mutual visibility for satellite at this qth and qth2*/ - passes = get_mloses (sat, skg->qth, qth2, skg->ts, maxdt, 10); + passes = get_mloses (sat, mlosag->qth, qth2, mlosag->ts, maxdt, 10); n = g_slist_length (passes); sat_log_log (SAT_LOG_LEVEL_DEBUG, _("%s:%d: %s has %d passes within %.4f days\n"), __FILE__, __LINE__, sat->nickname, n, maxdt); - /* add mlos_pass_t items to skg->passes */ + /* add mlos_pass_t items to mlosag->passes */ if (passes != NULL) { /* add pass items */ @@ -1040,8 +1037,7 @@ /* box tooltip will contain pass summary */ tooltip = g_strdup_printf("<big><b>%s with %s</b>\n</big>\n" \ "<tt>MAOS: %s\n" \ - "MLOS: %s</tt>\n" \ - "\n<i>Click for details</i>", + "MLOS: %s</tt>\n", \ sat->nickname, qth2->name, aosstr, @@ -1057,7 +1053,7 @@ g_free (tooltip); /* store this pass in list */ - skg->passes = g_slist_append (skg->passes, mlospass); + mlosag->passes = g_slist_append (mlosag->passes, mlospass); /* store a pointer to the pass data in the GooCanvasItem so that we can access it later during various events, e.g mouse click */ @@ -1081,7 +1077,7 @@ "font", "Sans 8", "fill-color-rgba", bcol, NULL); - skg->satlab = g_slist_append (skg->satlab, lab); + mlosag->satlab = g_slist_append (mlosag->satlab, lab); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-18 02:07:26
|
Revision: 821 http://gpredict.svn.sourceforge.net/gpredict/?rev=821&view=rev Author: aa1vs Date: 2011-05-18 02:07:20 +0000 (Wed, 18 May 2011) Log Message: ----------- Fix segfault in mod-cfg.c Modified Paths: -------------- branches/mlos/src/mod-cfg.c Modified: branches/mlos/src/mod-cfg.c =================================================================== --- branches/mlos/src/mod-cfg.c 2011-05-14 13:43:15 UTC (rev 820) +++ branches/mlos/src/mod-cfg.c 2011-05-18 02:07:20 UTC (rev 821) @@ -875,7 +875,7 @@ if (g_str_has_suffix (filename, ".qth")) { buffv = g_strsplit (filename, ".qth", 0); - qths = g_slist_insert_sorted(qths,g_strdup(buffv[0]),(GCompareFunc) qth_name_compare); + qths = g_slist_insert_sorted(qths,g_strdup(buffv[0]),(GCompareFunc) gpredict_strcmp); g_strfreev (buffv); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-14 13:43:21
|
Revision: 820 http://gpredict.svn.sourceforge.net/gpredict/?rev=820&view=rev Author: aa1vs Date: 2011-05-14 13:43:15 +0000 (Sat, 14 May 2011) Log Message: ----------- Add range circles around ground stations. Modified Paths: -------------- branches/ground_ring/ChangeLog branches/ground_ring/src/gtk-sat-map.c branches/ground_ring/src/gtk-sat-map.h Modified: branches/ground_ring/ChangeLog =================================================================== --- branches/ground_ring/ChangeLog 2011-05-14 12:43:16 UTC (rev 819) +++ branches/ground_ring/ChangeLog 2011-05-14 13:43:15 UTC (rev 820) @@ -1,3 +1,9 @@ +2011-05-14 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-src-map.c + First attempt at plotting satellite coverage for a qth. + Addresses "The satellite map can show the range circle of the ground station according to the selected satellite." from TODO file. + 2011-04-03 Alexandru Csete <oz9aec at gmail.com> * src/gtk-rot-knob.c Modified: branches/ground_ring/src/gtk-sat-map.c =================================================================== --- branches/ground_ring/src/gtk-sat-map.c 2011-05-14 12:43:16 UTC (rev 819) +++ branches/ground_ring/src/gtk-sat-map.c 2011-05-14 13:43:15 UTC (rev 820) @@ -71,11 +71,12 @@ static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data); static void update_map_size (GtkSatMap *satmap); static void update_sat (gpointer key, gpointer value, gpointer data); +static void update_qth (GtkSatMap *satmap); static void update_obj (sat_map_obj_t *obj, GtkSatMap *satmap, guint32 col, guint32 covcol, gfloat lon, gfloat lat,gchar * tooltip, gdouble footprint); static void plot_sat (gpointer key, gpointer value, gpointer data); -static void plot_qth (gpointer key, gpointer value, gpointer data); +static void plot_qth (GtkSatMap* satmap); static sat_map_obj_t* -plot_obj (gpointer key, gpointer value, gpointer data, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint); +plot_obj (GtkSatMap *satmap, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint); static void lonlat_to_xy (GtkSatMap *m, gdouble lon, gdouble lat, gfloat *x, gfloat *y); static void xy_to_lonlat (GtkSatMap *m, gfloat x, gfloat y, gfloat *lon, gfloat *lat); static gboolean on_motion_notify (GooCanvasItem *item, @@ -297,6 +298,9 @@ g_object_unref (root); + /* plot qth here */ + plot_qth(GTK_SAT_MAP(satmap)); + /* plot each sat on the canvas */ g_hash_table_foreach (GTK_SAT_MAP (satmap)->sats, plot_sat, GTK_SAT_MAP (satmap)); @@ -319,7 +323,6 @@ { GooCanvasItemModel *root; gchar *buff; - gfloat x,y; guint32 col; root = goo_canvas_group_model_new (NULL, NULL); @@ -342,30 +345,6 @@ /* grid lines */ draw_grid_lines (satmap, root); - /* QTH mark */ - col = mod_cfg_get_int (satmap->cfgdata, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_QTH_COL, - SAT_CFG_INT_MAP_QTH_COL); - - lonlat_to_xy (satmap, satmap->qth->lon, satmap->qth->lat, &x, &y); - - satmap->qthmark = goo_canvas_rect_model_new (root, - x - MARKER_SIZE_HALF, - y - MARKER_SIZE_HALF, - 2 * MARKER_SIZE_HALF, - 2 * MARKER_SIZE_HALF, - "fill-color-rgba", col, - "stroke-color-rgba", col, - NULL); - - satmap->qthlabel = goo_canvas_text_model_new (root, satmap->qth->name, - x, y+2, -1, - GTK_ANCHOR_NORTH, - "font", "Sans 8", - "fill-color-rgba", col, - NULL); - /* QTH info */ col = mod_cfg_get_int (satmap->cfgdata, MOD_CFG_MAP_SECTION, @@ -482,7 +461,6 @@ { GtkAllocation allocation; GdkPixbuf *pbuf; - gfloat x, y; gfloat ratio; /* ratio between map width and height */ gfloat size; /* size = min (alloc.w, ratio*alloc.h) */ @@ -542,15 +520,7 @@ redraw_grid_lines (satmap); /* QTH */ - lonlat_to_xy (satmap, satmap->qth->lon, satmap->qth->lat, &x, &y); - g_object_set (satmap->qthmark, - "x", x - MARKER_SIZE_HALF, - "y", y - MARKER_SIZE_HALF, - NULL); - g_object_set (satmap->qthlabel, - "x", x, - "y", y+2, - NULL); + update_qth(satmap); /* QTH info */ g_object_set (satmap->locnam, @@ -617,42 +587,14 @@ gint *catnr; guint h, m, s; gchar *ch, *cm, *cs; - gfloat x,y; - gdouble oldx,oldy; - /* check whether there are any pending resize requests */ if (satmap->resize) update_map_size (satmap); /* check if qth has moved significantly if so move it*/ - lonlat_to_xy (satmap, satmap->qth->lon, satmap->qth->lat, &x, &y); - g_object_get (satmap->qthmark, - "x", &oldx, - "y", &oldy, - NULL); + update_qth(satmap); - if ((fabs (oldx-x) >= 2*MARKER_SIZE_HALF) || - (fabs (oldy-y) >= 2*MARKER_SIZE_HALF)) { - - /* update qth mark */ - g_object_set (satmap->qthmark, - "x", x - MARKER_SIZE_HALF, - "y", y - MARKER_SIZE_HALF, - NULL); - g_object_set (satmap->qthlabel, - "x", x, - "y", y+2, - NULL); - - /* QTH info */ - g_object_set (satmap->locnam, - "x", (gdouble) satmap->x0 + 2, - "y", (gdouble) satmap->y0 + 1, - NULL); - satmap->counter=satmap->refresh; - } - /* check refresh rate and refresh sats/qth if time */ /* FIXME add location check*/ if (satmap->counter < satmap->refresh) { @@ -665,16 +607,8 @@ /* QTH */ /*update for accuracy*/ - lonlat_to_xy (satmap, satmap->qth->lon, satmap->qth->lat, &x, &y); - g_object_set (satmap->qthmark, - "x", x - MARKER_SIZE_HALF, - "y", y - MARKER_SIZE_HALF, - NULL); - g_object_set (satmap->qthlabel, - "x", x, - "y", y+2, - NULL); - + update_qth(satmap); + /* QTH info */ g_object_set (satmap->locnam, "x", (gdouble) satmap->x0 + 2, @@ -1249,7 +1183,7 @@ * This function calculates the "left" side of the range circle and mirrors * the points in longitude to create the "right side of the range circle, too. * In order to be able to use the footprint points to create a set of subsequent - * lines conencted to each other (poly-lines) the function may have to perform + * lines connected to each other (poly-lines) the function may have to perform * one of the following three actions: * * 1. If the footprint covers the North or South pole, we need to sort the points @@ -1337,7 +1271,7 @@ points1->coords[719-2*azi] = msy; } - /* points1 ow contains 360 pairs of map-based XY coordinates. + /* points1 now contains 360 pairs of map-based XY coordinates. Check whether actions 1, 2 or 3 have to be performed. */ @@ -1751,8 +1685,8 @@ root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); + obj = plot_obj(data, col, covcol, shadowcol, sat->ssplon,sat->ssplat,tooltip,sat->nickname, sat->footprint); - obj = plot_obj(key,value,data, col, covcol, shadowcol, sat->ssplon,sat->ssplat,tooltip,sat->nickname, sat->footprint); g_object_set_data (G_OBJECT (obj->marker), "catnum", GINT_TO_POINTER (*catnum)); g_object_set_data (G_OBJECT (obj->label), "catnum", GINT_TO_POINTER (*catnum)); g_object_set_data (G_OBJECT (obj->range1), "catnum", GINT_TO_POINTER (*catnum)); @@ -1762,22 +1696,50 @@ /* add sat to hash table */ g_hash_table_insert (satmap->obj, catnum, obj); } +void +plot_qth (GtkSatMap *satmap){ + guint32 col,covcol,shadowcol; + col = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_QTH_COL, + SAT_CFG_INT_MAP_QTH_COL); + /* area coverage colour */ + covcol = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COV_COL, + SAT_CFG_INT_MAP_SAT_COV_COL); + /* shadow colour (only alpha channel) */ + shadowcol = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHADOW_ALPHA, + SAT_CFG_INT_MAP_SHADOW_ALPHA); + + satmap->qthobj = plot_obj(satmap, + col, + covcol, + shadowcol, + satmap->qth->lon, + satmap->qth->lat, + NULL, + satmap->qth->name, + 0); +} + static sat_map_obj_t* -plot_obj (gpointer key, gpointer value, gpointer data, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint) +plot_obj (GtkSatMap *satmap, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint) { - GtkSatMap *satmap = GTK_SAT_MAP (data); sat_map_obj_t *obj = NULL; GooCanvasItemModel *root; gfloat x,y; - + lonlat_to_xy (satmap, lon, lat, &x, &y); - - + + /* create and initialize a sat object */ - + obj = g_try_new (sat_map_obj_t, 1); - + obj->selected = FALSE; obj->showtrack = FALSE; obj->showcov = TRUE; @@ -1787,10 +1749,11 @@ obj->track_data.latlon = NULL; obj->track_data.lines = NULL; obj->track_orbit = 0; + obj->oldfootprint = 0.0; root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); - /* create satellite marker and label + shadows. We create shadows first */ + /* create marker and label + shadows. We create shadows first */ obj->shadowm = goo_canvas_rect_model_new (root, x - MARKER_SIZE_HALF + 1, y - MARKER_SIZE_HALF + 1, @@ -1799,17 +1762,17 @@ "fill-color-rgba", 0x00, "stroke-color-rgba", shadowcol, NULL); - obj->marker = goo_canvas_rect_model_new (root, - x - MARKER_SIZE_HALF, - y - MARKER_SIZE_HALF, - 2 * MARKER_SIZE_HALF, - 2 * MARKER_SIZE_HALF, - "fill-color-rgba", col, - "stroke-color-rgba", col, - "tooltip", tooltip, - NULL); - - obj->shadowl = goo_canvas_text_model_new (root, label, + if (tooltip) { + obj->marker = goo_canvas_rect_model_new (root, + x - MARKER_SIZE_HALF, + y - MARKER_SIZE_HALF, + 2 * MARKER_SIZE_HALF, + 2 * MARKER_SIZE_HALF, + "fill-color-rgba", col, + "stroke-color-rgba", col, + "tooltip", tooltip, + NULL); + obj->shadowl = goo_canvas_text_model_new (root, label, x+1, y+3, -1, @@ -1817,22 +1780,56 @@ "font", "Sans 8", "fill-color-rgba", shadowcol, NULL); - obj->label = goo_canvas_text_model_new (root, label, - x, - y+2, + + + obj->label = goo_canvas_text_model_new (root, label, + x, + y+2, + -1, + GTK_ANCHOR_NORTH, + "font", "Sans 8", + "fill-color-rgba", col, + "tooltip", tooltip, + NULL); + + } else { + obj->marker = goo_canvas_rect_model_new (root, + x - MARKER_SIZE_HALF, + y - MARKER_SIZE_HALF, + 2 * MARKER_SIZE_HALF, + 2 * MARKER_SIZE_HALF, + "fill-color-rgba", col, + "stroke-color-rgba", col, + NULL); + obj->shadowl = goo_canvas_text_model_new (root, label, + x+1, + y+3, -1, GTK_ANCHOR_NORTH, "font", "Sans 8", - "fill-color-rgba", col, - "tooltip", tooltip, + "fill-color-rgba", shadowcol, NULL); + + obj->label = goo_canvas_text_model_new (root, label, + x, + y+2, + -1, + GTK_ANCHOR_NORTH, + "font", "Sans 8", + "fill-color-rgba", col, + NULL); + + + } + /* initialize points for footprint */ points1 = goo_canvas_points_new (360); points2 = goo_canvas_points_new (360); /* calculate footprint */ obj->newrcnum = calculate_footprint (satmap, lon, lat, footprint); + obj->oldfootprint = footprint; obj->oldrcnum = obj->newrcnum; /* invisible footprint for decayed sats (STS fix) */ @@ -2007,6 +2004,26 @@ g_free (catnum); } +static void +update_qth(GtkSatMap *satmap){ + + guint32 col = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_QTH_COL, + SAT_CFG_INT_MAP_QTH_COL); + /* area coverage colour */ + guint32 covcol = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COV_COL, + SAT_CFG_INT_MAP_SAT_COV_COL); + + if (satmap->selected) { + update_obj(satmap->qthobj,satmap,col,covcol,satmap->qth->lon,satmap->qth->lat,NULL,2*satmap->selected->footprint); + } + else { + update_obj(satmap->qthobj,satmap,col,covcol,satmap->qth->lon,satmap->qth->lat,NULL,0); + } +} static void update_obj (sat_map_obj_t *obj, GtkSatMap *satmap, guint32 col, guint32 covcol, gfloat lon, gfloat lat,gchar * tooltip, gdouble footprint) { gfloat x, y; @@ -2027,6 +2044,7 @@ if ((fabs (oldx-x) >= 2*MARKER_SIZE_HALF) || (fabs (oldy-y) >= 2*MARKER_SIZE_HALF)) { + obj->oldfootprint=-1000; /* update sat mark */ g_object_set (obj->marker, @@ -2038,7 +2056,7 @@ "y", (gdouble) (y - MARKER_SIZE_HALF + 1), NULL); - /* update sat label */ + /* update label */ if (x < 50) { g_object_set (obj->label, "x", (gdouble) (x+3), @@ -2084,19 +2102,21 @@ "anchor", GTK_ANCHOR_NORTH, NULL); } - + } + if (fabs(footprint - obj->oldfootprint)>50) { + obj->oldfootprint=footprint; /* initialize points for footprint */ points1 = goo_canvas_points_new (360); points2 = goo_canvas_points_new (360); - + /* calculate footprint */ obj->newrcnum = calculate_footprint (satmap, lon, lat, footprint); - + /* always update first part */ g_object_set (obj->range1, "points", points1, NULL); - + if (obj->newrcnum == 2) { if (obj->oldrcnum == 1) { /* we need to create the second part */ @@ -2125,17 +2145,19 @@ } } } - + /* update rc-number */ obj->oldrcnum = obj->newrcnum; - + goo_canvas_points_unref (points1); goo_canvas_points_unref (points2); } - g_object_set (obj->marker, "tooltip", tooltip, NULL); - g_object_set (obj->label, "tooltip", tooltip, NULL); - + if (tooltip) { + g_object_set (obj->marker, "tooltip", tooltip, NULL); + g_object_set (obj->label, "tooltip", tooltip, NULL); + } + } /** \brief Update information about the selected satellite. Modified: branches/ground_ring/src/gtk-sat-map.h =================================================================== --- branches/ground_ring/src/gtk-sat-map.h 2011-05-14 12:43:16 UTC (rev 819) +++ branches/ground_ring/src/gtk-sat-map.h 2011-05-14 13:43:15 UTC (rev 820) @@ -100,6 +100,7 @@ /* book keeping */ guint oldrcnum; /*!< Number of RC parts in prev. cycle. */ guint newrcnum; /*!< Number of RC parts in this cycle. */ + gdouble oldfootprint; /*!< The old footprint radius. */ ground_track_t track_data; /*!< Ground track data. */ unsigned long track_orbit; /*!< Orbit when the ground track has been updated. */ @@ -118,8 +119,9 @@ GooCanvasItemModel *map; /*!< The canvas map item. */ - GooCanvasItemModel *qthmark; /*!< QTH marker, e.g. small rectangle. */ - GooCanvasItemModel *qthlabel; /*!< Label showing the QTH name. */ + //GooCanvasItemModel *qthmark; /*!< QTH marker, e.g. small rectangle. */ + //GooCanvasItemModel *qthlabel; /*!< Label showing the QTH name. */ + sat_map_obj_t *qthobj; GooCanvasItemModel *locnam; /*!< Location name. */ GooCanvasItemModel *curs; /*!< Cursor tracking text. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-05-14 12:43:22
|
Revision: 819 http://gpredict.svn.sourceforge.net/gpredict/?rev=819&view=rev Author: aa1vs Date: 2011-05-14 12:43:16 +0000 (Sat, 14 May 2011) Log Message: ----------- Update NOAA-15,-16, and -17 transponder frequencies. Modified Paths: -------------- trunk/ChangeLog trunk/data/trsp/25338.trsp trunk/data/trsp/26536.trsp trunk/data/trsp/27453.trsp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-05-01 11:12:02 UTC (rev 818) +++ trunk/ChangeLog 2011-05-14 12:43:16 UTC (rev 819) @@ -1,3 +1,10 @@ +2011-05-14 Charles Suprin <hamaa1vs at gmail.com> + + * data/trsp/25338.trsp + * data/trsp/26536.trsp + * data/trsp/27543.trsp + Update NOAA-15,-16,-17 transponder frequencies. + 2011-05-01 Alexandru Csete <oz9aec at gmail.com> * src/gtk-sat-module-popup.c Modified: trunk/data/trsp/25338.trsp =================================================================== --- trunk/data/trsp/25338.trsp 2011-05-01 11:12:02 UTC (rev 818) +++ trunk/data/trsp/25338.trsp 2011-05-14 12:43:16 UTC (rev 819) @@ -1,5 +1,5 @@ [APT] -DOWN_LOW=137500000 +DOWN_LOW=137620000 [HRPT] DOWN_LOW=1702500000 Modified: trunk/data/trsp/26536.trsp =================================================================== --- trunk/data/trsp/26536.trsp 2011-05-01 11:12:02 UTC (rev 818) +++ trunk/data/trsp/26536.trsp 2011-05-14 12:43:16 UTC (rev 819) @@ -1,3 +1,3 @@ [HRPT] -DOWN_LOW=1702500000 +DOWN_LOW=1698000000 Modified: trunk/data/trsp/27453.trsp =================================================================== --- trunk/data/trsp/27453.trsp 2011-05-01 11:12:02 UTC (rev 818) +++ trunk/data/trsp/27453.trsp 2011-05-14 12:43:16 UTC (rev 819) @@ -1,5 +1,5 @@ [APT] -DOWN_LOW=137620000 +DOWN_LOW=137500000 [HRPT] DOWN_LOW=1698000000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2011-05-01 11:12:09
|
Revision: 818 http://gpredict.svn.sourceforge.net/gpredict/?rev=818&view=rev Author: csete Date: 2011-05-01 11:12:02 +0000 (Sun, 01 May 2011) Log Message: ----------- New module menu item to allow selection of a satellite in all views at the same time. Related to feature request 3179102: Right click on satellite to add the track (probably the closest we can get to global selection without breaking the design). Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-event-list.c trunk/src/gtk-event-list.h trunk/src/gtk-polar-view.c trunk/src/gtk-polar-view.h trunk/src/gtk-sat-list.c trunk/src/gtk-sat-list.h trunk/src/gtk-sat-map.c trunk/src/gtk-sat-map.h trunk/src/gtk-sat-module-popup.c trunk/src/gtk-sat-module.c trunk/src/gtk-sat-module.h trunk/src/gtk-single-sat.c trunk/src/gtk-single-sat.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/ChangeLog 2011-05-01 11:12:02 UTC (rev 818) @@ -1,3 +1,24 @@ +2011-05-01 Alexandru Csete <oz9aec at gmail.com> + + * src/gtk-sat-module-popup.c + * src/gtk-sat-module.c + * src/gtk-sat-module.h + * src/gtk-sat-list.c + * src/gtk-sat-list.h + * src/gtk-single-sat.c + * src/gtk-single-sat.h + * src/gtk-event-list.c + * src/gtk-event-list.h + * src/gtk-sat-map.c + * src/gtk-sat-map.h + * src/gtk-polar-view.c + * src/gtk-polar-view.h + New module menu item to allow selection of a satellite in all views at the + same time. Related to feature request 3179102: Right click on satellite to + add the track (probably the closest we can get to "global selection" without + breaking the design). + + 2011-04-29 Alexandru Csete <oz9aec at gmail.com> * data/desktop/gpredict.desktop.in Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/NEWS 2011-05-01 11:12:02 UTC (rev 818) @@ -1,5 +1,6 @@ Changes in version 1.4 (TBD) +- New menu item in the module menu for selecting a satellite in all views. - Feature request 3141555: gpsd support. - Feature request 2130926: Change frequency using mouse wheel. Also for rotator controller. - Applied and extended patch 3237220: natural sort for sat list in module config Modified: trunk/src/gtk-event-list.c =================================================================== --- trunk/src/gtk-event-list.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-event-list.c 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -844,3 +844,39 @@ { GTK_EVENT_LIST (evlist)->satellites = sats; } + + +/** \brief Select satellite. */ +void gtk_event_list_select_sat (GtkWidget *widget, gint catnum) +{ + GtkEventList *list; + GtkTreeModel *model; + GtkTreeSelection *selection; + GtkTreeIter iter; + gint i,n; + gint sat; + + + list = GTK_EVENT_LIST(widget); + model = gtk_tree_view_get_model(GTK_TREE_VIEW(list->treeview)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list->treeview)); + + /* iterate over the satellite list until a amtch is found */ + n = g_hash_table_size(list->satellites); + for (i = 0; i < n; i++) { + + if (gtk_tree_model_iter_nth_child(model, &iter, NULL, i)) { + gtk_tree_model_get(model, &iter, EVENT_LIST_COL_CATNUM, &sat, -1); + if (sat == catnum) { + gtk_tree_selection_select_iter(selection, &iter); + i = n; + } + } + else { + sat_log_log(SAT_LOG_LEVEL_ERROR, + _("%s: GtkEventList has not child with index %d"), + __FUNCTION__, i); + } + } + +} Modified: trunk/src/gtk-event-list.h =================================================================== --- trunk/src/gtk-event-list.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-event-list.h 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -114,8 +114,8 @@ void gtk_event_list_reconf (GtkWidget *widget, GKeyFile *cfgdat); void gtk_event_list_reload_sats (GtkWidget *satlist, GHashTable *sats); +void gtk_event_list_select_sat (GtkWidget *widget, gint catnum); - #ifdef __cplusplus } #endif /* __cplusplus */ Modified: trunk/src/gtk-polar-view.c =================================================================== --- trunk/src/gtk-polar-view.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-polar-view.c 2011-05-01 11:12:02 UTC (rev 818) @@ -1616,7 +1616,54 @@ } +/** \brief Select a satellite (puublic) + * + * \todo Current selection is loast when satellite goes LOS + */ +void gtk_polar_view_select_sat (GtkWidget *widget, gint catnum) +{ + GtkPolarView *polv = GTK_POLAR_VIEW(widget); + gint *catpoint = NULL; + sat_obj_t *obj = NULL; + guint32 color; + catpoint = g_try_new0 (gint, 1); + *catpoint = catnum; + + + obj = SAT_OBJ (g_hash_table_lookup (polv->obj, catpoint)); + if (obj == NULL) { + sat_log_log (SAT_LOG_LEVEL_DEBUG, + _("%s Requested satellite (%d) is not within range"), + __FUNCTION__, catnum); + } + else { + obj->selected = TRUE; + + color = mod_cfg_get_int (polv->cfgdata, + MOD_CFG_POLAR_SECTION, + MOD_CFG_POLAR_SAT_SEL_COL, + SAT_CFG_INT_POLAR_SAT_SEL_COL); + + g_object_set (obj->marker, + "fill-color-rgba", color, + "stroke-color-rgba", color, + NULL); + g_object_set (obj->label, + "fill-color-rgba", color, + "stroke-color-rgba", color, + NULL); + + } + + /* clear previous selection, if any */ + g_hash_table_foreach (polv->obj, clear_selection, catpoint); + + g_free (catpoint); + +} + + /** \brief Convert LOS timestamp to human readable countdown string */ static gchar *los_time_to_str (GtkPolarView *polv, sat_t *sat) { Modified: trunk/src/gtk-polar-view.h =================================================================== --- trunk/src/gtk-polar-view.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-polar-view.h 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -154,8 +154,8 @@ void xy_to_azel (GtkPolarView *p, gfloat x, gfloat y, gfloat *az, gfloat *el); void gtk_polar_view_reload_sats (GtkWidget *polv, GHashTable *sats); +void gtk_polar_view_select_sat (GtkWidget *widget, gint catnum); - #ifdef __cplusplus } #endif /* __cplusplus */ Modified: trunk/src/gtk-sat-list.c =================================================================== --- trunk/src/gtk-sat-list.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-list.c 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -1387,3 +1387,38 @@ { GTK_SAT_LIST (satlist)->satellites = sats; } + +/** \brief Select a satellite */ +void gtk_sat_list_select_sat (GtkWidget *satlist, gint catnum) +{ + GtkSatList *slist; + GtkTreeModel *model; + GtkTreeSelection *selection; + GtkTreeIter iter; + gint i,n; + gint sat; + + + slist = GTK_SAT_LIST(satlist); + model = gtk_tree_view_get_model(GTK_TREE_VIEW(slist->treeview)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(slist->treeview)); + + /* iterate over the satellite list until a amtch is found */ + n = g_hash_table_size(slist->satellites); + for (i = 0; i < n; i++) { + + if (gtk_tree_model_iter_nth_child(model, &iter, NULL, i)) { + gtk_tree_model_get(model, &iter, SAT_LIST_COL_CATNUM, &sat, -1); + if (sat == catnum) { + gtk_tree_selection_select_iter(selection, &iter); + i = n; + } + } + else { + sat_log_log(SAT_LOG_LEVEL_ERROR, + _("%s: GtkSatList has not child with index %d"), + __FUNCTION__, i); + } + } + +} Modified: trunk/src/gtk-sat-list.h =================================================================== --- trunk/src/gtk-sat-list.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-list.h 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -152,6 +152,7 @@ void gtk_sat_list_reconf (GtkWidget *widget, GKeyFile *cfgdat); void gtk_sat_list_reload_sats (GtkWidget *satlist, GHashTable *sats); +void gtk_sat_list_select_sat (GtkWidget *satlist, gint catnum); #ifdef __cplusplus Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-map.c 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Copyright (C) 2006-2007 William J Beksi, KC2EXL. Copyright (C) 2011 Charles Suprin, AA1VS. @@ -1066,6 +1066,57 @@ } +/** \brief select a satellite */ +void gtk_sat_map_select_sat (GtkWidget *satmap, gint catnum) +{ + GtkSatMap *smap = GTK_SAT_MAP(satmap); + gint *catpoint = NULL; + sat_map_obj_t *obj = NULL; + guint32 col; + + + catpoint = g_try_new0 (gint, 1); + *catpoint = catnum; + + obj = SAT_MAP_OBJ (g_hash_table_lookup (smap->obj, catpoint)); + if (obj == NULL) { + sat_log_log (SAT_LOG_LEVEL_BUG, + _("%s: Can not find clicked object (%d) in hash table"), + __FUNCTION__, catnum); + } + else { + obj->selected = TRUE; + + col = mod_cfg_get_int (smap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_SEL_COL, + SAT_CFG_INT_MAP_SAT_SEL_COL); + + g_object_set (obj->marker, + "fill-color-rgba", col, + "stroke-color-rgba", col, + NULL); + g_object_set (obj->label, + "fill-color-rgba", col, + "stroke-color-rgba", col, + NULL); + g_object_set (obj->range1, + "stroke-color-rgba", col, + NULL); + + if (obj->oldrcnum == 2) + g_object_set (obj->range2, + "stroke-color-rgba", col, + NULL); + + /* clear other selections */ + g_hash_table_foreach (smap->obj, clear_selection, catpoint); + } + + g_free (catpoint); + +} + /** \brief Reconfigure map. * * This function should eventually reload all configuration for the GtkSatMap. Modified: trunk/src/gtk-sat-map.h =================================================================== --- trunk/src/gtk-sat-map.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-map.h 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Copyright (C) 2006-2007 William J Beksi, KC2EXL. Authors: Alexandru Csete <oz...@gm...> @@ -182,6 +182,7 @@ gdouble *x, gdouble *y); void gtk_sat_map_reload_sats (GtkWidget *satmap, GHashTable *sats); +void gtk_sat_map_select_sat (GtkWidget *satmap, gint catnum); #ifdef __cplusplus } Modified: trunk/src/gtk-sat-module-popup.c =================================================================== --- trunk/src/gtk-sat-module-popup.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-module-popup.c 2011-05-01 11:12:02 UTC (rev 818) @@ -53,6 +53,7 @@ static void clone_cb (GtkWidget *menuitem, gpointer data); static void docking_state_cb (GtkWidget *menuitem, gpointer data); static void screen_state_cb (GtkWidget *menuitem, gpointer data); +static void sat_selected_cb (GtkWidget *menuitem, gpointer data); static void sky_at_glance_cb (GtkWidget *menuitem, gpointer data); static void tmgr_cb (GtkWidget *menuitem, gpointer data); static void rigctrl_cb (GtkWidget *menuitem, gpointer data); @@ -78,10 +79,16 @@ */ void gtk_sat_module_popup (GtkSatModule *module) { - GtkWidget *menu; - GtkWidget *menuitem; - GtkWidget *image; - gchar *buff; + GtkWidget *menu; /* The pop-up menu */ + GtkWidget *satsubmenu; /* Satellite selection submenu */ + GtkWidget *menuitem; /* Widget used to create the menu items */ + GtkWidget *image; /* Widget used to create menu item icons */ + + /* misc variables */ + GList *sats; + sat_t *sat; + gchar *buff; + guint i,n; @@ -143,6 +150,27 @@ menuitem = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL(menu), menuitem); + /* select satellite submenu */ + menuitem = gtk_menu_item_new_with_label(_("Select satellite")); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + + satsubmenu = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), satsubmenu); + + sats = g_hash_table_get_values(module->satellites); // FIXME: sort list + n = g_list_length(sats); + for (i = 0; i < n; i++) { + sat = SAT(g_list_nth_data(sats, i)); + menuitem = gtk_menu_item_new_with_label(sat->nickname); + g_object_set_data(G_OBJECT(menuitem), "catnum", GINT_TO_POINTER(sat->tle.catnr)); + g_signal_connect(menuitem, "activate", G_CALLBACK (sat_selected_cb), module); + gtk_menu_shell_append(GTK_MENU_SHELL(satsubmenu), menuitem); + } + + /* separator */ + menuitem = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL(menu), menuitem); + /* sky at a glance */ menuitem = gtk_image_menu_item_new_with_label (_("Sky at a glance")); buff = icon_file_name ("gpredict-planner-small.png"); @@ -747,6 +775,23 @@ } +/** \brief New satellite selected. + * \param data Pointer to the GtkSatModule widget + * + * This menu item is activated when a new satellite is selected in the + * "Select satellite" submenu of the module pop-up. This will trigger a call + * to the select_sat() fuinction of the module, which in turn will call the + * select_sat() function of each child view. + * + * The catalog number of the selected satellite is attached to the menu item + */ +static void sat_selected_cb (GtkWidget *menuitem, gpointer data) +{ + gint catnum = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), "catnum")); + GtkSatModule *module = GTK_SAT_MODULE(data); + + gtk_sat_module_select_sat(module, catnum); +} /** \brief Invoke Sky-at-glance. * Modified: trunk/src/gtk-sat-module.c =================================================================== --- trunk/src/gtk-sat-module.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-module.c 2011-05-01 11:12:02 UTC (rev 818) @@ -1460,6 +1460,42 @@ } +/** \brief Select a new satellite */ +void gtk_sat_module_select_sat (GtkSatModule *module, gint catnum) +{ + GtkWidget *child; + gint i; + + + /* select satellite in each child */ + for (i = 0; i < module->nviews; i++) { + + child = GTK_WIDGET (g_slist_nth_data (module->views, i)); + + if (IS_GTK_SINGLE_SAT (G_OBJECT (child))) { + gtk_single_sat_select_sat(child, catnum); + } + else if (IS_GTK_SAT_MAP (child)) { + gtk_sat_map_select_sat(child, catnum); + } + else if (IS_GTK_SAT_LIST (child)) { + gtk_sat_list_select_sat(child, catnum); + } + else if (IS_GTK_EVENT_LIST (child)) { + gtk_event_list_select_sat(child, catnum); + } + else if (IS_GTK_POLAR_VIEW (child)) { + gtk_polar_view_select_sat(child, catnum); + } + else { + sat_log_log(SAT_LOG_LEVEL_BUG, _("%s: Unknown child type"), __FUNCTION__); + } + } + +} + + + /** \brief Re-configure module. * \param module The module. * \param local Flag indicating whether reconfiguration is requested from Modified: trunk/src/gtk-sat-module.h =================================================================== --- trunk/src/gtk-sat-module.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-sat-module.h 2011-05-01 11:12:02 UTC (rev 818) @@ -174,6 +174,7 @@ void gtk_sat_module_reload_sats (GtkSatModule *module); void gtk_sat_module_reconf (GtkSatModule *module, gboolean local); +void gtk_sat_module_select_sat (GtkSatModule *module, gint catnum); void gtk_sat_module_fix_size (GtkWidget *module); Modified: trunk/src/gtk-single-sat.c =================================================================== --- trunk/src/gtk-single-sat.c 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-single-sat.c 2011-05-01 11:12:02 UTC (rev 818) @@ -325,11 +325,48 @@ } +/** \brief Select new satellite */ +void gtk_single_sat_select_sat (GtkWidget *single_sat, gint catnum) +{ + GtkSingleSat *ssat = GTK_SINGLE_SAT(single_sat); + sat_t *sat = NULL; + gchar *title; + gboolean foundsat = FALSE; + gint i,n; + + /* find satellite with catnum */ + n = g_slist_length (ssat->sats); + for (i = 0; i < n; i++) { + sat = SAT(g_slist_nth_data(ssat->sats, i)); + if (sat->tle.catnr == catnum) { + /* found satellite */ + ssat->selected = i; + foundsat = TRUE; + /* exit loop */ + i = n; + } + } + + if (!foundsat) { + sat_log_log(SAT_LOG_LEVEL_ERROR, + _("%s: Could not find satellite with catalog number %d"), + __FUNCTION__, catnum); + return; + } + + title = g_strdup_printf ("<b>%s</b>", sat->nickname); + gtk_label_set_markup (GTK_LABEL (ssat->header), title); + g_free (title); + +} + + + /** \brief Update satellites */ void gtk_single_sat_update (GtkWidget *widget) Modified: trunk/src/gtk-single-sat.h =================================================================== --- trunk/src/gtk-single-sat.h 2011-04-29 18:28:15 UTC (rev 817) +++ trunk/src/gtk-single-sat.h 2011-05-01 11:12:02 UTC (rev 818) @@ -2,7 +2,7 @@ /* Gpredict: Real-time satellite tracking and orbit prediction program - Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC. + Copyright (C) 2001-2011 Alexandru Csete, OZ9AEC. Authors: Alexandru Csete <oz...@gm...> @@ -166,8 +166,8 @@ void gtk_single_sat_reload_sats (GtkWidget *single_sat, GHashTable *sats); +void gtk_single_sat_select_sat (GtkWidget *single_sat, gint catnum); - #ifdef __cplusplus } #endif /* __cplusplus */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2011-04-29 18:28:22
|
Revision: 817 http://gpredict.svn.sourceforge.net/gpredict/?rev=817&view=rev Author: csete Date: 2011-04-29 18:28:15 +0000 (Fri, 29 Apr 2011) Log Message: ----------- Fixed bug 3294829: Program name wrong in desktop files. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/data/desktop/gpredict.desktop.in Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-04-21 11:23:02 UTC (rev 816) +++ trunk/ChangeLog 2011-04-29 18:28:15 UTC (rev 817) @@ -1,3 +1,9 @@ +2011-04-29 Alexandru Csete <oz9aec at gmail.com> + + * data/desktop/gpredict.desktop.in + Fixed bug 3294829: Program name wrong in desktop files. + + 2011-04-03 Alexandru Csete <oz9aec at gmail.com> * src/gtk-rot-knob.c Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-04-21 11:23:02 UTC (rev 816) +++ trunk/NEWS 2011-04-29 18:28:15 UTC (rev 817) @@ -4,7 +4,8 @@ - Feature request 2130926: Change frequency using mouse wheel. Also for rotator controller. - Applied and extended patch 3237220: natural sort for sat list in module config - Improve handling of decayed satellites. -- Fixed bug 3250344: Win32 uild not working with hamlib +- Fixed bug 3250344: Win32 uild not working with hamlib. +- Fixed bug 3294829: Program name wrong in desktop files. Changes in version 1.3 (1 Mar 2011) Modified: trunk/data/desktop/gpredict.desktop.in =================================================================== --- trunk/data/desktop/gpredict.desktop.in 2011-04-21 11:23:02 UTC (rev 816) +++ trunk/data/desktop/gpredict.desktop.in 2011-04-29 18:28:15 UTC (rev 817) @@ -1,5 +1,5 @@ [Desktop Entry] -Name=Gredict +Name=Gpredict Comment=Satellite tracker Exec=gpredict Icon=gpredict-icon This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aa...@us...> - 2011-04-21 11:23:09
|
Revision: 816 http://gpredict.svn.sourceforge.net/gpredict/?rev=816&view=rev Author: aa1vs Date: 2011-04-21 11:23:02 +0000 (Thu, 21 Apr 2011) Log Message: ----------- Begin adding range circle of ground station for selected satellite. Restructure satellite object so it can also support ground object. Modified Paths: -------------- branches/ground_ring/src/gtk-sat-map.c branches/ground_ring/src/gtk-sat-map.h Added Paths: ----------- branches/ground_ring/ Modified: branches/ground_ring/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2011-04-03 16:04:20 UTC (rev 813) +++ branches/ground_ring/src/gtk-sat-map.c 2011-04-21 11:23:02 UTC (rev 816) @@ -71,7 +71,11 @@ static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data); static void update_map_size (GtkSatMap *satmap); static void update_sat (gpointer key, gpointer value, gpointer data); +static void update_obj (sat_map_obj_t *obj, GtkSatMap *satmap, guint32 col, guint32 covcol, gfloat lon, gfloat lat,gchar * tooltip, gdouble footprint); static void plot_sat (gpointer key, gpointer value, gpointer data); +static void plot_qth (gpointer key, gpointer value, gpointer data); +static sat_map_obj_t* +plot_obj (gpointer key, gpointer value, gpointer data, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint); static void lonlat_to_xy (GtkSatMap *m, gdouble lon, gdouble lat, gfloat *x, gfloat *y); static void xy_to_lonlat (GtkSatMap *m, gfloat x, gfloat y, gfloat *lon, gfloat *lat); static gboolean on_motion_notify (GooCanvasItem *item, @@ -95,12 +99,12 @@ static void load_map_file (GtkSatMap *satmap); static GooCanvasItemModel* create_canvas_model (GtkSatMap *satmap); static gdouble arccos (gdouble, gdouble); -static gboolean pole_is_covered (sat_t *sat); -static gboolean mirror_lon (sat_t *sat, gdouble rangelon, gdouble *mlon); -static guint calculate_footprint (GtkSatMap *satmap, sat_t *sat); -static void split_points (GtkSatMap *satmap, sat_t *sat, gdouble sspx); -static void sort_points_x (GtkSatMap *satmap, sat_t *sat, GooCanvasPoints *points, gint num); -static void sort_points_y (GtkSatMap *satmap, sat_t *sat, GooCanvasPoints *points, gint num); +static gboolean pole_is_covered (gdouble lon, gdouble lat, gdouble footprint); +static gboolean mirror_lon (gdouble lon, gdouble rangelon, gdouble *mlon); +static guint calculate_footprint (GtkSatMap *satmap, gdouble lon, gdouble lat, gdouble footprint); +static void split_points (GtkSatMap *satmap, gdouble sspx, gdouble lon, gdouble lat); +static void sort_points_x (GtkSatMap *satmap, GooCanvasPoints *points, gint num, gdouble lat); +static void sort_points_y (GtkSatMap *satmap, GooCanvasPoints *points, gint num); static gint compare_coordinates_x (gconstpointer a, gconstpointer b, gpointer data); static gint compare_coordinates_y (gconstpointer a, gconstpointer b, gpointer data); static void update_selected (GtkSatMap *satmap, sat_t *sat); @@ -185,6 +189,7 @@ satmap->showgrid = FALSE; satmap->keepratio = FALSE; satmap->resize = FALSE; + satmap->selected = NULL; } @@ -985,6 +990,7 @@ MOD_CFG_MAP_SECTION, MOD_CFG_MAP_SAT_SEL_COL, SAT_CFG_INT_MAP_SAT_SEL_COL); + satmap->selected = g_hash_table_lookup (satmap->sats, catpoint); } else { col = mod_cfg_get_int (satmap->cfgdata, @@ -992,7 +998,7 @@ MOD_CFG_MAP_SAT_COL, SAT_CFG_INT_MAP_SAT_COL); *catpoint = 0; - + satmap->selected = NULL; g_object_set (satmap->sel, "text", "", NULL); } @@ -1184,15 +1190,15 @@ /** \brief Check whether the footprint covers the North or South pole. */ static gboolean -pole_is_covered (sat_t *sat) +pole_is_covered (gdouble lon, gdouble lat, gdouble footprint) { int ret1,ret2; gdouble qrb1, qrb2, az1, az2; - ret1 = qrb (sat->ssplon, sat->ssplat, 0.0, 90.0, &qrb1, &az1); - ret2 = qrb (sat->ssplon, sat->ssplat, 0.0, -90.0, &qrb2, &az2); + ret1 = qrb (lon, lat, 0.0, 90.0, &qrb1, &az1); + ret2 = qrb (lon, lat, 0.0, -90.0, &qrb2, &az2); - if ((qrb1 <= 0.5*sat->footprint) || (qrb2 <= 0.5*sat->footprint)) + if ((qrb1 <= 0.5*footprint) || (qrb2 <= 0.5*footprint)) return TRUE; return FALSE; @@ -1201,27 +1207,27 @@ /** \brief Mirror the footprint longitude. */ static gboolean -mirror_lon (sat_t *sat, gdouble rangelon, gdouble *mlon) +mirror_lon (gdouble lon, gdouble rangelon, gdouble *mlon) { gdouble diff; gboolean warped = FALSE; - if (sat->ssplon < 0.0) { + if (lon < 0.0) { /* western longitude */ if (rangelon < 0.0) { /* rangelon has not been warped over */ - *mlon = sat->ssplon + fabs (rangelon - sat->ssplon); + *mlon = lon + fabs (rangelon - lon); } else { /* rangelon has been warped over */ - diff = 360.0 + sat->ssplon - rangelon; - *mlon = sat->ssplon + diff; + diff = 360.0 + lon - rangelon; + *mlon = lon + diff; warped = TRUE; } } else { /* eastern longitude */ - *mlon = sat->ssplon + fabs (rangelon - sat->ssplon); + *mlon = lon + fabs (rangelon - lon); if (*mlon > 180.0) { *mlon -= 360; @@ -1266,7 +1272,7 @@ * extra points. */ static guint -calculate_footprint (GtkSatMap *satmap, sat_t *sat) +calculate_footprint (GtkSatMap *satmap, gdouble lon, gdouble lat, gdouble footprint) { guint azi; gfloat sx, sy, msx, msy, ssx, ssy; @@ -1280,9 +1286,9 @@ * who borrowed from John Magliacane, KD2BD. * Optimized by Alexandru Csete and William J Beksi. */ - ssplat = sat->ssplat * de2ra; - ssplon = sat->ssplon * de2ra; - beta = (0.5 * sat->footprint) / xkmper; + ssplat = lat * de2ra; + ssplon = lon * de2ra; + beta = (0.5 * footprint) / xkmper; for (azi = 0; azi < 180; azi++) { azimuth = de2ra * (double)azi; @@ -1317,7 +1323,7 @@ rangelon = rangelon / de2ra; /* mirror longitude */ - if (mirror_lon (sat, rangelon, &mlon)) + if (mirror_lon (lon, rangelon, &mlon)) warped = TRUE; lonlat_to_xy (satmap, rangelon, rangelat, &sx, &sy); @@ -1336,9 +1342,9 @@ */ /* pole is covered => sort points1 and add additional points */ - if (pole_is_covered (sat)) { + if (pole_is_covered (lon, lat, footprint)) { - sort_points_x (satmap, sat, points1, 360); + sort_points_x (satmap, points1, 360, lat); numrc = 1; } @@ -1347,8 +1353,8 @@ => split points */ else if (warped == TRUE) { - lonlat_to_xy (satmap, sat->ssplon, sat->ssplat, &ssx, &ssy); - split_points (satmap, sat, ssx); + lonlat_to_xy (satmap, lon, lat, &ssx, &ssy); + split_points (satmap, ssx, lon, lat); numrc = 2; } @@ -1377,7 +1383,7 @@ * (the end result may freeze the X-server requiring a hard-reset!) */ static void -split_points (GtkSatMap *satmap, sat_t *sat, gdouble sspx) +split_points (GtkSatMap *satmap, gdouble sspx, gdouble lon, gdouble lat) { GooCanvasPoints *tps1,*tps2; gint n,n1,n2,ns,i,j,k; @@ -1393,12 +1399,8 @@ tps1 = goo_canvas_points_new (n); tps2 = goo_canvas_points_new (n); - //if ((sspx >= (satmap->x0 + satmap->width - 0.6)) || - // (sspx >= (satmap->x0 - 0.6))) { - //if ((sspx == (satmap->x0 + satmap->width)) || - // (sspx == (satmap->x0))) { - if ((sat->ssplon >= 179.4) || (sat->ssplon <= -179.4)) { - /* sslon = +/-180 deg. + if ((lon >= 179.4) || (lon <= -179.4)) { + /* lon = +/-180 deg. - copy points with (x > satmap->x0+satmap->width/2) to tps1 - copy points with (x < satmap->x0+satmap->width/2) to tps2 - sort tps1 and tps2 @@ -1417,8 +1419,8 @@ } } - sort_points_y (satmap, sat, tps1, n1); - sort_points_y (satmap, sat, tps2, n2); + sort_points_y (satmap, tps1, n1); + sort_points_y (satmap, tps2, n2); } else if (sspx < (satmap->x0 + satmap->width / 2)) { @@ -1559,7 +1561,7 @@ * */ static void -sort_points_x (GtkSatMap *satmap, sat_t *sat, GooCanvasPoints *points, gint num) +sort_points_x (GtkSatMap *satmap, GooCanvasPoints *points, gint num, gdouble lat) { gsize size = 2*sizeof(double); @@ -1576,7 +1578,7 @@ points->coords[716] = satmap->x0+satmap->width;//points->coords[718]; points->coords[717] = points->coords[719]; - if (sat->ssplat > 0.0) { + if (lat > 0.0) { /* insert (x0-1,y0) into position 0 */ points->coords[0] = satmap->x0; points->coords[1] = satmap->y0; @@ -1609,7 +1611,7 @@ * */ static void -sort_points_y (GtkSatMap *satmap, sat_t *sat, GooCanvasPoints *points, gint num) +sort_points_y (GtkSatMap *satmap, GooCanvasPoints *points, gint num) { gsize size; @@ -1708,7 +1710,6 @@ GooCanvasItemModel *root; gint *catnum; guint32 col,covcol,shadowcol; - gfloat x,y; gchar *tooltip; if (decayed(sat)) { @@ -1718,23 +1719,6 @@ catnum = g_new0 (gint, 1); *catnum = sat->tle.catnr; - lonlat_to_xy (satmap, sat->ssplon, sat->ssplat, &x, &y); - - /* create and initialize a sat object */ - obj = g_try_new (sat_map_obj_t, 1); - - obj->selected = FALSE; - obj->showtrack = FALSE; - obj->showcov = TRUE; - obj->istarget = FALSE; - obj->oldrcnum = 0; - obj->newrcnum = 0; - obj->track_data.latlon = NULL; - obj->track_data.lines = NULL; - obj->track_orbit = 0; - - root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); - /* satellite color */ col = mod_cfg_get_int (satmap->cfgdata, MOD_CFG_MAP_SECTION, @@ -1752,7 +1736,6 @@ MOD_CFG_MAP_SECTION, MOD_CFG_MAP_SHADOW_ALPHA, SAT_CFG_INT_MAP_SHADOW_ALPHA); - /* create tooltip */ tooltip = g_strdup_printf("<big><b>%s</b>\n</big>"\ "<tt>Lon: %5.1f\302\260\n" \ @@ -1764,6 +1747,49 @@ sat->az, sat->el); + + + root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); + + + obj = plot_obj(key,value,data, col, covcol, shadowcol, sat->ssplon,sat->ssplat,tooltip,sat->nickname, sat->footprint); + g_object_set_data (G_OBJECT (obj->marker), "catnum", GINT_TO_POINTER (*catnum)); + g_object_set_data (G_OBJECT (obj->label), "catnum", GINT_TO_POINTER (*catnum)); + g_object_set_data (G_OBJECT (obj->range1), "catnum", GINT_TO_POINTER (*catnum)); + if (obj->newrcnum == 2) + g_object_set_data (G_OBJECT (obj->range2), "catnum", GINT_TO_POINTER (*catnum)); + + /* add sat to hash table */ + g_hash_table_insert (satmap->obj, catnum, obj); +} + +static sat_map_obj_t* +plot_obj (gpointer key, gpointer value, gpointer data, guint32 col, guint32 covcol, guint32 shadowcol, gfloat lon, gfloat lat,gchar * tooltip, gchar *label, gdouble footprint) +{ + GtkSatMap *satmap = GTK_SAT_MAP (data); + sat_map_obj_t *obj = NULL; + GooCanvasItemModel *root; + gfloat x,y; + + lonlat_to_xy (satmap, lon, lat, &x, &y); + + + /* create and initialize a sat object */ + + obj = g_try_new (sat_map_obj_t, 1); + + obj->selected = FALSE; + obj->showtrack = FALSE; + obj->showcov = TRUE; + obj->istarget = FALSE; + obj->oldrcnum = 0; + obj->newrcnum = 0; + obj->track_data.latlon = NULL; + obj->track_data.lines = NULL; + obj->track_orbit = 0; + + root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); + /* create satellite marker and label + shadows. We create shadows first */ obj->shadowm = goo_canvas_rect_model_new (root, x - MARKER_SIZE_HALF + 1, @@ -1783,7 +1809,7 @@ "tooltip", tooltip, NULL); - obj->shadowl = goo_canvas_text_model_new (root, sat->nickname, + obj->shadowl = goo_canvas_text_model_new (root, label, x+1, y+3, -1, @@ -1791,7 +1817,7 @@ "font", "Sans 8", "fill-color-rgba", shadowcol, NULL); - obj->label = goo_canvas_text_model_new (root, sat->nickname, + obj->label = goo_canvas_text_model_new (root, label, x, y+2, -1, @@ -1801,17 +1827,12 @@ "tooltip", tooltip, NULL); - g_free (tooltip); - - g_object_set_data (G_OBJECT (obj->marker), "catnum", GINT_TO_POINTER (*catnum)); - g_object_set_data (G_OBJECT (obj->label), "catnum", GINT_TO_POINTER (*catnum)); - /* initialize points for footprint */ points1 = goo_canvas_points_new (360); points2 = goo_canvas_points_new (360); /* calculate footprint */ - obj->newrcnum = calculate_footprint (satmap, sat); + obj->newrcnum = calculate_footprint (satmap, lon, lat, footprint); obj->oldrcnum = obj->newrcnum; /* invisible footprint for decayed sats (STS fix) */ @@ -1828,7 +1849,6 @@ "line-cap", CAIRO_LINE_CAP_SQUARE, "line-join", CAIRO_LINE_JOIN_MITER, NULL); - g_object_set_data (G_OBJECT (obj->range1), "catnum", GINT_TO_POINTER (*catnum)); /* create second part if available */ if (obj->newrcnum == 2) { @@ -1842,15 +1862,12 @@ "line-cap", CAIRO_LINE_CAP_SQUARE, "line-join", CAIRO_LINE_JOIN_MITER, NULL); - g_object_set_data (G_OBJECT (obj->range2), "catnum", GINT_TO_POINTER (*catnum)); } goo_canvas_points_unref (points1); goo_canvas_points_unref (points2); - - /* add sat to hash table */ - g_hash_table_insert (satmap->obj, catnum, obj); + return obj; } @@ -1863,8 +1880,6 @@ GtkSatMap *satmap = GTK_SAT_MAP (data); sat_map_obj_t *obj = NULL; sat_t *sat = SAT(value); - gfloat x, y; - gdouble oldx, oldy; gdouble now; // = get_current_daynum (); GooCanvasItemModel *root; gint idx; @@ -1928,14 +1943,10 @@ /* update satmap->sel */ update_selected (satmap, sat); } - - //sat_debugger_get_ssp (&ssplo,&sspla); - //sat->ssplon = ssplo; - //sat->ssplat = sspla; - + /* we update tooltips every time */ aosstr = aoslos_time_to_str(satmap, sat); - tooltip = g_strdup_printf("<big><b>%s</b>\n</big>"\ + tooltip = g_strdup_printf("<big><b>%s</b>\n</big>" \ "<tt>Lon: %5.1f\302\260\n" \ "Lat: %5.1f\302\260\n" \ " Az: %5.1f\302\260\n" \ @@ -1945,13 +1956,67 @@ sat->ssplon, sat->ssplat, sat->az, sat->el, aosstr); - g_object_set (obj->marker, "tooltip", tooltip, NULL); - g_object_set (obj->label, "tooltip", tooltip, NULL); + if (obj->selected) { + col = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_SEL_COL, + SAT_CFG_INT_MAP_SAT_SEL_COL); + } + else { + col = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COL, + SAT_CFG_INT_MAP_SAT_COL); + } + /* coverage color */ + if (obj->showcov) { + covcol = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COV_COL, + SAT_CFG_INT_MAP_SAT_COV_COL); + } + else { + covcol = 0x00000000; + } + + /*update satellite position and footprint*/ + update_obj (obj, satmap, col, covcol, sat->ssplon, sat->ssplat, tooltip, sat->footprint); + g_free (tooltip); g_free (aosstr); - lonlat_to_xy (satmap, sat->ssplon, sat->ssplat, &x, &y); + if (obj->newrcnum == 2) { + if (obj->oldrcnum == 1) { + g_object_set_data (G_OBJECT (obj->range2), "catnum", + GINT_TO_POINTER (*catnum)); + } + } + /* if ground track is visible check whether we have passed into a + new orbit, in which case we need to recalculate the ground track + */ + if (obj->showtrack) { + if (obj->track_orbit != sat->orbit) { + ground_track_update (satmap, sat, satmap->qth, obj, TRUE); + } + /* otherwise we may be in a map rescale process */ + else if (satmap->resize) { + ground_track_update (satmap, sat, satmap->qth, obj, FALSE); + } + } + g_free (catnum); +} + +static void +update_obj (sat_map_obj_t *obj, GtkSatMap *satmap, guint32 col, guint32 covcol, gfloat lon, gfloat lat,gchar * tooltip, gdouble footprint) { + gfloat x, y; + gdouble oldx, oldy; + GooCanvasItemModel *root; + gint idx; + + root = goo_canvas_get_root_item_model (GOO_CANVAS (satmap->canvas)); + lonlat_to_xy (satmap, lon, lat, &x, &y); + /* update only if satellite has moved at least 2 * MARKER_SIZE_HALF (no need to drain CPU all the time) */ @@ -2025,7 +2090,7 @@ points2 = goo_canvas_points_new (360); /* calculate footprint */ - obj->newrcnum = calculate_footprint (satmap, sat); + obj->newrcnum = calculate_footprint (satmap, lon, lat, footprint); /* always update first part */ g_object_set (obj->range1, @@ -2035,28 +2100,6 @@ if (obj->newrcnum == 2) { if (obj->oldrcnum == 1) { /* we need to create the second part */ - if (obj->selected) { - col = mod_cfg_get_int (satmap->cfgdata, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_SEL_COL, - SAT_CFG_INT_MAP_SAT_SEL_COL); - } - else { - col = mod_cfg_get_int (satmap->cfgdata, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_COL, - SAT_CFG_INT_MAP_SAT_COL); - } - /* coverage color */ - if (obj->showcov) { - covcol = mod_cfg_get_int (satmap->cfgdata, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_COV_COL, - SAT_CFG_INT_MAP_SAT_COV_COL); - } - else { - covcol = 0x00000000; - } obj->range2 = goo_canvas_polyline_model_new (root, FALSE, 0, "points", points2, "line-width", 1.0, @@ -2065,8 +2108,6 @@ "line-cap", CAIRO_LINE_CAP_SQUARE, "line-join", CAIRO_LINE_JOIN_MITER, NULL); - g_object_set_data (G_OBJECT (obj->range2), "catnum", - GINT_TO_POINTER (*catnum)); } else { /* just update the second part */ @@ -2091,24 +2132,12 @@ goo_canvas_points_unref (points1); goo_canvas_points_unref (points2); } + g_object_set (obj->marker, "tooltip", tooltip, NULL); + g_object_set (obj->label, "tooltip", tooltip, NULL); - /* if ground track is visible check whether we have passed into a - new orbit, in which case we need to recalculate the ground track - */ - if (obj->showtrack) { - if (obj->track_orbit != sat->orbit) { - ground_track_update (satmap, sat, satmap->qth, obj, TRUE); - } - /* otherwise we may be in a map rescale process */ - else if (satmap->resize) { - ground_track_update (satmap, sat, satmap->qth, obj, FALSE); - } - } - g_free (catnum); } - /** \brief Update information about the selected satellite. * \param satmap Pointer to the GtkSatMap widget. * \param sat Pointer to the selected satellite Modified: branches/ground_ring/src/gtk-sat-map.h =================================================================== --- trunk/src/gtk-sat-map.h 2011-04-03 16:04:20 UTC (rev 813) +++ branches/ground_ring/src/gtk-sat-map.h 2011-04-21 11:23:02 UTC (rev 816) @@ -134,6 +134,8 @@ gdouble naos; /*!< Next event time. */ gint ncat; /*!< Next event catnum. */ + sat_t *selected; + gdouble tstamp; /*!< Time stamp for calculations; set by GtkSatModule */ GKeyFile *cfgdata; /*!< Module configuration data. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |