The following sample code shows how to change the symbol of of a point layer's selected feature to a red diamond. It assumes that you already have a valid MapServer and MapDescription object, and that you are not working with a server context. However, if you are developing an ArcGIS Server application using a server context, you should not use New to create local ArcObjects, but you should always create objects within the server by calling CreateObject on IServerContext.
IMapServer mapServer; IMapDescription mapDesc;
int layerID = 0; string strMapName = mapDesc.Name;
// Select a feature IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = "Name = 'Halifax'"; IFIDSet FIDSet = mapServer.QueryFeatureIDs(strMapName, layerID, filter);
// Set color IRgbColor color = new RgbColorClass(); color.Red = 255;
// Create new marker symbol ISimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbolClass(); markerSymbol.Size = 15; markerSymbol.Color = color; markerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond;
// Hilite selected feature ILayerDescription layerDesc = mapDesc.LayerDescriptions.get_Element(layerID); layerDesc.SelectionFeatures = FIDSet; layerDesc.SetSelectionSymbol = true; layerDesc.SelectionSymbol = (ISymbol)markerSymbol;
本文介绍如何使用ArcObjects API将地图上特定点特征的符号更改为红色钻石形状。代码示例假设已有有效的MapServer和MapDescription对象,并且在客户端上下文中运行。示例中选择了一个名为'Halifax'的特征,并为其设置了新的符号。
330

被折叠的 条评论
为什么被折叠?



