Пример #1
0
 def acceptDlg(self):
     strS = None;
     selectedItem = self.pnlAerodrome.SelectedItem;
     num = (self.pnlAcCategory.SelectedIndex >= 0) and self.pnlAcCategory.SelectedIndex or -1;
     for row in self.table:
         flag = True;
         if (self.selected != None and row == self.selected):
             flag = False;
         if (row["ahpEnt"] != selectedItem):
             flag = False;
         if (not self.pnlDesignator.Value == row["txtDesig"]):
             flag = False;
         if (num != (row["codeCatAcft"] == None) and -1 or int(row["codeCatAcft"])):
             flag = False;
         strS = (row["codeTransId"] == None) and "" or row["codeTransId"];
         if (not self.pnlTransID.Value == strS):
             flag = False;
         if (not flag):
             continue;
         str1 = "Cannot create a duplicate procedure entry.\n\nAerodrome = {0}\nDesignator = {1}".format(self.pnlAerodrome.SelectedItem, self.pnlDesignator.Value);
         if (self.pnlAcCategory.SelectedIndex >= 0):
             str1 = String.Concat([str1, "\nAc. Category = {0}".format(self.pnlAcCategory.SelectedItem)]);
         if (not String.IsNullOrEmpty(self.pnlTransID.Value)):
             str1 = String.Concat([str1, "\nTransition Identifier = {0}".format(self.pnlTransID.Value)]);
         QMessageBox.warning(self, "Error", str1);
         return;
     self.accept()
Пример #2
0
 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()
