def positionGeoChanged(self): try: if self.flag1 == 0: self.flag1 = 2 if self.flag1 == 1: self.flag1 = 0 if self.flag1 == 2: latDegree = Degrees.String2Degree(self.txtLat.Value) lonDegree = Degrees.String2Degree(self.txtLong.Value) point3dPlan = QgisHelper.CrsTransformPoint( lonDegree.value, latDegree.value, define._latLonCrs, define._xyCrs) self.txtPointX.setText(str(point3dPlan.get_X())) self.txtPointY.setText(str(point3dPlan.get_Y())) if self.alwwaysShowString == "Degree": self.resultPoint3d = Point3D( lonDegree.value, latDegree.value, float(self.txtAltitudeM.text())) else: if define._units == QGis.Meters: self.resultPoint3d = Point3D( float(self.txtPointX.text()), float(self.txtPointY.text()), float(self.txtAltitudeM.text())) else: self.resultPoint3d = Point3D( lonDegree.value, latDegree.value, float(self.txtAltitudeM.text())) self.emit(SIGNAL("positionChanged"), self) except: raise "This geodetic coordinate can not be converted to plan coordinate."
def method_4(self): if (self.xy): return Position(self.type, self.id, self.xlat, self.ylon, Altitude(self.altitude)) return Position(self.type, self.id, None, None, Altitude(self.altitude), Degrees.smethod_1(self.xlat), Degrees.smethod_5(self.ylon))
def method_0(self): if (self.xy): xlatValue = self.xlat ylonValue = self.ylon return True, xlatValue, ylonValue result, ylonValue, xlatValue = Geo.smethod_3(Degrees.smethod_1(self.xlat), Degrees.smethod_5(self.ylon)) return result, xlatValue, ylonValue
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 resultPointValueListMethod(resultValueList, dataBaseProcedureData_0, point3d_0, procEntityListType_0, parent): if len(resultValueList) > 0: lat = None lon = None if define._units == QGis.Meters: point3d = QgisHelper.CrsTransformPoint( float(resultValueList[1]), float(resultValueList[2]), define._xyCrs, define._latLonCrs) lat = Degrees(point3d.get_Y(), None, None, DegreesType.Latitude) lon = Degrees(point3d.get_X(), None, None, DegreesType.Longitude) else: lat = Degrees(float(resultValueList[2]), None, None, DegreesType.Latitude) lon = Degrees(float(resultValueList[1]), None, None, DegreesType.Longitude) str0 = lon.method_1("dddmmss.ssssH") textString = lat.method_1("ddmmss.ssssH") procEntityBases = DlgAixmSelectPosition.smethod_1( dataBaseProcedureData_0, procEntityListType_0, point3d_0, textString, str0) dlgAixmSelectPosition = DlgAixmSelectPosition() naN = None degree = None result, naN, degree = Geo.smethod_2(point3d_0.get_X(), point3d_0.get_Y()) if (result): dataBaseProcedureData_0.method_60(procEntityBases, procEntityListType_0, naN.ToString(), degree.ToString()) dlgAixmSelectPosition.lstItems.Sorted = True for procEntityBase in procEntityBases: dlgAixmSelectPosition.lstItems.Add(procEntityBase) if (procEntityListType_0 != ProcEntityListType.CentersEx and procEntityListType_0 != ProcEntityListType.FixesEx): dlgAixmSelectPosition.btnNewPCP.setEnabled(False) dlgAixmSelectPosition.btnNewPCP.setVisible(False) resultDlg = dlgAixmSelectPosition.exec_() procEntityBase_0 = None if (resultDlg != 1): if dlgAixmSelectPosition.newTypeSelected == NewDbEntryType.DPN: flag, procEntityBase_0 = DlgAixmNewDPN.smethod_0( dataBaseProcedureData_0, naN, degree) elif dlgAixmSelectPosition.newTypeSelected == NewDbEntryType.PCP: flag, procEntityBase_0 = DlgAixmNewPCP.smethod_0( dataBaseProcedureData_0, naN, degree) else: flag = False else: procEntityBase_0 = dlgAixmSelectPosition.lstItems.SelectedItem flag = True QObject.emit(parent, SIGNAL("DlgAixmSelectPosition_Smethod_0_Event"), flag, procEntityBase_0) return
def ToString(self, format_0 = None): stringBuilder = StringBuilder() if format_0 == None: format_0 = "" if not isinstance(format_0, QString): format_0 = String.Str2QString(format_0) # if (provider == null) # { # provider = CultureInfo.CurrentCulture # } if (not String.IsNullOrEmpty(format_0)): format_0 = format_0.toUpper() if (format_0.contains("QA:")): format_0 = format_0.replace("QA:", "") num = 0 try: num = int(format_0) except: num = 0 stringBuilder = StringBuilder() str0 = "" for i in range(num): str0 = QString(String.Concat([str0, " "])) if (not String.IsNullOrEmpty(self.id)): stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.ID, self.id)) if (not self.xy): lATITUDE = Captions.LATITUDE degree = Degrees.smethod_1(self.xlat) stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, lATITUDE, degree.method_2())) lONGITUDE = Captions.LONGITUDE degree1 = Degrees.smethod_5(self.ylon) stringBuilder.Append("{0}{1}\t{2}".format(str0, lONGITUDE, degree1.method_2())) else: stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.X, str(self.xlat)))#.ToString(Formats.GridXYFormat, provider))) stringBuilder.Append("{0}{1}\t{2}".format(str0, Captions.Y, str(self.ylon)))#.ToString(Formats.GridXYFormat, provider))) if (not self.altitude == None): altitude = Altitude(self.altitude) stringBuilder.AppendLine("") aLTITUDE = [str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft")] stringBuilder.Append("{0}{1}\t{2} ({3})".format(str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft"))) return stringBuilder.ToString() stringBuilder = StringBuilder() if (not String.IsNullOrEmpty(self.id)): stringBuilder.Append(self.id + ", ") if (not self.xy): degree2 = Degrees.smethod_1(self.xlat) str1 = degree2.method_2() degree3 = Degrees.smethod_5(self.ylon) stringBuilder.Append(str1 + ", " + degree3.method_2()) else: stringBuilder.Append(str(self.xlat) + ", " + str(self.ylon)) if (not self.altitude == None): altitude1 = Altitude(self.altitude) stringBuilder.Append(", {0} ({1})", ", " + altitude1.ToString(":m") + " (" + altitude1.ToString(":ft") + ")") return stringBuilder.ToString()
def acceptDlg(self): degree = None degree1 = None # this.errorProvider.method_1(); # this.pnlCodeId.method_0(); # # this.pnlPosition.method_6(); # if (self.pnlCodeType.method_0()) # { codeTypeDesigPtAixm = self.pnlCodeType.SelectedItem if (codeTypeDesigPtAixm == CodeTypeDesigPtAixm.ICAO): # if (self.pnlCodeId.method_0()) # { procEntityBases = self.data.method_54(self.pnlCodeId.Value) if (procEntityBases != None and len(procEntityBases) > 0): self.pnlCodeId.method_2(Validations.UNIQUE_IDENTIFIER_REQUIRED) return elif (codeTypeDesigPtAixm == CodeTypeDesigPtAixm.ADHP): if (self.pnlLocation.SelectedIndex < 1 and self.pnlAssociation.SelectedIndex < 1): err = self.pnlLocation.Caption + " : \n" + \ Validations.PLEASE_SELECT_AN_ITEM + "\n" + \ self.pnlAssociation.Caption + " : \n" + \ Validations.PLEASE_SELECT_AN_ITEM QMessageBox.warning(self, "Warning", err) return elif (self.pnlAssociation.SelectedIndex > 0): procEntityBases1 = self.data.method_55( self.pnlCodeId.Value, self.pnlAssociation.SelectedItem) if (procEntityBases1 != None and procEntityBases1.Count > 0): self.pnlCodeId.method_2( Validations.UNIQUE_IDENTIFIER_REQUIRED) return value = self.pnlCodeId.Value result, degree, degree1 = self.pnlPosition.method_3() if (self.data.method_57( self.pnlCodeId.Value, Degrees(degree1, None, None, DegreesType.Latitude), Degrees(degree, None, None, DegreesType.Longitude)) != None): strS = "Cannot create a duplicate DPN entry.\n\nCodeID = {0}\nLatitude = {1}\nLongitude = {2}".format( value, str(degree), str(degree1)) QMessageBox.warning(self, "Error", strS) return codeTypeDesigPtAixm1 = self.pnlCodeType.SelectedItem self.dbEntry = ProcEntityDPN( value, Degrees(degree1, None, None, DegreesType.Latitude).method_1("ddmmss.ssssh"), Degrees(degree, None, None, DegreesType.Longitude).method_1("dddmmss.ssssh"), self.pnlAssociation.SelectedItem, self.pnlLocation.SelectedItem, codeTypeDesigPtAixm1, self.pnlName.Value, self.txtRemarks.Value, True) self.data.method_52(self.dbEntry) self.accept()
def get_Point3d(self): if (not self.IsValid): raise Messages.ERR_INVALID_OR_INCOMPLETE_POSITION if (self.xy): if (self.altitude == None or math.isinf(self.altitude)): return Point3D(self.xlat, self.ylon, 0) return Point3D(self.xlat, self.ylon, self.altitude) result, num, num1 = Geo.smethod_3(Degrees.smethod_1(self.xlat), Degrees.smethod_5(self.ylon)) if (not result): raise "Geo.LastError" if (self.altitude == None or math.isinf(self.altitude)): return Point3D(num, num1, 0) return Point3D(num, num1, self.altitude)
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 setPosition(self, x, y): degreeLat = None degreeLon = None if (math.fabs(x) >= 89.99999999 and math.fabs(y) >= 180): self.txtPointX.setText(str(x)) self.txtPointY.setText(str(y)) try: flag, degreeLat, degreeLon = Geo.smethod_2( float(self.txtPointX.text()), float(self.txtPointY.text())) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString("dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") except: pass else: degreeLat = Degrees(y, None, None, DegreesType.Latitude) degreeLon = Degrees(x, None, None, DegreesType.Longitude) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString("dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") flag, xVal, yVal = Geo.smethod_3(degreeLat, degreeLon) if flag: self.txtPointX.setText(str(xVal)) self.txtPointY.setText(str(yVal)) if self.alwwaysShowString == "Degree": self.resultPoint3d = Point3D(degreeLon.value, degreeLat.value) else: self.resultPoint3d = Point3D(x, y) self.setAnnotation()
def acceptDlg(self): degree = None degree1 = None value = self.pnlDesig.Value result, degree, degree1 = self.pnlPosition.method_3() if (self.data.method_26( self.pnlDesig.Value, Degrees(degree1, None, None, DegreesType.Latitude), Degrees(degree, None, None, DegreesType.Latitude)) != None): strS = "Cannot create a duplicate PCP entry.\n\nCodeID = {0}\nLatitude = {1}\nLongitude = {2}".format( value, str(degree), str(degree1)) QMessageBox.warning(self, "Error", strS) return self.dbEntry = ProcEntityPCP( None, value, Degrees(degree1, None, None, DegreesType.Latitude).ToString(), Degrees(degree, None, None, DegreesType.Longitude).ToString(), self.pnlType.Value, self.txtRemarks.Value, True) self.data.method_24(self.dbEntry) self.accept()
def setPoint3D(self, point_0): degreeLon = None degreeLat = None if point_0 == None: self.txtPointX.setText("") self.txtPointY.setText("") self.txtLat.Value = "" self.txtLong.Value = "" self.txtAltitudeM.setText("0.0") self.resultPoint3d = None return else: if (math.fabs(point_0.get_X()) >= 89.99999999 and math.fabs(point_0.get_Y()) >= 180): self.txtPointX.setText(str(point_0.get_X())) self.txtPointY.setText(str(point_0.get_Y())) try: flag, degreeLat, degreeLon = Geo.smethod_2( float(self.txtPointX.text()), float(self.txtPointY.text())) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString( "dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") except: pass else: degreeLat = Degrees(point_0.get_Y(), None, None, DegreesType.Latitude) degreeLon = Degrees(point_0.get_X(), None, None, DegreesType.Longitude) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString("dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") flag, xVal, yVal = Geo.smethod_3(degreeLat, degreeLon) if flag: self.txtPointX.setText(str(xVal)) self.txtPointY.setText(str(yVal)) self.txtAltitudeM.setText(str(point_0.get_Z())) if isinstance(point_0, Point3D): self.txtID.setText(point_0.ID) if self.alwwaysShowString == "Degree" or define._units != QGis.Meters: self.resultPoint3d = Point3D(degreeLon.value, degreeLat.value, point_0.get_Z()) else: self.resultPoint3d = Point3D(float(self.txtPointX.text()), float(self.txtPointY.text()), point_0.get_Z()) self.setAnnotation()
def resultPointValueListMethod(self, resultValueList): degreeLat = None degreeLon = None if len(resultValueList) > 0: self.id = resultValueList[0] if define._units == QGis.Meters: self.txtPointX.setText(resultValueList[1]) self.txtPointY.setText(resultValueList[2]) try: flag, degreeLat, degreeLon = Geo.smethod_2( float(self.txtPointX.text()), float(self.txtPointY.text())) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString( "dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") except: pass else: degreeLat = Degrees(float(resultValueList[2]), None, None, DegreesType.Latitude) degreeLon = Degrees(float(resultValueList[1]), None, None, DegreesType.Longitude) self.txtLat.Value = degreeLat.ToString() if len(str(int(degreeLon.value))) == 3: self.txtLong.Value = degreeLon.ToString("dddmmss.ssssH") else: self.txtLong.Value = degreeLon.ToString("ddmmss.ssssH") flag, xVal, yVal = Geo.smethod_3(degreeLat, degreeLon) if flag: self.txtPointX.setText(str(xVal)) self.txtPointY.setText(str(yVal)) # self.txtPointX.setText(resultValueList[1]) # self.txtPointY.setText(resultValueList[2]) if self.alwwaysShowString == "Degree": self.resultPoint3d = Point3D(degreeLon.value, degreeLat.value, float(resultValueList[3])) else: self.resultPoint3d = Point3D(float(resultValueList[1]), float(resultValueList[2]), float(resultValueList[3])) self.resultPoint3d.ID = self.id self.txtAltitudeM.setText(str(round(float(resultValueList[3])))) self.txtID.setText(resultValueList[0]) self.setAnnotation() self.emit(SIGNAL("captureFinished"), self) self.emit(SIGNAL("positionChanged"), self)
def method_1(self): if (self.xy): return Geo.smethod_2(self.xlat, self.ylon) degreesLat = Degrees.smethod_1(self.xlat) degreesLon = Degrees.smethod_5(self.ylon) return True, degreesLat, degreesLon
def calculateP(self): degree = None degree1 = None degree2 = None degree3 = None num = None result, degree, degree1 = self.parametersPanel.pnlStartPosP.method_3() if (result): # self.pnlVarStart.Value.smethod_17(); num1 = float(self.parametersPanel.pnlVarFinishP.Value) value = float(self.parametersPanel.txtForwardTP.Value) value1 = float(self.parametersPanel.txtForwardTP.Value) distance = self.parametersPanel.txtDistanceP.Value result, degree2, degree3, num = Geo.smethod_6( self.parametersPanel.cmbCalculationTypeP.SelectedItem, degree, degree1, value, distance) if (result): num2 = MathHelper.smethod_3(num - num1) self.method_29_P() self.resultPoint3d = Point3D(degree3, degree2) self.resultLat = degree2 self.resultLon = degree3 latStr = Degrees(degree2, None, None, DegreesType.Latitude).ToString() self.resultModelP.setItem(0, 0, QStandardItem(Captions.LATITUDE)) self.resultModelP.setItem(0, 1, QStandardItem(latStr)) lonStr = Degrees(degree3, None, None, DegreesType.Longitude).ToString() if String.Str2QString(lonStr).mid(0, 1) == "0": lonStr = String.Str2QString(lonStr).mid( 1, String.Str2QString(lonStr).length() - 1) self.resultModelP.setItem(1, 0, QStandardItem(Captions.LONGITUDE)) self.resultModelP.setItem(1, 1, QStandardItem(lonStr)) self.resultModelP.setItem( 2, 0, QStandardItem(Captions.REVERSE_TRUE_BEARING)) self.resultModelP.setItem(2, 1, QStandardItem(str(round(num, 4)))) self.resultModelP.setItem( 3, 0, QStandardItem(Captions.REVERSE_MAGNETIC_BEARING)) self.resultModelP.setItem(3, 1, QStandardItem(str(round(num2, 4)))) dataList = [] dataList.append([ "Latitude (Start)", "Longitude (Start)", "Variation (Start)", "Forward (° T)", "Forward (° M)", "Distance (nm)", "Distance (km)", "Latitude (Finish)", "Longitude (Finish)", "Variation (Finish)", "Reverse (° T)", "Reverse (° M)" ]) dataList.append([ str(degree), str(degree1), str(self.parametersPanel.pnlVarStartP.Value), str(self.parametersPanel.txtForwardTP.Value), str(self.parametersPanel.txtForwardMP.Value), str(distance.NauticalMiles), str(distance.Kilometres), str(degree2), str(degree3), str(self.parametersPanel.pnlVarFinishP.Value), str(round(num, 4)), str(round(num2, 4)) ]) GeoDetermineDlg.HistoryDataP.append(dataList) self.setDataInHistoryModel(dataList) self.method_28_P(degree2, degree3)
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