Exemple #1
0
        private static void AssertCollectionOfType <T>(string targetId, IReadOnlyCollection <KmlObject> collection)
        {
            KmlObject updateTarget = collection.Single();

            Assert.That(updateTarget, Is.TypeOf <T>());
            Assert.That(updateTarget.TargetId, Is.EqualTo(targetId));
        }
Exemple #2
0
 private static void ProcessChange(ChangeCollection change, KmlFile file)
 {
     foreach (KmlObject source in change)
     {
         if (source.TargetId != null)
         {
             KmlObject target = file.FindObject(source.TargetId);
             if (target != null)
             {
                 target.Merge(source);
                 target.TargetId = null; // Merge copied the TargetId from the source, but target shouldn't have it set
             }
         }
     }
 }
Exemple #3
0
        private void OnElementAdded(Element element)
        {
            // Map KmlObjects and related descendents
            KmlObject obj = element as KmlObject;

            if ((obj != null) && (obj.Id != null))
            {
                this.AddToDictionary(obj, this.objects);

                // Also map Styles, as StyleSelector inherits from KmlObject.
                // A shared style is defined to be a StyleSelector with an
                // id that is a child of a Document.
                StyleSelector style = element as StyleSelector;
                if (style != null)
                {
                    Document document = element.Parent as Document;
                    if (document != null)
                    {
                        this.AddToDictionary(style, this.styles);
                    }
                }
            }
        }