Esempio n. 1
0
        public static RasterExact ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterExact rasterExact = new RasterExact();

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

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

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

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

                            case "value": rasterExact.Value = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(rasterExact);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Esempio n. 2
0
        public override object Clone()
        {
            RasterExact clone = (RasterExact)this.MemberwiseClone();

            return(clone);
        }
Esempio n. 3
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);
                }
            }
        }