Example #1
0
        public static Bands ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Bands bands = new Bands();

                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        string value = reader.ReadContentAsString();

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "rasterid": bands.RasterID = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                if (!reader.IsEmptyElement)
                {
                    reader.Read();

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case Band.XmlName: bands.Add(Band.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(bands);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Example #2
0
        public object Clone()
        {
            Bands clone = new Bands();

            clone.RasterID = RasterID;

            foreach (Band band in this)
            {
                clone.Add((Band)band.Clone());
            }

            return(clone);
        }
Example #3
0
        public static RasterInfo ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterInfo rasterInfo = new RasterInfo();

                if (!reader.IsEmptyElement)
                {
                    reader.Read();

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case Bands.XmlName: rasterInfo.Bands = Bands.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(rasterInfo);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }