示例#1
0
        public void DeserializeAttributeRegistry(XmlNode xmlAttrRegistry, MapTree tree)
        {
            foreach (XmlNode xmlAttribute in xmlAttrRegistry)
            {
                if (xmlAttribute.Name == "attribute_name")
                {
                    var    attr     = xmlAttribute.Attributes["NAME"];
                    string attrName = attr != null ? attr.Value : null;

                    attr = xmlAttribute.Attributes["VISIBLE"];
                    bool visible = attr != null?bool.Parse(attr.Value) : true;

                    attr = xmlAttribute.Attributes["TYPE"];
                    MapTree.AttributeType type = (MapTree.AttributeType)(attr != null ? Enum.Parse(typeof(MapTree.AttributeType), attr.Value) : MapTree.AttributeType.UserDefined);

                    attr = xmlAttribute.Attributes["DATATYPE"];
                    MapTree.AttributeDataType dataType = (MapTree.AttributeDataType)
                                                             (attr != null ?
                                                             Enum.Parse(typeof(MapTree.AttributeDataType), attr.Value) :
                                                             MapTree.AttributeDataType.Alphanumeric);

                    attr = xmlAttribute.Attributes["LISTOPTION"];
                    MapTree.AttributeListOption listOption = (MapTree.AttributeListOption)
                                                                 (attr != null ?
                                                                 Enum.Parse(typeof(MapTree.AttributeListOption), attr.Value) :
                                                                 MapTree.AttributeListOption.OptionalList);

                    SortedSet <string> attrValues = null;
                    if (listOption != MapTree.AttributeListOption.NoList)
                    {
                        attrValues = new SortedSet <string>();

                        foreach (XmlNode xmlValue in xmlAttribute.ChildNodes)
                        {
                            if (xmlValue.Name == "attribute_value")
                            {
                                attr = xmlValue.Attributes["VALUE"];
                                if (attr != null)
                                {
                                    attrValues.Add(attr.Value);
                                }
                            }
                        }
                    }

                    new MapTree.AttributeSpec(tree, attrName, visible, dataType, listOption, attrValues, type);
                }
            }
        }
示例#2
0
 public AttributeSpecDataType(MapTree.AttributeSpec spec, MapTree.AttributeDataType oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }