예제 #1
0
        public void RenameLocationRecord(GDMLocationRecord locRec)
        {
            if (locRec == null)
            {
                return;
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                var evsRec = fRecords[i] as GDMRecordWithEvents;
                if (evsRec != null)
                {
                    for (int j = evsRec.Events.Count - 1; j >= 0; j--)
                    {
                        GDMPlace evPlace = evsRec.Events[j].Place;

                        if (evPlace.Location.Value == locRec)
                        {
                            evPlace.StringValue = locRec.LocationName;
                        }
                    }
                }
            }
        }
예제 #2
0
        public GDMSourceEvent(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.EVEN);

            fDate  = new GDMDatePeriod(this);
            fPlace = new GDMPlace(this);
        }
예제 #3
0
        public void Test_Common()
        {
            using (GDMPlace place = new GDMPlace(null)) {
                Assert.IsNotNull(place);

                place.Form = "abrakadabra";
                Assert.AreEqual("abrakadabra", place.Form);

                Assert.IsNotNull(place.Map);
                Assert.IsNotNull(place.Location);

                var note = new GDMNotes(place);
                note.Lines.Text = "place notes";
                place.Notes.Add(note);

                using (GDMPlace place2 = new GDMPlace(null)) {
                    Assert.Throws(typeof(ArgumentException), () => {
                        place2.Assign(null);
                    });

                    place2.Assign(place);

                    string buf = TestUtils.GetTagStreamText(place2, 1);
                    Assert.AreEqual("1 PLAC\r\n" +
                                    "2 NOTE place notes\r\n" +
                                    "2 FORM abrakadabra\r\n", buf);
                }

                place.ReplaceXRefs(new GDMXRefReplacer());

                Assert.IsFalse(place.IsEmpty());
                place.Clear();
                Assert.IsTrue(place.IsEmpty());
            }
        }
예제 #4
0
        public void RenameLocationRecord(GDMLocationRecord locRec)
        {
            if (locRec == null)
            {
                return;
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                var evsRec = fRecords[i] as GDMRecordWithEvents;
                if (evsRec == null || !evsRec.HasEvents)
                {
                    continue;
                }

                for (int j = evsRec.Events.Count - 1; j >= 0; j--)
                {
                    var evt = evsRec.Events[j];
                    if (!evt.HasPlace)
                    {
                        continue;
                    }

                    GDMPlace evPlace = evt.Place;
                    if (evPlace.Location.XRef == locRec.XRef)
                    {
                        evPlace.StringValue = locRec.LocationName;
                    }
                }
            }
        }
예제 #5
0
        public GDMSourceEvent()
        {
            SetName(GEDCOMTagType.EVEN);

            fDate  = new GDMDatePeriod();
            fPlace = new GDMPlace();
        }
예제 #6
0
 protected GDMCustomEvent(GDMObject owner) : base(owner)
 {
     fAddress         = new GDMAddress(this);
     fDate            = new GDMDateValue(this);
     fPlace           = new GDMPlace(this);
     fNotes           = new GDMList <GDMNotes>(this);
     fSourceCitations = new GDMList <GDMSourceCitation>(this);
     fMultimediaLinks = new GDMList <GDMMultimediaLink>(this);
 }
예제 #7
0
 protected GDMCustomEvent()
 {
     fAddress         = new GDMAddress();
     fDate            = new GDMDateValue();
     fPlace           = new GDMPlace();
     fNotes           = new GDMList <GDMNotes>();
     fSourceCitations = new GDMList <GDMSourceCitation>();
     fMultimediaLinks = new GDMList <GDMMultimediaLink>();
 }
