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

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "lookupfield": valueMapRenderer.LookupField = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

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

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

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

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

                        reader.Read();
                    }
                }

                return(valueMapRenderer);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
예제 #2
0
        public override object Clone()
        {
            Exact clone = (Exact)this.MemberwiseClone();

            if (Symbol != null)
            {
                clone.Symbol = (Symbol)Symbol.Clone();
            }

            return(clone);
        }
예제 #3
0
        public static ValueMapLabelRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ValueMapLabelRenderer valueMapLabelRenderer = new ValueMapLabelRenderer();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "lookupfield": valueMapLabelRenderer.LookupField = value; break;

                            case "labelfield": valueMapLabelRenderer.LabelField = value; break;

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

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

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

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

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

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

                            case "rotationalangles": valueMapLabelRenderer.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 Exact.XmlName: valueMapLabelRenderer.Classifications.Add(Exact.ReadFrom(reader)); break;

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

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

                        reader.Read();
                    }
                }

                return(valueMapLabelRenderer);
            }
            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 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);
                }
            }
        }