阅读:18760回复:46
[原创]一个VB-MAPGIS小程序的源代码
<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编辑过]
|
|
|
1楼#
发布于:2004-06-26 09:00
<P>我也刚对这个感兴趣,但不知怎洋学起?</P><P>请指教!</P>
|
|
2楼#
发布于:2004-06-27 20:37
<img src="images/post/smile/dvbbs/em01.gif" />
|
|
3楼#
发布于:2004-06-27 21:00
<P>先要掌握一门基本的编程语言,如VB、VC等,再通过MAPGIS提供的</P><P>控件、模块、API进行编程,逐步提高,其实,我们并不需要编大型的</P><P>软件,而只需编一点小程序,来提高自己工作生产中的效率。</P>
|
|
|
4楼#
发布于:2004-07-05 20:51
支持<img src="images/post/smile/dvbbs/em01.gif" />
|
|
5楼#
发布于:2004-07-06 18:24
<img src="images/post/smile/dvbbs/em12.gif" />
|
|
6楼#
发布于:2004-07-24 11:47
<img src="images/post/smile/dvbbs/em01.gif" />
|
|
|
7楼#
发布于:2004-07-27 16:39
很有道理,真是这样,主要是提高我们自己的工作效率
|
|
8楼#
发布于:2004-07-27 16:41
熟悉界面
|
|
9楼#
发布于:2004-07-27 23:50
<img src="http://www.gisempire.com/bbs/Skins/Default/emot/em05.gif"><img src="http://www.gisempire.com/bbs/Skins/Default/emot/em02.gif">
|
|
|
上一页
下一页