Moved GsweAntiscionAxisInfo to its own source files

This commit is contained in:
Gergely Polonkai 2013-09-23 23:12:50 +02:00
parent 6ee6650d84
commit e06c73c23d
12 changed files with 275 additions and 46 deletions

View File

@ -65,6 +65,7 @@ IGNORE_HFILES = \
gswe-planet-data-private.h \
gswe-aspect-info-private.h \
gswe-aspect-data-private.h \
gswe-antiscion-axis-info-private.h \
gswe-antiscion-data-private.h \
$(NULL)

View File

@ -23,6 +23,7 @@
<xi:include href="xml/gswe-moon-phase-data.xml"/>
<xi:include href="xml/gswe-aspect-data.xml" />
<xi:include href="xml/gswe-aspect-info.xml" />
<xi:include href="xml/gswe-antiscion-axis-info.xml" />
<xi:include href="xml/gswe-antiscion-data.xml" />
<xi:include href="xml/swe-glib.xml"/>
<xi:include href="xml/gswe-moment.xml"/>

View File

@ -97,6 +97,18 @@ GSWE_TYPE_ASPECT_DATA
gswe_aspect_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-antiscion-axis-info</FILE>
GsweAntiscionAxisInfo
gswe_antiscion_axis_info_get_axis
gswe_antiscion_axis_info_get_name
gswe_antiscion_axis_info_get_sign_offset
gswe_antiscion_axis_info_get_start_sign
<SUBSECTION Standard>
GSWE_TYPE_ANTISCION_AXIS_INFO
gswe_antiscion_axis_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-antiscion-data</FILE>
GsweAntiscionData
@ -166,7 +178,6 @@ GsweMoonPhase
GswePlanetInfo
GsweSignInfo
GsweHouseSystemInfo
GsweAntiscionAxisInfo
GsweCoordinates
GsweHouseData
<SUBSECTION Standard>

View File

@ -4,15 +4,17 @@ AM_CPPFLAGS = -DG_LOG_DOMAIN=\"SWE-GLib\" -DLOCALEDIR=\"$(localedir)\" -D__SWE_G
lib_LTLIBRARIES = libswe-glib-1.0.la
INST_H_SRC_FILES = \
swe-glib.h \
gswe-types.h \
gswe-moon-phase-data.h \
gswe-aspect-info.h \
gswe-aspect-data.h \
gswe-antiscion-data.h \
gswe-planet-data.h \
gswe-moment.h \
gswe-timestamp.h
swe-glib.h \
gswe-types.h \
gswe-moon-phase-data.h \
gswe-aspect-info.h \
gswe-aspect-data.h \
gswe-antiscion-axis-info.h \
gswe-antiscion-data.h \
gswe-planet-data.h \
gswe-moment.h \
gswe-timestamp.h \
$(NULL)
INST_H_BUILT_FILES = \
gswe-enumtypes.h
@ -20,17 +22,19 @@ INST_H_BUILT_FILES = \
gswe_enum_headers = gswe-timestamp.h gswe-types.h
libswe_glib_1_0_la_SOURCES = \
swe-glib.c \
gswe-types.c \
gswe-moon-phase-data.c \
gswe-planet-data.c \
gswe-aspect-info.c \
gswe-aspect-data.c \
gswe-antiscion-data.c \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \
swe-glib.c \
gswe-types.c \
gswe-moon-phase-data.c \
gswe-planet-data.c \
gswe-aspect-info.c \
gswe-aspect-data.c \
gswe-antiscion-axis-info.c \
gswe-antiscion-data.c \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \
$(NULL)
libswe_glib_1_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
libswe_glib_1_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)

View File

