简体   繁体   中英

Graphical Family Tree Algorithm

I have a SQLite-Database with 3 Tables:

Persons

  • ID: Interger
  • Name: Text
  • Gender: Integer

Families

  • ID: Integer
  • HusbandID: Integer (Person ID)
  • WifeID: Integer (Person ID)

Children

  • ID: Integer
  • ChildID: Integer (Person ID)
  • FamilyID: Integer
  • Order: Integer

So i would Love to create a Graphical Output.

How should a OOP class look like that? Children of children should also be drawn. So i need interative to select the Families of each Child, where the Child is Husband Or Wife and find any children of that. How to Do that (SQL SELECT)? And how to create a Graphical Output Class?

Will it possible to create such a Concept together step by step? Read a lot about Tilford Algorithm, but i am a non professional, just Hobby Programmer. To high for me :D

Develope with Xojo/RealBasic/VB/Delphi.

Thanks all

Their is no simple answer to your question since there are many ways to do it. You will have to first learn the Xojo database and Graphics classes. Until you are fairly conversant in those the rest is academic, in my opinion.

In general, though, you can create class objects representing Persons, Families, and Children. The Families class will have an array of Persons and the children will have a property pointing to their parent (though won't they have both a mother and father?). Personally, I would let these classes do all of the database work of loading and getting relational data.

To display in a canvas you'd iterate through the objects and then draw them individually via the Canvas.Graphics object. I recommend taking a look at the CustomFrames project at https://github.com/alexrestrepo/RBCustomFrames to get a feel for how to do this. FWIW, this will probably be the part you struggle with the most.

A big project to bite off for someone new to Xojo. You have some homework to do before starting this regardless of which language you end up using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM