VBScript for arcengine advanced tagging

Source: Internet
Author: User
You know that ArcMap provides a flexible tagging method. Apart from common tagging, it also supports VBScript and JScript, and AE also provides corresponding functions.

For example, ArcMap expression (VBScript ):

Function findlabel ([st_name], [suffix])
If ([suffix] = "hwy") then
Findlabel = [st_name]
End if
End Function
In AE,

// Global variables

Private iannotatelayerpropertiescollection pannoprops;

Private ilabelenginelayerproperties plabelengine;

Ibasicoverposterlayerproperties4 pbasic;

// Set on layer selection

Pannoprops = pgeolayer. annotationproperties;

// Label creation Function

Pbasic = new basicoverposterlayerpropertiesclass ();

Pbasic. featuretype = esribasicoverposterfeaturetype. esrioverposterpolyline;

Pbasic. linelabelplacementpriorities = lineplacement;

Pbasic. linelabelposition = lineposition;

Plabelengine = new labelenginelayerpropertiesclass ();

Plabelengine. basicoverposterlayerproperties = (ibasicoverposterlayerproperties) pbasic;

Plabelengine. isexpressionsimple = false;

Iannotationexpressionengine extends Peng = new annotationvbscriptengineclass ();

Plabelengine. expressionparser = paipeng;

Plabelengine. expression = "function findlabel (" + fieldlb. selecteditem + "," + fieldcb. text + ") \ n if (" + fieldcb. text + "" + equalitybtn. text + "\" "+ criteriatxt. text + "\") Then \ n findlabel = "+ fieldlb. selecteditem + "\ n end if \ n end function"; plabelengine. symbol = mytxtsym;

Pannolayerprops = (iannotatelayerproperties) plabelengine;

Pannolayerprops. Class = fieldlb. selecteditem. tostring ();

Pannoprops. Add (pannolayerprops );

It can be seen that the expression can only be used to directly convert VBScript into a string. Note that you need to press enter to maintain the format.

 

From: http://hi.baidu.com/xduoo/blog/item/13aa0636fc6450c7a2cc2bed.html

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.