예제 #1
0
class Ui_NpaOnFix(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(435, 580)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))

        self.gbParameters = GroupBox(Form)
        self.gbParameters.Caption = "General"
        self.verticalLayout.addWidget(self.gbParameters)

        self.cmbAerodrome = ComboBoxPanel(self.gbParameters, True)
        self.cmbAerodrome.Caption = "Aerodrome"
        self.cmbAerodrome.LabelWidth = 150
        self.cmbAerodrome.Width = 150
        self.gbParameters.Add = self.cmbAerodrome

        self.cmbRwyDir = ComboBoxPanel(self.gbParameters, True)
        self.cmbRwyDir.Caption = "Runway Direction"
        self.cmbRwyDir.LabelWidth = 150
        self.cmbRwyDir.Width = 150
        self.gbParameters.Add = self.cmbRwyDir

        self.annotationFAWP = QgsTextAnnotationItem(define._canvas)
        self.annotationFAWP.setDocument(QTextDocument("FAF"))
        self.annotationFAWP.hide()

        self.pnlFafPosition = PositionPanel(self.gbParameters,
                                            self.annotationFAWP)
        self.pnlFafPosition.Caption = "FAF Position"
        self.pnlFafPosition.btnCalculater.hide()
        self.pnlFafPosition.hideframe_Altitude()
        self.gbParameters.Add = self.pnlFafPosition

        self.pnlThrPosition = PositionPanel(self.gbParameters)
        self.pnlThrPosition.Caption = "Threshold Position"
        self.pnlThrPosition.btnCalculater.hide()
        self.gbParameters.Add = self.pnlThrPosition

        # self.annotationMapt = QgsTextAnnotationItem(define._canvas)
        # self.annotationMapt.setDocument(QTextDocument("MAPt"))
        # self.annotationMapt.hide()

        self.pnlMaPtPosition = PositionPanel(self.gbParameters)
        self.pnlMaPtPosition.Caption = "MAPt Position"
        self.pnlMaPtPosition.btnCalculater.hide()
        self.pnlMaPtPosition.hideframe_Altitude()
        self.gbParameters.Add = self.pnlMaPtPosition

        self.pnlRwyEndPosition = PositionPanel(self.gbParameters)
        self.pnlRwyEndPosition.Caption = "Rwy End Position"
        self.pnlRwyEndPosition.btnCalculater.hide()
        self.pnlRwyEndPosition.hideframe_Altitude()
        self.gbParameters.Add = self.pnlRwyEndPosition
        self.pnlRwyEndPosition.Visible = False

        self.pnlInboundTrack = TrackRadialBoxPanel(self.gbParameters)
        self.pnlInboundTrack.Caption = "In-bound Track"
        self.pnlInboundTrack.LabelWidth = 150
        self.pnlInboundTrack.Enabled = False
        self.gbParameters.Add = self.pnlInboundTrack

        self.pnlEstimatedAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlEstimatedAltitude.Caption = "Estimated Altitude"
        self.pnlEstimatedAltitude.LabelWidth = 150
        self.pnlEstimatedAltitude.Value = Altitude(1000)
        self.gbParameters.Add = self.pnlEstimatedAltitude

        self.pnlAerodromeAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlAerodromeAltitude.Caption = "Aerodrome Altitude"
        self.pnlAerodromeAltitude.LabelWidth = 150
        self.pnlAerodromeAltitude.Value = Altitude(1000)
        self.gbParameters.Add = self.pnlAerodromeAltitude

        self.pnlIsa = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlIsa.CaptionUnits = define._degreeStr + "C"
        self.pnlIsa.Caption = "ISA"
        self.pnlIsa.LabelWidth = 150
        self.pnlIsa.Value = 15
        self.gbParameters.Add = self.pnlIsa

        self.cmbAircraftCategory = ComboBoxPanel(self.gbParameters)
        self.cmbAircraftCategory.Caption = "Aircraft Category"
        self.cmbAircraftCategory.LabelWidth = 150
        self.gbParameters.Add = self.cmbAircraftCategory

        # self.pnlHeightLoss = AltitudeBoxPanel(self.gbParameters)
        # self.pnlHeightLoss.Caption = "Height Loss"
        # self.pnlHeightLoss.LabelWidth = 150
        # self.gbParameters.Add = self.pnlHeightLoss

        self.pnlIas = SpeedBoxPanel(self.gbParameters)
        self.pnlIas.Caption = "IAS"
        self.pnlIas.LabelWidth = 150
        self.pnlIas.Value = Speed(100)
        self.pnlIas.Enabled = False
        self.gbParameters.Add = self.pnlIas

        self.pnlTas = SpeedBoxPanel(self.gbParameters)
        self.pnlTas.Caption = "TAS"
        self.pnlTas.Enabled = False
        self.pnlTas.LabelWidth = 150
        self.gbParameters.Add = self.pnlTas

        self.pnlWind = WindPanel(self.gbParameters)
        self.pnlWind.LabelWidth = 145
        self.gbParameters.Add = self.pnlWind

        self.pnlSocAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlSocAltitude.Caption = "SOC Altitude"
        self.pnlSocAltitude.LabelWidth = 150
        self.gbParameters.Add = self.pnlSocAltitude

        self.pnlDistFixTolerance = DistanceBoxPanel(self.gbParameters,
                                                    DistanceUnits.M,
                                                    DistanceUnits.NM)
        self.pnlDistFixTolerance.Caption = "FIX Tolerance"
        self.pnlDistFixTolerance.LabelWidth = 150
        self.pnlDistFixTolerance.Button = "coordinate_capture.png"
        self.pnlDistFixTolerance.Value = Distance(900)
        # self.pnlDistFixTolerance.Enabled = False
        self.gbParameters.Add = self.pnlDistFixTolerance

        self.pnlDistD = DistanceBoxPanel(self.gbParameters, DistanceUnits.M,
                                         DistanceUnits.NM)
        self.pnlDistD.Caption = "d(10kts/3s)"
        self.pnlDistD.LabelWidth = 150
        self.pnlDistD.Button = None
        self.pnlDistD.Value = Distance(900)
        self.pnlDistD.Enabled = False
        self.gbParameters.Add = self.pnlDistD

        self.pnlDistX = DistanceBoxPanel(self.gbParameters, DistanceUnits.M,
                                         DistanceUnits.NM)
        self.pnlDistX.Caption = "X(10kts/15s)"
        self.pnlDistX.LabelWidth = 150
        self.pnlDistX.Button = None
        self.pnlDistX.Value = Distance(900)
        self.pnlDistX.Enabled = False
        self.gbParameters.Add = self.pnlDistX

        self.pnlDistOfFafMapt = DistanceBoxPanel(self.gbParameters,
                                                 DistanceUnits.M,
                                                 DistanceUnits.NM)
        self.pnlDistOfFafMapt.Caption = "FAP-MAPt Distance"
        self.pnlDistOfFafMapt.LabelWidth = 150
        self.pnlDistOfFafMapt.Button = None
        self.pnlDistOfFafMapt.Enabled = False
        self.gbParameters.Add = self.pnlDistOfFafMapt

        self.pnlDistOfMaptThr = DistanceBoxPanel(self.gbParameters,
                                                 DistanceUnits.M,
                                                 DistanceUnits.NM)
        self.pnlDistOfMaptThr.Caption = "MAPt-THR Distance"
        self.pnlDistOfMaptThr.LabelWidth = 150
        self.pnlDistOfMaptThr.Button = None
        self.pnlDistOfMaptThr.Enabled = False
        self.gbParameters.Add = self.pnlDistOfMaptThr

        self.pnlDistOfMaptSoc = DistanceBoxPanel(self.gbParameters,
                                                 DistanceUnits.M,
                                                 DistanceUnits.NM)
        self.pnlDistOfMaptSoc.Caption = "MAPt-SOC Distance"
        self.pnlDistOfMaptSoc.LabelWidth = 150
        self.pnlDistOfMaptSoc.Button = None
        self.pnlDistOfMaptSoc.Enabled = False
        self.gbParameters.Add = self.pnlDistOfMaptSoc

        self.pnlDistOfSocThr = DistanceBoxPanel(self.gbParameters,
                                                DistanceUnits.M,
                                                DistanceUnits.NM)
        self.pnlDistOfSocThr.Caption = "THR-SOC Distance"
        self.pnlDistOfSocThr.LabelWidth = 150
        self.pnlDistOfSocThr.Button = None
        self.pnlDistOfSocThr.Enabled = False
        self.gbParameters.Add = self.pnlDistOfSocThr
예제 #2
0
class NpaOnFixDlg(FlightPlanBaseDlg):
    def __init__(self, parent, dlgType):

        FlightPlanBaseDlg.__init__(self, parent)

        # self.dlgType = dlgType

        self.setObjectName("PaIlsDlg")
        self.dlgType = dlgType
        if self.dlgType == "NpaOnFix":
            self.surfaceType = SurfaceTypes.NpaOnFix
        else:
            self.surfaceType = SurfaceTypes.NpaOverheadingNavaid
        self.initParametersPan()
        self.setWindowTitle(self.surfaceType)
        self.resize(540, 600)
        QgisHelper.matchingDialogSize(self, 650, 700)
        self.surfaceList = None
        self.manualPolygon = None

        self.mapToolPan = None
        self.toolSelectByPolygon = None

        self.accepted.connect(self.closed)
        self.rejected.connect(self.closed)

        self.wptLayer = None

        self.arpFeatureArray = []
        self.currentLayer = define._canvas.currentLayer()
        self.rwyFeatureArray = []
        self.rwyEndPosition = None
        self.initAerodromeAndRwyCmb()

        self.socRubber = None
        self.socAnnotation = QgsTextAnnotationItem(define._canvas)
        self.socAnnotation.setDocument(QTextDocument(Captions.SOC))
        self.socAnnotation.setFrameBackgroundColor(Qt.white)
        self.socAnnotation.setFrameSize(QSizeF(30, 20))
        self.socAnnotation.setFrameColor(Qt.magenta)
        self.socAnnotation.hide()
        self.socPoint3d = None

        self.daRubber = None
        self.daAnnotation = QgsTextAnnotationItem(define._canvas)
        self.daAnnotation.setDocument(QTextDocument(Captions.DA))
        self.daAnnotation.setFrameBackgroundColor(Qt.white)
        self.daAnnotation.setFrameSize(QSizeF(30, 20))
        self.daAnnotation.setFrameColor(Qt.magenta)
        self.daAnnotation.hide()
        self.daPoint3d = None

        self.annotationFAWP = self.parametersPanel.pnlFafPosition.annotation
        self.annotationMAPt = self.parametersPanel.pnlMaPtPosition.annotation
        # self.surfaceType = self.dlgType
    def initAerodromeAndRwyCmb(self):

        if self.currentLayer != None and self.currentLayer.isValid(
        ) and isinstance(self.currentLayer, QgsVectorLayer):
            self.arpFeatureArray = self.aerodromeAndRwyCmbFill(
                self.currentLayer, self.parametersPanel.cmbAerodrome, None,
                self.parametersPanel.cmbRwyDir)
            self.calcRwyBearing()

    def calcRwyBearing(self):
        try:
            point3dMapt = self.parametersPanel.pnlMaPtPosition.Point3d
            point3dFaf = self.parametersPanel.pnlFafPosition.Point3d
            if point3dMapt == None:
                self.parametersPanel.pnlInboundTrack.Value = 0.0
                return
            self.parametersPanel.pnlInboundTrack.Value = round(
                Unit.ConvertRadToDeg(
                    MathHelper.getBearing(point3dFaf, point3dMapt)), 4)
            # if point3dFaf == None:
            #     self.parametersPanel.pnlInboundTrack.Value = round(Unit.ConvertRadToDeg(MathHelper.getBearing(point3dThr, self.parametersPanel.pnlRwyEndPosition.Point3d)), 4)
            #     point3dFap = self.rwyEndPosition
            # else:
            #     self.parametersPanel.pnlInboundTrack.Value = round(Unit.ConvertRadToDeg(MathHelper.getBearing(point3dFap, point3dThr)), 4)
            self.showMarkDaSoc()
        except:
            pass


