kopia lustrzana https://gitlab.com/Zwarf/picplanner
Add lower culmination to the sun page
rodzic
d28ad4b7de
commit
4834bd8fea
|
@ -228,16 +228,17 @@ double
|
|||
|
||||
|
||||
int
|
||||
*picplanner_get_index_rise_upper_set (double *coordinates_array)
|
||||
*picplanner_get_index_rise_upper_set_lower (double *coordinates_array)
|
||||
{
|
||||
int *rise_upper_set_array = malloc (sizeof (int) * 3);
|
||||
int *rise_upper_set_lower_array = malloc (sizeof (int) * 4);
|
||||
|
||||
double elevation;
|
||||
double upper_max = coordinates_array[0+1];
|
||||
double lower_min = coordinates_array[0+1];
|
||||
double last_elevation = coordinates_array[0+1];
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
rise_upper_set_array[i] = -1;
|
||||
for (int i=0; i<4; i++)
|
||||
rise_upper_set_lower_array[i] = -1;
|
||||
|
||||
for (int i=0; i<NUM_DATA_POINTS; i++)
|
||||
{
|
||||
|
@ -245,24 +246,30 @@ int
|
|||
|
||||
if (elevation >= upper_max)
|
||||
{
|
||||
rise_upper_set_array[1] = i;
|
||||
rise_upper_set_lower_array[1] = i;
|
||||
upper_max = elevation;
|
||||
}
|
||||
|
||||
if (elevation <= lower_min)
|
||||
{
|
||||
rise_upper_set_lower_array[3] = i;
|
||||
lower_min = elevation;
|
||||
}
|
||||
|
||||
|
||||
if (last_elevation < 0 && elevation > 0)
|
||||
{
|
||||
rise_upper_set_array[0] = i;
|
||||
rise_upper_set_lower_array[0] = i;
|
||||
}
|
||||
else if (last_elevation > 0 && elevation < 0)
|
||||
{
|
||||
rise_upper_set_array[2] = i;
|
||||
rise_upper_set_lower_array[2] = i;
|
||||
}
|
||||
|
||||
last_elevation = elevation;
|
||||
}
|
||||
|
||||
return rise_upper_set_array;
|
||||
return rise_upper_set_lower_array;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ double
|
|||
double time_sidereal);
|
||||
|
||||
int
|
||||
*picplanner_get_index_rise_upper_set (double *coordinates_array);
|
||||
*picplanner_get_index_rise_upper_set_lower (double *coordinates_array);
|
||||
|
||||
int
|
||||
*picplanner_get_index_dark_blue_golden (double *coordinates_array);
|
||||
|
|
|
@ -90,7 +90,7 @@ picplanner_application_activate (GApplication *app)
|
|||
window = g_object_new (PICPLANNER_TYPE_WINDOW,
|
||||
"application", app,
|
||||
"default-width", 600,
|
||||
"default-height", 700,
|
||||
"default-height", 800,
|
||||
NULL);
|
||||
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
|
||||
char *phase_moon;
|
||||
|
||||
int *rise_upper_set_index_sun;
|
||||
int *rise_upper_set_lower_index_sun;
|
||||
int *rise_upper_set_index_moon;
|
||||
int *rise_upper_set_index_milky_way;
|
||||
int *dark_blue_golden_index;
|
||||
|
@ -267,7 +267,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
longitude,
|
||||
latitude);
|
||||
|
||||
rise_upper_set_index_sun = picplanner_get_index_rise_upper_set (array_coordinates_sun);
|
||||
rise_upper_set_lower_index_sun = picplanner_get_index_rise_upper_set_lower (array_coordinates_sun);
|
||||
dark_blue_golden_index = picplanner_get_index_dark_blue_golden (array_coordinates_sun);
|
||||
|
||||
picplanner_sun_set_date (PICPLANNER_SUN (window->sun_box),
|
||||
|
@ -279,13 +279,13 @@ calculate_positions (PicplannerWindow *window)
|
|||
|
||||
picplanner_overview_set_current_coordinates_sun (PICPLANNER_OVERVIEW (window->overview_box),
|
||||
array_coordinates_sun,
|
||||
rise_upper_set_index_sun,
|
||||
rise_upper_set_lower_index_sun,
|
||||
current_index);
|
||||
|
||||
picplanner_sun_set_rise_upper_set (PICPLANNER_SUN (window->sun_box),
|
||||
date_time_noon,
|
||||
array_coordinates_sun,
|
||||
rise_upper_set_index_sun);
|
||||
rise_upper_set_lower_index_sun);
|
||||
|
||||
picplanner_sun_set_dark_blue_golden (PICPLANNER_SUN (window->sun_box),
|
||||
date_time_noon,
|
||||
|
@ -297,7 +297,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
longitude,
|
||||
latitude);
|
||||
|
||||
rise_upper_set_index_moon = picplanner_get_index_rise_upper_set (array_coordinates_moon);
|
||||
rise_upper_set_index_moon = picplanner_get_index_rise_upper_set_lower (array_coordinates_moon);
|
||||
|
||||
|
||||
picplanner_overview_set_current_coordinates_moon (PICPLANNER_OVERVIEW (window->overview_box),
|
||||
|
@ -344,7 +344,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
longitude,
|
||||
latitude);
|
||||
|
||||
rise_upper_set_index_milky_way = picplanner_get_index_rise_upper_set (array_coordinates_milky_way);
|
||||
rise_upper_set_index_milky_way = picplanner_get_index_rise_upper_set_lower (array_coordinates_milky_way);
|
||||
|
||||
picplanner_overview_set_current_coordinates_milky_way (PICPLANNER_OVERVIEW (window->overview_box),
|
||||
array_coordinates_milky_way,
|
||||
|
@ -377,7 +377,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
picplanner_overview_update_map_sun (PICPLANNER_OVERVIEW (window->overview_box),
|
||||
array_coordinates_sun,
|
||||
current_index,
|
||||
rise_upper_set_index_sun);
|
||||
rise_upper_set_lower_index_sun);
|
||||
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ calculate_positions (PicplannerWindow *window)
|
|||
rise_upper_set_index_milky_way);
|
||||
}
|
||||
|
||||
g_free (rise_upper_set_index_sun);
|
||||
g_free (rise_upper_set_lower_index_sun);
|
||||
g_free (rise_upper_set_index_moon);
|
||||
g_free (rise_upper_set_index_milky_way);
|
||||
g_free (dark_blue_golden_index);
|
||||
|
|
|
@ -33,9 +33,15 @@ struct _PicplannerSun
|
|||
|
||||
GtkWidget *label_morning_rise_time;
|
||||
GtkWidget *label_morning_rise_azimuth;
|
||||
|
||||
GtkWidget *label_upper_time;
|
||||
GtkWidget *label_upper_azimuth;
|
||||
GtkWidget *label_upper_elevation;
|
||||
|
||||
GtkWidget *label_lower_time;
|
||||
GtkWidget *label_lower_azimuth;
|
||||
GtkWidget *label_lower_elevation;
|
||||
|
||||
GtkWidget *label_evening_set_time;
|
||||
GtkWidget *label_evening_set_azimuth;
|
||||
|
||||
|
@ -70,37 +76,46 @@ void
|
|||
picplanner_sun_set_rise_upper_set (PicplannerSun *sun,
|
||||
GDateTime *date_time,
|
||||
double *coordinates_array,
|
||||
int *index_rise_upper_set)
|
||||
int *index_rise_upper_set_lower)
|
||||
{
|
||||
char *char_morning_rise_time;
|
||||
char *char_morning_rise_azimuth;
|
||||
|
||||
char *char_upper_time;
|
||||
char *char_upper_azimuth;
|
||||
char *char_upper_elevation;
|
||||
|
||||
char *char_lower_time;
|
||||
char *char_lower_azimuth;
|
||||
char *char_lower_elevation;
|
||||
|
||||
char *char_evening_set_time;
|
||||
char *char_evening_set_azimuth;
|
||||
|
||||
GDateTime *date_time_rise;
|
||||
GDateTime *date_time_upper;
|
||||
GDateTime *date_time_set;
|
||||
(void) coordinates_array;
|
||||
GDateTime *date_time_lower;
|
||||
|
||||
date_time_rise = g_date_time_add_minutes (date_time,
|
||||
index_rise_upper_set[0]*24*60/NUM_DATA_POINTS-12*60);
|
||||
index_rise_upper_set_lower[0]*24*60/NUM_DATA_POINTS-12*60);
|
||||
date_time_upper = g_date_time_add_minutes (date_time,
|
||||
index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
||||
index_rise_upper_set_lower[1]*24*60/NUM_DATA_POINTS-12*60);
|
||||
date_time_set = g_date_time_add_minutes (date_time,
|
||||
index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
||||
index_rise_upper_set_lower[2]*24*60/NUM_DATA_POINTS-12*60);
|
||||
date_time_lower = g_date_time_add_minutes (date_time,
|
||||
index_rise_upper_set_lower[3]*24*60/NUM_DATA_POINTS-12*60);
|
||||
|
||||
/*
|
||||
* Morning
|
||||
*/
|
||||
if (index_rise_upper_set[0]>1)
|
||||
if (index_rise_upper_set_lower[0]>1)
|
||||
{
|
||||
char_morning_rise_time = g_strdup_printf ("%02d:%02d",
|
||||
g_date_time_get_hour (date_time_rise),
|
||||
g_date_time_get_minute (date_time_rise));
|
||||
char_morning_rise_azimuth = g_strdup_printf ("Azimuth: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set[0]*2]);
|
||||
coordinates_array[index_rise_upper_set_lower[0]*2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -115,20 +130,20 @@ picplanner_sun_set_rise_upper_set (PicplannerSun *sun,
|
|||
g_date_time_get_hour (date_time_upper),
|
||||
g_date_time_get_minute (date_time_upper));
|
||||
char_upper_azimuth = g_strdup_printf ("Azimuth: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set[1]*2]);
|
||||
coordinates_array[index_rise_upper_set_lower[1]*2]);
|
||||
char_upper_elevation = g_strdup_printf ("Elevation: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set[1]*2+1]);
|
||||
coordinates_array[index_rise_upper_set_lower[1]*2+1]);
|
||||
|
||||
/*
|
||||
* Evening
|
||||
*/
|
||||
if (index_rise_upper_set[2]>0)
|
||||
if (index_rise_upper_set_lower[2]>0)
|
||||
{
|
||||
char_evening_set_time = g_strdup_printf ("%02d:%02d",
|
||||
g_date_time_get_hour (date_time_set),
|
||||
g_date_time_get_minute (date_time_set));
|
||||
char_evening_set_azimuth = g_strdup_printf ("Azimuth: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set[2]*2]);
|
||||
coordinates_array[index_rise_upper_set_lower[2]*2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -136,6 +151,17 @@ picplanner_sun_set_rise_upper_set (PicplannerSun *sun,
|
|||
char_evening_set_azimuth = g_strdup_printf ("Azimuth: -\u00B0");
|
||||
}
|
||||
|
||||
/*
|
||||
* Lower Culmination
|
||||
*/
|
||||
char_lower_time = g_strdup_printf ("%02d:%02d",
|
||||
g_date_time_get_hour (date_time_lower),
|
||||
g_date_time_get_minute (date_time_lower));
|
||||
char_lower_azimuth = g_strdup_printf ("Azimuth: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set_lower[3]*2]);
|
||||
char_lower_elevation = g_strdup_printf ("Elevation: %.0f\u00B0",
|
||||
coordinates_array[index_rise_upper_set_lower[3]*2+1]);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_morning_rise_time), char_morning_rise_time);
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_morning_rise_azimuth), char_morning_rise_azimuth);
|
||||
|
||||
|
@ -146,9 +172,29 @@ picplanner_sun_set_rise_upper_set (PicplannerSun *sun,
|
|||
gtk_label_set_text (GTK_LABEL (sun->label_evening_set_time), char_evening_set_time);
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_evening_set_azimuth), char_evening_set_azimuth);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_lower_time), char_lower_time);
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_lower_azimuth), char_lower_azimuth);
|
||||
gtk_label_set_text (GTK_LABEL (sun->label_lower_elevation), char_lower_elevation);
|
||||
|
||||
|
||||
/*
|
||||
* Free objects
|
||||
*/
|
||||
|
||||
g_date_time_unref (date_time_rise);
|
||||
g_date_time_unref (date_time_upper);
|
||||
g_date_time_unref (date_time_set);
|
||||
|
||||
g_free (char_morning_rise_time);
|
||||
g_free (char_morning_rise_azimuth);
|
||||
g_free (char_upper_time);
|
||||
g_free (char_upper_azimuth);
|
||||
g_free (char_upper_elevation);
|
||||
g_free (char_lower_time);
|
||||
g_free (char_lower_azimuth);
|
||||
g_free (char_lower_elevation);
|
||||
g_free (char_evening_set_time);
|
||||
g_free (char_evening_set_azimuth);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -347,6 +393,9 @@ picplanner_sun_class_init (PicplannerSunClass *class)
|
|||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_upper_time);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_upper_azimuth);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_upper_elevation);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_lower_time);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_lower_azimuth);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_lower_elevation);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_evening_set_time);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_evening_set_azimuth);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerSun, label_morning_dark);
|
||||
|
|
|
@ -35,7 +35,7 @@ void
|
|||
picplanner_sun_set_rise_upper_set (PicplannerSun *sun,
|
||||
GDateTime *date_time,
|
||||
double *coordinates_array,
|
||||
int *index_rise_upper_set);
|
||||
int *index_rise_upper_set_lower);
|
||||
|
||||
void
|
||||
picplanner_sun_set_dark_blue_golden (PicplannerSun *sun,
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-top">2</property>
|
||||
<property name="margin-bottom">2</property>
|
||||
<child>
|
||||
|
@ -241,6 +242,67 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Night</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">15</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="ultrabold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="hexpand">true</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="valign">fill</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title">Lower Culmination</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-top">2</property>
|
||||
<property name="margin-bottom">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_lower_time">
|
||||
<property name="label">12:00</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_lower_azimuth">
|
||||
<property name="label">Azimuth: 180,0°</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.85"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_lower_elevation">
|
||||
<property name="label">Elevation: 90,0°</property>
|
||||
<property name="halign">start</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.85"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue