Exemplo n.º 1
0
        public static Properties ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Properties properties = new Properties();

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

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

                            case "ENVELOPE": properties.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

                            case FeatureCoordSys.XmlName: properties.FeatureCoordSys = FeatureCoordSys.ReadFrom(reader); break;

                            case FilterCoordSys.XmlName: properties.FilterCoordSys = FilterCoordSys.ReadFrom(reader); break;

                            case ImageGeneralization.XmlName: properties.ImageGeneralization = ImageGeneralization.ReadFrom(reader); break;

                            case ImageSize.XmlName: properties.ImageSize = ImageSize.ReadFrom(reader); break;

                            case MapUnits.XmlName: properties.MapUnits = MapUnits.ReadFrom(reader); break;

                            case Output.XmlName: properties.Output = Output.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

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

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "units": mapUnits.Units = (Units)ArcXmlEnumConverter.ToEnum(typeof(Units), value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

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

            return(clone);
        }