def openData(self):
        try:
            fileName = FlightPlanBaseDlg.openData(self)
            if fileName == None:
                return
            doc = DataHelper.loadXmlDocFromFile(fileName)
            dialogNodeList = doc.elementsByTagName(self.objectName())
            if dialogNodeList.isEmpty():
                raise UserWarning, "self file is not correct."
            dialogElem = dialogNodeList.at(0).toElement()
            trackNodeList = dialogElem.elementsByTagName("Track")
            if trackNodeList.isEmpty():
                return
            elemTrack = trackNodeList.at(0).toElement()
            elemStart = elemTrack.elementsByTagName("StartPoint").at(
                0).toElement()
            elemEnd = elemTrack.elementsByTagName("EndPoint").at(0).toElement()

            x, y = DataHelper.getPointValueFromElem(elemStart)
            self.parametersPanel.txtTrack.captureRadialTool.startPoint = Point3D(
                x, y)

            x, y = DataHelper.getPointValueFromElem(elemEnd)
            self.parametersPanel.txtTrack.captureRadialTool.endPoint = Point3D(
                x, y)
        except BaseException as e:
            QMessageBox.warning(self, "Error", e.message)
    def getParameterList(self):
        parameterList = []
        parameterList.append(("general", "group"))
        parameterList.append(("Runway", "group"))
        DataHelper.pnlPositionParameter(self.parametersPanel.pnlTHR, parameterList)
        parameterList.append(("Direction", "Plan : " + QString(str(self.parametersPanel.txtRwyDir.txtRadialPlan.Value))))
        parameterList.append(("", "Geodetic : " + QString(str(self.parametersPanel.txtRwyDir.txtRadialGeodetic.Value))))


        parameterList.append(("Code", self.parametersPanel.cmbRwyCode.SelectedItem))
        if self.parametersPanel.cmbApproachType.SelectedIndex == 0:
            parameterList.append(("Strip Width", str(self.parametersPanel.txtStripWidth.Value.Metres) + " m"))
        
        parameterList.append(("Parameters", "group"))
        parameterList.append(("Approach Type", self.parametersPanel.cmbApproachType.SelectedItem))
        parameterList.append(("Descent Angle", QString(str(self.parametersPanel.txtDescAngle.Value.Degrees))))
        parameterList.append(("Minimum Altitude(%s)"%self.parametersPanel.pnlOCAH.cmbMCAH.currentText(), self.parametersPanel.pnlOCAH.txtMCAH.text() + " ft"))
        parameterList.append(("Construction Type", self.parametersPanel.cmbConstructionType.SelectedItem))
        if self.parametersPanel.cmbApproachType.SelectedIndex == 0:
            parameterList.append(("In-bound Track", "Plan : " + QString(str(self.parametersPanel.txtTrack.txtRadialPlan.Value))))
            parameterList.append(("", "Geodetic : " + QString(str(self.parametersPanel.txtTrack.txtRadialGeodetic.Value))))


            parameterList.append(("THR to FAF Distance", str(self.parametersPanel.txtThrFaf.Value.NauticalMiles) + " nm"))
                
        c = self.obstaclesModel.rowCount()
        parameterList.append(("Number of Checked Obstacles", str(c)))  
        return parameterList
 def saveData(self):
     fileName = FlightPlanBaseDlg.saveData(self)
     if fileName == None:
         return
     doc = DataHelper.loadXmlDocFromFile(fileName)
     dialogNodeList = doc.elementsByTagName(self.objectName())
     if dialogNodeList.isEmpty():
         raise UserWarning, "self file is not correct."
     dialogElem = dialogNodeList.at(0).toElement()
     elemTrack = doc.createElement("Track")
     
     elemStart = doc.createElement("StartPoint")
     elemX = doc.createElement("X")
     elemX.appendChild(doc.createTextNode(str(self.parametersPanel.txtTrack.captureRadialTool.startPoint.x())))
     elemY = doc.createElement("Y")
     elemY.appendChild(doc.createTextNode(str(self.parametersPanel.txtTrack.captureRadialTool.startPoint.y())))
     elemStart.appendChild(elemX)
     elemStart.appendChild(elemY)
     elemTrack.appendChild(elemStart)
     
     elemEnd = doc.createElement("EndPoint")
     elemX = doc.createElement("X")
     elemX.appendChild(doc.createTextNode(str(self.parametersPanel.txtTrack.captureRadialTool.endPoint.x())))
     elemY = doc.createElement("Y")
     elemY.appendChild(doc.createTextNode(str(self.parametersPanel.txtTrack.captureRadialTool.endPoint.y())))
     elemEnd.appendChild(elemX)
     elemEnd.appendChild(elemY)
     elemTrack.appendChild(elemEnd)
     dialogElem.appendChild(elemTrack)
     DataHelper.saveXmlDocToFile(fileName, doc)
    def exportResult(self):
        result, resultHideColumnNames = FlightPlanBaseDlg.exportResult(self)
        if not result:
            return

        filePathDir = QFileDialog.getSaveFileName(
            self, "Export Obstacle Data",
            QCoreApplication.applicationDirPath(),
            "ExportObstaclefiles(*.xml)")
        if filePathDir == "":
            return
        if self.ui.cmbSegmentType.SelectedIndex != 0:
            self.filterList = [
                "", PinsSurfaceType.PinsSurfaceType_LevelOIS,
                PinsSurfaceType.PinsSurfaceType_OCS
            ]
        else:
            self.filterList = ["", PinsSurfaceType.PinsSurfaceType_OIS]
