Exemple #1
0
        public void TestExample()
        {
            PlaceDescription         popesCreek    = CreatePopesCreek();
            PlaceDescription         mountVernon   = CreateMountVernon();
            PlaceDescription         chestnutGrove = CreateChestnutGrove();
            Person                   george        = CreateGeorge(popesCreek, mountVernon);
            Person                   martha        = CreateMartha(chestnutGrove, mountVernon);
            Relationship             marriage      = CreateMarriage(george, martha);
            List <SourceDescription> sources       = CiteGeorgeMarthaAndMarriage(george, martha, marriage);
            Agent contributor = CreateContributor();

            Gx.Gedcomx gx = new Gx.Gedcomx();
            gx.Persons = new List <Person>()
            {
                george, martha
            };
            gx.SetRelationship(marriage);
            gx.SourceDescriptions = sources;
            gx.SetAgent(contributor);
            gx.SetAttribution(new Attribution());
            gx.Attribution.SetContributor(new ResourceReference());
            gx.Attribution.Contributor.SetResource("#" + contributor.Id);
            gx.Places = new List <PlaceDescription>()
            {
                popesCreek, mountVernon, chestnutGrove
            };

            xmlSerializer.Deserialize <Gx.Gedcomx>(xmlSerializer.Serialize(gx));
            jsonSerializer.Deserialize <Gx.Gedcomx>(jsonSerializer.Serialize(gx));
        }
Exemple #2
0
        private Person CreateMartha(PlaceDescription birthPlace, PlaceDescription deathPlace)
        {
            Person person = new Person();

            person.SetGender(new Gender(GenderType.Male));

            Fact fact = new Fact();

            fact.SetId("321");
            fact.SetType(FactType.Birth);

            fact.SetDate(new DateInfo());
            fact.Date.SetOriginal("June 2, 1731");
            fact.Date.SetFormal("+1731-06-02");

            fact.SetPlace(new PlaceReference());
            fact.Place.SetOriginal(birthPlace.Names[0].Value.ToLower());
            fact.Place.DescriptionRef = "#" + birthPlace.Id;

            person.AddFact(fact);

            fact = new Fact();
            fact.SetId("654");
            fact.SetType(FactType.Death);

            fact.SetDate(new DateInfo());
            fact.Date.SetOriginal("May 22, 1802");
            fact.Date.SetFormal("+1802-05-22");

            fact.SetPlace(new PlaceReference());
            fact.Place.SetOriginal(deathPlace.Names[0].Value.ToLower());
            fact.Place.DescriptionRef = "#" + deathPlace.Id;

            person.AddFact(fact);

            List <Name> names    = new List <Name>();
            Name        name     = new Name();
            NameForm    nameForm = new NameForm();

            nameForm.SetFullText("Martha Dandridge Custis");
            List <NamePart> parts = new List <NamePart>();
            NamePart        part  = new NamePart();

            part.SetType(NamePartType.Given);
            part.SetValue("Martha Dandridge");
            parts.Add(part);
            part = new NamePart();
            part.SetType(NamePartType.Surname);
            part.SetValue("Custis");
            parts.Add(part);
            nameForm.Parts = parts;
            name.SetNameForm(nameForm);
            name.SetId("987");
            names.Add(name);
            person.Names = names;

            person.SetId("CCC-CCCC");

            return(person);
        }
