def putAircraftSpeed(self): speedTas = self.parametersPanel.pnlTas.Value if self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.H: xDist = self.calcDAndXDistance(speedTas, Speed(10), 5) self.parametersPanel.pnlDistX.Caption = "X(10kts/5s)" self.parametersPanel.pnlDistX.Value = Distance(xDist) else: xDist = self.calcDAndXDistance(speedTas, Speed(10), 15) self.parametersPanel.pnlDistX.Caption = "X(10kts/15s)" self.parametersPanel.pnlDistX.Value = Distance(xDist) if self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.A: self.parametersPanel.pnlIas.Value = Speed(100) # self.parametersPanel.pnlIas.Value = Speed(90) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.B: self.parametersPanel.pnlIas.Value = Speed(130) # self.parametersPanel.pnlIas.Value = Speed(120) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.C: self.parametersPanel.pnlIas.Value = Speed(160) # self.parametersPanel.pnlIas.Value = Speed(140) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.D: self.parametersPanel.pnlIas.Value = Speed(185) # self.parametersPanel.pnlIas.Value = Speed(165) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.E: self.parametersPanel.pnlIas.Value = Speed(230) # self.parametersPanel.pnlIas.Value = Speed(210) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.Custom: # self.parametersPanel.pnlIas.Value = self.customIas self.parametersPanel.pnlIas.Value = Speed(185) elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.H: # self.parametersPanel.pnlIas.Value = self.customIas self.parametersPanel.pnlIas.Value = Speed(90) self.parametersPanel.pnlIas.Enabled = self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.Custom
def getDistanceFromWaypointToLatestTurningPoint( rnavWaypointType_0, speedTas, speedWind, valuePilotTime, valueBankEstTime, att, turnRadiusDist, turnAngle, angleUnits_0): ### This methos is the method which calculate "Latest turning point". ### Parameters ### angleUnits_0 : type of turnAngle(Degree or Radian). ### att, turnRadiusDist : Distance class ### valuePilotTime, valueBankEstTime : float type ### speedTas, speedWind : Speed class if (rnavWaypointType_0 != RnavWaypointType.FlyBy): if (rnavWaypointType_0 != RnavWaypointType.FlyOver): raise UserWarning, "RNAV WayPoint type not SUPPORTED" double0 = valuePilotTime + valueBankEstTime num = double0 * (speedTas.MetresPerSecond + speedWind.MetresPerSecond) return Distance(-(att.Metres + num)) double_2 = 0.0 if (angleUnits_0 == AngleUnits.Degrees): double_2 = Unit.ConvertDegToRad(turnAngle) num1 = min([ turnRadiusDist.Metres * math.tan(double_2 / 2), turnRadiusDist.Metres ]) double01 = valuePilotTime * (speedTas.MetresPerSecond + speedWind.MetresPerSecond) return Distance(num1 - att.Metres - double01)
def __init__(self, parent): FlightPlanBaseSimpleDlg.__init__(self, parent) self.setObjectName("DmeToleranceDlg") self.surfaceType = SurfaceTypes.DmeTolerance self.dmeTolerance = Distance.NaN() self.slantTolerance = Distance.NaN() self.pilotDistance = Distance.NaN() self.groundDistance = Distance.NaN() self.initParametersPan() self.setWindowTitle("DME Tolerance and Slant Range") self.method_29() self.method_28() self.resize(550, 550) QgisHelper.matchingDialogSize(self, 550, 600) self.vorDmeFeatureArray = [] self.currentLayer = define._canvas.currentLayer() self.resultLayerList = [] # self.rwyFeatureArray = [] # self.thrPoint3d = None # self.thrEndPoint3d = None self.initBasedOnCmb()
def putDistances(self): try: point3dThr = self.parametersPanel.pnlThrPosition.Point3d point3dFaf = self.parametersPanel.pnlFapPosition.Point3d point3dThr = self.parametersPanel.pnlThrPosition.Point3d # point3dFaf = self.parametersPanel.pnlFapPosition.Point3d inboundTrackRad = MathHelper.smethod_4( self.parametersPanel.pnlInboundTrack.Value ) #MathHelper.getBearing(point3dFaf, point3dThr) inboundTrack180Rad = MathHelper.smethod_4(inboundTrackRad + math.pi) estimatedAltitdeMeters = self.parametersPanel.pnlEstimatedAltitude.Value.Metres thrAltitudeMeters = self.parametersPanel.pnlThrPosition.Altitude( ).Metres heightLossAltitudeMeters = self.parametersPanel.pnlHeightLoss.Value.Metres rdhAltitudeMeters = self.parametersPanel.pnlRDH.Value.Metres vpa = Unit.ConvertDegToRad(self.getVPA()) xz = self.parametersPanel.pnlDistXz.Value.Metres socThrDistMeters = ( (estimatedAltitdeMeters - thrAltitudeMeters - heightLossAltitudeMeters) / math.tan(vpa)) + xz daThrDistMeters = (estimatedAltitdeMeters - thrAltitudeMeters - rdhAltitudeMeters) / math.tan(vpa) self.parametersPanel.pnlDistOfDaThr.Value = Distance( daThrDistMeters ) #MathHelper.calcDistance(point3dThr, self.daPoint3d)) self.parametersPanel.pnlDistOfSocThr.Value = Distance( socThrDistMeters ) #MathHelper.calcDistance(point3dThr, self.socPoint3d)) self.parametersPanel.pnlDistOfFafDA.Value = Distance( MathHelper.calcDistance(point3dFaf, self.daPoint3d)) except: pass
def chbAdCodeF_Click(self): if (self.sender() == self.parametersPanel.cmbRwyCode and self.parametersPanel.cmbApproachType.SelectedIndex == 0): if (self.parametersPanel.cmbRwyCode.SelectedIndex != 0): self.parametersPanel.txtStripWidth.Value = Distance(300) else: self.parametersPanel.txtStripWidth.Value = Distance(150) self.method_31() self.method_29()
def smethod_0(iwin32Window_0): num = 0 str0 = "" navigationalAidList = NavigationalAidList() NavigationalAidList.NavigationalAidList() navigationalAidList.append(OmnidirectionalNavigationalAid("DME N", AngleGradientSlope(1), Distance(3000), Distance(300), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("VOR", AngleGradientSlope(1), Distance(3000), Distance(600), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("Directional Finder (DF)", AngleGradientSlope(1), Distance(3000), Distance(500), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("Markers", AngleGradientSlope(20), Distance(200), Distance(50), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("NDB", AngleGradientSlope(5), Distance(1000), Distance(200), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("GBAS ground reference receiver", AngleGradientSlope(3), Distance(3000), Distance(400), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("GBAS VDB station", AngleGradientSlope(0.9), Distance(3000), Distance(300), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("SBAS ground monitoring station", AngleGradientSlope(3), Distance(3000), Distance(400), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("VHF (Communication Tx)", AngleGradientSlope(1), Distance(2000), Distance(300), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("VHF (Communication Rx)", AngleGradientSlope(1), Distance(2000), Distance(300), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("PSR", AngleGradientSlope(0.25), Distance(15000), Distance(500), True)) navigationalAidList.append(OmnidirectionalNavigationalAid("SSR", AngleGradientSlope(0.25), Distance(15000), Distance(500), True)) navigationalAidList.append(DirectionalNavigationalAid("ILS LOC (single freq.)", Distance.NaN(), Distance(500), Altitude(70), Distance(6000), Distance(500), Altitude(10), Distance(2300), AngleGradientSlope(30), True)) navigationalAidList.append(DirectionalNavigationalAid("ILS LOC (dual freq.)", Distance.NaN(), Distance(500), Altitude(70), Distance(6000), Distance(500), Altitude(20), Distance(1500), AngleGradientSlope(20), True)) navigationalAidList.append(DirectionalNavigationalAid("ILS GP M-Type (dual freq.)", Distance(800), Distance(50), Altitude(70), Distance(6000), Distance(250), Altitude(5), Distance(325), AngleGradientSlope(10), True)) navigationalAidList.append(DirectionalNavigationalAid("MLS AZ", Distance.NaN(), Distance(20), Altitude(70), Distance(6000), Distance(600), Altitude(20), Distance(1500), AngleGradientSlope(40), True)) navigationalAidList.append(DirectionalNavigationalAid("MLS EL", Distance(300), Distance(20), Altitude(70), Distance(6000), Distance(200), Altitude(20), Distance(1500), AngleGradientSlope(40), True)) navigationalAidList.append(DirectionalNavigationalAid("DME (directional antennas)", Distance.NaN(), Distance(20), Altitude(70), Distance(6000), Distance(600), Altitude(20), Distance(1500), AngleGradientSlope(40), True)) try: if (QFile.exists(NavigationalAidList.fileName)): xmlFile = XmlFile(NavigationalAidList.fileName, "NavigationalAids", False) xmlNodeLists = xmlFile.elementsByTagName("NavigationalAid") if (xmlNodeLists != None): count = xmlNodeLists.count() for i in range(count): xmlElement = xmlNodeLists.item(i) # foreach (XmlElement xmlElement in xmlNodeLists) result1, num = xmlFile.method_7(xmlElement, "Type") result2, str0 = xmlFile.method_7(xmlElement, "Name") if (not result1 or not result2): continue for case in switch(num): if case(NavigationalAidType.Omnidirectional): navigationalAidList.Add(OmnidirectionalNavigationalAid(None, xmlFile, xmlElement, str0)) continue elif case(NavigationalAidType.Directional): navigationalAidList.Add(DirectionalNavigationalAid(None, xmlFile, xmlElement, str0)) continue elif case(NavigationalAidType.LineOfSight): navigationalAidList.Add(LineOfSight(None, xmlFile, xmlElement, str0)) continue else: continue except: # Exception exception = exception1 QMessageBox.warning(iwin32Window_0, "Error", Messages.ERR_FAILED_TO_LOAD_NAVAID_DATA_FILE) # ErrorMessageBox.smethod_0(iwin32Window_0, string.Format(Messages.ERR_FAILED_TO_LOAD_NAVAID_DATA_FILE, exception.Message)) navigationalAidList.method_1() return navigationalAidList
def method_5(self, bool_0, string_0, string_1): position = Position() stringBuilder = StringBuilder() string_1 = QString(string_1) str0 = "qa:{0}".format(string_1.length()) sAFETYAREAWIDTH = Captions.SAFETY_AREA_WIDTH distance = Distance(self.safetyAreaWidth) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREAWIDTH, distance.method_0("0.##:m"))) sAFETYAREALENGTHSTART = Captions.SAFETY_AREA_LENGTH_START distance1 = Distance(self.safetyAreaStart) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHSTART, distance1.method_0("0.##:m"))) sAFETYAREALENGTHEND = Captions.SAFETY_AREA_LENGTH_END distance2 = Distance(self.safetyAreaEnd) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHEND, distance2.method_0("0.##:m"))) if (self.method_4(PositionType.START)): position = self.method_1(PositionType.START).method_3() if(not bool_0) else self.method_1(PositionType.START).method_2() stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) for position1 in self: if (position1.Type != PositionType.Position or not position1.IsValidIncludingAltitude): continue position = position1.method_3() if(not bool_0) else position1.method_2() stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_4(PositionType.END)): position = self.method_1(PositionType.END).method_3() if(not bool_0) else self.method_1(PositionType.END).method_2() stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_4(PositionType.CWY)): position = self.method_1(PositionType.CWY).method_3() if(not bool_0) else self.method_1(PositionType.CWY).method_2() stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) return stringBuilder.ToString()
def method_4(self): aSFA = None if (self.leg.Type == RnpArLegType.RF): if (self.ui.txtAltitude.text() != "" and self.ui.txtWind.text() != ""): if (self.leg.Segment == RnpArSegmentType.Final): aSFA = self.group.IAS_FA; elif (self.leg.Segment != RnpArSegmentType.Initial): if self.leg.Segment != RnpArSegmentType.Intermediate: aSFA = self.group.IAS_MA else: aSFA = self.group.IAS_I else: aSFA = self.group.IAS_IA try: altitude = Altitude(float(self.ui.txtAltitude.text()), AltitudeUnits.FT) except ValueError: raise UserWarning, "Altitude Value is invalid!" speed = Speed.plus(Speed.smethod_0(aSFA, self.group.ISA, altitude) , Speed(float(self.ui.txtWind.text()))) num = math.pow(speed.Knots, 2) value = Distance(float(self.ui.txtRadius.text()), DistanceUnits.M) num1 = Unit.smethod_1(math.atan(num / (68625 * value.NauticalMiles))) num2 = 3431 * math.tan(Unit.ConvertDegToRad(num1)) / (3.14159265358979 * speed.Knots) self.ui.txtBank.setText(str(round(num1, 2))) self.ui.txtR.setText(str(round(num2, 2))) return self.ui.txtBank.setText("") self.ui.txtR.setText("")
def btnConstruct_Click(self): flag = FlightPlanBaseDlg.btnConstruct_Click(self) if not flag: return value = Speed(float(self.parametersPanel.txtIas.text()),SpeedUnits.KTS); if (self.parametersPanel.chbDeparture.isChecked()): value = value + (value / 10); altitude = Altitude(float(self.parametersPanel.txtAltitudeFt.text()), AltitudeUnits.FT); value1 = float(self.parametersPanel.txtIsa.text()); num1 = float (self.parametersPanel.txtBankAngle.text()); self.speedP = self.parametersPanel.pnlWind.Value; self.num2P = Unit.ConvertDegToRad(float(self.parametersPanel.txtTrackRadial.Value)); self.orientationTypeP = self.parametersPanel.cmbOrientation.currentText(); speed1 = Speed.smethod_0(value, value1, altitude); numList = [] distance = Distance.smethod_1(speed1, num1, numList); self.numP = numList[0] self.metresP = distance.Metres; self.originP = Point3D.get_Origin(); self.point3dP = Point3D.get_Origin(); self.origin1P = Point3D.get_Origin(); self.polylineP = PolylineArea(); self.flagP = True; define._canvas.setMapTool(self.CaptureCoordTool)
def btnCalculate_Click(self): # try: if self.type == RnavCommonWaypoint.FAWP or self.type == RnavCommonWaypoint.MAWP: if self.getThrPoint3D() == None or self.getEndPoint3D() == None: return if not MathHelper.smethod_112(float(self.txtBearing.text()), self.MinBearing, self.MaxBearing, AngleUnits.Degrees): if self.type != RnavCommonWaypoint.MAWP or MathHelper.smethod_96(self.MinBearing2) or MathHelper.smethod_96(self.MaxBearing2): raise UserWarning, Messages.VALUE_NOT_WITHIN_ACCEPTABLE_RANGE elif not MathHelper.smethod_106(float(self.txtBearing.text()), self.MinBearing2, self.MaxBearing2): raise UserWarning, Messages.VALUE_NOT_WITHIN_ACCEPTABLE_RANGE if self.txtDistance.isEnabled() and Distance(float(self.txtDistance.text()),DistanceUnits.NM).Metres < (self.MinDistance.Metres - 100): raise UserWarning, Validations.VALUE_CANNOT_BE_SMALLER_THAN%self.MinDistance.NauticalMiles wayPoint = self.getWaypoint() if self.type == RnavCommonWaypoint.FAWP or self.type == RnavCommonWaypoint.MAWP: if self.type == RnavCommonWaypoint.FAWP: self.parent().gbFAWP.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 0: self.parent().parameterCalcList.pop(0) self.parent().parameterCalcList.insert(0,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationFAWP.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) else: self.parent().gbMAWP.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 1: self.parent().parameterCalcList.pop(1) self.parent().parameterCalcList.insert(1,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationMAWP.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) self.parent().RwyTHR = self.getThrPoint3D() self.parent().RwyEND = self.getEndPoint3D() elif self.type == RnavCommonWaypoint.MAHWP: self.parent().gbMAHWP.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 2: self.parent().parameterCalcList.pop(2) self.parent().parameterCalcList.insert(2,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationMAHWP.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) elif self.type == RnavCommonWaypoint.IWP: self.parent().gbIWP.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 3: self.parent().parameterCalcList.pop(3) self.parent().parameterCalcList.insert(3,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationIWP.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) elif self.type == RnavCommonWaypoint.IAWP1: self.parent().gbIAWP1.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 4: self.parent().parameterCalcList.pop(4) self.parent().parameterCalcList.insert(4,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationIAWP1.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) elif self.type == RnavCommonWaypoint.IAWP2: self.parent().gbIAWP2.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 5: self.parent().parameterCalcList.pop(5) self.parent().parameterCalcList.insert(5,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationIAWP2.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) elif self.type == RnavCommonWaypoint.IAWP3: self.parent().gbIAWP3.setPosition( wayPoint.x(), wayPoint.y()) if len(self.parent().parameterCalcList) > 6: self.parent().parameterCalcList.pop(6) self.parent().parameterCalcList.insert(6,(self.txtBearing.text(), self.txtDistance.text())) self.parent().annotationIAWP3.setMapPosition(QgsPoint(wayPoint.x(), wayPoint.y())) self.close() QDialog.accept(self)
def getWaypoint(self): if (self.type == RnavCommonWaypoint.FAWP): nauticalMiles = float(self.txtDistance.text()) value = float(self.txtBearing.text()) num1 = math.fabs(self.rethr - value) if (num1 > 180): num1 = 360 - num1 num2 = math.sin(Unit.smethod_0(num1)) * 0.7559395 num3 = Unit.smethod_1(math.asin(num2 / nauticalMiles)) num4 = math.cos(Unit.smethod_0(num1)) * 0.755939525 num5 = math.cos(Unit.smethod_0(num3)) * nauticalMiles return RnavWaypoints.smethod_3(self.pos1400m, float(self.txtBearing.text()), Distance(math.fabs(num5 - num4), DistanceUnits.NM)) if (self.type != RnavCommonWaypoint.MAWP): return RnavWaypoints.smethod_3(self.from1, float(self.txtBearing.text()), Distance(float(self.txtDistance.text()), DistanceUnits.NM)) angle = 90 if (float(self.txtBearing.text()) > self.thrre or float(self.txtBearing.text()) - self.thrre >= 90): if self.flagStrName == "Y-Bar": angle = 70 num = self.rethr - angle if (num < 0): num = num + 360 else: num = self.rethr + angle if (num > 360): num = num - 360 point3d1 = self.from1 point3d2 = self.getThrPoint3D() point3d = MathHelper.getIntersectionPoint(point3d1, RnavWaypoints.smethod_3(self.from1, float(self.txtBearing.text()), Distance(1000)), point3d2, RnavWaypoints.smethod_3(self.getThrPoint3D(), num, Distance(1000))) if point3d == None: raise UserWarning, Messages.ERR_FAILED_TO_CALCULATE_INTERSECTION_POINT return RnavWaypoints.smethod_3(self.getThrPoint3D(), num, Distance(MathHelper.calcDistance(point3d2, point3d)))
def __init__(self, rnavSpecification_0=None, rnavDmeDmeFlightPhase_0=None, rnavDmeDmeCriteria_0=None, altitude_0=None): self.xtt = Distance(0.0) self.att = Distance(0.0) self.asw = Distance(0.0) # def RnavDmeDmeTolerance(RnavSpecification rnavSpecification_0, RnavDmeDmeFlightPhase rnavDmeDmeFlightPhase_0, RnavDmeDmeCriteria rnavDmeDmeCriteria_0, Altitude altitude_0) # { num = 0.0 num1 = 0.0 if rnavSpecification_0 == RnavSpecification.Rnav5: num = 2.5 elif rnavSpecification_0 == RnavSpecification.Rnav2: num = 1 elif rnavSpecification_0 == RnavSpecification.Rnav1: num = 0.5
def putDistances(self): try: point3dThr = self.parametersPanel.pnlThrPosition.Point3d point3dFaf = self.parametersPanel.pnlFafPosition.Point3d point3dMapt = self.parametersPanel.pnlMaPtPosition.Point3d speedTas = self.parametersPanel.pnlTas.Value inboundTrackRad = Unit.ConvertDegToRad(self.parametersPanel.pnlInboundTrack.Value) inboundTrack180Rad = MathHelper.smethod_4(inboundTrackRad + math.pi) dDist = Distance(MathHelper.calcDistance(point3dFaf, point3dMapt)) self.parametersPanel.pnlDistOfFafMapt.Value = dDist aDist = self.parametersPanel.pnlDistA.Value bDist = self.parametersPanel.pnlDistB.Value tasMin = Speed.smethod_0(self.parametersPanel.pnlIas.Value, -10, self.parametersPanel.pnlAerodromeAltitude.Value) tasMax = Speed.smethod_0(self.parametersPanel.pnlIas.Value, 15, self.parametersPanel.pnlAerodromeAltitude.Value) # calculate Distance from earliest MAPt to nominal MAPt: x1 = math.sqrt(math.pow(aDist.NauticalMiles, 2) + math.pow(tasMin.Knots * 10 / float(3600), 2) + math.pow(30 * dDist.NauticalMiles / tasMin.Knots, 2)) x2 = math.sqrt(math.pow(aDist.NauticalMiles, 2) + math.pow(tasMax.Knots * 10 / float(3600), 2) + math.pow(30 * dDist.NauticalMiles / tasMax.Knots, 2)) distEarliestMaptToNominalMapt = Distance(max(x1, x2), DistanceUnits.NM) self.parametersPanel.pnlDistOfEarliestToNominalMapt.Value = distEarliestMaptToNominalMapt #calculate Distance from nominal MAPt to latest MAPt x3 = math.sqrt(math.pow(bDist.NauticalMiles, 2) + math.pow(tasMin.Knots * 13 / float(3600), 2) + math.pow(30 * dDist.NauticalMiles / tasMin.Knots, 2)) x4 = math.sqrt(math.pow(bDist.NauticalMiles, 2) + math.pow(tasMax.Knots * 13 / float(3600), 2) + math.pow(30 * dDist.NauticalMiles / tasMax.Knots, 2)) distNominalMaptToLatestMapt = Distance(max(x3, x4), DistanceUnits.NM) self.parametersPanel.pnlDistOfNominalToLatestMapt.Value = distNominalMaptToLatestMapt #calculate Distance from Mapt to SOC x5 = x3 + 15 * (tasMin.Knots + 10) / float(3600) x6 = x4 + 15 * (tasMax.Knots + 10) / float(3600) distMaptSoc = Distance(max(x5, x6), DistanceUnits.NM) socMaptDistMeters = distMaptSoc.Metres socThrDistMeters = MathHelper.calcDistance(point3dMapt, point3dThr) - socMaptDistMeters sockBearing = inboundTrackRad self.socPoint3d = MathHelper.distanceBearingPoint(point3dMapt, sockBearing, socMaptDistMeters).smethod_167(self.calcSocAltitude()) self.parametersPanel.pnlDistOfMaptSoc.Value = Distance(socMaptDistMeters) self.parametersPanel.pnlDistOfSocThr.Value = Distance(MathHelper.calcDistance(self.socPoint3d, point3dThr)) self.parametersPanel.pnlDistOfFafMapt.Value = Distance(MathHelper.calcDistance(point3dFaf, point3dMapt))#MathHelper.calcDistance(point3dThr, self.socPoint3d)) self.parametersPanel.pnlDistOfMaptThr.Value = Distance(MathHelper.calcDistance(point3dMapt, point3dThr)) except: pass
def btnEvaluate_Click(self): 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) polylineArea = self.method_35() polylineAreaTemp = holdingTemplate.vmethod_0( polylineArea, self.parametersPanel.chbIntercept.Checked, self.parametersPanel.chbSectors12.Checked) polylineArea1 = polylineAreaTemp[0] altitude_0 = self.parametersPanel.txtAltitude.Value altitude_1 = self.parametersPanel.txtMoc.Value if (self.parametersPanel.cmbUsedFor.SelectedIndex != 0): hOSE = HoldingOverheadSecondaryEvaluator( polylineArea1, altitude_0, altitude_1, Distance(2.5, DistanceUnits.NM)) self.obstaclesModel = HoldingOverHeadObstacles( False, "second", None, altitude_0, hOSE.inner, hOSE.outer, hOSE.poly, altitude_1, Distance(2.5, DistanceUnits.NM)) elif (not self.parametersPanel.chbCatH.isChecked()): hOBE = HoldingOverheadBufferEvaluator(polylineArea1, altitude_0, altitude_1) self.obstaclesModel = HoldingOverHeadObstacles( self.parametersPanel.chbCatH.Checked, "buffer", hOBE.areas, altitude_0) else: hOSE = HoldingOverheadSecondaryEvaluator( polylineArea1, altitude_0, altitude_1, Distance(2, DistanceUnits.NM)) self.obstaclesModel = HoldingOverHeadObstacles( True, "second", None, altitude_0, hOSE.inner, hOSE.outer, hOSE.poly, altitude_1, Distance(2, DistanceUnits.NM)) return FlightPlanBaseDlg.btnEvaluate_Click(self)
def __init__(self): self.PointEnt = None self.CenterEnt = None self.CodeLegType = "" self.CodePathType = "" self.ValMinAlt = Altitude(0) self.ValDist = Distance(0) self.ValCourse = 0 self.ValLegRadial = 0 self.VorUidLeg = None self.CodePointType = "" self.CodeRepAtc = "" self.ValPointRadial = 0 self.VorUidPoint = None self.ValLegRadialBack = 0 self.VorUidLegBack = None self.ValPointDist1 = Distance(0) self.UidPointDist1 = None self.ValPointDist2 = Distance(0) self.UidPointDist2 = None self.ValDur = "" self.TxtRmk = "" self.CodeFlyBy = "" self.dataList = [] self.nameList = [ "Point", "Leg Type", "Path Type", "Center", "Min. Alt.", "Length", "Course", "Radial", "Fly-By", "Pnt. Type", "Rep. Pnt. Type", "Pnt. Radial", "Reverse Radial", "Pnt. Dist. 1", "Pnt. Dist. 2", "Duration", ]
def method_3(self, bool_0): point3d = None if (not bool_0): position = self.method_1(PositionType.START) point3d = self.method_1(PositionType.THR).Point3d if ( not position.IsValidIncludingAltitude) else position.Point3d else: point3d = self.method_1(PositionType.THR).Point3d point3d1 = self.method_1(PositionType.END).Point3d return Distance(MathHelper.calcDistance(point3d, point3d1))
def cmbAircraftCategory_Event_0(self): if self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.H: self.parametersPanel.pnlDistXz.Value = Distance(-700) self.parametersPanel.pnlDistXz.Enabled = False elif self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.Custom: self.parametersPanel.pnlDistXz.Enabled = True else: self.parametersPanel.pnlDistXz.Enabled = False if self.dlgType == SurfaceTypes.BARO_VNAV: for case in switch(self.parametersPanel.cmbAircraftCategory. SelectedIndex): if case(AircraftSpeedCategory.A) or case( AircraftSpeedCategory.B): self.parametersPanel.pnlDistXz.Value = Distance(-900) elif case(AircraftSpeedCategory.C): self.parametersPanel.pnlDistXz.Value = Distance(-1100) elif case(AircraftSpeedCategory.D): self.parametersPanel.pnlDistXz.Value = Distance(-1400) elif case(AircraftSpeedCategory.E): self.parametersPanel.pnlDistXz.Value = Distance(-1400) else: self.parametersPanel.pnlDistXz.Value = Distance(-900) self.putAircraftSpeed() self.putWithInHeightLoss()
def smethod_13(rnavFlightPhase_0, rnavWaypointType_0, speed_0, speed_1, distance_0, distance_1, double_0, angleUnits_0): if (rnavWaypointType_0 != RnavWaypointType.FlyBy): if (rnavWaypointType_0 != RnavWaypointType.FlyOver): raise UserWarning, "RNAV WayPoint type not SUPPORTED" if rnavFlightPhase_0 == RnavFlightPhase.Enroute: num1 = 15 elif rnavFlightPhase_0 == RnavFlightPhase.SID: num1 = 6 elif rnavFlightPhase_0 == RnavFlightPhase.STAR: raise UserWarning, "RNAV_FLIGHT_PHASE_NOT_SUPPORTED" elif rnavFlightPhase_0 == RnavFlightPhase.IafIf or rnavFlightPhase_0 == RnavFlightPhase.Faf: num1 = 11 elif rnavFlightPhase_0 == RnavFlightPhase.MissedApproach: num1 = 6 else: raise UserWarning, "RNAV_FLIGHT_PHASE_NOT_SUPPORTED" num2 = num1 * (speed_0.MetresPerSecond + speed_1.MetresPerSecond) return Distance(-(distance_0.Metres + num2)) if (angleUnits_0 == AngleUnits.Degrees): double_0 = Unit.ConvertDegToRad(double_0) num3 = min( [distance_1.Metres * math.tan(double_0 / 2), distance_1.Metres]) if rnavFlightPhase_0 == RnavFlightPhase.Enroute: num = 10 elif rnavFlightPhase_0 == RnavFlightPhase.SID: num = 3 elif rnavFlightPhase_0 == RnavFlightPhase.STAR: raise UserWarning, "RNAV_FLIGHT_PHASE_NOT_SUPPORTED" elif rnavFlightPhase_0 == RnavFlightPhase.IafIf or rnavFlightPhase_0 == RnavFlightPhase.Faf: num = 6 elif rnavFlightPhase_0 == RnavFlightPhase.MissedApproach: num = 3 else: raise UserWarning, "RNAV_FLIGHT_PHASE_NOT_SUPPORTED" num4 = num * (speed_0.MetresPerSecond + speed_1.MetresPerSecond) return Distance(num3 - distance_0.Metres - num4)
def __init__(self): self.RecommendedEnt = None self.PointEnt = None self.CenterEnt = None self.CodePhase = "" self.CodeType = CodeTypeProcPathAixm.OTHER self.ValCourse = 0 self.CodeTypeCourse = "" self.CodeDirTurn = "" self.CodeTurnValid = "" self.CodeDescrDistVer = "" self.CodeDistVerUpper = "" self.ValDistVerUpper = Altitude(0) self.CodeDistVerLower = "" self.ValDistVerLower = Altitude(0) self.ValVerAngle = 0 self.ValSpeedLimit = Speed(0) self.CodeSpeedRef = "" self.ValDist = Distance(0) self.ValDur = 0 self.ValTheta = 0 self.ValRho = Distance(0) self.ValBankAngle = 0 self.CodeRepAtc = "" self.CodeRoleFix = "" self.TxtRmk = "" self.dataList = [] self.nameList = [ "Fix Position", "Fix Type", "Recommended Nav. Aid", "Flight Phase", "Leg Type", "Course Type", "Course Angle", "Turn Direction", "Center", "Fly-By", "Bank Angle", "Altitude Interpretation", "Lower Limit Ref.", "Lower Limit", "Upper Limit Ref.", "Upper Limit", "Climb / Descent Angle", "Speed Restriction Ref.", "Speed Restriction", "Segment Length", "Duration", "ATC Reporting" ]
def getDistanceFromWaypointToEarliestTurningPoint(rnavWaypointType_0, att, turnRadiusDist, turnAngle, angleUnits_0): ### This methos is the method which calculate "Earliest turning point". ### Parameters ### angleUnits_0 : type of turnAngle(Degree or Radian). ### att, turnRadiusDist : Distance class if (rnavWaypointType_0 != RnavWaypointType.FlyBy): if (rnavWaypointType_0 != RnavWaypointType.FlyOver): raise UserWarning, "RNAV WayPoint type not SUPPORTED" return att turnAngleRad = 0.0 if (angleUnits_0 == AngleUnits.Degrees): turnAngleRad = Unit.ConvertDegToRad(turnAngle) return Distance(turnRadiusDist.Metres * math.tan(turnAngleRad / 2) + att.Metres)
def smethod_6(rnavCommonWaypoint_0, aircraftSpeedCategory_0): if (aircraftSpeedCategory_0 == AircraftSpeedCategory.Custom): raise Messages.CUSTOM_AC_CATEGORY_NOT_SUPPORTED if rnavCommonWaypoint_0 == RnavCommonWaypoint.MAHWP: return Distance(10, DistanceUnits.NM) elif rnavCommonWaypoint_0 == RnavCommonWaypoint.MAWP: return Distance.NaN() elif rnavCommonWaypoint_0 == RnavCommonWaypoint.FAWP: if (aircraftSpeedCategory_0 == AircraftSpeedCategory.H): return Distance(2, DistanceUnits.NM) return Distance(5, DistanceUnits.NM) elif rnavCommonWaypoint_0 == RnavCommonWaypoint.IWP: if (aircraftSpeedCategory_0 == AircraftSpeedCategory.H): return Distance(3, DistanceUnits.NM) return Distance(5, DistanceUnits.NM) else: if (aircraftSpeedCategory_0 != AircraftSpeedCategory.H): pass else: return Distance(3, DistanceUnits.NM) if (aircraftSpeedCategory_0 != AircraftSpeedCategory.A): if (aircraftSpeedCategory_0 != AircraftSpeedCategory.B): return Distance(6, DistanceUnits.NM) return Distance(5, DistanceUnits.NM)
def __init__(self, point3d_0, double_0, speed_0, speed_1, double_1, turnDirection_0): ### point3d_0 : start point ### double_0 is inboundTrack angle(radian). ### speed_0 is speed of airplane(TAS). ### speed_1 is speed of wind. ### double_1 is value of bank anlge(float). self.Start = [Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0)] self.Middle = [Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0)] self.Finish = [Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0)] self.Center = [Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0)] self.Radius = [Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0), Point3D(0.0, 0.0, 0.0)] self.Direction = turnDirection_0 return1 = [] distance = Distance.smethod_1(speed_0, double_1, return1) # out num) num = return1[0] metres = distance.Metres metresPerSecond = 45 / num * speed_1.MetresPerSecond metresPerSecond1 = 90 / num * speed_1.MetresPerSecond metresPerSecond2 = 135 / num * speed_1.MetresPerSecond num2 = 180 / num * speed_1.MetresPerSecond metresPerSecond3 = 225 / num * speed_1.MetresPerSecond num3 = 270 / num * speed_1.MetresPerSecond if turnDirection_0 != TurnDirection.Left: num1 = 1 else: num1 = -1 point3d = MathHelper.distanceBearingPoint(point3d_0, num1 * math.pi / 2 + double_0, metres) self.Start[0] = point3d_0 self.Middle[0] = MathHelper.distanceBearingPoint(point3d, -1 * num1 * (math.pi / 4) + double_0, metres + metresPerSecond) self.Finish[0] = MathHelper.distanceBearingPoint(point3d, double_0, metres + metresPerSecond1) self.Start[1] = self.Finish[0] self.Middle[1] = MathHelper.distanceBearingPoint(point3d, num1 * (math.pi / 4) + double_0, metres + metresPerSecond2) self.Finish[1] = MathHelper.distanceBearingPoint(point3d, num1 * math.pi / 2 + double_0, metres + num2) self.Start[2] = self.Finish[1] self.Middle[2] = MathHelper.distanceBearingPoint(point3d, num1 * (math.pi / 4) * 3 + double_0, metres + metresPerSecond3) self.Finish[2] = MathHelper.distanceBearingPoint(point3d, num1 * math.pi + double_0, metres + num3) self.Center[0] = MathHelper.smethod_68(self.Start[0], self.Middle[0], self.Finish[0]) self.Center[1] = MathHelper.smethod_68(self.Start[1], self.Middle[1], self.Finish[1]) self.Center[2] = MathHelper.smethod_68(self.Start[2], self.Middle[2], self.Finish[2]) self.Radius[0] = MathHelper.calcDistance(self.Center[0], self.Middle[0]) self.Radius[1] = MathHelper.calcDistance(self.Center[1], self.Middle[1]) self.Radius[2] = MathHelper.calcDistance(self.Center[2], self.Middle[2])
def smethod_4(rnavCommonWaypoint_0, aircraftSpeedCategory_0): if (aircraftSpeedCategory_0 == AircraftSpeedCategory.Custom): raise UserWarning, Messages.CUSTOM_AC_CATEGORY_NOT_SUPPORTED if rnavCommonWaypoint_0 == RnavCommonWaypoint.MAHWP: return Distance(1, DistanceUnits.NM) elif rnavCommonWaypoint_0 == RnavCommonWaypoint.MAWP: return Distance.NaN() elif rnavCommonWaypoint_0 == RnavCommonWaypoint.FAWP: if (aircraftSpeedCategory_0 == AircraftSpeedCategory.H): return Distance(1, DistanceUnits.NM) return Distance(3, DistanceUnits.NM) elif rnavCommonWaypoint_0 == RnavCommonWaypoint.IWP: return Distance(2, DistanceUnits.NM) else: return Distance(1, DistanceUnits.NM)
def putDistances(self): try: point3dThr = self.parametersPanel.pnlThrPosition.Point3d point3dFaf = self.parametersPanel.pnlFafPosition.Point3d point3dMapt = self.parametersPanel.pnlMaPtPosition.Point3d self.parametersPanel.pnlDistOfFafMapt.Value = Distance( MathHelper.calcDistance(point3dFaf, point3dMapt)) inboundTrackRad = Unit.ConvertDegToRad( self.parametersPanel.pnlInboundTrack.Value) inboundTrack180Rad = MathHelper.smethod_4(inboundTrackRad + math.pi) speedTas = self.parametersPanel.pnlTas.Value xDist = self.calcDAndXDistance(speedTas, Speed(10), 15) self.parametersPanel.pnlDistX.Caption = "X(10kts/15s)" if self.parametersPanel.cmbAircraftCategory.SelectedIndex == 5: xDist = self.calcDAndXDistance(speedTas, Speed(10), 5) self.parametersPanel.pnlDistX.Caption = "X(10kts/5s)" dDist = self.calcDAndXDistance(speedTas, Speed(10), 3) fixTolerance = 0.0 if self.dlgType == "NpaOnFix": fixTolerance = self.parametersPanel.pnlDistFixTolerance.Value.Metres socMaptDistMeters = fixTolerance + dDist + xDist socThrDistMeters = MathHelper.calcDistance( point3dMapt, point3dThr) - socMaptDistMeters sockBearing = inboundTrackRad self.socPoint3d = MathHelper.distanceBearingPoint( point3dMapt, sockBearing, socMaptDistMeters).smethod_167(self.calcSocAltitude()) self.parametersPanel.pnlDistD.Value = Distance(dDist) self.parametersPanel.pnlDistX.Value = Distance(xDist) self.parametersPanel.pnlDistOfMaptSoc.Value = Distance( socMaptDistMeters) self.parametersPanel.pnlDistOfSocThr.Value = Distance( MathHelper.calcDistance(self.socPoint3d, point3dThr) ) #MathHelper.calcDistance(point3dThr, self.daPoint3d)) # self.parametersPanel.pnlDistOfFafMapt.Value = Distance(MathHelper.calcDistance(point3dFaf, point3dMapt))#MathHelper.calcDistance(point3dThr, self.socPoint3d)) self.parametersPanel.pnlDistOfMaptThr.Value = Distance( MathHelper.calcDistance(point3dMapt, point3dThr)) except: pass
def __init__(self, rnavSpecification_0, rnavDmeDmeFlightPhase_0, rnavDmeDmeCriteria_0, altitude_0): # double num; # double num1; self.xtt = Distance(0, DistanceUnits.NM) self.att = Distance(0, DistanceUnits.NM) self.asw = Distance(0, DistanceUnits.NM) if rnavSpecification_0 == RnavSpecification.Rnav5: if (rnavDmeDmeFlightPhase_0 != RnavDmeDmeFlightPhase.EnrouteStarSid): return # throw new ArgumentException(string.Format(Validations.RNAV_FLIGHT_PHASE_NOT_SUPPORTED, EnumHelper.smethod_0(rnavDmeDmeFlightPhase_0))); num = 2.5 elif rnavSpecification_0 == RnavSpecification.Rnav2: num = 1 elif rnavSpecification_0 == RnavSpecification.Rnav1: num = 0.5 else: return if rnavDmeDmeFlightPhase_0 == RnavDmeDmeFlightPhase.EnrouteStarSid: num1 = 2 elif rnavDmeDmeFlightPhase_0 == RnavDmeDmeFlightPhase.Star30Sid30IfIaf: num1 = 1 elif rnavDmeDmeFlightPhase_0 == RnavDmeDmeFlightPhase.Sid15: num1 = 0.5 else: return num2 = 0.25 num3 = Unit.ConvertDegToRad(90) if (rnavDmeDmeCriteria_0 == RnavDmeDmeCriteria.Two): num3 = Unit.ConvertDegToRad(30) num4 = 1.23 * math.sqrt(altitude_0.Feet) if (rnavSpecification_0 == RnavSpecification.Rnav5): num4 = 300 elif (rnavDmeDmeFlightPhase_0 == RnavDmeDmeFlightPhase.EnrouteStarSid): num4 = 1.23 * math.sqrt(15000) num5 = max([0.085, 0.00125 * num4]) num6 = 0.05 num7 = 2 * math.sqrt(2 * (num5 * num5 + num6 * num6)) / math.sin(num3) self.xtt = Distance(math.sqrt(num7 * num7 + num * num + num2 * num2), DistanceUnits.NM) self.att = Distance(math.sqrt(num7 * num7 + num2 * num2), DistanceUnits.NM) self.asw = Distance(1.5 * self.xtt.NauticalMiles + num1, DistanceUnits.NM)
def btnCalculate_Click(self): try: bearing = Unit.ConvertDegToRad(float(self.txtBearing.text())) distance0 = Distance(float(self.txtDistance.text()), DistanceUnits.NM).Metres self.calcedPoint = MathHelper.distanceBearingPoint( self.point, bearing, distance0) if self.flagStr == "R": self.parent0.parametersPanel.pnlIAWP1.Point3d = self.calcedPoint self.parent0.parametersPanel.txtRadiusIAWP1.setText( self.txtDistance.text()) elif self.flagStr == "L": self.parent0.parametersPanel.txtRadiusIAWP3.setText( self.txtDistance.text()) self.parent0.parametersPanel.pnlIAWP3.Point3d = self.calcedPoint elif self.flagStr == "C": self.parent0.parametersPanel.txtRadiusIAWP2.setText( self.txtDistance.text()) self.parent0.parametersPanel.pnlIAWP2.Point3d = self.calcedPoint self.accept() except UserWarning as e: QMessageBox.warning(self, "warning", e.message)
def method_38(self): point3d = self.parametersPanel.pnlWaypoint.Point3d num = 1 if (self.parametersPanel.cmbOrientation.currentText() == OrientationType.Left): num = -1 num1 = MathHelper.smethod_4(Unit.ConvertDegToRad(float(self.parametersPanel.txtTrack.Value))) aTT = Distance(float(self.parametersPanel.pnlTolerances.txtAtt.text()), DistanceUnits.NM) point3d1 = MathHelper.distanceBearingPoint(point3d, num1, aTT.Metres) xTT = Distance(float(self.parametersPanel.pnlTolerances.txtXtt.text()), DistanceUnits.NM) point3d2 = MathHelper.distanceBearingPoint(point3d1, num1 + num * 1.5707963267949, xTT.Metres) distance = Distance(float(self.parametersPanel.pnlTolerances.txtAtt.text()), DistanceUnits.NM) point3d3 = MathHelper.distanceBearingPoint(point3d2, num1 + 3.14159265358979, distance.Metres * 2) aTT1 = Distance(float(self.parametersPanel.pnlTolerances.txtAtt.text()), DistanceUnits.NM) point3d4 = MathHelper.distanceBearingPoint(point3d, num1, aTT1.Metres) xTT1 = Distance(float(self.parametersPanel.pnlTolerances.txtXtt.text()), DistanceUnits.NM) point3d5 = MathHelper.distanceBearingPoint(point3d4, num1 - num * 1.5707963267949, xTT1.Metres) distance1 = Distance(float(self.parametersPanel.pnlTolerances.txtAtt.text()), DistanceUnits.NM) point3d6 = MathHelper.distanceBearingPoint(point3d5, num1 + 3.14159265358979, distance1.Metres * 2) point3dArray = [point3d2, point3d3, point3d6, point3d5] return PolylineArea(point3dArray)
def __init__(self, rnavSpecification_0=None, rnavVorDmeFlightPhase_0=None, distance_0=None, distance_1=None, distance_2=None): self.xtt = Distance(0.0) self.att = Distance(0.0) self.asw = Distance(0.0) # if (rnavSpecification_0 != RnavSpecification.Rnav5) # { # throw new ArgumentException(string.Format(Validations.RNAV_SPECIFICATION_NOT_SUPPORTED, EnumHelper.smethod_0(rnavSpecification_0))) # } # if (rnavVorDmeFlightPhase_0 != RnavVorDmeFlightPhase.Enroute) # { # throw new ArgumentException(string.Format(Validations.RNAV_FLIGHT_PHASE_NOT_SUPPORTED, EnumHelper.smethod_0(rnavVorDmeFlightPhase_0))) # } num = round(distance_0.NauticalMiles, 5) num1 = round(distance_1.NauticalMiles, 5) num2 = round(distance_2.NauticalMiles, 5) num3 = max([0.085, 0.00125 * num]) num4 = 0.05 num5 = 2 * math.sqrt(num3 * num3 + num4 * num4) num6 = Unit.ConvertDegToRad(4.5) num7 = 5707963267949 if (num1 == 0) else math.atan(num2 / num1) num8 = num1 - num * math.cos(num7 + num6) num9 = num5 * math.cos(num7) num10 = num2 - num * math.sin(num7 - num6) num11 = num5 * math.sin(num7) num12 = 2.5 num13 = 0.25 num14 = 2 self.xtt = Distance( math.sqrt(num8 * num8 + num9 * num9 + num12 * num12 + num13 * num13), DistanceUnits.NM) self.att = Distance( math.sqrt(num10 * num10 + num11 * num11 + num13 * num13), DistanceUnits.NM) self.asw = Distance(1.5 * self.xtt.NauticalMiles + num14, DistanceUnits.NM)
def smethod_2(position_0, position_1): return Distance( Unit.ConvertMeterToNM( MathHelper.calcDistance(position_0, position_1)), DistanceUnits.NM)
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)