public static ExtensibleData Resolve(ResourceReference @ref, Gx.Gedcomx document)
        {
            if (@ref.Resource == null)
            {
                return null;
            }

            return Resolve(@ref.Resource, document);
        }
 /// <summary>
 /// Adds the specified GEDCOM X entity to the current GEDCOM X file.
 /// </summary>
 /// <param name="resource">The entity to add.</param>
 /// <param name="lastModified">The last modified to specify for the entity being added.</param>
 public void AddResource(Gx.Gedcomx resource, DateTime? lastModified)
 {
     StringBuilder entryName = new StringBuilder("tree");
     if (this.entryCount > 0)
     {
         entryName.Append(this.entryCount);
     }
     entryName.Append(".xml");
     AddResource(entryName.ToString(), resource, lastModified);
 }
Example #3
0
 public override string ToString()
 {
     return(string.Format("G:({0}, {1}, {2}) M:({3}, {4}, {5})",
                          Gx.ToString(Format),
                          Gy.ToString(Format),
                          Gz.ToString(Format),
                          Mx.ToString(Format),
                          My.ToString(Format),
                          Mz.ToString(Format)));
 }
        /// <summary>
        /// Reads merge options for the specified search result from <see cref="P:Results.Entries"/>.
        /// </summary>
        /// <param name="entry">A search result entry from <see cref="P:Results.Entries"/>.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="PersonMergeState"/> instance containing the REST API response.
        /// </returns>
        public PersonMergeState ReadMergeOptions(Gx.Atom.Entry entry, params IStateTransitionOption[] options)
        {
            Link link = entry.GetLink(Rel.MERGE);
            if (link == null || link.Href == null)
            {
                return null;
            }

            IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(link.Href, Method.OPTIONS);
            return ((FamilySearchStateFactory)this.stateFactory).NewPersonMergeState(request, Invoke(request, options), this.Client, this.CurrentAccessToken);
        }
        public static ExtensibleData Resolve(String @ref, Gx.Gedcomx document)
        {
            if ([email protected]().StartsWith("#"))
            {
                return null;
            }

            GedcomxLocalReferenceResolver visitor = new GedcomxLocalReferenceResolver(@ref.ToString().Substring(1));
            document.Accept(visitor);
            return visitor.Resource;
        }
Example #6
0
        private double CalcInterpolationError() //Maximum interp error among interpolation points
        {
            double error = 0;

            Point[] interpolationPoints = Lp.GetPointCollection();
            Func <double, double> gx    = Gx.CompileDynamicMethod();

            for (int i = 0; i < interpolationPoints.Length; i++)
            {
                double gxValue = gx(interpolationPoints[i].X);
                if (gxValue != interpolationPoints[i].Y)
                {
                    error = Math.Max(gxValue, error);
                }
            }
            return(error);
        }
