[Gpredict-svn] SF.net SVN: gpredict:[120] trunk/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2008-09-17 18:08:14
|
Revision: 120
http://gpredict.svn.sourceforge.net/gpredict/?rev=120&view=rev
Author: csete
Date: 2008-09-17 18:08:24 +0000 (Wed, 17 Sep 2008)
Log Message:
-----------
Added markers for target, controller and rotator.
Modified Paths:
--------------
trunk/src/gtk-polar-plot.c
trunk/src/gtk-polar-plot.h
Modified: trunk/src/gtk-polar-plot.c
===================================================================
--- trunk/src/gtk-polar-plot.c 2008-09-17 10:59:23 UTC (rev 119)
+++ trunk/src/gtk-polar-plot.c 2008-09-17 18:08:24 UTC (rev 120)
@@ -155,6 +155,7 @@
polview->qthinfo = FALSE;
polview->cursinfo = FALSE;
polview->extratick = FALSE;
+ polview->target = NULL;
}
@@ -270,6 +271,275 @@
}
+
+/** \brief Set target object position
+ * \param plot Pointer to the GtkPolarPlot widget
+ * \param az Azimuth of the target object
+ * \param el Elevation of the target object
+ *
+ * If either az or el are negative the target object will be hidden
+ */
+void gtk_polar_plot_set_target_pos (GtkPolarPlot *plot, gdouble az, gdouble el)
+{
+ GooCanvasItemModel *root;
+ gint idx;
+ gfloat x,y;
+ guint32 col;
+
+
+ if (plot == NULL)
+ return;
+
+
+ root = goo_canvas_get_root_item_model (GOO_CANVAS (plot->canvas));
+
+ if ((az < 0.0) || (el < 0.0)) {
+ if (plot->target != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->target);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->target = NULL;
+ }
+ /* else the target object is not visible; nothing to do */
+ }
+ else {
+ /* we need to either update or create the object */
+ azel_to_xy (plot, az, el, &x, &y);
+
+ if (plot->target != NULL) {
+ /* the target object already exists; move it */
+ g_object_set (plot->target,
+ "x", x - MARKER_SIZE_HALF,
+ "y", y - MARKER_SIZE_HALF,
+ NULL);
+ }
+ else {
+ /* the target object does not exist; create it */
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_SAT_COL);
+ plot->target = 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);
+ }
+ }
+}
+
+
+/** \brief Set controller object position
+ * \param plot Pointer to the GtkPolarPlot widget
+ * \param az Azimuth of the controller object
+ * \param el Elevation of the controller object
+ *
+ * If either az or el are negative the controller object will be hidden
+ */
+void gtk_polar_plot_set_ctrl_pos (GtkPolarPlot *plot, gdouble az, gdouble el)
+{
+ GooCanvasItemModel *root;
+ gint idx;
+ gfloat x,y;
+ guint32 col;
+
+
+ if (plot == NULL)
+ return;
+
+
+ root = goo_canvas_get_root_item_model (GOO_CANVAS (plot->canvas));
+
+ if ((az < 0.0) || (el < 0.0)) {
+ if (plot->ctrl != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->ctrl);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->ctrl = NULL;
+ }
+ /* else the target object is not visible; nothing to do */
+ }
+ else {
+ /* we need to either update or create the object */
+ azel_to_xy (plot, az, el, &x, &y);
+
+ if (plot->ctrl != NULL) {
+ /* the target object already exists; move it */
+ g_object_set (plot->ctrl,
+ "center_x", x,
+ "center_y", y,
+ NULL);
+ }
+ else {
+ /* the target object does not exist; create it */
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_SAT_COL);
+ plot->ctrl = goo_canvas_ellipse_model_new (root,
+ x, y, 7, 7,
+ "fill-color-rgba", 0xFF00000F,
+ "stroke-color-rgba", col,
+ "line-width", 0.8,
+ NULL);
+ }
+ }
+
+}
+
+
+/** \brief Set rotator object position
+ * \param plot Pointer to the GtkPolarPlot widget
+ * \param az Azimuth of the rotator object
+ * \param el Elevation of the rotator object
+ *
+ * If either az or el are negative the controller object will be hidden
+ */
+void gtk_polar_plot_set_rotor_pos (GtkPolarPlot *plot, gdouble az, gdouble el)
+{
+ GooCanvasItemModel *root;
+ GooCanvasPoints *prec;
+ gint idx;
+ gfloat x,y;
+ guint32 col;
+
+
+ if (plot == NULL)
+ return;
+
+
+ root = goo_canvas_get_root_item_model (GOO_CANVAS (plot->canvas));
+
+ if ((az < 0.0) || (el <= 0.0)) {
+ if (plot->rot1 != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->rot1);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->rot1 = NULL;
+ }
+ if (plot->rot2 != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->rot2);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->rot2 = NULL;
+ }
+ if (plot->rot3 != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->rot3);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->rot3 = NULL;
+ }
+ if (plot->rot4 != NULL) {
+ /* the target object is visible; delete it */
+ idx = goo_canvas_item_model_find_child (root, plot->rot4);
+ if (idx != -1) {
+ goo_canvas_item_model_remove_child (root, idx);
+ }
+ plot->rot4 = NULL;
+ }
+ }
+ else {
+ /* we need to either update or create the object */
+ azel_to_xy (plot, az, el, &x, &y);
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_SAT_COL);
+
+
+ if (plot->rot1 != NULL) {
+ /* the target object already exists; move it */
+ prec = goo_canvas_points_new (2);
+ prec->coords[0] = x;
+ prec->coords[1] = y-4;
+ prec->coords[2] = x;
+ prec->coords[3] = y-14;
+ g_object_set (plot->rot1,
+ "points", prec,
+ NULL);
+ goo_canvas_points_unref (prec);
+ }
+ else {
+ /* the target object does not exist; create it */
+ plot->rot1 = goo_canvas_polyline_model_new_line (root,
+ x, y-4, x, y-14,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
+ }
+ if (plot->rot2 != NULL) {
+ /* the target object already exists; move it */
+ prec = goo_canvas_points_new (2);
+ prec->coords[0] = x+4;
+ prec->coords[1] = y;
+ prec->coords[2] = x+14;
+ prec->coords[3] = y;
+ g_object_set (plot->rot2,
+ "points", prec,
+ NULL);
+ goo_canvas_points_unref (prec);
+ }
+ else {
+ /* the target object does not exist; create it */
+ plot->rot2 = goo_canvas_polyline_model_new_line (root,
+ x+4, y, x+14, y,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
+ }
+ if (plot->rot3 != NULL) {
+ /* the target object already exists; move it */
+ prec = goo_canvas_points_new (2);
+ prec->coords[0] = x;
+ prec->coords[1] = y+4;
+ prec->coords[2] = x;
+ prec->coords[3] = y+14;
+ g_object_set (plot->rot3,
+ "points", prec,
+ NULL);
+ goo_canvas_points_unref (prec);
+ }
+ else {
+ /* the target object does not exist; create it */
+ plot->rot3 = goo_canvas_polyline_model_new_line (root,
+ x, y+4, x, y+14,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
+ }
+ if (plot->rot4 != NULL) {
+ /* the target object already exists; move it */
+ prec = goo_canvas_points_new (2);
+ prec->coords[0] = x-4;
+ prec->coords[1] = y;
+ prec->coords[2] = x-14;
+ prec->coords[3] = y;
+ g_object_set (plot->rot4,
+ "points", prec,
+ NULL);
+ goo_canvas_points_unref (prec);
+ }
+ else {
+ /* the target object does not exist; create it */
+ plot->rot4 = goo_canvas_polyline_model_new_line (root,
+ x-4, y, x-14, y,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
+ }
+ }
+
+}
+
+
/** \brief Show/hide time tick
* \param plot Pointer to the GtkPolarPlot widget
* \param show TRUE => show tick. FALSE => don't show
@@ -599,7 +869,9 @@
/* sky track */
if (polv->pass != NULL)
update_track (polv);
+
+
}
}
Modified: trunk/src/gtk-polar-plot.h
===================================================================
--- trunk/src/gtk-polar-plot.h 2008-09-17 10:59:23 UTC (rev 119)
+++ trunk/src/gtk-polar-plot.h 2008-09-17 18:08:24 UTC (rev 120)
@@ -91,6 +91,9 @@
pass_t *pass;
GooCanvasItemModel *track; /*!< Sky track. */
+ GooCanvasItemModel *target; /*!< Target object marker */
+ GooCanvasItemModel *ctrl; /*!< Position marker for the controller */
+ GooCanvasItemModel *rot1,*rot2,*rot3,*rot4; /*!< Position marker for the rotor */
GooCanvasItemModel *trtick[TRACK_TICK_NUM]; /*!< Time ticks along the sky track */
qth_t *qth; /*!< Pointer to current location. */
@@ -121,7 +124,9 @@
GtkWidget* gtk_polar_plot_new (qth_t *qth, pass_t *pass);
void gtk_polar_plot_set_pass (GtkPolarPlot *plot, pass_t *pass);
-
+void gtk_polar_plot_set_target_pos (GtkPolarPlot *plot, gdouble az, gdouble el);
+void gtk_polar_plot_set_ctrl_pos (GtkPolarPlot *plot, gdouble az, gdouble el);
+void gtk_polar_plot_set_rotor_pos (GtkPolarPlot *plot, gdouble az, gdouble el);
void gtk_polar_plot_show_time_ticks (GtkPolarPlot *plot, gboolean show);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|