#         self.ui.btnExportResult.setEnabled(True)

        parameterList = self.getParameterList()
        DataHelper.saveExportResult(filePathDir,
                                    "PinS Visual Segment for Departures",
                                    self.ui.tblObstacles, self.filterList,
                                    parameterList, resultHideColumnNames)
        self.obstaclesModel.setFilterFixedString(
            self.filterList[self.ui.cmbSurface.currentIndex()])
Ejemplo n.º 5
0
 def openData(self):
     try:
         filePathDir = QFileDialog.getOpenFileName(self, "Open Input Data",QCoreApplication.applicationDirPath (),"Xml Files(*.xml)")
         if filePathDir == "":
             return
         DataHelper.loadInputParameters(filePathDir, self)
         return filePathDir
     except UserWarning as e:
         QMessageBox.warning(self, "Error", e.message)
Ejemplo n.º 6
0
    def exportResult(self):
        result, resultHideColumnNames = FlightPlanBaseDlg.exportResult(self)
        if not result:
            return

        filePathDir = QFileDialog.getSaveFileName(self, "Export Obstacle Data", QCoreApplication.applicationDirPath (),"ExportObstaclefiles(*.xml)")
        if filePathDir == "":
            return
        parameterList = self.getParameterList()
        DataHelper.saveExportResult(filePathDir, self.surfaceType, self.ui.tblObstacles, None, parameterList, resultHideColumnNames)
    def exportResult(self):
        result, resultHideColumnNames = FlightPlanBaseDlg.exportResult(self)
        if not result:
            return
        
        filePathDir = QFileDialog.getSaveFileName(self, "Export Obstacle Data", QCoreApplication.applicationDirPath (),"ExportObstaclefiles(*.xml)")        
        if filePathDir == "":
            return   
        
#         self.ui.btnExportResult.setEnabled(True)     
        
        parameterList = self.getParameterList()
        DataHelper.saveExportResult(filePathDir, "PinS Visual Segment for Approaches", self.ui.tblObstacles, None, parameterList, resultHideColumnNames)
    def exportResult(self):
        filePathDir = QFileDialog.getSaveFileName(
            self, "Export Obstacle Data",
            QCoreApplication.applicationDirPath(),
            "ExportObstaclefiles(*.xml)")
        if filePathDir == "":
            return
#         self.filterList = []
#         for taaArea in self.taaCalculationAreas:
#             self.filterList.append(taaArea.title)
        parameterList = self.getParameterList()
        DataHelper.saveExportResult(filePathDir, SurfaceTypes.HoldingRnp,
                                    self.ui.tblObstacles, None, parameterList)
        #         self.obstaclesModel.setFilterFixedString(self.filterList[self.ui.cmbObstSurface.currentIndex()])
        return FlightPlanBaseDlg.exportResult(self)
    def openData(self):
        try:




            filePathDir = QFileDialog.getOpenFileName(self, "Open Input Data",QCoreApplication.applicationDirPath (),"Xml Files(*.xml)")
            if filePathDir == "":
                return

            layers = define._canvas.layers()
            if layers != None and len(layers) > 0:
                for layer in layers:
                    if layer.name() == "Symbols":
                        self.currentLayer = layer
                        try:
                            self.initAerodromeAndRwyCmb()
                        except:
                            pass
                        try:
                            self.initBasedOnCmb()
                        except:
                            pass
                        break

            # contents = None
            # with open(filePathDir, 'rb', 0) as tempFile:
            #     contents = tempFile.read()
            #     tempFile.close()
            # bytes = FasDataBlockFile.CRC_Calculation(contents)
            #
            # string_0 = QString(filePathDir)
            # crcFileDir = string_0.left(string_0.length() - 3) + "crc"
            # crcFileContents = None
            # with open(crcFileDir, 'rb', 0) as tempFileCrc:
            #     crcFileContents = tempFileCrc.read()
            #     tempFileCrc.close()
            # if bytes != crcFileContents:
            #     QMessageBox.warning(self, "Error", "Input file has been changed by outside.")
            #     return

            DataHelper.loadInputParameters(filePathDir, self)
            return filePathDir
        except UserWarning as e:
            QMessageBox.warning(self, "Error", e.message)
