用MAPINFO画三叶草的代码(freeheart原创)原名:张金柱

类别:.NET开发 点击:0 评论:0 推荐:
用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:张金柱

本文地址:http://com.8s8s.com/it/it42545.htm