Ejemplo n.º 1
0
        public static RasterRange ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterRange rasterRange = new RasterRange();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "color": rasterRange.Color = ColorConverter.ToColor(value); break;

                            case "equality": rasterRange.Equality = (RangeEquality)ArcXmlEnumConverter.ToEnum(typeof(RangeEquality), value); break;

                            case "label": rasterRange.Label = value; break;

                            case "lower": rasterRange.Lower = Convert.ToDouble(value); break;

                            case "transparency": rasterRange.Transparency = Convert.ToDouble(value); break;

                            case "upper": rasterRange.Upper = Convert.ToDouble(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(rasterRange);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Ejemplo n.º 2
0
        public static RasterRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterRenderer rasterRenderer = new RasterRenderer();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case RasterExact.XmlName: rasterRenderer.Classifications.Add(RasterExact.ReadFrom(reader)); break;

                            case RasterRange.XmlName: rasterRenderer.Classifications.Add(RasterRange.ReadFrom(reader)); break;

                            case RasterOther.XmlName: rasterRenderer.Classifications.Add(RasterOther.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(rasterRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Ejemplo n.º 3
0
        public override object Clone()
        {
            RasterRange clone = (RasterRange)this.MemberwiseClone();

            return(clone);
        }