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

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": chartSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "maxsize": chartSymbol.MaxSize = Convert.ToInt32(value); break;

                            case "maxvalue": chartSymbol.MaxValue = Convert.ToInt32(value); break;

                            case "minsize": chartSymbol.MinSize = Convert.ToInt32(value); break;

                            case "minvalue": chartSymbol.MinValue = Convert.ToInt32(value); break;

                            case "mode": chartSymbol.Mode = (ChartSymbolMode)ArcXmlEnumConverter.ToEnum(typeof(ChartSymbolMode), value); break;

                            case "outline": chartSymbol.Outline = ColorConverter.ToColor(value); break;

                            case "shadow": chartSymbol.Shadow = ColorConverter.ToColor(value); break;

                            case "size": chartSymbol.Size = Convert.ToInt32(value); break;

                            case "sizefield": chartSymbol.SizeField = value; break;

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

                            case "width": chartSymbol.Width = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(chartSymbol);
            }
            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
        public static CallOutMarkerSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                CallOutMarkerSymbol callOutMarkerSymbol = new CallOutMarkerSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": callOutMarkerSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "backcolor": callOutMarkerSymbol.BackColor = ColorConverter.ToColor(value); break;

                            case "boundarycolor": callOutMarkerSymbol.BoundaryColor = ColorConverter.ToColor(value); break;

                            case "font": callOutMarkerSymbol.Font = value; break;

                            case "fontcolor": callOutMarkerSymbol.FontColor = ColorConverter.ToColor(value); break;

                            case "fontsize": callOutMarkerSymbol.FontSize = Convert.ToInt32(value); break;

                            case "fontstyle": callOutMarkerSymbol.FontStyle = (FontStyle)ArcXmlEnumConverter.ToEnum(typeof(FontStyle), value); break;

                            case "glowing": callOutMarkerSymbol.Glowing = ColorConverter.ToColor(value); break;

                            case "interval": callOutMarkerSymbol.Interval = Convert.ToInt32(value); break;

                            case "outline": callOutMarkerSymbol.Outline = ColorConverter.ToColor(value); break;

                            case "shadow": callOutMarkerSymbol.Shadow = ColorConverter.ToColor(value); break;

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

                    reader.MoveToElement();
                }

                return(callOutMarkerSymbol);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Beispiel #3
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 #4
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 #5
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 #6
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 #7
0
        public static SimplePolygonSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                SimplePolygonSymbol simplePolygonSymbol = new SimplePolygonSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": simplePolygonSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "boundary": simplePolygonSymbol.Boundary = Convert.ToBoolean(value); break;

                            case "boundarycaptype": simplePolygonSymbol.BoundaryCapType = (CapType)ArcXmlEnumConverter.ToEnum(typeof(CapType), value); break;

                            case "boundarycolor": simplePolygonSymbol.BoundaryColor = Color.FromArgb(simplePolygonSymbol.BoundaryColor.A, ColorConverter.ToColor(value)); break;

                            case "boundaryjointype": simplePolygonSymbol.BoundaryJoinType = (JoinType)ArcXmlEnumConverter.ToEnum(typeof(JoinType), value); break;

                            case "boundarytype": simplePolygonSymbol.BoundaryType = (LineType)ArcXmlEnumConverter.ToEnum(typeof(LineType), value); break;

                            case "boundarywidth": simplePolygonSymbol.BoundaryWidth = Convert.ToInt32(value); break;

                            case "fillcolor": simplePolygonSymbol.FillColor = Color.FromArgb(simplePolygonSymbol.FillColor.A, ColorConverter.ToColor(value)); break;

                            case "fillinterval": simplePolygonSymbol.FillInterval = Convert.ToInt32(value); break;

                            case "filltype": simplePolygonSymbol.FillType = (FillType)ArcXmlEnumConverter.ToEnum(typeof(FillType), value); break;

                            case "overlap": simplePolygonSymbol.Overlap = Convert.ToBoolean(value); break;

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

                    reader.MoveToElement();
                }

                return(simplePolygonSymbol);
            }
            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 ShieldSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ShieldSymbol shieldSymbol = new ShieldSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": shieldSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "bottomcolor": shieldSymbol.BottomColor = ColorConverter.ToColor(value); break;

                            case "font": shieldSymbol.Font = value; break;

                            case "fontcolor": shieldSymbol.FontColor = ColorConverter.ToColor(value); break;

                            case "fontsize": shieldSymbol.FontSize = Convert.ToInt32(value); break;

                            case "fontstyle": shieldSymbol.FontStyle = (FontStyle)ArcXmlEnumConverter.ToEnum(typeof(FontStyle), value); break;

                            case "labelmode": shieldSymbol.LabelMode = (ShieldLabelMode)ArcXmlEnumConverter.ToEnum(typeof(ShieldLabelMode), value); break;

                            case "middlecolor": shieldSymbol.MiddleColor = ColorConverter.ToColor(value); break;

                            case "minsize": shieldSymbol.MinSize = Convert.ToInt32(value); break;

                            case "shadow": shieldSymbol.Shadow = ColorConverter.ToColor(value); break;

                            case "topcolor": shieldSymbol.TopColor = ColorConverter.ToColor(value); break;

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

                    reader.MoveToElement();
                }

                return(shieldSymbol);
            }
            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 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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
