矢量图层标注

        public void Annotation(IGeoFeatureLayer pGeoFeatLyr, IMap pMap, string annoField)
        {
            IAnnotateMap pAnnoMap;
            pAnnoMap = new MaplexAnnotateMapClass();
            pMap.AnnotationEngine = pAnnoMap;
            IGeoFeatureLayer pGeoFeatLayer;
            pGeoFeatLayer = pGeoFeatLyr;
            IAnnotateLayerPropertiesCollection pAnnoProps;
            pAnnoProps = pGeoFeatLyr.AnnotationProperties;
            pAnnoProps.Clear();
            ILabelEngineLayerProperties2 pLabelEngine2 = new MaplexLabelEngineLayerPropertiesClass();
            pLabelEngine2.Expression = "[" + annoField + "]";

            IMaplexOverposterLayerProperties pMaplexPro = new MaplexOverposterLayerPropertiesClass();
            pMaplexPro.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolygon;
            pMaplexPro.PolygonPlacementMethod = esriMaplexPolygonPlacementMethod.esriMaplexHorizontalInPolygon;
            pMaplexPro.CanPlaceLabelOutsidePolygon = false;
            pMaplexPro.CanRemoveOverlappingLabel = false;
            pMaplexPro.RepeatLabel = false;
            pLabelEngine2.OverposterLayerProperties = pMaplexPro as IOverposterLayerProperties;
            IMapOverposter pMapPos = axMapControl1.Map as IMapOverposter;
            IOverposterProperties pOP = pMapPos.OverposterProperties;
            IMaplexOverposterProperties pMaplexOP = pOP as IMaplexOverposterProperties;
            pMaplexOP.LabelLargestPolygon = false;
            pAnnoProps.Add(pLabelEngine2 as IAnnotateLayerProperties);
            pGeoFeatLyr.DisplayAnnotation = true;
        }

你可能感兴趣的:(C#+AE)