コード例 #1
0
 def ToString(self, format_0 = None):
     stringBuilder = StringBuilder()
     if format_0 == None:
         format_0 = ""
     if not isinstance(format_0, QString):
         format_0 = String.Str2QString(format_0)
     # if (provider == null)
     # {
     #     provider = CultureInfo.CurrentCulture
     # }
     if (not String.IsNullOrEmpty(format_0)):
         format_0 = format_0.toUpper()
         if (format_0.contains("QA:")):
             format_0 = format_0.replace("QA:", "")
             num = 0
             try:
                 num = int(format_0)
             except:
                 num = 0
             stringBuilder = StringBuilder()
             str0 = ""
             for i in range(num):
                 str0 = QString(String.Concat([str0, " "]))
             if (not String.IsNullOrEmpty(self.id)):
                 stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.ID, self.id))
             if (not self.xy):
                 lATITUDE = Captions.LATITUDE
                 degree = Degrees.smethod_1(self.xlat)
                 stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, lATITUDE, degree.method_2()))
                 lONGITUDE = Captions.LONGITUDE
                 degree1 = Degrees.smethod_5(self.ylon)
                 stringBuilder.Append("{0}{1}\t{2}".format(str0, lONGITUDE, degree1.method_2()))
             else:
                 stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.X, str(self.xlat)))#.ToString(Formats.GridXYFormat, provider)))
                 stringBuilder.Append("{0}{1}\t{2}".format(str0, Captions.Y, str(self.ylon)))#.ToString(Formats.GridXYFormat, provider)))
             if (not self.altitude == None):
                 altitude = Altitude(self.altitude)
                 stringBuilder.AppendLine("")
                 aLTITUDE = [str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft")]
                 stringBuilder.Append("{0}{1}\t{2} ({3})".format(str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft")))
             return stringBuilder.ToString()
     stringBuilder = StringBuilder()
     if (not String.IsNullOrEmpty(self.id)):
         stringBuilder.Append(self.id + ", ")
     if (not self.xy):
         degree2 = Degrees.smethod_1(self.xlat)
         str1 = degree2.method_2()
         degree3 = Degrees.smethod_5(self.ylon)
         stringBuilder.Append(str1 + ", " + degree3.method_2())
     else:
         stringBuilder.Append(str(self.xlat) + ", " + str(self.ylon))
     if (not self.altitude == None):
         altitude1 = Altitude(self.altitude)
         stringBuilder.Append(", {0} ({1})", ", " + altitude1.ToString(":m") + " (" + altitude1.ToString(":ft") + ")")
     return stringBuilder.ToString()
コード例 #2
0
 def method_4(self):
     if (self.xy):
         return Position(self.type, self.id, self.xlat, self.ylon,
                         Altitude(self.altitude))
     return Position(self.type, self.id, None, None,
                     Altitude(self.altitude), Degrees.smethod_1(self.xlat),
                     Degrees.smethod_5(self.ylon))
コード例 #3
0
 def method_0(self):
     if (self.xy):
         xlatValue = self.xlat
         ylonValue = self.ylon
         return True, xlatValue, ylonValue
     result, ylonValue, xlatValue = Geo.smethod_3(Degrees.smethod_1(self.xlat), Degrees.smethod_5(self.ylon))
     return result, xlatValue, ylonValue
コード例 #4
0
ファイル: Fato.py プロジェクト: developer124320/FlightPlanner
 def smethod_0(binaryReader_0, byte_0):
     if not isinstance(binaryReader_0, QDataStream):
         return
     position = Position()
     fato = Fato()
     if (byte_0 != 1):
         raise Messages.ERR_INVALID_FILE_FORMAT
         # throw new Exception(Messages.ERR_INVALID_FILE_FORMAT)
     fato.name = binaryReader_0.readQString()
     fato.des1 = binaryReader_0.readQString()
     fato.des2 = binaryReader_0.readQString()
     fato.safetyAreaWidth = binaryReader_0.readDouble()
     fato.safetyAreaStart = binaryReader_0.readDouble()
     fato.safetyAreaEnd = binaryReader_0.readDouble()
     num = binaryReader_0.readInt()
     for i in range(num):
         positionType = binaryReader_0.readInt()
         flag = binaryReader_0.readBool()
         if (binaryReader_0.readBool()):
             position = Position(
                 positionType, None, None, None,
                 Altitude(binaryReader_0.readDouble()),
                 Degrees.smethod_1(binaryReader_0.readDouble()),
                 Degrees.smethod_5(binaryReader_0.readDouble())) if (
                     not flag) else Position(
                         positionType, None, binaryReader_0.readDouble(),
                         binaryReader_0.readDouble(),
                         Altitude(binaryReader_0.readDouble()))
             if (i >= 3):
                 fato.Add(position)
             else:
                 fato[i] = position
     return fato
コード例 #5
0
 def get_Point3d(self):
     if (not self.IsValid):
         raise Messages.ERR_INVALID_OR_INCOMPLETE_POSITION
     if (self.xy):
         if (self.altitude == None or math.isinf(self.altitude)):
             return Point3D(self.xlat, self.ylon, 0)
         return Point3D(self.xlat, self.ylon, self.altitude)
     result, num, num1 = Geo.smethod_3(Degrees.smethod_1(self.xlat), Degrees.smethod_5(self.ylon))
     if (not result):
         raise "Geo.LastError"
     if (self.altitude == None or math.isinf(self.altitude)):
         return Point3D(num, num1, 0)
     return Point3D(num, num1, self.altitude)
コード例 #6
0
 def get_Position(self):
     position = None
     if (self.inputType != "XY"):
         position = Position(None, None, None, None, None,
                             Degrees.smethod_1(self.Point3d.get_X()),
                             Degrees.smethod_5(self.Point3d.get_Y()))
     else:
         position = Position(None, None, self.Point3d.get_X(),
                             self.Point3d.get_Y())
     position.ID = self.txtID.text()
     if (self.hasAltitude):
         position.altitude = self.Point3d.get_Z()
     position.Type = self.posType
     return position
コード例 #7
0
 def method_1(self):
     if (self.xy):
         return Geo.smethod_2(self.xlat, self.ylon)
     degreesLat = Degrees.smethod_1(self.xlat)
     degreesLon = Degrees.smethod_5(self.ylon)
     return True, degreesLat, degreesLon
コード例 #8
0
    def smethod_0(dataStream, byte_0=0):
        ####### dataStream must be the instance of QDataStream.
        if not isinstance(dataStream, QDataStream):
            QMessageBox.warning(None, "Warning", "Please use the QDataStream")
            return

        position = None
        runway = Runway()

        runway.name = dataStream.readQString()
        runway.des1 = dataStream.readQString()
        runway.des2 = dataStream.readQString()

        positionCount = dataStream.readInt()
        if byte_0 == 2:
            for i in range(positionCount):
                positionType = dataStream.writeInt()
                xyFlag = dataStream.readBool()
                validIncludingAltitude = dataStream.readBool()
                if validIncludingAltitude:
                    xLat = dataStream.readDouble()
                    yLon = dataStream.readDouble()
                    altitude = dataStream.readDouble()

                    if (positionType == 1):
                        runway[runway.method_2(PositionType.CWY)] = Position(
                            PositionType.CWY, None, xLat, yLon,
                            Altitude(altitude))
                    elif (positionType == 2):
                        runway[runway.method_2(PositionType.SWY)] = Position(
                            PositionType.SWY, None, xLat, yLon,
                            Altitude(altitude))
                    elif (positionType == 3):
                        runway[runway.method_2(PositionType.END)] = Position(
                            PositionType.END, None, xLat, yLon,
                            Altitude(altitude))
                    elif (positionType == 4):
                        runway[runway.method_2(PositionType.THR)] = Position(
                            PositionType.THR, None, xLat, yLon,
                            Altitude(altitude))
                    elif (positionType == 5):
                        runway.Add(
                            Position(PositionType.Position, None, xLat, yLon,
                                     Altitude(altitude)))
                    elif (positionType == 6):
                        runway[runway.method_2(PositionType.START)] = Position(
                            PositionType.START, None, xLat, yLon,
                            Altitude(altitude))
        elif byte_0 == 3:
            for i in range(positionCount):
                positionType = dataStream.readInt()
                xyFlag = dataStream.readBool()
                validIncludingAltitude = dataStream.readBool()
                if validIncludingAltitude:
                    xLat = dataStream.readDouble()
                    yLon = dataStream.readDouble()
                    altitude = dataStream.readDouble()

                    position = Position(
                        positionType, None, None, None, Altitude(altitude),
                        Degrees.smethod_1(xLat),
                        Degrees.smethod_5(yLon)) if (not xyFlag) else Position(
                            positionType, None, xLat, yLon, Altitude(altitude))
                    if (i >= 5):
                        runway.Add(position)
                    else:
                        runway[i] = position
        return runway