@ -0,0 +1,46 @@
/* gswe-antiscion-axis-info-private.h: Private parts of GsweAntiscionAxisInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-antiscion-axis-info.h"
struct _GsweAntiscionAxisInfo {
/* the identifier of this mirror's axis */
GsweAntiscionAxis axis;
/* represents the sign in whict the mirror axis starts */
GsweSignInfo *start_sign;
/* the name of the mirror */
gchar *name;
/* if TRUE, the axis runs through the middle of its starting sign */
gdouble sign_offset;
};
GsweAntiscionAxisInfo *gswe_antiscion_axis_info_copy(GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_free(GsweAntiscionAxisInfo *antiscion_axis_info);
#endif /* __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -0,0 +1,134 @@
/* gswe-antiscion-axis-info.c: Antiscion axis related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "gswe-antiscion-axis-info.h"
#include "gswe-antiscion-axis-info-private.h"
/**
* SECTION:gswe-antiscion-axis-info
* @short_description: a structure storing information about antiscion axes
* @title: GsweAntiscionAxisInfo
* @stability: Stable
* @include: swe-glib.h
*
* The #GsweAntiscionAxisInfo stores information about an antiscion axis.
*/
G_DEFINE_BOXED_TYPE(GsweAntiscionAxisInfo, gswe_antiscion_axis_info, (GBoxedCopyFunc)gswe_antiscion_axis_info_copy, (GBoxedFreeFunc)gswe_antiscion_axis_info_free);
GsweAntiscionAxisInfo *
gswe_antiscion_axis_info_copy(GsweAntiscionAxisInfo *antiscion_axis_info)
{
GsweAntiscionAxisInfo *ret;
if (antiscion_axis_info == NULL) {
return NULL;
}
ret = g_new0(GsweAntiscionAxisInfo, 1);
ret->axis = antiscion_axis_info->axis;
ret->start_sign = antiscion_axis_info->start_sign;
ret->name = g_strdup(antiscion_axis_info->name);
ret->sign_offset = antiscion_axis_info->sign_offset;
return ret;
}
void
gswe_antiscion_axis_info_free(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info) {
if (antiscion_axis_info->name) {
g_free(antiscion_axis_info->name);
}
g_free(antiscion_axis_info);
}
}
/**
* gswe_antiscion_axis_info_get_axis:
* @antiscion_axis_info: (in) (allow-none): a #GsweAntiscionAxisInfo
*
* Gets the axis ID.
*
* Returns: the axis this #GsweAntiscionAxisInfo represents
*/
GsweAntiscionAxis
gswe_antiscion_axis_info_get_axis(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info) {
return antiscion_axis_info->axis;
} else {
return GSWE_ANTISCION_AXIS_NONE;
}
}
/**
* gswe_antiscion_axis_info_get_start_sign:
* @antiscion_axis_info: (in) (allow-none): a #GsweAntiscionAxisInfo
*
* Gets the starting sign of the axis.
*
* Returns: (transfer none): the #GsweSignInfo of the sign in which this axis starts
*/
GsweSignInfo *
gswe_antiscion_axis_info_get_start_sign(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info) {
return antiscion_axis_info->start_sign;
} else {
return NULL;
}
}
/**
* gswe_antiscion_axis_info_get_name:
* @antiscion_axis_info: (in) (allow-none): a #GsweAntiscionAxisInfo
*
* Gets the name of the axis.
*
* Returns: (transfer none): the name of the axis
*/
const gchar *
gswe_antiscion_axis_info_get_name(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info) {
return antiscion_axis_info->name;
} else {
return NULL;
}
}
/**
* gswe_antiscion_axis_info_get_sign_offset:
* @antiscion_axis_info: (in) (allow-none): a #GsweAntiscionAxisInfo
*
* Gets the offset at which the axis starts.
*
* Returns: the offset, in degrees
*/
gboolean
gswe_antiscion_axis_info_get_sign_offset(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info) {
return antiscion_axis_info->sign_offset;
} else {
return 0.0;
}
}

View File

@ -0,0 +1,48 @@
/* gswe-antiscion-axis-info.h: Antiscion axis related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__
#define __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
G_BEGIN_DECLS
/**
* GsweAntiscionAxisInfo:
*
* <structname>GsweAntiscionAxisInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweAntiscionAxisInfo GsweAntiscionAxisInfo;
GType gswe_antiscion_axis_info_get_type(void);
#define GSWE_TYPE_ANTISCION_AXIS_INFO (gswe_antiscion_axis_info_get_type())
GsweAntiscionAxis gswe_antiscion_axis_info_get_axis(GsweAntiscionAxisInfo *antiscion_axis_info);
GsweSignInfo *gswe_antiscion_axis_info_get_start_sign(GsweAntiscionAxisInfo *antiscion_axis_info);
const gchar *gswe_antiscion_axis_info_get_name(GsweAntiscionAxisInfo *antiscion_axis_info);
gboolean gswe_antiscion_axis_info_get_sign_offset(GsweAntiscionAxisInfo *antiscion_axis_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__ */

