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
 def createItem(self, e):
     mapCoord = self.toMapCoordinates(e.pos())
     textItem = QgsTextAnnotationItem(self.mCanvas)
     textItem.setMapPosition(self.toMapCoordinates(e.pos()))
     textItem.setFrameSize(QSizeF(200, 100))
     textItem.setSelected(True)
     return textItem
    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
# coding: utf-8
from PyQt4.QtCore import QSizeF
from PyQt4.QtGui import QColor, QTextDocument
from qgis.core import QgsPoint
from qgis.gui import QgsTextAnnotationItem
from qgis.utils import iface

canvas = iface.mapCanvas()
text_annotation_item = QgsTextAnnotationItem(canvas)
X, Y = float(3), float(45)
point = QgsPoint(X, Y)
text_annotation_item.setMapPosition(point)
text_annotation_item.setFrameSize(QSizeF(300, 200))
text_annotation_item.setFrameColor(QColor(0, 255, 0))
text_annotation_item.setFrameBackgroundColor(QColor(128, 128, 128))
text_document = QTextDocument()
html_content = "<b>New annotation</b>"
font_color, font_family, font_size = "#123456", "Times New Roman", 16
text_document.setHtml('<font style="color:' + font_color + "; font-family:" +
                      font_family + "; font-size: " + str(font_size) + 'px">' +
                      html_content + "</font>")
text_annotation_item.setDocument(text_document)
canvas.refresh()