Пример #3
0
 def HtmlBody(self, lines, title):
     lines.AppendLine("<div align=\"center\">")
     if (not String.IsNullOrEmpty(title)):
         lines.AppendLine(
             String.Concat(["<p align=\"center\"><b>", title, "</b></p>"]))
     lines.AppendLine(
         "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">")
     lines.AppendLine("<tbody>")
     lines.AppendLine(String.Concat(["<tr><td>", self.Text, "</td></tr>"]))
     lines.AppendLine("</tbody>")
     lines.AppendLine("</table>")
     lines.AppendLine("</div>")
    def btnEvaluate_Click(self):   #### ---------------  Export  -------------------###
        if ProcedureExportDlg.dataBase == None:
            return
        filePathDir = QFileDialog.getSaveFileName(self, "Save Data",QCoreApplication.applicationDirPath (),"XML Files (*.xml)")
        if filePathDir == "":
            return

        effectiveDate = ProcedureExportDlg.dataBase.EffectiveDate;
        resultDlg, effectiveDate = DlgAixmEffectiveDate.smethod_0(effectiveDate)
        if (not resultDlg):
            return;
        xmlDocument = QDomDocument()
        xmlDeclaration = xmlDocument.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"" )
        xmlDocument.appendChild(xmlDeclaration)
        xmlElement = xmlDocument.createElement("AIXM-update")
        # xmlAttribute = xmlDocument.createAttribute("xsi")
        # xmlAttribute.setValue("http://www.w3.org/2001/XMLSchema-instance")
        xmlElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
        xmlElement.setAttribute("xsi:noNamespaceSchemaLocation", "AIXM+Update.xsd");
    #     xmlAttribute.Value = "AIXM+Update.xsd";
        xmlElement.setAttribute("version", "4.5");
        xmlElement.setAttribute("origin", "ASAP s.r.o.");
        strS = QDateTime.currentDateTime().toString("yyyy-MM-dd");
        now = QDateTime.currentDateTime();
        xmlElement.setAttribute("created", String.Concat([strS, "T", now.toString("hh:mm:ss")]));
        xmlElement.setAttribute("effective", String.Concat([effectiveDate.toString("yyyy-MM-dd"), "T00:00:00"]));
        # xmlElement.Attributes.Append(xmlAttribute);
        xmlDocument.appendChild(xmlElement)
        xmlElement1 = xmlDocument.createElement("Group");
        xmlElement1.setAttribute("Name", "Group 1 of 1");
        ProcedureExportDlg.dataBase.ProcedureData.method_61(xmlElement1, self.newProcedurePointsInUse);
        ProcedureExportDlg.dataBase.ProcedureData.method_62(xmlElement1, ProcedureExportDlg.dataBase.SIDs.Select({"deleted":"True", "new":"False"}), DataBaseProcedureExportDlgType.Deleted);
        ProcedureExportDlg.dataBase.ProcedureData.method_62(xmlElement1, ProcedureExportDlg.dataBase.SIDs.Select({"deleted":"False", "changed":"True", "new":"False"}), DataBaseProcedureExportDlgType.Updated);
        ProcedureExportDlg.dataBase.ProcedureData.method_62(xmlElement1, ProcedureExportDlg.dataBase.SIDs.Select({"deleted":"False", "new":"True"}), DataBaseProcedureExportDlgType.Created);
        ProcedureExportDlg.dataBase.ProcedureData.method_63(xmlElement1, ProcedureExportDlg.dataBase.STARs.Select({"deleted":"True", "new":"False"}), DataBaseProcedureExportDlgType.Deleted);
        ProcedureExportDlg.dataBase.ProcedureData.method_63(xmlElement1, ProcedureExportDlg.dataBase.STARs.Select({"deleted":"False", "changed":"True", "new":"False"}), DataBaseProcedureExportDlgType.Updated);
        ProcedureExportDlg.dataBase.ProcedureData.method_63(xmlElement1, ProcedureExportDlg.dataBase.STARs.Select({"deleted":"False", "new":"True"}), DataBaseProcedureExportDlgType.Created);
        ProcedureExportDlg.dataBase.ProcedureData.method_64(xmlElement1, ProcedureExportDlg.dataBase.IAPs.Select({"deleted":"True", "new":"False"}), DataBaseProcedureExportDlgType.Deleted);
        ProcedureExportDlg.dataBase.ProcedureData.method_64(xmlElement1, ProcedureExportDlg.dataBase.IAPs.Select({"deleted":"False", "changed":"True", "new":"False"}), DataBaseProcedureExportDlgType.Updated);
        ProcedureExportDlg.dataBase.ProcedureData.method_64(xmlElement1, ProcedureExportDlg.dataBase.IAPs.Select({"deleted":"False", "new":"True"}), DataBaseProcedureExportDlgType.Created);
        ProcedureExportDlg.dataBase.ProcedureData.method_65(xmlElement1, ProcedureExportDlg.dataBase.Holdings.Select({"deleted":"True", "new":"False"}), DataBaseProcedureExportDlgType.Deleted);
        ProcedureExportDlg.dataBase.ProcedureData.method_65(xmlElement1, ProcedureExportDlg.dataBase.Holdings.Select({"deleted":"False", "changed":"True", "new":"False"}), DataBaseProcedureExportDlgType.Updated);
        ProcedureExportDlg.dataBase.ProcedureData.method_65(xmlElement1, ProcedureExportDlg.dataBase.Holdings.Select({"deleted":"False", "new":"True"}), DataBaseProcedureExportDlgType.Created);
        xmlElement.appendChild(xmlElement1);
    #     xmlDocument.Save(self.sfd.FileName);
    #     base.method_20(string.Format(Messages.X_SUCCESSFULLY_CREATED, self.pnlFile.Value));
        qFile = QFile(filePathDir)
        if qFile.open(QFile.WriteOnly):
            textStream = QTextStream(qFile)
            xmlDocument.save(textStream, 4)
            qFile.close()
        else:
            raise UserWarning, "can not open file:" + filePathDir
