From 46c09ea2689913bb459c5f04439647aa138dc196 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Mon, 13 Jan 2014 21:10:49 +0100 Subject: [PATCH] Added object position managing functions and structures. --- Makefile.am | 2 + doc/model.dia | Bin 2729 -> 3577 bytes src/math/3d.h | 60 +++++++++++ src/math/positions.c | 41 +++++++ src/math/positions.h | 42 ++++++++ src/storage/positions.c | 233 ++++++++++++++++++++++++++++++++++++++++ src/storage/positions.h | 56 ++++++++++ src/storage/storage.c | 7 ++ 8 files changed, 441 insertions(+) create mode 100644 src/math/3d.h create mode 100644 src/math/positions.c create mode 100644 src/math/positions.h create mode 100644 src/storage/positions.c create mode 100644 src/storage/positions.h diff --git a/Makefile.am b/Makefile.am index 187b942..7d30f83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,6 +38,8 @@ bin_familia_SOURCES = \ src/storage/storage.c \ src/storage/individual.c \ src/storage/family.c \ + src/storage/positions.c \ + src/math/positions.c \ src/gedcom/familia_gedcom.c \ src/memory_stack.c \ src/gui.c \ diff --git a/doc/model.dia b/doc/model.dia index 5490dcd0428e17321f3afea9b88f09f31ec504f1..f02a73883f9c70e9282efea6bc4c045783ac2cf2 100644 GIT binary patch literal 3577 zcmZ{kRag@Y!-h8)T_a_5Hr_AHa>!8ww1#>DOSD&hi(MDb-w0!(x46 z-_v675|~Y&Pb@1784}M0yTc$-C0(uDTkP6GMRXj!U%G^QBrjG9xdJ zR_4Aq=rDyl|5_c?KlI{bjc>Y>Ru+!@dvy7kaC5OcNY^y_Hvhp!lG(k>bRO%&((r77 z!pPgx)8D@nu5~7|r8RMidM%+>sejavS=wg(X58|=Z-Dv2_K|tWv220kgcEH~U|Gt} z8U~Has0!ff>Q57^V~>ww^?JREBt%9SIQG}|71n9qCtEH(YGKulMN0bH=1YxYXHSi_ zS0+t8oc9f~++!*de zo;s?zBqq!|F-bXO#pzw$4%~E&0b0>E%fSuX8T`|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YF2AivtUzi!lq=Gz@)k`DWzDjDBwE)-=Vuz3&2+(HNX}NNDV-0 zxHVG4&q=}pn)YIg+F<6?2D4Wi&Tfq8hE$OkRJ(R0Y;NP4;jv`Oo`;pyw>2nOX?C~| zd~e(V&J)2 zt5G;kuTm#in2O@$ba`losUzRLvyh?KO#{n9o+4Tq4yp-E%!t6p;^-ljYjC|TaWNgH zIyzf(dy08T_hsi#E-01b6*yqkbg@#=vwO)n-9t^P@P(@9=R?<>-6p&cjI+fNkDxwp zWR2}FIs^CD6o~dj1T2oTH90BOxcZMa#c`NZ1O!Wu)X_HoeeC(A5!-XEkzZ>RueHj@ z3GFnfIa$DlKv6*(aWKrMECF!O;aCBt#ZE2Eyj)z1}UUOqFTlcKV2K z57}NW$#9)P-$#zEKHJDP8l9eg{DI$Xbn>L!9=Sbs3Y@hL^L*^~b9}yLG^@=yEb=e% za)DeQH4%25=>xeukjn$PJdn!+xjc}|1Gzkq%LBPQkjn$PJdn$C3Tf=y6|xU*lO_f% zu=ho`{C0&z0f$P6cDzXMc6LN=Q)lcG^Y%4obwG@ z8s=IMWHpL-9D(d#{&YdF>FnP}j_>H^-MwL;zGE02PXAJry%Oc>hA}X8WZR~5cW=wR zeqGV0VUX=~^Tel7yS{5*288TOS%sI^-N}P<%oD60l3aE&;m)>=Lj`z%Bv11nd&9OTaDxyF3MfdEsO{{7#ne6wo#v zQMf*UFx#1ho1L0;N#KE??+o3{w(A$OtS3gpTeYlzsaTmbE5TB0inik+U{(NqUJ3fF zihKJ_;ZRRF)DsT%e9MP=Zn80SWa^zJo!pzqQdrx4dN`b63|wTT zStt(j>Vt2uA?dJMiRH2ea^1dVoK@CAdJ!?)hb~HGO68V{LfRo5?75v)=T&CL9nY%s ji`V*RXVqn&BfKR1^M~w%{80es=MVn}%QUJlGS~nBjB{JS diff --git a/src/math/3d.h b/src/math/3d.h new file mode 100644 index 0000000..bc5bfc3 --- /dev/null +++ b/src/math/3d.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * Familia Lignum - Genealogical program * + * Copyright (C) 2011-2012 Rafał Długołęcki * + * * + * This program 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; version 2 of the License. * + * * + * This program 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 program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * + ****************************************************************************/ + +#ifndef _FAMILIA_MATH_3D_H +#define _FAMILIA_MATH_3D_H + +/** + * + */ +struct position { + /** x coordinate */ + float x; + + /** y coordinate */ + float y; + + /** z coordinate */ + float z; +}; + +struct quaternion { + /** Quaternion angle */ + float w; + + /** Quaternion x coordinate */ + float x; + + /** Quaternion y coordinate */ + float y; + + /** Quaternion z coordinate */ + float z; +}; + +/* +struct matrix quaternion_to_matrix(struct quaternion q); +struct quaternion matrix_to_quaternion(struct matrix4 m); + +struct quaternion slerp(struct quaternion q1, struct quaternion q2, float time); + +struct quaternion quaternion_normalise(struct quaternion q) +*/ + +#endif /* _FAMILIA_MATH_3D_H */ diff --git a/src/math/positions.c b/src/math/positions.c new file mode 100644 index 0000000..4fd47bf --- /dev/null +++ b/src/math/positions.c @@ -0,0 +1,41 @@ +/**************************************************************************** + * Familia Lignum - Genealogical program * + * Copyright (C) 2011-2012 Rafał Długołęcki * + * * + * This program 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; version 2 of the License. * + * * + * This program 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 program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * + ****************************************************************************/ + +#ifndef _FAMILIA_MATH_POSITIONS_H +#define _FAMILIA_MATH_POSITIONS_H + +#include + +#include "positions.h" +#include "storage/individual.h" +#include "storage/family.h" + +struct position * familia_position_calculate_individual_position(struct familia_individual * individual) +{ +/* TODO: Implement this function*/ + return NULL; +} + +struct position * familia_position_calculate_family_position(struct familia_family * family) +{ +/* TODO: Implement this function*/ + return NULL; +} + +#endif /* _FAMILIA_MATH_3D_H */ diff --git a/src/math/positions.h b/src/math/positions.h new file mode 100644 index 0000000..6db7f3d --- /dev/null +++ b/src/math/positions.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * Familia Lignum - Genealogical program * + * Copyright (C) 2011-2012 Rafał Długołęcki * + * * + * This program 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; version 2 of the License. * + * * + * This program 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 program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * + ****************************************************************************/ + +#ifndef _FAMILIA_MATH_POSITIONS_H +#define _FAMILIA_MATH_POSITIONS_H + +#include "3d.h" + +#include "storage/individual.h" +#include "storage/family.h" + +/** + * Calculates local position of given individual + * @parameter individual to calculate position + * @return calculated local position of the individual + */ +struct position * familia_position_calculate_individual_position(struct familia_individual * individual); + +/** + * Calculates local position of given family + * @parameter family to calculate position + * @return calculated local position of the family + */ +struct position * familia_position_calculate_family_position(struct familia_family * family); + +#endif /* _FAMILIA_MATH_3D_H */ diff --git a/src/storage/positions.c b/src/storage/positions.c new file mode 100644 index 0000000..b2e977e --- /dev/null +++ b/src/storage/positions.c @@ -0,0 +1,233 @@ +/**************************************************************************** + * Familia Lignum - Genealogical program * + * Copyright (C) 2011-2012 Rafał Długołęcki * + * * + * This program 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; version 2 of the License. * + * * + * This program 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 program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * + ****************************************************************************/ + +#include +#include + +#include "../debug.h" + +#include "positions.h" + +/** + * Structure holding individual and position pair + */ +struct familia_storage_individual_position { + struct familia_individual *ind; + struct position *pos; +}; + +/** + * Structure holding family and position pair + */ +struct familia_storage_family_position { + struct familia_family *fam; + struct position *pos; +}; + +/** + * Structure holding individual and family positions + */ +struct familia_storage_positions { + struct familia_storage_individual_position **individuals; + + unsigned int individuals_no; + + struct familia_storage_family_position **families; + + unsigned int families_no; +}; + +/** + * Global variable for storing positions of graphic objects. + * + * Example graphic object is an individual or family... + */ +struct familia_storage_positions * storage_positions; + +/** + * Initializes storage for individual and family positions. + */ +void _familia_storage_positions_init() +{ + if (!storage_positions) { + storage_positions = malloc(sizeof(struct familia_storage_positions)); + + if (!storage_positions) { + debug("["__FILE__ "] There was a problem with allocating memory for storage of positions.\n"); + } + else { + storage_positions->individuals_no = 0; + storage_positions->families_no = 0; + } + } +} + +/** + * Frees storage for the positions + */ +void _familia_storage_positions_free() +{ + if (storage_positions) { + if (storage_positions->individuals) { + free(storage_positions->individuals); + } + + if (storage_positions->families) { + free(storage_positions->families); + } + + free(storage_positions); + storage_positions = NULL; + } +} + +/** + * Adds new position for the given individual. + * + * This function should be invoked only internaly and thus is not declared in + * header. Usage without caution can create duplicates in global variable + * storage_positions. Variable storage_positions is not prepared for such duplicates + * and this can provide to errors. + */ +void _familia_positions_add_individual_position(struct familia_individual *individual, struct position *pos) +{ + struct familia_storage_individual_position ** tmp = NULL; + unsigned int alloc_size = sizeof(struct familia_storage_individual_position *); + + int size = (storage_positions->individuals_no + 1); + + tmp = realloc(storage_positions->individuals, size * alloc_size); + + if (tmp) { + storage_positions->individuals = tmp; + storage_positions->individuals[storage_positions->individuals_no]->ind = individual; + storage_positions->individuals[storage_positions->individuals_no]->pos = pos; + storage_positions->individuals_no++; + } + else { + debug("There were problems with allocating memory for storage of individual positions->\n"); + } +} + +/** + * Adds new position for the given family. + * + * This function should be invoked only internaly and thus is not declared in + * header. Usage without caution can create duplicates in global variable + * storage_positions. Variable storage_positions is not prepared for such duplicates + * and this can provide to errors. + */ +void _familia_positions_add_family_position(struct familia_family *family, struct position *pos) +{ + struct familia_storage_family_position ** tmp = NULL; + unsigned int alloc_size = sizeof(struct familia_storage_family_position *); + + int size = (storage_positions->families_no + 1); + + tmp = realloc(storage_positions->families, size * alloc_size); + + if (tmp) { + storage_positions->families = tmp; + storage_positions->families[storage_positions->families_no]->fam = family; + storage_positions->families[storage_positions->families_no]->pos = pos; + storage_positions->families_no++; + } + else { + debug("There were problems with allocating memory for storage of family positions.\n"); + } +} + +void familia_positions_set_individual_position(struct familia_individual *individual, struct position *pos) +{ + struct position * p = NULL; + + p = familia_position_get_individual_position(individual); + + /* If not found create a new one */ + if (p == NULL) { + _familia_positions_add_individual_position(individual, pos); + } +} + +void familia_positions_set_family_position(struct familia_family *family, struct position *pos) +{ + struct position * p = NULL; + + p = familia_position_get_family_position(family); + + /* If not found create a new one */ + if (p == NULL) { + _familia_positions_add_family_position(family, pos); + } +} + +struct position * familia_position_get_individual_position(struct familia_individual *individual) +{ + unsigned int i; + unsigned int id; + + /* + * Uninitialized global. Return error. + */ + if (!storage_positions || !storage_positions->individuals) { + debug("Trying to request individual position, but positions storage is not initialized.\n"); + return NULL; + } + + id = individual->id; + + for (i = 0; i < storage_positions->individuals_no; i++) { + if (storage_positions->individuals[i]->ind->id == id) { + return storage_positions->individuals[i]->pos; + } + } + + /* + * Entry not found for a given individual. Return error. + */ + return NULL; +} + +struct position * familia_position_get_family_position(struct familia_family *family) +{ + unsigned int i; + unsigned int id; + + /* + * Uninitialized global. Return error. + */ + if (!storage_positions || !storage_positions->families) { + debug("Trying to request family position, but positions storage is not initialized.\n"); + return NULL; + } + + id = family->id; + + for (i = 0; i < storage_positions->families_no; i++) { + if (storage_positions->families[i]->fam->id == id) { + return storage_positions->families[i]->pos; + } + } + + /* + * Entry not found for a given individual. Return error. + */ + return NULL; +} + diff --git a/src/storage/positions.h b/src/storage/positions.h new file mode 100644 index 0000000..2d3473e --- /dev/null +++ b/src/storage/positions.h @@ -0,0 +1,56 @@ +/**************************************************************************** + * Familia Lignum - Genealogical program * + * Copyright (C) 2011-2012 Rafał Długołęcki * + * * + * This program 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; version 2 of the License. * + * * + * This program 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 program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * + ****************************************************************************/ + +#ifndef _FAMILIA_STORAGE_POSITIONS_H +#define _FAMILIA_STORAGE_POSITIONS_H + +#include "../math/3d.h" + +#include "individual.h" +#include "family.h" + +/** + * Sets position for the given individual. + * @parameter individual individual to set the position + * @parameter position position which will be used for individual + */ +void familia_positions_set_individual_position(struct familia_individual *individual, struct position *pos); + +/** + * Sets position for the given family. + * @parameter family family to set the position + * @parameter position position which will be used for family + */ +void familia_positions_set_family_position(struct familia_family *family, struct position *pos); + +/** + * Gets position of the given individual. + * @parameter individual individual for which the position will be get + * @return position of the individual or NULL on error + */ +struct position * familia_position_get_individual_position(struct familia_individual *individual); + +/** + * Gets position of the given family + * @parameter family family for which the position will be get + * @return position of the family or NULL on error + */ +struct position * familia_position_get_family_position(struct familia_family *family); + +#endif /* _FAMILIA_STORAGE_POSITIONS_H */ diff --git a/src/storage/storage.c b/src/storage/storage.c index 9f74f90..272e6af 100644 --- a/src/storage/storage.c +++ b/src/storage/storage.c @@ -6,6 +6,9 @@ struct familia_storage * _familia_storage_current; +extern void _familia_storage_positions_init(); +extern void _familia_storage_positions_free(); + struct familia_storage * familia_storage_get_current() { return _familia_storage_current; @@ -31,6 +34,8 @@ struct familia_storage * familia_storage_new() storage->families = NULL; storage->families_no = 0; + _familia_storage_positions_init(); + return storage; } @@ -57,6 +62,8 @@ void familia_storage_free(struct familia_storage * storage) storage->families = NULL; storage->families_no = 0; } + + _familia_storage_positions_free(); } void familia_storage_add_individual(struct familia_storage * storage, struct familia_individual * individual) -- 2.30.2