Beispiel #1
0
        public static ValueMapRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ValueMapRenderer valueMapRenderer = new ValueMapRenderer();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "lookupfield": valueMapRenderer.LookupField = 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 Exact.XmlName: valueMapRenderer.Classifications.Add(Exact.ReadFrom(reader)); break;

                            case Other.XmlName: valueMapRenderer.Classifications.Add(Other.ReadFrom(reader)); break;

                            case Range.XmlName: valueMapRenderer.Classifications.Add(Range.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(valueMapRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #2
0
        private static Coordinate[] ReadCoordsFrom(ArcXmlReader reader)
        {
            try
            {
                Coordinate[] coordinates = new Coordinate[0];

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == "COORDS"))
                    {
                        if (reader.NodeType == XmlNodeType.Text)
                        {
                            string[] coords = reader.ReadContentAsString().Split(reader.TupleSeparator);
                            coordinates = new Coordinate[coords.Length];

                            for (int i = 0; i < coords.Length; ++i)
                            {
                                string[] c = coords[i].Split(reader.CoordinateSeparator);
                                coordinates[i] = new Coordinate(Convert.ToDouble(c[0]), Convert.ToDouble(c[1]));
                            }
                        }

                        reader.Read();
                    }
                }

                return(coordinates);
            }
            catch (Exception ex)
            {
                throw new ArcXmlException("Could not read COORDS element.", ex);
            }
        }
Beispiel #3
0
        public static ServiceInfo ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ServiceInfo serviceInfo = new ServiceInfo();

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

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

                            case Properties.XmlName: serviceInfo.Properties = Properties.ReadFrom(reader); break;

                            case LayoutInfo.XmlName: serviceInfo.LayoutInfo = LayoutInfo.ReadFrom(reader); break;

                            case DataFrameInfo.XmlName:
                                if (serviceInfo.DataFrameInfos == null)
                                {
                                    serviceInfo.DataFrameInfos = new DataFrameInfoList();
                                }

                                serviceInfo.DataFrameInfos.Add(DataFrameInfo.ReadFrom(reader));
                                break;

                            case LayerInfo.XmlName:
                                if (serviceInfo.LayerInfos == null)
                                {
                                    serviceInfo.LayerInfos = new LayerInfoList();
                                }

                                serviceInfo.LayerInfos.Add(LayerInfo.ReadFrom(reader));
                                break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(serviceInfo);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #4
0
        public static DataFrameInfo ReadFrom(ArcXmlReader reader)
        {
            try
            {
                DataFrameInfo dataFrameInfo = new DataFrameInfo();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "default": dataFrameInfo.Default = Convert.ToBoolean(value); break;

                            case "name": dataFrameInfo.Name = 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 Properties.XmlName: dataFrameInfo.Properties = Properties.ReadFrom(reader); break;

                            case LayerInfo.XmlName: dataFrameInfo.LayerInfos.Add(LayerInfo.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(dataFrameInfo);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #5
0
        public static Error ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Error error = new Error();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "machine": error.Machine = value; break;

                            case "processid": error.ProcessID = Convert.ToInt32(value); break;

                            case "threadid": error.ThreadID = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Text)
                        {
                            error.Text = reader.Value;
                        }

                        reader.Read();
                    }
                }

                return(error);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #6
0
        public static Extension ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Extension extension = new Extension();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "type": extension.Type = (ExtensionType)ArcXmlEnumConverter.ToEnum(typeof(ExtensionType), 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 GcStyle.XmlName: extension.GcStyle = GcStyle.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(extension);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #7
0
        public static FieldValue ReadFrom(ArcXmlReader reader)
        {
            try
            {
                FieldValue fieldValue = new FieldValue();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "valuestring": fieldValue.ValueString = 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 "POINT": fieldValue.Point = (IPoint)GeometrySerializer.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(fieldValue);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #8
0
		public static TocGroup ReadFrom(ArcXmlReader reader)
		{
			try
			{
				TocGroup tocGroup = new TocGroup();

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

						if (value.Length > 0)
						{
							switch (reader.Name)
							{
								case "heading": tocGroup.Heading = 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 TocClass.XmlName: tocGroup.Add(TocClass.ReadFrom(reader)); break;
							}
						}

						reader.Read();
					}
				}

				return tocGroup;
			}
			catch (Exception ex)
			{
				if (ex is ArcXmlException)
				{
					throw ex;
				}
				else
				{
					throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
				}
			}
		}
Beispiel #9
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);
                }
            }
        }