# Then remove
# canvas.scene().removeItem(text_annotation_item)
    def wplaceAnnotationsButton_click(self):
        annotations = self.getSelectedAnnotations()
        for anno in annotations:
            annoData = anno.data(1)
            annotation = QgsTextAnnotationItem(self.iface.mapCanvas())

            #Make data accessible from annotation
            annotation.setData(1, annoData)

            doc = annotation.document()
            #"layer": self.getLayer(),
            #"srid": crs.postgisSrid(),
            #"label":  label[0:256] ,

            #"content": annotation.document().toHtml().replace("'","''"),
            doc.setHtml(annoData.get('content', None))
            annotation.setDocument(doc)

            #"frame_color":annotation.frameColor().name(),
            color = QColor()
            color.setNamedColor(annoData.get('frame_color'))
            annotation.setFrameColor(color)

            #"bg_color": annotation.frameBackgroundColor().name(),
            color = QColor()
            color.setNamedColor(annoData.get('bg_color'))
            annotation.setFrameBackgroundColor(color)

            #"frame_width": frame_size.width(),
            #"frame_height": frame_size.height(),
            size = QSizeF()
            size.setWidth(annoData.get('frame_width'))
            size.setHeight(annoData.get('frame_height'))
            annotation.setFrameSize(size)

            #"frame_border_width": annotation.frameBorderWidth(),
            width = float(annoData.get('frame_border_width'))
            annotation.setFrameBorderWidth(width)

            #"map_position_x": map_position_x,
            #"map_position_y": map_position_y,
            map_position_x = float(annoData.get('map_position_x'))
            map_position_y = float(annoData.get('map_position_y'))
            annotation.setMapPosition(QgsPoint(map_position_x, map_position_y))

            #"offset_x": ref_offset.x(),
            #"offset_y": ref_offset.y(),
            offset_x = float(annoData.get('offset_x'))
            offset_y = float(annoData.get('offset_y'))
            annotation.setOffsetFromReferencePoint(QPointF(offset_x, offset_y))

            #"marker_symbol": json.dumps(self.dumpMarkerSymbol(marker))
            marker_symbol = annoData.get('marker_symbol')

            new_marker_symbol = QgsMarkerSymbolV2()
            #'color':marker.color().name(),
            color = QColor()
            color.setNamedColor(marker_symbol.get('color'))
            new_marker_symbol.setColor(color)

            #'alpha':marker.alpha(),
            alpha = float(marker_symbol.get('alpha'))
            new_marker_symbol.setAlpha(alpha)

            #'output_unit': marker.outputUnit(),
            output_unit = marker_symbol.get('output_unit')
            new_marker_symbol.setOutputUnit(output_unit)

            #'angle': marker.angle(),
            angle = float(marker_symbol.get('angle'))
            new_marker_symbol.setAngle(angle)

            #'size': marker.size(),
            size = float(marker_symbol.get('size'))
            new_marker_symbol.setSize(size)

            #'size_unit': marker.sizeUnit(),
            size_unit = marker_symbol.get('size_unit')
            new_marker_symbol.setSizeUnit(size_unit)

            #'symbol_layers': [self.dumpSymbolLayer(layer) for layer in marker.symbolLayers()]

            for properties in marker_symbol.get('symbol_layers'):
                print properties
                #properties = json.loads(properties)
                new_symbol_layer = QgsSimpleMarkerSymbolLayerV2()
                new_symbol_layer.restoreDataDefinedProperties(properties)
                new_marker_symbol.appendSymbolLayer(new_symbol_layer)

            annotation.setMarkerSymbol(new_marker_symbol)
    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)
 def parse_response(self):
     names = {
         "dilanka": "Ділянка",
         "ikk": "ІКК",
         "obl": "Область",
         "rajonunion": "Район",
         "grunt": "Ґрунти",
         "dilanka_arch": "Ділянка (архівна)",
         "restriction": "Обмеження",
         "cnap": "ЦНАД"
     }
     text = ""
     scene = self.canvas.scene()
     annotation = QgsTextAnnotationItem(self.canvas)
     annotation.setMapPosition(QgsPoint(self.x_map, self.y_map))
     # Starting from 2.14
     # TODO: check and fix bug for previous versions
     if qgis.utils.QGis.QGIS_VERSION_INT < 20140:
         iface.messageBar().pushMessage(
             "Warning",
             "For correct transformation annotations between CRS please use"
             " version 2.14 or later",
             level=QgsMessageBar.WARNING)
     # This delete annotation if we used other CRS than defined when we use OTF
     # if qgis.utils.QGis.QGIS_VERSION_INT >= 20140:
     #     annotation.setMapPositionCrs(QgsCoordinateReferenceSystem(3857))
     annotation.setActive(True)
     # fixes bug when response starts not with JSON object
     # http://map.land.gov.ua/kadastrova-karta/getobjectinfo?x=6201535.76141&y=2477307.1863&zoom=16&actLayers[]=kadastr_arch
     response_read = self.response.read()
     if not response_read.startswith("{"):
         response_read = "{" + response_read.split("{")[-1]
     json_obj = json.loads(response_read)
     for k, v in json_obj.items():
         if k == "pusto":
             annotation.setFrameSize(QSizeF(100, 20))
             annotation.setDocument(QTextDocument("Data is empty"))
             scene.addItem(annotation)
             self.canvas.refresh()
             return
         if iface.mapCanvas().currentLayer().customProperty(
                 "layer_id") == 0:
             annotation.setFrameSize(QSizeF(200, 300))
         elif iface.mapCanvas().currentLayer().customProperty(
                 "layer_id") == 1:
             annotation.setFrameSize(QSizeF(200, 100))
         elif iface.mapCanvas().currentLayer().customProperty(
                 "layer_id") == 2:
             annotation.setFrameSize(QSizeF(200, 300))
         else:
             annotation.setFrameSize(QSizeF(200, 250))
         title = names.get(k, u"Noname")
         text += title.decode("utf-8") + "\n"
         html_parsed = BeautifulSoup.BeautifulSoup(v)
         for i in html_parsed:
             for j in i.findAll("li"):
                 write_text = ""
                 t = (j.contents[0].string, j.contents[1])
                 if t[0]:
                     write_text += t[0]
                     if isinstance(t[1], BeautifulSoup.Tag):
                         write_text += " " + t[1].text
                     else:
                         write_text += " " + t[1]
                     text += write_text + "\n"
         #     for j in i.findAll(text=True):
         #         j = str(j)
         #         if j.startswith("&") or j.startswith("Замовити") or j.startswith("Інформація про право власності"):
         #             continue
         #         text += j.decode("utf-8") + " "
         # text += "\n"
     annotation.setDocument(QTextDocument(text))
     scene.addItem(annotation)
     self.canvas.refresh()
