1、获取图层字段

    Dim pTable As ITable = pLayer
Dim pField As IField
For i As Integer = To pTable.Fields.FieldCount - pField = pTable.Fields.Field(i) Next

 2、布局视图中的Element分离和合并

  Private Sub PartEleMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PartEleMenuItem.Click
Dim graphicsContainer As IGraphicsContainer = TryCast(PageLayoutPrint.ActiveView, IGraphicsContainer)
Dim pGraphContSel As IGraphicsContainerSelect = TryCast(graphicsContainer, IGraphicsContainerSelect) pGraphContSel.UnselectAllElements()
Dim pGroupEle As IGroupElement = Right_MenuStrip.Tag
If IsNothing(pGroupEle) Then Exit Sub
For i As Integer = To pGroupEle.ElementCount -
Dim pElement As IElement = pGroupEle.Element(i)
pGraphContSel.SelectElement(pElement)
graphicsContainer.AddElement(pElement, )
Next Right_MenuStrip.Tag = Nothing
PageLayoutPrint.ActiveView.Refresh()
End Sub
'合并Element
Private Sub MargerEleMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MargerEleMenuItem.Click
Dim graphicsContainer As IGraphicsContainer = TryCast(PageLayoutPrint.ActiveView, IGraphicsContainer)
Dim pGraphContSel As IGraphicsContainerSelect = TryCast(graphicsContainer, IGraphicsContainerSelect)
Dim pGroupEle As IGroupElement = New GroupElement()
For i As Integer = To pGraphContSel.ElementSelectionCount -
pGroupEle.AddElement(pGraphContSel.SelectedElement(i))
Next
pGraphContSel.UnselectAllElements()
Dim pElement As IElement = CType(pGroupEle, IElement)
graphicsContainer.AddElement(pElement, )
pGraphContSel.SelectElement(pElement)
PageLayoutPrint.ActiveView.Refresh()
End Sub

效果如下图:

合并前:

合并后:

3、批量修改字段值

VB

  ''' <summary>
''' 字段值更新,将Int型的字段值转换成date类型的字段值
''' </summary>
''' <param name="pFeatureLayer">需要转换的图层</param>
''' <returns></returns>
''' <remarks></remarks>
Private Function UpdateFieldValue(ByVal pFeatureLayer As IFeatureLayer)
Dim pFeatureClass As IFeatureClass = pFeatureLayer.FeatureClass
Dim pFeatureCursor As IFeatureCursor = pFeatureClass.Search(Nothing, False)
Dim pFeature As IFeature = pFeatureCursor.NextFeature()
While Not IsNothing(pFeature)
Dim timevalue As String = pFeature.Value().ToString() & "/01/01" '这里的字段索引固定
Dim time As DateTime = CType(timevalue, DateTime)
pFeature.Value() = time '这里的字段索引固定
pFeature.Store()
pFeature = pFeatureCursor.NextFeature()
End While
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor)
End Function

 C#

 /// <summary>
/// 字段值更新根据字段名
/// </summary>
/// <param name="pFeatureLayer">要素图层</param>
/// <param name="fieldName">字段名</param>
private void UpdateFieldValue(IFeatureLayer pFeatureLayer,string fieldName)
{
IFeatureClass pFeatureClass =pFeatureLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();
while(pFeature!=null)
{
pFeature.set_Value(pFeatureClass.FindField(fieldName), );
pFeature.Store();
pFeature = pFeatureCursor.NextFeature();
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
}

4、ImageComboBoxEdit 加载字段

Friend WithEvents cboLayerList As DevExpress.XtraEditors.ImageComboBoxEdit
  Private Sub AddLayer()
cboLayerList.Properties.Items.Clear()
For i As Integer = To m_AssetApplication.MainMapCon.LayerCount -
Dim icbi As ImageComboBoxItem = New ImageComboBoxItem
Dim pLayer As ILayer = m_AssetApplication.MainMapCon.get_Layer(i)
icbi.Description = pLayer.Name
icbi.Value = pLayer
cboLayerList.Properties.Items.Add(icbi)
Next
cboLayerList.EditValue = m_AssetApplication.MainMapCon.get_Layer()
End Sub

5、图层查询 IFeatureSelection

  Protected Overridable Function QueryByType(ByVal querystring As String) As Boolean
Dim pQueryFilter As IQueryFilter = New QueryFilter
pQueryFilter.WhereClause = querystring
Dim pFeatureLayer As IFeatureLayer = tmpLayer
Dim pSelection As IFeatureSelection = pFeatureLayer
If CheckSearchFromSelection.Checked Then '从选择集中查询数据
pSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultAnd, False)
Else ‘从图层中查询数据
m_AssetApplication.MainMapCon.Map.ClearSelection() '清空选择集
pSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
End If
If pSelection.SelectionSet.Count = Then
MessageBox.Show("查询结果为空!")
Return True
End If
Return False
End Function

 6、查询删除数据

 Dim pQueryFilter As IQueryFilter = New QueryFilter()
