private void btnPatSearch_Click(object sender, EventArgs e) { ListPatriarchs.BeginUpdate(); ExtList <PatriarchObj> lst = null; try { ListPatriarchs.ClearItems(); lst = PatriarchsMan.GetPatriarchsList(fBase.Context, (int)edMinGens.Value, !chkWithoutDates.Checked.GetValueOrDefault()); lst.QuickSort(PatriarchsCompare); int num = lst.Count; for (int i = 0; i < num; i++) { PatriarchObj pObj = lst[i]; string pSign = ((pObj.IRec.Patriarch) ? "[*] " : ""); ListPatriarchs.AddItem(pObj.IRec, new object[] { pSign + GKUtils.GetNameString(pObj.IRec, true, false), pObj.BirthYear, pObj.DescendantsCount, pObj.DescGenerations }); } } finally { if (lst != null) { lst.Dispose(); } ListPatriarchs.EndUpdate(); } }
public PatriarchsViewerWin(IBaseWindow baseWin, int minGens) { InitializeComponent(); fBase = baseWin; fTipShow = false; using (Graph graph = PatriarchsMan.GetPatriarchsGraph(fBase.Context, minGens, false, true)) { ArborSystem sys = fArborViewer.Sys; foreach (Vertex vtx in graph.Vertices) { var arbNode = sys.addNode(vtx.Sign) as ArborNodeEx; PGNode pgNode = (PGNode)vtx.Value; arbNode.Color = (pgNode.Type == PGNodeType.Intersection) ? Colors.BlueViolet : Colors.Navy; arbNode.Mass = pgNode.Size; } foreach (Edge edge in graph.Edges) { sys.addEdge(edge.Source.Sign, edge.Target.Sign); } } fArborViewer.NodesDragging = true; }
public void Search() { fView.PatriarchsList.BeginUpdate(); ExtList <PatriarchObj> lst = null; try { fView.PatriarchsList.ClearItems(); lst = PatriarchsMan.GetPatriarchsList(fBase.Context, (int)fView.MinGensNum.Value, !fView.WithoutDatesCheck.Checked); lst.QuickSort(PatriarchsCompare); int num = lst.Count; for (int i = 0; i < num; i++) { PatriarchObj pObj = lst[i]; string pSign = ((pObj.IRec.Patriarch) ? "[*] " : ""); fView.PatriarchsList.AddItem(pObj.IRec, new object[] { pSign + GKUtils.GetNameString(pObj.IRec, true, false), pObj.BirthYear, pObj.DescendantsCount, pObj.DescGenerations }); } } finally { if (lst != null) { lst.Dispose(); } fView.PatriarchsList.EndUpdate(); } }
private void PreparePatriarchs() { using (ExtList <PatriarchObj> lst = PatriarchsMan.GetPatriarchsList(fBase.Context, 2, false)) { lst.QuickSort(PatriarchsCompare); int num = lst.Count; for (int i = 0; i < num; i++) { PatriarchObj pObj = lst[i]; fPatList.AddObject(GKUtils.GetNameString(pObj.IRec, true, false), pObj.IRec); } } }
public void CreateArborGraph(IBaseWindow baseWin, int minGens, bool loneSuppress) { fBase = baseWin; try { fSys = new ArborSystem(1000, 1000, 0.1, null); //(10000, 1000, 0.1, this); fSys.setScreenSize(50, 50); fSys.OnStop += OnArborStop; using (ExtList <PatriarchObj> patList = PatriarchsMan.GetPatriarchsLinks( baseWin.Context, minGens, false, loneSuppress)) { int num = patList.Count; for (int i = 0; i < num; i++) { PatriarchObj pObj = patList[i]; if (!loneSuppress || pObj.HasLinks) { ArborNode node = fSys.addNode(pObj.IRec.XRef); node.Data = pObj; } } for (int i = 0; i < num; i++) { PatriarchObj pat1 = patList[i]; foreach (PatriarchObj pat2 in pat1.Links) { fSys.addEdge(pat1.IRec.XRef, pat2.IRec.XRef); } } } z = -50; fSys.start(); } catch (Exception ex) { Logger.LogWrite("TreeVizControl.CreateArborGraph(): " + ex.Message); } }
protected override void InternalGenerate() { try { #if !NETSTANDARD IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000); IColor clrBlue = AppHost.GfxProvider.CreateColor(0x0000FF); fLinkFont = fWriter.CreateFont("", 8f, false, true, clrBlue); fTextFont = fWriter.CreateFont("", 8f, false, false, clrBlack); fWriter.EnablePageNumbers(); fRenderer = fWriter.GetPageRenderer(); if (fRenderer == null) { // TODO: warning return; } IFont titleFont = fWriter.CreateFont("", 30f, true, false, clrBlack); fPageSize = fWriter.GetPageSize(); float pageHeight = fPageSize.GetHeight(); float pageWidth = fPageSize.GetWidth(); float halfpage = (pageHeight - (((PDFWriter.FontHandler)titleFont).GetTextHeight())) / 2f; fWriter.NewLine(0.0f, halfpage); fWriter.AddParagraph(fTitle, titleFont, TextAlignment.taCenter); var chartOptions = new TreeChartOptions(); chartOptions.Assign(GlobalOptions.Instance.TreeChartOptions); chartOptions.DefaultPortraits = false; chartOptions.HideUnknownSpouses = true; chartOptions.InvertedTree = false; chartOptions.Kinship = false; chartOptions.ShowPlaces = false; var treeBox = AppHost.Container.Resolve <ITreeChart>(); treeBox.SetRenderer(fRenderer); treeBox.Base = fBase; treeBox.Options = chartOptions; treeBox.Height = (int)pageHeight; treeBox.Width = (int)pageWidth; fPatList = PatriarchsMan.GetPatriarchsList(fBase.Context, 2, false); fPatList.QuickSort(PatriarchsCompare); int num = fPatList.Count; for (int i = 0; i < num; i++) { var patriarch = fPatList[i].IRec; fIndiQueue.Clear(); fIndiQueue.Add(new IndiObj(patriarch, TreeChartKind.ckDescendants)); for (int q = 0; q < fIndiQueue.Count; q++) { fWriter.NewPage(); TryRenderTreeSlice(treeBox, q, patriarch); } } #endif } catch (Exception ex) { Logger.WriteError("TreesAlbumExporter.InternalGenerate()", ex); throw; } }