Пример #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);
                }
            }
        }
Пример #2
0
        public static TextSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                TextSymbol textSymbol = new TextSymbol();

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

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

                            case "blockout": textSymbol.BlockOut = ColorConverter.ToColor(value); break;

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

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

                            case "fontsize": textSymbol.FontSize = reader.ReadContentAsInt(); break;

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

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

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

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

                            case "printmode": textSymbol.PrintMode = (PrintMode)ArcXmlEnumConverter.ToEnum(typeof(PrintMode), value); break;

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

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

                    reader.MoveToElement();
                }

                return(textSymbol);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #3
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);
                }
            }
        }
Пример #4
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);
				}
			}
		}
Пример #5
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);
                }
            }
        }
Пример #6
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);
                }
            }
        }
Пример #7
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);
                }
            }
        }
Пример #8
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);
                }
            }
        }
Пример #9
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);
                }
            }
        }
Пример #10
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);
                }
            }
        }
Пример #11
0
        public static MapUnits ReadFrom(ArcXmlReader reader)
        {
            try
            {
                MapUnits mapUnits = new MapUnits();

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

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

                    reader.MoveToElement();
                }

                return(mapUnits);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #12
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);
                }
            }
        }
Пример #13
0
        public static FClass ReadFrom(ArcXmlReader reader)
        {
            try
            {
                FClass fClass = new FClass();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "type": fClass.Type = (FClassType)ArcXmlEnumConverter.ToEnum(typeof(FClassType), 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": fClass.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

                            case Field.XmlName:
                                if (fClass.Fields == null)
                                {
                                    fClass.Fields = new Fields();
                                }

                                fClass.Fields.Add(Field.ReadFrom(reader));
                                break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(fClass);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #14
0
        public static SimpleLabelRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                SimpleLabelRenderer simpleLabelRenderer = new SimpleLabelRenderer();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "field": simpleLabelRenderer.Field = value; break;

                            case "featureweight": simpleLabelRenderer.FeatureWeight = (LabelWeight)ArcXmlEnumConverter.ToEnum(typeof(LabelWeight), value); break;

                            case "howmanylabels": simpleLabelRenderer.HowManyLabels = (HowManyLabels)ArcXmlEnumConverter.ToEnum(typeof(HowManyLabels), value); break;

                            case "labelbufferratio": simpleLabelRenderer.LabelBufferRatio = Convert.ToDouble(value); break;

                            case "labelpriorities": simpleLabelRenderer.LabelPriorities = value; break;

                            case "labelweight": simpleLabelRenderer.LabelWeight = (LabelWeight)ArcXmlEnumConverter.ToEnum(typeof(LabelWeight), value); break;

                            case "linelabelposition": simpleLabelRenderer.LineLabelPosition = (LineLabelPosition)ArcXmlEnumConverter.ToEnum(typeof(LineLabelPosition), value); break;

                            case "rotationalangles": simpleLabelRenderer.RotationalAngles = 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 ShieldSymbol.XmlName: simpleLabelRenderer.Symbol = ShieldSymbol.ReadFrom(reader); break;

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

                        reader.Read();
                    }
                }

                return(simpleLabelRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #15
0
        public static TrueTypeMarkerSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                TrueTypeMarkerSymbol trueTypeMarkerSymbol = new TrueTypeMarkerSymbol();

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

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

                            case "anglefield": trueTypeMarkerSymbol.AngleField = value; break;

                            case "antialiasing": trueTypeMarkerSymbol.Antialiasing = Convert.ToBoolean(value); break;

                            case "character": trueTypeMarkerSymbol.Character = Convert.ToUInt16(value); break;

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

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

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

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

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

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

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

                            case "rotatemethod": trueTypeMarkerSymbol.RotateMethod = (RotateMethod)ArcXmlEnumConverter.ToEnum(typeof(RotateMethod), value); break;

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

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

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

                    reader.MoveToElement();
                }

                return(trueTypeMarkerSymbol);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #16
0
        public static Range ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Range range = new Range();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "equality": range.Equality = (RangeEquality)ArcXmlEnumConverter.ToEnum(typeof(RangeEquality), value); break;

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

                            case "lower": range.Lower = value; break;

                            case "upper": range.Upper = 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: range.Symbol = HashLineSymbol.ReadFrom(reader); break;

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

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

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

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

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

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

                        reader.Read();
                    }
                }

                return(range);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #17
0
        public static Capabilities ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Capabilities capabilities = new Capabilities();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "disabledtypes": capabilities.DisabledTypes = value; break;

                            case "forbidden": capabilities.Forbidden = value; break;

                            case "returngeometry": capabilities.ReturnGeometry = (ReturnGeometry)ArcXmlEnumConverter.ToEnum(typeof(ReturnGeometry), value); break;

                            case "servertype": capabilities.ServerType = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(capabilities);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #18
