コード例 #1
0
ファイル: VisualObject.cs プロジェクト: abdurrm/gedtovisio
 string IndiStr(Individual indi)
 {
     return string.Format("{0} {1}", indi.GivenName, indi.Surname);
 }
コード例 #2
0
ファイル: GedcomFile.cs プロジェクト: abdurrm/gedtovisio
        private void ProcessRootLevel(string[] lineArray)
        {
            switch (_currentRecord)
            {
                case GedcomRecordEnum.Individual:
                    Individuals.Add(_currentIndividual);
                    break;
                case GedcomRecordEnum.Family:
                    Families.Add(_currentFamily);
                    break;
                case GedcomRecordEnum.Note:
                    Notes.Add(_currentNote);
                    break;
            }

            if (lineArray[1] == "HEAD")
            {
                    _currentRecord = GedcomRecordEnum.Header;
                    _currentSubRecord = GedcomSubRecordEnum.None;
            } else if (lineArray[1].IndexOf("@") >= 0) {
                switch (lineArray[2])
                {
                    case "INDI":
                        _currentRecord = GedcomRecordEnum.Individual;
                        _currentIndividual = new Individual { Id = lineArray[1] };
                        _currentSubRecord = GedcomSubRecordEnum.None;
                        break;
                    case "FAM":
                        _currentRecord = GedcomRecordEnum.Family;
                        _currentFamily = new Family { Id = lineArray[1] };
                        _currentSubRecord = GedcomSubRecordEnum.None;
                        break;
                    case "NOTE":
                        _currentRecord = GedcomRecordEnum.Note;
                        _currentNote = new Note { Id = lineArray[1] };
                        _currentSubRecord = GedcomSubRecordEnum.None;
                        break;
                }
            }
        }
コード例 #3
0
ファイル: VisioRenderer.cs プロジェクト: abdurrm/gedtovisio
        Shape Render(Individual indi, double x, double y)
        {
            const double height = 0.5;
            const double width = 1.7;

            //var shape = _page.DrawRectangle(x - width / 2, y - height / 2, x + width / 2, y + height / 2);
            var shape = VisioHelper.DrawRectangle(_page, x - width / 2, y - height / 2, x + width / 2, y + height / 2);

            var notes = string.Join("\n", indi.Notes);
            shape.Text = string.Format("{0}{1}\n{2}{3}", indi.GivenName,
                string.IsNullOrEmpty(indi.Surname) ? "" : string.Format(" /{0}/", indi.Surname),
                string.IsNullOrEmpty(indi.BirthDate) && string.IsNullOrEmpty(indi.DiedDate) ? ""
                    : string.Format("{0} - {1}", FormatDate(indi.BirthDate), FormatDate(indi.DiedDate)),
                string.IsNullOrEmpty(notes) ? "" : "\n" + notes
                );

            shape.Characters.CharProps[(short)VisCellIndices.visCharacterSize] = 10;
            if (indi.Sex == "F")
            {
                shape.CellsU["Rounding"].FormulaU = ".2";
            }

            VisioHelper.SetCustomProperty(shape, "_UID", "Unique Identification Number", indi.Uid);
            VisioHelper.SetCustomProperty(shape, "ID", "gedcom ID", indi.Id);
            VisioHelper.SetCustomProperty(shape, "GivenName", indi.GivenName);
            VisioHelper.SetCustomProperty(shape, "Surname", indi.Surname);
            VisioHelper.SetCustomProperty(shape, "Sex", indi.Sex);
            VisioHelper.SetCustomProperty(shape, "BirthDate", indi.BirthDate);
            VisioHelper.SetCustomProperty(shape, "DiedDate", indi.DiedDate);
            VisioHelper.SetCustomProperty(shape, "Notes", notes);

            return shape;
        }