예제 #1
0
        public XmlNode ToXml(XmlDocument doc)
        {
            XmlNode      layerNode     = doc.CreateElement("Layer");
            XmlAttribute nameAttribute = doc.CreateAttribute("Name");

            nameAttribute.Value = _name;
            XmlAttribute aliasNameAttribute = doc.CreateAttribute("AliasName");

            aliasNameAttribute.Value = _aliasName;
            XmlAttribute templateAttribute = doc.CreateAttribute("Template");

            templateAttribute.Value = _templateName;
            XmlAttribute visibleAttribute = doc.CreateAttribute("Visible");

            visibleAttribute.Value = _visible.ToString();
            XmlAttribute typeAttribute = doc.CreateAttribute("DataType");

            typeAttribute.Value = EnumHelper.ConvertDataTypeToString(_dataType);
            XmlAttribute heightAttribute = doc.CreateAttribute("HeightType");

            heightAttribute.Value = EnumHelper.ConvertHeightTypeToStr(_heightType);

            XmlAttribute depthAttribute = doc.CreateAttribute("DepthType");

            depthAttribute.Value = EnumHelper.ConvertDepthTypeToStr(_depthType);

            XmlAttribute sectionAttribute = doc.CreateAttribute("SectionType");

            sectionAttribute.Value = EnumHelper.ConvertSectionTypeToStr(_sectionType);

            XmlAttribute validateKeysAttribute = doc.CreateAttribute("ValidateKeys");

            validateKeysAttribute.Value = _validateKeys;
            XmlAttribute autoNamesAttribute = doc.CreateAttribute("AutoNames");

            autoNamesAttribute.Value = _autoNames;
            layerNode.Attributes.Append(nameAttribute);
            layerNode.Attributes.Append(aliasNameAttribute);
            layerNode.Attributes.Append(templateAttribute);
            layerNode.Attributes.Append(visibleAttribute);
            layerNode.Attributes.Append(typeAttribute);
            layerNode.Attributes.Append(heightAttribute);
            layerNode.Attributes.Append(depthAttribute);
            layerNode.Attributes.Append(sectionAttribute);
            layerNode.Attributes.Append(validateKeysAttribute);
            layerNode.Attributes.Append(autoNamesAttribute);

            XmlNode fieldsNode = doc.CreateElement("Fields");

            foreach (IYTField ytField in _fields)
            {
                XmlNode fieldNode = ytField.ToXml(doc);
                fieldsNode.AppendChild(fieldNode);
            }
            layerNode.AppendChild(fieldsNode);
            return(layerNode);
        }
