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

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

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

                    reader.MoveToElement();
                }

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

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

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

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

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

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

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

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

                        reader.Read();
                    }
                }

                return(other);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
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);
                }
            }
        }
Exemplo n.º 4
0
        public override object Clone()
        {
            TrueTypeMarkerSymbol clone = (TrueTypeMarkerSymbol)this.MemberwiseClone();

            return(clone);
        }
Exemplo n.º 5
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);
                }
            }
        }
Exemplo n.º 6
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);
                }
            }
        }