// Creates a CMiniTreeIndividual for the individual specified and adds it to the group. // Informs neighbouring boxes about this box. // bCreateLink decides whether to make this box a clickable link in the HTML. public MiniTreeIndividual AddIndividual(GDMIndividualRecord ir, string firstnames, string surname, string date, bool createLink, bool createStalk, bool highlight, bool concealed, bool shade) { MiniTreeIndividual mti = new MiniTreeIndividual(ir, firstnames, surname, date, createLink, createStalk, highlight, concealed, shade, CConfig.Instance.ConserveTreeWidth); if (fMembers == null) { fMembers = new List <MiniTreeObject>(); } fMembers.Add(mti); fIndividuals++; if (createStalk) { fStalkedIndividuals++; } mti.LeftObject = fLastAddedObject; if (fLastAddedObject != null) { fLastAddedObject.RightObject = mti; } fLastAddedObject = mti; return(mti); }
protected MiniTreeObject() { fLeft = null; fRight = null; fLeftAlien = null; fRightAlien = null; }
public MiniTreeGroup() { fMembers = null; fSize = new SizeF(0.0f, 0.0f); fParent = null; fIndividuals = 0; fStalkedIndividuals = 0; fBoxLeft = null; fBoxRight = null; fLastAddedObject = null; fCrossbar = ECrossbar.Solid; }
// Shifts this object and all objects to its right, until one can't move. public override float PullRight(float amount) { if (fMembers != null) { // This couple had children // Shift the underhanging group members. // Find the leftmost underhanging member and shift it right. // That will interact with other members to find max possible shift amount. MiniTreeIndividual mtiLeftmost = null; float min = 0; bool first = true; foreach (MiniTreeObject obj in fMembers) { var mtIndi = obj as MiniTreeIndividual; if (mtIndi != null) { if (first || mtIndi.Right < min) { min = mtIndi.Right; mtiLeftmost = mtIndi; } first = false; } } if (mtiLeftmost != null) { amount = mtiLeftmost.PushRight(amount); } } // Now shift left object right. MiniTreeObject mtoLeft = LeftObject; if (mtoLeft != null) { amount = mtoLeft.PullRight(amount); } return(amount); }
// Shifts this object and all objects to its left, until one can't move. public override float PullLeft(float amount) { // Did this couple have children? if (fMembers != null) { // Shift the underhanging group members // Find the rightmost underhanging member and shift it left. // That will interact with other members to find max possible shift amount. MiniTreeIndividual mtiRightmost = null; float max = 0; bool first = true; foreach (MiniTreeObject obj in fMembers) { var mtIndi = obj as MiniTreeIndividual; if (mtIndi != null) { if (first || mtIndi.Left > max) { max = mtIndi.Left; mtiRightmost = mtIndi; } first = false; } } if (mtiRightmost != null) { amount = mtiRightmost.PushLeft(amount); } } // Now shift right object left. MiniTreeObject mtoRight = RightObject; if (mtoRight != null) { amount = mtoRight.PullLeft(amount); } return(amount); }
// Adds a CMiniTreeGroup to this group. // Informs neighbouring boxes about the group. public void AddGroup(MiniTreeGroup mtg) { if (mtg != null) { if (fMembers == null) { fMembers = new List <MiniTreeObject>(); } fMembers.Add(mtg); mtg.fParent = this; mtg.LeftObject = fLastAddedObject; if (fLastAddedObject != null) { fLastAddedObject.RightObject = mtg; } fLastAddedObject = mtg; } }