#         self.ui.horizontalLayout_6.addWidget(self.ui.frame_3)

    def aerodromeAndRwyCmbFill(self,
                               layer,
                               aerodromeCmbObj,
                               aerodromePositionPanelObj,
                               rwyDirCmbObj=None):
        idx = layer.fieldNameIndex('Type')
        idxName = layer.fieldNameIndex('Name')
        idxLat = layer.fieldNameIndex('Latitude')
        idxLong = layer.fieldNameIndex('Longitude')
        idxAltitude = layer.fieldNameIndex('Altitude')
        arpList = []
        arpFeatureList = []
        if idx >= 0:
            featIter = layer.getFeatures()
            for feat in featIter:
                attrValue = feat.attributes()[idx].toString()
                attrValue = QString(attrValue)
                attrValue = attrValue.replace(" ", "")
                attrValue = attrValue.toUpper()
                if attrValue == "AERODROMEREFERENCEPOINT":
                    arpList.append(attrValue)
                    arpFeatureList.append(feat)
            if len(arpList) != 0:

                i = -1
                attrValueList = []
                for feat in arpFeatureList:
                    attrValue = feat.attributes()[idxName].toString()
                    items = attrValueList
                    if len(items) != 0:
                        existFlag = False
                        for item in items:
                            if item == attrValue:
                                existFlag = True
                        if existFlag:
                            continue
                    attrValueList.append(attrValue)
                attrValueList.sort()
                # attrValueList.insert(0, "")
                aerodromeCmbObj.Items = attrValueList
                aerodromeCmbObj.SelectedIndex = 0

                # if idxAttributes
                for feat in arpFeatureList:
                    attrValue = feat.attributes()[idxName].toString()
                    if attrValue != aerodromeCmbObj.SelectedItem:
                        continue
                    attrValue = feat.attributes()[idxLat].toDouble()
                    lat = attrValue[0]

                    attrValue = feat.attributes()[idxLong].toDouble()
                    long = attrValue[0]

                    attrValue = feat.attributes()[idxAltitude].toDouble()
                    alt = attrValue[0]

                    # aerodromePositionPanelObj.Point3d = Point3D(long, lat, alt)
                    self.connect(aerodromeCmbObj, SIGNAL("Event_0"),
                                 self.aerodromeCmbObj_Event_0)
                    break
            if rwyDirCmbObj != None:
                idxAttr = layer.fieldNameIndex('Attributes')
                if idxAttr >= 0:
                    rwyFeatList = []
                    featIter = layer.getFeatures()
                    rwyDirCmbObjItems = []
                    for feat in featIter:
                        attrValue = feat.attributes()[idxAttr].toString()
                        if attrValue == aerodromeCmbObj.SelectedItem:
                            attrValue = feat.attributes()[idxName].toString()
                            s = attrValue.replace(" ", "")
                            compStr = s.left(6).toUpper()
                            if compStr == "THRRWY":
                                valStr = s.right(s.length() - 6)
                                rwyDirCmbObjItems.append(
                                    aerodromeCmbObj.SelectedItem + " RWY " +
                                    valStr)
                                rwyFeatList.append(feat)
                    rwyDirCmbObjItems.sort()
                    rwyDirCmbObj.Items = rwyDirCmbObjItems
                    self.connect(rwyDirCmbObj, SIGNAL("Event_0"),
                                 self.rwyDirCmbObj_Event_0)
                    self.rwyFeatureArray = rwyFeatList
        self.rwyDirCmbObj_Event_0()

        self.aerodromeCmbObj_Event_0()
        return arpFeatureList

    def rwyDirCmbObj_Event_0(self):
        if len(self.rwyFeatureArray) == 0:
            self.calcRwyBearing()
            return
        idxName = self.currentLayer.fieldNameIndex('Name')
        idxLat = self.currentLayer.fieldNameIndex('Latitude')
        idxLong = self.currentLayer.fieldNameIndex('Longitude')
        idxAltitude = self.currentLayer.fieldNameIndex('Altitude')
        idxAttr = self.currentLayer.fieldNameIndex('Attributes')
        # rwyFeatList = []
        featIter = self.currentLayer.getFeatures()
        # for feat in featIter:
        #     attrValue = feat.attributes()[idxAttr].toString()
        #     if attrValue == self.cmbAerodrome.SelectedItem:
        #         attrValue = feat.attributes()[idxName].toString()
        #         s = attrValue.replace(" ", "")
        #         compStr = s.left(6).toUpper()
        #         if compStr == "THRRWY":
        #             valStr = s.right(s.length() - 6)
        #             rwyFeatList.append(feat)
        for feat in self.rwyFeatureArray:
            attrValue = feat.attributes()[idxName].toString()
            attrValueStr = QString(attrValue)
            attrValueStr = attrValueStr.replace(
                " ", "").right(attrValueStr.length() - 3)
            itemStr = self.parametersPanel.cmbRwyDir.SelectedItem
            itemStr = QString(itemStr)
            itemStr = itemStr.replace(" ", "").right(itemStr.length() - 4)
            if attrValueStr != itemStr:
                continue
            latAttrValue = feat.attributes()[idxLat].toDouble()
            lat = latAttrValue[0]

            longAttrValue = feat.attributes()[idxLong].toDouble()
            long = longAttrValue[0]

            altAttrValue = feat.attributes()[idxAltitude].toDouble()
            alt = altAttrValue[0]

            self.parametersPanel.pnlThrPosition.Point3d = Point3D(
                long, lat, alt)

            valStr = None
            if attrValue.right(1).toUpper() == "L" or attrValue.right(
                    1).toUpper() == "R":
                s = attrValue.left(attrValue.length() - 1)
                valStr = s.right(2)
            else:
                valStr = attrValue.right(2)
            val = int(valStr)
            val += 18
            if val > 36:
                val -= 36
            newValStr = None
            if len(str(val)) == 1:
                newValStr = "0" + str(val)
            else:
                newValStr = str(val)
            otherAttrValue = attrValue.replace(valStr, newValStr)
            ss = otherAttrValue.right(1)
            if ss.toUpper() == "L":
                otherAttrValue = otherAttrValue.left(otherAttrValue.length() -
                                                     1) + "R"
            elif ss.toUpper() == "R":
                otherAttrValue = otherAttrValue.left(otherAttrValue.length() -
                                                     1) + "L"
            for feat in self.rwyFeatureArray:
                attrValue = feat.attributes()[idxName].toString()
                if attrValue != otherAttrValue:
                    continue
                latAttrValue = feat.attributes()[idxLat].toDouble()
                lat = latAttrValue[0]

                longAttrValue = feat.attributes()[idxLong].toDouble()
                long = longAttrValue[0]

                altAttrValue = feat.attributes()[idxAltitude].toDouble()
                alt = altAttrValue[0]

                self.parametersPanel.pnlRwyEndPosition.Point3d = Point3D(
                    long, lat, alt)
                break
            break
        self.calcRwyBearing()

    def aerodromeCmbObj_Event_0(self):
        if len(self.arpFeatureArray) == 0:
            return
        # self.parametersPanel.pnlArp.Point3d = None
        self.parametersPanel.pnlRwyEndPosition.Point3d = None
        self.parametersPanel.pnlThrPosition.Point3d = None
        idxName = self.currentLayer.fieldNameIndex('Name')
        idxLat = self.currentLayer.fieldNameIndex('Latitude')
        idxLong = self.currentLayer.fieldNameIndex('Longitude')
        idxAltitude = self.currentLayer.fieldNameIndex('Altitude')
        self.rwyFeatureArray = []
        # if idxAttributes
        for feat in self.arpFeatureArray:
            attrValue = feat.attributes()[idxName].toString()
            if attrValue != self.parametersPanel.cmbAerodrome.SelectedItem:
                continue
            attrValue = feat.attributes()[idxLat].toDouble()
            lat = attrValue[0]

            attrValue = feat.attributes()[idxLong].toDouble()
            long = attrValue[0]

            attrValue = feat.attributes()[idxAltitude].toDouble()
            alt = attrValue[0]

            # self.parametersPanel.pnlArp.Point3d = Point3D(long, lat, alt)
            break
        idxAttr = self.currentLayer.fieldNameIndex('Attributes')
        if idxAttr >= 0:
            self.parametersPanel.cmbRwyDir.Clear()
            rwyFeatList = []
            featIter = self.currentLayer.getFeatures()
            for feat in featIter:
                attrValue = feat.attributes()[idxAttr].toString()
                if attrValue == self.parametersPanel.cmbAerodrome.SelectedItem:
                    attrValue = feat.attributes()[idxName].toString()
                    s = attrValue.replace(" ", "")
                    compStr = s.left(6).toUpper()
                    if compStr == "THRRWY":
                        valStr = s.right(s.length() - 6)
                        self.parametersPanel.cmbRwyDir.Add(
                            self.parametersPanel.cmbAerodrome.SelectedItem +
                            " RWY " + valStr)
                        rwyFeatList.append(feat)
                        self.rwyFeatureArray = rwyFeatList
        self.rwyDirCmbObj_Event_0()

    def closed(self):
        if self.mapToolPan != None:
            self.mapToolPan.deactivate()
        if self.toolSelectByPolygon != None:
            self.toolSelectByPolygon.deactivate()

    def initObstaclesModel(self):
        self.obstaclesModel.MocMultiplier = self.parametersPanel.mocSpinBox.value(
        )
        return FlightPlanBaseDlg.initObstaclesModel(self)

    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 getParameterList(self):
        parameterList = []
        parameterList.append(("general", "group"))
        parameterList.append(
            ("RNAV Specification",
             self.parametersPanel.cmbRnavSpecification.SelectedItem))
        if self.parametersPanel.cmbRnavSpecification.SelectedIndex == 0:
            parameterList.append(
                ("ATT",
                 self.parametersPanel.pnlTolerances.txtAtt.text() + "nm"))
            parameterList.append(
                ("XTT",
                 self.parametersPanel.pnlTolerances.txtXtt.text() + "nm"))
            parameterList.append(
                ("1/2 A/W",
                 self.parametersPanel.pnlTolerances.txtAsw.text() + "nm"))
        else:
            if self.parametersPanel.cmbPhaseOfFlight.currentIndex() != 0:
                parameterList.append(
                    ("Aerodrome Reference Point(ARP)", "group"))
                longLatPoint = QgisHelper.Meter2Degree(
                    float(self.parametersPanel.pnlArp.txtPointX.text()),
                    float(self.parametersPanel.pnlArp.txtPointY.text()))

                parameterList.append(
                    ("Lat", self.parametersPanel.pnlArp.txtLat.Value))
                parameterList.append(
                    ("Lon", self.parametersPanel.pnlArp.txtLong.Value))
                parameterList.append(
                    ("X", self.parametersPanel.pnlArp.txtPointX.text()))
                parameterList.append(
                    ("Y", self.parametersPanel.pnlArp.txtPointY.text()))

        parameterList.append(("Waypoint", "group"))
        longLatPoint = QgisHelper.Meter2Degree(
            float(self.parametersPanel.pnlWaypoint1.txtPointX.text()),
            float(self.parametersPanel.pnlWaypoint1.txtPointY.text()))

        parameterList.append(
            ("Lat", self.parametersPanel.pnlWaypoint1.txtLat.Value))
        parameterList.append(
            ("Lon", self.parametersPanel.pnlWaypoint1.txtLong.Value))
        parameterList.append(
            ("X", self.parametersPanel.pnlWaypoint1.txtPointX.text()))
        parameterList.append(
            ("Y", self.parametersPanel.pnlWaypoint1.txtPointY.text()))

        parameterList.append(
            ("Cat.H", str(self.parametersPanel.chbCatH.Checked)))
        parameterList.append(
            (self.parametersPanel.chbCircularArcs.Caption,
             str(self.parametersPanel.chbCircularArcs.Checked)))

        parameterList.append(("Parameters", "group"))
        parameterList.append(
            ("Selection Mode",
             self.parametersPanel.cmbSelectionMode.SelectedItem))
        parameterList.append(
            ("In-bound Track", "Plan : " +
             str(self.parametersPanel.pnlInbound.txtRadialPlan.Value) +
             define._degreeStr))
        parameterList.append(
            ("", "Geodetic : " +
             str(self.parametersPanel.pnlInbound.txtRadialGeodetic.Value) +
             define._degreeStr))

        # parameterList.append(("In-bound Track", self.parametersPanel.txtInbound.Value))
        parameterList.append(
            ("Out-bound Track", "Plan : " +
             str(self.parametersPanel.pnlOutbound.txtRadialPlan.Value) +
             define._degreeStr))
        parameterList.append(
            ("", "Geodetic : " +
             str(self.parametersPanel.pnlOutbound.txtRadialGeodetic.Value) +
             define._degreeStr))

        # parameterList.append(("Out-bound Track", self.parametersPanel.txtOutbound.Value))
        parameterList.append(
            ("IAS", str(self.parametersPanel.pnlIas.Value.Knots) + "kts"))
        parameterList.append(
            ("Altitude",
             str(self.parametersPanel.pnlAltitude.Value.Feet) + "ft"))
        parameterList.append(("ISA", str(self.parametersPanel.pnlIsa.Value)))
        parameterList.append(
            ("Bank Angle", str(self.parametersPanel.pnlBankAngle.Value)))
        parameterList.append(
            ("Wind", str(self.parametersPanel.pnlWind.Value.Knots) + "kts"))
        parameterList.append(
            ("Primary Moc",
             str(self.parametersPanel.pnlPrimaryMoc.Value.Metres) + "m"))
        parameterList.append(
            ("Construction Type",
             self.parametersPanel.cmbConstructionType.SelectedItem))
        parameterList.append(
            ("MOCmultipiler", str(self.parametersPanel.mocSpinBox.value())))
        if self.parametersPanel.cmbConstructionType.SelectedIndex == 0:
            parameterList.append(
                ("Draw Waypoint Tolerance",
                 str(self.parametersPanel.chbDrawTolerance.Checked)))

        parameterList.append(("Results / Checked Obstacles", "group"))
        parameterList.append(("Checked Obstacles", "group"))
        c = self.obstaclesModel.rowCount()
        parameterList.append(("Number of Checked Obstacles", str(c)))
        return parameterList

    def uiStateInit(self):
        self.ui.grbMostCritical.setVisible(False)
        self.ui.grbResult_2.setVisible(False)
        self.ui.btnUpdateQA.setVisible(False)
        self.ui.btnUpdateQA_2.setVisible(False)
        self.ui.frm_cmbObstSurface.setVisible(False)
        self.ui.btnPDTCheck.setVisible(False)
        self.ui.tabCtrlGeneral.removeTab(2)
        self.ui.tabCtrlGeneral.removeTab(1)
        self.ui.btnEvaluate.setVisible(False)
        self.ui.btnConstruct.setVisible(False)
        #         self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click)
        return FlightPlanBaseDlg.uiStateInit(self)

    # def btnPDTCheck_Click(self):
    #     pdtResultStr = MathHelper.pdtCheckResultToString(float(self.parametersPanel.txtIsa.text()), Altitude(float(self.parametersPanel.txtAltitude.text()), AltitudeUnits.FT), float(self.parametersPanel.txtIas.text()), float(self.parametersPanel.txtTime.text()))
    #
    #     QMessageBox.warning(self, "PDT Check", pdtResultStr)
    def btnEvaluate_Click(self):

        # self.complexObstacleArea.ObstacleArea = None
        #
        # ObstacleTable.MocMultiplier = self.parametersPanel.mocSpinBox.value()
        # self.obstaclesModel = TurnProtectionAndObstacleAssessmentObstacles(self.complexObstacleArea, self.parametersPanel.pnlPrimaryMoc.Value, self.parametersPanel.pnlAltitude.Value, self.manualPolygon )

        FlightPlanBaseDlg.btnEvaluate_Click(self)
        self.ui.btnLocate.setEnabled(True)

    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return

    def outputResultMethod(self):
        self.manualPolygon = self.toolSelectByPolygon.polygonGeom

    def manualEvent(self, index):
        QgisHelper.ClearRubberBandInCanvas(define._canvas)
        self.manualPolygon = None

        if index != 0:
            self.toolSelectByPolygon = RubberBandPolygon(define._canvas)
            define._canvas.setMapTool(self.toolSelectByPolygon)
            self.connect(self.toolSelectByPolygon, SIGNAL("outputResult"),
                         self.outputResultMethod)
        else:
            self.mapToolPan = QgsMapToolPan(define._canvas)
            define._canvas.setMapTool(self.mapToolPan)

    def initParametersPan(self):
        ui = Ui_NpaOnFix()
        self.parametersPanel = ui
        FlightPlanBaseDlg.initParametersPan(self)

        if self.dlgType != "NpaOnFix":
            self.parametersPanel.pnlDistFixTolerance.Visible = False

        self.parametersPanel.cmbAircraftCategory.Items = [
            "A", "B", "C", "D", "E", "H", "Custom"
        ]

        self.connect(self.parametersPanel.pnlAerodromeAltitude,
                     SIGNAL("editingFinished"), self.altitudeChanged)
        self.connect(self.parametersPanel.pnlIas, SIGNAL("Event_0"),
                     self.altitudeChanged)
        self.connect(self.parametersPanel.pnlTas, SIGNAL("Event_0"),
                     self.showMarkDaSoc)
        self.connect(self.parametersPanel.pnlIsa, SIGNAL("editingFinished"),
                     self.altitudeChanged)
        self.connect(self.parametersPanel.pnlEstimatedAltitude,
                     SIGNAL("Event_0"), self.pnlEstimatedAltitude_Event_0)
        self.connect(self.parametersPanel.pnlEstimatedAltitude,
                     SIGNAL("editingFinished"), self.showMarkDaSoc)
        self.connect(self.parametersPanel.cmbAircraftCategory,
                     SIGNAL("Event_0"), self.cmbAircraftCategory_Event_0)
        # # self.connect(self.parametersPanel.cmbPhaseOfFlight, SIGNAL("Event_0"), self.cmbPhaseOfFlightChanged)
        # # self.connect(self.parametersPanel.cmbSelectionMode, SIGNAL("Event_0"), self.manualEvent)
        # self.connect(self.parametersPanel.pnlHeightLoss, SIGNAL("Event_0"), self.pnlHeightLoss_Event_0)
        self.connect(self.parametersPanel.pnlDistFixTolerance,
                     SIGNAL("editingFinished"), self.showMarkDaSoc)
        # self.connect(self.parametersPanel.pnlRDH, SIGNAL("editingFinished"), self.pnlRDH_Event_0)
        self.connect(self.parametersPanel.pnlDistX, SIGNAL("Event_0"),
                     self.showMarkDaSoc)
        # # self.connect(self.parametersPanel.cmbType2, SIGNAL("Event_0"), self.method_31)
        #
        self.connect(self.parametersPanel.pnlFafPosition,
                     SIGNAL("positionChanged"), self.calcRwyBearing)
        self.connect(self.parametersPanel.pnlMaPtPosition,
                     SIGNAL("positionChanged"), self.calcRwyBearing)
        self.connect(self.parametersPanel.pnlThrPosition,
                     SIGNAL("positionChanged"), self.showMarkDaSoc)

        self.parametersPanel.pnlFafPosition.btnCalculater.clicked.connect(
            self.pnlFafPosition_btnCalculater_clicked)
        self.parametersPanel.pnlMaPtPosition.btnCalculater.clicked.connect(
            self.pnlMaPtPosition_btnCalculater_clicked)

        #
        self.parametersPanel.cmbAircraftCategory.SelectedIndex = 0

        # self.putAircraftSpeed()
        self.altitudeChanged()
        # self.putWithInHeightLoss()
        self.calcSocAltitude()

    def pnlFafPosition_btnCalculater_clicked(self):
        self.gbFAWP = self.parametersPanel.pnlFafPosition
        dlg = CalcDlg(self, RnavCommonWaypoint.FAWP,
                      self.parametersPanel.cmbAircraftCategory.SelectedIndex,
                      None, None, [
                          self.parametersPanel.pnlThrPosition.Point3d,
                          self.parametersPanel.pnlRwyEndPosition.Point3d, None
                      ])
        dlg.setWindowTitle("Calculate FAF")
        dlg.groupBox_4.setVisible(False)
        dlg.groupBox_5.setVisible(False)
        dlg.resize(200, 100)

        dlg.txtForm.setText("")
        self.parameterCalcList = []
        dlg.txtDistance.setEnabled(True)
        self.annotationFAWP.show()
        dlg.show()

    def pnlMaPtPosition_btnCalculater_clicked(self):
        self.gbMAWP = self.parametersPanel.pnlMaPtPosition
        dlg = CalcDlg(self, RnavCommonWaypoint.MAWP,
                      self.parametersPanel.cmbAircraftCategory.SelectedIndex,
                      None, None, [
                          self.parametersPanel.pnlThrPosition.Point3d,
                          self.parametersPanel.pnlRwyEndPosition.Point3d, None
                      ])
        dlg.setWindowTitle("Calculate MAPt")
        dlg.groupBox_4.setVisible(False)
        dlg.groupBox_5.setVisible(False)
        dlg.resize(200, 100)

        dlg.txtForm.setText("")
        self.parameterCalcList = []
        dlg.txtDistance.setEnabled(True)
        self.annotationMAPt.show()
        dlg.show()

    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 calcDAndXDistance(self, speed_0, speed_1, double_0):
        return Distance((speed_0 + speed_1).MetresPerSecond * double_0).Metres

    def showMarkDaSoc(self):
        try:
            flag = FlightPlanBaseDlg.btnConstruct_Click(self)

            self.putDistances()

            point3dMapt = self.parametersPanel.pnlMaPtPosition.Point3d
            socLayer = AcadHelper.createVectorLayer(
                "SOC_MAPt_" + self.surfaceType, QGis.Point)
            AcadHelper.setGeometryAndAttributesInLayer(socLayer,
                                                       self.socPoint3d, False,
                                                       {"Caption": "SOC"})
            AcadHelper.setGeometryAndAttributesInLayer(socLayer, point3dMapt,
                                                       False,
                                                       {"Caption": "MAPt"})

            QgisHelper.appendToCanvas(define._canvas, [socLayer],
                                      self.surfaceType)

            palSetting = QgsPalLayerSettings()
            palSetting.readFromLayer(socLayer)
            palSetting.enabled = True
            palSetting.fieldName = "Caption"
            palSetting.isExpression = True
            palSetting.placement = QgsPalLayerSettings.AroundPoint
            palSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True,
                                              True, '8', "")
            palSetting.writeToLayer(socLayer)

            self.resultLayerList = [socLayer]

            return socLayer
        except:
            pass

    def pnlEstimatedAltitude_Event_0(self):
        self.calcSocAltitude()

    def cmbAircraftCategory_Event_0(self):
        self.putAircraftSpeed()
        self.showMarkDaSoc()

    def calcSocAltitude(self):
        # val = self.parametersPanel.pnlEstimatedAltitude.Value.Metres - self.parametersPanel.pnlHeightLoss.Value.Metres
        self.parametersPanel.pnlSocAltitude.Value = Altitude(
            self.parametersPanel.pnlEstimatedAltitude.Value.Metres)
        return self.parametersPanel.pnlEstimatedAltitude.Value.Metres

    def altitudeChanged(self):
        self.parametersPanel.pnlWind.setAltitude(
            self.parametersPanel.pnlAerodromeAltitude.Value)
        try:
            self.parametersPanel.pnlTas.Value = Speed.smethod_0(
                self.parametersPanel.pnlIas.Value,
                self.parametersPanel.pnlIsa.Value,
                self.parametersPanel.pnlAerodromeAltitude.Value)
            self.showMarkDaSoc()
        except:
            raise ValueError("Value Invalid")

    def WPT2Layer(self):
        mapUnits = define._canvas.mapUnits()
        if define._mapCrs == None:
            if mapUnits == QGis.Meters:
                resultLayer = QgsVectorLayer(
                    "Point?crs=EPSG:32633", "WPT_" +
                    self.surfaceType.replace(" ", "_").replace("-", "_"),
                    "memory")
            else:
                resultLayer = QgsVectorLayer(
                    "Point?crs=EPSG:4326", "WPT_" +
                    self.surfaceType.replace(" ", "_").replace("-", "_"),
                    "memory")
        else:
            resultLayer = QgsVectorLayer(
                "Point?crs=%s" % define._mapCrs.authid(),
                "WPT_" + self.surfaceType.replace(" ", "_").replace("-", "_"),
                "memory")
        shpPath = ""
        if define.obstaclePath != None:
            shpPath = define.obstaclePath
        elif define.xmlPath != None:
            shpPath = define.xmlPath
        else:
            shpPath = define.appPath
        er = QgsVectorFileWriter.writeAsVectorFormat(
            resultLayer,
            shpPath + "/" + "RnavTurningSegmentAnalyserWpt" + ".shp", "utf-8",
            resultLayer.crs())
        resultLayer = QgsVectorLayer(
            shpPath + "/" + "RnavTurningSegmentAnalyserWpt" + ".shp",
            "WPT_RnavTurningSegmentAnalyser", "ogr")

        fieldName = "CATEGORY"
        resultLayer.dataProvider().addAttributes(
            [QgsField(fieldName, QVariant.String)])
        resultLayer.startEditing()
        fields = resultLayer.pendingFields()
        i = 1
        feature = QgsFeature()
        feature.setFields(fields)

        feature.setGeometry(
            QgsGeometry.fromPoint(self.parametersPanel.pnlWaypoint1.Point3d))
        feature.setAttribute(fieldName, "Waypoint1")
        pr = resultLayer.dataProvider()
        pr.addFeatures([feature])
        # resultLayer.addFeature(feature)
        feature.setGeometry(
            QgsGeometry.fromPoint(self.parametersPanel.pnlWaypoint2.Point3d))
        feature.setAttribute(fieldName, "Waypoint2")
        pr = resultLayer.dataProvider()
        pr.addFeatures([feature])
        # resultLayer.addFeature(feature)
        resultLayer.commitChanges()

        renderCatFly = None
        if self.parametersPanel.cmbType1.SelectedIndex == 1:
            '''FlyOver'''

            symbolFlyOver = QgsSymbolV2.defaultSymbol(
                resultLayer.geometryType())
            symbolFlyOver.deleteSymbolLayer(0)
            svgSymLayer = QgsSvgMarkerSymbolLayerV2("Resource/flyover.svg",
                                                    10.0, 0.0)
            symbolFlyOver.appendSymbolLayer(svgSymLayer)
            renderCatFly = QgsRendererCategoryV2(0, symbolFlyOver, "Fly Over")
        elif self.parametersPanel.cmbType1.SelectedIndex == 0:
            '''FlyBy'''
            symbolFlyBy = QgsSymbolV2.defaultSymbol(resultLayer.geometryType())
            symbolFlyBy.deleteSymbolLayer(0)
            svgSymLayer = QgsSvgMarkerSymbolLayerV2("Resource/flyby.svg", 10.0,
                                                    0.0)
            symbolFlyBy.appendSymbolLayer(svgSymLayer)
            renderCatFly = QgsRendererCategoryV2(0, symbolFlyBy, "Fly By")
        else:
            return None
        WPT_EXPRESION = "CASE WHEN  \"CATEGORY\" = 'Waypoint1'  THEN 0 " + \
                                        "END"
        symRenderer = QgsCategorizedSymbolRendererV2(WPT_EXPRESION,
                                                     [renderCatFly])

        resultLayer.setRendererV2(symRenderer)
        return resultLayer

    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
