Exemplo n.º 1
0
        static Source decodeSource(XmlElement e, Project proj, int pass)
        {
            Source source = null;

            if (e != null)
            {
                if (pass == 0)
                {
                    // first pass: create the new source record
                    source = new Source();
#if TODO_DANI
                    source.setBaseURI(proj.getBaseURI());
#endif
                    source.setName(e.GetAttribute("name"));
                    source.setType(e.GetAttribute("type") == "raster" ? Source.SourceType.TYPE_RASTER : Source.SourceType.TYPE_FEATURE);
                    source.setURI(e.GetElementsByTagName("uri")[0].InnerText);
#if TODO_DANI
                    source.setFilterGraph(proj.getFilterGraph(e.GetAttribute("graph")));
#endif
                }
                else
                {
                    // second pass: reference other sources
                    source = proj.getSource(e.GetAttribute("name"));
                    source.setParentSource(proj.getSource(e.GetAttribute("parent")));
                }
            }
            return(source);
        }
Exemplo n.º 2
0
        static BuildLayerSlice decodeSlice(XmlElement e, Project proj)
        {
            BuildLayerSlice slice = null;

            if (e != null)
            {
                slice = new BuildLayerSlice();

                if (!string.IsNullOrEmpty(e.GetAttribute("min_range")))
                {
                    slice.setMinRange(float.Parse(e.GetAttribute("min_range")));
                }
                if (!string.IsNullOrEmpty(e.GetAttribute("max_range")))
                {
                    slice.setMaxRange(float.Parse(e.GetAttribute("max_range")));
                }

#if TODO_DANI
                // required filter graph:
                string graph = e.GetAttribute("graph");
                slice.setFilterGraph(proj.getFilterGraph(graph)); //TODO: warning?
#endif

                // optional source:
                slice.setSource(proj.getSource(e.GetAttribute("source")));

#if TODO_DANI
                // properties particular to this slice:
                XmlNodeList props = e.GetElementsByTagName("property");
                foreach (XmlNode i in props)
                {
                    XmlElement k_e   = (XmlElement)i;
                    string     name  = k_e.GetAttribute("name");
                    string     value = k_e.GetAttribute("value");
                    slice.getProperties().Add(new Property(name, value));
                }
#endif

                // now decode sub-slices:
                XmlNodeList slices = e.GetElementsByTagName("slice");
                foreach (XmlNode i in slices)
                {
                    BuildLayerSlice child = decodeSlice((XmlElement)i, proj);
                    if (child != null)
                    {
                        slice.getSubSlices().Add(child);
                    }
                }
            }
            return(slice);
        }
Exemplo n.º 3
0
 static Source decodeSource(XmlElement e, Project proj, int pass)
 {
     Source source = null;
     if (e != null)
     {
         if (pass == 0)
         {
             // first pass: create the new source record
             source = new Source();
     #if TODO_DANI
             source.setBaseURI(proj.getBaseURI());
     #endif
             source.setName(e.GetAttribute("name"));
             source.setType(e.GetAttribute("type") == "raster" ? Source.SourceType.TYPE_RASTER : Source.SourceType.TYPE_FEATURE);
             source.setURI(e.GetElementsByTagName("uri")[0].InnerText);
     #if TODO_DANI
             source.setFilterGraph(proj.getFilterGraph(e.GetAttribute("graph")));
     #endif
         }
         else
         {
             // second pass: reference other sources
             source = proj.getSource(e.GetAttribute("name"));
             source.setParentSource(proj.getSource(e.GetAttribute("parent")));
         }
     }
     return source;
 }
Exemplo n.º 4
0
        static BuildLayerSlice decodeSlice(XmlElement e, Project proj)
        {
            BuildLayerSlice slice = null;
            if (e != null)
            {
                slice = new BuildLayerSlice();

                if (!string.IsNullOrEmpty(e.GetAttribute("min_range")))
                    slice.setMinRange(float.Parse(e.GetAttribute("min_range")));
                if (!string.IsNullOrEmpty(e.GetAttribute("max_range")))
                    slice.setMaxRange(float.Parse(e.GetAttribute("max_range")));

            #if TODO_DANI
                // required filter graph:
                string graph = e.GetAttribute("graph");
                slice.setFilterGraph(proj.getFilterGraph(graph)); //TODO: warning?
            #endif

                // optional source:
                slice.setSource(proj.getSource(e.GetAttribute("source")));

            #if TODO_DANI
                // properties particular to this slice:
                XmlNodeList props = e.GetElementsByTagName("property");
                foreach (XmlNode i in props)
                {
                    XmlElement k_e = (XmlElement)i;
                    string name = k_e.GetAttribute("name");
                    string value = k_e.GetAttribute("value");
                    slice.getProperties().Add(new Property(name, value));
                }
            #endif

                // now decode sub-slices:
                XmlNodeList slices = e.GetElementsByTagName("slice");
                foreach (XmlNode i in slices)
                {
                    BuildLayerSlice child = decodeSlice((XmlElement)i, proj);
                    if (child != null)
                        slice.getSubSlices().Add(child);
                }
            }
            return slice;
        }
