爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4027|回复: 3

关于标注的问题

[复制链接]

新浪微博达人勋

发表于 2012-4-24 11:31:47 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

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>

结果如下
1.bmp
没有得到预警信号的图标,麻烦看下到底是什么原因造成的

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-4-24 11:50:38 | 显示全部楼层
可能是字段类型的问题,用于设置图例的字段是alarmcolor,看起来应该是字符型string,你可以试着将添加此字段的代码修改如下:
aLayer.EditAddField("alarmcolor", typeof(string));
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-4-24 14:49:26 | 显示全部楼层
修改了以后还是这样。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-4-24 15:01:21 | 显示全部楼层
从结果来看,最后执行的还是这段代码Color="#2D6697" DrawShape="True" OutlineColor="Black" Size="10" Style="Circle" DrawOutline="True" DrawFill="True"
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表