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 数据链路层

  2. Linux查看用户及其权限管理

    https://www.cnblogs.com/fxlttkl/p/7601224.html 查看用户 请打开终端,输入命令: $ who am i 或者 $ who mom likes 输出的第一列 ...

  3. Java1.8 获取文件总行数

    Files.lines(Paths.get("aaa.txt")).count();

  4. 深入java面向对象四:Java 内部类种类及使用解析(转)

    内部类Inner Class 将相关的类组织在一起,从而降低了命名空间的混乱. 一个内部类可以定义在另一个类里,可以定义在函数里,甚至可以作为一个表达式的一部分. Java中的内部类共分为四种: 静态 ...

  5. Python--day38--进程同步控制的---锁\信号量\事件的方法名

  6. java Class中得到构造方法Constructor、方法Method、字段Field

    常用方法: Constructor类用于描述类中的构造方法: Constructor<T> getConstructor(Class<?>... parameterTypes) ...

  7. vue通信、传值的方式

    原文博主地址:https://blog.csdn.net/qq_35430000/article/details/79291287 看完还是受益匪浅,讲得很详细..感谢!

  8. Codeforces Round #564 (Div. 2) D. Nauuo and Circle(树形DP)

    D. Nauuo and Circle •参考资料 [1]:https://www.cnblogs.com/wyxdrqc/p/10990378.html •题意 给出你一个包含 n 个点的树,这 n ...

  9. P1077 旅行

    题目描述 你要进行一个行程为7000KM的旅行,现在沿途有些汽车旅馆,为了安全起见,每天晚上都不开车,住在汽车旅馆,你手里现在已经有一个旅馆列表,用离起点的距离来标识,如下: 0, 990, 1010 ...

  10. H3C IEEE EUI-64格式