namespace Yw.WpfUI.Hydro
|
{
|
/// <summary>
|
/// 节点绘制3D
|
/// </summary>
|
internal abstract class NodeDraw3D : VisualDraw3D
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public NodeDraw3D(NodeL3d visual, NodeDrawer drawer) : base(visual, drawer)
|
{
|
|
}
|
|
/// <summary>
|
/// 可见元素
|
/// </summary>
|
public new NodeL3d Visual
|
{
|
get { return _visual as NodeL3d; }
|
set { _visual = value; }
|
}
|
|
/// <summary>
|
/// 绘制器
|
/// </summary>
|
public new NodeDrawer Drawer
|
{
|
get { return _drawer as NodeDrawer; }
|
set { _drawer = value; }
|
}
|
|
#region 合法验证
|
|
/// <summary>
|
/// 验证
|
/// </summary>
|
public override bool Verify()
|
{
|
if (this.Visual == null)
|
{
|
return false;
|
}
|
if (this.Visual.Position == null)
|
{
|
return false;
|
}
|
if (this.Drawer == null)
|
{
|
return false;
|
}
|
if (!this.Drawer.Position.HasValue)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
#endregion
|
|
#region 位置处理
|
|
/// <summary>
|
/// 偏移
|
/// </summary>
|
public override void Offset(Vector3D offset)
|
{
|
if (this.Visual != null)
|
{
|
if (this.Visual.Position != null)
|
{
|
this.Visual.Position = this.Visual.Position + offset.ToPointL3d();
|
}
|
}
|
this.Drawer?.UpdatePositions();
|
}
|
|
/// <summary>
|
/// 获取位置
|
/// </summary>
|
public override List<Point3D> GetPositions()
|
{
|
return this.Drawer?.GetPositions();
|
}
|
|
/// <summary>
|
/// 获取位置
|
/// </summary>
|
public virtual Point3D? GetPosition()
|
{
|
return this.Drawer?.Position;
|
}
|
|
/// <summary>
|
/// 更新位置
|
/// </summary>
|
public override void UpdatePositions()
|
{
|
this.Drawer?.UpdatePositions();
|
}
|
|
/// <summary>
|
/// 更新位置
|
/// </summary>
|
public virtual void UpdatePosition(Point3D pt)
|
{
|
if (this.Visual != null)
|
{
|
this.Visual.Position = pt.ToPointL3d();
|
}
|
if (this.Drawer != null)
|
{
|
this.Drawer.Position = pt;
|
}
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
}
|
}
|