Example #7
0
        public override Bitmap ProcessImage(Bitmap SourceImage, BackgroundWorker worker)
        {
            Bitmap ResultImage = new Bitmap(SourceImage.Width, SourceImage.Height);
            int    R, G, B;
            int    R_x, G_x, B_x;
            int    R_y, G_y, B_y;
            SharrX filterX = new SharrX();
            SharrY filterY = new SharrY();
            Bitmap Gx, Gy;

            Gx = filterX.ProcessImage(SourceImage, worker);
            Gy = filterY.ProcessImage(SourceImage, worker);
            for (int i = 0; i < SourceImage.Width; i++)
            {
                worker.ReportProgress((int)((float)i / ResultImage.Width * 100));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < SourceImage.Height; j++)
                {
                    R_x = (int)Gx.GetPixel(i, j).R;
                    G_x = (int)Gx.GetPixel(i, j).G;
                    B_x = (int)Gx.GetPixel(i, j).B;

                    R_y = (int)Gy.GetPixel(i, j).R;
                    G_y = (int)Gy.GetPixel(i, j).G;
                    B_y = (int)Gy.GetPixel(i, j).B;


                    R = Clamp((int)Math.Sqrt(Math.Pow(R_x, 2) + Math.Pow(R_y, 2)), 0, 255);
                    G = Clamp((int)Math.Sqrt(Math.Pow(G_x, 2) + Math.Pow(G_y, 2)), 0, 255);
                    B = Clamp((int)Math.Sqrt(Math.Pow(B_x, 2) + Math.Pow(B_y, 2)), 0, 255);

                    ResultImage.SetPixel(i, j, Color.FromArgb(R, G, B));
                }
            }
            return(ResultImage);
        }
 /// <summary>
 /// Visits the source description.
 /// </summary>
 /// <param name="sourceDescription">The source description to visit.</param>
 public override void VisitSourceDescription(Gx.Source.SourceDescription sourceDescription)
 {
     if (sourceDescription.Id != null)
     {
         this.dictionary.Add(sourceDescription.Id, sourceDescription);
     }
     base.VisitSourceDescription(sourceDescription);
 }
 /// <summary>
 /// Visits the source citation.
 /// </summary>
 /// <param name="citation">The source citation to visit.</param>
 public override void VisitSourceCitation(Gx.Source.SourceCitation citation)
 {
     if (citation.Id != null)
     {
         this.dictionary.Add(citation.Id, citation);
     }
     base.VisitSourceCitation(citation);
 }
 /// <summary>
 /// Visits the event role.
 /// </summary>
 /// <param name="role">The event role to visit.</param>
 public override void VisitEventRole(Gx.Conclusion.EventRole role)
 {
     if (role.Id != null)
     {
         this.dictionary.Add(role.Id, role);
     }
     base.VisitEventRole(role);
 }
 /// <summary>
 /// Visits the agent.
 /// </summary>
 /// <param name="agent">The agent to visit.</param>
 public override void VisitAgent(Gx.Agent.Agent agent)
 {
     if (agent.Id != null)
     {
         this.dictionary.Add(agent.Id, agent);
     }
     base.VisitAgent(agent);
 }
 /// <summary>
 /// Visits the note.
 /// </summary>
 /// <param name="note">The note to visit.</param>
 public override void VisitNote(Gx.Common.Note note)
 {
     if (note.Id != null)
     {
         this.dictionary.Add(note.Id, note);
     }
     base.VisitNote(note);
 }
 /// <summary>
 /// Visits the agent.
 /// </summary>
 /// <param name="agent">The agent to visit.</param>
 /// <remarks>This specific class implementation does not currently visit the agent.</remarks>
 public virtual void VisitAgent(Gx.Agent.Agent agent)
 {
     //no-op.
 }
 /// <summary>
 /// Visits the name form.
 /// </summary>
 /// <param name="form">The name form to visit.</param>
 public override void VisitNameForm(Gx.Conclusion.NameForm form)
 {
     if (form.Id != null)
     {
         this.dictionary.Add(form.Id, form);
     }
     base.VisitNameForm(form);
 }
Example #15
0
 public override int GetHashCode()
 {
     return(Gx.GetHashCode() ^ Gy.GetHashCode() ^ Gz.GetHashCode() ^
            Mx.GetHashCode() ^ My.GetHashCode() ^ Mz.GetHashCode());
 }
 /// <summary>
 /// Visits the fact.
 /// </summary>
 /// <param name="fact">The fact to visit.</param>
 public override void VisitFact(Gx.Conclusion.Fact fact)
 {
     if (fact.Id != null)
     {
         this.dictionary.Add(fact.Id, fact);
     }
     base.VisitFact(fact);
 }
 /// <summary>
 /// Visits the date.
 /// </summary>
 /// <param name="date">The date to visit.</param>
 public override void VisitDate(Gx.Conclusion.DateInfo date)
 {
     if (date.Id != null)
     {
         this.dictionary.Add(date.Id, date);
     }
     base.VisitDate(date);
 }
 /**
  * Build out this source description with a repository.
  *
  * @param repository The repository.
  * @return this.
  */
 public SourceDescription SetRepository(Gx.Agent.Agent repository)
 {
     return SetRepository(new ResourceReference("#" + repository.Id));
 }