예제 #3
0
class PaIlsDlg(FlightPlanBaseDlg):
    
    def __init__(self, parent, dlgType):



        FlightPlanBaseDlg.__init__(self, parent)

        self.dlgType = dlgType

        self.setObjectName("PaIlsDlg")
        self.surfaceType = self.dlgType
        self.initParametersPan()
        self.setWindowTitle(self.dlgType)
        self.resize(540, 600)
        QgisHelper.matchingDialogSize(self, 720, 700)
        self.surfaceList = None
        self.manualPolygon = None

        self.mapToolPan = None
        self.toolSelectByPolygon = None

        self.accepted.connect(self.closed)
        self.rejected.connect(self.closed)

        self.wptLayer = None

        self.arpFeatureArray = []
        self.currentLayer = define._canvas.currentLayer()
        self.rwyFeatureArray = []
        self.rwyEndPosition = None
        self.initAerodromeAndRwyCmb()
        
        self.socRubber = None
        self.socAnnotation = QgsTextAnnotationItem(define._canvas)
        self.socAnnotation.setDocument(QTextDocument(Captions.SOC))
        self.socAnnotation.setFrameBackgroundColor(Qt.white)
        self.socAnnotation.setFrameSize(QSizeF(30, 20))
        self.socAnnotation.setFrameColor(Qt.magenta)
        self.socAnnotation.hide()
        self.socPoint3d = None
        
        self.daRubber = None
        self.daAnnotation = QgsTextAnnotationItem(define._canvas)
        self.daAnnotation.setDocument(QTextDocument(Captions.DA))
        self.daAnnotation.setFrameBackgroundColor(Qt.white)
        self.daAnnotation.setFrameSize(QSizeF(30, 20))
        self.daAnnotation.setFrameColor(Qt.magenta)
        self.daAnnotation.hide()
        self.daPoint3d = None

        self.annotationFAWP = self.parametersPanel.pnlFapPosition.annotation
        self.surfaceType = self.dlgType
    def initAerodromeAndRwyCmb(self):

        if self.currentLayer != None and self.currentLayer.isValid() and isinstance(self.currentLayer, QgsVectorLayer):
            self.arpFeatureArray = self.aerodromeAndRwyCmbFill(self.currentLayer, self.parametersPanel.cmbAerodrome, None, self.parametersPanel.cmbRwyDir)
            self.calcRwyBearing()
    def calcRwyBearing(self):
        try:
            point3dThr = self.parametersPanel.pnlThrPosition.Point3d
            point3dFap = self.parametersPanel.pnlFapPosition.Point3d
            if point3dThr == None:
                self.parametersPanel.pnlInboundTrack.Value = 0.0
                return
            if point3dFap == None:
                self.parametersPanel.pnlInboundTrack.Value = round(Unit.ConvertRadToDeg(MathHelper.getBearing(point3dThr, self.parametersPanel.pnlRwyEndPosition.Point3d)), 4)
                point3dFap = self.rwyEndPosition
            else:
                self.parametersPanel.pnlInboundTrack.Value = round(Unit.ConvertRadToDeg(MathHelper.getBearing(point3dFap, point3dThr)), 4)
            self.showMarkDaSoc()
        except:
            pass