Exemple #3
0
        private Person CreateGeorge(PlaceDescription birthPlace, PlaceDescription deathPlace)
        {
            Person person = new Person();

            person.SetGender(new Gender(GenderType.Male));

            Fact fact = new Fact();

            fact.SetId("123");
            fact.SetType(FactType.Birth);

            fact.SetDate(new DateInfo());
            fact.Date.SetOriginal("February 22, 1732");
            fact.Date.SetFormal("+1732-02-22");

            fact.SetPlace(new PlaceReference());
            fact.Place.SetOriginal(birthPlace.Names[0].Value.ToLower());
            fact.Place.DescriptionRef = "#" + birthPlace.Id;

            person.AddFact(fact);

            fact = new Fact();
            fact.SetId("456");
            fact.SetType(FactType.Death);

            fact.SetDate(new DateInfo());
            fact.Date.SetOriginal("December 14, 1799");
            fact.Date.SetFormal("+1799-12-14T22:00:00");

            fact.SetPlace(new PlaceReference());
            fact.Place.SetOriginal(deathPlace.Names[0].Value.ToLower());
            fact.Place.DescriptionRef = "#" + deathPlace.Id;

            person.AddFact(fact);

            List <Name> names    = new List <Name>();
            Name        name     = new Name();
            NameForm    nameForm = new NameForm();

            nameForm.SetFullText("George Washington");
            List <NamePart> parts = new List <NamePart>();
            NamePart        part  = new NamePart();

            part.SetType(NamePartType.Given);
            part.SetValue("George");
            parts.Add(part);
            part = new NamePart();
            part.SetType(NamePartType.Surname);
            part.SetValue("Washington");
            parts.Add(part);
            nameForm.Parts = parts;
            name.SetNameForm(nameForm);
            name.SetId("789");
            names.Add(name);
            person.Names = names;

            person.SetId("BBB-BBBB");

            return(person);
        }
Exemple #4
0
        /// <summary>
        /// Adds a place description to the current collection of place descriptions.
        /// </summary>
        /// <param name="place">The place description to add.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="PlaceDescriptionState"/> instance containing the REST API response.
        /// </returns>
        public PlaceDescriptionState AddPlaceDescription(PlaceDescription place, params IStateTransitionOption[] options)
        {
            Gedcomx entity = new Gedcomx();

            entity.AddPlace(place);
            IRestRequest request = CreateAuthenticatedGedcomxRequest().SetEntity(entity).Build(GetSelfUri(), Method.POST);

            return(this.stateFactory.NewPlaceDescriptionState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
Exemple #5
0
        private PlaceDescription CreateChestnutGrove()
        {
            PlaceDescription place = new PlaceDescription();

            place.SetId("KKK");
            place.SetLatitude(37.518304);
            place.SetLongitude(-76.984148);
            place.SetName("Chestnut Grove, New Kent, Virginia, United States");
            return(place);
        }
Exemple #6
0
        private PlaceDescription CreateMountVernon()
        {
            PlaceDescription place = new PlaceDescription();

            place.SetId("999");
            place.SetLatitude(38.721144);
            place.SetLongitude(-77.109461);
            place.SetName("Mount Vernon, Fairfax County, Virginia, United States");
            return(place);
        }
Exemple #7
0
        private PlaceDescription CreatePopesCreek()
        {
            PlaceDescription place = new PlaceDescription();

            place.SetId("888");
            place.SetLatitude(38.192353);
            place.SetLongitude(-76.904069);
            place.SetName("Pope's Creek, Westmoreland, Virginia, United States");
            return(place);
        }
Exemple #8
0
 /// <summary>
 /// Add a place to the data set.
 /// </summary>
 /// <param name="place">The place to be added.</param>
 public void AddPlace(PlaceDescription place)
 {
     if (place != null)
     {
         if (Places == null)
         {
             Places = new List <PlaceDescription>();
         }
         Places.Add(place);
     }
 }
 public virtual void VisitPlaceDescription(PlaceDescription place)
 {
     this.contextStack.Push(place);
     VisitSubject(place);
     this.contextStack.Pop();
 }
Exemple #10
0
 /**
  * Build this out with a place.
  * @param place The place.
  * @return this.
  */
 public Gedcomx SetPlace(PlaceDescription place)
 {
     AddPlace(place);
     return(this);
 }
Exemple #11
0
 public override void VisitPlaceDescription(PlaceDescription place)
 {
     BindIfNeeded(place);
     base.VisitPlaceDescription(place);
 }