예제 #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);
                }
            }
        }
예제 #2
0
        public object Clone()
        {
            Bands clone = new Bands();

            clone.RasterID = RasterID;

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

            return(clone);
        }