#         self.ui.horizontalLayout_6.addWidget(self.ui.frame_3)
    def aerodromeAndRwyCmbFill(self, layer, aerodromeCmbObj, aerodromePositionPanelObj, rwyDirCmbObj = None):
        idx = layer.fieldNameIndex('Type')
        idxName = layer.fieldNameIndex('Name')
        idxLat = layer.fieldNameIndex('Latitude')
        idxLong = layer.fieldNameIndex('Longitude')
        idxAltitude = layer.fieldNameIndex('Altitude')
        arpList = []
        arpFeatureList = []
        if idx >= 0:
            featIter = layer.getFeatures()
            for feat in featIter:
                attrValue = feat.attributes()[idx].toString()
                attrValue = QString(attrValue)
                attrValue = attrValue.replace(" ", "")
                attrValue = attrValue.toUpper()
                if attrValue == "AERODROMEREFERENCEPOINT":
                    arpList.append(attrValue)
                    arpFeatureList.append(feat)
            if len(arpList) != 0:

                i = -1
                attrValueList = []
                for feat in arpFeatureList:
                    attrValue = feat.attributes()[idxName].toString()
                    items = attrValueList
                    if len(items) != 0:
                        existFlag = False
                        for item in items:
                            if item == attrValue:
                                existFlag = True
                        if existFlag:
                            continue
                    attrValueList.append(attrValue)
                attrValueList.sort()
                # attrValueList.insert(0, "")
                aerodromeCmbObj.Items = attrValueList
                aerodromeCmbObj.SelectedIndex = 0

                # if idxAttributes
                for feat in arpFeatureList:
                    attrValue = feat.attributes()[idxName].toString()
                    if attrValue != aerodromeCmbObj.SelectedItem:
                        continue
                    attrValue = feat.attributes()[idxLat].toDouble()
                    lat = attrValue[0]

                    attrValue = feat.attributes()[idxLong].toDouble()
                    long = attrValue[0]

                    attrValue = feat.attributes()[idxAltitude].toDouble()
                    alt = attrValue[0]

                    # aerodromePositionPanelObj.Point3d = Point3D(long, lat, alt)
                    self.connect(aerodromeCmbObj, SIGNAL("Event_0"), self.aerodromeCmbObj_Event_0)
                    break
            if rwyDirCmbObj != None:
                idxAttr = layer.fieldNameIndex('Attributes')
                if idxAttr >= 0:
                    rwyFeatList = []
                    featIter = layer.getFeatures()
                    rwyDirCmbObjItems = []
                    for feat in featIter:
                        attrValue = feat.attributes()[idxAttr].toString()
                        if attrValue == aerodromeCmbObj.SelectedItem:
                            attrValue = feat.attributes()[idxName].toString()
                            s = attrValue.replace(" ", "")
                            compStr = s.left(6).toUpper()
                            if compStr == "THRRWY":
                                valStr = s.right(s.length() - 6)
                                rwyDirCmbObjItems.append(aerodromeCmbObj.SelectedItem + " RWY " + valStr)
                                rwyFeatList.append(feat)
                    rwyDirCmbObjItems.sort()
                    rwyDirCmbObj.Items = rwyDirCmbObjItems
                    self.connect(rwyDirCmbObj, SIGNAL("Event_0"), self.rwyDirCmbObj_Event_0)
                    self.rwyFeatureArray = rwyFeatList
        self.rwyDirCmbObj_Event_0()

        self.aerodromeCmbObj_Event_0()
        return arpFeatureList
    def rwyDirCmbObj_Event_0(self):
        if len(self.rwyFeatureArray) == 0:
            self.calcRwyBearing()
            return
        idxName = self.currentLayer.fieldNameIndex('Name')
        idxLat = self.currentLayer.fieldNameIndex('Latitude')
        idxLong = self.currentLayer.fieldNameIndex('Longitude')
        idxAltitude = self.currentLayer.fieldNameIndex('Altitude')
        idxAttr = self.currentLayer.fieldNameIndex('Attributes')
        # rwyFeatList = []
        featIter = self.currentLayer.getFeatures()
        # for feat in featIter:
        #     attrValue = feat.attributes()[idxAttr].toString()
        #     if attrValue == self.cmbAerodrome.SelectedItem:
        #         attrValue = feat.attributes()[idxName].toString()
        #         s = attrValue.replace(" ", "")
        #         compStr = s.left(6).toUpper()
        #         if compStr == "THRRWY":
        #             valStr = s.right(s.length() - 6)
        #             rwyFeatList.append(feat)
        for feat in self.rwyFeatureArray:
            attrValue = feat.attributes()[idxName].toString()
            attrValueStr = QString(attrValue)
            attrValueStr = attrValueStr.replace(" ", "").right(attrValueStr.length() - 3)
            itemStr = self.parametersPanel.cmbRwyDir.SelectedItem
            itemStr = QString(itemStr)
            itemStr = itemStr.replace(" ", "").right(itemStr.length() - 4)
            if attrValueStr != itemStr:
                continue
            latAttrValue = feat.attributes()[idxLat].toDouble()
            lat = latAttrValue[0]

            longAttrValue = feat.attributes()[idxLong].toDouble()
            long = longAttrValue[0]

            altAttrValue = feat.attributes()[idxAltitude].toDouble()
            alt = altAttrValue[0]

            self.parametersPanel.pnlThrPosition.Point3d = Point3D(long, lat, alt)

            valStr = None
            if attrValue.right(1).toUpper() =="L" or attrValue.right(1).toUpper() =="R":
                s = attrValue.left(attrValue.length() - 1)
                valStr = s.right(2)
            else:
                valStr = attrValue.right(2)
            val = int(valStr)
            val += 18
            if val > 36:
                val -= 36
            newValStr = None
            if len(str(val)) == 1:
                newValStr = "0" + str(val)
            else:
                newValStr = str(val)
            otherAttrValue = attrValue.replace(valStr, newValStr)
            ss = otherAttrValue.right(1)
            if ss.toUpper() == "L":
                otherAttrValue = otherAttrValue.left(otherAttrValue.length() - 1) + "R"
            elif ss.toUpper() == "R":
                otherAttrValue = otherAttrValue.left(otherAttrValue.length() - 1) + "L"
            for feat in self.rwyFeatureArray:
                attrValue = feat.attributes()[idxName].toString()
                if attrValue != otherAttrValue:
                    continue
                latAttrValue = feat.attributes()[idxLat].toDouble()
                lat = latAttrValue[0]

                longAttrValue = feat.attributes()[idxLong].toDouble()
                long = longAttrValue[0]

                altAttrValue = feat.attributes()[idxAltitude].toDouble()
                alt = altAttrValue[0]

                self.parametersPanel.pnlRwyEndPosition.Point3d = Point3D(long, lat, alt)
                break
            break
        self.calcRwyBearing()
    def aerodromeCmbObj_Event_0(self):
        if len(self.arpFeatureArray) == 0:
            return
        # self.parametersPanel.pnlArp.Point3d = None
        self.parametersPanel.pnlRwyEndPosition.Point3d = None
        self.parametersPanel.pnlThrPosition.Point3d = None
        idxName = self.currentLayer.fieldNameIndex('Name')
        idxLat = self.currentLayer.fieldNameIndex('Latitude')
        idxLong = self.currentLayer.fieldNameIndex('Longitude')
        idxAltitude = self.currentLayer.fieldNameIndex('Altitude')
        self.rwyFeatureArray = []
        # if idxAttributes
        for feat in self.arpFeatureArray:
            attrValue = feat.attributes()[idxName].toString()
            if attrValue != self.parametersPanel.cmbAerodrome.SelectedItem:
                continue
            attrValue = feat.attributes()[idxLat].toDouble()
            lat = attrValue[0]

            attrValue = feat.attributes()[idxLong].toDouble()
            long = attrValue[0]

            attrValue = feat.attributes()[idxAltitude].toDouble()
            alt = attrValue[0]

            # self.parametersPanel.pnlArp.Point3d = Point3D(long, lat, alt)
            break
        idxAttr = self.currentLayer.fieldNameIndex('Attributes')
        if idxAttr >= 0:
            self.parametersPanel.cmbRwyDir.Clear()
            rwyFeatList = []
            featIter = self.currentLayer.getFeatures()
            for feat in featIter:
                attrValue = feat.attributes()[idxAttr].toString()
                if attrValue == self.parametersPanel.cmbAerodrome.SelectedItem:
                    attrValue = feat.attributes()[idxName].toString()
                    s = attrValue.replace(" ", "")
                    compStr = s.left(6).toUpper()
                    if compStr == "THRRWY":
                        valStr = s.right(s.length() - 6)
                        self.parametersPanel.cmbRwyDir.Add(self.parametersPanel.cmbAerodrome.SelectedItem + " RWY " + valStr)
                        rwyFeatList.append(feat)
                        self.rwyFeatureArray = rwyFeatList
        self.rwyDirCmbObj_Event_0()

    def closed(self):
        if self.mapToolPan != None:
            self.mapToolPan.deactivate()
        if self.toolSelectByPolygon != None:
            self.toolSelectByPolygon.deactivate()
    def initObstaclesModel(self):
        self.obstaclesModel.MocMultiplier = self.parametersPanel.mocSpinBox.value()
        return FlightPlanBaseDlg.initObstaclesModel(self)


    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 getParameterList(self):
        parameterList = []
        parameterList.append(("general", "group"))
        parameterList.append(("RNAV Specification", self.parametersPanel.cmbRnavSpecification.SelectedItem))
        if self.parametersPanel.cmbRnavSpecification.SelectedIndex == 0:
            parameterList.append(("ATT", self.parametersPanel.pnlTolerances.txtAtt.text() + "nm"))
            parameterList.append(("XTT", self.parametersPanel.pnlTolerances.txtXtt.text() + "nm"))
            parameterList.append(("1/2 A/W", self.parametersPanel.pnlTolerances.txtAsw.text() + "nm"))
        else:
            if self.parametersPanel.cmbPhaseOfFlight.currentIndex() != 0:
                parameterList.append(("Aerodrome Reference Point(ARP)", "group"))
                longLatPoint = QgisHelper.Meter2Degree(float(self.parametersPanel.pnlArp.txtPointX.text()), float(self.parametersPanel.pnlArp.txtPointY.text()))

                parameterList.append(("Lat", self.parametersPanel.pnlArp.txtLat.Value))
                parameterList.append(("Lon", self.parametersPanel.pnlArp.txtLong.Value))
                parameterList.append(("X", self.parametersPanel.pnlArp.txtPointX.text()))
                parameterList.append(("Y", self.parametersPanel.pnlArp.txtPointY.text()))

        parameterList.append(("Waypoint", "group"))
        longLatPoint = QgisHelper.Meter2Degree(float(self.parametersPanel.pnlWaypoint1.txtPointX.text()), float(self.parametersPanel.pnlWaypoint1.txtPointY.text()))

        parameterList.append(("Lat", self.parametersPanel.pnlWaypoint1.txtLat.Value))
        parameterList.append(("Lon", self.parametersPanel.pnlWaypoint1.txtLong.Value))
        parameterList.append(("X", self.parametersPanel.pnlWaypoint1.txtPointX.text()))
        parameterList.append(("Y", self.parametersPanel.pnlWaypoint1.txtPointY.text()))

        parameterList.append(("Cat.H", str(self.parametersPanel.chbCatH.Checked)))
        parameterList.append((self.parametersPanel.chbCircularArcs.Caption, str(self.parametersPanel.chbCircularArcs.Checked)))

        parameterList.append(("Parameters", "group"))
        parameterList.append(("Selection Mode", self.parametersPanel.cmbSelectionMode.SelectedItem))
        parameterList.append(("In-bound Track", "Plan : " + str(self.parametersPanel.pnlInbound.txtRadialPlan.Value) + define._degreeStr))
        parameterList.append(("", "Geodetic : " + str(self.parametersPanel.pnlInbound.txtRadialGeodetic.Value) + define._degreeStr))

        # parameterList.append(("In-bound Track", self.parametersPanel.txtInbound.Value))
        parameterList.append(("Out-bound Track", "Plan : " + str(self.parametersPanel.pnlOutbound.txtRadialPlan.Value) + define._degreeStr))
        parameterList.append(("", "Geodetic : " + str(self.parametersPanel.pnlOutbound.txtRadialGeodetic.Value) + define._degreeStr))

        # parameterList.append(("Out-bound Track", self.parametersPanel.txtOutbound.Value))
        parameterList.append(("IAS", str(self.parametersPanel.pnlIas.Value.Knots) + "kts"))
        parameterList.append(("Altitude", str(self.parametersPanel.pnlAltitude.Value.Feet) + "ft"))
        parameterList.append(("ISA", str(self.parametersPanel.pnlIsa.Value)))
        parameterList.append(("Bank Angle", str(self.parametersPanel.pnlBankAngle.Value)))
        parameterList.append(("Wind", str(self.parametersPanel.pnlWind.Value.Knots) + "kts"))
        parameterList.append(("Primary Moc", str(self.parametersPanel.pnlPrimaryMoc.Value.Metres) + "m"))
        parameterList.append(("Construction Type", self.parametersPanel.cmbConstructionType.SelectedItem))
        parameterList.append(("MOCmultipiler", str(self.parametersPanel.mocSpinBox.value())))
        if self.parametersPanel.cmbConstructionType.SelectedIndex == 0:
            parameterList.append(("Draw Waypoint Tolerance", str(self.parametersPanel.chbDrawTolerance.Checked)))

        parameterList.append(("Results / Checked Obstacles", "group"))
        parameterList.append(("Checked Obstacles", "group"))
        c = self.obstaclesModel.rowCount()
        parameterList.append(("Number of Checked Obstacles", str(c)))
        return parameterList

    def uiStateInit(self):
        self.ui.grbMostCritical.setVisible(False)
        self.ui.grbResult_2.setVisible(False)
        self.ui.btnUpdateQA.setVisible(False)
        self.ui.btnUpdateQA_2.setVisible(False)
        self.ui.frm_cmbObstSurface.setVisible(False)
        self.ui.btnPDTCheck.setVisible(False)
        self.ui.tabCtrlGeneral.removeTab(2)
        self.ui.tabCtrlGeneral.removeTab(1)
        self.ui.btnEvaluate.setVisible(False)
        self.ui.btnConstruct.setVisible(False)
