コード例 #1
0
    def autoCalcFinishMagVar(self):
        try:
            if self.parametersPanel.chbAutoFinishMagVar.Checked:
                finishPt = None
                finishLat = None
                finishLon = None
                degree3 = None
                num = None
                result, degree, degree1 = self.parametersPanel.pnlStartPosP.method_3(
                )
                if (result):
                    value = float(self.parametersPanel.txtForwardTP.Value)
                    value1 = float(self.parametersPanel.txtForwardTP.Value)
                    distance = self.parametersPanel.txtDistanceP.Value
                    result1, degree2, degree3, num = Geo.smethod_6(
                        self.parametersPanel.cmbCalculationTypeP.SelectedItem,
                        degree, degree1, value, distance)
                    if (result1):
                        finishPt = Point3D(degree3, degree2)

                        finishLat = degree2
                        finishLon = degree3
                if finishPt != None and self.model != None and self.date != None:
                    # result, degree, degree1 = self.parametersPanel.pnlStartPosP.method_3();
                    result2, degree2 = Geo.smethod_7(finishLat, finishLon,
                                                     Altitude(0), self.model,
                                                     self.date)
                    if (result2):
                        degree2 = round(degree2, 2)
                        self.parametersPanel.pnlVarFinishP.Value = degree2
        except:
            pass
コード例 #2
0
    def calculateP(self):
        degree = None
        degree1 = None
        degree2 = None
        degree3 = None
        num = None
        result, degree, degree1 = self.parametersPanel.pnlStartPosP.method_3()
        if (result):
            # self.pnlVarStart.Value.smethod_17();
            num1 = float(self.parametersPanel.pnlVarFinishP.Value)
            value = float(self.parametersPanel.txtForwardTP.Value)
            value1 = float(self.parametersPanel.txtForwardTP.Value)
            distance = self.parametersPanel.txtDistanceP.Value
            result, degree2, degree3, num = Geo.smethod_6(
                self.parametersPanel.cmbCalculationTypeP.SelectedItem, degree,
                degree1, value, distance)
            if (result):
                num2 = MathHelper.smethod_3(num - num1)
                self.method_29_P()
                self.resultPoint3d = Point3D(degree3, degree2)

                self.resultLat = degree2
                self.resultLon = degree3

                latStr = Degrees(degree2, None, None,
                                 DegreesType.Latitude).ToString()

                self.resultModelP.setItem(0, 0,
                                          QStandardItem(Captions.LATITUDE))
                self.resultModelP.setItem(0, 1, QStandardItem(latStr))

                lonStr = Degrees(degree3, None, None,
                                 DegreesType.Longitude).ToString()
                if String.Str2QString(lonStr).mid(0, 1) == "0":
                    lonStr = String.Str2QString(lonStr).mid(
                        1,
                        String.Str2QString(lonStr).length() - 1)

                self.resultModelP.setItem(1, 0,
                                          QStandardItem(Captions.LONGITUDE))
                self.resultModelP.setItem(1, 1, QStandardItem(lonStr))

                self.resultModelP.setItem(
                    2, 0, QStandardItem(Captions.REVERSE_TRUE_BEARING))
                self.resultModelP.setItem(2, 1,
                                          QStandardItem(str(round(num, 4))))

                self.resultModelP.setItem(
                    3, 0, QStandardItem(Captions.REVERSE_MAGNETIC_BEARING))
                self.resultModelP.setItem(3, 1,
                                          QStandardItem(str(round(num2, 4))))

                dataList = []
                dataList.append([
                    "Latitude (Start)", "Longitude (Start)",
                    "Variation (Start)", "Forward (° T)", "Forward (° M)",
                    "Distance (nm)", "Distance (km)", "Latitude (Finish)",
                    "Longitude (Finish)", "Variation (Finish)",
                    "Reverse (° T)", "Reverse (° M)"
                ])
                dataList.append([
                    str(degree),
                    str(degree1),
                    str(self.parametersPanel.pnlVarStartP.Value),
                    str(self.parametersPanel.txtForwardTP.Value),
                    str(self.parametersPanel.txtForwardMP.Value),
                    str(distance.NauticalMiles),
                    str(distance.Kilometres),
                    str(degree2),
                    str(degree3),
                    str(self.parametersPanel.pnlVarFinishP.Value),
                    str(round(num, 4)),
                    str(round(num2, 4))
                ])
                GeoDetermineDlg.HistoryDataP.append(dataList)
                self.setDataInHistoryModel(dataList)
                self.method_28_P(degree2, degree3)