Beispiel #10
0
		public static LayoutInfo ReadFrom(ArcXmlReader reader)
		{
			try
			{
				LayoutInfo layoutInfo = new LayoutInfo();

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

						if (value.Length > 0)
						{
							switch (reader.Name)
							{
								case "pageunits": layoutInfo.PageUnits = (PageUnits)ArcXmlEnumConverter.ToEnum(typeof(PageUnits), 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 "ENVELOPE": layoutInfo.Envelope = EnvelopeSerializer.ReadFrom(reader); break;
              }
						}

						reader.Read();
					}
				}

				return layoutInfo;
			}
			catch (Exception ex)
			{
				if (ex is ArcXmlException)
				{
					throw ex;
				}
				else
				{
					throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
				}
			}
		}
Beispiel #11
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);
                }
            }
        }
Beispiel #12
0
        public static Project ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Project project = new Project();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "ENVELOPE": project.Envelopes.Add(EnvelopeSerializer.ReadFrom(reader)); break;

                            case "MULTIPOINT":
                                IMultiPoint multiPoint = (IMultiPoint)GeometrySerializer.ReadFrom(reader);
                                IGeometry   shape      = multiPoint.Count == 1 ? (IGeometry)multiPoint[0] : (IGeometry)multiPoint;
                                project.Shapes.Add(shape);
                                break;

                            case "POLYLINE":
                            case "POLYGON":
                                project.Shapes.Add(GeometrySerializer.ReadFrom(reader));
                                break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(project);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #13
0
        public static GroupRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                GroupRenderer groupRenderer = new GroupRenderer();

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

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

                            case ScaleDependentRenderer.XmlName: groupRenderer.Add(ScaleDependentRenderer.ReadFrom(reader)); break;

                            case SimpleLabelRenderer.XmlName: groupRenderer.Add(SimpleLabelRenderer.ReadFrom(reader)); break;

                            case SimpleRenderer.XmlName: groupRenderer.Add(SimpleRenderer.ReadFrom(reader)); break;

                            case ValueMapLabelRenderer.XmlName: groupRenderer.Add(ValueMapLabelRenderer.ReadFrom(reader)); break;

                            case ValueMapRenderer.XmlName: groupRenderer.Add(ValueMapRenderer.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(groupRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #14
0
        public static IMultiPoint ReadMultiPointFrom(ArcXmlReader reader)
        {
            try
            {
                List <IPoint> points = new List <IPoint>();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == "MULTIPOINT"))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "POINT": points.Add(ReadPointFrom(reader)); break;

                            case "COORDS":
                                Coordinate[] coordinates = ReadCoordsFrom(reader);

                                foreach (Coordinate c in coordinates)
                                {
                                    points.Add(new Point(c));
                                }
                                break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(new MultiPoint(points.ToArray()));
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read MULTIPOINT element.", ex);
                }
            }
        }
Beispiel #15
0
        public static Environment ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Environment environment = new Environment();

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

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

                            case ImageLimit.XmlName: environment.ImageLimit = ImageLimit.ReadFrom(reader); break;

                            case Locale.XmlName: environment.Locale = Locale.ReadFrom(reader); break;

                            case Screen.XmlName: environment.Screen = Screen.ReadFrom(reader); break;

                            case Separators.XmlName: environment.Separators = Separators.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(environment);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #16
0
        public static SimpleRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                SimpleRenderer simpleRenderer = new SimpleRenderer();

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

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

                            case SimpleLineSymbol.XmlName: simpleRenderer.Symbol = SimpleLineSymbol.ReadFrom(reader); break;

                            case SimpleMarkerSymbol.XmlName: simpleRenderer.Symbol = SimpleMarkerSymbol.ReadFrom(reader); break;

                            case SimplePolygonSymbol.XmlName: simpleRenderer.Symbol = SimplePolygonSymbol.ReadFrom(reader); break;

                            case TrueTypeMarkerSymbol.XmlName: simpleRenderer.Symbol = TrueTypeMarkerSymbol.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(simpleRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #17
0
        public static Coords ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Coords coords = new Coords();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Text)
                        {
                            string[] tuples = reader.ReadContentAsString().Split(reader.TupleSeparator);

                            if (tuples.Length > 0)
                            {
                                for (int i = 0; i < tuples.Length; ++i)
                                {
                                    string[] c = tuples[i].Split(reader.CoordinateSeparator);
                                    coords.Add(new Point(Convert.ToDouble(c[0]), Convert.ToDouble(c[1])));
                                }
                            }
                        }

                        reader.Read();
                    }
                }

                return(coords);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #18