예제 #2
0
        public XmlNode ToXml(XmlDocument doc)
        {
            XmlNode      layerNode     = doc.CreateElement("LineLayer");
            XmlAttribute nameAttribute = doc.CreateAttribute("Name");

            nameAttribute.Value = _name;
            XmlAttribute aliasNameAttribute = doc.CreateAttribute("AliasName");

            aliasNameAttribute.Value = _aliasName;
            XmlAttribute templateAttribute = doc.CreateAttribute("Template");

            templateAttribute.Value = _templateName;

            XmlAttribute heightTypeAttribute = doc.CreateAttribute("HeightType");

            heightTypeAttribute.Value = EnumHelper.ConvertHeightTypeToStr(_heightType);
            XmlAttribute visibleAttribute = doc.CreateAttribute("Visible");

            visibleAttribute.Value = _visible.ToString();
            layerNode.Attributes.Append(nameAttribute);
            layerNode.Attributes.Append(aliasNameAttribute);
            layerNode.Attributes.Append(templateAttribute);
            layerNode.Attributes.Append(visibleAttribute);
            layerNode.Attributes.Append(heightTypeAttribute);

            XmlNode fieldsNode = doc.CreateElement("Fields");

            if (_noField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _noField.TypeName) == null)
            {
                fieldsNode.AppendChild(_noField.ToXml(doc));
            }
            if (_sPointField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _sPointField.TypeName) == null)
            {
                fieldsNode.AppendChild(_sPointField.ToXml(doc));
            }
            if (_ePointField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _ePointField.TypeName) == null)
            {
                fieldsNode.AppendChild(_ePointField.ToXml(doc));
            }
            if (_sDeepField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _sDeepField.TypeName) == null)
            {
                fieldsNode.AppendChild(_sDeepField.ToXml(doc));
            }
            if (_eDeepField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _eDeepField.TypeName) == null)
            {
                fieldsNode.AppendChild(_eDeepField.ToXml(doc));
            }
            if (_shField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _shField.TypeName) == null)
            {
                fieldsNode.AppendChild(_shField.ToXml(doc));
            }
            if (_ehField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _ehField.TypeName) == null)
            {
                fieldsNode.AppendChild(_ehField.ToXml(doc));
            }
            if (_codeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _codeField.TypeName) == null)
            {
                fieldsNode.AppendChild(_codeField.ToXml(doc));
            }
            if (_materialField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _materialField.TypeName) == null)
            {
                fieldsNode.AppendChild(_materialField.ToXml(doc));
            }
            if (_dTypeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _dTypeField.TypeName) == null)
            {
                fieldsNode.AppendChild(_dTypeField.ToXml(doc));
            }
            if (_lineStyleField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _lineStyleField.TypeName) == null)
            {
                fieldsNode.AppendChild(_lineStyleField.ToXml(doc));
            }
            if (_dsField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _dsField.TypeName) == null)
            {
                fieldsNode.AppendChild(_dsField.ToXml(doc));
            }
            if (_sectionSizeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _sectionSizeField.TypeName) == null)
            {
                fieldsNode.AppendChild(_sectionSizeField.ToXml(doc));
            }
            if (_pdmField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _pdmField.TypeName) == null)
            {
                fieldsNode.AppendChild(_pdmField.ToXml(doc));
            }
            if (_pipeNatureField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _pipeNatureField.TypeName) == null)
            {
                fieldsNode.AppendChild(_pipeNatureField.ToXml(doc));
            }
            if (_msrqField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _msrqField.TypeName) == null)
            {
                fieldsNode.AppendChild(_msrqField.ToXml(doc));
            }
            if (_mDateField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _mDateField.TypeName) == null)
            {
                fieldsNode.AppendChild(_mDateField.ToXml(doc));
            }
            if (_useStatusField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _useStatusField.TypeName) == null)
            {
                fieldsNode.AppendChild(_useStatusField.ToXml(doc));
            }
            if (_bCodeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _bCodeField.TypeName) == null)
            {
                fieldsNode.AppendChild(_bCodeField.ToXml(doc));
            }
            if (_roadCodeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _roadCodeField.TypeName) == null)
            {
                fieldsNode.AppendChild(_roadCodeField.ToXml(doc));
            }
            if (_cabCountField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _cabCountField.TypeName) == null)
            {
                fieldsNode.AppendChild(_cabCountField.ToXml(doc));
            }
            if (_volPresField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _volPresField.TypeName) == null)
            {
                fieldsNode.AppendChild(_volPresField.ToXml(doc));
            }
            if (_holeCountField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _holeCountField.TypeName) == null)
            {
                fieldsNode.AppendChild(_holeCountField.ToXml(doc));
            }
            if (_holeUsedField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _holeUsedField.TypeName) == null)
            {
                fieldsNode.AppendChild(_holeUsedField.ToXml(doc));
            }
            if (_flowDField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _flowDField.TypeName) == null)
            {
                fieldsNode.AppendChild(_flowDField.ToXml(doc));
            }
            if (_remarkField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _remarkField.TypeName) == null)
            {
                fieldsNode.AppendChild(_remarkField.ToXml(doc));
            }
            layerNode.AppendChild(fieldsNode);
            return(layerNode);
        }