Exemple #1
0
        private static async Task BuildSubThemeForLayerAsync(TmNode node, IGisLayer subLayer)
        {
            ThemeData data = new ThemeData(null, subLayer.DataType);

            if (subLayer.IsGroup)
            {
                TmNode newNode = new TmNode(TmNodeType.Theme, subLayer.Name, node, data, null, null, null);
                node.Add(newNode);
                await BuildSubThemesForGroupLayerAsync(newNode, subLayer);
            }
            else
            {
                BuildThemeDataForLayer(data, subLayer);
                Metadata md = await Metadata.FromDataSourceAsync(data);

                TmNode newNode = new TmNode(TmNodeType.Theme, subLayer.Name, node, data, md, null, null);
                node.Add(newNode);
            }
        }
Exemple #2
0
        private void FillCategory(TmNode node, int catId)
        {
            //  A category can have categories and/or themes for children.
            List <Category> cats;

            _categoriesInCategories.TryGetValue(catId, out cats);
            if (cats != null)
            {
                foreach (Category cat in cats)
                {
                    TmNode newNode = new TmNode(TmNodeType.Category,
                                                cat.Name,
                                                node,
                                                null,
                                                MakeMetadataForCategory(cat.Link),
                                                cat.Description,
                                                null
                                                );
                    node.Add(newNode);
                    FillCategory(newNode, cat.Id);
                }
            }

            List <Theme> themes;

            _themesInCategories.TryGetValue(catId, out themes);
            if (themes != null)
            {
                foreach (Theme theme in themes)
                {
                    TmNode newNode = new TmNode(TmNodeType.Theme,
                                                theme.Name,
                                                node,
                                                MakeThemeData(theme.Name, theme.DataSource, theme.Type),
                                                MakeMetadataForTheme(theme.Metadata),
                                                null,
                                                theme.PubDate
                                                );
                    node.Add(newNode);
                    FillTheme(newNode, theme.Id);
                }
            }
        }
Exemple #3
0
        private void FillTheme(TmNode node, int themeId)
        {
            //  A theme can have only themes for children.
            List <Theme> themes;

            _themesInThemes.TryGetValue(themeId, out themes);
            if (themes != null)
            {
                foreach (Theme theme in themes)
                {
                    TmNode newNode = new TmNode(TmNodeType.Theme,
                                                theme.Name,
                                                node,
                                                MakeThemeData(theme.Name, theme.DataSource, theme.Type),
                                                MakeMetadataForTheme(theme.Metadata),
                                                null,
                                                theme.PubDate
                                                );
                    node.Add(newNode);
                    FillTheme(newNode, theme.Id);
                }
            }
        }
 private void FillTheme(TmNode node, int themeId)
 {
     //  A theme can have only themes for children, we create new subtheme nodes..
     List<Theme> themes;
     _themesInThemes.TryGetValue(themeId, out themes);
     if (themes != null)
         foreach (Theme theme in themes)
         {
             TmNode newNode = new SubThemeNode(
                 theme.Name,
                 node,
                 MakeThemeData(theme.Name, theme.DataSource, theme.Type),
                 MakeMetadataForTheme(theme.Metadata),
                 null,
                 theme.PubDate
                 );
             node.Add(newNode);
             FillTheme(newNode, theme.Id);
         }
 }
        private void FillCategory(TmNode node, int catId)
        {
            //  A category can have categories and/or themes for children.
            List<Category> cats;
            _categoriesInCategories.TryGetValue(catId, out cats);
            if (cats != null)
                foreach (Category cat in cats)
                {
                    TmNode newNode = new CategoryNode(
                        cat.Name,
                        node,
                        MakeMetadataForCategory(cat.Link),
                        cat.Description
                        );
                    node.Add(newNode);
                    FillCategory(newNode, cat.Id);
                }

            List<Theme> themes;
            _themesInCategories.TryGetValue(catId, out themes);
            if (themes != null)
                foreach (Theme theme in themes)
                {
                    TmNode newNode = new ThemeNode(
                        theme.Name,
                        node,
                        MakeThemeData(theme.Name, theme.DataSource, theme.Type),
                        MakeMetadataForTheme(theme.Metadata),
                        null,
                        theme.PubDate
                        );
                    node.Add(newNode);
                    FillTheme(newNode, theme.Id);
                }
        }