.Net下用citymaker平台进行三维GIs开发时会根据场景对图层中的某些元素进行高亮显示,具体代码如下:
//过滤条件
string filterString = string.Format("oid={0}", featureId);//构建过滤filter
IQueryFilter filter = new QueryFilterClass();
filter.WhereClause = filterString;
IFdeCursor cursor = null;
try
{
//在当前FeatherClass中查询
cursor = curFeatureClass.Search(filter, true);
if (cursor != null)
{
IRowBuffer fdeRow = null;
if ((fdeRow = cursor.NextRow()) != null)
{
//Geometry的位置
int nPos = fdeRow.FieldIndex("Geometry");
if (nPos != -1 && !fdeRow.IsNull(nPos))
{
// 从行数据中读取值ModelPoint
IModelPoint mp = fdeRow.GetValue(nPos) as IModelPoint;
IVector3 v = new Vector3();
v.Set(mp.Position.X, mp.Position.Y, mp.Position.Z);
IEnvelope env =mp.Envelope;
IEulerAngle angle = new EulerAngle();
if (typeLayer == 1)//监控系统
{
angle.Set(150, 30, 0);
//定位飞到对应的对象
MapDocument.Instance.RenderControl.Camera.LookAt(v, 1.5, angle);
MapDocument.Instance.RenderControl.Camera.FlyTime = 0.5;
//return;
IModelPointSymbol symbol = new ModelPointSymbol();
symbol.SetResourceDataSet(curFeatureClass.FeatureDataSet);
IRenderModelPoint rmp = this.axRenderControl.ObjectManager.CreateRenderModelPoint(mp, symbol, rootId);
if (rmp != null)
{
//高亮显示
rmp.Highlight(0x00ff0000);
rmp.Glow(4000);
}
}
}
}
}
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}