View File

@ -1190,9 +1190,7 @@ find_antiscion(gpointer axis_p, GsweAntiscionAxisInfo *antiscion_axis_info, Gswe
planet_orb = fmin(antiscion_data->planet1->planet_info->orb, antiscion_data->planet2->planet_info->orb);
start_point = (antiscion_axis_info->start_sign->sign_id - 1) * 30.0;
if (antiscion_axis_info->middle_axis == TRUE) {
start_point += 15.0;
}
start_point += antiscion_axis_info->sign_offset;
axis_position = 2 * start_point - antiscion_data->planet1->position;

View File

@ -317,22 +317,6 @@ typedef struct {
gchar *name;
} GsweHouseSystemInfo;
/**
* GsweAntiscionAxisInfo:
* @axis_id: the identifier of this mirror's axis
* @start_sign: represents the sign in whict the mirror axis starts
* @name: the name of the mirror
* @middle_axis: if TRUE, the axis runs through the middle of its starting sign
*
* Holds information of antiscion axes.
*/
typedef struct {
GsweAntiscionAxis axis_id;
GsweSignInfo *start_sign;
gchar *name;
gboolean middle_axis;
} GsweAntiscionAxisInfo;
/**
* GsweCoordinates:
* @longitude: longitude part of the coordinates

View File

@ -23,6 +23,7 @@
#include "gswe-planet-data-private.h"
#include "gswe-aspect-info-private.h"
#include "gswe-aspect-data-private.h"
#include "gswe-antiscion-axis-info-private.h"
#include "gswe-antiscion-data-private.h"
extern gchar *gswe_ephe_path;

View File

@ -82,10 +82,10 @@ GsweTimestamp *gswe_full_moon_base_date;
#define ADD_ANTISCION(ht, v, hts, vs, i, n, s, m) (v) = g_new0(GsweAntiscionAxisInfo, 1); \
(vs) = g_hash_table_lookup((hts), GINT_TO_POINTER(i)); \
(v)->axis_id = (i); \
(v)->axis = (i); \
(v)->start_sign = (vs); \
(v)->name = g_strdup(n); \
(v)->middle_axis = m; \
(v)->sign_offset = m; \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v));
void
gswe_free_planet_info(gpointer planet_info)
@ -204,11 +204,11 @@ gswe_init(void)
gswe_antiscion_axis_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)gswe_free_antiscion_axis_info);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_NONE, _("None"), GSWE_SIGN_NONE, FALSE);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_ARIES, _("Aries/Libra"), GSWE_SIGN_ARIES, FALSE);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_MID_TAURUS, _("mid Taurus/Scorpio"), GSWE_SIGN_TAURUS, TRUE);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_CANCER, _("Cancer/Capricorn"), GSWE_SIGN_CANCER, FALSE);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_MID_LEO, _("mid Leo/Aquarius"), GSWE_SIGN_LEO, TRUE);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_NONE, _("None"), GSWE_SIGN_NONE, 0.0);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_ARIES, _("Aries/Libra"), GSWE_SIGN_ARIES, 0.0);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_MID_TAURUS, _("mid Taurus/Scorpio"), GSWE_SIGN_TAURUS, 15.0);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_CANCER, _("Cancer/Capricorn"), GSWE_SIGN_CANCER, 0.0);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info, gswe_sign_info_table, sign_info, GSWE_ANTISCION_AXIS_MID_LEO, _("mid Leo/Aquarius"), GSWE_SIGN_LEO, 15.0);
gswe_full_moon_base_date = gswe_timestamp_new_from_gregorian_full(2005, 5, 8, 3, 48, 0, 0, 0.0);

View File

@ -24,6 +24,7 @@
#include "gswe-planet-data.h"
#include "gswe-aspect-info.h"
#include "gswe-aspect-data.h"
#include "gswe-antiscion-axis-info.h"
#include "gswe-antiscion-data.h"
#include "gswe-timestamp.h"
#include "gswe-moment.h"