0
        public static Image ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Image image = new Image();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "ENVELOPE": image.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

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

                            case Layers.XmlName: image.Layers = Layers.ReadFrom(reader); break;

                            case Scale.XmlName: image.Scale = Scale.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(image);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #19
0
        public static IPolygon ReadRingFrom(ArcXmlReader reader)
        {
            try
            {
                List <Coordinate>  exteriorRing  = new List <Coordinate>();
                List <ILinearRing> interiorRings = new List <ILinearRing>();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == "RING"))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "COORDS": exteriorRing.AddRange(ReadCoordsFrom(reader)); break;

                            case "POINT": exteriorRing.Add(ReadAsCoordinateFrom(reader)); break;

                            case "HOLE": interiorRings.Add(new LinearRing(ReadLineStringFrom(reader, "HOLE").Coordinates)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(new Polygon(new LinearRing(exteriorRing.ToArray()), interiorRings.ToArray()));
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read RING element.", ex);
                }
            }
        }
Beispiel #20
0
        public static Features ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Features features = new Features();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "ENVELOPE": features.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

                            case FeatureCount.XmlName: features.FeatureCount = FeatureCount.ReadFrom(reader); break;

                            case Feature.XmlName: features.Add(Feature.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(features);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #21
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);
                }
            }
        }
Beispiel #22
0
        public static Layout ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Layout layout = new Layout();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "ENVELOPE": layout.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

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

                        reader.Read();
                    }
                }

                return(layout);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #23
0
        private static ILineString ReadLineStringFrom(ArcXmlReader reader, string arcXmlName)
        {
            try
            {
                List <Coordinate> coordinates = new List <Coordinate>();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == arcXmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "COORDS": coordinates.AddRange(ReadCoordsFrom(reader)); break;

                            case "POINT": coordinates.Add(ReadAsCoordinateFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(new LineString(coordinates.ToArray()));
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", arcXmlName), ex);
                }
            }
        }
Beispiel #24
0
        public static Geocode ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Geocode geocode = new Geocode();

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

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

                            case Feature.XmlName: geocode.Features.Add(Feature.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(geocode);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #25
0
        public static Toc ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Toc toc = new Toc();

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

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

                        reader.Read();
                    }
                }

                return(toc);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #26
0
        public static Layers ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Layers layers = new Layers();

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

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

                        reader.Read();
                    }
                }

                return(layers);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #27
0
        public static IMultiLineString ReadPolylineFrom(ArcXmlReader reader)
        {
            try
            {
                List <ILineString> lineStrings = new List <ILineString>();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == "POLYLINE"))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "PATH": lineStrings.Add(ReadLineStringFrom(reader, "PATH")); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(new MultiLineString(lineStrings.ToArray()));
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read POLYLINE element.", ex);
                }
            }
        }
Beispiel #28
0
        public static IMultiPolygon ReadPolygonFrom(ArcXmlReader reader)
        {
            try
            {
                List <IPolygon> polygons = new List <IPolygon>();

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

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == "POLYGON"))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "RING": polygons.Add(ReadRingFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(new MultiPolygon(polygons.ToArray()));
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read POLYGON element.", ex);
                }
            }
        }
Beispiel #29
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);
                }
            }
        }
Beispiel #30
0
        public static Other ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Other other = new Other();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "label": other.Label = 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 HashLineSymbol.XmlName: other.Symbol = HashLineSymbol.ReadFrom(reader); break;

                            case SimpleLineSymbol.XmlName: other.Symbol = SimpleLineSymbol.ReadFrom(reader); break;

                            case SimpleMarkerSymbol.XmlName: other.Symbol = SimpleMarkerSymbol.ReadFrom(reader); break;

                            case SimplePolygonSymbol.XmlName: other.Symbol = SimplePolygonSymbol.ReadFrom(reader); break;

                            case ShieldSymbol.XmlName: other.Symbol = ShieldSymbol.ReadFrom(reader); break;

                            case TextSymbol.XmlName: other.Symbol = TextSymbol.ReadFrom(reader); break;

                            case TrueTypeMarkerSymbol.XmlName: other.Symbol = TrueTypeMarkerSymbol.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

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