static FilterGraph decodeFilterGraph(XmlElement e, Project proj)
        {
            FilterGraph graph = null;
            if (e != null)
            {
                string name = e.GetAttribute("name");
                //TODO: assert name
            #if TODO_DANI
                string parent_name = e.GetAttribute("inherits");
                if (!string.IsNullOrEmpty(parent_name))
                {
                    FilterGraph parent_graph = proj.getFilterGraph(parent_name);
                    if (parent_graph == null)
                    {
                        //osgGIS.notify( osg.WARN )
                        //    << "Parent graph \"" << parent_name << "\" not found for graph \""
                        //    << name << "\"" << std.endl;
                    }
                    else
                    {
                        graph = (FilterGraph)parent_graph;
                        //TODO...
                    }
                }
                else
                {
            #endif
                graph = new FilterGraph();
                graph.setName(name);

                XmlNodeList filter_els = e.GetElementsByTagName("filter");
                foreach (XmlNode i in filter_els)
                {
                    XmlElement f_e = (XmlElement)i;

                    string type = f_e.GetAttribute("type");

                    Filter f = MogreGis.Registry.instance().createFilterByType(type);

                    // try again with "Filter" suffix
                    if (f == null && !type.EndsWith("Filter", false, System.Globalization.CultureInfo.InvariantCulture))
                        f = MogreGis.Registry.instance().createFilterByType(type + "Filter");
                    if (f != null)
                    {
                        XmlNodeList prop_els = f_e.GetElementsByTagName("property");
                        foreach (XmlNode k in prop_els)
                        {
                            XmlElement k_e = (XmlElement)k;
                            string name_ = k_e.GetAttribute("name");
                            string value_ = k_e.GetAttribute("value");
                            f.setProperty(new Property(name_, value_));
                        }
                        graph.appendFilter(f);
                    }
                }
            #if TODO_DANI
                }
            #endif
            }

            return graph;
            #if TODO_DANI
            #endif
            throw new NotImplementedException();
        }
Exemple #2
0
        static FilterGraph decodeFilterGraph(XmlElement e, Project proj)
        {
            FilterGraph graph = null;

            if (e != null)
            {
                string name = e.GetAttribute("name");
                //TODO: assert name
#if TODO_DANI
                string parent_name = e.GetAttribute("inherits");
                if (!string.IsNullOrEmpty(parent_name))
                {
                    FilterGraph parent_graph = proj.getFilterGraph(parent_name);
                    if (parent_graph == null)
                    {
                        //osgGIS.notify( osg.WARN )
                        //    << "Parent graph \"" << parent_name << "\" not found for graph \""
                        //    << name << "\"" << std.endl;
                    }
                    else
                    {
                        graph = (FilterGraph)parent_graph;
                        //TODO...
                    }
                }
                else
                {
#endif
                graph = new FilterGraph();
                graph.setName(name);

                XmlNodeList filter_els = e.GetElementsByTagName("filter");
                foreach (XmlNode i in filter_els)
                {
                    XmlElement f_e = (XmlElement)i;

                    string type = f_e.GetAttribute("type");

                    Filter f = MogreGis.Registry.instance().createFilterByType(type);

                    // try again with "Filter" suffix
                    if (f == null && !type.EndsWith("Filter", false, System.Globalization.CultureInfo.InvariantCulture))
                    {
                        f = MogreGis.Registry.instance().createFilterByType(type + "Filter");
                    }
                    if (f != null)
                    {
                        XmlNodeList prop_els = f_e.GetElementsByTagName("property");
                        foreach (XmlNode k in prop_els)
                        {
                            XmlElement k_e    = (XmlElement)k;
                            string     name_  = k_e.GetAttribute("name");
                            string     value_ = k_e.GetAttribute("value");
                            f.setProperty(new Property(name_, value_));
                        }
                        graph.appendFilter(f);
                    }
                }
#if TODO_DANI
            }
#endif
            }

            return(graph);

#if TODO_DANI
#endif
            throw new NotImplementedException();
        }