4 Commits

5 changed files with 81 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
m4_define([swe_glib_major_version], [2])
m4_define([swe_glib_minor_version], [0])
m4_define([swe_glib_micro_version], [2])
m4_define([swe_glib_micro_version], [3])
m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version])
m4_define([swe_glib_api_version], [swe_glib_major_version.0])

View File

@@ -6,7 +6,7 @@ Summary: A GLib style wrapper library around the Swiss Ephemeris library, create
Group: Development/Libraries
License: LGPLv3+
URL: http://gergely.polonkai.eu/swe-glib/
Source: https://github.com/gergelypolonkai/%{name}/archive/v%{version}.tar.gz
Source: http://gergely.polonkai.eu/download/%{name}-%{version}.tar.gz
BuildRequires: pkgconfig
BuildRequires: glib2-devel
@@ -86,6 +86,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir
%{_libdir}/libswe-1.76.so
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so
%{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi
%changelog

View File

@@ -25,10 +25,12 @@ gswe_moment_get_quality_points
gswe_moment_get_moon_phase
gswe_moment_get_all_aspects
gswe_moment_get_planet_aspects
gswe_moment_get_aspect_by_planets
gswe_moment_get_all_antiscia
gswe_moment_get_all_planet_antiscia
gswe_moment_get_axis_all_antiscia
gswe_moment_get_axis_planet_antiscia
gswe_moment_get_antiscion_by_planets
<SUBSECTION Standard>
GSWE_IS_MOMENT
GSWE_IS_MOMENT_CLASS

View File

@@ -1121,6 +1121,43 @@ gswe_moment_get_planet_aspects(GsweMoment *moment, GswePlanet planet, GError **e
return ret;
}
/**
* gswe_moment_get_aspect_by_planets:
* @moment: the GsweMoment to operate on
* @planet1: the first planet
* @planet2: the second planet
* @err: a #GError
*
* Get the aspect between two given planets. The order of @planet1 and @planet2
* doesnt matter.
*
* Returns: (transfer none): a #GsweAspectData containing the aspect data of the
* two planets. If an error occurs, like when one of the planets are
* not added to the planet list, returns NULL, and @err is set
* accordingly.
*/
GsweAspectData *
gswe_moment_get_aspect_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err)
{
struct GsweAspectFinder aspect_finder;
GList *aspect_data_element;
if (!gswe_moment_has_planet(moment, planet1) || !gswe_moment_has_planet(moment, planet2)) {
g_set_error(err, GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET, "One of the requested planets is not found in the planet list");
return NULL;
}
aspect_finder.planet1 = planet1;
aspect_finder.planet2 = planet2;
if ((aspect_data_element = g_list_find_custom(moment->priv->aspect_list, &aspect_finder, (GCompareFunc)find_aspect_by_both_planets)) != NULL) {
return aspect_data_element->data;
}
return NULL;
}
static gint
find_antiscion_by_both_planets(GsweAntiscionData *antiscion, struct GsweAspectFinder *antiscion_finder)
{
@@ -1314,3 +1351,40 @@ gswe_moment_get_axis_planet_antiscia(GsweMoment *moment, GsweAntiscionAxis axis,
return ret;
}
/**
* gswe_moment_get_antiscion_by_planets:
* @moment: the GsweMoment to operate on
* @planet1: the first planet
* @planet2: the second planet
* @err: a #GError
*
* Get the aspect between two given planets. The order of @planet1 and @planet2
* doesnt matter.
*
* Returns: (transfer none): a #GsweAspectData containing the aspect data of the
* two planets. If an error occurs, like when one of the planets are
* not added to the planet list, returns NULL, and @err is set
* accordingly.
*/
GsweAntiscionData *
gswe_moment_get_antiscion_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err)
{
struct GsweAspectFinder antiscion_finder;
GList *antiscion_data_element;
if (!gswe_moment_has_planet(moment, planet1) || !gswe_moment_has_planet(moment, planet2)) {
g_set_error(err, GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET, "One of the planets is not found in the planet list");
return NULL;
}
antiscion_finder.planet1 = planet1;
antiscion_finder.planet2 = planet2;
if ((antiscion_data_element = g_list_find_custom(moment->priv->antiscia_list, &antiscion_finder, (GCompareFunc)find_antiscion_by_both_planets)) != NULL) {
return antiscion_data_element->data;
}
return NULL;
}

View File

@@ -119,11 +119,13 @@ GsweMoonPhaseData *gswe_moment_get_moon_phase(GsweMoment *moment, GError **err);
GList *gswe_moment_get_all_aspects(GsweMoment *moment);
GList *gswe_moment_get_planet_aspects(GsweMoment *moment, GswePlanet planet, GError **err);
GsweAspectData *gswe_moment_get_aspect_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err);
GList *gswe_moment_get_all_antiscia(GsweMoment *moment);
GList *gswe_moment_get_all_planet_antiscia(GsweMoment *moment, GswePlanet planet, GError **err);
GList *gswe_moment_get_axis_all_antiscia(GsweMoment *moment, GsweAntiscionAxis axis);
GList *gswe_moment_get_axis_planet_antiscia(GsweMoment *moment, GsweAntiscionAxis axis, GswePlanet planet, GError **err);
GsweAntiscionData *gswe_moment_get_antiscion_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err);
#endif /* __GSWE_MOMENT_H__ */