• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

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

posted on 2012-03-26 14:22  gisai  阅读(887)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3