#         self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click)
        return FlightPlanBaseDlg.uiStateInit(self)


    # def btnPDTCheck_Click(self):
    #     pdtResultStr = MathHelper.pdtCheckResultToString(float(self.parametersPanel.txtIsa.text()), Altitude(float(self.parametersPanel.txtAltitude.text()), AltitudeUnits.FT), float(self.parametersPanel.txtIas.text()), float(self.parametersPanel.txtTime.text()))
    #
    #     QMessageBox.warning(self, "PDT Check", pdtResultStr)
    def btnEvaluate_Click(self):

        self.complexObstacleArea.ObstacleArea = None

        ObstacleTable.MocMultiplier = self.parametersPanel.mocSpinBox.value()
        # self.obstaclesModel = TurnProtectionAndObstacleAssessmentObstacles(self.complexObstacleArea, self.parametersPanel.pnlPrimaryMoc.Value, self.parametersPanel.pnlAltitude.Value, self.manualPolygon )


        FlightPlanBaseDlg.btnEvaluate_Click(self)
        self.ui.btnLocate.setEnabled(True)



    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return





    def outputResultMethod(self):
        self.manualPolygon = self.toolSelectByPolygon.polygonGeom
    def manualEvent(self, index):
        QgisHelper.ClearRubberBandInCanvas(define._canvas)
        self.manualPolygon  = None

        if index != 0:
            self.toolSelectByPolygon = RubberBandPolygon(define._canvas)
            define._canvas.setMapTool(self.toolSelectByPolygon)
            self.connect(self.toolSelectByPolygon, SIGNAL("outputResult"), self.outputResultMethod)
        else:
            self.mapToolPan = QgsMapToolPan(define._canvas)
            define._canvas.setMapTool(self.mapToolPan )
    def getVPA(self):
        num = 2.5
        for i in range(0, self.parametersPanel.cmbVPA.SelectedIndex):
            num = num + 0.1
        return num
    def putWithInHeightLoss(self):
        if self.parametersPanel.cmbAircraftCategory.SelectedIndex == AircraftSpeedCategory.H:
            self.parametersPanel.pnlHeightLoss.Value = Altitude(35)
            return
        try:
            num = self.getVPA()
            num1 = self.parametersPanel.pnlThrPosition.Altitude().Metres
            num2 = self.parametersPanel.pnlIas.Value.Knots
            num3 = round(0.125 * num2 + 28.3)
            num4 = round(0.177 * num2 - 3.2)
            num5 = 0
            if (num1 > 900):
                num5 = num5 + num4 * 0.02 * (num1 / 300)
            if (num > 3.2):
                num5 = num5 + num4 * 0.05 * ((num - 3.2) / 0.1)
            num5 = MathHelper.smethod_0(num5, 0)
            self.parametersPanel.pnlHeightLoss.Value = Altitude(num3 + num5)
        except:
             self.parametersPanel.pnlHeightLoss.Value = Altitude(0.0)

    def initParametersPan(self):
        ui = Ui_PaIls()
        self.parametersPanel = ui
        FlightPlanBaseDlg.initParametersPan(self)

        items = []
        for i in range(25, 71):
            num = float(i) / 10
            items.append(QString(str(num)) + define._degreeStr)
        self.parametersPanel.cmbVPA.Items = items
        self.parametersPanel.cmbVPA.SelectedIndex = 5

        self.parametersPanel.cmbAircraftCategory.Items = ["A", "B", "C", "D", "E", "H", "Custom"]


        # self.parametersPanel.pnlWind.setAltitude(self.parametersPanel.pnlAltitude.Value)
        #
        # self.parametersPanel.cmbSelectionMode.Items = ["Automatic", "Manual"]
        #
        # self.parametersPanel.cmbConstructionType.Items = ["2D", "3D"]
        # self.parametersPanel.cmbType1.Items = ["Fly-By", "Fly-Over", "RF"]
        # self.parametersPanel.cmbType2.Items = ["Fly-By", "Fly-Over", "RF"]
        #
        # self.parametersPanel.cmbRnavSpecification.Items = ["", "Rnav5", "Rnav2", "Rnav1", "Rnp4", "Rnp2", "Rnp1", "ARnp2", "ARnp1", "ARnp09", "ARnp08", "ARnp07", "ARnp06", "ARnp05", "ARnp04", "ARnp03", "RnpApch"]
        #
        #
        self.connect(self.parametersPanel.pnlAerodromeAltitude, SIGNAL("Event_0"), self.altitudeChanged)
        self.connect(self.parametersPanel.pnlIas, SIGNAL("Event_0"), self.altitudeChanged)
        self.connect(self.parametersPanel.pnlIsa, SIGNAL("Event_0"), self.altitudeChanged)
        self.connect(self.parametersPanel.pnlEstimatedAltitude, SIGNAL("Event_0"), self.pnlEstimatedAltitude_Event_0)
        self.connect(self.parametersPanel.pnlEstimatedAltitude, SIGNAL("editingFinished"), self.showMarkDaSoc)
        self.connect(self.parametersPanel.cmbVPA, SIGNAL("Event_0"), self.cmbVPA_Event_0)
        self.connect(self.parametersPanel.cmbAircraftCategory, SIGNAL("Event_0"), self.cmbAircraftCategory_Event_0)
        # self.connect(self.parametersPanel.cmbPhaseOfFlight, SIGNAL("Event_0"), self.cmbPhaseOfFlightChanged)
        # self.connect(self.parametersPanel.cmbSelectionMode, SIGNAL("Event_0"), self.manualEvent)
        self.connect(self.parametersPanel.pnlHeightLoss, SIGNAL("Event_0"), self.pnlHeightLoss_Event_0)
        self.connect(self.parametersPanel.pnlHeightLoss, SIGNAL("editingFinished"), self.showMarkDaSoc)
        self.connect(self.parametersPanel.pnlRDH, SIGNAL("editingFinished"), self.pnlRDH_Event_0)
        self.connect(self.parametersPanel.pnlDistXz, SIGNAL("Event_0"), self.showMarkDaSoc)
        # self.connect(self.parametersPanel.cmbType2, SIGNAL("Event_0"), self.method_31)
        #
        self.connect(self.parametersPanel.pnlFapPosition, SIGNAL("positionChanged"), self.calcRwyBearing)
        self.connect(self.parametersPanel.pnlThrPosition, SIGNAL("positionChanged"), self.calcRwyBearing)

        self.parametersPanel.pnlFapPosition.btnCalculater.clicked.connect(self.pnlFapPosition_btnCalculater_clicked)
        #
        self.parametersPanel.cmbAircraftCategory.SelectedIndex = 0

        self.putAircraftSpeed()
        self.altitudeChanged()
        self.putWithInHeightLoss()
        self.calcSocAltitude()
        self.putDistances()




    def pnlFapPosition_btnCalculater_clicked(self):
        self.gbFAWP = self.parametersPanel.pnlFapPosition
        dlg = CalcDlg(self, RnavCommonWaypoint.FAWP, self.parametersPanel.cmbAircraftCategory.SelectedIndex, None, None, [self.parametersPanel.pnlThrPosition.Point3d, self.parametersPanel.pnlRwyEndPosition.Point3d, None])
        dlg.setWindowTitle("Calculate FAP")
        dlg.groupBox_4.setVisible(False)
        dlg.groupBox_5.setVisible(False)
        dlg.resize(200,100)

        dlg.txtForm.setText("")
        self.parameterCalcList = []
        # if len(self.parameterCalcList) > 0 and self.parameterCalcList[0] != None :
        #     str1, str2 = self.parameterCalcList[0]
        #     calcFAWPDlg.txtBearing.setText(str1)
        #     calcFAWPDlg.txtDistance.setText(str2)
