Include "MapBasic.def" Declare Sub Main Declare Function CreateAnnulusSector( ByVal oCenterPoint As Object , ByVal fInnerRadius As Float 'in meters , ByVal fOuterRadius As Float 'in meters , ByVal fStartAngle As Float , ByVal fEndAngle As Float , ByVal nResolution As Integer ) As Object Declare Function MathNorth2MathAngle( ByVal fNorthAngle As Float) As Float '****************************************************************************************** Sub Main Set CoordSys Table Live_Cell Update Live_Cell Set OBJ = CreateAnnulusSector(CreatePoint(actual_longitude, actual_latitude), 0, Radius, MathNorth2MathAngle(Brg2a), MathNorth2MathAngle(Brg2a), 120) End Sub '****************************************************************************************** Function CreateAnnulusSector( ByVal oCenterPoint As Object , ByVal fInnerRadius As Float 'in meters , ByVal fOuterRadius As Float 'in meters , ByVal fStartAngle As Float , ByVal fEndAngle As Float , ByVal nResolution As Integer ) As Object Dim oPoint, oSector, oCutter As Object, fX, fY, fDistance As Float, i As Integer CreateAnnulusSector = oCenterPoint '**Create concentric circle oSector = Buffer(oCenterPoint, nResolution, fOuterRadius, "m") If fInnerRadius > 0 Then oSector = Erase(oSector, Buffer(oCenterPoint, nResolution, fInnerRadius, "m")) End If '**Find center coordinates fX = CentroidX(oCenterPoint) fY = CentroidY(oCenterPoint) '**Calculate distance for cutter object fDistance = 3 * fOuterRadius Create Pline Into Variable oCutter 1 (fX, fY) oPoint = Offset(oCenterPoint, fStartAngle , fDistance, "m") Alter Object oCutter Node Add (CentroidX(oPoint),CentroidY(oPoint)) oPoint = Offset(oCenterPoint, fEndAngle , fDistance, "m") Alter Object oCutter Node Add (CentroidX(oPoint),CentroidY(oPoint)) '**Convert cutter polyline to a polygon oCutter = ConvertToRegion(oCutter) '**Erase the concentric circle where the cutter object doesn't overlap oSector = Overlap(oSector, oCutter) CreateAnnulusSector = oSector End Function '****************************************************************************************** Function MathNorth2MathAngle( ByVal fNorthAngle As Float) As Float Dim fNewAngle As Float If fNorthAngle = 0 Then fNewAngle = 90 ElseIf fNorthAngle = 90 Then fNewAngle = 0 ElseIf fNorthAngle = 180 Then fNewAngle = 270 ElseIf fNorthAngle = 270 Then fNewAngle = 180 ElseIf fNorthAngle = 360 Then fNewAngle = 90 ElseIf fNorthAngle > 0 And fNorthAngle < 90 Then fNewAngle = 90 - fNorthAngle ElseIf fNorthAngle > 90 And fNorthAngle < 180 Then fNewAngle = (360 - fNorthAngle) + 90 ElseIf fNorthAngle > 180 And fNorthAngle < 270 Then fNewAngle = (270 - fNorthAngle) + 180 ElseIf fNorthAngle > 270 And fNorthAngle < 360 Then fNewAngle = (360 - fNorthAngle) + 90 End If MathNorth2MathAngle = fNewAngle End Function