예제 #8
0
        public GDMHeader(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.HEAD);

            fCharacterSet = new GDMHeaderCharSet(this);
            fFile         = new GDMHeaderFile(this);
            fGEDCOM       = new GDMHeaderGEDCOM(this);
            fNote         = new GDMTextTag(this, (int)GEDCOMTagType.NOTE);
            fPlace        = new GDMPlace(this);
            fSource       = new GDMHeaderSource(this);
            fSubmission   = new GDMPointer(this, (int)GEDCOMTagType.SUBN, string.Empty);
            fSubmitter    = new GDMPointer(this, (int)GEDCOMTagType.SUBM, string.Empty);
        }
예제 #9
0
        public GDMHeader()
        {
            SetName(GEDCOMTagType.HEAD);

            fCharacterSet = new GDMHeaderCharSet();
            fFile         = new GDMHeaderFile();
            fGEDCOM       = new GDMHeaderGEDCOM();
            fNote         = new GDMTextTag((int)GEDCOMTagType.NOTE);
            fPlace        = new GDMPlace();
            fSource       = new GDMHeaderSource();
            fSubmission   = new GDMPointer((int)GEDCOMTagType.SUBN, string.Empty);
            fSubmitter    = new GDMPointer((int)GEDCOMTagType.SUBM, string.Empty);
        }
예제 #10
0
        public override void Assign(GDMTag source)
        {
            GDMPlace otherPlace = (source as GDMPlace);

            if (otherPlace == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "source");
            }

            base.Assign(otherPlace);

            fForm = otherPlace.fForm;
            fLocation.Assign(otherPlace.fLocation);
            fMap.Assign(otherPlace.fMap);
        }
예제 #11
0
        public void Test_Common()
        {
            using (GDMPlace place = new GDMPlace()) {
                Assert.IsNotNull(place);

                place.Form = "abrakadabra";
                Assert.AreEqual("abrakadabra", place.Form);

                Assert.IsNotNull(place.Map);
                Assert.IsNotNull(place.Location);

                var note = new GDMNotes();
                note.Lines.Text = "place notes";
                place.Notes.Add(note);

                using (GDMPlace place2 = new GDMPlace()) {
                    Assert.Throws(typeof(ArgumentException), () => {
                        place2.Assign(null);
                    });

                    var iRec = new GDMIndividualRecord(null);
                    var evt  = new GDMIndividualEvent();
                    evt.SetName("BIRT");
                    iRec.Events.Add(evt);
                    //place2.Assign(place);
                    evt.Place.Assign(place);

                    string buf = TestUtils.GetTagStreamText(iRec, 1);
                    Assert.AreEqual("0 INDI\r\n" +
                                    "1 SEX U\r\n" +
                                    "1 BIRT\r\n" +
                                    "2 PLAC\r\n" +
                                    "3 NOTE place notes\r\n" +
                                    "3 FORM abrakadabra\r\n", buf);
                }

                place.ReplaceXRefs(new GDMXRefReplacer());

                Assert.IsFalse(place.IsEmpty());
                place.Clear();
                Assert.IsTrue(place.IsEmpty());
            }
        }
예제 #12
0
        public void Test_GEDCOMTagWithLists()
        {
            // GDMTagWithLists protected class, derived - GDMPlace
            using (GDMPlace tag = new GDMPlace(null)) {
                Assert.IsNotNull(tag);

                Assert.IsNotNull(tag.Notes);
                Assert.IsNotNull(tag.SourceCitations);
                Assert.IsNotNull(tag.MultimediaLinks);

                Assert.IsNull(tag.AddNote(null));
                Assert.IsNull(tag.AddSource(null, "page", 1));
                Assert.IsNull(tag.AddMultimedia(null));

                Assert.IsNotNull(tag.AddNote(new GDMNoteRecord(null)));
                Assert.IsNotNull(tag.AddSource(new GDMSourceRecord(null), "page", 1));
                Assert.IsNotNull(tag.AddMultimedia(new GDMMultimediaRecord(null)));
            }
        }
예제 #13
0
 protected GDMCustomEvent(GDMObject owner) : base(owner)
 {
     fAddress = new GDMAddress(this);
     fDate    = new GDMDateValue(this);
     fPlace   = new GDMPlace(this);
 }