def btnInsert_Click(self):
     selectedNode = self.trvPositions.SelectedNode
     if (selectedNode == None):
         return
     tag = selectedNode.Tag
     if (tag == None):
         return
     if (tag.Type == PositionType.THR):
         selectedNode = selectedNode.Insert(
             0, PositionType.VariableNames[PositionType.Position - 1])
         selectedNode.Tag = Position(PositionType.Position)
     elif (tag.Type != PositionType.END):
         if (tag.Type != PositionType.Position):
             return
         if selectedNode.Parent == None:
             selectedNode = self.trvPositions.Insert(
                 selectedNode.Index,
                 PositionType.VariableNames[PositionType.Position - 1])
         else:
             selectedNode = selectedNode.Parent.Insert(
                 selectedNode.Index,
                 PositionType.VariableNames[PositionType.Position - 1])
         selectedNode.Tag = Position(PositionType.Position)
     else:
         selectedNode = selectedNode.PrevNode.Add(
             PositionType.VariableNames[PositionType.Position - 1])
         selectedNode.Tag = Position(PositionType.Position)
     self.trvPositions.SelectedNode = selectedNode
 def method_5(self, runway_0):
     self.trvPositions.treeNodeList = []
     if (runway_0 != None):
         position = runway_0.method_1(PositionType.START)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = runway_0.method_1(PositionType.THR)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = runway_0.method_1(PositionType.END)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = runway_0.method_1(PositionType.SWY)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = runway_0.method_1(PositionType.CWY)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         item = self.trvPositions.Nodes[1]
         for position0 in runway_0:
             if (position0.Type != PositionType.Position):
                 continue
             item.Add(PositionType.VariableNames[position0.Type -
                                                 1]).Tag = position0
         # item.Expand()
     else:
         self.trvPositions.Add("START").Tag = Position(PositionType.START)
         self.trvPositions.Add("THR").Tag = Position(PositionType.THR)
         self.trvPositions.Add("END").Tag = Position(PositionType.END)
         self.trvPositions.Add("SWY").Tag = Position(PositionType.SWY)
         self.trvPositions.Add("CWY").Tag = Position(PositionType.CWY)
     self.trvPositions.SelectedNode = self.trvPositions.Nodes[0]
     self.method_10()
 def ClearItems(self):
     while True:
         if len(self) == 0: break
         self.pop(len(self) - 1)
     self.Add(Position(PositionType.START))
     self.Add(Position(PositionType.END))
     self.Add(Position(PositionType.CWY))
 def smethod_0(binaryReader_0, byte_0):
     if not isinstance(binaryReader_0, QDataStream):
         return
     position = Position()
     fato = Fato()
     if (byte_0 != 1):
         raise Messages.ERR_INVALID_FILE_FORMAT
         # throw new Exception(Messages.ERR_INVALID_FILE_FORMAT)
     fato.name = binaryReader_0.readQString()
     fato.des1 = binaryReader_0.readQString()
     fato.des2 = binaryReader_0.readQString()
     fato.safetyAreaWidth = binaryReader_0.readDouble()
     fato.safetyAreaStart = binaryReader_0.readDouble()
     fato.safetyAreaEnd = binaryReader_0.readDouble()
     num = binaryReader_0.readInt()
     for i in range(num):
         positionType = binaryReader_0.readInt()
         flag = binaryReader_0.readBool()
         if (binaryReader_0.readBool()):
             position = Position(positionType, None, None, None, Altitude(binaryReader_0.readDouble()), Degrees.smethod_1(binaryReader_0.readDouble()), Degrees.smethod_5(binaryReader_0.readDouble())) if(not flag) else Position(positionType, None, binaryReader_0.readDouble(), binaryReader_0.readDouble(), Altitude(binaryReader_0.readDouble()))
             if (i >= 3):
                 fato.Add(position)
             else:
                 fato[i] = position
     return fato
 def method_5(self, fato_0):
     self.trvPositions.Clear()
     if (fato_0 != None):
         position = fato_0.method_1(PositionType.START)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = fato_0.method_1(PositionType.END)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         position = fato_0.method_1(PositionType.CWY)
         self.trvPositions.Add(PositionType.VariableNames[position.Type -
                                                          1]).Tag = position
         item = self.trvPositions.Nodes[0]
         for fato0 in fato_0:
             if (fato0.Type != PositionType.Position):
                 continue
             item.Add(PositionType.VariableNames[fato0.Type -
                                                 1]).Tag = fato0
     else:
         self.trvPositions.Nodes.Add("START").Tag = Position(
             PositionType.START)
         self.trvPositions.Nodes.Add("END").Tag = Position(PositionType.END)
         self.trvPositions.Nodes.Add("CWY").Tag = Position(PositionType.CWY)
     self.trvPositions.SelectedNode = self.trvPositions.Nodes[0]
     self.pnlPosition.posType = PositionType.START
     self.method_10()
    def __init__(self):
        list.__init__(self)

        self.des1 = ""
        self.des2 = ""
        self.name = ""

        self.Add(Position(PositionType.START))
        self.Add(Position(PositionType.THR))
        self.Add(Position(PositionType.END))
        self.Add(Position(PositionType.SWY))
        self.Add(Position(PositionType.CWY))
    def __init__(self):
        list.__init__(self)

        self.des1 = ""
        self.des2 = ""
        self.name = ""

        self.safetyAreaStart = 0.0
        self.safetyAreaEnd = 0.0
        self.safetyAreaWidth = 0.0

        self.Add(Position(PositionType.START))
        self.Add(Position(PositionType.END))
        self.Add(Position(PositionType.CWY))
 def method_1(self, positionType_0):
     position = None
     try:
         for current in self:
             if (current.Type != positionType_0):
                 continue
             position = current
             return position
         return Position(positionType_0)
     except:
         pass
     return position
 def method_5(self, bool_0, string_0, string_1):
     position = Position()
     stringBuilder = StringBuilder()
     string_1 = QString(string_1)
     str0 = "qa:{0}".format(string_1.length())
     sAFETYAREAWIDTH = Captions.SAFETY_AREA_WIDTH
     distance = Distance(self.safetyAreaWidth)
     stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREAWIDTH, distance.method_0("0.##:m")))
     sAFETYAREALENGTHSTART = Captions.SAFETY_AREA_LENGTH_START
     distance1 = Distance(self.safetyAreaStart)
     stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHSTART, distance1.method_0("0.##:m")))
     sAFETYAREALENGTHEND = Captions.SAFETY_AREA_LENGTH_END
     distance2 = Distance(self.safetyAreaEnd)
     stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHEND, distance2.method_0("0.##:m")))
     if (self.method_4(PositionType.START)):
         position = self.method_1(PositionType.START).method_3() if(not bool_0) else self.method_1(PositionType.START).method_2()
         stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     for position1 in self:
         if (position1.Type != PositionType.Position or not position1.IsValidIncludingAltitude):
             continue
         position = position1.method_3() if(not bool_0) else position1.method_2()
         stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_4(PositionType.END)):
         position = self.method_1(PositionType.END).method_3() if(not bool_0) else self.method_1(PositionType.END).method_2()
         stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     if (self.method_4(PositionType.CWY)):
         position = self.method_1(PositionType.CWY).method_3() if(not bool_0) else self.method_1(PositionType.CWY).method_2()
         stringBuilder.AppendLine(String.Concat([string_0, position.Type.VariableNames[position.Type - 1]]))
         stringBuilder.AppendLine(position.method_5(str0))
     return stringBuilder.ToString()
 def method_1(self, positionType_0):
     position = None
     for current in self:
     # using (IEnumerator<Position> enumerator = base.GetEnumerator())
     # {
     #     while (enumerator.MoveNext())
     #     {
     #         Position current = enumerator.Current
         if (current.Type != positionType_0):
             continue
         position = current
         return position
     return Position(positionType_0)
 def get_Position(self):
     position = None
     if (self.inputType != "XY"):
         position = Position(None, None, None, None, None,
                             Degrees.smethod_1(self.Point3d.get_X()),
                             Degrees.smethod_5(self.Point3d.get_Y()))
     else:
         position = Position(None, None, self.Point3d.get_X(),
                             self.Point3d.get_Y())
     position.ID = self.txtID.text()
     if (self.hasAltitude):
         position.altitude = self.Point3d.get_Z()
     position.Type = self.posType
     return position
    def smethod_0(dataStream, byte_0=0):
        ####### dataStream must be the instance of QDataStream.
        if not isinstance(dataStream, QDataStream):
            QMessageBox.warning(None, "Warning", "Please use the QDataStream")
            return

        position = None
        runway = Runway()

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

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

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

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