Howto: 定制Check out后的数据的Layer Definition文件

文章编号: 154
软件: ArcPad Application Builder 6.0.1,6.0.3
操作系统: N/A
已邀请:

EsriSupport

赞同来自:

摘要: 有的时候用户会有这样的需求,在Check out数据后,系统会自动生成一个Layer Definition文件,但是用户希望用自己的Layer Definition文件替代系统生成的文件,但是在修改数据后,发现无法Check In到数据库。
内容: 研究系统生成的APL文件代码后发现,无法CHECK IN的原因是因为ARCGIS临时在每个导出的SHAPE文件中生成了一个字段,用来标记是被修改了,还是新添加的等等。所以在用户自定义的Layer Definition文件里面,也需要修改这个新的字段。让ARCGIS能够知道哪些记录被修改了。将下面两个函数复制到相应LAYER DEFINITION文件对应的VBS文件中。并且在层的APL文件中的LAYER TAG中添加onfeatureadded="call UpdateChgCode(1)" onfeaturechanged="call HandleOnFeatureChanged(2)" onfeaturegeometrychanged="call HandleOnFeatureChanged(3),完整的LAYER TAG如下
<LAYER name="layername" onfeatureadded="call UpdateChgCode(1)" onfeaturechanged="call HandleOnFeatureChanged(2)" onfeaturegeometrychanged="call HandleOnFeatureChanged(3)">
下面是VBS中的代码
'#### Passes the input value to UpdateChgCode routine if the CHGCODE field needs updating
Sub HandleOnFeatureChanged(pCode)
'get the RS
Dim pRS
Set pRS = Layer.Records
'if the change code field exists...
If (UCase(CHGCODE) = UCase(pRS.Fields(pRS.Fields.Count).Name)) Then
Dim intCurrCode
pRS.Bookmark = ThisEvent.Bookmark
'get the value of the change code field
intCurrCode = pRS.Fields(CHGCODE).Value
'if its not new feature or geometry update, pass the input value to the update routine
If Not(intCurrCode = CODE_GEOMUPDATE Or intCurrCode = CODE_NEWFEATURE) Then
Call UpdateChgCode(pCode)
End If
End If
'clean up
Set pRS = Nothing
End Sub
'#### Sets the CHGCODE value to the input value
Sub UpdateChgCode(pCode)
Dim pRS
Set pRS = Layer.Records
If (UCase(CHGCODE) = UCase(pRS.Fields(pRS.Fields.Count).Name)) Then
pRS.Bookmark = ThisEvent.Bookmark
pRS.Fields(CHGCODE).Value = pCode
pRS.Update
End If
Set pRS = Nothing
End Sub




创建时间:2005-04-22
最近更新:2005-04-22


原文链接
http://support.esrichina.com.cn/2005/0422/154.html

要回复问题请先登录注册