Example #8
0
    def run(self):
        project_id = self.settings.value("project/id")
        epsg = self.settings.value("project/epsg")

        locale = QSettings().value('locale/userLocale')[0:2]

        if not project_id:
            self.message_bar.pushCritical(
                "Error",
                _translate("VeriSO_EE_Geb_LokTest", "project_id not set",
                           None))
            return

        QApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            group = _translate("VeriSO_EE_Geb_LokTest",
                               "Gebaeudeadressen - Lokalisationstest", None)
            group += " (" + str(project_id) + ")"

            # TODO: Check "tid" vs. t_ili_tid... in queries. Do not import
            # i_ili_tid?

            # define layer names here
            lokalisation = _translate("VeriSO_EE_Geb_LokTest",
                                      "Lokalisation Lokalisationstest", None)
            strassenstueck_geometrie = _translate(
                "VeriSO_EE_Geb_LokTest", "Strassenstueck (geometrie) "
                "Lokalisationstest", None)
            strassenstueck_anfangspunkt = _translate(
                "VeriSO_EE_Geb_LokTest", "Strassenstueck ("
                "anfangspunkt) "
                "Lokalisationstest", None)
            benanntesgebiet = _translate("VeriSO_EE_Geb_LokTest",
                                         "Benanntes Gebiet Lokalisationstest",
                                         None)
            gebaeudeeingang = _translate("VeriSO_EE_Geb_LokTest",
                                         "Gebaeudeeingang Lokalisationstest",
                                         None)
            shortestline = _translate("VeriSO_EE_Geb_LokTest",
                                      "Kuerzeste Linie Lokalisationstest",
                                      None)
            hausnummerpos = _translate("VeriSO_EE_Geb_LokTest",
                                       "HausnummerPos Lokalisationstest", None)
            lokalisationsname = _translate("VeriSO_EE_Geb_LokTest",
                                           "LokalisationsName", None)

            vlayer_lokalisation = self.get_vector_layer_by_name(lokalisation)
            if not vlayer_lokalisation:
                layer = {
                    "type": "postgres",
                    "title": lokalisation,
                    "featuretype": "gebaeudeadressen_lokalisation",
                    "key": "ogc_fid",
                    "sql": "ogc_fid = -1",
                    "readonly": True,
                    "group": group
                }
                vlayer_lokalisation = self.layer_loader.load(layer)

            vlayer_strassenstueck_geometrie = self.get_vector_layer_by_name(
                strassenstueck_geometrie)
            if not vlayer_strassenstueck_geometrie:
                layer = {
                    "type":
                    "postgres",
                    "title":
                    "Strassenstueck (geometrie) Lokalisationstest",
                    "featuretype":
                    "gebaeudeadressen_strassenstueck",
                    "geom":
                    "geometrie",
                    "key":
                    "ogc_fid",
                    "sql":
                    "strassenstueck_von = -1",
                    "readonly":
                    True,
                    "group":
                    group,
                    "style":
                    "global_qml/gebaeudeadressen/strassenachsen_rot"
                    ".qml"
                }
                vlayer_strassenstueck_geometrie = self.layer_loader.load(layer)

            vlayer_strassenstueck_anfangspunkt = self.get_vector_layer_by_name(
                strassenstueck_anfangspunkt)
            if not vlayer_strassenstueck_anfangspunkt:
                layer = {
                    "type": "postgres",
                    "title": "Strassenstueck (anfangspunkt) Lokalisationstest",
                    "featuretype": "gebaeudeadressen_strassenstueck",
                    "geom": "anfangspunkt",
                    "key": "ogc_fid",
                    "sql": "strassenstueck_von = -1",
                    "readonly": True,
                    "group": group,
                    "style": "global_qml/gebaeudeadressen/anfangspunkt_rot.qml"
                }
                vlayer_strassenstueck_anfangspunkt = self.layer_loader.load(
                    layer)

            vlayer_benanntesgebiet = self.get_vector_layer_by_name(
                benanntesgebiet)
            if not vlayer_benanntesgebiet:
                layer = {
                    "type":
                    "postgres",
                    "title":
                    "Benanntes Gebiet Lokalisationstest",
                    "featuretype":
                    "gebaeudeadressen_benanntesgebiet",
                    "geom":
                    "flaeche",
                    "key":
                    "ogc_fid",
                    "sql":
                    "benanntesgebiet_von = -1",
                    "readonly":
                    True,
                    "group":
                    group,
                    "style":
                    "global_qml/gebaeudeadressen/benanntesgebiet_rot"
                    ".qml"
                }
                vlayer_benanntesgebiet = self.layer_loader.load(layer)

            vlayer_gebaeudeeingang = self.get_vector_layer_by_name(
                gebaeudeeingang)
            if not vlayer_gebaeudeeingang:
                layer = {
                    "type":
                    "postgres",
                    "title":
                    "Gebaeudeeingang Lokalisationstest",
                    "featuretype":
                    "gebaeudeadressen_gebaeudeeingang",
                    "geom":
                    "lage",
                    "key":
                    "ogc_fid",
                    "sql":
                    "gebaeudeeingang_von = -1",
                    "readonly":
                    True,
                    "group":
                    group,
                    "style":
                    "global_qml/gebaeudeadressen/gebaeudeeingang_rot"
                    ".qml"
                }
                vlayer_gebaeudeeingang = self.layer_loader.load(layer)

            vlayer_shortestline = self.get_vector_layer_by_name(shortestline)
            if not vlayer_shortestline:
                layer = {
                    "type":
                    "postgres",
                    "title":
                    "Kuerzeste Linie Lokalisationstest",
                    "featuretype":
                    "t_shortestline_hausnummerpos",
                    "geom":
                    "the_geom",
                    "key":
                    "ogc_fid",
                    "sql":
                    "lok_tid = -1",
                    "readonly":
                    True,
                    "group":
                    group,
                    "style":
                    "global_qml/gebaeudeadressen/shortestline_linie_rot.qml"
                }
                vlayer_shortestline = self.layer_loader.load(layer)

            vlayer_hausnummerpos = self.get_vector_layer_by_name(hausnummerpos)
            if not vlayer_hausnummerpos:
                layer = {
                    "type": "postgres",
                    "title": "HausnummerPos Lokalisationstest",
                    "featuretype": "v_gebaeudeadressen_hausnummerpos",
                    "geom": "pos",
                    "key": "ogc_fid",
                    "sql": "lok_tid = -1",
                    "readonly": True,
                    "group": group,
                    "style":
                    "global_qml/gebaeudeadressen/hausnummerpos_rot.qml"
                }
                vlayer_hausnummerpos = self.layer_loader.load(layer)

            vlayer_lokalisationsname = self.get_vector_layer_by_name(
                lokalisationsname)
            if not vlayer_lokalisationsname:
                self.message_bar.pushMessage(
                    "Error",
                    _translate("VeriSO_EE_Geb_LokTest",
                               "Layer _LokalisationsName_ not found.", None),
                    level=QgsMessageBar.CRITICAL,
                    duration=0)
                QApplication.restoreOverrideCursor()
                return

            iterator = vlayer_lokalisationsname.getFeatures()
            ids = []

            for feature in iterator:
                ids.append(feature.id())

            if vlayer_lokalisationsname.selectedFeatureCount() < 1:
                self.message_bar.pushCritical(
                    "Error",
                    _translate("VeriSO_EE_Geb_LokTest",
                               "No _LokalisationsName_ selected.", None))
                QApplication.restoreOverrideCursor()
                return

            if vlayer_lokalisationsname.selectedFeatureCount() > 1:
                self.message_bar.pushCritical(
                    "Error",
                    _translate(
                        "VeriSO_EE_Geb_LokTest",
                        "Please select only one (1) _LokalisationsName_.",
                        None))
                QApplication.restoreOverrideCursor()
                return

            feat = QgsFeature()
            id = vlayer_lokalisationsname.selectedFeaturesIds()[0]
            feat = vlayer_lokalisationsname.selectedFeatures()[0]
            idx = ids.index(id)

            benannte_idx = vlayer_lokalisationsname.fieldNameIndex("benannte")
            text_idx = vlayer_lokalisationsname.fieldNameIndex("atext")

            if benannte_idx == -1 or text_idx == -1:
                self.message_bar.pushCritical(
                    "Error",
                    _translate("VeriSO_EE_Geb_LokTest",
                               "Field _benannte_ or _text_ not found.", None))
                QApplication.restoreOverrideCursor()
                return

            benannte = feat.attributes()[benannte_idx]
            lokalisationsname = feat.attributes()[text_idx]

            vlayer_strassenstueck_geometrie.setSubsetString(
                "(strassenstueck_von = " + str(benannte) + ")")
            vlayer_strassenstueck_anfangspunkt.setSubsetString(
                "(strassenstueck_von = " + str(benannte) + ")")
            vlayer_benanntesgebiet.setSubsetString("(benanntesgebiet_von = " +
                                                   str(benannte) + ")")
            vlayer_gebaeudeeingang.setSubsetString("(gebaeudeeingang_von = " +
                                                   str(benannte) + ")")
            vlayer_lokalisation.setSubsetString("(ogc_fid = " + str(benannte) +
                                                ")")
            vlayer_shortestline.setSubsetString("(lok_tid = " + str(benannte) +
                                                ")")
            vlayer_hausnummerpos.setSubsetString("(lok_tid = " +
                                                 str(benannte) + ")")

            if vlayer_strassenstueck_geometrie.featureCount() > 0:
                x_min = vlayer_strassenstueck_geometrie.extent().xMinimum()
                y_min = vlayer_strassenstueck_geometrie.extent().yMinimum()
                x_max = vlayer_strassenstueck_geometrie.extent().xMaximum()
                y_max = vlayer_strassenstueck_geometrie.extent().yMaximum()

            if vlayer_benanntesgebiet.featureCount() > 0:
                x_min = vlayer_benanntesgebiet.extent().xMinimum()
                y_min = vlayer_benanntesgebiet.extent().yMinimum()
                x_max = vlayer_benanntesgebiet.extent().xMaximum()
                y_max = vlayer_benanntesgebiet.extent().yMaximum()

            try:
                if vlayer_gebaeudeeingang.featureCount() > 0:
                    if vlayer_gebaeudeeingang.extent().xMinimum() < x_min:
                        x_min = vlayer_gebaeudeeingang.extent().xMinimum()
                    if vlayer_gebaeudeeingang.extent().yMinimum() < y_min:
                        y_min = vlayer_gebaeudeeingang.extent().yMinimum()
                    if vlayer_gebaeudeeingang.extent().xMaximum() > x_max:
                        x_max = vlayer_gebaeudeeingang.extent().xMaximum()
                    if vlayer_gebaeudeeingang.extent().yMaximum() > y_max:
                        y_max = vlayer_gebaeudeeingang.extent().yMaximum()

                rect = QgsRectangle(x_min, y_min, x_max, y_max)
                rect.scale(1.3)

            except UnboundLocalError:
                vlayer_gemeindegrenze = self.getVectorLayerByName(
                    "Gemeindegrenze")
                if vlayer_gemeindegrenze is None:
                    rect = self.canvas.fullExtent()
                else:
                    rect = vlayer_gemeindegrenze.extent()

            self.iface.mapCanvas().setExtent(rect)
            self.iface.mapCanvas().refresh()

            iterator = vlayer_lokalisation.getFeatures()

            # only one feature is selected
            for feature in iterator:
                prinzip_idx = vlayer_lokalisation.fieldNameIndex(
                    "nummerierungsprinzip_txt")
                attributeprovisorisch_idx = vlayer_lokalisation.fieldNameIndex(
                    "attributeprovisorisch_txt")
                offiziell_idx = vlayer_lokalisation.fieldNameIndex(
                    "istoffiziellebezeichnung_txt")
                status_idx = vlayer_lokalisation.fieldNameIndex("status_txt")
                inaenderung_idx = vlayer_lokalisation.fieldNameIndex(
                    "inaenderung_txt")
                art_idx = vlayer_lokalisation.fieldNameIndex("art_txt")

                something_missing = (prinzip_idx == -1
                                     or attributeprovisorisch_idx == -1
                                     or offiziell_idx == -1 or status_idx == -1
                                     or inaenderung_idx == -1 or art_idx == -1)
                if something_missing:
                    self.message_bar.pushMessage("Error",
                                                 _translate(
                                                     "VeriSO_EE_Geb_LokTest",
                                                     "Field not found.", None),
                                                 level=QgsMessageBar.CRITICAL,
                                                 duration=0)
                    QApplication.restoreOverrideCursor()
                    return

                prinzip = feature.attributes()[prinzip_idx]
                attributeprovisorisch = feature.attributes(
                )[attributeprovisorisch_idx]
                offiziell = feature.attributes()[offiziell_idx]
                status = feature.attributes()[status_idx]
                inaenderung = feature.attributes()[inaenderung_idx]
                art = feature.attributes()[art_idx]

                map_extent = self.canvas.extent()
                x = map_extent.xMinimum()
                y = map_extent.yMaximum()

            text_item_found = False
            items = list(self.iface.mapCanvas().scene().items())
            for i in range(len(items)):
                try:
                    name = items[i].data(0)
                    if str(name) == "LokalisationsInfo":
                        text_item = items[i]
                        text_item_found = True
                except Exception:
                    pass

            if not text_item_found:
                text_item = QgsTextAnnotationItem(self.canvas)
                text_item.setData(0, "LokalisationsInfo")

            # noinspection PyUnboundLocalVariable
            text_item.setMapPosition(
                QgsPoint(x + 10 * self.canvas.mapUnitsPerPixel(),
                         y - 10 * self.canvas.mapUnitsPerPixel()))
            text_item.setMapPositionFixed(False)
            text_item.setFrameBorderWidth(0.0)
            text_item.setFrameColor(QColor(250, 250, 250, 255))
            text_item.setFrameBackgroundColor(QColor(250, 250, 250, 123))
            text_item.setFrameSize(QSizeF(250, 150))
            text_document = QTextDocument()
            text_document.setHtml(
                "<table style='font-size:12px;'><tr><td>Lok.Name: </td><td>" +
                lokalisationsname + "</td></tr><tr><td>TID: </td><td>" +
                str(benannte) + "</td></tr> <tr><td>Num.prinzip: "
                "</td><td>" + str(prinzip) +
                "</td></tr> <tr><td>Attr. prov.: </td><td>" +
                str(attributeprovisorisch) + "</td></tr> <tr><td>ist "
                "offiziell: </td><td>" + str(offiziell) +
                "</td></tr> <tr><td>Status: "
                "</td><td>" + str(status) + "</td></tr> <tr><td>in Aenderung: "
                "</td><td>" + str(inaenderung) + "</td></tr> <tr><td>Art: "
                "</td><td>" + str(art) + "</td></tr>  </table>")
            text_item.setDocument(text_document)

            # This is a workaround: first ever position is not correct.
            text_item.setMapPosition(
                QgsPoint(x + 10 * self.canvas.mapUnitsPerPixel(),
                         y - 10 * self.canvas.mapUnitsPerPixel()))
            text_item.update()

            self.iface.mapCanvas().refresh()

            try:
                vlayer_lokalisationsname.setSelectedFeatures([ids[idx + 1]])
            except IndexError:
                self.message_bar.pushInfo(
                    "Information",
                    _translate("VeriSO_EE_Geb_LokTest", "End of table.", None))

        except Exception as e:
            QApplication.restoreOverrideCursor()
            exc_type, exc_value, exc_traceback = sys.exc_info()
            self.message_bar.pushMessage(
                "Error",
                str(traceback.format_exc(exc_traceback)),
                level=QgsMessageBar.CRITICAL,
                duration=0)
        QApplication.restoreOverrideCursor()
        QApplication.restoreOverrideCursor()
Example #9
0
    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