Ejemplo n.º 10
0
    def exportResult(self):
        result, resultHideColumnNames = FlightPlanBaseDlg.exportResult(self)
        if not result:
            return

        filePathDir = QFileDialog.getSaveFileName(
            self, "Export Obstacle Data",
            QCoreApplication.applicationDirPath(),
            "ExportObstaclefiles(*.xml)")
        if filePathDir == "":
            return
#         self.filterList = []
#         for taaArea in self.taaCalculationAreas:
#             self.filterList.append(taaArea.title)
        parameterList = self.getParameterList()
        DataHelper.saveExportResult(filePathDir, SurfaceTypes.HoldingRnp,
                                    self.ui.tblObstacles, None, parameterList,
                                    resultHideColumnNames)
    def saveData(self):
        try:
            filePathDir = QFileDialog.getSaveFileName(self, "Save Input Data",QCoreApplication.applicationDirPath (),"Xml Files(*.xml)")        
            if filePathDir == "":
                return
            DataHelper.saveInputParameters(filePathDir, self)

            # contents = None
            # with open(filePathDir, 'rb', 0) as tempFile:
            #     contents = tempFile.read()
            #     tempFile.flush()
            #     tempFile.close()
            # bytes = FasDataBlockFile.CRC_Calculation(contents)
            # string_0 = QString(filePathDir)
            # path = string_0.left(string_0.length() - 3) + "crc"
            # fileStream = open(path, 'wb')
            # fileStream.write(bytes)
            # fileStream.close()
            return filePathDir
        except UserWarning as e:
            QMessageBox.warning(self, "Error", e.message)
    def getParameterList(self):
        parameterList = []
        parameterList.append(("general", "group"))
        parameterList.append(("Parameters", "group"))
        parameterList.append(
            ("Visual Segment Type", self.ui.cmbSegmentType.SelectedItem))
        parameterList.append(
            ("VSDG", str(self.ui.txtVSDG.Value.Percent) + " %"))
        parameterList.append(
            ("Minimum(%s)" % self.pnlMCAH.cmbMCAH.currentText(),
             self.pnlMCAH.txtMCAH.text() + " ft"))
        parameterList.append(
            ("Construction Type", self.ui.cmbConstructionType.SelectedItem))
        if self.ui.cmbSegmentType.SelectedIndex != 0:
            parameterList.append(
                ("Departure Type", self.ui.cmbDepartureType.SelectedItem))
            parameterList.append(
                ("Out-bound Take-off Surface Track",
                 "Plan : " + str(self.parametersPanel.txtTakeOffSurfaceTrack.
                                 txtRadialPlan.Value) + define._degreeStr))
            parameterList.append(
                ("", "Geodetic : " +
                 str(self.parametersPanel.txtTakeOffSurfaceTrack.
                     txtRadialGeodetic.Value) + define._degreeStr))

            # parameterList.append(("Out-bound Take-off Surface Track", self.ui.txtTakeOffSurfaceTrack.Value + unicode(" °", "utf-8")))
            if self.ui.chbRightTurnProhibited.isChecked():
                parameterList.append(("Limitation", "Right turn prohibited"))
            else:
                parameterList.append(("Limitation", "Left turn prohibited"))
        else:
            parameterList.append(
                ("MOC", str(self.ui.txtMOC.Value.Metres) + " m"))
            parameterList.append(("", str(self.ui.txtMOC.Value.Feet) + " ft"))

        parameterList.append(("Initial Departure Fix (IDF)", "group"))
        #         parameterList.append(("X", self.pnlIDF.txtPointX.text()))
        #         parameterList.append(("Y", self.pnlIDF.txtPointY.text()))
        DataHelper.pnlPositionParameter(self.pnlIDF, parameterList)
        if self.ui.cmbSegmentType.SelectedIndex == 0:
            parameterList.append(
                ("Track From",
                 "Plan : " + str(self.ui.txtTrackFrom.txtRadialPlan.Value) +
                 define._degreeStr))
            parameterList.append(
                ("", "Geodetic : " +
                 str(self.ui.txtTrackFrom.txtRadialGeodetic.Value) +
                 define._degreeStr))

            # parameterList.append(("Track From", self.ui.txtTrackFrom.Value + unicode(" °", "utf-8")))

        parameterList.append(("Heliport", "group"))
        DataHelper.pnlPositionParameter(self.pnlHRP, parameterList)
        parameterList.append(
            ("Safety Area Length", str(self.ui.txtHSAL.Value.Metres) + " m"))
        parameterList.append(
            ("Safety Area Width", str(self.ui.txtHSAW.Value.Metres) + " m"))

        parameterList.append(("Results / Checked Obstacles", "group"))

        parameterList.append(("Checked Obstacles", "group"))

        for strFilter in self.filterList:
            self.obstaclesModel.setFilterFixedString(strFilter)
            c = self.obstaclesModel.rowCount()
            parameterList.append(
                ("Number of Checked Obstacles(%s)" % strFilter, str(c)))
        return parameterList