#         calcFAWPDlg.txtBearing.setText("007.86")
#         calcFAWPDlg.txtDistance.setText("")
        dlg.txtDistance.setEnabled(True)
        self.annotationFAWP.show()
        dlg.show()
        # dlg = None
        # if self.parametersPanel.pnlRwyEndPosition.Point3d == None:
        #     dlg = DlgFapCalcPosition(self, self.parametersPanel.pnlThrPosition, None, self.parametersPanel.pnlInboundTrack.Value)
        # else:
        #     dlg = DlgFapCalcPosition(self, self.parametersPanel.pnlThrPosition, self.parametersPanel.pnlRwyEndPosition.Point3d)
        # dlg.show()
# `       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))

    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 showMarkDaSoc(self):
        try:
            flag = FlightPlanBaseDlg.btnConstruct_Click(self)
            # if not flag:
            #     return
            point3dThr = self.parametersPanel.pnlThrPosition.Point3d
            point3dFaf = self.parametersPanel.pnlFapPosition.Point3d
            inboundTrackRad = Unit.ConvertDegToRad(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)

            sockBearing = inboundTrackRad
            # if socThrDistMeters < 0:
            #     sockBearing = inboundTrack180Rad
            #     socThrDistMeters = math.fabs(socThrDistMeters)
            # else:
            #     sockBearing = inboundTrackRad
            daBearing = inboundTrack180Rad
            # if daThrDistMeters < 0:
            #     daBearing = inboundTrackRad
            #     daThrDistMeters = math.fabs(daThrDistMeters)
            # else:
            #     daBearing = inboundTrack180Rad
            self.socPoint3d = MathHelper.distanceBearingPoint(point3dThr, sockBearing, -socThrDistMeters).smethod_167(self.calcSocAltitude())
            self.daPoint3d = MathHelper.distanceBearingPoint(point3dThr, daBearing, daThrDistMeters)

            daSocLayer = AcadHelper.createVectorLayer("DA_SOC_" + self.surfaceType, QGis.Point)
            AcadHelper.setGeometryAndAttributesInLayer(daSocLayer, self.socPoint3d, False, {"Caption":"SOC"})
            AcadHelper.setGeometryAndAttributesInLayer(daSocLayer, self.daPoint3d, False, {"Caption":"DA"})

            QgisHelper.appendToCanvas(define._canvas, [daSocLayer], self.surfaceType)

            palSetting = QgsPalLayerSettings()
            palSetting.readFromLayer(daSocLayer)
            palSetting.enabled = True
            palSetting.fieldName = "Caption"
            palSetting.isExpression = True
            palSetting.placement = QgsPalLayerSettings.AroundPoint
            palSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True, True, '8', "")
            palSetting.writeToLayer(daSocLayer)

            QgisHelper.zoomToLayers([daSocLayer])
            self.resultLayerList = [daSocLayer]

            # # show SOC Mark
            # point3d = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - 0, 100)
            # point3d1 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - math.pi / 2, 100)
            # point3d2 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - math.pi, 100)
            # point3d3 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - (math.pi * 3) / 2 , 100)
            #
            # if self.socRubber == None:
            #     self.socRubber = QgsRubberBand(define._canvas, QGis.Line)
            #     self.socRubber.setColor(Qt.yellow)
            # else:
            #     self.socRubber.reset(QGis.Line)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline([point3d, point3d2]), None)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline([point3d1, point3d3]), None)
            # circle = MathHelper.constructCircle(self.socPoint3d, 100, 16)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline(circle), None)
            # self.socRubber.show()
            #
            # self.socAnnotation.setMapPosition(self.socPoint3d)
            # self.socAnnotation.show()
            #
            # # show DA Mark
            # point3d = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - 0, 100)
            # point3d1 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - math.pi / 2, 100)
            # point3d2 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - math.pi, 100)
            # point3d3 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - (math.pi * 3) / 2 , 100)
            #
            # if self.daRubber == None:
            #     self.daRubber = QgsRubberBand(define._canvas, QGis.Line)
            #     self.daRubber.setColor(Qt.yellow)
            # else:
            #     self.daRubber.reset(QGis.Line)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline([point3d, point3d2]), None)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline([point3d1, point3d3]), None)
            # circle = MathHelper.constructCircle(self.daPoint3d, 100, 16)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline(circle), None)
            # self.daRubber.show()
            #
            # self.daAnnotation.setMapPosition(self.daPoint3d)
            # self.daAnnotation.show()

            self.putDistances()
            return daSocLayer
        except:
            pass

    def pnlHeightLoss_Event_0(self):
        self.calcSocAltitude()
        self.putDistances()
    def pnlRDH_Event_0(self):
        self.showMarkDaSoc()
    def pnlEstimatedAltitude_Event_0(self):
        self.calcSocAltitude()
        self.putDistances()
    def cmbVPA_Event_0(self):
        self.putWithInHeightLoss()
        self.showMarkDaSoc()
    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 calcSocAltitude(self):
        val = self.parametersPanel.pnlEstimatedAltitude.Value.Metres - self.parametersPanel.pnlHeightLoss.Value.Metres
        self.parametersPanel.pnlSocAltitude.Value = Altitude(val)
        return val


    def altitudeChanged(self):
        self.parametersPanel.pnlWind.setAltitude(self.parametersPanel.pnlAerodromeAltitude.Value)
        try:
            self.parametersPanel.pnlTas.Value = Speed.smethod_0(self.parametersPanel.pnlIas.Value, self.parametersPanel.pnlIsa.Value, self.parametersPanel.pnlAerodromeAltitude.Value)
        except:
            raise ValueError("Value Invalid")

    def WPT2Layer(self):
        mapUnits = define._canvas.mapUnits()
        if define._mapCrs == None:
            if mapUnits == QGis.Meters:
                resultLayer = QgsVectorLayer("Point?crs=EPSG:32633", "WPT_" + self.surfaceType.replace(" ", "_").replace("-", "_"), "memory")
            else:
                resultLayer = QgsVectorLayer("Point?crs=EPSG:4326", "WPT_" + self.surfaceType.replace(" ", "_").replace("-", "_"), "memory")
        else:
            resultLayer = QgsVectorLayer("Point?crs=%s"%define._mapCrs.authid (), "WPT_" + self.surfaceType.replace(" ", "_").replace("-", "_"), "memory")
        shpPath = ""
        if define.obstaclePath != None:
            shpPath = define.obstaclePath
        elif define.xmlPath != None:
            shpPath = define.xmlPath
        else:
            shpPath = define.appPath
        er = QgsVectorFileWriter.writeAsVectorFormat(resultLayer, shpPath + "/" + "RnavTurningSegmentAnalyserWpt" + ".shp", "utf-8", resultLayer.crs())
        resultLayer = QgsVectorLayer(shpPath + "/" + "RnavTurningSegmentAnalyserWpt" + ".shp", "WPT_RnavTurningSegmentAnalyser", "ogr")

        fieldName = "CATEGORY"
        resultLayer.dataProvider().addAttributes( [QgsField(fieldName, QVariant.String)] )
        resultLayer.startEditing()
        fields = resultLayer.pendingFields()
        i = 1
        feature = QgsFeature()
        feature.setFields(fields)

        feature.setGeometry(QgsGeometry.fromPoint (self.parametersPanel.pnlWaypoint1.Point3d))
        feature.setAttribute(fieldName, "Waypoint1")
        pr = resultLayer.dataProvider()
        pr.addFeatures([feature])
        # resultLayer.addFeature(feature)
        feature.setGeometry(QgsGeometry.fromPoint (self.parametersPanel.pnlWaypoint2.Point3d))
        feature.setAttribute(fieldName, "Waypoint2")
        pr = resultLayer.dataProvider()
        pr.addFeatures([feature])
        # resultLayer.addFeature(feature)
        resultLayer.commitChanges()

        renderCatFly = None
        if self.parametersPanel.cmbType1.SelectedIndex == 1:
            '''FlyOver'''

            symbolFlyOver = QgsSymbolV2.defaultSymbol(resultLayer.geometryType())
            symbolFlyOver.deleteSymbolLayer(0)
            svgSymLayer = QgsSvgMarkerSymbolLayerV2("Resource/flyover.svg", 10.0, 0.0)
            symbolFlyOver.appendSymbolLayer(svgSymLayer)
            renderCatFly = QgsRendererCategoryV2(0, symbolFlyOver,"Fly Over")
        elif self.parametersPanel.cmbType1.SelectedIndex == 0:
            '''FlyBy'''
            symbolFlyBy = QgsSymbolV2.defaultSymbol(resultLayer.geometryType())
            symbolFlyBy.deleteSymbolLayer(0)
            svgSymLayer = QgsSvgMarkerSymbolLayerV2("Resource/flyby.svg", 10.0, 0.0)
            symbolFlyBy.appendSymbolLayer(svgSymLayer)
            renderCatFly = QgsRendererCategoryV2(0, symbolFlyBy,"Fly By")
        else:
            return None
        WPT_EXPRESION = "CASE WHEN  \"CATEGORY\" = 'Waypoint1'  THEN 0 " + \
                                        "END"
        symRenderer = QgsCategorizedSymbolRendererV2(WPT_EXPRESION, [renderCatFly])

        resultLayer.setRendererV2(symRenderer)
        return resultLayer
    def putAircraftSpeed(self):
        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(165)
        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
