Ejemplo n.º 1
0
    def method_36_Construct(self, bool_0):
        polylines = []
        point3d5 = self.parametersPanel.pnlWaypoint.Point3d
        value = float(self.parametersPanel.txtTrack.Value)
        value1 = float(self.parametersPanel.txtRnpValue.text())
        speed = Speed(float(self.parametersPanel.txtIas.text()))
        altitude = Altitude(float(self.parametersPanel.txtAltitude.text()),
                            AltitudeUnits.FT)
        num1 = float(self.parametersPanel.txtIsa.text())
        value2 = float(self.parametersPanel.txtTime.text())
        speed1 = Speed(float(self.parametersPanel.pnlWind.speedBox.text()))
        num = 15 if (altitude.Feet >= 24500) else 23
        speed2 = Speed.smethod_0(speed, num1, altitude)
        metresPerSecond = value2 * 60 * speed2.MetresPerSecond
        num2 = math.pow(speed2.Knots + speed1.Knots, 2) / (
            34313 * math.tan(Unit.ConvertDegToRad(num))) * 1852
        num3 = value1 * 1852
        num4 = num2 * (1 - math.sin(Unit.ConvertDegToRad(20))) / (
            2 * math.cos(Unit.ConvertDegToRad(20)))
        num5 = value1 * 1852 + 3704
        if (num5 < 9260):
            num5 = 9260
        point3d4 = MathHelper.distanceBearingPoint(
            point3d5, Unit.ConvertDegToRad(value + 90), num2 /
            2) if (self.parametersPanel.cmbOrientation.currentText() !=
                   OrientationType.Left) else MathHelper.distanceBearingPoint(
                       point3d5, Unit.ConvertDegToRad(value - 90), num2 / 2)
        point3d6 = MathHelper.distanceBearingPoint(point3d4,
                                                   Unit.ConvertDegToRad(value),
                                                   num4)
        point3d7 = MathHelper.distanceBearingPoint(
            point3d4, Unit.ConvertDegToRad(value + 180), metresPerSecond)
        num6 = num2 / 2 + 1.414 * num3
        num7 = num2 / 2 + num3
        point3d8 = MathHelper.distanceBearingPoint(point3d6,
                                                   Unit.ConvertDegToRad(value),
                                                   num6)
        point3d9 = MathHelper.distanceBearingPoint(
            point3d6,
            Unit.ConvertDegToRad(value + 90) - math.acos(num7 / num6), num6)
        point3d10 = MathHelper.distanceBearingPoint(
            point3d7,
            Unit.ConvertDegToRad(value + 90) + math.acos(num7 / num6), num6)
        point3d11 = MathHelper.distanceBearingPoint(
            point3d7, Unit.ConvertDegToRad(value + 180), num6)
        point3d12 = MathHelper.distanceBearingPoint(
            point3d7,
            Unit.ConvertDegToRad(value - 90) - math.acos(num7 / num6), num6)
        point3d13 = MathHelper.distanceBearingPoint(
            point3d6,
            Unit.ConvertDegToRad(value - 90) + math.acos(num7 / num6), num6)
        point3d = MathHelper.getIntersectionPoint(
            point3d9,
            MathHelper.distanceBearingPoint(
                point3d9,
                MathHelper.getBearing(point3d6, point3d9) -
                Unit.ConvertDegToRad(90), 100), point3d8,
            MathHelper.distanceBearingPoint(point3d8,
                                            Unit.ConvertDegToRad(value + 90),
                                            100))
        point3d1 = MathHelper.getIntersectionPoint(
            point3d10,
            MathHelper.distanceBearingPoint(
                point3d10,
                MathHelper.getBearing(point3d7, point3d10) +
                Unit.ConvertDegToRad(90), 100), point3d11,
            MathHelper.distanceBearingPoint(point3d11,
                                            Unit.ConvertDegToRad(value + 90),
                                            100))
        point3d2 = MathHelper.getIntersectionPoint(
            point3d12,
            MathHelper.distanceBearingPoint(
                point3d12,
                MathHelper.getBearing(point3d7, point3d12) -
                Unit.ConvertDegToRad(90), 100), point3d11,
            MathHelper.distanceBearingPoint(point3d11,
                                            Unit.ConvertDegToRad(value - 90),
                                            100))
        point3d3 = MathHelper.getIntersectionPoint(
            point3d13,
            MathHelper.distanceBearingPoint(
                point3d13,
                MathHelper.getBearing(point3d6, point3d13) +
                Unit.ConvertDegToRad(90), 100), point3d8,
            MathHelper.distanceBearingPoint(point3d8,
                                            Unit.ConvertDegToRad(value - 90),
                                            100))
        polylines1 = []
        polylineArea = None
        if (bool_0):
            num8 = num2 / 2
            point3d14 = MathHelper.distanceBearingPoint(
                point3d4, Unit.ConvertDegToRad(value + 90), num8)
            point3d15 = MathHelper.distanceBearingPoint(
                point3d7, Unit.ConvertDegToRad(value + 90), num8)
            point3d16 = MathHelper.distanceBearingPoint(
                point3d7, Unit.ConvertDegToRad(value - 90), num8)
            point3d17 = MathHelper.distanceBearingPoint(
                point3d4, Unit.ConvertDegToRad(value - 90), num8)
            point3dArray = [point3d14, point3d15, point3d16, point3d17]
            polylineArea = PolylineArea(point3dArray)
            polylineArea.method_19(
                1, -1
            )  #MathHelper.smethod_57(TurnDirection.Right, point3d15, point3d16, point3d7))
            polylineArea.method_19(
                3, -1
            )  #MathHelper.smethod_57(TurnDirection.Right, point3d17, point3d14, point3d4))
            polylines1.append(polylineArea)
        point3dArray1 = [point3d9, point3d10, point3d12, point3d13]
        polylineArea1 = PolylineArea(point3dArray1)
        #         for point3d0 in point3dArray1:
        #             polyline1.Add(point3d0)
        polylineArea1.method_19(
            1,
            MathHelper.smethod_57(TurnDirection.Right, point3d10, point3d12,
                                  point3d7))
        polylineArea1.method_19(
            3,
            MathHelper.smethod_57(TurnDirection.Right, point3d13, point3d9,
                                  point3d6))
        #         polylineArea1.set_closed(True)
        #         polyline1.SetDatabaseDefaults();
        polylines1.append(polylineArea1)

        polylineAreaLineList = [
            PolylineArea(
                [polylineArea1[0].Position, polylineArea1[1].Position]),
            PolylineArea(
                [polylineArea1[2].Position, polylineArea1[3].Position])
        ]
        polylineAreaArc0 = PolylineArea()
        polylineAreaArc0.Add(polylineArea1[1])
        polylineAreaArc0.Add(PolylineAreaPoint(polylineArea1[2].Position))
        polylineAreaArc1 = PolylineArea()
        polylineAreaArc1.Add(polylineArea1[3])
        polylineAreaArc1.Add(PolylineAreaPoint(polylineArea1[0].Position))
        polylineAreaArcList = [polylineAreaArc0, polylineAreaArc1]
        num9 = num5 / 5
        polylineAreaArcListResult = []
        polylineAreaLineListResult = []
        for i in range(1, 6):
            polylineAreaL0 = polylineAreaLineList[0].getOffsetCurveNo(
                num9 * i, 4)
            polylineAreaLineListResult.append(polylineAreaL0)

            polylineAreaA0 = polylineAreaArcList[0].getOffsetCurveNo(
                num9 * i, 4)
            polylineAreaT = PolylineArea()
            polylineAreaT.Add(
                PolylineAreaPoint(
                    polylineAreaA0[0].Position,
                    MathHelper.smethod_60(
                        polylineAreaA0[0].Position,
                        polylineAreaA0[int(len(polylineAreaA0) / 2)].Position,
                        polylineAreaA0[len(polylineAreaA0) - 1].Position)))
            polylineAreaT.Add(
                PolylineAreaPoint(polylineAreaA0[len(polylineAreaA0) -
                                                 1].Position))
            polylineAreaArcListResult.append(polylineAreaT)

            polylineAreaL1 = polylineAreaLineList[1].getOffsetCurveNo(
                num9 * i, 4)
            polylineAreaLineListResult.append(polylineAreaL1)

            polylineAreaA1 = polylineAreaArcList[1].getOffsetCurveNo(
                num9 * i, 4)
            polylineAreaT = PolylineArea()
            polylineAreaT.Add(
                PolylineAreaPoint(
                    polylineAreaA1[0].Position,
                    MathHelper.smethod_60(
                        polylineAreaA1[0].Position,
                        polylineAreaA1[int(len(polylineAreaA1) / 2)].Position,
                        polylineAreaA1[len(polylineAreaA1) - 1].Position)))
            polylineAreaT.Add(
                PolylineAreaPoint(polylineAreaA1[len(polylineAreaA1) -
                                                 1].Position))
            polylineAreaArcListResult.append(polylineAreaT)

            polylineAreaLineListResult.append(
                PolylineArea([
                    polylineAreaL0[len(polylineAreaL0) - 1].Position,
                    polylineAreaA0[0].Position
                ]))
            polylineAreaLineListResult.append(
                PolylineArea([
                    polylineAreaA0[len(polylineAreaA0) - 1].Position,
                    polylineAreaL1[0].Position
                ]))
            polylineAreaLineListResult.append(
                PolylineArea([
                    polylineAreaL1[len(polylineAreaL1) - 1].Position,
                    polylineAreaA1[0].Position
                ]))
            polylineAreaLineListResult.append(
                PolylineArea([
                    polylineAreaA1[len(polylineAreaA1) - 1].Position,
                    polylineAreaL0[0].Position
                ]))

        return polylineAreaLineListResult, polylineAreaArcListResult, polylineArea
    def method_36(self, bool_0):
        #         Point3d point3d;
        #         Point3d point3d1;
        #         Point3d point3d2;
        #         Point3d point3d3;
        #         Point3d point3d4;
        #         double num;
        polylines = []
        point3d5 = self.parametersPanel.pnlWaypoint.Point3d
        value = float(self.parametersPanel.txtTrack.text())
        value1 = float(self.parametersPanel.txtRnpValue.text())
        speed = Speed(float(self.parametersPanel.txtIas.text()))
        altitude = Altitude(float(self.parametersPanel.txtAltitude.text()),
                            AltitudeUnits.FT)
        num1 = float(self.parametersPanel.txtIsa.text())
        value2 = float(self.parametersPanel.txtTime.text())
        speed1 = Speed(float(self.parametersPanel.pnlWind.speedBox.text()))
        num = 15 if (altitude.Feet >= 24500) else 23
        speed2 = Speed.smethod_0(speed, num1, altitude)
        metresPerSecond = value2 * 60 * speed2.MetresPerSecond
        num2 = math.pow(speed2.Knots + speed1.Knots, 2) / (
            34313 * math.tan(Unit.ConvertDegToRad(num))) * 1852
        num3 = value1 * 1852
        num4 = num2 * (1 - math.sin(Unit.ConvertDegToRad(20))) / (
            2 * math.cos(Unit.ConvertDegToRad(20)))
        num5 = value1 * 1852 + 3704
        if (num5 < 9260):
            num5 = 9260
        point3d4 = MathHelper.distanceBearingPoint(
            point3d5, Unit.ConvertDegToRad(value + 90), num2 /
            2) if (self.parametersPanel.cmbOrientation.currentText() !=
                   OrientationType.Left) else MathHelper.distanceBearingPoint(
                       point3d5, Unit.ConvertDegToRad(value - 90), num2 / 2)
        point3d6 = MathHelper.distanceBearingPoint(point3d4,
                                                   Unit.ConvertDegToRad(value),
                                                   num4)
        point3d7 = MathHelper.distanceBearingPoint(
            point3d4, Unit.ConvertDegToRad(value + 180), metresPerSecond)
        num6 = num2 / 2 + 1.414 * num3
        num7 = num2 / 2 + num3
        point3d8 = MathHelper.distanceBearingPoint(point3d6,
                                                   Unit.ConvertDegToRad(value),
                                                   num6)
        point3d9 = MathHelper.distanceBearingPoint(
            point3d6,
            Unit.ConvertDegToRad(value + 90) - math.acos(num7 / num6), num6)
        point3d10 = MathHelper.distanceBearingPoint(
            point3d7,
            Unit.ConvertDegToRad(value + 90) + math.acos(num7 / num6), num6)
        point3d11 = MathHelper.distanceBearingPoint(
            point3d7, Unit.ConvertDegToRad(value + 180), num6)
        point3d12 = MathHelper.distanceBearingPoint(
            point3d7,
            Unit.ConvertDegToRad(value - 90) - math.acos(num7 / num6), num6)
        point3d13 = MathHelper.distanceBearingPoint(
            point3d6,
            Unit.ConvertDegToRad(value - 90) + math.acos(num7 / num6), num6)
        point3d = MathHelper.getIntersectionPoint(
            point3d9,
            MathHelper.distanceBearingPoint(
                point3d9,
                MathHelper.getBearing(point3d6, point3d9) -
                Unit.ConvertDegToRad(90), 100), point3d8,
            MathHelper.distanceBearingPoint(point3d8,
                                            Unit.ConvertDegToRad(value + 90),
                                            100))
        point3d1 = MathHelper.getIntersectionPoint(
            point3d10,
            MathHelper.distanceBearingPoint(
                point3d10,
                MathHelper.getBearing(point3d7, point3d10) +
                Unit.ConvertDegToRad(90), 100), point3d11,
            MathHelper.distanceBearingPoint(point3d11,
                                            Unit.ConvertDegToRad(value + 90),
                                            100))
        point3d2 = MathHelper.getIntersectionPoint(
            point3d12,
            MathHelper.distanceBearingPoint(
                point3d12,
                MathHelper.getBearing(point3d7, point3d12) -
                Unit.ConvertDegToRad(90), 100), point3d11,
            MathHelper.distanceBearingPoint(point3d11,
                                            Unit.ConvertDegToRad(value - 90),
                                            100))
        point3d3 = MathHelper.getIntersectionPoint(
            point3d13,
            MathHelper.distanceBearingPoint(
                point3d13,
                MathHelper.getBearing(point3d6, point3d13) +
                Unit.ConvertDegToRad(90), 100), point3d8,
            MathHelper.distanceBearingPoint(point3d8,
                                            Unit.ConvertDegToRad(value - 90),
                                            100))
        polylines1 = []
        if (bool_0):
            num8 = num2 / 2
            point3d14 = MathHelper.distanceBearingPoint(
                point3d4, Unit.ConvertDegToRad(value + 90), num8)
            point3d15 = MathHelper.distanceBearingPoint(
                point3d7, Unit.ConvertDegToRad(value + 90), num8)
            point3d16 = MathHelper.distanceBearingPoint(
                point3d7, Unit.ConvertDegToRad(value - 90), num8)
            point3d17 = MathHelper.distanceBearingPoint(
                point3d4, Unit.ConvertDegToRad(value - 90), num8)
            point3dArray = [point3d14, point3d15, point3d16, point3d17]
            polylineArea = PolylineArea(point3dArray)
            #             for point3d0 in point3dArray:
            #                 polyline.Add(point3d0)
            polylineArea.method_19(
                1,
                MathHelper.smethod_57(TurnDirection.Right, point3d15,
                                      point3d16, point3d7))
            polylineArea.method_19(
                3,
                MathHelper.smethod_57(TurnDirection.Right, point3d17,
                                      point3d14, point3d4))
            #             polyline.set_closed(True)
            #             polyline.SetDatabaseDefaults()
            polylines1.append(polylineArea)
        point3dArray1 = [point3d9, point3d10, point3d12, point3d13]
        polylineArea1 = PolylineArea(point3dArray1)
        #         for point3d0 in point3dArray1:
        #             polyline1.Add(point3d0)
        polylineArea1.method_19(
            1,
            MathHelper.smethod_57(TurnDirection.Right, point3d10, point3d12,
                                  point3d7))
        polylineArea1.method_19(
            3,
            MathHelper.smethod_57(TurnDirection.Right, point3d13, point3d9,
                                  point3d6))
        #         polylineArea1.set_closed(True)
        #         polyline1.SetDatabaseDefaults();
        polylines1.append(polylineArea1)
        num9 = num5 / 5
        for i in range(1, 6):
            polylineArea0 = polylineArea1.getOffsetCurve(num9 * i)
            polylines1.append(polylineArea0)


#         try:
#             OffsetGapType offsetType = AcadHelper.OffsetType;
#             try
#             {
#                 AcadHelper.OffsetType = OffsetGapType.Extend;
#         num9 = num5 / 5
#         for i in range(4):
#             n = i + 1
#         point3dCollection = polyline1.GetOffsetCurves(5)
#         polyline0 = Polyline()
#         for point3d0 in point3dCollection:
#             polyline0.Add(point3d0)
#         polylines1.append(polyline0)
#         polylines = polylines1
#             }
#             finally
#             {
#                 AcadHelper.OffsetType = offsetType;
#             }
#         }
#         catch
#         {
#             foreach (Polyline polyline2 in polylines1)
#             {
#                 if (polyline2 == null)
#                 {
#                     continue;
#                 }
#                 polyline2.Dispose();
#             }
#             throw;
#         }
        return polylines1