Пример #5
0
    def __init__(self,
                 xmlNode_0=None,
                 string_0=None,
                 string_1=None,
                 string_2=None,
                 string_3=None):
        ProcEntityBase.__init__(self)

        if xmlNode_0 != None:
            xmlNodes = xmlNode_0.namedItem("FtoUid")
            xmlNodes1 = xmlNodes.namedItem("AhpUid")
            self.codeId = xmlNodes1.namedItem("codeId").toElement().text()
            self.txtDesig = xmlNodes.namedItem("txtDesig").toElement().text()
            self.geoLat = xmlNode_0.namedItem("geoLat").toElement().text()
            self.geoLong = xmlNode_0.namedItem("geoLong").toElement().text()
            self.txtName = "{0}".format(self.codeId, self.txtDesig)
            if (self.codeId != self.txtDesig):
                procEntityFCP = self
                self.txtName = String.Concat(
                    [procEntityFCP.txtName, " {0}".format(self.txtDesig)])
        else:
            self.codeId = string_0
            self.txtDesig = string_1
            self.geoLat = string_2
            self.geoLong = string_3
            self.txtName = "{0} {1}".format(string_0, string_1)
Пример #6
0
 def smethod_0(string_0, stringBuilder_0):
     stringBuilder_0.AppendLine(
         "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
     )
     stringBuilder_0.AppendLine("<html>")
     stringBuilder_0.AppendLine("<head>")
     stringBuilder_0.AppendLine(
         String.Concat(["<title>", string_0, "</title>"]))
     stringBuilder_0.AppendLine("<style type=\"text/css\">")
     stringBuilder_0.AppendLine(
         "body { font:12px tahoma,12px helvetica,12px arial,12px verdana; font:size: 100%; }"
     )
     stringBuilder_0.AppendLine(
         "table { font:12px tahoma,12px helvetica,12px arial,12px verdana; font:size: 100%; border-collapse: collapse; }"
     )
     stringBuilder_0.AppendLine(
         "th { border: 1px solid black; text-align: center; vertical-align: middle; }"
     )
     stringBuilder_0.AppendLine(
         "td { border: 1px solid black; text-align: left; vertical-align: middle; }"
     )
     stringBuilder_0.AppendLine(
         "tr { border: 1px solid black; text-align: left; vertical-align: middle; }"
     )
     stringBuilder_0.AppendLine("</style>")
     stringBuilder_0.AppendLine("</head>")
     stringBuilder_0.AppendLine("<body>")
Пример #7
0
    def acceptDlg(self):
        strS = None
        # self.errorProvider.method_1();
        # self.pnlAerodrome.method_0();
        # self.pnlDesignator.method_0();
        # self.pnlType.method_0();
        # self.pnlRNP.method_1(new Validator(ValidationFlags.AllowEmpty | ValidationFlags.Positive));
        # if (self.errorProvider.HasErrors)
        # {
        #     return;
        # }
        selectedItem = self.pnlAerodrome.SelectedItem
        num = (self.pnlAcCategory.SelectedIndex >=
               0) and self.pnlAcCategory.SelectedIndex or -1
        for row in self.table:
            flag = True
            if (self.selected != None and row == self.selected):
                flag = False
            if (row["ahpEnt"] != selectedItem):
                flag = False
            if (not self.pnlDesignator.Value == row["txtDesig"]):
                flag = False
            if (num != (row["codeCatAcft"] == None) and -1
                    or int(row["codeCatAcft"])):
                flag = False
            strS = (row["codeTransId"] == None) and "" or row["codeTransId"]
            if (not self.pnlTransID.Value == strS):
                flag = False

            if (not flag):
                continue
            str1 = "Cannot create a duplicate procedure entry.\n\nAerodrome = {0}\nDesignator = {1}".format(
                self.pnlAerodrome.SelectedItem, self.pnlDesignator.Value)
            if (self.pnlAcCategory.SelectedIndex >= 0):
                str1 = String.Concat([
                    str1, "\nAc. Category = {0}".format(
                        self.pnlAcCategory.SelectedItem)
                ])
            if (not String.IsNullOrEmpty(self.pnlTransID.Value)):
                str1 = String.Concat([
                    str1, "\nTransition Identifier = {0}".format(
                        self.pnlTransID.Value)
                ])
            QMessageBox.warning(self, "Error", str1)
            return
        self.accept()
