- 积分
- 215
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-2-22
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
代码如下:
aLayer = new VectorLayer(ShapeTypes.Point);
aLayer.LayerName = "预警信号";
aLayer.LegendScheme =new LegendScheme(ShapeTypes.Point);
aLayer.LegendScheme.ImportFromXMLFile("alarm.lgs");
aLayer.Visible = true;
aLayer.EditAddField("STATION", typeof(string));
aLayer.EditAddField("LON", typeof(double));
aLayer.EditAddField("LAT", typeof(double));
aLayer.EditAddField("alarmcolor", typeof(double));
aLayer.EditAddField("alarmcontent", typeof(double));
//Add shape
foreach (DictionaryEntry de in alarmname)
{
PointShape aPS = new PointShape();
PointD aPoint = new PointD();
aPoint.X = Convert.ToDouble(lonhash[de.Key]);
aPoint.Y = Convert.ToDouble(lathash[de.Key]);
aPS.Point = aPoint;
int shapeNum = aLayer.ShapeNum;
if (aLayer.EditInsertShape(aPS, shapeNum))
{
//Edit record value
aLayer.EditCellValue("STATION", shapeNum, de.Key);
aLayer.EditCellValue("LON", shapeNum, aPoint.X);
aLayer.EditCellValue("LAT", shapeNum, aPoint.Y);
aLayer.EditCellValue("alarmcolor", shapeNum, Convert.ToString(alarmname[de.Key]) + Convert.ToString(alarmcolor[de.Key]));
aLayer.EditCellValue("alarmcontent", shapeNum, alarmcontent[de.Key]);
}
}
//Add layer
frmain.G_LayerLegend.AddLayer(aLayer, true);
this.mapView1.PaintLayers();
alarm.lgs的内容如下:
<MeteoInfo file="alarmlgs" type="LegendScheme">
<LegendScheme FieldName="alarmcolor" LegendType="UniqueValue" ShapeType="Point" BreakNum="46" HasNoData="False" MinValue="0" MaxValue="0" UNDEF="-9999">
<Breaks>
<Break Caption="暴雪橙色" StartValue="暴雪橙色" EndValue="暴雪橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雪橙色.gif" Angle="0" />
<Break Caption="暴雪黄色" StartValue="暴雪黄色" EndValue="暴雪黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雪黄色.gif" Angle="0" />
<Break Caption="暴雪红色" StartValue="暴雪红色" EndValue="暴雪红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雪红色.gif" Angle="0" />
<Break Caption="暴雪蓝色" StartValue="暴雪蓝色" EndValue="暴雪蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雪蓝色.gif" Angle="0" />
<Break Caption="暴雨橙色" StartValue="暴雨橙色" EndValue="暴雨橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雨橙色.gif" Angle="0" />
<Break Caption="暴雨黄色" StartValue="暴雨黄色" EndValue="暴雨黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雨黄色.gif" Angle="0" />
<Break Caption="暴雨红色" StartValue="暴雨红色" EndValue="暴雨红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雨红色.gif" Angle="0" />
<Break Caption="暴雨蓝色" StartValue="暴雨蓝色" EndValue="暴雨蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\暴雨蓝色.gif" Angle="0" />
<Break Caption="冰雹橙色" StartValue="冰雹橙色" EndValue="冰雹橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\冰雹橙色.gif" Angle="0" />
<Break Caption="冰雹红色" StartValue="冰雹红色" EndValue="冰雹红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\冰雹红色.gif" Angle="0" />
<Break Caption="大风橙色" StartValue="大风橙色" EndValue="大风橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大风橙色.gif" Angle="0" />
<Break Caption="大风黄色" StartValue="大风黄色" EndValue="大风黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大风黄色.gif" Angle="0" />
<Break Caption="大风红色" StartValue="大风红色" EndValue="大风红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大风红色.gif" Angle="0" />
<Break Caption="大风蓝色" StartValue="大风蓝色" EndValue="大风蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大风蓝色.gif" Angle="0" />
<Break Caption="大雾橙色" StartValue="大雾橙色" EndValue="大雾橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大雾橙色.gif" Angle="0" />
<Break Caption="大雾黄色" StartValue="大雾黄色" EndValue="大雾黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大雾黄色.gif" Angle="0" />
<Break Caption="大雾红色" StartValue="大雾红色" EndValue="大雾红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\大雾红色.gif" Angle="0" />
<Break Caption="道路结冰橙色" StartValue="道路结冰橙色" EndValue="道路结冰橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\道路结冰橙色.gif" Angle="0" />
<Break Caption="道路结冰黄色" StartValue="道路结冰黄色" EndValue="道路结冰黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\道路结冰黄色.gif" Angle="0" />
<Break Caption="道路结冰红色" StartValue="道路结冰红色" EndValue="道路结冰红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\道路结冰红色.gif" Angle="0" />
<Break Caption="干旱橙色" StartValue="干旱橙色" EndValue="干旱橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\干旱橙色.gif" Angle="0" />
<Break Caption="干旱红色" StartValue="干旱红色" EndValue="干旱红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\干旱红色.gif" Angle="0" />
<Break Caption="干热风橙色" StartValue="干热风橙色" EndValue="干热风橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\干热风橙色.gif" Angle="0" />
<Break Caption="干热风红色" StartValue="干热风红色" EndValue="干热风红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\干热风红色.gif" Angle="0" />
<Break Caption="高温橙色" StartValue="高温橙色" EndValue="高温橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\高温橙色.gif" Angle="0" />
<Break Caption="高温黄色" StartValue="高温黄色" EndValue="高温黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\高温黄色.gif" Angle="0" />
<Break Caption="高温红色" StartValue="高温红色" EndValue="高温红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\高温红色.gif" Angle="0" />
<Break Caption="寒潮橙色" StartValue="寒潮橙色" EndValue="寒潮橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\寒潮橙色.gif" Angle="0" />
<Break Caption="寒潮黄色" StartValue="寒潮黄色" EndValue="寒潮黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\寒潮黄色.gif" Angle="0" />
<Break Caption="寒潮红色" StartValue="寒潮红色" EndValue="寒潮红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\寒潮红色.gif" Angle="0" />
<Break Caption="寒潮蓝色" StartValue="寒潮蓝色" EndValue="寒潮蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\寒潮蓝色.gif" Angle="0" />
<Break Caption="雷电橙色" StartValue="雷电橙色" EndValue="雷电橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\雷电橙色.gif" Angle="0" />
<Break Caption="雷电黄色" StartValue="雷电黄色" EndValue="雷电黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\雷电黄色.gif" Angle="0" />
<Break Caption="雷电红色" StartValue="雷电红色" EndValue="雷电红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\雷电红色.gif" Angle="0" />
<Break Caption="霾橙色" StartValue="霾橙色" EndValue="霾橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\霾橙色.gif" Angle="0" />
<Break Caption="霾黄色" StartValue="霾黄色" EndValue="霾黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\霾黄色.gif" Angle="0" />
<Break Caption="沙尘暴橙色" StartValue="沙尘暴橙色" EndValue="沙尘暴橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\沙尘暴橙色.gif" Angle="0" />
<Break Caption="沙尘暴黄色" StartValue="沙尘暴黄色" EndValue="沙尘暴黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\沙尘暴黄色.gif" Angle="0" />
<Break Caption="沙尘暴红色" StartValue="沙尘暴红色" EndValue="沙尘暴红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\沙尘暴红色.gif" Angle="0" />
<Break Caption="霜冻橙色" StartValue="霜冻橙色" EndValue="霜冻橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\霜冻橙色.gif" Angle="0" />
<Break Caption="霜冻黄色" StartValue="霜冻黄色" EndValue="霜冻黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\霜冻黄色.gif" Angle="0" />
<Break Caption="霜冻蓝色" StartValue="霜冻蓝色" EndValue="霜冻蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\霜冻蓝色.gif" Angle="0" />
<Break Caption="台风橙色" StartValue="台风橙色" EndValue="台风橙色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\台风橙色.gif" Angle="0" />
<Break Caption="台风黄色" StartValue="台风黄色" EndValue="台风黄色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\台风黄色.gif" Angle="0" />
<Break Caption="台风红色" StartValue="台风红色" EndValue="台风红色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\台风红色.gif" Angle="0" />
<Break Caption="台风蓝色" StartValue="台风蓝色" EndValue="台风蓝色" Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True" IsNoData="False" MarkerType="Image" FontName="Arial" CharIndex="0" ImagePath="alarmico\台风蓝色.gif" Angle="0" />
</Breaks>
</LegendScheme>
</MeteoInfo>
结果如下
没有得到预警信号的图标,麻烦看下到底是什么原因造成的
|
|