- 积分
- 797
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-8-1
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2012-8-23 11:58:02
|
显示全部楼层
在engine中实现自定义站点渲染的主要代码见下:
IUniqueValueRenderer pUniqueValueR = new UniqueValueRendererClass();
pUniqueValueR.FieldCount = 1;
pUniqueValueR.set_Field(0, "sStaCode");
while (feature != null)
{
if (feature.Shape is IPoint)
{
//////////////////////////////////////////////
//得到点shp的属性值
string sStaCode = feature.get_Value(feature.Fields.FindField("sStaCode")).ToString();
string sStaName = feature.get_Value(feature.Fields.FindField("sStaName")).ToString();
int iN = int.Parse(feature.get_Value(feature.Fields.FindField("iN")).ToString());
float fWindDir = float.Parse(feature.get_Value(feature.Fields.FindField("fWindDir")).ToString());
float fWindSpeed = float.Parse(feature.get_Value(feature.Fields.FindField("fWindSpeed")).ToString());
//////////////////////////////////////////////////////
//云量
//圈
ICharacterMarkerSymbol charMrkSymTotalCloud = GetCharFromFont("GSI Weather Symbols", 0xF0C0, pBlackColor,
0, 0, 0, (int)(fRate*25));
//数字
sTemp = GetCloudText(iN);
IMarkerSymbol pMakSymCloudAmout = GetTextMarSym(sTemp, (int)(fRate * 8), 0 * fRate, 4 * fRate, pBlackColor);
//////////////////////////////////////////////////////
//风向、风速
int iWindCharIndex = 0x22c + (int)(fWindSpeed / 2);
ICharacterMarkerSymbol charMrkSymWind = GetCharFromFont("Winds", iWindCharIndex, pBlackColor,
360 - fWindDir, 1.5 * fRate, 18 * fRate, (int)(fRate * 45));
//////////////////////////////////////////////////////
//合成点渲染的符号
IMultiLayerMarkerSymbol multiLayermrkSym = new MultiLayerMarkerSymbol();
multiLayermrkSym.AddLayer(charMrkSymTotalCloud);
if (iN >= 0)
multiLayermrkSym.AddLayer(pMakSymCloudAmout);
multiLayermrkSym.AddLayer(charMrkSymWind);
pUniqueValueR.AddValue(sStaCode, "sStaCode", (ISymbol)multiLayermrkSym);
}
feature = featureCursor.NextFeature();
}
geoFeatureLayer.Renderer = (IFeatureRenderer)pUniqueValueR;
|
|