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); } } }
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); } } }