Пример #8
0
 def HtmlBody(self, lines, title):
     lines.AppendLine("<div>");
     if (not String.IsNullOrEmpty(title)):
         lines.AppendLine(String.Concat(["<p align=\"center\"><b>", title, "</b></p>"]));
     strArrays = Extensions.smethod_3(self.Text);
     for i in range(strArrays.count()):
         str0 = String.QString2Str(strArrays[i]);
         lines.AppendLine("{0}<br>".format(str0));
     lines.AppendLine("</div>");
Пример #9
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()
Пример #10
0
 def set_AirportId(self, value):
     num = 1
     while (len(value) < 4):
         value = String.Concat([value, " "])
     charArray = String.ToCharArray(value, 0, 4)
     i = 3
     while i >= 0:
         self.bytes[num] = Type.ByteFunc.d2b(ord(charArray[i]) & ord('?'))
         num += 1
         i -= 1
     self.method_3()
Пример #11
0
 def set_ReferencePathIdentifier(self, value):
     num = 8
     value = "<doc>"
     while (len(value) < 4):
         value = String.Concat([value, " "])
     charArray = String.ToCharArray(value, 0, 4)
     i = 3
     while i >= 0:
         self.bytes[num] = Type.ByteFunc.d2b(ord(charArray[i]) & ord('?'))
         num += 1
         i -= 1
     self.method_3()