0
        public static Envelope ReadFrom(ArcXmlReader reader)
        {
            try
            {
                double minx = Double.NaN;
                double miny = Double.NaN;
                double maxx = Double.NaN;
                double maxy = Double.NaN;

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "minx": minx = Convert.ToDouble(value); break;

                            case "miny": miny = Convert.ToDouble(value); break;

                            case "maxx": maxx = Convert.ToDouble(value); break;

                            case "maxy": maxy = Convert.ToDouble(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                if (Double.IsNaN(minx) || Double.IsNaN(minx) || Double.IsNaN(minx) || Double.IsNaN(minx))
                {
                    return(new Envelope());
                }
                else
                {
                    return(new Envelope(new Coordinate(minx, miny), new Coordinate(maxx, maxy)));
                }
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read ENVELOPE element.", ex);
                }
            }
        }
Beispiel #16
0
        public static HashLineSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                HashLineSymbol hashLineSymbol = new HashLineSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": hashLineSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "color": hashLineSymbol.Color = ColorConverter.ToColor(value); break;

                            case "interval": hashLineSymbol.Interval = Convert.ToInt32(value); break;

                            case "linethickness": hashLineSymbol.LineThickness = Convert.ToInt32(value); break;

                            case "tickthickness": hashLineSymbol.TickThickness = Convert.ToInt32(value); break;

                            case "overlap": hashLineSymbol.Overlap = Convert.ToBoolean(value); break;

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

                            case "type": hashLineSymbol.Type = (HashLineType)ArcXmlEnumConverter.ToEnum(typeof(HashLineType), value); break;

                            case "width": hashLineSymbol.Width = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(hashLineSymbol);
            }
            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 SimpleMarkerSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": simpleMarkerSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "color": simpleMarkerSymbol.Color = ColorConverter.ToColor(value); break;

                            case "outline": simpleMarkerSymbol.Outline = ColorConverter.ToColor(value); break;

                            case "overlap": simpleMarkerSymbol.Overlap = Convert.ToBoolean(value); break;

                            case "shadow": simpleMarkerSymbol.Shadow = ColorConverter.ToColor(value); break;

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

                            case "type": simpleMarkerSymbol.Type = (MarkerType)ArcXmlEnumConverter.ToEnum(typeof(MarkerType), value); break;

                            case "usecentroid": simpleMarkerSymbol.UseCentroid = Convert.ToBoolean(value); break;

                            case "width": simpleMarkerSymbol.Width = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(simpleMarkerSymbol);
            }
            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 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 #19
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 #20
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);
                }
            }
        }
Beispiel #21
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 #22
0
        public static ImageSize ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ImageSize imageSize = new ImageSize();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "height": imageSize.Height = Convert.ToInt32(value); break;

                            case "width": imageSize.Width = Convert.ToInt32(value); break;

                            case "dpi": imageSize.Dpi = Convert.ToInt32(value); break;

                            case "printheight": imageSize.PrintHeight = Convert.ToInt32(value); break;

                            case "printwidth": imageSize.PrintWidth = Convert.ToInt32(value); break;

                            case "scalesymbols": imageSize.ScaleSymbols = Convert.ToBoolean(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(imageSize);
            }
            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
        public static GradientFillSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                GradientFillSymbol gradientFillSymbol = new GradientFillSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": gradientFillSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "finishcolor": gradientFillSymbol.FinishColor = ColorConverter.ToColor(value); break;

                            case "overlap": gradientFillSymbol.Overlap = Convert.ToBoolean(value); break;

                            case "startcolor": gradientFillSymbol.StartColor = ColorConverter.ToColor(value); break;

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

                            case "type": gradientFillSymbol.Type = (GradientFillType)ArcXmlEnumConverter.ToEnum(typeof(GradientFillType), value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

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

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "accuracy": query.Accuracy = Convert.ToDouble(value); break;

                            case "featurelimit": query.FeatureLimit = Convert.ToInt32(value); break;

                            case "joinexpression": query.JoinExpression = value; break;

                            case "jointables": query.JoinTables = value; break;

                            case "subfields": query.Subfields = value; break;

                            case "where": query.Where = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(query);
            }
            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 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 #26
0
        public static RasterFillSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterFillSymbol rasterFillSymbol = new RasterFillSymbol();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "antialiasing": rasterFillSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "image": rasterFillSymbol.Image = value; break;

                            case "overlap": rasterFillSymbol.Overlap = Convert.ToBoolean(value); break;

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

                            case "url": rasterFillSymbol.Url = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(rasterFillSymbol);
            }
            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 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 #28
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 #29
0
        public static Output ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Output output = new Output();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "file": output.File = value; break;

                            case "height": output.Height = Convert.ToInt32(value); break;

                            case "url": output.Url = value; break;

                            case "width": output.Width = Convert.ToInt32(value); break;

                            case "type": output.Type = (ImageType)ArcXmlEnumConverter.ToEnum(typeof(ImageType), value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(output);
            }
            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 Separators ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Separators separators = new Separators();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "cs":
                                separators.CoordinateSeparator = value[0];
                                reader.CoordinateSeparator     = new char[] { separators.CoordinateSeparator };
                                break;

                            case "ts":
                                separators.TupleSeparator = value[0];
                                reader.TupleSeparator     = new char[] { separators.TupleSeparator };
                                break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

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