class PinSVisualSegmentDepManouvering(IPinSVisualSegmentDep): def __init__(self, pinSVisualSegmentDep_0): IPinSVisualSegmentDep.__init__(self) self.RADIUS = 750 self.OCS = 0 self.OIS = 1 self.poaOIS = PrimaryObstacleArea() self.poaOCS = PrimaryObstacleArea() self.paOIS = PolylineArea() self.paOCS = PolylineArea() self.selectionArea = [] self.ptsOCSL = [] self.ptsOCSR = [] self.ptHRP = Point3D() self.ptIDF = Point3D() self.track = 0.0 self.tang = 0.0 self.elevOIS = 0.0 self.cancelled = False self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D() self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D() self.track = MathHelper.smethod_4( Unit.ConvertDegToRad( float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value))) num = MathHelper.getBearing(self.ptIDF, self.ptHRP) MathHelper.getBearing(self.ptHRP, self.ptIDF) altitude = pinSVisualSegmentDep_0.pnlMCAH.method_3( Altitude(self.ptHRP.get_Z())) metres = altitude.Metres if (metres < 90): raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_2( Altitude(self.ptHRP.get_Z())) metres1 = altitude1.Metres self.tang = 0.125 num1 = 741 num2 = 1482 if (metres > 183): num3 = math.trunc((metres - 183) / 30) if ((metres - 183) % 30 > 0): num3 = num3 + 1 num2 = num2 + num3 * 185 num4 = 50 if (metres > 183 and metres <= 304): num5 = math.trunc((metres - 183) / 30) if ((metres - 183) % 30 > 0): num5 = num5 + 1 num4 = num4 - num5 * 5 if (num4 < 30): num4 = 30 elif (metres > 304): num4 = 30 num6 = Unit.ConvertDegToRad(num4) num7 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) if (num7 < 1000): eRRINSUFFICIENTSEGMENTLENGTHIDFHRP = Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH_IDF_HRP distance = Distance(num2) raise UserWarning, eRRINSUFFICIENTSEGMENTLENGTHIDFHRP % distance.Metres turnDirectionList = [] num8 = MathHelper.smethod_77(num, self.track, AngleUnits.Radians, turnDirectionList) turnDirection = turnDirectionList[0] if (num8 + num6 >= 3.14159265358979): eRRPINSCCHGLARGEUSEDIRECT = Messages.ERR_PINS_CCHG_LARGE_USE_DIRECT num9 = Unit.smethod_1(3.14159265358979 - num6) raise UserWarning, eRRPINSCCHGLARGEUSEDIRECT % num9 self.paOIS = PolylineArea() self.paOIS.method_1(self.ptIDF) if (turnDirection == TurnDirection.Nothing or MathHelper.smethod_99(num8, 0, 0.1)): point3d = MathHelper.distanceBearingPoint(self.ptHRP, num - num6, num2) point3d1 = MathHelper.distanceBearingPoint(self.ptHRP, num + num6, num2) if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked()): point3d = MathHelper.distanceBearingPoint( self.ptHRP, num, num2) elif (pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.isChecked() ): point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, num, num2) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) else: if num2 > num7: point3d2 = None point3d3 = None else: point3d2 = MathHelper.distanceBearingPoint( self.ptHRP, num - math.fabs(math.asin(num2 / num7)) - 1.5707963267949, num2) point3d3 = MathHelper.distanceBearingPoint( self.ptHRP, num + math.fabs(math.asin(num2 / num7)) + 1.5707963267949, num2) if (num8 < num6 and not pinSVisualSegmentDep_0.ui. chbLeftTurnProhibited.isChecked() and not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited. isChecked()): point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2) point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2) if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)): point3d = point3d2 if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)): point3d1 = point3d3 self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) elif (turnDirection != TurnDirection.Left): point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2) if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)): point3d1 = point3d3 if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked( )): point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track, num2) self.paOIS.method_1(self.ptHRP) if not MathHelper.smethod_119(point3d3, self.ptHRP, point3d): self.paOIS.method_1(point3d) else: self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) else: num10 = Unit.ConvertDegToRad(30) point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2 ) if num8 - num6 <= num10 else MathHelper.distanceBearingPoint( self.ptHRP, num + num10, num2) if (MathHelper.smethod_119(point3d, self.ptIDF, self.ptHRP)): self.paOIS.method_1(self.ptHRP) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) else: point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2) if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)): point3d = point3d2 if (not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited. isChecked()): num11 = Unit.ConvertDegToRad(30) point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2 ) if num8 - num6 <= num11 else MathHelper.distanceBearingPoint( self.ptHRP, num - num11, num2) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) if (MathHelper.smethod_115(point3d1, self.ptIDF, self.ptHRP)): self.paOIS.method_1(self.ptHRP) self.paOIS.method_1(self.ptIDF) else: point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track, num2) if (MathHelper.smethod_115(point3d2, self.ptHRP, point3d1)): self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptHRP) self.paOIS.method_1(self.ptIDF) # polyline = AcadHelper.smethod_131(self.paOIS); # polyline.set_Closed(true); # polyline = polyline.smethod_159(num1, OffsetGapType.Fillet, TurnDirection.Right); self.paOIS.offsetCurve(num1) self.poaOIS = PrimaryObstacleArea(self.paOIS) self.elevOIS = self.ptHRP.get_Z() + max([metres / 2 - 46, 46]) metres2 = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres) metres3 = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres) num = MathHelper.smethod_4( Unit.ConvertDegToRad( float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value))) self.paOCS = PolylineArea() self.ptsOCSL = [] self.ptsOCSR = [] point3d4 = MathHelper.distanceBearingPoint( MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2), num - 1.5707963267949, metres2 / 2) point3d5 = MathHelper.distanceBearingPoint( MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2), num + 1.5707963267949, metres2 / 2) num12 = math.atan( 0.1 ) if pinSVisualSegmentDep_0.ui.cmbDepartureType.SelectedIndex == 0 else math.atan( 0.15) num13 = 152 / self.tang num14 = (120 - metres2 / 2) / math.tan(num12) self.ptsOCSL = [] self.ptsOCSL.append(point3d4) self.ptsOCSL.append( MathHelper.distanceBearingPoint( point3d4, num - num12, num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() + num14 * self.tang)) self.ptsOCSL.append( MathHelper.distanceBearingPoint( self.ptsOCSL[1], num, num13 - num14).smethod_167(self.ptHRP.get_Z() + 152)) self.ptsOCSR = [] self.ptsOCSR.append(point3d5) self.ptsOCSR.append( MathHelper.distanceBearingPoint( point3d5, num + num12, num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() + num14 * self.tang)) self.ptsOCSR.append( MathHelper.distanceBearingPoint( self.ptsOCSR[1], num, num13 - num14).smethod_167(self.ptHRP.get_Z() + 152)) self.paOCS = PolylineArea() for point in self.ptsOCSL: self.paOCS.method_1(point) for j in range(len(self.ptsOCSR) - 1, -1, -1): self.paOCS.method_1(self.ptsOCSR[j]) self.paOCS.method_10() self.poaOCS = PrimaryObstacleArea(self.paOCS) self.selectionArea = (PrimaryObstacleArea(self.paOIS)).SelectionArea def get_Cancelled(self): return self.cancelled Cancelled = property(get_Cancelled, None, None, None) def get_SelectionArea(self): return self.selectionArea SelectionArea = property(get_SelectionArea, None, None, None) def imethod_0(self, obstacle_0): criticalObstacleType = CriticalObstacleType.No if (self.poaOIS.pointInPolygon(obstacle_0.Position, obstacle_0.Tolerance)): z = self.elevOIS num = 1 if (self.poaOCS.pointInPolygon(obstacle_0.Position, obstacle_0.Tolerance)): point3d1 = MathHelper.distanceBearingPoint( obstacle_0.Position, self.track, 100) point3d = MathHelper.getIntersectionPoint( obstacle_0.Position, point3d1, self.ptsOCSL[0], self.ptsOCSR[0]) num1 = max( MathHelper.calcDistance(point3d, obstacle_0.Position) - obstacle_0.Tolerance, 0) z = num1 * self.tang + self.ptHRP.get_Z() num = 0 position = obstacle_0.Position z1 = position.get_Z() + obstacle_0.Trees - z if (z1 > 0): criticalObstacleType = CriticalObstacleType.Yes return [ z, z1, criticalObstacleType, PinsSurfaceType.PinsSurfaceType_OCS if num == 0 else PinsSurfaceType.PinsSurfaceType_LevelOIS ] def imethod_1(self, layers): linesList = [] pointList = self.paOIS.method_14_closed() linesList.append((pointList, [ ("surface", PinsSurfaceType.PinsSurfaceType_LevelOIS) ])) polyline = self.paOCS.method_14_closed() linesList.append( (polyline, [("surface", PinsSurfaceType.PinsSurfaceType_OCS)])) resultLayer = QgisHelper.createPolylineLayer( "Pins Visual Segment Departure Manouvering 2D", linesList, [QgsField("surface", QVariant.String)]) layers.append(resultLayer) def imethod_2(self, layers): polyline = self.paOIS.method_14_closed() # polyline.set_Elevation(self.elevOIS); linesList = [] for i in range(1, len(self.ptsOCSL)): face = [ self.ptsOCSL[i - 1], self.ptsOCSL[i], self.ptsOCSR[i], self.ptsOCSR[i - 1] ] linesList.append( (face, [("surface", PinsSurfaceType.PinsSurfaceType_OCS)])) linesList.append((polyline, [ ("surface", PinsSurfaceType.PinsSurfaceType_LevelOIS) ])) resultLayer = QgisHelper.createPolylineLayer( "Pins Visual Segment Departure Manouvering 3D", linesList, [QgsField("surface", QVariant.String)]) layers.append(resultLayer)
def __init__(self, pinSVisualSegmentDep_0): IPinSVisualSegmentDep.__init__(self) self.RADIUS = 750 self.OCS = 0 self.OIS = 1 self.poaOIS = PrimaryObstacleArea() self.poaOCS = PrimaryObstacleArea() self.paOIS = PolylineArea() self.paOCS = PolylineArea() self.selectionArea = [] self.ptsOCSL = [] self.ptsOCSR = [] self.ptHRP = Point3D() self.ptIDF = Point3D() self.track = 0.0 self.tang = 0.0 self.elevOIS = 0.0 self.cancelled = False self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D() self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D() self.track = MathHelper.smethod_4( Unit.ConvertDegToRad( float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value))) num = MathHelper.getBearing(self.ptIDF, self.ptHRP) MathHelper.getBearing(self.ptHRP, self.ptIDF) altitude = pinSVisualSegmentDep_0.pnlMCAH.method_3( Altitude(self.ptHRP.get_Z())) metres = altitude.Metres if (metres < 90): raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_2( Altitude(self.ptHRP.get_Z())) metres1 = altitude1.Metres self.tang = 0.125 num1 = 741 num2 = 1482 if (metres > 183): num3 = math.trunc((metres - 183) / 30) if ((metres - 183) % 30 > 0): num3 = num3 + 1 num2 = num2 + num3 * 185 num4 = 50 if (metres > 183 and metres <= 304): num5 = math.trunc((metres - 183) / 30) if ((metres - 183) % 30 > 0): num5 = num5 + 1 num4 = num4 - num5 * 5 if (num4 < 30): num4 = 30 elif (metres > 304): num4 = 30 num6 = Unit.ConvertDegToRad(num4) num7 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) if (num7 < 1000): eRRINSUFFICIENTSEGMENTLENGTHIDFHRP = Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH_IDF_HRP distance = Distance(num2) raise UserWarning, eRRINSUFFICIENTSEGMENTLENGTHIDFHRP % distance.Metres turnDirectionList = [] num8 = MathHelper.smethod_77(num, self.track, AngleUnits.Radians, turnDirectionList) turnDirection = turnDirectionList[0] if (num8 + num6 >= 3.14159265358979): eRRPINSCCHGLARGEUSEDIRECT = Messages.ERR_PINS_CCHG_LARGE_USE_DIRECT num9 = Unit.smethod_1(3.14159265358979 - num6) raise UserWarning, eRRPINSCCHGLARGEUSEDIRECT % num9 self.paOIS = PolylineArea() self.paOIS.method_1(self.ptIDF) if (turnDirection == TurnDirection.Nothing or MathHelper.smethod_99(num8, 0, 0.1)): point3d = MathHelper.distanceBearingPoint(self.ptHRP, num - num6, num2) point3d1 = MathHelper.distanceBearingPoint(self.ptHRP, num + num6, num2) if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked()): point3d = MathHelper.distanceBearingPoint( self.ptHRP, num, num2) elif (pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.isChecked() ): point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, num, num2) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) else: if num2 > num7: point3d2 = None point3d3 = None else: point3d2 = MathHelper.distanceBearingPoint( self.ptHRP, num - math.fabs(math.asin(num2 / num7)) - 1.5707963267949, num2) point3d3 = MathHelper.distanceBearingPoint( self.ptHRP, num + math.fabs(math.asin(num2 / num7)) + 1.5707963267949, num2) if (num8 < num6 and not pinSVisualSegmentDep_0.ui. chbLeftTurnProhibited.isChecked() and not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited. isChecked()): point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2) point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2) if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)): point3d = point3d2 if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)): point3d1 = point3d3 self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) elif (turnDirection != TurnDirection.Left): point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2) if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)): point3d1 = point3d3 if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked( )): point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track, num2) self.paOIS.method_1(self.ptHRP) if not MathHelper.smethod_119(point3d3, self.ptHRP, point3d): self.paOIS.method_1(point3d) else: self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) else: num10 = Unit.ConvertDegToRad(30) point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2 ) if num8 - num6 <= num10 else MathHelper.distanceBearingPoint( self.ptHRP, num + num10, num2) if (MathHelper.smethod_119(point3d, self.ptIDF, self.ptHRP)): self.paOIS.method_1(self.ptHRP) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptIDF) else: point3d = MathHelper.distanceBearingPoint( self.ptHRP, self.track - num6, num2) if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)): point3d = point3d2 if (not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited. isChecked()): num11 = Unit.ConvertDegToRad(30) point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track + num6, num2 ) if num8 - num6 <= num11 else MathHelper.distanceBearingPoint( self.ptHRP, num - num11, num2) self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) if (MathHelper.smethod_115(point3d1, self.ptIDF, self.ptHRP)): self.paOIS.method_1(self.ptHRP) self.paOIS.method_1(self.ptIDF) else: point3d1 = MathHelper.distanceBearingPoint( self.ptHRP, self.track, num2) if (MathHelper.smethod_115(point3d2, self.ptHRP, point3d1)): self.paOIS.method_3( point3d, MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1, self.ptHRP)) self.paOIS.method_1(point3d1) self.paOIS.method_1(self.ptHRP) self.paOIS.method_1(self.ptIDF) # polyline = AcadHelper.smethod_131(self.paOIS); # polyline.set_Closed(true); # polyline = polyline.smethod_159(num1, OffsetGapType.Fillet, TurnDirection.Right); self.paOIS.offsetCurve(num1) self.poaOIS = PrimaryObstacleArea(self.paOIS) self.elevOIS = self.ptHRP.get_Z() + max([metres / 2 - 46, 46]) metres2 = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres) metres3 = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres) num = MathHelper.smethod_4( Unit.ConvertDegToRad( float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value))) self.paOCS = PolylineArea() self.ptsOCSL = [] self.ptsOCSR = [] point3d4 = MathHelper.distanceBearingPoint( MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2), num - 1.5707963267949, metres2 / 2) point3d5 = MathHelper.distanceBearingPoint( MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2), num + 1.5707963267949, metres2 / 2) num12 = math.atan( 0.1 ) if pinSVisualSegmentDep_0.ui.cmbDepartureType.SelectedIndex == 0 else math.atan( 0.15) num13 = 152 / self.tang num14 = (120 - metres2 / 2) / math.tan(num12) self.ptsOCSL = [] self.ptsOCSL.append(point3d4) self.ptsOCSL.append( MathHelper.distanceBearingPoint( point3d4, num - num12, num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() + num14 * self.tang)) self.ptsOCSL.append( MathHelper.distanceBearingPoint( self.ptsOCSL[1], num, num13 - num14).smethod_167(self.ptHRP.get_Z() + 152)) self.ptsOCSR = [] self.ptsOCSR.append(point3d5) self.ptsOCSR.append( MathHelper.distanceBearingPoint( point3d5, num + num12, num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() + num14 * self.tang)) self.ptsOCSR.append( MathHelper.distanceBearingPoint( self.ptsOCSR[1], num, num13 - num14).smethod_167(self.ptHRP.get_Z() + 152)) self.paOCS = PolylineArea() for point in self.ptsOCSL: self.paOCS.method_1(point) for j in range(len(self.ptsOCSR) - 1, -1, -1): self.paOCS.method_1(self.ptsOCSR[j]) self.paOCS.method_10() self.poaOCS = PrimaryObstacleArea(self.paOCS) self.selectionArea = (PrimaryObstacleArea(self.paOIS)).SelectionArea
class PinSVisualSegmentDepDirect(IPinSVisualSegmentDep): def __init__(self, pinSVisualSegmentDep_0): IPinSVisualSegmentDep.__init__(self) self.poaOIS = PrimaryObstacleArea() self.paOIS = PolylineArea() self.tanOIS = 0.0 self.trackOIS = 0.0 self.maxSurfAlt = 0.0 self.ptHRP = Point3D() self.ptIDF = Point3D() self.ptL1 = Point3D() self.ptR1 = Point3D() turnDirection = [] metres = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres) num = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres) self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D() self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D() num1 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) - metres / 2 if (num1 < 1482): raise UserWarning, Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH value = float(pinSVisualSegmentDep_0.ui.txtTrackFrom.Value) num2 = Unit.smethod_1(MathHelper.getBearing(self.ptHRP, self.ptIDF)) num3 = MathHelper.smethod_77(num2, value, AngleUnits.Degrees, turnDirection) if (num3 == 0): str1 = "13.9km(7.5nm)" if (num1 > 13900): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str1 elif (num3 <= 10): str3 = "11.9km(6.4nm)" if (num1 > 11900): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str3 elif (num3 > 20): if (num3 > 30): raise UserWarning, Messages.ERR_COURSE_CHANGES_GREATER_THAN_30_NOT_ALLOWED str5 = "6.5km(3.5nm)" if (num1 > 6500): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str5 else: str7 = "9.3km(5nm)" if (num1 > 9300): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str7 altitude = pinSVisualSegmentDep_0.pnlMCAH.method_2( Altitude(self.ptHRP.get_Z())) metres1 = altitude.Metres altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_3( Altitude(self.ptHRP.get_Z())) metres2 = altitude1.Metres metres3 = pinSVisualSegmentDep_0.ui.txtMOC.Value.Metres if (metres2 - metres3 <= 0): raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE angleGradientSlope = pinSVisualSegmentDep_0.ui.txtVSDG.Value percent = metres2 / (angleGradientSlope.Percent / 100) self.tanOIS = (metres2 - metres3) / percent if (percent > num1): raise UserWarning, Messages.ERR_IDF_TOO_CLOSE_OR_MIN_ALT_TOO_HIGH num2 = Unit.ConvertDegToRad(num2) value = Unit.ConvertDegToRad(value) self.trackOIS = num2 num4 = Unit.ConvertDegToRad(15) point3d = MathHelper.distanceBearingPoint(self.ptHRP, num2, metres / 2) self.ptL1 = MathHelper.distanceBearingPoint( point3d, num2 - 1.5707963267949, 45).smethod_167(self.ptHRP.get_Z()) self.ptR1 = MathHelper.distanceBearingPoint( point3d, num2 + 1.5707963267949, 45).smethod_167(self.ptHRP.get_Z()) point3d1 = MathHelper.distanceBearingPoint( self.ptL1, num2 - num4, percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d2 = MathHelper.distanceBearingPoint( self.ptR1, num2 + num4, percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d3 = MathHelper.distanceBearingPoint( point3d1, num2 - num4, (num1 - percent) / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d4 = MathHelper.distanceBearingPoint( point3d2, num2 + num4, (num1 - percent) / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) self.maxSurfAlt = self.ptHRP.get_Z() + percent * self.tanOIS self.paOIS = PolylineArea() polylineArea = self.paOIS point3dArray = [ self.ptL1, point3d1, point3d3, point3d4, point3d2, self.ptR1 ] polylineArea.method_7(point3dArray) self.paOIS.method_16() self.poaOIS = PrimaryObstacleArea(self.paOIS) def get_SelectionArea(self): return self.poaOIS.SelectionArea SelectionArea = property(get_SelectionArea, None, None, None) def imethod_0(self, obstacle_0): criticalObstacleType = CriticalObstacleType.No if (self.poaOIS.pointInPolygon(obstacle_0.Position, obstacle_0.Tolerance)): point3d1 = MathHelper.distanceBearingPoint(obstacle_0.Position, self.trackOIS, 100) point3d = MathHelper.getIntersectionPoint(obstacle_0.Position, point3d1, self.ptL1, self.ptR1) num = max([ MathHelper.calcDistance(point3d, obstacle_0.Position) - obstacle_0.Tolerance, 0 ]) num1 = min( [self.ptHRP.get_Z() + num * self.tanOIS, self.maxSurfAlt]) position = obstacle_0.Position z = position.get_Z() + obstacle_0.Trees - num1 if (z > 0): criticalObstacleType = CriticalObstacleType.Yes return [ num1, z, criticalObstacleType, PinsSurfaceType.PinsSurfaceType_OIS ] def imethod_1(self, layers): resultLayer = AcadHelper.createVectorLayer( "Pins Visual Segment Departure") AcadHelper.setGeometryAndAttributesInLayer( resultLayer, self.paOIS, True, {"Surface": PinsSurfaceType.PinsSurfaceType_OIS}) # pointList = self.paOIS.method_14_closed() # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure", # [(pointList, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])], # [QgsField("surface", QVariant.String)]) layers.append(resultLayer) def imethod_2(self, layers): resultLayer = AcadHelper.createVectorLayer( "Pins Visual Segment Departure") if (self.paOIS.Count == 4): face = [ self.paOIS[0].Position, self.paOIS[1].Position, self.paOIS[2].Position, self.paOIS[3].Position, self.paOIS[0].Position ] # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure", # [(face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])], # [QgsField("surface", QVariant.String)]) AcadHelper.setGeometryAndAttributesInLayer( resultLayer, face, False, {"Surface": PinsSurfaceType.PinsSurfaceType_OIS}) layers.append(resultLayer) return linesList = [] face = [ self.paOIS[0].Position, self.paOIS[1].Position, self.paOIS[4].Position, self.paOIS[5].Position, self.paOIS[0].Position ] AcadHelper.setGeometryAndAttributesInLayer( resultLayer, face, False, {"Surface": PinsSurfaceType.PinsSurfaceType_OIS}) linesList.append( (face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])) face = [ self.paOIS[1].Position, self.paOIS[2].Position, self.paOIS[3].Position, self.paOIS[4].Position, self.paOIS[1].Position ] AcadHelper.setGeometryAndAttributesInLayer( resultLayer, face, False, {"Surface": PinsSurfaceType.PinsSurfaceType_OIS}) linesList.append( (face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])) # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure", linesList, [QgsField("surface", QVariant.String)]) layers.append(resultLayer)
def __init__(self, pinSVisualSegmentDep_0): IPinSVisualSegmentDep.__init__(self) self.poaOIS = PrimaryObstacleArea() self.paOIS = PolylineArea() self.tanOIS = 0.0 self.trackOIS = 0.0 self.maxSurfAlt = 0.0 self.ptHRP = Point3D() self.ptIDF = Point3D() self.ptL1 = Point3D() self.ptR1 = Point3D() turnDirection = [] metres = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres) num = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres) self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D() self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D() num1 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) - metres / 2 if (num1 < 1482): raise UserWarning, Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH value = float(pinSVisualSegmentDep_0.ui.txtTrackFrom.Value) num2 = Unit.smethod_1(MathHelper.getBearing(self.ptHRP, self.ptIDF)) num3 = MathHelper.smethod_77(num2, value, AngleUnits.Degrees, turnDirection) if (num3 == 0): str1 = "13.9km(7.5nm)" if (num1 > 13900): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str1 elif (num3 <= 10): str3 = "11.9km(6.4nm)" if (num1 > 11900): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str3 elif (num3 > 20): if (num3 > 30): raise UserWarning, Messages.ERR_COURSE_CHANGES_GREATER_THAN_30_NOT_ALLOWED str5 = "6.5km(3.5nm)" if (num1 > 6500): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str5 else: str7 = "9.3km(5nm)" if (num1 > 9300): raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str7 altitude = pinSVisualSegmentDep_0.pnlMCAH.method_2( Altitude(self.ptHRP.get_Z())) metres1 = altitude.Metres altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_3( Altitude(self.ptHRP.get_Z())) metres2 = altitude1.Metres metres3 = pinSVisualSegmentDep_0.ui.txtMOC.Value.Metres if (metres2 - metres3 <= 0): raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE angleGradientSlope = pinSVisualSegmentDep_0.ui.txtVSDG.Value percent = metres2 / (angleGradientSlope.Percent / 100) self.tanOIS = (metres2 - metres3) / percent if (percent > num1): raise UserWarning, Messages.ERR_IDF_TOO_CLOSE_OR_MIN_ALT_TOO_HIGH num2 = Unit.ConvertDegToRad(num2) value = Unit.ConvertDegToRad(value) self.trackOIS = num2 num4 = Unit.ConvertDegToRad(15) point3d = MathHelper.distanceBearingPoint(self.ptHRP, num2, metres / 2) self.ptL1 = MathHelper.distanceBearingPoint( point3d, num2 - 1.5707963267949, 45).smethod_167(self.ptHRP.get_Z()) self.ptR1 = MathHelper.distanceBearingPoint( point3d, num2 + 1.5707963267949, 45).smethod_167(self.ptHRP.get_Z()) point3d1 = MathHelper.distanceBearingPoint( self.ptL1, num2 - num4, percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d2 = MathHelper.distanceBearingPoint( self.ptR1, num2 + num4, percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d3 = MathHelper.distanceBearingPoint( point3d1, num2 - num4, (num1 - percent) / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) point3d4 = MathHelper.distanceBearingPoint( point3d2, num2 + num4, (num1 - percent) / math.cos(num4)).smethod_167(self.ptHRP.get_Z() + percent * self.tanOIS) self.maxSurfAlt = self.ptHRP.get_Z() + percent * self.tanOIS self.paOIS = PolylineArea() polylineArea = self.paOIS point3dArray = [ self.ptL1, point3d1, point3d3, point3d4, point3d2, self.ptR1 ] polylineArea.method_7(point3dArray) self.paOIS.method_16() self.poaOIS = PrimaryObstacleArea(self.paOIS)
def getIntersectPolylineArea(self, angle, angleUnits_0): point3dArray = [self.Start[0], self.Start[1], self.Start[2], self.Finish[2]] polyline = PolylineArea(point3dArray) polyline.SetBulgeAt(0, MathHelper.smethod_60(self.Start[0], self.Middle[0], self.Finish[0])) polyline.SetBulgeAt(1, MathHelper.smethod_60(self.Start[1], self.Middle[1], self.Finish[1])) polyline.SetBulgeAt(2, MathHelper.smethod_60(self.Start[2], self.Middle[2], self.Finish[2])) intersectPt = self.method_0(angle, angleUnits_0) if intersectPt == None: return None, None polylineArea = None if round(self.Radius[0]) == round(MathHelper.calcDistance(self.Center[0], intersectPt)): point3dArray = [self.Start[0], intersectPt] polylineArea = PolylineArea(point3dArray) polylineArea.SetBulgeAt(0, MathHelper.smethod_60(self.Start[0], self.Middle[0], self.Finish[0])) elif round(self.Radius[1]) == round(MathHelper.calcDistance(self.Center[1], intersectPt)): point3dArray = [self.Start[0], self.Start[1], intersectPt] polylineArea = PolylineArea(point3dArray) polylineArea.SetBulgeAt(0, MathHelper.smethod_60(self.Start[0], self.Middle[0], self.Finish[0])) polylineArea.SetBulgeAt(1, MathHelper.smethod_60(self.Start[1], self.Middle[1], self.Finish[1])) else: point3dArray = [self.Start[0], self.Start[1], self.Start[2], intersectPt] polylineArea = PolylineArea(point3dArray) polylineArea.SetBulgeAt(0, MathHelper.smethod_60(self.Start[0], self.Middle[0], self.Finish[0])) polylineArea.SetBulgeAt(1, MathHelper.smethod_60(self.Start[1], self.Middle[1], self.Finish[1])) polylineArea.SetBulgeAt(2, MathHelper.smethod_60(self.Start[2], self.Middle[2], self.Finish[2])) return intersectPt, polylineArea
def __init__(self, point3d_0, double_0, speed_0, altitude_0, speed_1, double_1, double_2, orientationType_0): ''' Constructor ''' # double num; # double num1; # double num2; # double num3; # double num4; # Point3d point3d; # Point3d point3d1; # Point3d point3d2; # Point3d point3d3; # Point3d point3d4; # Point3d point3d5; # Point3d point3d6; # Point3d point3d7; # Point3d point3d8; # Point3d point3d9; # Point3d point3d10; # Point3d point3d11; # Point3d point3d12; # Point3d point3d13; # Point3d point3d14; # Point3d point3d15; # Point3d point3d16; # Point3d point3d17; # Point3d point3d18; # Point3d point3d19; # Point3d point3d20; # Point3d point3d21; # Point3d point3d22; # Point3d point3d23; # Point3d point3d24; # Point3d point3d25; # Point3d point3d26; # Point3d point3d27; # Point3d point3d28; # Point3d point3d29; # Point3d point3d30; # Point3d point3d31; # Point3d point3d32; # Point3d point3d33; # Point3d point3d34; # Point3d point3d35; point3d_0 = point3d_0.smethod_167(0) self.ptBase = point3d_0 self.trackDeg = MathHelper.smethod_3(double_0) self.trackRad = MathHelper.smethod_4(Unit.ConvertDegToRad(double_0)) self.orientation = orientationType_0 self.tas = Speed.smethod_0(speed_0, double_1, altitude_0) self.R = min([943.27 / self.tas.KilometresPerHour, 3]) self.radius = Distance( Unit.ConvertKMToMeters(self.tas.KilometresPerHour / (62.8318530717959 * self.R))) metresPerSecond = self.tas.MetresPerSecond metres = self.radius.Metres kilometresPerHour = speed_1.KilometresPerHour metresPerSecond1 = speed_1.MetresPerSecond r = 45 * metresPerSecond1 / self.R double2 = double_2 * 60 self.ds = Distance(metresPerSecond * double2) self.wd = Distance( math.sqrt(self.ds.Metres * self.ds.Metres + 4 * metres * metres)) num5 = 5 * metresPerSecond num6 = 11 * metresPerSecond num7 = (double2 - 5) * metresPerSecond num8 = (double2 - 5) * metresPerSecond num9 = (double2 + 21) * metresPerSecond num10 = (double2 + 21) * metresPerSecond num11 = 5 * metresPerSecond1 num12 = 11 * metresPerSecond1 num13 = num12 + r num14 = num12 + 2 * r num15 = num12 + 3 * r num16 = num12 + 4 * r num17 = num11 + 5 * r num18 = num11 + 6 * r num19 = (double2 + 6) * metresPerSecond1 + 4 * r num20 = (double2 + 6) * metresPerSecond1 + 4 * r num21 = num19 + 14 * metresPerSecond1 num22 = num19 + 14 * metresPerSecond1 num23 = num21 + r num24 = num21 + 2 * r num25 = num21 + 2 * r num26 = num21 + 3 * r num27 = num19 + 4 * r num28 = num21 + 4 * r r1 = 2 * metres + (double2 + 15) * metresPerSecond + ( double2 + 26 + 195 / self.R) * metresPerSecond1 num29 = 11 * metresPerSecond * math.cos(Unit.ConvertDegToRad( 20)) + metres * (1 + math.sin(Unit.ConvertDegToRad(20))) + ( double2 + 15) * metresPerSecond * math.tan( Unit.ConvertDegToRad(5)) + ( double2 + 26 + 125 / self.R) * metresPerSecond1 self.ias = speed_0 self.wind = speed_1 self.isa = double_1 self.altitude = altitude_0 self.time = double_2 num30 = 1 if (orientationType_0 == OrientationType.Right) else -1 turnDirection = TurnDirection.Right if ( orientationType_0 == OrientationType.Right) else TurnDirection.Left turnDirection1 = TurnDirection.Left if ( orientationType_0 == OrientationType.Right) else TurnDirection.Right point3d36 = MathHelper.distanceBearingPoint(point3d_0, 0, 0) point3d37 = MathHelper.distanceBearingPoint( point3d36, Unit.ConvertDegToRad(double_0), num5) point3d38 = MathHelper.distanceBearingPoint( point3d36, Unit.ConvertDegToRad(double_0), num6) point3d39 = MathHelper.distanceBearingPoint( point3d38, Unit.ConvertDegToRad(double_0 + num30 * 90), metres) point3d40 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * -45), metres) point3d41 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0), metres) point3d42 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * 45), metres) point3d43 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * 90), metres) point3d39 = MathHelper.distanceBearingPoint( point3d37, Unit.ConvertDegToRad(double_0 + num30 * 90), metres) MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * 90), metres) point3d44 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * 135), metres) point3d45 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + 180), metres) point3d46 = MathHelper.distanceBearingPoint( point3d43, Unit.ConvertDegToRad(double_0 + 180 - num30 * 5), num7) point3d47 = MathHelper.distanceBearingPoint( point3d43, Unit.ConvertDegToRad(double_0 + 180 - num30 * 5), num9) point3d48 = MathHelper.distanceBearingPoint( point3d43, Unit.ConvertDegToRad(double_0 + 180 + num30 * 5), num8) point3d49 = MathHelper.distanceBearingPoint( point3d43, Unit.ConvertDegToRad(double_0 + 180 + num30 * 5), num10) point3d39 = MathHelper.distanceBearingPoint( point3d47, Unit.ConvertDegToRad(double_0 - num30 * 90), metres) point3d50 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + 180 - num30 * 45), metres) point3d51 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + 180), metres) MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + num30 * 90), metres) point3d39 = MathHelper.distanceBearingPoint( point3d49, Unit.ConvertDegToRad(double_0 - num30 * 90), metres) point3d52 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + 180), metres) point3d53 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 + 180 + num30 * 45), metres) point3d54 = MathHelper.distanceBearingPoint( point3d39, Unit.ConvertDegToRad(double_0 - num30 * 90), metres) point3d55 = MathHelper.distanceBearingPoint( point3d48, Unit.ConvertDegToRad(double_0 - num30 * 90), metres * 2) point3d, num = MathHelper.smethod_193(point3d38, num12, point3d40, num13, point3d41, num14, False) point3d1, num1 = MathHelper.smethod_193(point3d41, num14, point3d42, num15, point3d43, num16, False) point3d2, num2 = MathHelper.smethod_193(point3d43, num16, point3d44, num17, point3d45, num18, False) point3d3, num3 = MathHelper.smethod_193(point3d47, num21, point3d50, num23, point3d51, num24, False) point3d4, num4 = MathHelper.smethod_193(point3d52, num25, point3d53, num26, point3d54, num28, False) point3d56 = MathHelper.distanceBearingPoint( point3d4, Unit.ConvertDegToRad(double_0 - num30 * 90), num4) point3d57 = MathHelper.distanceBearingPoint( point3d56, Unit.ConvertDegToRad(double_0 + num30 * 90), num29) point3d58 = MathHelper.distanceBearingPoint( point3d3, Unit.ConvertDegToRad(double_0 + 180), num3) point3d58 = MathHelper.getIntersectionPoint( point3d_0, MathHelper.distanceBearingPoint( point3d_0, Unit.ConvertDegToRad(double_0 + 180), 100), point3d58, MathHelper.distanceBearingPoint( point3d58, Unit.ConvertDegToRad(double_0 + 90), 100)) point3d59 = MathHelper.distanceBearingPoint( point3d4, Unit.ConvertDegToRad(double_0 + 180), num4) point3d59 = MathHelper.getIntersectionPoint( point3d_0, MathHelper.distanceBearingPoint( point3d_0, Unit.ConvertDegToRad(double_0 + 180), 100), point3d59, MathHelper.distanceBearingPoint( point3d59, Unit.ConvertDegToRad(double_0 + 90), 100)) point3d5 = MathHelper.distanceBearingPoint( point3d58, Unit.ConvertDegToRad(double_0), r1) if (MathHelper.calcDistance(point3d_0, point3d58) >= MathHelper.calcDistance(point3d_0, point3d59) ) else MathHelper.distanceBearingPoint( point3d59, Unit.ConvertDegToRad(double_0), r1) self.ptE = MathHelper.getIntersectionPoint( point3d5, MathHelper.distanceBearingPoint( point3d5, Unit.ConvertDegToRad(double_0 + 90), 100), point3d57, MathHelper.distanceBearingPoint(point3d57, Unit.ConvertDegToRad(double_0), 100)) self.nominal = PolylineArea() point3d56 = MathHelper.distanceBearingPoint( point3d_0, Unit.ConvertDegToRad(double_0 + num30 * 90), 2 * metres) point3d58 = MathHelper.distanceBearingPoint( point3d56, Unit.ConvertDegToRad(double_0 + 180), self.ds.Metres) point3d59 = MathHelper.distanceBearingPoint( point3d58, Unit.ConvertDegToRad(double_0 - num30 * 90), 2 * metres) self.nominal.Add( PolylineAreaPoint( point3d_0, MathHelper.smethod_59(Unit.ConvertDegToRad(double_0), point3d_0, point3d56))) self.nominal.method_1(point3d56) self.nominal.Add( PolylineAreaPoint( point3d58, MathHelper.smethod_59(Unit.ConvertDegToRad(double_0 + 180), point3d58, point3d59))) self.nominal.method_1(point3d59) self.nominal.method_1(point3d_0) self.wd = Distance(MathHelper.calcDistance(point3d_0, point3d58)) self.area = PolylineArea() point3dCollection = [] point3dCollection.append( MathHelper.distanceBearingPoint(point3d, Unit.ConvertDegToRad(double_0), num)) point3dCollection.append( MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(double_0), num1)) point3dCollection.append( MathHelper.distanceBearingPoint( point3d3, Unit.ConvertDegToRad(double_0 + num30 * 90), num3)) point3dCollection.append( MathHelper.distanceBearingPoint( point3d3, Unit.ConvertDegToRad(double_0 + 180), num3)) point3dCollection.append( MathHelper.distanceBearingPoint( point3d4, Unit.ConvertDegToRad(double_0 + 180), num4)) point3dCollection.append( MathHelper.distanceBearingPoint( point3d4, Unit.ConvertDegToRad(double_0 - num30 * 90), num4)) point3dCollection.append( MathHelper.distanceBearingPoint(point3d55, Unit.ConvertDegToRad(double_0), num27)) point3d7, point3d8 = MathHelper.smethod_91(point3d3, num3, point3d4, num4, turnDirection) point3d9, point3d10 = MathHelper.smethod_91(point3d4, num4, point3d55, num27, turnDirection) point3d11, point3d12 = MathHelper.smethod_91(point3d4, num4, point3d, num, turnDirection) point3d13, point3d14 = MathHelper.smethod_91(point3d4, num4, point3d1, num1, turnDirection) point3d15, point3d16 = MathHelper.smethod_91(point3d4, num4, point3d3, num3, turnDirection) point3d17, point3d18 = MathHelper.smethod_91(point3d55, num27, point3d, num, turnDirection) point3d19, point3d20 = MathHelper.smethod_91(point3d55, num27, point3d1, num1, turnDirection) point3d21, point3d22 = MathHelper.smethod_91(point3d55, num27, point3d3, num3, turnDirection) point3d23, point3d6 = MathHelper.smethod_91(point3d, num, point3d1, num1, turnDirection) point3d24, point3d25 = MathHelper.smethod_91(point3d1, num1, point3d46, num19, turnDirection) point3d26, point3d27 = MathHelper.smethod_91(point3d46, num19, point3d3, num3, turnDirection) point3d28, point3d29 = MathHelper.smethod_91(point3d43, num16, point3d48, num20, turnDirection1) point3d30, point3d31 = MathHelper.smethod_91(point3d48, num20, point3d49, num22, turnDirection1) if (num4 >= MathHelper.calcDistance(point3d4, point3d55) + num27): self.area.method_1(point3d7) self.area.method_3( point3d8, MathHelper.smethod_57(turnDirection, point3d8, point3d9, point3d4)) self.area.method_1(point3d9) if (num27 <= MathHelper.calcDistance(point3d55, point3d1) + num1): flag = False if (num27 < MathHelper.calcDistance(point3d55, point3d) + num): point3d39 = MathHelper.distanceBearingPoint( point3d18, MathHelper.getBearing(point3d17, point3d18) + 1.5707963267949 * num30, 100) flag = MathHelper.smethod_119( point3d23, point3d18, point3d39) if (turnDirection != TurnDirection.Right ) else MathHelper.smethod_115( point3d23, point3d18, point3d39) if (flag): self.area.Add( PolylineAreaPoint( point3d10, MathHelper.smethod_57(turnDirection, point3d10, point3d17, point3d55))) self.area.method_1(point3d17) self.area.method_3( point3d18, MathHelper.smethod_57(turnDirection, point3d18, point3d23, point3d)) self.area.method_3( point3d23, MathHelper.smethod_57(turnDirection, point3d23, point3d24, point3d1)) self.area.method_1(point3d24) else: self.area.Add( PolylineAreaPoint( point3d10, MathHelper.smethod_57(turnDirection, point3d10, point3d19, point3d55))) self.area.method_1(point3d19) self.area.Add( PolylineAreaPoint( point3d20, MathHelper.smethod_57(turnDirection, point3d20, point3d24, point3d1))) self.area.method_1(point3d24) self.area.method_3( point3d25, MathHelper.smethod_57(turnDirection, point3d25, point3d26, point3d46)) self.area.method_1(point3d26) self.area.method_3( point3d27, MathHelper.smethod_57(turnDirection, point3d27, point3d7, point3d3)) self.area.method_1(point3d7) else: self.area.method_3( point3d10, MathHelper.smethod_57(turnDirection, point3d10, point3d21, point3d55)) self.area.method_1(point3d21) self.area.method_3( point3d22, MathHelper.smethod_57(turnDirection, point3d22, point3d7, point3d3)) self.area.method_1(point3d7) elif (num4 <= MathHelper.calcDistance(point3d4, point3d1) + num1): flag1 = False if (num4 < MathHelper.calcDistance(point3d4, point3d) + num): point3d39 = MathHelper.distanceBearingPoint( point3d12, MathHelper.getBearing(point3d11, point3d12) + 1.5707963267949 * num30, 100) flag1 = MathHelper.smethod_119( point3d23, point3d12, point3d39) if (turnDirection != TurnDirection.Right ) else MathHelper.smethod_115( point3d23, point3d12, point3d39) if (flag1): self.area.method_1(point3d7) self.area.method_3( point3d8, MathHelper.smethod_57(turnDirection, point3d8, point3d11, point3d4)) self.area.method_1(point3d11) self.area.method_3( point3d12, MathHelper.smethod_57(turnDirection, point3d12, point3d23, point3d)) self.area.method_3( point3d23, MathHelper.smethod_57(turnDirection, point3d23, point3d24, point3d1)) self.area.method_1(point3d24) else: self.area.method_1(point3d7) self.area.method_3( point3d8, MathHelper.smethod_57(turnDirection, point3d8, point3d13, point3d4)) self.area.method_1(point3d13) self.area.method_3( point3d14, MathHelper.smethod_57(turnDirection, point3d14, point3d24, point3d1)) self.area.method_1(point3d24) self.area.method_3( point3d25, MathHelper.smethod_57(turnDirection, point3d25, point3d26, point3d46)) self.area.method_1(point3d26) self.area.method_3( point3d27, MathHelper.smethod_57(turnDirection, point3d27, point3d7, point3d3)) self.area.method_1(point3d7) else: self.area.method_1(point3d7) self.area.method_3( point3d8, MathHelper.smethod_57(turnDirection, point3d8, point3d15, point3d4)) self.area.method_1(point3d15) self.area.method_3( point3d16, MathHelper.smethod_57(turnDirection, point3d16, point3d7, point3d3)) self.area.method_1(point3d7) self.outboundLineTop = PolylineArea() self.outboundLineTop.method_1(point3d24) self.outboundLineTop.method_3( point3d25, MathHelper.smethod_57(turnDirection, point3d25, point3d26, point3d46)) # PolylineArea polylineArea = self.outboundLineTop; point3dArray = [point3d26, point3d27] self.outboundLineTop.method_7(point3dArray) self.outboundLineBottom = PolylineArea() self.outboundLineBottom.method_1(point3d28) self.outboundLineBottom.method_3( point3d29, MathHelper.smethod_57(turnDirection1, point3d29, point3d30, point3d48)) # PolylineArea polylineArea1 = self.outboundLineBottom; point3dArray = [point3d30, point3d31] self.outboundLineBottom.method_7(point3dArray) self.spiral = PolylineArea() if (MathHelper.calcDistance(point3d, point3d_0) <= num): point3d32_39 = [] MathHelper.smethod_34( point3d_0, MathHelper.distanceBearingPoint(point3d_0, Unit.ConvertDegToRad(double_0), 100), point3d, num, point3d32_39) point3d32 = point3d32_39[0] point3d39 = point3d32_39[1] point3d33 = MathHelper.distanceBearingPoint( point3d, MathHelper.getBearing(point3d, point3d38), num) self.spiral.Add( PolylineAreaPoint( point3d32, MathHelper.smethod_57(turnDirection, point3d32, point3d33, point3d))) else: point3d32, point3d33 = MathHelper.smethod_91( point3d_0, 0, point3d, num, turnDirection) self.spiral.method_1(point3d32) point3d34, point3d35 = MathHelper.smethod_91(point3d, num, point3d1, num1, turnDirection) self.spiral.Add( PolylineAreaPoint( point3d33, MathHelper.smethod_57(turnDirection, point3d33, point3d34, point3d))) point3d33 = point3d34 point3d34, point3d35 = MathHelper.smethod_91(point3d1, num1, point3d2, num2, turnDirection) self.spiral.Add( PolylineAreaPoint( point3d33, MathHelper.smethod_57(turnDirection, point3d33, point3d34, point3d1))) point3d33 = point3d34 point3d39 = MathHelper.distanceBearingPoint( point3d2, Unit.ConvertDegToRad(double_0 + 180), num2) self.spiral.Add( PolylineAreaPoint( point3d33, MathHelper.smethod_57(turnDirection, point3d33, point3d39, point3d2))) self.spiral.method_1(point3d39) self.method_0(point3dCollection) self.method_1( MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(double_0), num1), MathHelper.distanceBearingPoint( point3d2, Unit.ConvertDegToRad(double_0 + num30 * 90), num2), MathHelper.distanceBearingPoint( point3d2, Unit.ConvertDegToRad(double_0 + 180), num2)) point3d56 = MathHelper.distanceBearingPoint( point3d_0, Unit.ConvertDegToRad(double_0 + 180), 1000) point3d39 = MathHelper.getIntersectionPoint(point3d_0, point3d56, point3d7, point3d8) point3d6_58 = [] MathHelper.smethod_34(point3d_0, point3d56, point3d3, num3, point3d6_58) point3d6 = point3d6_58[0] point3d58 = point3d6_58[1] point3d6_59 = [] MathHelper.smethod_34(point3d_0, point3d56, point3d4, num4, point3d6_59) point3d6 = point3d6_59[0] point3d59 = point3d6_59[1] if (orientationType_0 == OrientationType.Right): if (not MathHelper.smethod_119(point3d39, point3d3, point3d7) or not MathHelper.smethod_115(point3d39, point3d4, point3d8)): self.ptC = point3d58 if (MathHelper.calcDistance( point3d_0, point3d58) > MathHelper.calcDistance( point3d_0, point3d59)) else point3d59 else: self.ptC = point3d39 elif (not MathHelper.smethod_115(point3d39, point3d3, point3d7) or not MathHelper.smethod_119(point3d39, point3d4, point3d8)): self.ptC = point3d58 if ( MathHelper.calcDistance(point3d_0, point3d58) > MathHelper.calcDistance(point3d_0, point3d59)) else point3d59 else: self.ptC = point3d39 num31 = MathHelper.calcDistance(self.ptC, point3d43) point3d60 = MathHelper.distanceBearingPoint( self.ptC, MathHelper.getBearing(self.ptC, point3d43) + math.asin(num16 / num31) * num30, math.sqrt(num31 * num31 - num16 * num16)) point3d6_58 = [] MathHelper.smethod_34(self.ptC, point3d60, point3d1, num1, point3d6_58) point3d6 = point3d6_58[0] point3d58 = point3d6_58[1] point3d6_59 = [] MathHelper.smethod_34(self.ptC, point3d60, point3d2, num2, point3d6_59) point3d6 = point3d6_59[0] point3d59 = point3d6_59[1] self.ptR = point3d58 if ( MathHelper.calcDistance(self.ptC, point3d58) > MathHelper.calcDistance(self.ptC, point3d59)) else point3d59
def btnConstruct_Click(self): flag = FlightPlanBaseDlg.btnConstruct_Click(self) if not flag: return if not self.method_27(): return holdingTemplate = HoldingTemplate( self.parametersPanel.pnlNavAid.Point3d, float(self.parametersPanel.txtTrack.Value), self.parametersPanel.txtIas.Value, self.parametersPanel.txtAltitude.Value, Speed(float(self.parametersPanel.pnlWind.speedBox.text())), float(self.parametersPanel.txtIsa.Value), float(self.parametersPanel.txtTime.Value), self.parametersPanel.cmbOrientation.SelectedItem) polylineArea2 = self.method_35() polylineAreaTemp = holdingTemplate.vmethod_0( polylineArea2, self.parametersPanel.chbIntercept.Checked, self.parametersPanel.chbSectors12.Checked) polylineArea3 = polylineAreaTemp[0] polyline = PolylineArea.smethod_131(holdingTemplate.Nominal) resultPolylineAreaList = [] if (self.parametersPanel.cmbConstruction.SelectedIndex == 0): constructionLayer = AcadHelper.createVectorLayer(self.surfaceType) resultPolylineAreaList.append(polylineArea3) resultPolylineAreaList.append( PolylineArea.smethod_136(polylineArea2, True)) if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1 or self.parametersPanel.chbCatH.Checked): for entity in HoldingTemplateBase.smethod_2( polylineArea3, Distance(2.5, DistanceUnits.NM) if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1) else Distance(2, DistanceUnits.NM)): resultPolylineAreaList.append(entity) else: for entity1 in HoldingTemplateBase.smethod_1( polylineArea3, True): resultPolylineAreaList.append(entity1) if self.parametersPanel.cmbOrientation.SelectedIndex == 0: polyline[0].bulge = -1 polyline[2].bulge = -1 else: polyline[0].bulge = 1 polyline[2].bulge = 1 resultPolylineAreaList.append(polyline) resultPolylineList = [] for polylineArea in resultPolylineAreaList: AcadHelper.setGeometryAndAttributesInLayer( constructionLayer, polylineArea, True) # point3dCollection = [] # for polylineAreaPoint in polylineArea: # # point3dCollection.append(polylineAreaPoint.Position) # resultPolylineList.append((point3dCollection, [])) # constructionLayer = QgisHelper.createPolylineLayer(self.surfaceType, resultPolylineList) QgisHelper.appendToCanvas(define._canvas, [constructionLayer], self.surfaceType, True) QgisHelper.zoomToLayers([constructionLayer]) self.resultLayerList = [constructionLayer] else: # polyline.set_Elevation(self.pnlAltitude.Value.Metres); # polyline.set_Thickness(-self.pnlMoc.Value.Metres); constructionLayer = AcadHelper.createVectorLayer( self.surfaceType, QGis.Polygon) # mapUnits = define._canvas.mapUnits() # constructionLayer = None # if define._mapCrs == None: # if mapUnits == QGis.Meters: # constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", self.surfaceType, "memory") # else: # constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", self.surfaceType, "memory") # else: # constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), self.surfaceType, "memory") # shpPath = "" # if define.obstaclePath != None: # shpPath = define.obstaclePath # elif define.xmlPath != None: # shpPath = define.xmlPath # else: # shpPath = define.appPath # er = QgsVectorFileWriter.writeAsVectorFormat(constructionLayer, shpPath + "/" + QString(self.surfaceType).replace(" ", "") + ".shp", "utf-8", constructionLayer.crs()) # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(self.surfaceType).replace(" ", "") + ".shp", self.surfaceType, "ogr") # # # constructionLayer.startEditing() geometryList = [] if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1): distance = Distance(2.5, DistanceUnits.NM) if ( self.parametersPanel.cmbUsedFor.SelectedIndex == 1) else Distance(2, DistanceUnits.NM) polylineArea, polylineArea1 = HoldingTemplateBase.smethod_4( polylineArea3, self.parametersPanel.txtAltitude.Value, self.parametersPanel.txtMoc.Value, distance) # point3dCollection = polylineArea.method_15(False) # point3dCollection1 = polylineArea1.method_15(False) geometryList = QgisHelper.smethod_146( polylineArea.method_15(True), polylineArea1.method_15(True)) else: geometryList = HoldingTemplateBase.smethod_3( polylineArea3, self.parametersPanel.txtAltitude.Value, self.parametersPanel.txtMoc.Value) # feature = QgsFeature() # feature.setGeometry(QgsGeometry.fromPolygon([polyline.method_14_closed()])) # constructionLayer.addFeature(feature) i = 0 for entity2 in geometryList: i += 1 AcadHelper.setGeometryAndAttributesInLayer( constructionLayer, PolylineArea(geometryList[len(geometryList) - i].asPolygon()[0])) # feature = QgsFeature() # feature.setGeometry(entity2) # constructionLayer.addFeature(feature) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, polyline, True) # constructionLayer.commitChanges() QgisHelper.appendToCanvas(define._canvas, [constructionLayer], self.surfaceType, True) QgisHelper.zoomToLayers([constructionLayer]) self.resultLayerList = [constructionLayer] self.ui.btnEvaluate.setEnabled(True) # AcadHelper.smethod_18(transaction, blockTableRecord, entity2, constructionLayer); pass
def btnConstruct2_Click(self): qgsLayerTreeView = define._mLayerTreeView groupName = self.surfaceType2 layerTreeModel = qgsLayerTreeView.layerTreeModel() layerTreeGroup = layerTreeModel.rootGroup() rowCount = layerTreeModel.rowCount() groupExisting = False if rowCount > 0: for i in range(rowCount): qgsLayerTreeNode = layerTreeModel.index2node(layerTreeModel.index(i, 0)) if qgsLayerTreeNode.nodeType() == 0: qgsLayerTreeNode._class_ = QgsLayerTreeGroup if isinstance(qgsLayerTreeNode, QgsLayerTreeGroup) and qgsLayerTreeNode.name() == groupName: groupExisting = True if groupExisting: if len(self.resultLayerList2) > 0: QgisHelper.removeFromCanvas(define._canvas, self.resultLayerList2) self.resultLayerList2 = [] else: QMessageBox.warning(self, "Warning", "Please remove \"" + self.surfaceType2 + "\" layer group from LayerTreeView.") return num = None; num1 = None; line = None; polyline = None; point3d = None; point3d1 = None; point3d2 = None; point3d3 = None; point3d4 = None; point3d5 = None; point3d6 = None; point3d7 = None; point3d8 = None; ficorResult = None; point = []; value = None; resultPolylineAreaList = [] # if (!AcadHelper.Ready) # { # return; # } # if (!self.method_27(true)) # { # return; # } # string constructionLayer = base.ConstructionLayer; point3d9 = self.parametersPanel.pnlTrackingPosition.Point3d; point3d10 = self.parametersPanel.pnlIntersectingPosition.Point3d; value1 = float(self.parametersPanel.txtTrackingRadialTrack.Value); value2 = float(self.parametersPanel.txtIntersectingRadialTrack.Value); num2 = Unit.ConvertDegToRad(value1); num3 = Unit.ConvertDegToRad(value2); if (self.parametersPanel.cmbTrackingType.currentIndex() != 0): num = Unit.ConvertDegToRad(2.4) if(self.parametersPanel.cmbTrackingType.currentIndex() != 1) else Unit.ConvertDegToRad(6.9); else: num = Unit.ConvertDegToRad(5.2); num1 = Unit.ConvertDegToRad(6.2) if(self.parametersPanel.cmbIntersectingType.currentIndex() != 0) else Unit.ConvertDegToRad(4.5); num4 = num2 + num; point3d11 = MathHelper.distanceBearingPoint(point3d9, num4, 100); num5 = num2 - num; point3d12 = MathHelper.distanceBearingPoint(point3d9, num5, 100); point3d13 = MathHelper.distanceBearingPoint(point3d9, num2, 100); point3d = MathHelper.getIntersectionPoint(point3d9, point3d13, point3d10, MathHelper.distanceBearingPoint(point3d10, num3, 100)) if (self.parametersPanel.cmbIntersectingType.currentIndex() >= 2): metres = Distance(float(self.parametersPanel.txtIntersectingDistance.text()), DistanceUnits.NM).Metres; if (self.parametersPanel.chb0dmeAtThr.isChecked()): value = Distance(float(self.parametersPanel.txtDmeOffset.text())); metres = metres + value.Metres; num6 = 460 + metres * 0.0125; num7 = metres + num6; num8 = metres - num6; if (MathHelper.smethod_102(point3d9, point3d10)): point3d14 = MathHelper.distanceBearingPoint(point3d9, num4, num8); point3d15 = MathHelper.distanceBearingPoint(point3d9, num2, num8); point3d16 = MathHelper.distanceBearingPoint(point3d9, num5, num8); point3d17 = MathHelper.distanceBearingPoint(point3d9, num5, num7); point3d18 = MathHelper.distanceBearingPoint(point3d9, num2, num7); point3d19 = MathHelper.distanceBearingPoint(point3d9, num4, num7); point = [point3d14, point3d16, point3d17, point3d19]; polyline = AcadHelper.smethod_126(point); polyline.SetBulgeAt(0, MathHelper.smethod_60(point3d14, point3d15, point3d16)); polyline.SetBulgeAt(2, MathHelper.smethod_60(point3d17, point3d18, point3d19)); polyline.set_Closed(True); resultPolylineAreaList.append(polyline) # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); point3d14 = MathHelper.distanceBearingPoint(point3d9, num2, num8); point3d15 = MathHelper.distanceBearingPoint(point3d9, num2, num7); resultPolylineAreaList.append(PolylineArea([point3d14, point3d15])) # line = new Line(point3d14, point3d15); # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer); point3d14 = MathHelper.distanceBearingPoint(point3d9, num4, metres); point3d15 = MathHelper.distanceBearingPoint(point3d9, num2, metres); point3d16 = MathHelper.distanceBearingPoint(point3d9, num5, metres); point = [point3d14, point3d16 ]; polyline = AcadHelper.smethod_126(point); polyline.SetBulgeAt(0, MathHelper.smethod_60(point3d14, point3d15, point3d16)); resultPolylineAreaList.append(polyline) # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); else: ficorResult1 = self.method_37(point3d10, num2, point3d9, point3d13, num8, FicorInput.C); ficorResult2 = self.method_37(point3d10, num2, point3d9, point3d13, metres, FicorInput.C); ficorResult3 = self.method_37(point3d10, num2, point3d9, point3d13, num7, FicorInput.C); if (ficorResult1.Status != FicorStatus.TWO and ficorResult2.Status != FicorStatus.TWO): if (ficorResult3.Status == FicorStatus.TWO): ficorResult = FicorResult(None, FicorStatus.TWO); else: ficorResult = FicorResult(None, ficorResult2.Status); else: ficorResult = FicorResult(None, FicorStatus.TWO); if (ficorResult.Status != FicorStatus.NID): ficorInput = FicorInput.F; num9 = 1; if (ficorResult.Status == FicorStatus.TWO): QMessageBox.warning(self,"Infomation", Messages.TWO_POSSIBLE_FIX_POSITIONS); ficorInput = FicorInput.L; num9 = 2; num10 = 0; while (num10 < num9): ficorResult4 = self.method_37(point3d10, num4, point3d9, point3d11, num8, ficorInput); ficorResult5 = self.method_37(point3d10, num2, point3d9, point3d13, num8, ficorInput); ficorResult6 = self.method_37(point3d10, num5, point3d9, point3d12, num8, ficorInput); ficorResult7 = self.method_37(point3d10, num4, point3d9, point3d11, metres, ficorInput); ficorResult8 = self.method_37(point3d10, num2, point3d9, point3d13, metres, ficorInput); ficorResult9 = self.method_37(point3d10, num5, point3d9, point3d12, metres, ficorInput); ficorResult10 = self.method_37(point3d10, num4, point3d9, point3d11, num7, ficorInput); ficorResult11 = self.method_37(point3d10, num2, point3d9, point3d13, num7, ficorInput); ficorResult12 = self.method_37(point3d10, num5, point3d9, point3d12, num7, ficorInput); if (ficorResult4.Status == FicorStatus.NID or ficorResult5.Status == FicorStatus.NID or ficorResult6.Status == FicorStatus.NID or ficorResult7.Status == FicorStatus.NID or ficorResult9.Status == FicorStatus.NID or ficorResult10.Status == FicorStatus.NID or ficorResult11.Status == FicorStatus.NID or ficorResult12.Status == FicorStatus.NID or ficorResult8.Status == FicorStatus.NID): eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY = Messages.ERR_FAILED_TO_CONSTRUCT_THE_FIX_AUTOMATICALLY; value = Distance(float(self.parametersPanel.txtIntersectingDistance.text()), DistanceUnits.NM); str000 = str(round(value.Metres, 4)) + "m" value = str(round(Distance(num6).Metres, 4)) + "m"; QMessageBox.warning(self,"Error", eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY %(str000, value)) # ErrorMessageBox.smethod_0(self, string.Format(eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY, str, value.method_0(":m"))); return; elif (MathHelper.calcDistance(point3d9, ficorResult8.Point) < MathHelper.calcDistance(ficorResult5.Point, ficorResult8.Point)): QMessageBox.warning(self, "Error", Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE) # ErrorMessageBox.smethod_0(self, Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE); return; else: point = [ficorResult4.Point, ficorResult6.Point, ficorResult12.Point, ficorResult10.Point]; polyline = AcadHelper.smethod_126(point); polyline.SetBulgeAt(0, MathHelper.smethod_60(ficorResult4.Point, ficorResult5.Point, ficorResult6.Point)); polyline.SetBulgeAt(2, MathHelper.smethod_60(ficorResult12.Point, ficorResult11.Point, ficorResult10.Point)); polyline.set_Closed(True); resultPolylineAreaList.append(polyline) # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); resultPolylineAreaList.append(PolylineArea([ficorResult5.Point, ficorResult11.Point])) # line = new Line(ficorResult5.Point, ficorResult11.Point); # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer); point = [ficorResult7.Point, ficorResult9.Point]; polyline = AcadHelper.smethod_126(point); polyline.SetBulgeAt(0, MathHelper.smethod_60(ficorResult7.Point, ficorResult8.Point, ficorResult9.Point)); resultPolylineAreaList.append(polyline) # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); if (ficorResult.Status == FicorStatus.TWO): ficorInput = FicorInput.S; num10 += 1; else: QMessageBox.warning(self, "Error", Messages.ERR_RADIAL_TRACK_DME_DISTANCE_DO_NOT_INTERSECT) # ErrorMessageBox.smethod_0(self, Messages.ERR_RADIAL_TRACK_DME_DISTANCE_DO_NOT_INTERSECT); return; elif (point3d == None): QMessageBox.warning(self, "Error", Messages.ERR_RADIALS_TRACKS_ARE_PARALLEL) # ErrorMessageBox.smethod_0(self, Messages.ERR_RADIALS_TRACKS_ARE_PARALLEL); return; elif (MathHelper.smethod_99(MathHelper.getBearing(point3d9, point3d), num2, 0.001)): point3d20 = MathHelper.distanceBearingPoint(point3d10, num3 + num1, 100); point3d21 = MathHelper.distanceBearingPoint(point3d10, num3 - num1, 100); point3d1 = MathHelper.getIntersectionPoint(point3d9, point3d12, point3d10, point3d20); point3d2 = MathHelper.getIntersectionPoint(point3d9, point3d12, point3d10, point3d21); point3d3 = MathHelper.getIntersectionPoint(point3d9, point3d11, point3d10, point3d21); point3d4 = MathHelper.getIntersectionPoint(point3d9, point3d11, point3d10, point3d20); point3d5 = MathHelper.getIntersectionPoint(point3d9, point3d, point3d10, point3d20); point3d6 = MathHelper.getIntersectionPoint(point3d9, point3d, point3d10, point3d21); point3d7 = MathHelper.getIntersectionPoint(point3d9, point3d11, point3d10, point3d); point3d8 = MathHelper.getIntersectionPoint(point3d9, point3d12, point3d10, point3d); if (MathHelper.calcDistance(point3d9, point3d) < MathHelper.calcDistance(point3d5, point3d) or MathHelper.calcDistance(point3d10, point3d) < MathHelper.calcDistance(point3d5, point3d) or MathHelper.calcDistance(point3d9, point3d) < MathHelper.calcDistance(point3d8, point3d) or MathHelper.calcDistance(point3d10, point3d) < MathHelper.calcDistance(point3d8, point3d)): QMessageBox.warning(self, "Error", Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE) # ErrorMessageBox.smethod_0(self, Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE); return; else: resultPolylineAreaList.append(PolylineArea([point3d5, point3d6])) # line = new Line(point3d5, point3d6); # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer); resultPolylineAreaList.append(PolylineArea([point3d7, point3d8])) # line = new Line(point3d7, point3d8); # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer); point = [point3d1, point3d2, point3d3, point3d4]; polyline = AcadHelper.smethod_126(point); polyline.set_Closed(True); resultPolylineAreaList.append(polyline) # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); else: QMessageBox.warning(self, "Error", Messages.ERR_RADIALS_TRACKS_DO_NOT_INTERSECT) # ErrorMessageBox.smethod_0(self, Messages.ERR_RADIALS_TRACKS_DO_NOT_INTERSECT); return; mapUnits = define._canvas.mapUnits() constructionLayer = AcadHelper.createVectorLayer(SurfaceTypes.FixConstruction, QGis.Line) for polylinrArea0 in resultPolylineAreaList: AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, polylinrArea0) QgisHelper.appendToCanvas(define._canvas, [constructionLayer], SurfaceTypes.FixConstruction, True) self.resultLayerList2 = [constructionLayer] QgisHelper.zoomToLayers(self.resultLayerList2)
def btnConstruct_Click(self): qgsLayerTreeView = define._mLayerTreeView groupName = self.surfaceType1 layerTreeModel = qgsLayerTreeView.layerTreeModel() layerTreeGroup = layerTreeModel.rootGroup() rowCount = layerTreeModel.rowCount() groupExisting = False if rowCount > 0: for i in range(rowCount): qgsLayerTreeNode = layerTreeModel.index2node(layerTreeModel.index(i, 0)) if qgsLayerTreeNode.nodeType() == 0: qgsLayerTreeNode._class_ = QgsLayerTreeGroup if isinstance(qgsLayerTreeNode, QgsLayerTreeGroup) and qgsLayerTreeNode.name() == groupName: groupExisting = True if groupExisting: if len(self.resultLayerList1) > 0: QgisHelper.removeFromCanvas(define._canvas, self.resultLayerList1) self.resultLayerList1 = [] else: QMessageBox.warning(self, "Warning", "Please remove \"" + self.surfaceType1 + "\" layer group from LayerTreeView.") return num = None; num1 = None; num2 = None; num3 = None; point3d = None; resultPolylineAreaList = [] # if (!AcadHelper.Ready) # { # return; # } # if (!self.method_27(true)) # { # return; # } # string constructionLayer = base.ConstructionLayer; point3d1 = self.parametersPanel.pnlNavAid.Point3d; value = float(self.parametersPanel.txtTrackRadial.Value); metres = Altitude(float(self.parametersPanel.txtAltitude.text()), AltitudeUnits.FT).Metres; z = metres - point3d1.get_Z(); if (self.parametersPanel.cmbNavAidType.currentIndex() != 0): num = 450 - value + 90; num1 = 15; num2 = 25; num3 = z * 0.839099631; else: num = 450 - value + 90; num1 = 5; num2 = 15; num3 = z * 1.191753593; num4 = Unit.ConvertDegToRad(num1); num5 = Unit.ConvertDegToRad(360 - num1); num6 = Unit.ConvertDegToRad(180 - num2); num7 = Unit.ConvertDegToRad(180 + num2); num8 = 0; num9 = Unit.ConvertDegToRad(180); point3d2 = MathHelper.distanceBearingPoint(point3d1, num4, num3); point3d3 = MathHelper.distanceBearingPoint(point3d1, num5, num3); point3d = MathHelper.smethod_68(point3d2, MathHelper.distanceBearingPoint(point3d1, num8, num3), point3d3) if (point3d == None): QMessageBox.warning(self, "Error", Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT) return # throw new Exception(Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT); num10 = MathHelper.smethod_55(point3d2, point3d3, MathHelper.calcDistance(point3d2, point3d)); point3d2 = MathHelper.distanceBearingPoint(point3d1, num6, num3); point3d3 = MathHelper.distanceBearingPoint(point3d1, num7, num3); point3d = MathHelper.smethod_68(point3d2, MathHelper.distanceBearingPoint(point3d1, num9, num3), point3d3) if (point3d == None): QMessageBox.warning(self, "Error", Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT) # throw new Exception(Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT); num11 = MathHelper.smethod_55(point3d2, point3d3, MathHelper.calcDistance(point3d2, point3d)); matrix3d = Matrix3d.Rotation(Unit.ConvertDegToRad(num), Vector3d(0, 0, 1), point3d1); point3d2 = MathHelper.distanceBearingPoint(point3d1, num8, num3); point3d3 = MathHelper.distanceBearingPoint(point3d1, num9, num3); line = PolylineArea([point3d2, point3d3]); resultPolylineAreaList.append(self.TransformBy(line, Unit.ConvertDegToRad(value), self.parametersPanel.pnlNavAid.Point3d))#.TransformBy(matrix3d)) point3d2 = MathHelper.distanceBearingPoint(point3d1, num6, num3); point3d3 = MathHelper.distanceBearingPoint(point3d1, num4, num3); point3d4 = MathHelper.distanceBearingPoint(point3d1, num5, num3); point3d5 = MathHelper.distanceBearingPoint(point3d1, num7, num3); point3dArray = [point3d2, point3d3, point3d4, point3d5, point3d2]; polyline = AcadHelper.smethod_126(point3dArray); if self.parametersPanel.cmbNavAidType.currentIndex() == 0: num10 = 0.0436609429083 num11 = 0.131652497586 else: num10 = 0.131652497586 num11 = 0.221694662642 polyline.SetBulgeAt(1, num10); polyline.SetBulgeAt(3, num11); # polyline.set_Elevation(point3d1.get_Z()); resultPolylineAreaList.append(self.TransformBy(polyline, Unit.ConvertDegToRad(value), self.parametersPanel.pnlNavAid.Point3d))#polyline.TransformBy(matrix3d)) # polyline.TransformBy(matrix3d); # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer); # transaction.Commit(); # AcadHelper.smethod_5(); mapUnits = define._canvas.mapUnits() constructionLayer = AcadHelper.createVectorLayer(SurfaceTypes.OverheadTolerance, QGis.Line) for polylinrArea0 in resultPolylineAreaList: AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, polylinrArea0) QgisHelper.appendToCanvas(define._canvas, [constructionLayer], SurfaceTypes.OverheadTolerance, True) self.resultLayerList1 = [constructionLayer] QgisHelper.zoomToLayers(self.resultLayerList1)