用MAPINFO画三叶草的代码(freeheart原创)原名:张金柱
2004-12-03 22:25
387 查看
用MAPINFO画三叶草的代码(freeheart原创)原名:张金柱
在移动通信网络优化工作中,经常需要地图画的网元信息,并要包含大量的辅助信息为此,用MAPINFO做了自动生成三叶草的小程序,现在已经弄清楚mif文件格式了
,这宏也没什么价值了,但或许对大家有用。
Dim intNowCell as Integer,intPower as Integer,intPos as Integer,strUseFile as String,strTempFile as String,i As Integer
Dim tmpStr as String,tmpStr2 as string,tmpStr3 as Integer,mcolor as Integer
intNowCell=1
'**create temp table**
strUseFile=FileOpenDlg("C:/","","TXT","打开源数据文件")
If Not FileExists(strUseFile) Or strUseFile="" Then
Exit Sub
End if
strTempFile=GetMyTempFile(strUseFile,"tempSite.TAB")
'strTempFile=TableInfo(0, TAB_INFO_NAME)
Register Table strUseFile
Type ASCII Titles CharSet "Neutral"
Into strTempFile
Open Table strTempFile Interactive
Create Map For tempSite CoordSys Earth Projection 1, 0
Map from tempSite Max
set map redraw off
Create Table "WYSite" (
SITE_ID Char (8) ,SITE_NAME char(40), BSCID Char (7) , MSCID Char (6) , LAC Smallint , LONGITUDE Float ,
LATITUDE Float , CELL_NAME Char (1), POWER Smallint , BCC Smallint , NCC Smallint , ANTDIR Float ,
ANTTIL Float , ANTBAND Float , ANTNUM Smallint , ANTHIGH Float , GROUNDHIGH Float ,
ANTTYPE Char (10) , ANTPLUS Smallint , ANTLEN Smallint ,
OPENTIME Date , SiteType Char (7) , TRANSTYPE Char (4) ,
NCELL1 char(8),NCELL2 char(8),NCELL3 char(8),NCELL4 char(8),NCELL5 char(8),NCELL6 char(8),NCELL7 char(8),NCELL8 char(8),NCELL9 char(8),NCELL10 char(8),
NCELL11 char(8),NCELL12 char(8),NCELL13 char(8),NCELL14 char(8),NCELL15 char(8),NCELL16 char(8),NCELL17 char(8),NCELL18 char(8),NCELL19 char(8),NCELL20 char(8),
NCELL21 char(8),NCELL22 char(8),NCELL23 char(8),NCELL24 char(8),NCELL25 char(8),NCELL26 char(8),NCELL27 char(8),NCELL28 char(8),NCELL29 char(8),NCELL30 char(8),
NCELL31 char(8),NCELL32 char(8),
BCCH Smallint,DCH1 Smallint,DCH2 Smallint,DCH3 Smallint,DCH4 Smallint,DCH5 Smallint,DCH6 Smallint,DCH7 Smallint,DCH8 Smallint,DCH9 Smallint,
DCH10 Smallint,DCH11 Smallint,DCH12 Smallint,TRXS Smallint ,
DEVTYPE Char (6) , ZFSite Char (1) , HAVEWATCH Smallint , FIRETYPE Char (4) , TOWERTYPE Char (4) ,
TOWERHIGH Float , ROOMOWNER Char (8)
) file GetMyTempFile(strUseFile,"WYSite.TAB") TYPE NATIVE Charset "WindowsSimpChinese"
Create Map For WYSite CoordSys Earth Projection 1, 0
Add Map Layer WYSite
Fetch First From tempSite
Set Map Center (tempSite.LONGITUDE , tempSite.LATITUDE )
Set Map Zoom 5 Units "km"
Set Map Layer 0 Editable On Selectable On
Do While Not EOT(tempSite)
if tempSite.POWER=0 THEN
intPower=45
else
intPower=tempSite.POWER
end if
x(1)=tempSite.LONGITUDE
y(1)=tempSite.LATITUDE
For i = 2 To 18
x(i)=tempSite.LONGITUDE+0.000012* intPower * cos((90.0 - tempSite.ANTDIR + tempSite.ANTBAND * ( i - 10)/16.0 )*PI/180)
y(i)=tempSite.LATITUDE +0.00001* intPower * sin((90.0 - tempSite.ANTDIR + tempSite.ANTBAND * ( i - 10)/16.0 )*PI/180)
Next
Do Case Left$(tempSite.SITE_ID,2)
Case "WE"
mcolor=RGB(119,158,232)
Case "DE"
mcolor=RGB(233,118,207)
Case "WM"
mcolor=RGB(53,201,41)
Case "WO"
mcolor=RGB(231,55,12)
Case "ZF"
mcolor=RGB(240,139,2)
Case Else
mcolor=RGB(240,139,2)
End Case
Create Region Into Variable objRegion 1 18
(x(1),y(1))(x(2),y(2))(x(3),y(3))(x(4),y(4))(x(5),y(5))(x(6),y(6))
(x(7),y(7))(x(8),y(8))(x(9),y(9))(x(10),y(10))(x(11),y(11))(x(12),y(12))
(x(13),y(13))(x(14),y(14))(x(15),y(15))(x(16),y(16))(x(17),y(17))(x(18),y(18))
'Pen(1, 1, BLUE)
'Brush(2, BLUE, BLUE)
Pen MakePen(INT(tempSite.ANTTIL),2,RGB(123,23,88))
'Brush MakeBrush(2,RGB(114,137,207),RGB(13,0,100))
Brush MakeBrush(2,mcolor,RGB(13,0,100))
Center(tempSite.LONGITUDE,tempSite.LATITUDE)
'Insert 方式范例Jinzhu.Zhang
tmpStr=tempSite.SITE_ID
tmpStr2=tempSite.SITE_NAME
Insert Into WYSite(Obj,SITE_ID,SITE_NAME) Values (objRegion,tmpStr,tmpStr2)
'Update 方式范例Jinzhu.Zhang
tmpStr=tempSite.所属BSC编号
Update WYSite set BSCID=tmpStr WHERE ROWID=intNowCell
'tmpStr3=tempSite.开通时间
'Update WYSite set OPENTIME=NumberToDate(tmpStr3) WHERE ROWID=intNowCell
intNowCell = intNowCell + 1
Fetch Next From tempSite
Loop
set map redraw on
QQ:4631855
name:张金柱
相关文章推荐
- 使用vb.net打开某个文件
- Delphi 对treeview的操作(转,收藏)
- 让Spring的XML文件配置简单的衡量
- (原创) 脚踏实地学Java之:基础篇
- asp.net提高性能的要点
- e的X平方加上e的y平方(C++ code)
- 使用ADO.NET 和C# 处理BLOB 数据
- Delphi2005学习笔记3——数组参数的研究
- 《Core Java 2》与《Thinking in Java》之我见:)
- 论Java加密技术与Windows的结合
- PHP画图(四)
- Using the Network Functions in C# (Part I - User Functions)
- 发送邮件常见出错代码
- java中不同类型的转换和提升
- 使用CODEDOM动态实现代码的生成,编译
- 使用CODEDOM动态实现代码的生成,编译
- asp.net打印
- ...继续学习Unix编程...
- PHP实现文件下载
- C# 运算符