Exemplo n.º 5
0
        static BuildLayer decodeLayer(XmlElement e, Project proj)
        {
            BuildLayer layer = null;
            if (e != null)
            {
                layer = new BuildLayer();

            #if TODO_DANI
                layer.setBaseURI(proj.getBaseURI());
            #endif

                layer.setName(e.GetAttribute("name"));

                string type = e.GetAttribute("type");
                if (type == "correlated")
                    layer.setType(BuildLayer.LayerType.TYPE_CORRELATED);
                else if (type == "gridded")
                    layer.setType(BuildLayer.LayerType.TYPE_GRIDDED);
                else if (type == "quadtree" || type == "new")
                    layer.setType(BuildLayer.LayerType.TYPE_QUADTREE);

                string source = e.GetAttribute("source");
                layer.setSource(proj.getSource(source));

                string terrain = e.GetAttribute("terrain");
                layer.setTerrain(proj.getTerrain(terrain));

                layer.setTargetPath(e.GetAttribute("target"));

                XmlNodeList slices = e.GetElementsByTagName("slice");
                foreach (XmlNode i in slices)
                {
                    BuildLayerSlice slice = decodeSlice((XmlElement)i, proj);
                    if (slice != null)
                        layer.getSlices().Add(slice);
                }

            #if TODO_DANI
                XmlNodeList props = e.GetElementsByTagName("property");
                foreach (XmlNode i in props)
                {
                    XmlElement k_e = (XmlElement)i;
                    string name = k_e.GetAttribute("name");
                    string value = k_e.GetAttribute("value");
                    layer.getProperties().Add(new Property(name, value));
                }

                XmlNodeList env_props = e.GetElementsByTagName("env_property");
                foreach (XmlNode i in env_props)
                {
                    XmlElement k_e = (XmlElement)i;
                    string name = k_e.GetAttribute("name");
                    string value = k_e.GetAttribute("value");
                    layer.getEnvProperties().Add(new Property(name, value));
                }
            #endif
            }
            return layer;
        }
Exemplo n.º 6
0
        static BuildLayer decodeLayer(XmlElement e, Project proj)
        {
            BuildLayer layer = null;

            if (e != null)
            {
                layer = new BuildLayer();

#if TODO_DANI
                layer.setBaseURI(proj.getBaseURI());
#endif

                layer.setName(e.GetAttribute("name"));

                string type = e.GetAttribute("type");
                if (type == "correlated")
                {
                    layer.setType(BuildLayer.LayerType.TYPE_CORRELATED);
                }
                else if (type == "gridded")
                {
                    layer.setType(BuildLayer.LayerType.TYPE_GRIDDED);
                }
                else if (type == "quadtree" || type == "new")
                {
                    layer.setType(BuildLayer.LayerType.TYPE_QUADTREE);
                }

                string source = e.GetAttribute("source");
                layer.setSource(proj.getSource(source));

                string terrain = e.GetAttribute("terrain");
                layer.setTerrain(proj.getTerrain(terrain));

                layer.setTargetPath(e.GetAttribute("target"));

                XmlNodeList slices = e.GetElementsByTagName("slice");
                foreach (XmlNode i in slices)
                {
                    BuildLayerSlice slice = decodeSlice((XmlElement)i, proj);
                    if (slice != null)
                    {
                        layer.getSlices().Add(slice);
                    }
                }

#if TODO_DANI
                XmlNodeList props = e.GetElementsByTagName("property");
                foreach (XmlNode i in props)
                {
                    XmlElement k_e   = (XmlElement)i;
                    string     name  = k_e.GetAttribute("name");
                    string     value = k_e.GetAttribute("value");
                    layer.getProperties().Add(new Property(name, value));
                }

                XmlNodeList env_props = e.GetElementsByTagName("env_property");
                foreach (XmlNode i in env_props)
                {
                    XmlElement k_e   = (XmlElement)i;
                    string     name  = k_e.GetAttribute("name");
                    string     value = k_e.GetAttribute("value");
                    layer.getEnvProperties().Add(new Property(name, value));
                }
#endif
            }
            return(layer);
        }