|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.Controls;
|
|
|
|
|
using ESRI.ArcGIS.Display;
|
|
|
|
|
using KGIS.Framework.Maps;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.PluginServiceInterface.Helper
|
|
|
|
|
{
|
|
|
|
|
public class MarkLabelLayerForZYQ
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//AxMapControl axMapControl1 = MapsManager.Instance.MapService.getAxMapControl();
|
|
|
|
|
public static void MarkLayer()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//AxMapControl axMapControl1 = MapsManager.Instance.MapService.getAxMapControl();
|
|
|
|
|
IFeatureLayer pFeatureLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("ZYQ");
|
|
|
|
|
if (pFeatureLayer == null) return;
|
|
|
|
|
IGeoFeatureLayer pGeoLayer = pFeatureLayer as IGeoFeatureLayer;
|
|
|
|
|
IRgbColor pColor = new RgbColorClass() { Red = 85, Blue = 105, Green = 255 };
|
|
|
|
|
stdole.IFontDisp pFont = new stdole.StdFont()
|
|
|
|
|
{
|
|
|
|
|
Name = "宋体",
|
|
|
|
|
//Bold = true
|
|
|
|
|
} as stdole.IFontDisp;
|
|
|
|
|
|
|
|
|
|
ITextSymbol pTextSymbol = new TextSymbolClass()
|
|
|
|
|
{
|
|
|
|
|
Color = pColor,
|
|
|
|
|
Font = pFont,
|
|
|
|
|
Size = 8
|
|
|
|
|
};
|
|
|
|
|
IBasicOverposterLayerProperties pBasicOverLayerPro = new BasicOverposterLayerPropertiesClass();
|
|
|
|
|
pBasicOverLayerPro.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolygon;
|
|
|
|
|
pBasicOverLayerPro.GenerateUnplacedLabels = true;
|
|
|
|
|
pBasicOverLayerPro.NumLabelsOption = esriBasicNumLabelsOption.esriOneLabelPerShape;
|
|
|
|
|
|
|
|
|
|
ILabelEngineLayerProperties pLableEngine = new LabelEngineLayerPropertiesClass()
|
|
|
|
|
{
|
|
|
|
|
Symbol = pTextSymbol,
|
|
|
|
|
IsExpressionSimple = true
|
|
|
|
|
};
|
|
|
|
|
IOverposterLayerProperties2 pOverLayerProper = pBasicOverLayerPro as IOverposterLayerProperties2;
|
|
|
|
|
pOverLayerProper.TagUnplaced = true;//设置该属性,目的是不被其他element遮挡
|
|
|
|
|
pLableEngine.BasicOverposterLayerProperties = pBasicOverLayerPro;
|
|
|
|
|
IAnnotateLayerProperties pAnnoPros = pLableEngine as IAnnotateLayerProperties;
|
|
|
|
|
pGeoLayer.AnnotationProperties.Add(pAnnoPros);
|
|
|
|
|
pGeoLayer.DisplayAnnotation = true;
|
|
|
|
|
//axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, axMapControl1.Extent);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("设置标注时发生异常,异常信息如下:" + ex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|