Example #19
0
 /**
  * Build this out with a agent.
  * @param agent The agent.
  * @return this.
  */
 public Gedcomx SetAgent(Gx.Agent.Agent agent)
 {
     AddAgent(agent);
     return this;
 }
Example #20
0
 /// <summary>
 /// Add a agent to the data set.
 /// </summary>
 /// <param name="agent">The agent to be added.</param>
 public void AddAgent(Gx.Agent.Agent agent)
 {
     if (agent != null)
     {
         if (Agents == null)
             Agents = new List<Gx.Agent.Agent>();
         Agents.Add(agent);
     }
 }
 /// <summary>
 /// Visits the relationship.
 /// </summary>
 /// <param name="relationship">The relationship to visit.</param>
 public override void VisitRelationship(Gx.Conclusion.Relationship relationship)
 {
     if (relationship.Id != null)
     {
         this.dictionary.Add(relationship.Id, relationship);
     }
     base.VisitRelationship(relationship);
 }
 /// <summary>
 /// Visits the gender.
 /// </summary>
 /// <param name="gender">The gender to visit.</param>
 public override void VisitGender(Gx.Conclusion.Gender gender)
 {
     if (gender.Id != null)
     {
         this.dictionary.Add(gender.Id, gender);
     }
     base.VisitGender(gender);
 }
 /// <summary>
 /// Visits the person.
 /// </summary>
 /// <param name="person">The person to visit.</param>
 public override void VisitPerson(Gx.Conclusion.Person person)
 {
     if (person.Id != null)
     {
         this.dictionary.Add(person.Id, person);
     }
     base.VisitPerson(person);
 }
        /// <summary>
        /// Visits the conclusion.
        /// </summary>
        /// <param name="conclusion">The conclusion to visit.</param>
        protected void VisitConclusion(Gx.Conclusion.Conclusion conclusion)
        {
            if (conclusion.Sources != null)
            {
                foreach (SourceReference sourceReference in conclusion.Sources)
                {
                    VisitSourceReference(sourceReference);
                }
            }

            if (conclusion.Notes != null)
            {
                foreach (Note note in conclusion.Notes)
                {
                    VisitNote(note);
                }
            }
        }
 /// <summary>
 /// Visits the place reference.
 /// </summary>
 /// <param name="place">The place reference to visit.</param>
 public override void VisitPlaceReference(Gx.Conclusion.PlaceReference place)
 {
     if (place.Id != null)
     {
         this.dictionary.Add(place.Id, place);
     }
     base.VisitPlaceReference(place);
 }
