zoukankan      html  css  js  c++  java
  • arcengine 高级标注之vbscript

    家知道arcmap提供了非常灵活的标注方式,除了一般的标注 同时支持vbscript和jscript,同样AE也提供了相应的功能。

    比如:ArcMap Expression(vbscript):

    Function FindLabel ([ST_NAME], [SUFFIX])
    IF ([SUFFIX] = "HWY") THEN
    FindLabel = [ST_NAME]
    END IF
    End Function
    在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 AnnExpEng = new AnnotationVBScriptEngineClass();

    pLabelEngine.ExpressionParser = AnnExpEng;

    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);

    可以看出表达式 只是把VBscript直接拿来变成字符串就可以使用,需要注意的是 需要回车以保持格式

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

  • 相关阅读:
    JS 表单submit() 提交无效的问题
    thinkphp中连接oracle时封装的方法无法用
    Struts2 开发流程(转)
    oracle wm_concat(column)函数的使用(转)
    js点击按钮后显示时间自动减少提示
    Windows Server 2008 R2安装过程
    Spring学习之旅(1) 第一个Controller
    Groovy系列 Groovy集合
    Groovy系列 安装Groovy
    VMWare实现共享目录
  • 原文地址:https://www.cnblogs.com/gisoracle/p/2417837.html
Copyright © 2011-2022 走看看