|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.PluginServiceInterface.Model
|
|
|
|
|
{
|
|
|
|
|
public class LayerFieldCfg
|
|
|
|
|
{
|
|
|
|
|
public LayerFieldCfg() { Layers = new List<LayerInfo>(); }
|
|
|
|
|
public List<LayerInfo> Layers { get; set; }
|
|
|
|
|
public string ToXML()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string Str = SerializeAPI.SerializeToXML<LayerFieldCfg>(this);
|
|
|
|
|
return Str;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public LayerFieldCfg(string pFilePath)
|
|
|
|
|
{
|
|
|
|
|
LayerFieldCfg cfg = SerializeAPI.DeserializeToObject2<LayerFieldCfg>(pFilePath);
|
|
|
|
|
this.Layers = cfg.Layers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class LayerInfo
|
|
|
|
|
{
|
|
|
|
|
[XmlAttribute("CfgName")]
|
|
|
|
|
public string CfgName { get; set; }
|
|
|
|
|
[System.Xml.Serialization.XmlIgnore]
|
|
|
|
|
private List<FieldCfg> _Fields;
|
|
|
|
|
[XmlElement(ElementName = "FieldCfg")]
|
|
|
|
|
public List<FieldCfg> Fields
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_Fields != null)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < _Fields.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
_Fields[i].ID = i + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _Fields;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_Fields = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public LayerInfo()
|
|
|
|
|
{
|
|
|
|
|
Fields = new List<FieldCfg>();
|
|
|
|
|
}
|
|
|
|
|
public List<FieldCfg> GetAllField()
|
|
|
|
|
{
|
|
|
|
|
List<FieldCfg> result = new List<FieldCfg>();
|
|
|
|
|
if (_Fields != null)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < _Fields.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
result.Add(_Fields[i]);
|
|
|
|
|
if (_Fields[i].Fields.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.AddRange(GetSubField(_Fields[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
private List<FieldCfg> GetSubField(FieldCfg pField)
|
|
|
|
|
{
|
|
|
|
|
List<FieldCfg> result = new List<FieldCfg>();
|
|
|
|
|
if (pField != null)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < pField.Fields.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
result.Add(pField.Fields[i]);
|
|
|
|
|
if (pField.Fields[i].Fields.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.AddRange(GetSubField(pField.Fields[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|