Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
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.º 3
0
        public override object Clone()
        {
            SimplePolygonSymbol clone = (SimplePolygonSymbol)this.MemberwiseClone();

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