diff --git a/src/map/draw-layer.c b/src/map/draw-layer.c new file mode 100644 index 0000000..0bd6757 --- /dev/null +++ b/src/map/draw-layer.c @@ -0,0 +1,374 @@ +/* + * Code mainly taken from https://gitlab.gnome.org/GNOME/libshumate/-/blob/main/shumate/shumate-path-layer.c + * This is a copy of the shumate-path-layer adjusted for the needs of PicPlanner + */ + +#include "draw-layer.h" + +#include "shumate/shumate-enum-types.h" + +#include +#include +#include +#include + +enum +{ + PROP_STROKE_WIDTH, + PROP_STROKE_COLOR, + PROP_STROKE, + N_PROPERTIES +}; + +static GdkRGBA DEFAULT_STROKE_COLOR = { 0.64, 0.0, 0.0, 1.0 }; + +typedef struct +{ + GdkRGBA *stroke_color; + gboolean stroke; + double stroke_width; + + GList *nodes; +} PicplannerDrawLayerPrivate; + +G_DEFINE_TYPE_WITH_PRIVATE (PicplannerDrawLayer, picplanner_draw_layer, SHUMATE_TYPE_LAYER); + +static void +on_view_longitude_changed (PicplannerDrawLayer *self, + GParamSpec *pspec, + ShumateViewport *view) +{ + (void) pspec; + (void) view; + g_assert (PICPLANNER_IS_DRAW_LAYER (self)); + + gtk_widget_queue_draw (GTK_WIDGET (self)); +} + +static void +on_view_latitude_changed (PicplannerDrawLayer *self, + GParamSpec *pspec, + ShumateViewport *view) +{ + (void) pspec; + (void) view; + g_assert (PICPLANNER_IS_DRAW_LAYER (self)); + + gtk_widget_queue_draw (GTK_WIDGET (self)); +} + +static void +on_view_zoom_level_changed (PicplannerDrawLayer *self, + GParamSpec *pspec, + ShumateViewport *view) +{ + (void) pspec; + (void) view; + g_assert (PICPLANNER_IS_DRAW_LAYER (self)); + + gtk_widget_queue_draw (GTK_WIDGET (self)); +} + +static void +on_view_rotation_changed (PicplannerDrawLayer *self, + GParamSpec *pspec, + ShumateViewport *view) +{ + (void) pspec; + (void) view; + g_assert (PICPLANNER_IS_DRAW_LAYER (self)); + + gtk_widget_queue_draw (GTK_WIDGET (self)); +} + + +static void +picplanner_draw_layer_dispose (GObject *object) +{ + PicplannerDrawLayer *self = PICPLANNER_DRAW_LAYER (object); + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (self); + ShumateViewport *viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self)); + + g_signal_handlers_disconnect_by_data (viewport, self); + + if (priv->nodes) + picplanner_draw_layer_remove_all (PICPLANNER_DRAW_LAYER (object)); + + G_OBJECT_CLASS (picplanner_draw_layer_parent_class)->dispose (object); +} + +static void +picplanner_draw_layer_constructed (GObject *object) +{ + PicplannerDrawLayer *self = PICPLANNER_DRAW_LAYER (object); + ShumateViewport *viewport; + + G_OBJECT_CLASS (picplanner_draw_layer_parent_class)->constructed (object); + + viewport = shumate_layer_get_viewport (SHUMATE_LAYER (self)); + g_signal_connect_swapped (viewport, "notify::longitude", G_CALLBACK (on_view_longitude_changed), self); + g_signal_connect_swapped (viewport, "notify::latitude", G_CALLBACK (on_view_latitude_changed), self); + g_signal_connect_swapped (viewport, "notify::zoom-level", G_CALLBACK (on_view_zoom_level_changed), self); + g_signal_connect_swapped (viewport, "notify::rotation", G_CALLBACK (on_view_rotation_changed), self); +} + + +static void +picplanner_draw_layer_finalize (GObject *object) +{ + PicplannerDrawLayer *self = PICPLANNER_DRAW_LAYER (object); + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (self); + + g_clear_pointer (&priv->stroke_color, gdk_rgba_free); + + G_OBJECT_CLASS (picplanner_draw_layer_parent_class)->finalize (object); +} + +static void +picplanner_draw_layer_snapshot (GtkWidget *widget, + GtkSnapshot *snapshot) +{ + PicplannerDrawLayer *self = (PicplannerDrawLayer *)widget; + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (self); + int width, height; + cairo_t *cr; + GList *elem; + + width = gtk_widget_get_allocated_width (widget); + height = gtk_widget_get_allocated_height (widget); + + if (!gtk_widget_get_visible (widget) || width <= 0 || height <= 0) + return; + + cr = gtk_snapshot_append_cairo (snapshot, &GRAPHENE_RECT_INIT(0, 0, width, height)); + + cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL); + + for (elem = priv->nodes; elem != NULL; elem = elem->next) + { + double *location = elem->data; + double x, y; + + x = location[0]; + y = location[1]; + + cairo_line_to (cr, x, y); + } + + if (priv->stroke) + { + /* width of the backgroud-colored part of the stroke, + * will be reduced by the outline, when that is set (non-zero) + */ + + gdk_cairo_set_source_rgba (cr, priv->stroke_color); + cairo_set_line_width (cr, priv->stroke_width); + cairo_stroke (cr); + } + + cairo_destroy (cr); +} + + +static void +picplanner_draw_layer_class_init (PicplannerDrawLayerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->finalize = picplanner_draw_layer_finalize; + object_class->dispose = picplanner_draw_layer_dispose; + object_class->constructed = picplanner_draw_layer_constructed; + + widget_class->snapshot = picplanner_draw_layer_snapshot; +} + +static void +picplanner_draw_layer_init (PicplannerDrawLayer *self) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (self); + + priv->stroke = TRUE; + priv->stroke_width = 2.0; + priv->nodes = NULL; + + priv->stroke_color = gdk_rgba_copy (&DEFAULT_STROKE_COLOR); +} + + +PicplannerDrawLayer * +picplanner_draw_layer_new (ShumateViewport *viewport) +{ + return g_object_new (PICPLANNER_TYPE_DRAW_LAYER, + "viewport", viewport, + NULL); +} + +static void +position_notify (ShumateLocation *location, + GParamSpec *pspec, + PicplannerDrawLayer *layer) +{ + (void) location; + (void) pspec; + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + +static void +add_node (PicplannerDrawLayer *layer, + double *location, + gboolean prepend, + guint position) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + if (prepend) + priv->nodes = g_list_prepend (priv->nodes, location); + else + priv->nodes = g_list_insert (priv->nodes, location, position); + + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +void +picplanner_draw_layer_add_node (PicplannerDrawLayer *layer, + double *location) +{ + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + add_node (layer, location, TRUE, 0); +} + + +void +picplanner_draw_layer_remove_all (PicplannerDrawLayer *layer) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + g_clear_pointer (&priv->nodes, g_list_free); + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +GList * +picplanner_draw_layer_get_nodes (PicplannerDrawLayer *layer) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + GList *lst; + + g_return_val_if_fail (PICPLANNER_IS_DRAW_LAYER (layer), NULL); + + lst = g_list_copy (priv->nodes); + return g_list_reverse (lst); +} + + +void +picplanner_draw_layer_remove_node (PicplannerDrawLayer *layer, + double *location) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + g_signal_handlers_disconnect_by_func (G_OBJECT (location), G_CALLBACK (position_notify), layer); + + priv->nodes = g_list_remove (priv->nodes, location); + g_object_unref (location); + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +void +picplanner_draw_layer_insert_node (PicplannerDrawLayer *layer, + double *location, + guint position) +{ + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + add_node (layer, location, FALSE, position); +} + + +void +picplanner_draw_layer_set_stroke_color (PicplannerDrawLayer *layer, + const GdkRGBA *color) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + if (priv->stroke_color != NULL) + gdk_rgba_free (priv->stroke_color); + + if (color == NULL) + color = &DEFAULT_STROKE_COLOR; + + priv->stroke_color = gdk_rgba_copy (color); + + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +GdkRGBA * +picplanner_draw_layer_get_stroke_color (PicplannerDrawLayer *layer) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_val_if_fail (PICPLANNER_IS_DRAW_LAYER (layer), NULL); + + return priv->stroke_color; +} + + +void +picplanner_draw_layer_set_stroke (PicplannerDrawLayer *layer, + gboolean value) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + priv->stroke = value; + + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +gboolean +picplanner_draw_layer_get_stroke (PicplannerDrawLayer *layer) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_val_if_fail (PICPLANNER_IS_DRAW_LAYER (layer), FALSE); + + return priv->stroke; +} + + +void +picplanner_draw_layer_set_stroke_width (PicplannerDrawLayer *layer, + double value) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_if_fail (PICPLANNER_IS_DRAW_LAYER (layer)); + + priv->stroke_width = value; + + gtk_widget_queue_draw (GTK_WIDGET (layer)); +} + + +double +picplanner_draw_layer_get_stroke_width (PicplannerDrawLayer *layer) +{ + PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (layer); + + g_return_val_if_fail (PICPLANNER_IS_DRAW_LAYER (layer), 0); + + return priv->stroke_width; +} diff --git a/src/map/draw-layer.h b/src/map/draw-layer.h new file mode 100644 index 0000000..1099f2e --- /dev/null +++ b/src/map/draw-layer.h @@ -0,0 +1,51 @@ +/* + * Code mainly taken from https://gitlab.gnome.org/GNOME/libshumate/-/blob/main/shumate/shumate-path-layer.h + * This is a copy of the shumate-path-layer adjusted for the needs of PicPlanner + */ + +#ifndef PICPLANNER_DRAW_LAYER_H +#define PICPLANNER_DRAW_LAYER_H + +#include +#include +#include + +G_BEGIN_DECLS + +#define PICPLANNER_TYPE_DRAW_LAYER picplanner_draw_layer_get_type () +G_DECLARE_DERIVABLE_TYPE (PicplannerDrawLayer, picplanner_draw_layer, PICPLANNER, DRAW_LAYER, ShumateLayer) + +struct _PicplannerDrawLayerClass +{ + ShumateLayerClass parent_class; +}; + +PicplannerDrawLayer *picplanner_draw_layer_new (ShumateViewport *viewport); + +void picplanner_draw_layer_add_node (PicplannerDrawLayer *layer, + double *location); +void picplanner_draw_layer_remove_node (PicplannerDrawLayer *layer, + double *location); +void picplanner_draw_layer_remove_all (PicplannerDrawLayer *layer); +void picplanner_draw_layer_insert_node (PicplannerDrawLayer *layer, + double *location, + guint position); +GList *picplanner_draw_layer_get_nodes (PicplannerDrawLayer *layer); + +GdkRGBA *picplanner_draw_layer_get_stroke_color (PicplannerDrawLayer *layer); +void picplanner_draw_layer_set_stroke_color (PicplannerDrawLayer *layer, + const GdkRGBA *color); + +gboolean picplanner_draw_layer_get_stroke (PicplannerDrawLayer *layer); +void picplanner_draw_layer_set_stroke (PicplannerDrawLayer *layer, + gboolean value); + +double picplanner_draw_layer_get_stroke_width (PicplannerDrawLayer *layer); +void picplanner_draw_layer_set_stroke_width (PicplannerDrawLayer *layer, + double value); + +G_END_DECLS + +#endif + + diff --git a/src/meson.build b/src/meson.build index c2e4261..3f16c57 100644 --- a/src/meson.build +++ b/src/meson.build @@ -12,6 +12,7 @@ picplanner_sources = [ 'calculations/calculations_moon.c', 'calculations/calculations_milky_way.c', 'search/search.c', + 'map/draw-layer.c', ] picplanner_deps = [ diff --git a/src/window/overview-page/overview-view.c b/src/window/overview-page/overview-view.c index 1323db5..eac95fa 100644 --- a/src/window/overview-page/overview-view.c +++ b/src/window/overview-page/overview-view.c @@ -3,6 +3,7 @@ #include "calculations/calculations_sun.h" #include "calculations/calculations_moon.h" #include "calculations/calculations_milky_way.h" +#include "map/draw-layer.h" #define LENGTH_SCALE_FACTOR 0.38 @@ -37,11 +38,13 @@ struct _PicplannerOverview ShumateMarkerLayer *marker_layer_center; ShumateMarker *marker_sun; - ShumateMarker *marker_sun_rise; - ShumateMarker *marker_sun_set; ShumateMarkerLayer *marker_layer_sun; ShumatePathLayer *path_layer_sun; - ShumatePathLayer *path_layer_sun_rise_set; + + PicplannerDrawLayer *path_layer_sun_rise_set; + double *coordinates_sunrise; + double *coordinates_sunset; + double *coordinates_center; ShumateMarker *marker_moon; ShumateMarker *marker_moon_rise; @@ -228,17 +231,15 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview, double x_sun_rise, y_sun_rise; double x_sun_set, y_sun_set; double azimuth_sun, latitude_sun, longitude_sun; - double azimuth_sun_rise, latitude_sun_rise, longitude_sun_rise; - double azimuth_sun_set, latitude_sun_set, longitude_sun_set; + double azimuth_sun_rise; + double azimuth_sun_set; GdkRGBA sun_color = {1., 0.9, 0.0, 0.8}; GdkRGBA sun_rise_set_color = {1., 0.7, 0.0, 0.8}; bool visible_sun = TRUE; GtkWidget *image_sun; - shumate_marker_layer_remove_all (overview->marker_layer_sun); - shumate_path_layer_remove_all (overview->path_layer_sun); - shumate_path_layer_remove_all (overview->path_layer_sun_rise_set); + picplanner_draw_layer_remove_all (overview->path_layer_sun_rise_set); width = gtk_widget_get_allocated_width (GTK_WIDGET (overview->map)); height = gtk_widget_get_allocated_height (GTK_WIDGET (overview->map)); @@ -247,19 +248,19 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview, else min_size = height; + shumate_viewport_location_to_widget_coords (overview->viewport, GTK_WIDGET (overview->map), latitude, longitude, &x, &y); - /* - * Sun marker - */ + + image_sun = gtk_image_new_from_icon_name ("sun"); gtk_image_set_pixel_size (GTK_IMAGE (image_sun), 48); shumate_marker_set_child (overview->marker_sun, image_sun); - /* Calculate virtual positon of the sun on the map */ + azimuth_sun = array_coordinates_sun[NUM_DATA_POINTS]; if (array_coordinates_sun[NUM_DATA_POINTS+1]<0) visible_sun = FALSE; @@ -281,46 +282,35 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview, &latitude_sun, &longitude_sun); - shumate_viewport_widget_coords_to_location (overview->viewport, - GTK_WIDGET (overview->map), - x_sun_rise, - y_sun_rise, - &latitude_sun_rise, - &longitude_sun_rise); - - shumate_viewport_widget_coords_to_location (overview->viewport, - GTK_WIDGET (overview->map), - x_sun_set, - y_sun_set, - &latitude_sun_set, - &longitude_sun_set); shumate_location_set_location (SHUMATE_LOCATION (overview->marker_sun), latitude_sun, longitude_sun); - shumate_location_set_location (SHUMATE_LOCATION (overview->marker_sun_rise), - latitude_sun_rise, - longitude_sun_rise); + overview->coordinates_center[0] = x; + overview->coordinates_center[1] = y; - shumate_location_set_location (SHUMATE_LOCATION (overview->marker_sun_set), - latitude_sun_set, - longitude_sun_set); + overview->coordinates_sunrise[0] = x_sun_rise; + overview->coordinates_sunrise[1] = y_sun_rise; + + overview->coordinates_sunset[0] = x_sun_set; + overview->coordinates_sunset[1] = y_sun_set; + + + picplanner_draw_layer_add_node (overview->path_layer_sun_rise_set, + overview->coordinates_sunrise); + + picplanner_draw_layer_add_node (overview->path_layer_sun_rise_set, + overview->coordinates_center); + picplanner_draw_layer_add_node (overview->path_layer_sun_rise_set, + overview->coordinates_sunset); + picplanner_draw_layer_set_stroke_color (overview->path_layer_sun_rise_set, &sun_rise_set_color); + picplanner_draw_layer_set_stroke_width (overview->path_layer_sun_rise_set, 6.); - /* - * Add markers to the layer - */ - shumate_path_layer_add_node (overview->path_layer_sun_rise_set, - SHUMATE_LOCATION (overview->marker_sun_rise)); - shumate_path_layer_add_node (overview->path_layer_sun_rise_set, - SHUMATE_LOCATION (overview->marker_center)); - shumate_path_layer_add_node (overview->path_layer_sun_rise_set, - SHUMATE_LOCATION (overview->marker_sun_set)); - shumate_path_layer_set_stroke_color (overview->path_layer_sun_rise_set, &sun_rise_set_color); - shumate_path_layer_set_stroke_width (overview->path_layer_sun_rise_set, 6.); if (visible_sun) { + /* shumate_marker_layer_add_marker (overview->marker_layer_sun, overview->marker_sun); shumate_path_layer_add_node (overview->path_layer_sun, @@ -329,123 +319,7 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview, SHUMATE_LOCATION (overview->marker_sun)); shumate_path_layer_set_stroke_color (overview->path_layer_sun, &sun_color); shumate_path_layer_set_stroke_width (overview->path_layer_sun, 6.); - } -} - -void -picplanner_overview_update_map_moon (PicplannerOverview *overview, - double latitude, - double longitude, - double *array_coordinates_moon, - int *rise_upper_set_moon) -{ - int width, height, min_size; - double x = 0, y = 0; - double x_moon, y_moon; - double x_moon_rise, y_moon_rise; - double x_moon_set, y_moon_set; - double azimuth_moon, latitude_moon, longitude_moon; - double azimuth_moon_rise, latitude_moon_rise, longitude_moon_rise; - double azimuth_moon_set, latitude_moon_set, longitude_moon_set; - GdkRGBA moon_color = {0.5, 0.5, 0.5, 0.8}; - GdkRGBA moon_rise_set_color = {0.3, 0.3, 1.0, 0.8}; - - bool visible_moon = TRUE; - GtkWidget *image_moon; - - shumate_marker_layer_remove_all (overview->marker_layer_moon); - shumate_path_layer_remove_all (overview->path_layer_moon); - shumate_path_layer_remove_all (overview->path_layer_moon_rise_set); - - width = gtk_widget_get_allocated_width (GTK_WIDGET (overview->map)); - height = gtk_widget_get_allocated_height (GTK_WIDGET (overview->map)); - if (widthviewport, - GTK_WIDGET (overview->map), - latitude, longitude, - &x, &y); - /* - * Sun marker - */ - image_moon = gtk_image_new_from_icon_name ("weather-clear-night-large"); - gtk_image_set_pixel_size (GTK_IMAGE (image_moon), 48); - shumate_marker_set_child (overview->marker_moon, - image_moon); - - /* Calculate virtual positon of the moon on the map */ - azimuth_moon = array_coordinates_moon[NUM_DATA_POINTS]; - if (array_coordinates_moon[NUM_DATA_POINTS+1]<0) - visible_moon = FALSE; - x_moon = x + sin(calc_deg_to_rad (azimuth_moon)) * min_size * LENGTH_SCALE_FACTOR; - y_moon = y - cos(calc_deg_to_rad (azimuth_moon)) * min_size * LENGTH_SCALE_FACTOR; - - azimuth_moon_rise = array_coordinates_moon[rise_upper_set_moon[0]*2]; - x_moon_rise = x + sin(calc_deg_to_rad (azimuth_moon_rise)) * min_size * LENGTH_SCALE_FACTOR; - y_moon_rise = y - cos(calc_deg_to_rad (azimuth_moon_rise)) * min_size * LENGTH_SCALE_FACTOR; - - azimuth_moon_set = array_coordinates_moon[rise_upper_set_moon[2]*2]; - x_moon_set = x + sin(calc_deg_to_rad (azimuth_moon_set)) * min_size * LENGTH_SCALE_FACTOR; - y_moon_set = y - cos(calc_deg_to_rad (azimuth_moon_set)) * min_size * LENGTH_SCALE_FACTOR; - - shumate_viewport_widget_coords_to_location (overview->viewport, - GTK_WIDGET (overview->map), - x_moon, - y_moon, - &latitude_moon, - &longitude_moon); - - shumate_viewport_widget_coords_to_location (overview->viewport, - GTK_WIDGET (overview->map), - x_moon_rise, - y_moon_rise, - &latitude_moon_rise, - &longitude_moon_rise); - - shumate_viewport_widget_coords_to_location (overview->viewport, - GTK_WIDGET (overview->map), - x_moon_set, - y_moon_set, - &latitude_moon_set, - &longitude_moon_set); - - shumate_location_set_location (SHUMATE_LOCATION (overview->marker_moon), - latitude_moon, - longitude_moon); - - shumate_location_set_location (SHUMATE_LOCATION (overview->marker_moon_rise), - latitude_moon_rise, - longitude_moon_rise); - - shumate_location_set_location (SHUMATE_LOCATION (overview->marker_moon_set), - latitude_moon_set, - longitude_moon_set); - - /* - * Add markers to the layer - */ - shumate_path_layer_add_node (overview->path_layer_moon_rise_set, - SHUMATE_LOCATION (overview->marker_moon_rise)); - shumate_path_layer_add_node (overview->path_layer_moon_rise_set, - SHUMATE_LOCATION (overview->marker_center)); - shumate_path_layer_add_node (overview->path_layer_moon_rise_set, - SHUMATE_LOCATION (overview->marker_moon_set)); - shumate_path_layer_set_stroke_color (overview->path_layer_moon_rise_set, &moon_rise_set_color); - shumate_path_layer_set_stroke_width (overview->path_layer_moon_rise_set, 6.); - - if (visible_moon) - { - shumate_marker_layer_add_marker (overview->marker_layer_moon, - overview->marker_moon); - shumate_path_layer_add_node (overview->path_layer_moon, - SHUMATE_LOCATION (overview->marker_center)); - shumate_path_layer_add_node (overview->path_layer_moon, - SHUMATE_LOCATION (overview->marker_moon)); - shumate_path_layer_set_stroke_color (overview->path_layer_moon, &moon_color); - shumate_path_layer_set_stroke_width (overview->path_layer_moon, 6.); + */ } } @@ -621,33 +495,23 @@ picplanner_overview_init (PicplannerOverview *overview) g_object_ref (overview->marker_center); overview->marker_sun = shumate_marker_new (); - overview->marker_sun_rise = shumate_marker_new (); - overview->marker_sun_set = shumate_marker_new (); g_object_ref (overview->marker_sun); - g_object_ref (overview->marker_sun_rise); - g_object_ref (overview->marker_sun_set); + + overview->coordinates_center = malloc (sizeof (double) * 2); + overview->coordinates_sunrise = malloc (sizeof (double) * 2); + overview->coordinates_sunset = malloc (sizeof (double) * 2); overview->marker_moon = shumate_marker_new (); overview->marker_moon_rise = shumate_marker_new (); overview->marker_moon_set = shumate_marker_new (); - g_object_ref (overview->marker_moon); - g_object_ref (overview->marker_moon_rise); - g_object_ref (overview->marker_moon_set); overview->path_layer_sun = shumate_path_layer_new (overview->viewport); shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->path_layer_sun)); - overview->path_layer_sun_rise_set = shumate_path_layer_new (overview->viewport); + overview->path_layer_sun_rise_set = picplanner_draw_layer_new (overview->viewport); shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->path_layer_sun_rise_set)); overview->marker_layer_sun = shumate_marker_layer_new (overview->viewport); shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->marker_layer_sun)); - overview->path_layer_moon = shumate_path_layer_new (overview->viewport); - shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->path_layer_moon)); - overview->path_layer_moon_rise_set = shumate_path_layer_new (overview->viewport); - shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->path_layer_moon_rise_set)); - overview->marker_layer_moon = shumate_marker_layer_new (overview->viewport); - shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->marker_layer_moon)); - overview->marker_layer_center = shumate_marker_layer_new (overview->viewport); shumate_simple_map_add_overlay_layer (overview->map, SHUMATE_LAYER (overview->marker_layer_center)); diff --git a/src/window/picplanner-window.c b/src/window/picplanner-window.c index cce0e54..f8aed97 100644 --- a/src/window/picplanner-window.c +++ b/src/window/picplanner-window.c @@ -304,13 +304,13 @@ calculate_positions (PicplannerWindow *window) longitude, array_coordinates_sun, rise_upper_set_index_sun); - +/* picplanner_overview_update_map_moon (PICPLANNER_OVERVIEW (window->overview_box), latitude, longitude, array_coordinates_moon, rise_upper_set_index_moon); - +*/ g_free (rise_upper_set_index_sun); g_free (rise_upper_set_index_moon);