Arcengine Layer Callout (Based on field, angle)

Source: Internet
Author: User

Transfer from CHANYINHELV source arcengine Layer Callout (Based on field, angle)

Today I made an AE to control whether the layer is showing labels, and which field as the label's field, and which field is the angle of the callout, write the code down for later use.

 Public voidEnablefeaturelayerlabel (Ifeaturelayer Pfeaturelayer,stringSlablefield, Irgbcolor Prgb,intSizestringAnglefield) {      //determine if the layer is empty    if(Pfeaturelayer = =NULL)          return; Igeofeaturelayer Pgeofeaturelayer=(Igeofeaturelayer) Pfeaturelayer;      Iannotatelayerpropertiescollection pannolayerpropscollection; Pannolayerpropscollection=pgeofeaturelayer.annotationproperties;        Pannolayerpropscollection.clear (); //stdole. IFontDisp Pfont; //FontItextsymbol Ptextsymbol; //pfont.name = "new song body"; //pfont.size = 9; //font Color Not specified is black by default    if(Prgb = =NULL) {Prgb=NewRgbcolorclass (); Prgb.red=0; Prgb.green=0; Prgb.blue=0; } Ptextsymbol=NewTextsymbolclass (); Ptextsymbol.color=(icolor) Prgb; Ptextsymbol.size= size;//Dimension SizeIBasicOverposterLayerProperties4 PBASICOVERPOSTERLAYERPROPS4=NewBasicoverposterlayerpropertiesclass (); Switch(PFeaturelayer.FeatureClass.ShapeType)//Judging layer Types    {           CaseESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:pBasicOverposterlayerProps4.FeatureType=Esribasicoverposterfeaturetype.esrioverposterpolygon;  Break;  CaseESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:pBasicOverposterlayerProps4.FeatureType=Esribasicoverposterfeaturetype.esrioverposterpoint;  Break;  CaseESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:pBasicOverposterlayerProps4.FeatureType=Esribasicoverposterfeaturetype.esrioverposterpolyline;  Break; } Pbasicoverposterlayerprops4.pointplacementmethod=Esrioverposterpointplacementmethod.esrirotationfield; Pbasicoverposterlayerprops4.rotationfield=Anglefield; Ilabelenginelayerproperties Plabelenginelayerprops=NewLabelenginelayerpropertiesclass (); Plabelenginelayerprops.expression="["+ Slablefield +"]"; Plabelenginelayerprops.symbol=Ptextsymbol; Plabelenginelayerprops.basicoverposterlayerproperties= PBASICOVERPOSTERLAYERPROPS4 asibasicoverposterlayerproperties;      Pannolayerpropscollection.add ((iannotatelayerproperties) plabelenginelayerprops); Pgeofeaturelayer.displayannotation=true;//It is important that you set//AxMapControl1.ActiveView.PartialRefresh (esriviewdrawphase.esriviewbackground, NULL, NULL);} }

Arcengine Layer Callout (Based on field, angle)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.