private static void BuildSubThemeForMap(ThemeNode node, IMap map)
 {
     SubThemeNode newNode = new SubThemeNode(map.Name, node, new ThemeData(null, "Map Data Frame", null), null, null, null);
     node.Add(newNode);
     int count = map.LayerCount;
     for (int i = 0; i < count; i++)
         BuildSubThemeForLayer(newNode, map.Layer[i]);
 }
        private static void BuildSubThemeForLayer(ThemeNode node, ILayer subLayer)
        {
            if (subLayer is GroupLayer)
            {
                SubThemeNode newNode = new SubThemeNode(subLayer.Name, node, new ThemeData(null, "Group Layer", null), null, null, null);
                node.Add(newNode);
                BuildSubThemesForGroupLayer(newNode, subLayer);
            }
            else
            {
                string dataType = LayerUtilities.GetLayerDescriptionFromLayer(subLayer);
                ThemeData data = new ThemeData(null, dataType, null);

                BuildThemeDataForLayer(data, subLayer);

                Metadata md = Metadata.Find(data);
                TmNode newNode = new SubThemeNode(subLayer.Name, node, data, md, null, null);
                node.Add(newNode);
            }
        }
Esempio n. 3
0
        public void Load(XElement xele, bool recurse)
        {
            if (xele == null)
                throw new ArgumentNullException("xele");

            //Kind was already set when node was created.  Set all other properties
            Name = (string)xele.Attribute("name");
            XElement data = xele.Element("tags");
            Tags = data == null ? null : data.Value;
            data = xele.Element("summary");
            Summary = data == null ? null : data.Value;
            data = xele.Element("description");
            Description = data == null ? null : data.Value;
            data = xele.Element("pubdate");
            if (data != null)
            {
                DateTime temp;
                if (DateTime.TryParse(data.Value, out temp))
                    if (this is ThemeNode)
                        ((ThemeNode)this).PubDate = temp;
            }

            data = xele.Element("data");
            if (data != null)
            {
                // Ignore data elements for themelists.
                var themeNode = this as ThemeNode;
                if (themeNode != null)
                    (themeNode).Data = ThemeData.Load(data);
                var themeListNode = this as ThemeListNode;
                if (themeListNode != null)
                    (themeListNode).FilePath = data.Value;
            }

            data = xele.Element("metadata");
            if (data != null)
                Metadata = Metadata.Load(data);

            if (recurse)
            {
                TmNode childNode;

                foreach (XElement xnode in xele.Elements(CategoryNode.TypeString))
                {
                    childNode = new CategoryNode();
                    Add(childNode);
                    childNode.Load(xnode);
                }

                foreach (XElement xnode in xele.Elements(ThemeNode.TypeString))
                {
                    if (this is SubThemeNode || this is ThemeNode)
                        childNode = new SubThemeNode();
                    else
                        childNode = new ThemeNode();
                    Add(childNode);
                    childNode.Load(xnode);
                }
            }
        }