pQueryFilter.WhereClause = PointId & " in (" & ids & ")" 'ids='1','2'
Dim pTable As ITable = pPointFeaCs
 pTable.DeleteSearchedRows(pQueryFilter)

7、添加REST服务地址

Dim pRestLayer As IMapServerRESTLayer = New MapServerRESTLayer
pRestLayer.Connect("http://172.0.0.1:7080/PBS/rest/services/MyPBSService1/MapServer")
pMap.AddLayer(pRestLayer)

ArcEngine语法笔记(VB)的更多相关文章

  1. SQL基础语法笔记教程整理

    PS:本文适用SQL Server2008语法. 一.关系型数据库和SQL 实际上准确的讲,SQL是一门语言,而不是一个数据库. 什么是SQL呢?简而言之,SQL就是维护和使用关系型数据库中的的数据的 ...

  2. C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | IT宅.com

    原文:C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | IT宅.com C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | I ...

  3. SQL 基础语法笔记教程整理

    最近从图书馆借了本介绍 SQL 的书,打算复习一下基本语法,记录一下笔记,整理一下思路,以备日后复习之用. PS:本文适用 SQL Server2008 语法. 首先,附一个发现的 MySQL 读书笔 ...

  4. [python] Pythonic语法笔记

    Pythonic语法笔记 __new__ 在类实例化之前执行的,也就是在init之前执行,可以为这个类写操作.接受的参数不是self而是cls.只有在new方法里返回类才会执行init操作,需要返回父 ...

  5. SQL Server 常用高级语法笔记

    自从用了EF后很少写sql和存储过程了,今天需要写个比较复杂的报告,翻出了之前的笔记做参考,感觉这个笔记还是很有用的,因此发出来和园友分享. 1.case...end (具体的值)case后面有值,相 ...

  6. C#语言不常用语法笔记

    只看过3天C#语法书,了解个大概,与C++等不同之处,或者看开源遇到一些奇异用法,记录一下,脑子不够用的情况下,还是记笔记靠谱. ==================== 顺便吐槽下,这年头得会各种编 ...

  7. solr使用语法笔记

    http://127.0.0.1:8095/shangbiao_sale/select?sort=id+desc&fq=&wt=json&json.nl=map&q=s ...

  8. Java语法笔记

    目录 知识点 不支持 恶心事 与C#的区别 组件 学习资料 母版页 知识点 类 静态方法,即可以在类上被调用,也可以在实例对象上被调用. Java类 先执行静态构造函数,再执行静态方法或静态字段,所以 ...

  9. Java基本语法笔记

    1. 基本格式: public class HelloWprdApp { public static void main(String[] args) {        // TODO Auto-ge ...

随机推荐

  1. H3C PPP MP简介

  2. 如何查看linux中的ssh端口开启状态

    netstat -anp |grep 22 netstat -anp |grep sshlsof -i :22

  3. 反思K-S指标(KPMG大数据挖掘)

    评估信用评级模型,反思K-S指标 2015-12-05 KPMG大数据团队 KPMG大数据挖掘 “信用评级”的概念听起来可以十分直截了当.比如一天早上你接到电话,有个熟人跟你借钱,而你将在半睡半醒间迅 ...

  4. Innodb_large_prefix

    innodb_large_prefix Prefixes, defined by the length attribute, can be up to 767 bytes long for InnoD ...

  5. 4-3 xpath的用法

  6. H5 操作class 类样式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. java 基本数据类型的自动拆箱与装箱

    ——>  -128~127之间的特殊性.为什么要这样设计,好处? ——>  享元模式(Flyweight Pattern):享元模式的特点是,复用我们内存中已存在的对象,降低系统创建对象实 ...

  8. 用Xshell连接谷歌云

    谷歌云服务器,默认用浏览器进行SSH链接,而且也不告知密码.以Centos为例,先使用浏览器连接 1,给root修改密码 1 sudo passwd root 2,编辑ssh配置文件 sudo nan ...

  9. java位运算和无符号运算

    计算机在底层使用的是二进制补码进行运算. 计算规则: 正数的原码.反码.补码是其二进制本身. 负数的原码首先计算其二进制数,然后最高位使用1表示负数,反码是最高位不变其它位取反,补码是在反码的基础上进 ...

  10. javascript异步编程 Async/await

    Async/await Async/await 在学习他之前应当补充一定的 promise 知识 它是一种与 promise 相配合的特殊语法,目前被认为是异步编程的终级解决方案 值得我们每一个人学习 ...