public XmlNode ToXml(XmlDocument doc) { XmlNode layerNode = doc.CreateElement("PointLayer"); 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(); layerNode.Attributes.Append(nameAttribute); layerNode.Attributes.Append(aliasNameAttribute); layerNode.Attributes.Append(templateAttribute); layerNode.Attributes.Append(visibleAttribute); 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 (_xField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _xField.TypeName) == null) { fieldsNode.AppendChild(_xField.ToXml(doc)); } if (_yField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _yField.TypeName) == null) { fieldsNode.AppendChild(_yField.ToXml(doc)); } if (_zField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _zField.TypeName) == null) { fieldsNode.AppendChild(_zField.ToXml(doc)); } if (_depthField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _depthField.TypeName) == null) { fieldsNode.AppendChild(_depthField.ToXml(doc)); } if (_featureField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _featureField.TypeName) == null) { fieldsNode.AppendChild(_featureField.ToXml(doc)); } if (_subsidField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _subsidField.TypeName) == null) { fieldsNode.AppendChild(_subsidField.ToXml(doc)); } if (_pStyleField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _pStyleField.TypeName) == null) { fieldsNode.AppendChild(_pStyleField.ToXml(doc)); } if (_pdsField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _pdsField.TypeName) == null) { fieldsNode.AppendChild(_pdsField.ToXml(doc)); } if (_codeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _codeField.TypeName) == null) { fieldsNode.AppendChild(_codeField.ToXml(doc)); } if (_mapNoField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _mapNoField.TypeName) == null) { fieldsNode.AppendChild(_mapNoField.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 (_rotangField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _rotangField.TypeName) == null) { fieldsNode.AppendChild(_rotangField.ToXml(doc)); } if (_roadCodeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _roadCodeField.TypeName) == null) { fieldsNode.AppendChild(_roadCodeField.ToXml(doc)); } if (_mDateField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _mDateField.TypeName) == null) { fieldsNode.AppendChild(_mDateField.ToXml(doc)); } if (_pcjhField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _pcjhField.TypeName) == null) { fieldsNode.AppendChild(_pcjhField.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); }
public XmlNode ToXml(XmlDocument doc) { XmlNode layerNode = doc.CreateElement("LineAssist"); 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(); layerNode.Attributes.Append(nameAttribute); layerNode.Attributes.Append(aliasNameAttribute); layerNode.Attributes.Append(templateAttribute); layerNode.Attributes.Append(visibleAttribute); XmlNode fieldsNode = doc.CreateElement("Fields"); if (_noField != null && _template != 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 (_gxlxField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _gxlxField.TypeName) == null) { fieldsNode.AppendChild(_gxlxField.ToXml(doc)); } if (_sslxField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _sslxField.TypeName) == null) { fieldsNode.AppendChild(_sslxField.ToXml(doc)); } if (_lineTypeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _lineTypeField.TypeName) == null) { fieldsNode.AppendChild(_lineTypeField.ToXml(doc)); } if (_codeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _codeField.TypeName) == null) { fieldsNode.AppendChild(_codeField.ToXml(doc)); } if (_roadCodeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _roadCodeField.TypeName) == null) { fieldsNode.AppendChild(_roadCodeField.ToXml(doc)); } if (_dCodeField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _dCodeField.TypeName) == null) { fieldsNode.AppendChild(_dCodeField.ToXml(doc)); } if (_dDateField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _dDateField.TypeName) == null) { fieldsNode.AppendChild(_dDateField.ToXml(doc)); } if (_mDateField != null && _template != null && _template.Fields.FirstOrDefault(c => c.TypeName == _mDateField.TypeName) == null) { fieldsNode.AppendChild(_mDateField.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); }
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); }