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 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 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 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 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_5(self, degrees_0, degrees_1): num = None num1 = None self.txtLat.Value = degrees_0.ToString() if len(str(int(degrees_1))) == 3: self.txtLong.Value = degrees_1.ToString("dddmmss.ssssH") else: self.txtLong.Value = degrees_1.ToString("ddmmss.ssssH") flag, xVal, yVal = Geo.smethod_3(degrees_0, degrees_1) if flag: self.txtPointX.setText(str(xVal)) self.txtPointY.setText(str(yVal)) self.resultPoint3d.ID = self.id self.txtAltitudeM.setText(str(0.0)) self.resultPoint3d = Point3D(degrees_1.value, degrees_0.value) self.txtID.setText("") return True