示例#1
0
        public override object Clone()
        {
            SimpleLabelRenderer clone = (SimpleLabelRenderer)this.MemberwiseClone();

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

            return(clone);
        }
示例#2
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);
                }
            }
        }
示例#3
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);
                }
            }
        }
示例#4
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);
                }
            }
        }
示例#5
0
        public static ScaleDependentRenderer ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ScaleDependentRenderer scaleDependentRenderer = new ScaleDependentRenderer();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "lower": scaleDependentRenderer.Lower = value; break;

                            case "upper": scaleDependentRenderer.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 GroupRenderer.XmlName: scaleDependentRenderer.Renderer = GroupRenderer.ReadFrom(reader); break;

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

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

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

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

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

                        reader.Read();
                    }
                }

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