Пример #12
0
 def method_6(self, bool_0, string_0, string_1):
     position = None
     stringBuilder = StringBuilder()
     str0 = "qa:{0}".format(string_1.Length)
     if (self.method_5(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, PositionType.Items[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_5(PositionType.THR)):
         position = self.method_1(PositionType.THR).method_3() if (
             not bool_0) else self.method_1(PositionType.THR).method_2()
         stringBuilder.AppendLine(
             String.Concat(
                 [string_0, PositionType.Items[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, PositionType.Items[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_5(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, PositionType.Items[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_5(PositionType.SWY)):
         position = self.method_1(PositionType.SWY).method_3() if (
             not bool_0) else self.method_1(PositionType.SWY).method_2()
         stringBuilder.AppendLine(
             String.Concat(
                 [string_0, PositionType.Items[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_5(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, PositionType.Items[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     return stringBuilder.ToString()
 def get_DisplayName(self):
     str0 = self.type if (String.IsNullOrEmpty(self.name)) else self.name
     if (self.hardCoded):
         return str0
     return String.Concat(["* ", str0])
Пример #14
0
 def method_14(self, binaryWriter_0, qafileVersion_0):
     if (qafileVersion_0 == QAFileVersion.V4_1):
         count = 0
         for session in self.sessions:
             count = count + len(session.Children) + 2
         binaryWriter_0.write(str(count))
     for i in range(len(self.sessions)):
         item = self.sessions[i]
         if (item.SessionType != QASessionType.Started):
             binaryWriter_0.write(str(1))
             binaryWriter_0.write(item.Stamp.toString())
             binaryWriter_0.write(item.DwgSaved.toString())
             binaryWriter_0.write(item.QaLastSaved.toString())
             binaryWriter_0.write(item.DwgSizeOpened)
             self.method_8(binaryWriter_0, item.DwgFileName)
             binaryWriter_0.write(item.Correlation)
             self.method_8(binaryWriter_0, item.TagName)
             self.method_8(binaryWriter_0, item.TagSection)
             self.method_8(binaryWriter_0, item.TagReason)
         else:
             binaryWriter_0.write(str(0))
             binaryWriter_0.write(item.Stamp.ToOADate())
             binaryWriter_0.write(item.DwgCreated.ToOADate())
             binaryWriter_0.write(item.DwgSaved.ToOADate())
             binaryWriter_0.write(item.DwgSizeOpened)
             self.method_8(binaryWriter_0, item.DwgFileName)
             self.method_8(binaryWriter_0, item.TagProject)
             self.method_8(binaryWriter_0, item.TagName)
             self.method_8(binaryWriter_0, item.TagSection)
             self.method_8(binaryWriter_0, item.TagReason)
         for j in range(len(item.Children)):
             qARecord = item.Children[j]
             oldRecordType = OldRecordType.ProcSummary
             if (len(qARecord.Children) == 0):
                 if (qARecord.Type == QARecordType.Attached):
                     oldRecordType = OldRecordType.Attached
                 elif (qARecord.Type == QARecordType.Comment):
                     oldRecordType = OldRecordType.Comment
                 elif (qARecord.Type == QARecordType.Snapshot):
                     oldRecordType = OldRecordType.Snapshot
                 elif (qARecord.Type == QARecordType.Table and qARecord.TableType == QATableType.General):
                     oldRecordType = OldRecordType.Program
             binaryWriter_0.write(oldRecordType)
             binaryWriter_0.write(qARecord.Stamp.ToOADate())
             self.method_8(binaryWriter_0, qARecord.Heading)
             if (oldRecordType == OldRecordType.Attached):
                 self.method_8(binaryWriter_0, String.Concat([Captions.STATUS, "\t", qARecord.Text]))
             elif (oldRecordType == OldRecordType.Comment):
                 self.method_10(binaryWriter_0, qARecord.Value, False)
             elif (oldRecordType == OldRecordType.Program):
                 self.method_10(binaryWriter_0, qARecord.Value, True)
             elif (oldRecordType == OldRecordType.Snapshot):
                 qASnapshot = qARecord# as QASnapshot
                 binaryWriter_0.write(qASnapshot.ImageRatio)
                 binaryWriter_0.write(qASnapshot.ViewSize)
                 binaryWriter_0.write(QADocument.smethod_0(qASnapshot.ViewCenter))
                 binaryWriter_0.write(qASnapshot.ModelSpace)
                 image = qASnapshot.Image
                 #TODO: UnCompleted
                 # using (MemoryStream memoryStream = new MemoryStream())
                 # {
                 #     image.Save(memoryStream, ImageHelper.smethod_2(ImageFormat.Jpeg), ImageHelper.smethod_3(QA.JpegQuality))
                 #     binaryWriter_0.write(memoryStream.Length)
                 #     binaryWriter_0.write(memoryStream.ToArray())
                 # }
             elif (oldRecordType == OldRecordType.ProcSummary):
                 num = len(qARecord.Children) - 1
                 if (qARecord.Type == QARecordType.Unknown):
                     binaryWriter_0.write(str(num))
                 else:
                     binaryWriter_0.write(str(num + 1))
                     if (len(qARecord.Children) <= 0):
                         self.method_8(binaryWriter_0, "")
                     else:
                         self.method_8(binaryWriter_0, Captions.GENERAL)
                     binaryWriter_0.write(str(1))
                     num1 = 0
                     if (qARecord.Type != QARecordType.Table):
                         num1 = 1
                     else:
                         tableType = qARecord.TableType
                         if (tableType == QATableType.General):
                             num1 = 0
                         elif (tableType == QATableType.OCAH):
                             num1 = 2
                         elif (tableType == QATableType.ObstacleList):
                             num1 = 3
                     binaryWriter_0.write(str(num1))
                     self.method_8(binaryWriter_0, "")
                     if (qARecord.Type != QARecordType.Table):
                         self.method_10(binaryWriter_0, qARecord.Value, False)
                     else:
                         self.method_10(binaryWriter_0, qARecord.Value, True)
                 for k in range(len(qARecord.Children)):
                     item1 = qARecord.Children[k]
                     self.method_8(binaryWriter_0, item1.Heading)
                     count1 = item1.Children.Count
                     if (item1.Type == QARecordType.Unknown):
                         binaryWriter_0.write(str(count1))
                     else:
                         binaryWriter_0.write(str(count1 + 1))
                         num2 = 0
                         if (item1.Type != QARecordType.Table):
                             num2 = 1
                         else:
                             qATableType = item1.TableType
                             if (qATableType == QATableType.General):
                                 num2 = 0
                             elif (qATableType == QATableType.OCAH):
                                 num2 = 2
                             elif (qATableType == QATableType.ObstacleList):
                                 num2 = 3
                         binaryWriter_0.write(str(num2))
                         if (len(item1.Children) <= 0):
                             self.method_8(binaryWriter_0, "")
                         else:
                             self.method_8(binaryWriter_0, Captions.GENERAL)
                         if (item1.Type != QARecordType.Table):
                             self.method_10(binaryWriter_0, item1.Value, False)
                         else:
                             self.method_10(binaryWriter_0, item1.Value, True)
                     for l in range(len(item1.Children)):
                         qARecord1 = item1.Children[l]
                         num3 = 0
                         if (qARecord1.Type != QARecordType.Table):
                             num3 = 1
                         else:
                             tableType1 = qARecord1.TableType
                             if (tableType1 == QATableType.General):
                                 num3 = 0
                             elif (tableType1 == QATableType.OCAH):
                                 num3 = 2
                             elif (tableType1 == QATableType.ObstacleList):
                                 num3 = 3
                         binaryWriter_0.write(str(num3))
                         self.method_8(binaryWriter_0, qARecord1.Heading)
                         if (qARecord1.Type != QARecordType.Table):
                             self.method_10(binaryWriter_0, qARecord1.Value, False)
                         else:
                             self.method_10(binaryWriter_0, qARecord1.Value, True)
         binaryWriter_0.write(str(6))
         if (i != len(self.sessions) - 1):
             binaryWriter_0.write(item.Stamp.toString())
         else:
             binaryWriter_0.write(QDateTime.currentDateTime().toString())
         if (i != len(self.sessions) - 1):
             binaryWriter_0.write(item.DwgSizeClosed)
         else:
             num4 = 0
             try:
                 fileInfo = QFileInfo(self.fileNameDWG)
                 num4 = round(float(fileInfo.size()) / float(1024), 2)
             except:
                 pass
             binaryWriter_0.write(str(num4))
Пример #15
0
    def ToString(self, formatStr=None):
        if formatStr == None:
            return self.ToString("G")
        num = 0.0
        num1 = 0.0
        num2 = 0.0
        if (self.IsNaN):
            return ""
        if (formatStr == None or formatStr == ""):
            formatStr = self.defaultformatStr
        # if (provider == null)
        # {
        #     provider = CultureInfo.CurrentCulture;
        # }
        # s = QString(45)
        # s.toUpper()

        if isinstance(formatStr, QString):
            formatStr = formatStr.toUpper()
        else:
            formatStr = formatStr.upper()
        if (formatStr == "G"):
            formatStr = self.defaultformatStr.upper()
        stringBuilder = StringBuilder()
        strS = None
        str1 = None
        str2 = None
        num3 = 0
        num4 = 0
        num5 = 0
        length = -1
        length1 = -1
        length2 = -1
        num6 = 0
        while (len(formatStr) > num6):
            chr = formatStr[num6]
            if (chr == 'D'):
                if (strS != None):
                    return None
                    # throw new ArgumentException("formatStr");
                strS = "0"
                num6 += 1
                flag = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'D'):
                        if (formatStr[num6] != '.'):
                            break
                        strS = String.Concat([strS, "."])
                        flag = True
                        num6 += 1
                    else:
                        strS = String.Concat([strS, "0"])
                        if (flag):
                            num3 += 1
                        num6 += 1
                length = stringBuilder.Length
            elif (chr == 'M'):
                if (strS == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str1 != None):
                    return None
                    # throw new ArgumentException("formatStr");
                str1 = "0"
                num6 += 1
                flag1 = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'M'):
                        if (formatStr[num6] != '.'):
                            break
                        str1 = String.Concat([str1, "."])
                        flag1 = True
                        num6 += 1
                    else:
                        str1 = String.Concat([str1, "0"])
                        if (flag1):
                            num4 += 1
                        num6 += 1
                length1 = stringBuilder.Length
            elif (chr == 'S'):
                if (strS == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str1 == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str2 != None):
                    return None
                    # throw new ArgumentException("formatStr");
                str2 = "0"
                num6 += 1
                flag2 = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'S'):
                        if (formatStr[num6] != '.'):
                            break
                        str2 = String.Concat([str2, "."])
                        flag2 = True
                        num6 += 1
                    else:
                        str2 = String.Concat([str2, "0"])
                        if (flag2):
                            num5 += 1
                        num6 += 1
                length2 = stringBuilder.Length
            elif (chr == 'H'):
                if (self.type == DegreesType.Latitude):
                    if (self.value >= 0):
                        stringBuilder.Append("N")
                    else:
                        stringBuilder.Append("S")
                elif (self.type == DegreesType.Longitude
                      or self.type == DegreesType.Variation):
                    if (self.value >= 0):
                        stringBuilder.Append("E")
                    else:
                        stringBuilder.Append("W")
                num6 += 1
            elif (chr != '-'):
                stringBuilder.Append(chr)
                num6 += 1
            else:
                if (self.value < 0):
                    stringBuilder.Append("-")
                num6 += 1
        if (str2 != None):
            num = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num7 = math.trunc(num)
            num8 = (num - num7) * 60
            num9 = math.trunc(num8)
            num10 = round((num8 - num9) * 60, num5)
            if (num10 >= 60):
                num10 = num10 - 60
                num9 = num9 + 1
            if (num9 >= 60):
                num9 = num9 - 60
                num7 = num7 + 1

            stringBuilder.Insert(length2, String.Number2String(num10, str2))
            stringBuilder.Insert(length1, String.Number2String(num9, str1))
            stringBuilder.Insert(length, String.Number2String(num7, strS))
        elif (str1 == None):
            if (strS == None):
                return None
                # throw new ArgumentException("formatStr");
            num2 = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num11 = round(num2, num3)
            stringBuilder.Insert(length, String.Number2String(num11, strS))
        else:
            num1 = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num12 = math.trunc(num1)
            num13 = round((num1 - num12) * 60, num4)
            if (num13 >= 60):
                num13 = num13 - 60
                num12 = num12 + 1
            stringBuilder.Insert(length1, String.Number2String(num13, str1))
            stringBuilder.Insert(length, String.Number2String(num12, strS))

        return stringBuilder.ToString()
Пример #16
0
 def get_DbCode(self):
     str0 = None;
     if self.type == SymbolType.Ad1:
         str0 = "ad1";
     elif self.type == SymbolType.Ad2:
         str0 = "ad2";
     elif self.type == SymbolType.Ad3:
         str0 = "ad3";
     elif self.type == SymbolType.Ad4:
         str0 = "ad4";
     elif self.type == SymbolType.Ad5:
         str0 = "ad5";
     elif self.type == SymbolType.Ad6:
         str0 = "ad6";
     elif self.type == SymbolType.Ad7:
         str0 = "ad7";
     elif self.type == SymbolType.Ad8:
         str0 = "ad8";
     elif self.type == SymbolType.Ad9:
         str0 = "ad9";
     elif self.type == SymbolType.Ad10:
         str0 = "ad10";
     elif self.type == SymbolType.Arp:
         str0 = "arp";
     elif self.type == SymbolType.Arr or \
         self.type == SymbolType.Box1 or \
         self.type == SymbolType.Box2 or \
         self.type == SymbolType.Box3 or \
         self.type == SymbolType.Box4 or \
         self.type == SymbolType.Brg or \
         self.type == SymbolType.Brg1 or \
         self.type == SymbolType.Dme_P or \
         self.type == SymbolType.Ils or \
         self.type == SymbolType.Imp0 or \
         self.type == SymbolType.Imp1 or \
         self.type == SymbolType.Imp2 or \
         self.type == SymbolType.Imp3 or \
         self.type == SymbolType.Imp4 or \
         self.type == SymbolType.Msab or \
         self.type == SymbolType.Msaa or \
         self.type == SymbolType.Ndb_P or \
         self.type == SymbolType.Rdh_P or \
         self.type == SymbolType.Sca1 or \
         self.type == SymbolType.Sca2 or \
         self.type == SymbolType.Sca3 or \
         self.type == SymbolType.TAlt_P or \
         self.type == SymbolType.Vare or \
         self.type == SymbolType.Varw or \
         self.type == SymbolType.Vortac_P:
         return "*";
     elif self.type == SymbolType.Be1:
         str0 = "be1";
     elif self.type == SymbolType.Be2:
         str0 = "be2";
     elif self.type == SymbolType.Church:
         str0 = "church";
     elif self.type == SymbolType.Dme:
         str0 = "dme";
     elif self.type == SymbolType.Loc:
         str0 = "loc";
     elif self.type == SymbolType.Faf:
         str0 = "faf";
     elif self.type == SymbolType.Flyb:
         str0 = "wpfb";
     elif self.type == SymbolType.Flyo:
         str0 = "wpfo";
     elif self.type == SymbolType.Gld:
         str0 = "gld";
     elif self.type == SymbolType.Gp:
         str0 = "gp";
     elif self.type == SymbolType.Hel:
         str0 = "hel";
     elif self.type == SymbolType.Lmm:
         str0 = "lmm";
     elif self.type == SymbolType.Mrp1:
         str0 = "mrpc";
     elif self.type == SymbolType.Mrp2:
         str0 = "mrpnc";
     elif self.type == SymbolType.Nav:
         str0 = "nav";
     elif self.type == SymbolType.Ndb:
         str0 = "ndb";
     elif self.type == SymbolType.Obst1:
         str0 = "obst1";
     elif self.type == SymbolType.Obst2:
         str0 = "obst2";
     elif self.type == SymbolType.Obst3:
         str0 = "obst3";
     elif self.type == SymbolType.Obst4:
         str0 = "obst4";
     elif self.type == SymbolType.Obst5:
         str0 = "obst5";
     elif self.type == SymbolType.Obst6:
         str0 = "obst6";
     elif self.type == SymbolType.Par:
         str0 = "par";
     elif self.type == SymbolType.Repc:
         str0 = "repc";
     elif self.type == SymbolType.Repnc:
         str0 = "repnc";
     elif self.type == SymbolType.Repv:
         str0 = "repv";
     elif self.type == SymbolType.Rvr:
         str0 = "rvr";
     elif self.type == SymbolType.Tacan:
         str0 = "tacan";
     elif self.type == SymbolType.Tree:
         str0 = "tree";
     elif self.type == SymbolType.Vor:
         str0 = "vor";
     elif self.type == SymbolType.Vord:
         str0 = "vord";
     elif self.type == SymbolType.Vortac:
         str0 = "vortac";
     elif self.type == SymbolType.Spot:
         str0 = "spot";
     elif self.type == SymbolType.SpotFt:
         str0 = "spotft";
     else:
         return "*";
     if (self.masked == None and not self.masked):
         return str0;
     str1 = String.Concat([str0, "m"]);
     str0 = str1;
     return str1;