'##############################################################'函数申明Include "MapBasic.def"Global Length as floatGlobal Path as stringDeclare SUB MainDeclare SUB Create_BCCHDeclare SUB Create_900'declare SUB Create_1800Declare SUB Create_SiteNameDeclare SUB Create_CellIDDeclare SUB Create_BCCH_NameCIDeclare Function Alterlon (ByVal 经度 as string,ByVal 纬度 as string,ByVal 方向角 as string,ByVal 定位长度 as string,ByValFileName as string) as integer'##############################################################'########################### MAIN程序#############################'##############################################################SUB MainLength=0.0025 '控制总体大小Path="D:\2"Call Create_900' Call Create_BCCH' Call Create_SiteName' Call Create_CellIDEND SUB'##############################################################'########################画基站 GSM900的扇区子程序#######################'##############################################################SUB Create_900Dim x0,y0,x1,y1,x2,y2 as floatDim ABC as ObjectDim ABC1 as ObjectDim i as IntegerDim MyRow as IntegerDim Length1 as FloatDim Row as IntegerDim Freq as StringDim Sitestytle as IntegerDim BSC as StringDim SiteStyle as IntegerDim BCCH as StringDim SiteName as StringDim CellID as StringDim FillBrush as BrushDim BSCwang as StringDim RowPi as FloatDim ObjCellID as ObjectMyRow=1Open Table Path+"\Rio2" As RFinfo1 Interactive'打开基站信息表Create Map For RFinfo1 ' 'select * from rfinfo where RFinfo.BSC网类="GSM900" into rfinfo1Create Table RF2 (NNN integer) File Path+"\Temp"Create Map For RF2Fetch First From RFinfo1 ‘设置一个表的光标位置(即哪一行是当前行)Do While Not EOT(RFinfo1)FillBrush=MakeBrush(2, white, Blue) ‘返回填充图案值Length1=Length ‘Length=0.0025 '控制总体大小Set Style Pen MakePen(1, 2, Black)‘返回一线型值,Pen为图形对象指定一种线型Row=RFinfo1.AzimuthX0=RFinfo1.LonY0=tX1=X0+Cos(3.14/4)*Length1Y1=Y0+Sin(3.14/4)*Length1X2=X0+Cos(3.14/4+3.14)*Length1Y2=Y0+Sin(3.14/4+3.14)*Length1‘定位扇形的三个点坐标'BCCH=RFinfo1.BCCHSiteName=RFinfo1.CellNameCellID=RFinfo1.CI'BSCwang=RFinfo1.BSCSitestytle=1'画定向天线的方向角Create Arc Into Variable ABC ( X1 , Y1 ) ( X2 , Y2 ) (60-Row) (120-Row) Pen(6, 2, Red)ABC=ConvertToRegion ( ABC )‘=ConvertToRegion ( ABC )返回一个形状近似于某个对象的区域对象Alter Object ABC Info OBJ_INFO_BRUSH, FillBrush Node Add ( X0, Y0 )Update RFinfo1 Set Obj = ABC Where RowID= MyRow''' row=90-row' rowpi=(row/180)*3.14'' length1=length'' if row=0 or row=-90 or row=-270 or row=-180 then' length1=length*1.1' end if'' y2=y0+length1*sin(rowpi)' x2=x0+length1*cos(rowpi)''写字Insert Into RF2 select SiteName from RFinfo1Create Text Into Variable ObjCellID SiteName (x2 , y2) ((x2+length1) , (y2+length1))Update RF2 Set Obj=ObjCellID Where RowID=MyRow' insert into drawbcch values(x0,y0,bcch,row,sitestyle) ' insert into drawsitenamevalues(sitename,x0,y0,cellid,row,sitestyle)' Insert Into RF2 (Object) values(ObjCellID )MyRow=MyRow+1Note MyRowFetch Next From RFinfo1LoopCommit Table RFinfo1Map From RFinfo1END SUB'###########################################################'改变经纬度Function alterlon (ByVal 经度 as string,ByVal 纬度 as string,ByVal 方向角 as string,ByVal 定位长度 as string,ByVal filename as string) as integerdim x0,y0,x2,y2 as floatdim drawobj as objectdim myrow as integerdim length1 as floatdim row as integerdim rowpi as floatdim bcch as stringmyrow=1open table path+"\"+filename as filename1fetch first from filename1do while not EOT(filename1)length1=val(定位长度) '频点位置X0=val(经度)Y0=val(纬度)if filename="drawbcch" thenrow=90-val(方向角)rowpi=(row/180)*3.14if row=0 or row=-90 or row=-270 or row=-180 then length1=length1*1.1end ify2=y0+length1*sin(rowpi)x2=x0+length1*cos(rowpi)elserow=val(方向角)y2=y0-length1*sin((row/180)*3.14)x2=x0+length1*cos((row/180)*3.14)end ifCreate Point Into Variable drawobj (X2 ,Y2) Symbol(22,white,1)update filename1 set 经度=x2 where rowid=myrowupdate filename1 set 纬度=y2 where rowid=myrowupdate filename1 set obj=objbcch where rowid=myrowMyRow=MyRow+1fetch next from filename1Loopcommit table filename1Add Map Auto Layer filename1alterlon=1end function'###########################################################'画各扇区频点,基站名字,基站cellidsub create_bcch_namecidim drawlength as floatdim return as integer'画基站频点'open table path+"\drawbcch" as filenamedrawlength=lengthreturn=alterlon("drawbcch.jindubcch","drawbcch.weidubcch","drawbcch.f angxiangjiaobcch",drawlength,"drawbcch")'画基站名字'open table path+"\drawsitename" as filenamedrawlength=length*0.3return=alterlon("drawsitename.jindusitename","drawsitename.weidusiten ame",10,drawlength,"drawsitename")'画基站cellid'open table path+"\drawcellid" as filenamedrawlength=length*0.3return=alterlon("drawcellid.jinducellid","drawcellid.weiducellid",50, drawlength,"drawcellid")end sub'########################################################### '??????sub create_bcchdim x0,y0,x2,y2 as floatdim objbcch as objectdim i as integerdim myrow as integerdim length1 as floatdim row as integerdim rowpi as floatdim bcch as stringlength=length*0.7myrow=1open table path+"\drawbcch" as drawbcchfetch first from drawbcchdo while not EOT(drawbcch)' if drawbcch.bscwangxing="DCS1800" then'??1800?900????' length1=length*0.5' elselength1=length' end ifX0=drawbcch.jindubcchY0=drawbcch.weidubcchrow=90-val(drawbcch.fangxiangjiaobcch)rowpi=(row/180)*3.14if row=0 or row=-90 or row=-270 or row=-180 then length1=length1*1.1end ify2=y0+length1*sin(rowpi)x2=x0+length1*cos(rowpi)Create Point Into Variable objbcch (X2 ,Y2) Symbol(22,white,1)update drawbcch set jindubcch=x2 where rowid=myrow update drawbcch set weidubcch=y2 where rowid=myrow update drawbcch set obj=objbcch where rowid=myrow MyRow=MyRow+1fetch next from drawbcchLoopcommit table drawbcchAdd Map Auto Layer drawbcchbrowse * from drawbcchend sub'###########################################################'??????sub Create_SiteNamedim x0,y0,x1,y1,x2,y2 as floatdim objsitename as objectdim i as integerdim myrow as integerdim length1 as floatdim row as integerdim rowpi as floatdim bsc as stringdim sitestyle as stringdim bcch as stringdim sitename as stringdim cellid as stringdim ci as integermyrow=1open table path+"\drawsitename" as drawsitenamefetch first from drawsitenamedo while not EOT(drawsitename)length1=length*0.3 '???X0=drawsitename.jindusitenameY0=drawsitename.weidusitenamesitestyle=drawsitename.zhanxingsitenamecellid=drawsitename.cisitenamesitename=drawsitename.sitenamesitenameci=val(left$(cellid, 1))y1=y0-length1*sin((10/180)*3.14) '10 ???????x1=x0+length1*cos((10/180)*3.14)'y2=y0-length2*sin((10/180)*3.14)'x2=x0+length2*cos((10/180)*3.14)if ci=1 thenCreate Point Into Variable objsitename (X1 ,Y1) Symbol(22,white,1)update drawsitename set jindusitename=x1 where rowid=myrowupdate drawsitename set weidusitename=y1 where rowid=myrowupdate drawsitename set obj=objsitename where rowid=myrowend ifMyRow=MyRow+1fetch next from drawsitenameLoopcommit table drawsitenameAdd Map Auto Layer drawsitenamebrowse * from drawsitenameend sub'###########################################################'????cellidsub Create_CellIDdim x0,y0,x1,y1,x2,y2 as floatdim objcellid as objectdim i as integerdim myrow as integerdim length1 as floatdim row as integerdim rowpi as floatdim bsc as stringdim sitestyle as stringdim bcch as stringdim sitename as stringdim cellid as stringdim ci as integermyrow=1open table path+"\drawcellid" as drawcellidfetch first from drawcelliddo while not EOT(drawcellid)length1=length*0.3 '??X0=drawcellid.jinducellidY0=drawcellid.weiducellidsitestyle=drawcellid.zhanxingcellidcellid=drawcellid.cicellidsitename=drawcellid.sitenamecellidci=val(left$(cellid, 1))y1=y0-length1*sin((50/180)*3.14) '50 ??????? x1=x0+length1*cos((50/180)*3.14)'y2=y0-length2*sin((40/180)*3.14)'x2=x0+length2*cos((10/180)*3.14)if ci=1 thenCreate Point Into Variable objcellid (X1 ,Y1) Symbol(22,white,1)update drawcellid set jinducellid=x1 where rowid=myrowupdate drawcellid set weiducellid=y1 where rowid=myrowupdate drawcellid set obj=objcellid where rowid=myrowend ifMyRow=MyRow+1fetch next from drawcellidLoopcommit table drawcellidAdd Map Auto Layer drawcellidbrowse * from drawcellidend sub。