年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

671 lines
21 KiB

using KGIS.Framework.Platform;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace Kingo.PluginServiceInterface.Model
{
public class TreeNode : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string _Text;
/// <summary>
/// 显示的文本值
/// </summary>
public string Name
{
get { return this._Text; }
set
{
_Text = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Name"));
}
}
}
private ContextMenu _cMenu;
public ContextMenu cMenu
{
get { return this._cMenu; }
set
{
_cMenu = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("cMenu"));
}
}
}
private bool? _Checked;
/// <summary>
/// 是否选中
/// </summary>
public bool? Checked
{
get { return this._Checked; }
set
{
_Checked = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Checked"));
}
}
}
private bool _IsExpanded;
/// <summary>
/// 是否展开
/// </summary>
public bool IsExpanded
{
get { return this._IsExpanded; }
set
{
_IsExpanded = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsExpanded"));
}
}
}
private string _icon;
/// <summary>
/// 节点图标:相对路径
/// </summary>
public string Icon
{
get
{
if (this.Data is WYRWTB)
{
WYRWTB wYRWTB = this.Data as WYRWTB;
if (wYRWTB.XBTB == 1)
{
_icon = "pack://application:,,,/Kingo.Plugin.General;component/Resources/星标.png";
}
else
{
_icon = "pack://application:,,,/Kingo.Plugin.General;component/Resources/未星标.png";
}
}
return this._icon;
}
set
{
_icon = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Icon"));
}
}
}
private string _iconTooltip;
public string IconTooltip
{
get
{
if (!string.IsNullOrWhiteSpace(Icon))
{
_iconTooltip = System.IO.Path.GetFileNameWithoutExtension(Icon);
}
return this._iconTooltip;
}
set
{
_iconTooltip = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IconTooltip"));
}
}
}
private ObservableCollection<TreeNode> _nodes;
/// <summary>
/// 子节点,默认null
/// </summary>
public ObservableCollection<TreeNode> Nodes
{
get { return this._nodes; }
set
{
_nodes = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Nodes"));
}
}
}
private object _data;
/// <summary>
/// 该节点数据项,默认null
/// </summary>
public virtual object Data
{
get { return this._data; }
set
{
_data = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Data"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Icon"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IconTooltip"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("FWYVisibility"));
}
}
}
public virtual bool IsOpenEdit { get; set; }
private string _PackageState;
/// <summary>
/// 0:未完成 1:已完成 2:返外业 3:待确认 4:质检错误
/// </summary>
public string PackageState
{
get { return this._PackageState; }
set
{
_PackageState = value;
if (this.PropertyChanged != null && _PackageState != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PackageState"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("WWCVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("WCVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ErrorVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("YDCVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("UploadVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ErrorUploadVisibility"));
}
}
}
private int _px;
public int Paixu
{
get { return this._px; }
set
{
_px = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Paixu"));
}
}
}
public object _nodeID { get; internal set; }
public object NodeID
{
get { return this._nodeID; }
set
{
_nodeID = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("NodeID"));
}
}
}
public int _nodeLevel { get; internal set; }
/// <summary>
/// 层级:
/// 0:任务列表 1、任务包节点 2、变更范围节点 3、图斑节点
/// </summary>
public int NodeLevel
{
get { return this._nodeLevel; }
set
{
_nodeLevel = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("NodeLevel"));
}
}
}
/// <summary>
/// 返外业
/// </summary>
public Visibility FWYVisibility
{
get
{
if (Data == null || (Data as WYRWTB) == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && Data is WYRWTB && (Data as WYRWTB).FWY == 1)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
private Visibility _PackageButtonVisibility;
public Visibility PackageButtonVisibility
{
get { return _PackageButtonVisibility; }
set
{
_PackageButtonVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PackageButtonVisibility"));
}
}
}
private Visibility _ParentButtonVisibility;
/// <summary>
/// 树父节点刷新按钮状态
/// </summary>
public Visibility ParentButtonVisibility
{
get { return this._ParentButtonVisibility; }
set
{
_ParentButtonVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ParentButtonVisibility"));
}
}
}
private Visibility _ZZTBVisibility;
public Visibility ZZTBVisibility
{
get { return _ZZTBVisibility; }
set
{
_ZZTBVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ZZTBVisibility"));
}
}
}
private Visibility _TBVisibility;
/// <summary>
/// 图斑状态 预处理:已预审 审核:已审核
/// </summary>
public Visibility TBVisibility
{
get { return this._TBVisibility; }
set
{
_TBVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("TBVisibility"));
}
}
}
private Visibility _YYSVisibility;
/// <summary>
/// 适用于预处理 图斑状态 预处理:已预审 审核:已审核
/// </summary>
public Visibility YYSVisibility
{
get { return this._YYSVisibility; }
set
{
_YYSVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("YYSVisibility"));
}
}
}
private Visibility _ZZBGVisibility;
public Visibility ZZBGVisibility
{
get { return this._ZZBGVisibility; }
set
{
_ZZBGVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ZZBGVisibility"));
}
}
}
private Visibility visibilityPackageButton;
/// <summary>
/// 打开任务包按钮显示状态
/// </summary>
public Visibility OpenPackageVisibility
{
get { return this.visibilityPackageButton; }
set
{
visibilityPackageButton = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("OpenPackageVisibility"));
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ClosePackageVisibility"));
}
}
}
/// <summary>
/// 关闭任务包按钮显示状态
/// </summary>
public Visibility ClosePackageVisibility
{
get
{
//只有任务包节点 NodeLevel = 1才显示
if (this.NodeLevel != 1)
{
return Visibility.Collapsed;
}
if (this.OpenPackageVisibility == Visibility.Collapsed && this.Data is ESRI.ArcGIS.Carto.IFeatureLayer)
{
return Visibility.Visible;
}
if (this.OpenPackageVisibility == Visibility.Visible || this.Data == null || (Data as TaskPackage) == null)
{
return Visibility.Collapsed;
}
TaskPackage taskPackage = Data as TaskPackage;
if (string.IsNullOrWhiteSpace(taskPackage.PackagePath) || !System.IO.File.Exists(taskPackage.PackagePath))
{
return Visibility.Collapsed;
}
return Visibility.Visible;
}
}
/// <summary>
/// 完成和未完成个数是否显示
/// </summary>
public Visibility WCAndWWCNumVisibility
{
get
{
if (!KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName").Equals("65"))
{
return Visibility.Collapsed;
}
if (Platform.Instance.SystemType != SystemTypeEnum.DTBJK)
{
return Visibility.Collapsed;
}
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 1)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
private int _UncompletedCount;
/// <summary>
/// 未完成个数
/// </summary>
public int UncompletedCount
{
get { return this._UncompletedCount; }
set
{
_UncompletedCount = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("UncompletedCount"));
}
}
}
private int _CompletedCount;
/// <summary>
/// 完成个数
/// </summary>
public int CompletedCount
{
get { return this._CompletedCount; }
set
{
_CompletedCount = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CompletedCount"));
}
}
}
/// <summary>
/// 未完成
/// </summary>
public Visibility WWCVisibility
{
get
{
if (Platform.Instance.SystemType == SystemTypeEnum.YCLJK)
{
return Visibility.Collapsed;
}
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && (this.PackageState == null || this.PackageState.Equals("未完成")))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
/// <summary>
/// 已完成
/// </summary>
public Visibility WCVisibility
{
get
{
if (Platform.Instance.SystemType == SystemTypeEnum.YCLJK)
{
return Visibility.Collapsed;
}
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && this.PackageState != null && this.PackageState.Equals("已完成"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
/// <summary>
/// 已上传
/// </summary>
public Visibility UploadVisibility
{
get
{
if (Platform.Instance.SystemType == SystemTypeEnum.YCLJK)
{
return Visibility.Collapsed;
}
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && this.PackageState != null && this.PackageState.Equals("已上传"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
/// <summary>
/// 上传失败
/// </summary>
public Visibility ErrorUploadVisibility
{
get
{
if (Platform.Instance.SystemType == SystemTypeEnum.YCLJK)
{
return Visibility.Collapsed;
}
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && this.PackageState != null && this.PackageState.Equals("上传失败"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
/// <summary>
/// 已导出
/// </summary>
public Visibility YDCVisibility
{
get
{
if (Data == null || (Data as WYRWTB) == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && this.PackageState != null && this.PackageState.Equals("已输出"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
/// <summary>
/// 质检错误
/// </summary>
public Visibility ErrorVisibility
{
get
{
if (Data == null)
{
return Visibility.Collapsed;
}
if (this.NodeLevel == 2 && this.PackageState != null && this.PackageState.Equals("质检错误"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
}
private Visibility _LoadingVisibility = Visibility.Collapsed;
public Visibility LoadingVisibility
{
get
{
return _LoadingVisibility;
}
set
{
_LoadingVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("LoadingVisibility"));
}
}
}
private Visibility _TreeVisibility;
/// <summary>
/// 树节点是否显示
/// </summary>
public Visibility TreeVisibility
{
get { return this._TreeVisibility; }
set
{
_TreeVisibility = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("TreeVisibility"));
}
}
}
#region NodeX-构造函数(初始化)
/// <summary>
/// NodeX-构造函数(初始化)
/// </summary>
public TreeNode()
{
this.IconTooltip = string.Empty;
this.Name = string.Empty;
this.Icon = string.Empty;
this.Checked = false;
ParentButtonVisibility = Visibility.Collapsed;
OpenPackageVisibility = Visibility.Collapsed;
ZZBGVisibility = Visibility.Collapsed;
ZZTBVisibility = Visibility.Collapsed;
TBVisibility = Visibility.Collapsed;
YYSVisibility = Visibility.Collapsed;
this.LoadingVisibility = Visibility.Collapsed;
Nodes = new ObservableCollection<TreeNode>();
if (Platform.Instance.SystemType == SystemTypeEnum.DTBJK || Platform.Instance.SystemType == SystemTypeEnum.WYZS)
{
if (ParentNode != null && ParentNode.Data != null)
Paixu = ParentNode.Nodes.Count + 1;
this.PackageState = "未完成";
}
else if (Platform.Instance.SystemType == SystemTypeEnum.YCLJK)
{
this.PackageState = null;
}
}
private TreeNode _ParentNode;
/// <summary>
/// 上级节点
/// </summary>
public TreeNode ParentNode
{
get { return this._ParentNode; }
set
{
_ParentNode = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("ParentNode"));
}
}
}
private TreeNode _PackageNode;
/// <summary>
/// 所属监测图斑图层节点/任务包所在的树节点
/// </summary>
public TreeNode PackageNode
{
get { return this._PackageNode; }
set
{
_PackageNode = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PackageNode"));
}
}
}
#endregion
}
}