예제 #4
0
class Ui_BaroVNAV(object):
    def setupUi(self, Form):
        Form.setObjectName(("Form"))
        Form.resize(473, 580)
        font = QtGui.QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        Form.setFont(font)

        self.aprAnnotation = QgsTextAnnotationItem(define._canvas)
        self.aprAnnotation.setDocument(QtGui.QTextDocument("ARP"))
        self.aprAnnotation.setFrameSize(QtCore.QSizeF(30, 20))
        self.aprAnnotation.hide()
        self.thrAnnotation = QgsTextAnnotationItem(define._canvas)
        self.thrAnnotation.setDocument(QtGui.QTextDocument("THR"))
        self.thrAnnotation.setFrameSize(QtCore.QSizeF(30, 20))
        self.thrAnnotation.hide()

        self.vlForm = QtGui.QVBoxLayout(Form)
        self.vlForm.setObjectName(("vlForm"))
        self.vlForm.setSpacing(0)
        self.vlForm.setMargin(0)

        self.pnlPositions = QtGui.QFrame(Form)
        self.pnlPositions.setObjectName(("pnlPositions"))
        self.hl_pnlPositions = QtGui.QVBoxLayout(self.pnlPositions)
        self.hl_pnlPositions.setObjectName(("hl_pnlPositions"))
        self.hl_pnlPositions.setMargin(0)

        self.cmbAerodrome = ComboBoxPanel(self.pnlPositions, True)
        self.cmbAerodrome.Caption = "Aerodrome"
        self.cmbAerodrome.LabelWidth = 120
        self.hl_pnlPositions.addWidget(self.cmbAerodrome)

        self.cmbRwyDir = ComboBoxPanel(self.pnlPositions, True)
        self.cmbRwyDir.Caption = "Runway Direction"
        self.cmbRwyDir.LabelWidth = 120
        self.cmbRwyDir.Width = 120
        self.hl_pnlPositions.addWidget(self.cmbRwyDir)

        self.gbAerodrome = QtGui.QGroupBox(Form)
        self.gbAerodrome.setObjectName("gbAerodrome")
        self.gbAerodrome.setTitle("Aerodrome")
        self.vl_gbAerodrome = QtGui.QVBoxLayout(self.gbAerodrome)
        self.vl_gbAerodrome.setObjectName("vl_gbAerodrome")

        self.pnlArp = PositionPanel(self.gbAerodrome, self.aprAnnotation)
        self.pnlArp.groupBox.setTitle("Reference Point (ARP)")
        self.pnlArp.btnCalculater.hide()
        self.vl_gbAerodrome.addWidget(self.pnlArp)

        self.pnlMinTemp = NumberBoxPanel(self.gbAerodrome)
        self.pnlMinTemp.CaptionUnits = define._degreeStr
        self.pnlMinTemp.Caption = "Minimum Temperature"
        self.pnlMinTemp.Value = -15
        self.vl_gbAerodrome.addWidget(self.pnlMinTemp)

        self.hl_pnlPositions.addWidget(self.gbAerodrome)

        self.gbRunway = QtGui.QGroupBox(Form)
        self.gbRunway.setObjectName("gbRunway")
        self.gbRunway.setTitle("Runway")
        self.vl_gbRunway = QtGui.QVBoxLayout(self.gbRunway)
        self.vl_gbRunway.setObjectName("vl_gbRunway")

        self.pnlThr = PositionPanel(self.gbRunway, self.thrAnnotation)
        self.pnlThr.groupBox.setTitle("Threshold Position")
        self.pnlThr.btnCalculater.hide()
        self.vl_gbRunway.addWidget(self.pnlThr)

        self.pnlThrEnd = PositionPanel(self.gbRunway, self.thrAnnotation)
        self.pnlThrEnd.groupBox.setTitle("Runway End Position")
        self.pnlThrEnd.btnCalculater.hide()
        self.vl_gbRunway.addWidget(self.pnlThrEnd)
        self.pnlThrEnd.Visible = False

        self.pnlRwyDir = TrackRadialBoxPanel(self.gbRunway)
        self.pnlRwyDir.Caption = "Direction"
        self.pnlRwyDir.LabelWidth = 70
        self.vl_gbRunway.addWidget(self.pnlRwyDir)

        self.hl_pnlPositions.addWidget(self.gbRunway)
        self.vlForm.addWidget(self.pnlPositions)

        self.gbParameters = QtGui.QGroupBox(Form)
        font = QtGui.QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.gbParameters.setFont(font)
        self.gbParameters.setObjectName(("gbParameters"))
        self.gbParameters.setTitle("Parameters")
        self.vl_gbParameters = QtGui.QVBoxLayout(self.gbParameters)
        self.vl_gbParameters.setObjectName(("vl_gbParameters"))

        self.pnlOCAH = OCAHPanel(self.gbParameters)
        self.pnlOCAH.Caption = "Intermediate Segment"
        self.pnlOCAH.Value = Altitude(2000, AltitudeUnits.FT)
        self.pnlOCAH.LabelWidth = 200
        self.vl_gbParameters.addWidget(self.pnlOCAH)

        self.pnlMocI = AltitudeBoxPanel(self.gbParameters)
        self.pnlMocI.CaptionUnits = "m"
        self.pnlMocI.Caption = "Intermediate Segment MOC"
        self.pnlMocI.Value = Altitude(150)
        self.vl_gbParameters.addWidget(self.pnlMocI)

        self.pnlRDH = AltitudeBoxPanel(self.gbParameters)
        self.pnlRDH.CaptionUnits = "m"
        self.pnlRDH.Caption = "RDH at THR"
        self.pnlRDH.Value = Altitude(15)
        self.vl_gbParameters.addWidget(self.pnlRDH)

        self.pnlVPA = ComboBoxPanel(self.gbParameters)
        self.pnlVPA.Caption = "Vertical Path Angle [VPA]"
        # self.pnlVPA.comboBox.setToolTip()
        self.vl_gbParameters.addWidget(self.pnlVPA)

        self.lblAbove35 = QtGui.QLabel(self.gbParameters)
        self.lblAbove35.setText(
            QtCore.QString("A procedure with a promulgated VPA exceeding 3.5")
            + unicode("°", "utf-8") + QtCore.QString(
                " is a non-standard procedure.\nIt shall be subject to an aeronautical study and will require special approval \n    by the national competent authority (PANS-OPS Part III, Section 3, Chapter 4, Par. 4.2.1.3)"
            ))
        self.vl_gbParameters.addWidget(self.lblAbove35)

        self.pnlThrFafDist = DistanceBoxPanel(self.gbParameters,
                                              DistanceUnits.NM)
        self.pnlThrFafDist.Caption = "THR to FAWP Distance"
        self.pnlThrFafDist.Value = Distance(5, DistanceUnits.NM)
        self.vl_gbParameters.addWidget(self.pnlThrFafDist)

        self.pnlAcCat = ComboBoxPanel(self.gbParameters)
        self.pnlAcCat.Caption = "Aircraft Category"
        self.vl_gbParameters.addWidget(self.pnlAcCat)

        self.pnlIas = SpeedBoxPanel(self.gbParameters, SpeedUnits.KTS)
        self.pnlIas.Caption = "Max. IAS"
        self.pnlIas.Value = Speed(185)
        self.vl_gbParameters.addWidget(self.pnlIas)

        self.pnlIasAtThr = SpeedBoxPanel(self.gbParameters, SpeedUnits.KTS)
        self.pnlIasAtThr.Caption = "Max. IAS at THR"
        self.pnlIasAtThr.Value = Speed(165)
        self.vl_gbParameters.addWidget(self.pnlIasAtThr)

        self.pnlHL = AltitudeBoxPanel(self.gbParameters)
        self.pnlHL.CaptionUnits = "m"
        self.pnlHL.Caption = "Height Loss"
        self.pnlHL.Value = Altitude(49)
        self.vl_gbParameters.addWidget(self.pnlHL)

        self.pnlTC = AltitudeBoxPanel(self.gbParameters)
        self.pnlTC.CaptionUnits = "m"
        self.pnlTC.Caption = "Temperature Correction"
        self.pnlTC.Value = Altitude(0)
        self.vl_gbParameters.addWidget(self.pnlTC)

        self.tableLayoutPanel1 = QtGui.QFrame(self.gbParameters)
        self.tableLayoutPanel1.setObjectName("tableLayoutPanel1")
        self.vl_tableLayoutPanel1 = QtGui.QVBoxLayout(self.tableLayoutPanel1)
        self.vl_tableLayoutPanel1.setObjectName("vl_tableLayoutPanel1")
        self.vl_tableLayoutPanel1.setSpacing(0)
        self.vl_tableLayoutPanel1.setMargin(0)

        self.upFrame = QtGui.QFrame(self.tableLayoutPanel1)
        self.upFrame.setObjectName("upFrame")
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.upFrame.sizePolicy().hasHeightForWidth())
        self.upFrame.setSizePolicy(sizePolicy)
        self.hl_upFrame = QtGui.QHBoxLayout(self.upFrame)
        self.hl_upFrame.setObjectName("hl_upFrame")
        self.hl_upFrame.setMargin(0)

        self.cmbTermination = ComboBoxPanel(self.upFrame)
        self.cmbTermination.Caption = "APV Segment Termination"
        self.cmbTermination.comboBox.setMinimumWidth(80)
        self.hl_upFrame.addWidget(self.cmbTermination)

        self.pnlTerminationDist = DistanceBoxPanel(self.upFrame,
                                                   DistanceUnits.NM)
        self.pnlTerminationDist.Caption = "Dist."
        self.pnlTerminationDist.Value = Distance(5, DistanceUnits.NM)
        self.pnlTerminationDist.LabelWidth = 50
        self.hl_upFrame.addWidget(self.pnlTerminationDist)

        self.vl_tableLayoutPanel1.addWidget(self.upFrame)

        self.downFrame = QtGui.QFrame(self.tableLayoutPanel1)
        self.downFrame.setObjectName("downFrame")
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.downFrame.sizePolicy().hasHeightForWidth())
        self.downFrame.setSizePolicy(sizePolicy)
        self.hl_downFrame = QtGui.QHBoxLayout(self.downFrame)
        self.hl_downFrame.setObjectName("hl_downFrame")
        self.hl_downFrame.setMargin(0)

        self.cmbMAPt = ComboBoxPanel(self.downFrame)
        self.cmbMAPt.Caption = "Missed Approach Point"
        self.cmbMAPt.comboBox.setMinimumWidth(80)
        self.hl_downFrame.addWidget(self.cmbMAPt)

        self.pnlMAPtDist = DistanceBoxPanel(self.downFrame, DistanceUnits.NM)
        self.pnlMAPtDist.Caption = "Dist."
        # self.pnlMAPtDist.Value = Distance(5, DistanceUnits.NM)
        self.pnlMAPtDist.LabelWidth = 50
        self.hl_downFrame.addWidget(self.pnlMAPtDist)

        self.vl_tableLayoutPanel1.addWidget(self.downFrame)
        self.vl_gbParameters.addWidget(self.tableLayoutPanel1)

        self.pnlMACG = NumberBoxPanel(self.gbParameters)
        self.pnlMACG.CaptionUnits = "%"
        self.pnlMACG.Caption = "Missed Approach Climb Gradient"
        self.pnlMACG.Value = 2.5
        self.vl_gbParameters.addWidget(self.pnlMACG)

        self.pnlMocMA = AltitudeBoxPanel(self.gbParameters)
        self.pnlMocMA.CaptionUnits = "m"
        self.pnlMocMA.Caption = "Missed Approach MOC"
        self.pnlMocMA.Value = Altitude(30)
        self.vl_gbParameters.addWidget(self.pnlMocMA)

        self.pnlEvalMethodMA = ComboBoxPanel(self.gbParameters)
        self.pnlEvalMethodMA.Caption = "Missed Approach Evaluation"
        self.vl_gbParameters.addWidget(self.pnlEvalMethodMA)

        self.pnlConstructionType = ComboBoxPanel(self.gbParameters)
        self.pnlConstructionType.Caption = "Construction Type"
        self.vl_gbParameters.addWidget(self.pnlConstructionType)

        self.vlForm.addWidget(self.gbParameters)
        QtCore.QMetaObject.connectSlotsByName(Form)
