• ArcGIS Server开发——标注


    [VB.NET写法]
    Private Sub LabelFeature(ByVal pFeaturelayer As IFeatureLayer, ByVal pServerContext As IServerContext)
       Dim pGeoFeatureLayer As IGeoFeatureLayer
       pGeoFeatureLayer = pFeaturelayer
       pGeoFeatureLayer .AnnotationProperties.Clear()
       Dim pAnnoLayerProColl As IAnnotateLayerPropertiesCollection
       Dim pLabelEngine As ILabelEngineLayerProperties
       pAnnoLayerProColl = pGeoFeatureLayer .AnnotationProperties
       Dim pAnnoLayerProps As IAnnotateLayerProperties
       pLabelEngine = pServerContext.CreateObject("esriCarto.LabelEngineLayerProperties") 
       pLabelEngine .Expression = "[Filed]"
       pAnnoLayerProps = pLabelEngine 
       'pAnnoLayerProps.LabelWhichFeatures = esriSelectedFeatures '转换Graphic时可以利用
       pAnnoLayerProColl .Add(pAnnoLayerProps)
       pGeoFeatureLayer.DisplayAnnotation = True
    End Sub     

    [C#写法]
    private void LabelField(IFeatureLayer pFeatureLayer,IServerContext pServerContext)
      { 
       IGeoFeatureLayer pGeoFeatureLayer = pFeatureLayer as IGeoFeatureLayer;
       pGeoFeatureLayer.AnnotationProperties.Clear();
       IAnnotateLayerPropertiesCollection pAnnoLayerPropsColl = pGeoFeatureLayer.AnnotationProperties;
       ILabelEngineLayerProperties pLabelEngine;
       
       pLabelEngine = pServerContext.CreateObject("esriCarto.LabelEngineLayerProperties") as     ILabelEngineLayerProperties;
       pLabelEngine.Expression = "[Field]";
       IAnnotateLayerProperties pAnnoLayerProps = pLabelEngine as IAnnotateLayerProperties;
       pAnnoLayerPropsColl.Add(pAnnoLayerProps);
       pGeoFeatureLayer.DisplayAnnotation = true; 
      }

    Feedback
    #1楼    回复  引用  查看    
    2005-05-15 18:23 by edison1024
    土匪兄,谢谢。好文。
    #2楼    回复  引用  查看    
    2005-06-30 11:15 by zls
    我试了一下,屏幕上怎么没出现标注啊,不知是什么原因啊?
    #3楼 [楼主]   回复  引用  查看    
    2005-06-30 14:11 by 土匪头
    layerDescription.ShowLabels = true;
    webMap.Refresh();
    #4楼    回复  引用  查看    
    2005-07-01 15:12 by zls
    谢谢!我是这样调用上面函数的
    using (WebMap webMap = Map1.CreateWebMap())
    {IMapServerObjects mapo = webMap.MapServer as IMapServerObjects;
    IMap map = mapo.get_Map(webMap.DataFrame);
    IFeatureLayer fl = map.get_Layer(0) as IFeatureLayer;
    IServerContext sc = webMap.ServerContext;
    LabelField(fl,sc);
    webMap.Refresh();
    }不知有没有错。 在 pLabelEngine.Expression = "[Field]"; 我的字段填了具体的字段。运行后一点变化都没有。那这句加在那里layerDescription.ShowLabels = true;它查询、调用哪个接口。
    #5楼 [楼主]   回复  引用  查看    
    2005-07-01 15:27 by 土匪头
    加在webMap.Refresh()前
    #6楼    回复  引用  查看    
    2005-07-04 10:05 by zls
    layerDescription.ShowLabels = true这句话跟上下语句没有联系,会出错啊。layerDescription是那里的对象或类没有具体声明啊,我不知道它从那里来的。谢谢土匪兄。
    #7楼    回复  引用  查看    
    2005-07-04 13:49 by 土匪头
    IMapDescription mapDescription = webMap.MapDescription;
    ILayerDescription layerDesc = mapDescription.LayerDescriptions.get_Element(labelID);
    #8楼    回复  引用  查看    
    2005-07-04 16:21 by zls
    可以显示出来了。土匪兄,非常谢谢!!!
    #9楼    回复  引用  查看    
    2005-08-05 16:31 by zls [未注册用户]
    土匪兄你好!我把上面的方法改成web服务发布然后再去调用这个方法,为什么这样做不行?
    #10楼 [楼主]   回复  引用  查看    
    2005-08-05 16:36 by 土匪头
    既然Web应用可以执行,说明程序本身没有问题。通过Web服务的方式无法访问,只能说明你写的Web服务的规范、协议或者接口设置有问题。
    #11楼    回复  引用  查看    
    2005-08-08 09:03 by zls [未注册用户]
    提示说“无法序列化接口 ESRI.ArcGIS.Carto.IFeatureLayer”不知道那里错了
    #12楼    回复  引用  查看    
    2005-08-11 10:14 by zls
    我知道了,不能用接口做传输参数了。
    不过请教一下土匪兄,我想对arcgis server摸板里的web services catalog Application摸板进行扩张,不知如何下手,你能否给点建议?非常感谢!!
    #13楼    回复  引用  查看    
    2006-03-10 23:20 by 建筑网 [未注册用户]
    我顶.......好...我在顶
    #14楼    回复  引用  查看    
    2006-03-10 23:20 by 建筑网 [未注册用户]
    我顶.......好...我在顶
    #15楼    回复  引用  查看    
    2006-08-10 09:09 by offer [未注册用户]
    ILayerDescription layerDesc = mapDescription.LayerDescriptions.get_Element(labelID); 请问这里的labelID 是什么?怎么填写?
    #16楼    回复  引用  查看    
    2006-08-10 09:11 by offer [未注册用户]
    还有,请问效果是像Tooltip那样吗 ?
    #17楼    回复  引用  查看    
    2006-08-10 09:16 by offer [未注册用户]
    ILayerDescription layerDesc = mapDescription.LayerDescriptions.get_Element(labelID);
    layerDescription.ShowLabels = true;这两句话是不是有点不一致啊上面定义的是layerDesc,后面是layerDescription.ShowLabels ???

    还是有别的意思?我是新手不好意思,需要明白点的

    #18楼    回复  引用  查看    
    2006-08-16 10:31 by offer [未注册用户]
    ??
    #19楼    回复  引用  查看    
    2006-08-16 17:04 by offer [未注册用户]
    还有,请问效果是像Tooltip那样吗 ??
    为什么没有人回答我啊 ???
    急啊

    #20楼    回复  引用  查看    
    2006-09-09 13:07 by flashsky [未注册用户]
    因为毕业后就不在搞GIS了,所以一直没有时间来回复问题,呵呵!
    #21楼    回复  引用  查看    
    2006-10-10 16:43 by wjb [未注册用户]
    各位好,labelID是从那里来的啊,真抱歉,我看不懂
    #22楼 [TrackBack]   回复  引用  查看    
    2007-07-19 13:44 by GIS云中飞鹏
    [VB.NET写法]PrivateSubLabelFeature(ByValpFeaturelayerAsIFeatureLayer,ByValpServerContextAsIS...
    [引用提示]GIS云中飞鹏引用了该文章, 地址: http://www.cnblogs.com/gispeng/archive/2007/07/19/823833.html
    #23楼 [TrackBack]   回复  引用  查看    
    2007-07-30 09:02 by kylinindotnet
    [VB.NET写法]PrivateSubLabelFeature(ByValpFeaturelayerAsIFeatureLayer,ByValpServerContextAsIS...
    [引用提示]kylinindotnet引用了该文章, 地址: http://www.cnblogs.com/kylinindotnet/archive/2007/07/30/835934.html
    #24楼    回复  引用  查看    
    2007-11-21 15:35 by zz啊 [未注册用户]
    protected void Button1_Click(object sender, EventArgs e)
    {
    m_agsBase.InitializeVar(Map1);
    IMap pMap = m_agsBase.GetMap();
    //取地图上的第一个图层
    ILayer pLayer = pMap.get_Layer(0);
    IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
    IGeoFeatureLayer pGeoFeatLyr = pFeatureLyr as IGeoFeatureLayer;

    IAnnotateLayerPropertiesCollection pAnnoLayerPropsColl = pGeoFeatLyr.AnnotationProperties;
    pAnnoLayerPropsColl.Clear();

    ILabelEngineLayerProperties pLabelEngineProps;

    IServerContext pSOC = m_agsBase.GetSOC();
    pLabelEngineProps = pSOC.CreateObject("esriCarto.LabelEngineLayerProperties") as ILabelEngineLayerProperties;
    pLabelEngineProps.Expression = "[支干渠]";
    IAnnotateLayerProperties pAnnoLayerProps = pLabelEngineProps as IAnnotateLayerProperties;
    pAnnoLayerPropsColl.Add(pAnnoLayerProps);
    pGeoFeatLyr.DisplayAnnotation = true;

    ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc = m_agsBase.GetMapDescription();

    ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription LayerDesc = mapDesc.LayerDescriptions[0] as ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription;

    LayerDesc.ShowLabels = true;

    Map1.Refresh();

    }
    为什么出不来亚。。


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhangjie_xiaoke/archive/2008/03/13/2176629.aspx

  • 相关阅读:
    OpenResty
    Jmeter
    kubernetes 中部署 metrics-server
    Jenkins 灰度
    socat管理haproxy以及haproxy调优
    代码质量测试工具SonarQube安装配置
    Jenkins+主从+Pipeline+Webhook
    xtrabackup 实现MySQL数据库备份
    idea Error:java: Compilation failed: internal java compiler error
    使用TableSnapshotInputFormat读取Hbase快照数据
  • 原文地址:https://www.cnblogs.com/googlegis/p/2979037.html
Copyright © 2020-2023  润新知