#region 清除台风历史路径图元
TrackingLayer lsLayer = MapInstance.Instance.Layers["台风历史路径"] as TrackingLayer;
TrackingLayer legendLayer = MapInstance.Instance.Layers["台风点标注"] as TrackingLayer;
Debug.Assert(lsLayer != null, "找不到台风预报路径图层");
Debug.Assert(legendLayer != null, "找不到台风点标注");
lsLayer.ClearGeometries();
legendLayer.ClearGeometries();
#endregion
#region 遍历数据创建图元
DataView dv = data.DefaultView;
dv.Sort = "RQSJ ASC";
DataTable dt = dv.ToTable();
Chain chain = new Chain();
TFPolyline line = new TFPolyline(chain);
ColorConverter cc = new ColorConverter();
List<TFPoint> pointList = new List<TFPoint>();
for (int i = 0; i < dt.Rows.Count; ++i)
{
DataRow dr = dt.Rows[i];
StructPoint sp = new StructPoint(double.Parse(dr["JD"].ToString()), double.Parse(dr["WD"].ToString()));
TFPoint pt = new TFPoint(sp.X, sp.Y);
Color pointColor = Color.Black;
if (i < dt.Rows.Count - 1)
{
if (!dr["COLOR"].ToString().Equals(string.Empty))
{
pointColor = (Color)cc.ConvertFromString("#" + dr["COLOR"].ToString());
}
pt.Legend = new PointLegend(pointColor, pointColor, new Size(Setting.TFPointsize, Setting.TFPointsize), MarkStyle.Ellipse);
#region 设置台风历史路径首节点的标注
if (i == 0)
{
TextGeometry textGeo = new TextGeometry(Convert.ToDateTime(dr["rqsj"]).ToString("dd日HH时"));
textGeo.Font = new Font("Time New Roman", 14);
textGeo.Point = pt;
textGeo.ForeColor = Color.Black;
textGeo.TextPosition = TextPosition.Right;
textGeo.Tag = string.Empty;
legendLayer.AddGeometry(textGeo);
}
#endregion
pt.IsLabelVisible = true;
lsLayer.IsLabelVisible = true;
}
else
{
Image image = Resource.当前台风;
pt.Legend = new PointLegend(image, image.Size);
SetLSLJLastPoint((float)pt.X, (float)pt.Y);
TextGeometry textGeo = new TextGeometry(Convert.ToDateTime(dr["rqsj"]).ToString("dd日HH时"));
textGeo.Font = new Font("Time New Roman", 14);
textGeo.Point = pt;
textGeo.ForeColor = Color.Black;
textGeo.TextPosition = TextPosition.Right;
textGeo.Tag = string.Empty;
legendLayer.AddGeometry(textGeo);
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>