예제 #5
0
class Ui_PaIls(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(435, 580)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))

        self.gbParameters = GroupBox(Form)
        self.gbParameters.Caption = "General"
        self.verticalLayout.addWidget(self.gbParameters)

        self.cmbAerodrome = ComboBoxPanel(self.gbParameters, True)
        self.cmbAerodrome.Caption = "Aerodrome"
        self.cmbAerodrome.LabelWidth = 150
        self.cmbAerodrome.Width = 150
        self.gbParameters.Add = self.cmbAerodrome

        self.cmbRwyDir = ComboBoxPanel(self.gbParameters, True)
        self.cmbRwyDir.Caption = "Runway Direction"
        self.cmbRwyDir.LabelWidth = 150
        self.cmbRwyDir.Width = 150
        self.gbParameters.Add = self.cmbRwyDir

        self.annotationFAWP = QgsTextAnnotationItem(define._canvas)
        self.annotationFAWP.setDocument(QTextDocument("FAP"))
        self.annotationFAWP.hide()

        self.pnlFapPosition = PositionPanel(self.gbParameters,
                                            self.annotationFAWP)
        self.pnlFapPosition.Caption = "FAP Position"
        # self.pnlFafPosition.btnCalculater.hide()
        self.pnlFapPosition.hideframe_Altitude()
        self.gbParameters.Add = self.pnlFapPosition

        self.pnlThrPosition = PositionPanel(self.gbParameters)
        self.pnlThrPosition.Caption = "Threshold Position"
        self.pnlThrPosition.btnCalculater.hide()
        self.gbParameters.Add = self.pnlThrPosition

        self.pnlRwyEndPosition = PositionPanel(self.gbParameters)
        self.pnlRwyEndPosition.Caption = "RwyEnd Position"
        self.pnlRwyEndPosition.btnCalculater.hide()
        self.gbParameters.Add = self.pnlRwyEndPosition
        self.pnlRwyEndPosition.Visible = False

        self.pnlInboundTrack = TrackRadialBoxPanel(self.gbParameters)
        self.pnlInboundTrack.Caption = "In-bound Track"
        self.pnlInboundTrack.LabelWidth = 150
        self.gbParameters.Add = self.pnlInboundTrack

        self.pnlEstimatedAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlEstimatedAltitude.Caption = "Estimated Altitude"
        self.pnlEstimatedAltitude.LabelWidth = 150
        self.pnlEstimatedAltitude.Value = Altitude(1000)
        self.gbParameters.Add = self.pnlEstimatedAltitude

        self.pnlAerodromeAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlAerodromeAltitude.Caption = "Aerodrome Altitude"
        self.pnlAerodromeAltitude.LabelWidth = 150
        self.pnlAerodromeAltitude.Value = Altitude(1000)
        self.gbParameters.Add = self.pnlAerodromeAltitude

        self.pnlIsa = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlIsa.CaptionUnits = define._degreeStr + "C"
        self.pnlIsa.Caption = "ISA"
        self.pnlIsa.LabelWidth = 150
        self.pnlIsa.Value = 15
        self.gbParameters.Add = self.pnlIsa

        self.pnlRDH = AltitudeBoxPanel(self.gbParameters)
        self.pnlRDH.Caption = "RDH at THR"
        self.pnlRDH.LabelWidth = 150
        self.pnlRDH.Value = Altitude(15)
        self.gbParameters.Add = self.pnlRDH

        self.cmbVPA = ComboBoxPanel(self.gbParameters)
        self.cmbVPA.Caption = "Vertical Path Angle[VPA]"
        self.cmbVPA.LabelWidth = 150
        self.gbParameters.Add = self.cmbVPA

        self.cmbAircraftCategory = ComboBoxPanel(self.gbParameters)
        self.cmbAircraftCategory.Caption = "Aircraft Category"
        self.cmbAircraftCategory.LabelWidth = 150
        self.gbParameters.Add = self.cmbAircraftCategory

        self.pnlHeightLoss = AltitudeBoxPanel(self.gbParameters)
        self.pnlHeightLoss.Caption = "Height Loss"
        self.pnlHeightLoss.LabelWidth = 150
        self.gbParameters.Add = self.pnlHeightLoss

        self.pnlIas = SpeedBoxPanel(self.gbParameters)
        self.pnlIas.Caption = "IAS"
        self.pnlIas.LabelWidth = 150
        self.pnlIas.Value = Speed(185)
        self.gbParameters.Add = self.pnlIas

        self.pnlTas = SpeedBoxPanel(self.gbParameters)
        self.pnlTas.Caption = "TAS"
        self.pnlTas.Enabled = False
        self.pnlTas.LabelWidth = 150
        self.gbParameters.Add = self.pnlTas

        self.pnlWind = WindPanel(self.gbParameters)
        self.pnlWind.LabelWidth = 145
        self.gbParameters.Add = self.pnlWind

        self.pnlSocAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlSocAltitude.Caption = "SOC Altitude"
        self.pnlSocAltitude.LabelWidth = 150
        self.gbParameters.Add = self.pnlSocAltitude

        self.pnlDistXz = DistanceBoxPanel(self.gbParameters, DistanceUnits.M,
                                          DistanceUnits.NM)
        self.pnlDistXz.Caption = "Xz Distance"
        self.pnlDistXz.LabelWidth = 150
        self.pnlDistXz.Button = None
        self.pnlDistXz.Value = Distance(-900)
        self.pnlDistXz.Enabled = False
        self.gbParameters.Add = self.pnlDistXz

        self.pnlDistOfFafDA = DistanceBoxPanel(self.gbParameters,
                                               DistanceUnits.M,
                                               DistanceUnits.NM)
        self.pnlDistOfFafDA.Caption = "FAP-DA Distance"
        self.pnlDistOfFafDA.LabelWidth = 150
        self.pnlDistOfFafDA.Button = None
        self.pnlDistOfFafDA.Enabled = False
        self.gbParameters.Add = self.pnlDistOfFafDA

        self.pnlDistOfDaThr = DistanceBoxPanel(self.gbParameters,
                                               DistanceUnits.M,
                                               DistanceUnits.NM)
        self.pnlDistOfDaThr.Caption = "DA-THR Distance"
        self.pnlDistOfDaThr.LabelWidth = 150
        self.pnlDistOfDaThr.Button = None
        self.pnlDistOfDaThr.Enabled = False
        self.gbParameters.Add = self.pnlDistOfDaThr

        self.pnlDistOfSocThr = DistanceBoxPanel(self.gbParameters,
                                                DistanceUnits.M,
                                                DistanceUnits.NM)
        self.pnlDistOfSocThr.Caption = "SOC-THR Distance"
        self.pnlDistOfSocThr.LabelWidth = 150
        self.pnlDistOfSocThr.Button = None
        self.pnlDistOfSocThr.Enabled = False
        self.gbParameters.Add = self.pnlDistOfSocThr