peng8748
论坛版主
论坛版主
  • 注册日期2003-08-07
  • 发帖数1712
  • QQ
  • 铜币52枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:17635回复:46

[原创]一个VB-MAPGIS小程序的源代码

楼主#
更多 发布于:2004-06-25 10:16
<P>一个VB小程序的源代码</P>
<P>为想学编程的朋友提供一个小小的帮助。该程序的作用的根据属性付面参数。</P>
<P>'根据属性付面参数</P>
<P>    Dim regObj As RegArea
    Dim i As Long
    Dim dldm As String
    Dim ATT As Record
    Dim flag As Integer, rtl As Integer
    Dim inf1 As Reg_Info
    
    '取区属性  ===(包括取二进制字段值)
    Set regObj = New RegArea
    
    If (regObj.Load()) Then
        For i = 1 To regObj.Count - 1
      
            flag = regObj.RegAtt.Get(i, ATT)  '将第i个图斑的属性放入ATT中
            
                dldm = ATT.Item(8).Value   '将地类代码付入DLDM变量中</P>
<P>                Select Case dldm           '根据地类代码付图斑的颜色
                  Case "11", "12", "13"
                     Set inf1 = New Reg_Info
                       With inf1
                         .clr = 501
                         .patclr = 0
                         .pathei = 0
                         .patno = 1
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)    '修改第i个图斑的颜色
                
                    Case "14"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 972
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "15"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 973
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "21", "22", "23", "24", "25"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 974
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "31", "32", "33", "34", "35", "36"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 979
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "41", "42", "43"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 980
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "51B"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 981
                         .patclr = 1
                         .pathei = 50
                         .patno = 153
                         .patwid = 50
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "52"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 981
                         .patclr = 1
                         .pathei = 50
                         .patno = 154
                         .patwid = 50
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "53", "55"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 981
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "71", "72", "73", "74", "75", "76", "77", "78"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 988
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "81"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 983
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "82"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 984
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "83"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 984
                         .patclr = 1
                         .pathei = 80
                         .patno = 157
                         .patwid = 80
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "84"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 984
                         .patclr = 1
                         .pathei = 20
                         .patno = 151
                         .patwid = 20
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                    Case "85", "86"
                    Set inf1 = New Reg_Info
                       With inf1
                         .clr = 986
                         .patclr = 0
                         .pathei = 0
                         .patno = 0
                         .patwid = 0
                         .res0 = gisON
                         .res1 = gisON
                       End With
                    rtl = regObj.UpdateInfo(i, inf1)
                    
                End Select
                
            
            Set ATT = Nothing
        Next i
        
        
        rtl = regObj.Save()   '保存区文件
    End If
    
    Set regObj = Nothing
End Sub</P>
[此贴子已经被作者于2004-6-27 21:00:41编辑过]
喜欢0 评分0
有什么要求PM我 email : peng8748@163.com
peng8748
论坛版主
论坛版主
  • 注册日期2003-08-07
  • 发帖数1712
  • QQ
  • 铜币52枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-06-27 21:00
<P>先要掌握一门基本的编程语言,如VB、VC等,再通过MAPGIS提供的</P><P>控件、模块、API进行编程,逐步提高,其实,我们并不需要编大型的</P><P>软件,而只需编一点小程序,来提高自己工作生产中的效率。</P>
有什么要求PM我 email : peng8748@163.com
举报 回复(0) 喜欢(0)     评分
peng8748
论坛版主
论坛版主
  • 注册日期2003-08-07
  • 发帖数1712
  • QQ
  • 铜币52枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-10-08 00:15
<DIV class=quote><B>以下是引用<I>crasher</I>在2004-10-3 18:59:04的发言:</B>

<P>mapgis有图斑的概念么? </P></DIV>
<P>是指区。图斑是土地详查中的用语。</P>
有什么要求PM我 email : peng8748@163.com
举报 回复(0) 喜欢(0)     评分
游客

返回顶部