本帖最后由 MeteoInfo 于 2013-3-14 21:10 编辑
tinysand 发表于 2013-3-14 18:39
风向杆、云量都是当作一个 LabelSet加上去的(采用特殊字体),但由于LabelSet没有办法设置角度,所以风向杆 ...
LabelSet加一个Angle属性也没用,AddLabels时所有标注都会是一个角度。实际上AddLables以后每个标注l都在VectorLayer的LablePoints里了,标注其实是Graphic类,里面有坐标和图例,图例是LabelBreak类,是有角度属性的,也就是说可以设置不同的角度,在MeteoInfo桌面软件里标注可以被选中,双击后会出现标注的属性设置,里面有角度的设置。有角度是一回事,但是你的这个思路做起来很麻烦。
我修改了类库,在MeteoInfoC.Data.MeteoData命名空间里增加了StationModel和StationModelData类,StationModel类里有站点号:StationIdentifer,坐标属性:Longitude, Latitude,各类气象参数属性:CloudCover, Weather, WindDirection, WindSpeed等等。StationModelData类包含了一个StationModel的列表(Data)、数据空间范围(DataExtent)以及缺测值(UNDEF)。你可以读你的数据,生成一个StationModelData对象。然后用DrawMeteoData类的public static VectorLayer CreateStationModelLayer(StationModelData smData, LegendScheme aLS, string LName, bool isSurface)方法创建站点填图图层即可。需要最新的MeteoInfo类库文件(见置顶帖子)
例如:
- public StationModelData GetStationModelData()
- {
- StationModelData smData = new StationModelData();
- string aStid;
- int i;
- Single lon, lat;
- List<string> dataList = new List<string>();
- Single minX, maxX, minY, maxY;
- minX = 0;
- maxX = 0;
- minY = 0;
- maxY = 0;
- StationModel sm;
- for (i = 0; i < DataList.Count; i++)
- {
- dataList = DataList;
-
aStid = (string)dataList[0];
- lon = Convert.ToSingle(dataList[1]);
- lat = Convert.ToSingle(dataList[2]);
- sm = new StationModel(UNDEF);
- sm.StationIdentifer = aStid;
- sm.Longitude = lon;
- sm.Latitude = lat;
- sm.WindDirection = Convert.ToDouble(dataList[8]); //Wind direction
- sm.WindSpeed = Convert.ToDouble(dataList[9]); //Wind speed
- //sm.Visibility = UNDEF; //Visibility
- //sm.Weather = UNDEF; //Weather
- sm.CloudCover = 1; //Cloud cover
- sm.Temperature = Convert.ToDouble(dataList[6]); //Temperature
- double ddp = double.Parse(dataList[7]);
- sm.DewPoint = sm.Temperature - ddp; //Dew point
- sm.Pressure = double.Parse(dataList[5]); //Pressure
- smData.Data.Add(sm);
- if (i == 0)
- {
- minX = lon;
- maxX = minX;
- minY = lat;
- maxY = minY;
- }
- else
- {
- if (minX > lon)
- {
- minX = lon;
- }
- else if (maxX < lon)
- {
- maxX = lon;
- }
- if (minY > lat)
- {
- minY = lat;
- }
- else if (maxY < lat)
- {
- maxY = lat;
- }
- }
- }
- Extent dataExtent = new Extent();
- dataExtent.minX = minX;
- dataExtent.maxX = maxX;
- dataExtent.minY = minY;
- dataExtent.maxY = maxY;
- smData.DataExtent = dataExtent;
- smData.UNDEF = UNDEF;
- return smData;
- }
|