ArcGIS Server开发——标注

[VB.NET写法]
Private Sub LabelFeature(ByVal pFeaturelayer As IFeatureLayer, ByVal pServerContext As IServerContext)
   Dim pGeoFeatureLayer As IGeoFeatureLayer
   pGeoFeatureLayer = pFeaturelayer
   pGeoFeatureLayer .AnnotationProperties.Clear()
   Dim pAnnoLayerProColl As IAnnotateLayerPropertiesCollection
   Dim pLabelEngine As ILabelEngineLayerProperties
   pAnnoLayerProColl = pGeoFeatureLayer .AnnotationProperties
   Dim pAnnoLayerProps As IAnnotateLayerProperties
   pLabelEngine = pServerContext.CreateObject("esriCarto.LabelEngineLayerProperties") 
   pLabelEngine .Expression = "[Filed]"
   pAnnoLayerProps = pLabelEngine 
   'pAnnoLayerProps.LabelWhichFeatures = esriSelectedFeatures '转换Graphic时可以利用 
   pAnnoLayerProColl .Add(pAnnoLayerProps)
   pGeoFeatureLayer.DisplayAnnotation = True
End Sub     

[C#写法]
private void LabelField(IFeatureLayer pFeatureLayer,IServerContext pServerContext)
  { 
   IGeoFeatureLayer pGeoFeatureLayer = pFeatureLayer as IGeoFeatureLayer;
   pGeoFeatureLayer.AnnotationProperties.Clear();
   IAnnotateLayerPropertiesCollection pAnnoLayerPropsColl = pGeoFeatureLayer.AnnotationProperties;
   ILabelEngineLayerProperties pLabelEngine;
   
   pLabelEngine = pServerContext.CreateObject("esriCarto.LabelEngineLayerProperties") as     ILabelEngineLayerProperties;
   pLabelEngine.Expression = "[Field]";
   IAnnotateLayerProperties pAnnoLayerProps = pLabelEngine as IAnnotateLayerProperties;
   pAnnoLayerPropsColl.Add(pAnnoLayerProps);
   pGeoFeatureLayer.DisplayAnnotation = true; 
  }



原文地址:http://www.cnblogs.com/flashsky/articles/152904.html

posted on 2007-07-19 13:44  GIS云中飞鹏  阅读(2575)  评论(4编辑  收藏  举报

导航