Example #26
0
 /**
  * Build up this attribution with a contributor.
  *
  * @param agent The contributor.
  * @return this.
  */
 public Attribution SetContributor(Gx.Agent.Agent agent)
 {
     if (agent.Id == null)
     {
         throw new ArgumentException("Can't reference agent as a contributor: no id.");
     }
     return SetContributor(new ResourceReference("#" + agent.Id));
 }
 /// <summary>
 /// Visits the name.
 /// </summary>
 /// <param name="name">The name to visit.</param>
 public override void VisitName(Gx.Conclusion.Name name)
 {
     if (name.Id != null)
     {
         this.dictionary.Add(name.Id, name);
     }
     base.VisitName(name);
 }
 /// <summary>
 /// Visits the specified <see cref="Gx.Gedcomx"/> entity.
 /// </summary>
 /// <param name="gx">The <see cref="Gx.Gedcomx"/> entity to visit.</param>
 public override void VisitGedcomx(Gx.Gedcomx gx)
 {
     if (gx.Id != null)
     {
         this.dictionary.Add(gx.Id, gx);
     }
     base.VisitGedcomx(gx);
 }
 /// <summary>
 /// Visits the name part.
 /// </summary>
 /// <param name="part">The name part to visit.</param>
 public override void VisitNamePart(Gx.Conclusion.NamePart part)
 {
     if (part.Id != null)
     {
         this.dictionary.Add(part.Id, part);
     }
     base.VisitNamePart(part);
 }
 /// <summary>
 /// Visits the document.
 /// </summary>
 /// <param name="document">The document to visit.</param>
 public override void VisitDocument(Gx.Conclusion.Document document)
 {
     if (document.Id != null)
     {
         this.dictionary.Add(document.Id, document);
     }
     base.VisitDocument(document);
 }
 /// <summary>
 /// Visits the source reference.
 /// </summary>
 /// <param name="sourceReference">The source reference to visit.</param>
 public override void VisitSourceReference(Gx.Source.SourceReference sourceReference)
 {
     if (sourceReference.Id != null)
     {
         this.dictionary.Add(sourceReference.Id, sourceReference);
     }
     base.VisitSourceReference(sourceReference);
 }
 /// <summary>
 /// Visits the place description.
 /// </summary>
 /// <param name="place">The place description to visit.</param>
 public override void VisitPlaceDescription(Gx.Conclusion.PlaceDescription place)
 {
     if (place.Id != null)
     {
         this.dictionary.Add(place.Id, place);
     }
     base.VisitPlaceDescription(place);
 }
        public virtual void VisitGedcomx(Gx.Gedcomx gx)
        {
            this.contextStack.Push(gx);

            List<Person> persons = gx.Persons;
            if (persons != null)
            {
                foreach (Person person in persons)
                {
                    if (person != null)
                    {
                        person.Accept(this);
                    }
                }
            }

            List<Relationship> relationships = gx.Relationships;
            if (relationships != null)
            {
                foreach (Relationship relationship in relationships)
                {
                    if (relationship != null)
                    {
                        relationship.Accept(this);
                    }
                }
            }

            List<SourceDescription> sourceDescriptions = gx.SourceDescriptions;
            if (sourceDescriptions != null)
            {
                foreach (SourceDescription sourceDescription in sourceDescriptions)
                {
                    if (sourceDescription != null)
                    {
                        sourceDescription.Accept(this);
                    }
                }
            }

            List<Agent> agents = gx.Agents;
            if (agents != null)
            {
                foreach (Agent agent in agents)
                {
                    if (agent != null)
                    {
                        agent.Accept(this);
                    }
                }
            }

            List<Event> events = gx.Events;
            if (events != null)
            {
                foreach (Event @event in events)
                {
                    if (@event != null)
                    {
                        @event.Accept(this);
                    }
                }
            }

            List<PlaceDescription> places = gx.Places;
            if (places != null)
            {
                foreach (PlaceDescription place in places)
                {
                    if (place != null)
                    {
                        place.Accept(this);
                    }
                }
            }

            List<Document> documents = gx.Documents;
            if (documents != null)
            {
                foreach (Document document in documents)
                {
                    if (document != null)
                    {
                        document.Accept(this);
                    }
                }
            }

            List<Field> fields = gx.Fields;
            if (fields != null)
            {
                foreach (Field field in fields)
                {
                    if (field != null)
                    {
                        field.Accept(this);
                    }
                }
            }

            List<RecordDescriptor> recordDescriptors = gx.RecordDescriptors;
            if (recordDescriptors != null)
            {
                foreach (RecordDescriptor rd in recordDescriptors)
                {
                    if (rd != null)
                    {
                        rd.Accept(this);
                    }
                }
            }

            List<Collection> collections = gx.Collections;
            if (collections != null)
            {
                foreach (Collection collection in collections)
                {
                    if (collection != null)
                    {
                        collection.Accept(this);
                    }
                }
            }

            this.contextStack.Pop();
        }
 /// <summary>
 /// Visits the event.
 /// </summary>
 /// <param name="e">The event to visit.</param>
 public override void VisitEvent(Gx.Conclusion.Event e)
 {
     if (e.Id != null)
     {
         this.dictionary.Add(e.Id, e);
     }
     base.VisitEvent(e);
 }