Пример #1
0
        private void ExposePerson(ColumnText mct, GEDCOMIndividualRecord iRec, string iName, float colWidth)
        {
            Paragraph pg    = new Paragraph();
            Chunk     chunk = new Chunk(iName, fBoldFont);

            chunk.SetLocalDestination(iRec.XRef);
            pg.Add(chunk);
            chunk = new Chunk(GKUtils.GetPedigreeLifeStr(iRec, PedigreeFormat.Compact), fTextFont);
            pg.Add(chunk);
            pg.KeepTogether = true;
            mct.AddElement(pg);

            // FIXME
            IImage image = fBase.Context.GetPrimaryBitmap(iRec, 0, 0, false);

            if (image != null)
            {
                itImage img = TreeChartPDFRenderer.ConvertImage(image);

                float fitWidth = colWidth * 0.5f;
                img.ScaleToFit(fitWidth, fitWidth);

                // FIXME: the moving, if the page height is insufficient for the image height

                //img.Alignment = Image.TEXTWRAP;
                img.IndentationLeft = 5f;
                img.SpacingBefore   = 5f;
                img.SpacingAfter    = 5f;

                //Paragraph imgpar = new Paragraph(new Chunk(img, 0, 0, true));
                //imgpar.KeepTogether = true;

                mct.AddElement(img);
            }

            GEDCOMIndividualRecord father, mother;
            GEDCOMFamilyRecord     fam = iRec.GetParentsFamily();

            if (fam == null)
            {
                father = null;
                mother = null;
            }
            else
            {
                father = fam.GetHusband();
                mother = fam.GetWife();
            }

            if (father != null)
            {
                pg    = new Paragraph();
                chunk = new Chunk(GKUtils.GetNameString(father, true, false), fLinkFont);
                chunk.SetLocalGoto(father.XRef);
                pg.Add(new Chunk(LangMan.LS(LSID.LSID_Father) + ": ", fTextFont)); pg.Add(chunk);
                mct.AddElement(pg);
            }

            if (mother != null)
            {
                pg    = new Paragraph();
                chunk = new Chunk(GKUtils.GetNameString(mother, true, false), fLinkFont);
                chunk.SetLocalGoto(mother.XRef);
                pg.Add(new Chunk(LangMan.LS(LSID.LSID_Mother) + ": ", fTextFont)); pg.Add(chunk);
                mct.AddElement(pg);
            }

            if (IncludeEvents && iRec.Events.Count != 0)
            {
                int num = iRec.Events.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = iRec.Events[i];
                    if (evt.Name == "BIRT" || evt.Name == "DEAT")
                    {
                        continue;
                    }

                    string evtName = GKUtils.GetEventName(evt);
                    string evtVal  = evt.StringValue;
                    string evtDesc = GKUtils.GetEventDesc(evt, false);

                    string tmp = evtName + ": " + evtVal;
                    if (evtVal != "")
                    {
                        tmp += ", ";
                    }
                    tmp += evtDesc;

                    mct.AddElement(new Paragraph(new Chunk(tmp, fTextFont)));
                }
            }

            if (IncludeNotes && iRec.Notes.Count != 0)
            {
                int num = iRec.Notes.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMNotes note = iRec.Notes[i];
                    mct.AddElement(new Paragraph(GKUtils.MergeStrings(note.Notes), fTextFont));
                }
            }
        }