def __init__(self, parent): FlightPlanBaseSimpleDlg.__init__(self, parent) self.setObjectName("DmeToleranceDlg") self.surfaceType = SurfaceTypes.DmeTolerance self.dmeTolerance = Distance.NaN() self.slantTolerance = Distance.NaN() self.pilotDistance = Distance.NaN() self.groundDistance = Distance.NaN() self.initParametersPan() self.setWindowTitle("DME Tolerance and Slant Range") self.method_29() self.method_28() self.resize(550, 550) QgisHelper.matchingDialogSize(self, 550, 600) self.vorDmeFeatureArray = [] self.currentLayer = define._canvas.currentLayer() self.resultLayerList = [] # self.rwyFeatureArray = [] # self.thrPoint3d = None # self.thrEndPoint3d = None self.initBasedOnCmb()
def initParametersPan(self): ui = Ui_RnavDmeUpdateAreaDlg() self.parametersPanel = ui FlightPlanBaseSimpleDlg.initParametersPan(self) '''init panel''' self.parametersPanel.pnlDme1 = PositionPanel(ui.gbDme1) # self.parametersPanel.pnlDme1.groupBox.setTitle("DME Position") self.parametersPanel.pnlDme1.btnCalculater.hide() self.parametersPanel.pnlDme1.hideframe_Altitude() self.parametersPanel.pnlDme1.setObjectName("positionDme1") ui.vl_Dme1.insertWidget(1, self.parametersPanel.pnlDme1) self.parametersPanel.pnlDme2 = PositionPanel(ui.gbDme2) # self.parametersPanel.pnlDme1.groupBox.setTitle("DME Position") self.parametersPanel.pnlDme2.btnCalculater.hide() self.parametersPanel.pnlDme2.hideframe_Altitude() self.parametersPanel.pnlDme2.setObjectName("positionDme2") ui.vl_Dme2.insertWidget(1, self.parametersPanel.pnlDme2) self.parametersPanel.cmbConstructionType.addItems(["2D", "3D"]) '''signal and slost''' self.parametersPanel.btnMesureDoc1.clicked.connect(self.measureToolDoc1) self.parametersPanel.btnMesureDoc2.clicked.connect(self.measureToolDoc2)
def btnUpdateQA_Click(self): # clip = QApplication.clipboard() # QMessageBox.warning(self, "WWW", clip.text()) # dlg = QaWindow(self) # dlg.show() if (not self.method_27(False)): return text = self.windowTitle() flag, text = DlgQaHeading.smethod_0(self, text) if (flag): qATable = QATable() qATable.TableType = QATableType.General, qATable.Heading = text stringBuilder = StringBuilder() stringBuilder.AppendLine("Runway THR") stringBuilder.AppendLine( self.parametersPanel.pnlTHR.method_8(" ")) stringBuilder.AppendLine("Navigational AID Position") stringBuilder.AppendLine( self.parametersPanel.pnlNavAid.method_8(" ")) stringBuilder.AppendLine( self.parametersPanel.grbParameters.title()) stringBuilder.AppendLine( self.parametersPanel.txtDirection.method_6(" ")) stringBuilder.AppendLine( ComboBox.method_11(self.parametersPanel.cmbCategory, self.parametersPanel.label_69, " ")) qATable.Text = stringBuilder.ToString() FlightPlanBaseSimpleDlg.method_27(self, qATable)
def __init__(self, parent): FlightPlanBaseSimpleDlg.__init__(self, parent) self.setObjectName("IasToTas") self.surfaceType = SurfaceTypes.IasToTas self.initParametersPan() self.setWindowTitle(SurfaceTypes.IasToTas) QgisHelper.matchingDialogSize(self, 650, 600)
def initParametersPan(self): ui = Ui_IasToTas() self.parametersPanel = ui FlightPlanBaseSimpleDlg.initParametersPan(self) self.parametersPanel.pnlWind = WindPanel( self.parametersPanel.gbNonStandard) self.parametersPanel.pnlWind.lblIA.setMinimumSize(180, 0) self.parametersPanel.pnlWind.speedBox.setEnabled(False) self.parametersPanel.vLayoutNonStandard.insertWidget( 0, self.parametersPanel.pnlWind) self.parametersPanel.pnlWind.setAltitude( Altitude(float(self.parametersPanel.txtAltitude.text()), AltitudeUnits.FT)) self.parametersPanel.txtAltitude.textChanged.connect( self.txtAltitudeChanged) self.parametersPanel.cmbType.addItems([ IasTasSegmentType.Departure, IasTasSegmentType.Enroute, IasTasSegmentType.Holding, IasTasSegmentType.InitialRR, IasTasSegmentType.InitialDR, IasTasSegmentType.IafIfFaf, IasTasSegmentType.MissedApproach ]) self.parametersPanel.cmbType.currentIndexChanged.connect( self.method_29) self.parametersPanel.txtIAS.textChanged.connect(self.method_29) self.parametersPanel.txtAltitude.textChanged.connect(self.method_29) self.parametersPanel.txtTime.textChanged.connect(self.method_29) self.parametersPanel.txtISA.textChanged.connect(self.method_29) self.parametersPanel.btnEST.clicked.connect(self.btnESTClicked) self.parametersPanel.btnREA.clicked.connect(self.btnREAClicked) self.parametersPanel.btnC.clicked.connect(self.btnCClicked) self.parametersPanel.btnD.clicked.connect(self.btnDClicked) self.parametersPanel.btnX.clicked.connect(self.btnXClicked) self.parametersPanel.btnNonStd.clicked.connect(self.btnNonStdClicked) self.parametersPanel.txtAltitudeM.textChanged.connect( self.txtAltitudeMChanged) self.parametersPanel.txtAltitude.textChanged.connect( self.txtAltitudeFtChanged) self.flag = 0 if self.flag == 0: self.flag = 2 if self.flag == 1: self.flag = 0 if self.flag == 2: try: self.parametersPanel.txtAltitudeM.setText( str( Unit.ConvertFeetToMeter( float(self.parametersPanel.txtAltitude.text())))) except: self.parametersPanel.txtAltitudeM.setText("0.0") self.method_29()
def initParametersPan(self): ui = Ui_DmeToleranceDlg() self.parametersPanel = ui FlightPlanBaseSimpleDlg.initParametersPan(self) '''init panel''' self.parametersPanel.pnlDME = PositionPanel(ui.gbConstruction) self.parametersPanel.pnlDME.groupBox.setTitle("DME Position") self.parametersPanel.pnlDME.btnCalculater.hide() self.parametersPanel.pnlDME.hideframe_Altitude() self.parametersPanel.pnlDME.setObjectName("positionDme") ui.vl_gbConstruction.insertWidget(1, self.parametersPanel.pnlDME) self.parametersPanel.cmbCalculationType.addItems([DmeToleranceCalculationType.Ground, DmeToleranceCalculationType.Aircraft]) self.parametersPanel.cmbConstructionType.addItems([DmeToleranceConstructionType.Circle, DmeToleranceConstructionType.Arc]) self.parametersPanel.btnMesureSlant.setVisible(False) self.parametersPanel.btnMesureTolerance.setVisible(False) # self.parametersPanel.txtRadial.setText("0") self.parametersPanel.cmbCalculationType.setCurrentIndex(1) '''signal and slost''' self.parametersPanel.cmbCalculationType.currentIndexChanged.connect(self.method_30) self.parametersPanel.txtDistance.textChanged.connect(self.method_30) self.parametersPanel.btnMesureDist.clicked.connect(self.measureToolDistance) self.parametersPanel.txtAcAltitude.textChanged.connect(self.method_30) self.parametersPanel.txtDmeAltitude.textChanged.connect(self.method_30) self.parametersPanel.cmbConstructionType.currentIndexChanged.connect(self.method_28) # self.parametersPanel.btnCaptureRadial.clicked.connect(self.captureRadial) self.parametersPanel.btnMesureAltitude.clicked.connect(self.measureToolAltitude) self.parametersPanel.txtAcAltitudeM.textChanged.connect(self.txtAcAltitudeMChanged) self.parametersPanel.txtAcAltitude.textChanged.connect(self.txtAcAltitudeFtChanged) self.flag = 0 if self.flag==0: self.flag=2; if self.flag==1: self.flag=0; if self.flag==2: try: self.parametersPanel.txtAcAltitudeM.setText(str(round(Unit.ConvertFeetToMeter(float(self.parametersPanel.txtAcAltitude.text())), 4))) except: self.parametersPanel.txtAcAltitudeM.setText("0.0") self.parametersPanel.txtDmeAltitude.textChanged.connect(self.txtDmeAltitudeMChanged) self.parametersPanel.txtDmeAltitudeFt.textChanged.connect(self.txtDmeAltitudeFtChanged) self.flag1 = 0 if self.flag1==0: self.flag1=1; if self.flag1==2: self.flag1=0; if self.flag1==1: try: self.parametersPanel.txtDmeAltitudeFt.setText(str(round(Unit.ConvertMeterToFeet(float(self.parametersPanel.txtDmeAltitude.text())), 4))) except: self.parametersPanel.txtDmeAltitudeFt.setText("0.0")
def __init__(self, parent): FlightPlanBaseSimpleDlg.__init__(self, parent) self.setObjectName("RnavDmeUpdateAreaDlg") self.surfaceType = SurfaceTypes.DmeUpdateArea self.initParametersPan() self.setWindowTitle("DME Update Area Construction") self.resize(450, 370) QgisHelper.matchingDialogSize(self, 550, 500) self.vorDmeFeatureArray1 = dict() self.currentLayer = define._canvas.currentLayer() self.initBasedOnCmb1() self.vorDmeFeatureArray = dict() self.initBasedOnCmb()
def uiStateInit(self): # self.ui.btnUpdateQA.setVisible(False) self.ui.btnConstruct.setVisible(False) self.ui.btnPDTCheck.setVisible(False) self.ui.btnExportResult.setVisible(False) # self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click) return FlightPlanBaseSimpleDlg.uiStateInit(self)
def initParametersPan(self): ui = Ui_Form_AAC() self.parametersPanel = ui FlightPlanBaseSimpleDlg.initParametersPan(self) self.parametersPanel.pnlNavAid = PositionPanel( self.ui.scrollAreaWidgetContents) self.parametersPanel.pnlNavAid.groupBox.setTitle( "Navigational AID Position") self.parametersPanel.pnlNavAid.hideframe_Altitude() self.parametersPanel.pnlNavAid.setObjectName("positionNavAid") self.parametersPanel.pnlNavAid.btnCalculater.hide() self.parametersPanel.verticalLayout_AAC.insertWidget( 2, self.parametersPanel.pnlNavAid) self.parametersPanel.pnlTHR = PositionPanel( self.ui.scrollAreaWidgetContents) self.parametersPanel.pnlTHR.groupBox.setTitle("Runway THR") self.parametersPanel.pnlTHR.btnCalculater.hide() self.parametersPanel.pnlTHR.hideframe_Altitude() self.parametersPanel.pnlTHR.setObjectName("positionTHR") self.parametersPanel.verticalLayout_AAC.insertWidget( 3, self.parametersPanel.pnlTHR) self.resize(500, 450) self.parametersPanel.cmbCategory.addItems( [Captions.ALL, Captions.CAT_A_B_ONLY]) self.connect(self.parametersPanel.pnlTHR, SIGNAL("positionChanged"), self.calcBearing) self.parametersPanel.pnlEnd = PositionPanel( self.ui.scrollAreaWidgetContents) self.parametersPanel.pnlEnd.groupBox.setTitle("Runway End") self.parametersPanel.pnlEnd.btnCalculater.hide() self.parametersPanel.pnlEnd.hideframe_Altitude() self.parametersPanel.pnlEnd.setObjectName("positionEnd") self.parametersPanel.verticalLayout_AAC.insertWidget( 4, self.parametersPanel.pnlEnd) self.connect(self.parametersPanel.pnlEnd, SIGNAL("positionChanged"), self.calcBearing) # self.resize(460,350) # self.parametersPanel.cmbCategory.addItems([Captions.ALL, Captions.CAT_A_B_ONLY]) '''Event Handlers Connect'''
def __init__(self, parent): FlightPlanBaseSimpleDlg.__init__(self, parent) self.setObjectName("ApproachAlignmentDesigner") self.surfaceType = SurfaceTypes.ApproachAlignment self.initParametersPan() self.setWindowTitle(SurfaceTypes.ApproachAlignment) QgisHelper.matchingDialogSize(self, 670, 600) self.arpFeatureArray = [] self.currentLayer = define._canvas.currentLayer() self.rwyFeatureArray = [] self.thrPoint3d = None self.thrEndPoint3d = None self.resultLayers = [] self.initAerodromeAndRwyCmb() pt = QaHeadingColumn("ttt", 2, True) d = pt.__class__.__dict__['Index'] pass
def btnConstruct_Click(self): flag = FlightPlanBaseSimpleDlg.btnConstruct_Click(self) if not flag: return num = 0.0 point3d = Point3D() point3d1 = Point3D() if not self.method_27(True): return point3d2 = self.parametersPanel.pnlTHR.getPoint3D() point3d3 = self.parametersPanel.pnlNavAid.getPoint3D() num1 = Unit.ConvertDegToRad(float(self.parametersPanel.txtDirection.Value)) point3d4 = MathHelper.distanceBearingPoint(point3d2, num1 + 3.14159265358979, 1400) num2 = -1 if MathHelper.smethod_115(point3d3, point3d2, point3d4): num2 = 1 point3d5 = MathHelper.distanceBearingPoint(point3d4, num2 * 1.5707963267949 + num1, 150) point3d6 = MathHelper.distanceBearingPoint(point3d5, num1 + 3.14159265358979, 17120) if self.parametersPanel.cmbCategory.currentIndex() != 1: num = 0.267949192 elif self.parametersPanel.cmbCategory.currentIndex() == 1: num = 0.577350269 point3d7 = MathHelper.distanceBearingPoint(point3d6, num1 - num2 * 1.5707963267949, 150 + num * 17120) MathHelper.distanceBearingPoint(point3d5, num1, 150 / num) point3d = MathHelper.getIntersectionPoint(point3d3, MathHelper.distanceBearingPoint(point3d3, num1 + 1.5707963267949, 100), point3d2, point3d4) if point3d == None: raise UserWarning, Messages.ERR_FAILED_TO_CALCULATE_INTERSECTION_POINT num3 = MathHelper.calcDistance(point3d3, point3d) / 0.087488664 if MathHelper.calcDistance(point3d, point3d4) >= num3: point3d1 = point3d4 MathHelper.distanceBearingPoint(point3d6, num1 - num2 * 1.5707963267949, 1525.321791) else: point3d1 = MathHelper.distanceBearingPoint(point3d, num1 + 3.14159265358979, num3) MathHelper.distanceBearingPoint(point3d6, num1 - num2 * 1.5707963267949, 150 + 0.087488664 * (17120 - MathHelper.calcDistance(point3d4, point3d1))) MathHelper.distanceBearingPoint(point3d4, num1 + 3.14159265358979, 17120); constructionLayer = AcadHelper.createVectorLayer("AAConstruction", QGis.Line) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, PolylineArea([point3d7, point3d4])) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, PolylineArea([point3d1, point3d4, point3d5])) QgisHelper.appendToCanvas(define._canvas, [constructionLayer], SurfaceTypes.ApproachAlignment) QgisHelper.zoomToLayers([constructionLayer]) self.resultLayerList = [constructionLayer]
def btnConstruct_Click(self): flag = FlightPlanBaseSimpleDlg.btnConstruct_Click(self) if not flag: return # mapUnits = define._canvas.mapUnits() constructionLayer = None if self.parametersPanel.cmbConstructionType.currentText() == "2D": constructionLayer = AcadHelper.createVectorLayer(SurfaceTypes.DmeUpdateArea) # if define._mapCrs == None: # if mapUnits == QGis.Meters: # constructionLayer = QgsVectorLayer("linestring?crs=EPSG:32633", SurfaceTypes.DmeUpdateArea, "memory") # else: # constructionLayer = QgsVectorLayer("linestring?crs=EPSG:4326", SurfaceTypes.DmeUpdateArea, "memory") # else: # constructionLayer = QgsVectorLayer("linestring?crs=%s"%define._mapCrs.authid (), SurfaceTypes.DmeUpdateArea, "memory") # shpPath = "" # if define.obstaclePath != None: # shpPath = define.obstaclePath # elif define.xmlPath != None: # shpPath = define.xmlPath # else: # shpPath = define.appPath # er = QgsVectorFileWriter.writeAsVectorFormat(constructionLayer, shpPath + "/" + QString(SurfaceTypes.DmeUpdateArea).replace(" ", "") + ".shp", "utf-8", constructionLayer.crs()) # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(SurfaceTypes.DmeUpdateArea).replace(" ", "") + ".shp", SurfaceTypes.DmeUpdateArea, "ogr") point3d = self.parametersPanel.pnlDme1.Point3d point3d1 = self.parametersPanel.pnlDme2.Point3d num = MathHelper.calcDistance(point3d, point3d1) num1 = num * 0.5 num2 = math.sqrt(num * num - num1 * num1) num3 = MathHelper.getBearing(point3d, point3d1) point3d2 = MathHelper.distanceBearingPoint(point3d, num3, 0.5 * num) point3d3 = MathHelper.distanceBearingPoint(point3d2, num3 - 1.5707963267949, num2) point3d4 = MathHelper.distanceBearingPoint(point3d2, num3 + 1.5707963267949, num2) distance = Distance(float(self.parametersPanel.txtDoc1.text()), DistanceUnits.NM) metres = distance.Metres distance1 = Distance(float(self.parametersPanel.txtDoc2.text()), DistanceUnits.NM) metres1 = distance1.Metres circlePointList = MathHelper.constructCircle(point3d, metres, 100) circlePointList1 = MathHelper.constructCircle(point3d1, metres1, 100) circlePointList2 = MathHelper.constructCircle(point3d3, num, 100) circlePointList3 = MathHelper.constructCircle(point3d4, num, 100) circlePointList4 = MathHelper.constructCircle(point3d, 1900, 100) circlePointList5 = MathHelper.constructCircle(point3d1, 1900, 100) # constructionLayer.startEditing() polygon = QgsGeometry.fromPolygon([circlePointList]) # feature0 = QgsFeature() # feature0.setGeometry(polygon) # constructionLayer.addFeature(feature0) polygon = QgsGeometry.fromPolygon([circlePointList]) polygon1 = QgsGeometry.fromPolygon([circlePointList1]) polygon2 = QgsGeometry.fromPolygon([circlePointList2]) polygon3 = QgsGeometry.fromPolygon([circlePointList3]) polygon4 = QgsGeometry.fromPolygon([circlePointList4]) polygon5 = QgsGeometry.fromPolygon([circlePointList5]) polygon0 = polygon.intersection(polygon1) polygon0 = polygon0.intersection(polygon2) polygon0 = polygon0.difference(polygon3) polygon0 = polygon0.difference(polygon4) polygon0 = polygon0.difference(polygon5) pointArray = QgsGeometry.asPolygon(polygon0) # feature1 = QgsFeature() # feature1.setGeometry(QgsGeometry.fromPolyline(pointArray[0])) # constructionLayer.addFeature(feature1) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, pointArray[0]) polygon0 = polygon.intersection(polygon1) polygon0 = polygon0.intersection(polygon3) polygon0 = polygon0.difference(polygon2) polygon0 = polygon0.difference(polygon4) polygon0 = polygon0.difference(polygon5) pointArray = QgsGeometry.asPolygon(polygon0) # feature1 = QgsFeature() # feature1.setGeometry(QgsGeometry.fromPolyline(pointArray[0])) # # constructionLayer.addFeature(feature1) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, pointArray[0]) # constructionLayer.commitChanges() else: constructionLayer = AcadHelper.createVectorLayer(SurfaceTypes.DmeUpdateArea, QGis.Polygon) # if define._mapCrs == None: # if mapUnits == QGis.Meters: # constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", SurfaceTypes.DmeUpdateArea, "memory") # else: # constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", SurfaceTypes.DmeUpdateArea, "memory") # else: # constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), SurfaceTypes.DmeUpdateArea, "memory") # shpPath = "" # if define.obstaclePath != None: # shpPath = define.obstaclePath # elif define.xmlPath != None: # shpPath = define.xmlPath # else: # shpPath = define.appPath # er = QgsVectorFileWriter.writeAsVectorFormat(constructionLayer, shpPath + "/" + QString(SurfaceTypes.DmeUpdateArea).replace(" ", "") + ".shp", "utf-8", constructionLayer.crs()) # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(SurfaceTypes.DmeUpdateArea).replace(" ", "") + ".shp", SurfaceTypes.DmeUpdateArea, "ogr") point3d = self.parametersPanel.pnlDme1.Point3d point3d1 = self.parametersPanel.pnlDme2.Point3d num = MathHelper.calcDistance(point3d, point3d1) num1 = num * 0.5 num2 = math.sqrt(num * num - num1 * num1) num3 = MathHelper.getBearing(point3d, point3d1) point3d2 = MathHelper.distanceBearingPoint(point3d, num3, 0.5 * num) point3d3 = MathHelper.distanceBearingPoint(point3d2, num3 - 1.5707963267949, num2) point3d4 = MathHelper.distanceBearingPoint(point3d2, num3 + 1.5707963267949, num2) distance = Distance(float(self.parametersPanel.txtDoc1.text()), DistanceUnits.NM) metres = distance.Metres distance1 = Distance(float(self.parametersPanel.txtDoc2.text()), DistanceUnits.NM) metres1 = distance1.Metres circlePointList = MathHelper.constructCircle(point3d, metres, 100) circlePointList1 = MathHelper.constructCircle(point3d1, metres1, 100) circlePointList2 = MathHelper.constructCircle(point3d3, num, 100) circlePointList3 = MathHelper.constructCircle(point3d4, num, 100) circlePointList4 = MathHelper.constructCircle(point3d, 1900, 100) circlePointList5 = MathHelper.constructCircle(point3d1, 1900, 100) # constructionLayer.startEditing() polygon = QgsGeometry.fromPolygon([circlePointList]) # feature0 = QgsFeature() # feature0.setGeometry(polygon) # constructionLayer.addFeature(feature0) polygon = QgsGeometry.fromPolygon([circlePointList]) polygon1 = QgsGeometry.fromPolygon([circlePointList1]) polygon2 = QgsGeometry.fromPolygon([circlePointList2]) polygon3 = QgsGeometry.fromPolygon([circlePointList3]) polygon4 = QgsGeometry.fromPolygon([circlePointList4]) polygon5 = QgsGeometry.fromPolygon([circlePointList5]) polygon0 = polygon.intersection(polygon1) polygon0 = polygon0.intersection(polygon2) polygon0 = polygon0.difference(polygon3) polygon0 = polygon0.difference(polygon4) polygon0 = polygon0.difference(polygon5) # feature1 = QgsFeature() # feature1.setGeometry(polygon0) # constructionLayer.addFeature(feature1) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, polygon0.asPolygon()[0]) polygon0 = polygon.intersection(polygon1) polygon0 = polygon0.intersection(polygon3) polygon0 = polygon0.difference(polygon2) polygon0 = polygon0.difference(polygon4) polygon0 = polygon0.difference(polygon5) # feature2 = QgsFeature() # feature2.setGeometry(polygon0) # constructionLayer.addFeature(feature2) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, polygon0.asPolygon()[0]) # constructionLayer.commitChanges() QgisHelper.appendToCanvas(define._canvas, [constructionLayer], SurfaceTypes.DmeUpdateArea) self.resultLayerList = [constructionLayer] QgisHelper.zoomToLayers([constructionLayer])
def btnConstruct_Click(self): flag = FlightPlanBaseSimpleDlg.btnConstruct_Click(self) if not flag: return constructionLayer = AcadHelper.createVectorLayer(SurfaceTypes.DmeTolerance, QGis.Line) point3d1 = self.parametersPanel.pnlDME.Point3d circleAreaList = [] # length = self.groundDistance.Metres / 5 # # rectangle = QgsRectangle(point3d1.get_X() - length / 2, point3d1.get_Y() - length / 2, point3d1.get_X() + length / 2, point3d1.get_Y() + length / 2,) # point1 = Point3D(point3d1.get_X() - length / 2, point3d1.get_Y() + length / 2) # point2 = Point3D(point3d1.get_X() - length / 2, point3d1.get_Y() - length / 2) captionCircleLine = [] centerPoint = None radius = 0.0 arc = None; resultPoint3dArrayList = [] if (self.groundDistance.Metres > 0): metres = self.dmeTolerance.valueMetres / 1.7; if (self.parametersPanel.cmbConstructionType.currentIndex() != 0): num1 = Unit.ConvertDegToRad(float(self.parametersPanel.pnlRadial.Value)); num2 = math.asin(min([1 / self.groundDistance.NauticalMiles, 1])); num3 = num1 + num2 num4 = num1 - num2 # arc = PolylineArea() # arc.Add(PolylineAreaPoint(point3d1, self.groundDistance.Metres)) arc = MathHelper.constructArc(point3d1, self.groundDistance.Metres, num3, num4, 30); point3d = MathHelper.distanceBearingPoint(point3d1, num1, self.groundDistance.Metres); captionCircleLine = [MathHelper.distanceBearingPoint(point3d, MathHelper.getBearing(point3d, point3d1) + math.pi / 2, self.groundDistance.Metres / 20), MathHelper.distanceBearingPoint(point3d, MathHelper.getBearing(point3d, point3d1) - math.pi / 2, self.groundDistance.Metres / 20)] num = -num1; if (self.parametersPanel.chbDrawRadial.isChecked()): line = PolylineArea([point3d1, point3d]); resultPoint3dArrayList.append([point3d1, point3d]) # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer); else: arc = MathHelper.constructCircle(point3d1, self.groundDistance.Metres, 50); circleAreaList.append(PolylineArea(None, point3d1, self.groundDistance.Metres)) centerPoint = point3d1 radius = self.groundDistance.Metres point3d = MathHelper.distanceBearingPoint(point3d1, 0, self.groundDistance.Metres); length = self.groundDistance.Metres / 5 # rectangle = QgsRectangle(point3d1.get_X() - length / 2, point3d1.get_Y() - length / 2, point3d1.get_X() + length / 2, point3d1.get_Y() + length / 2,) point1 = MathHelper.distanceBearingPoint(point3d, Unit.ConvertDegToRad(270), length / 4)#Point3D(point3d.get_X() - length / 4, point3d.get_Y()) point2 = MathHelper.distanceBearingPoint(point3d, Unit.ConvertDegToRad(90), length / 4)#Point3D(point3d.get_X() + length / 4, point3d.get_Y()) captionCircleLine = [point1, point2] num = 0; resultPoint3dArrayList.append(arc) # AcadHelper.smethod_18(transaction, blockTableRecord, arc, constructionLayer); if (self.parametersPanel.chbWriteText.isChecked()): nauticalMiles = self.groundDistance.NauticalMiles; # DBText dBText = AcadHelper.smethod_138(string.Format("{0} DME", nauticalMiles.ToString("0.#")), point3d, metres, 1); # dBText.set_Rotation(num); # AcadHelper.smethod_18(transaction, blockTableRecord, dBText, constructionLayer); if (self.parametersPanel.chbDrawDmeTol.isVisible() and self.parametersPanel.chbDrawDmeTol.isChecked() and self.dmeTolerance.IsValid() and arc != None): offsetCurf = QgisHelper.offsetCurve(arc, self.dmeTolerance.Metres) if self.parametersPanel.cmbConstructionType.currentIndex() == 0: circleAreaList.append(PolylineArea(None, centerPoint, radius + self.dmeTolerance.Metres)) if (self.parametersPanel.cmbConstructionType.currentIndex() == 0): endPoint = offsetCurf[0] offsetCurf.append(endPoint) resultPoint3dArrayList.append(offsetCurf) # foreach (Entity offsetCurf in arc.GetOffsetCurves(self.dmeTolerance.Metres)) # { # AcadHelper.smethod_19(transaction, blockTableRecord, offsetCurf, constructionLayer, 5); # } entity = QgisHelper.offsetCurve(arc, -(self.dmeTolerance.Metres + self.slantTolerance.Metres)) if self.parametersPanel.cmbConstructionType.currentIndex() == 0: circleAreaList.append(PolylineArea(None, centerPoint, radius -(self.dmeTolerance.Metres + self.slantTolerance.Metres))) if (self.parametersPanel.cmbConstructionType.currentIndex() == 0): endPoint = entity[0] entity.append(endPoint) resultPoint3dArrayList.append(entity) # foreach (Entity entity in arc.GetOffsetCurves(-(self.dmeTolerance.Metres + self.slantTolerance.Metres))) # { # AcadHelper.smethod_19(transaction, blockTableRecord, entity, constructionLayer, 5); # } # } if (self.parametersPanel.chbDrawSlantTol.isVisible() and self.parametersPanel.chbDrawSlantTol.isChecked() and self.slantTolerance.IsValid() and arc != None): offsetCurf1 = QgisHelper.offsetCurve(arc, -self.slantTolerance.Metres) if self.parametersPanel.cmbConstructionType.currentIndex() == 0: circleAreaList.append(PolylineArea(None, centerPoint, radius -self.slantTolerance.Metres)) if (self.parametersPanel.cmbConstructionType.currentIndex() == 0): endPoint = offsetCurf1[0] offsetCurf1.append(endPoint) resultPoint3dArrayList.append(offsetCurf1) # foreach (Entity offsetCurf1 in arc.GetOffsetCurves(-self.slantTolerance.Metres)) # { # AcadHelper.smethod_19(transaction, blockTableRecord, offsetCurf1, constructionLayer, 2); # } # } if (self.parametersPanel.chbInsertSymbol.isChecked()): length = self.groundDistance.Metres / 5 rectangle = QgsRectangle(point3d1.get_X() - length / 2, point3d1.get_Y() - length / 2, point3d1.get_X() + length / 2, point3d1.get_Y() + length / 2,) point1 = MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(315), length / 2)#Point3D(point3d1.get_X() - length / 2, point3d1.get_Y() + length / 2) point2 = MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(225), length / 2)#Point3D(point3d1.get_X() - length / 2, point3d1.get_Y() - length / 2) point3 = MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(135), length / 2)#Point3D(point3d1.get_X() + length / 2, point3d1.get_Y() - length / 2) point4 = MathHelper.distanceBearingPoint(point3d1, Unit.ConvertDegToRad(45), length / 2)#Point3D(point3d1.get_X() + length / 2, point3d1.get_Y() + length / 2) resultPoint3dArrayList.append([point1, point2, point3, point4, point1]) # Symbol symbol = new Symbol(SymbolType.Dme); # AcadHelper.smethod_57(transaction, blockTableRecord, symbol.BlockName, symbol.BlockFileName, point3d1, new Scale3d(1), 0, constructionLayer, None); # } for point3dArray in resultPoint3dArrayList: if (self.parametersPanel.cmbConstructionType.currentIndex() != 0): bulge = MathHelper.smethod_60(point3dArray[0], point3dArray[int(len(point3dArray)/2)], point3dArray[len(point3dArray)-1]) AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, point3dArray, False, {"Bulge":bulge}) if self.parametersPanel.cmbConstructionType.currentIndex() == 0: for area in circleAreaList: AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, area) if self.parametersPanel.chbInsertSymbol.isChecked(): AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, [point1, point2, point3, point4, point1]) if (self.parametersPanel.chbWriteText.isChecked()): AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, captionCircleLine, False, {"Caption":"3DME"} ) palSetting = QgsPalLayerSettings() palSetting.readFromLayer(constructionLayer) palSetting.enabled = True palSetting.fieldName = "Caption" palSetting.isExpression = True palSetting.placement = QgsPalLayerSettings.Line palSetting.placementFlags = QgsPalLayerSettings.AboveLine palSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True, True, '12', "") palSetting.writeToLayer(constructionLayer) QgisHelper.appendToCanvas(define._canvas, [constructionLayer], self.surfaceType, True) QgisHelper.zoomToLayers([constructionLayer]) self.resultLayerList = [constructionLayer]