0
        public static LayerInfo ReadFrom(ArcXmlReader reader)
        {
            try
            {
                LayerInfo layerInfo = new LayerInfo();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "arcmaptype": layerInfo.ArcMapType = (ArcMapType)ArcXmlEnumConverter.ToEnum(typeof(ArcMapType), value); break;

                            case "id": layerInfo.ID = value; break;

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

                            case "maxscale": layerInfo.MaxScale = value; break;

                            case "minscale": layerInfo.MinScale = value; break;

                            case "name": layerInfo.Name = value; break;

                            case "parentlayerid": layerInfo.ParentLayerID = value; break;

                            case "visible": layerInfo.Visible = Convert.ToBoolean(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": layerInfo.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

                            case FClass.XmlName: layerInfo.FClass = FClass.ReadFrom(reader); break;

                            case GroupRenderer.XmlName: layerInfo.Renderer = GroupRenderer.ReadFrom(reader); break;

                            case RasterRenderer.XmlName: layerInfo.Renderer = RasterRenderer.ReadFrom(reader); break;

                            case ScaleDependentRenderer.XmlName: layerInfo.Renderer = ScaleDependentRenderer.ReadFrom(reader); break;

                            case SimpleLabelRenderer.XmlName: layerInfo.Renderer = SimpleLabelRenderer.ReadFrom(reader); break;

                            case SimpleRenderer.XmlName: layerInfo.Renderer = SimpleRenderer.ReadFrom(reader); break;

                            case Toc.XmlName: layerInfo.Toc = Toc.ReadFrom(reader); break;

                            case ValueMapLabelRenderer.XmlName: layerInfo.Renderer = ValueMapLabelRenderer.ReadFrom(reader); break;

                            case ValueMapRenderer.XmlName: layerInfo.Renderer = ValueMapRenderer.ReadFrom(reader); break;

                            case Extension.XmlName:
                                if (layerInfo.Extensions == null)
                                {
                                    layerInfo.Extensions = new List <Extension>();
                                }

                                layerInfo.Extensions.Add(Extension.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(layerInfo);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #19
0
        public static GcStyle ReadFrom(ArcXmlReader reader)
        {
            try
            {
                GcStyle gcStyle = new GcStyle();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "name": gcStyle.Name = value; break;

                            case "endoffset": gcStyle.EndOffset = Convert.ToInt32(value); break;

                            case "sideoffset": gcStyle.SideOffset = Convert.ToInt32(value); break;

                            case "sideoffsetunits": gcStyle.SideOffsetUnits = (Units)ArcXmlEnumConverter.ToEnum(typeof(Units), value); break;

                            case "spellingsensitivity": gcStyle.SpellingSensitivity = Convert.ToInt32(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 GcInput.XmlName: gcStyle.GcInputs.Add(GcInput.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(gcStyle);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #20
0
        public static Field ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Field field = new Field();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "alias": field.Alias = value; break;

                            case "description": field.Description = value; break;

                            case "name": field.Name = value; break;

                            case "precision": field.Precision = Convert.ToInt32(value); break;

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

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

                            case "value": field.Value = 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 FieldValue.XmlName: field.FieldValue = FieldValue.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(field);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #21
0
        public static Exact ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Exact exact = new Exact();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "label": exact.Label = value; break;

                            case "method": exact.Method = (ExactMethod)ArcXmlEnumConverter.ToEnum(typeof(ExactMethod), value); break;

                            case "value": exact.Value = 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 CallOutMarkerSymbol.XmlName: exact.Symbol = CallOutMarkerSymbol.ReadFrom(reader); break;

                            case ChartSymbol.XmlName: exact.Symbol = ChartSymbol.ReadFrom(reader); break;

                            case GradientFillSymbol.XmlName: exact.Symbol = GradientFillSymbol.ReadFrom(reader); break;

                            case HashLineSymbol.XmlName: exact.Symbol = HashLineSymbol.ReadFrom(reader); break;

                            case RasterFillSymbol.XmlName: exact.Symbol = RasterFillSymbol.ReadFrom(reader); break;

                            case RasterMarkerSymbol.XmlName: exact.Symbol = RasterMarkerSymbol.ReadFrom(reader); break;

                            case RasterShieldSymbol.XmlName: exact.Symbol = RasterShieldSymbol.ReadFrom(reader); break;

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

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

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

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

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

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

                        reader.Read();
                    }
                }

                return(exact);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #22
0
        public static RasterShieldSymbol ReadFrom(ArcXmlReader reader)
        {
            try
            {
                RasterShieldSymbol rasterShieldSymbol = new RasterShieldSymbol();

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

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

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

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

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

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

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

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

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

                            case "printmode": rasterShieldSymbol.PrintMode = (PrintMode)ArcXmlEnumConverter.ToEnum(typeof(PrintMode), value); break;

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

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

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

                            case "textposition":
                                string[] p = value.Split(new char[] { ',' });
                                rasterShieldSymbol.TextPosition = new NetTopologySuite.Geometries.Point(Convert.ToDouble(p[0]), Convert.ToDouble(p[1]));
                                break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(rasterShieldSymbol);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Пример #23
0
        public static Service ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Service service = new Service();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name.ToLower())
                            {
                            case "access": service.Access = (ServiceAccess)ArcXmlEnumConverter.ToEnum(typeof(ServiceAccess), value); break;

                            case "name": service.Name = value; break;

                            case "servicegroup": service.ServiceGroup = value; break;

                            case "status": service.Status = (ServiceStatus)ArcXmlEnumConverter.ToEnum(typeof(ServiceStatus), value); break;

                            case "type": service.Type = value; break;

                            case "version": service.Version = 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 Cleanup.XmlName: service.Cleanup = Cleanup.ReadFrom(reader); break;

                            case Environment.XmlName: service.Environment = Environment.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

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