コード例 #1
0
    def resultPointValueListMethod(self, resultValueList):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        point  = Point3D()
        try:
            point = Point3D(float(resultValueList[1]), float(resultValueList[2]), float(resultValueList[3]))
        except:
            return
        if (not self.flagP):
            mapUnits = define._canvas.mapUnits()
            self.constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)

            self.point3dP = point.smethod_167(0);
            self.origin1P = self.method_31(self.polylineP, self.originP, self.point3dP, self.numP, self.metresP, self.speedP, self.num2P, self.orientationTypeP);
            AcadHelper.setGeometryAndAttributesInLayer(self.constructionLayer, self.polylineP)
            QgisHelper.appendToCanvas(define._canvas, [self.constructionLayer], self.surfaceType)

            # polyline.Draw();
        else:

            mapUnits = define._canvas.mapUnits()
            self.constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)
            self.originP = point.smethod_167(0);
            self.polylineP, self.origin1P = self.method_30(self.originP, self.numP, self.metresP, self.speedP, self.num2P, self.orientationTypeP);
            AcadHelper.setGeometryAndAttributesInLayer(self.constructionLayer, self.polylineP)
            QgisHelper.appendToCanvas(define._canvas, [self.constructionLayer], self.surfaceType)
            # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
        self.flagP = not self.flagP;
        self.resultLayerList = [self.constructionLayer]
        if (not self.flagP):
            define._messageLabel.setText(Prompts.SECOND_POSITION_FINISH);
        else:
            define._messageLabel.setText(Prompts.POSITION_FINISH)
        pass
コード例 #2
0
    def nominal2Layer(self):
        resultLayer = AcadHelper.createVectorLayer(
            "NominalTrack_" +
            self.surfaceType.replace(" ", "_").replace("-", "_"), QGis.Line)
        startPoint3d = self.parametersPanel.pnlRwyStart.Point3d
        derPoint3d = self.parametersPanel.pnlDer.Point3d
        bearing = MathHelper.getBearing(startPoint3d, derPoint3d)
        derPoint3d1 = MathHelper.distanceBearingPoint(derPoint3d, bearing, 100)
        derPoint3d2 = MathHelper.distanceBearingPoint(derPoint3d, bearing,
                                                      self.circleArea[0].bulge)
        geom = QgsGeometry.fromPolyline(self.area123).intersection(
            QgsGeometry.fromPolyline([derPoint3d1, derPoint3d2]))
        intersectionPoint1 = geom.asPoint()

        derPoint3d1 = MathHelper.distanceBearingPoint(derPoint3d, bearing, 100)
        bearing = MathHelper.smethod_4(bearing + math.pi)
        derPoint3d2 = MathHelper.distanceBearingPoint(
            derPoint3d, bearing,
            MathHelper.calcDistance(derPoint3d, startPoint3d) + 200)
        geom = QgsGeometry.fromPolyline(
            PolylineArea(self.area123).method_14_closed()).intersection(
                QgsGeometry.fromPolyline([derPoint3d1, derPoint3d2]))
        intersectionPoint2 = geom.asPoint()
        AcadHelper.setGeometryAndAttributesInLayer(
            resultLayer, [intersectionPoint1, derPoint3d])

        return resultLayer
コード例 #3
0
    def showMarkDaSoc(self):
        try:
            flag = FlightPlanBaseDlg.btnConstruct_Click(self)

            self.putDistances()

            point3dMapt = self.parametersPanel.pnlMaPtPosition.Point3d
            socLayer = AcadHelper.createVectorLayer(
                "SOC_MAPt_" + self.surfaceType, QGis.Point)
            AcadHelper.setGeometryAndAttributesInLayer(socLayer,
                                                       self.socPoint3d, False,
                                                       {"Caption": "SOC"})
            AcadHelper.setGeometryAndAttributesInLayer(socLayer, point3dMapt,
                                                       False,
                                                       {"Caption": "MAPt"})

            QgisHelper.appendToCanvas(define._canvas, [socLayer],
                                      self.surfaceType)

            palSetting = QgsPalLayerSettings()
            palSetting.readFromLayer(socLayer)
            palSetting.enabled = True
            palSetting.fieldName = "Caption"
            palSetting.isExpression = True
            palSetting.placement = QgsPalLayerSettings.AroundPoint
            palSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True,
                                              True, '8', "")
            palSetting.writeToLayer(socLayer)

            self.resultLayerList = [socLayer]

            return socLayer
        except:
            pass
コード例 #4
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.ui = Ui_DlgComplexAreas()
        self.ui.setupUi(self)

        self.stdItemModel = QStandardItemModel()
        self.ui.lstAreas.setModel(self.stdItemModel)

              
        ''' buttons clicked connect '''
        self.ui.btnAddPrimaryArea.clicked.connect(self.btnAddPrimaryArea_Click)
        self.ui.btnAddSecondaryArea.clicked.connect(self.btnAddSecondaryArea_Click)
        self.ui.btnRemove.clicked.connect(self.btnRemove_Click)
        self.ui.btnCaptureTrack.clicked.connect(self.btnCaptureTrack_Click)
        self.ui.buttonBoxOkCancel.accepted.connect(self.acceptEvent)
        self.ui.buttonBoxOkCancel.rejected.connect(self.rejectedEvent)
        self.ui.txtTrack.textChanged.connect(self.txtTrack_TextChanged)
        self.ui.lstAreas.clicked.connect(self.lstAreas_Click)

        self.ui.btnCaptureTrack.clicked.connect(self.captureTrack)

        self.complexObstacleArea = ComplexObstacleArea()
        self.itemCount = 0
        self.selectedModelIndex = None
        self.resultPolylineAreaListForDrawing = []
        self.method_9()


        self.constructionLayer = AcadHelper.createVectorLayer("TempComplexObstacleAreaLayer");
        QgisHelper.appendToCanvas(define._canvas, [self.constructionLayer], "Temp")
コード例 #5
0
    def resultSelectedFeatureByRectTasDraw(self, geom, distance,
                                           direction_bearing):
        # flag = FlightPlanBaseSimpleDlg.btnConstruct_Click(self)
        # if not flag:
        #     return
        if define._userLayers == None:
            mapUnits = define._canvas.mapUnits()
            constructionLayer = AcadHelper.createVectorLayer(
                "Lines", QGis.Line)
            AcadHelper.setGeometryAndAttributesInLayer(
                constructionLayer, geom.asPolyline(), False,
                {"Caption": str(round(distance, 4)) + "m"})

            define._userLayers = constructionLayer
            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, '8', "")
            palSetting.writeToLayer(constructionLayer)
            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      "Users layer", True)
            # self.resultLayerList = [constructionLayer]
        else:

            # constructionLayer = AcadHelper.createVectorLayer("Lines", QGis.Line)
            constructionLayer = define._userLayers
            iter = define._userLayers.getFeatures()
            equalFlag = 0
            for feat in iter:
                # AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, feat)
                if geom.equals(feat.geometry()):
                    equalFlag += 1
            if equalFlag <= 0:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, geom.asPolyline(), False,
                    {"Caption": str(round(distance, 4)) + "m"})

            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, '8', "")
            palSetting.writeToLayer(constructionLayer)
            # QgisHelper.appendToCanvas(define._canvas,[constructionLayer], "Users layer", True)
            # self.resultLayerList = [constructionLayer]
            QgisHelper.zoomToLayers([constructionLayer])
            define._userLayers = constructionLayer
        pass
コード例 #6
0
    def btnConstruct_Click(self):
        if len(self.resultLayerList) > 0:
            QgisHelper.removeFromCanvas(define._canvas, self.resultLayerList)
            self.resultLayerList = []
        try:
            point3d = self.parametersPanel.pnlTHR.getPoint3D()
            try:
                num = MathHelper.smethod_4(
                    Unit.ConvertDegToRad(
                        float(self.parametersPanel.txtRwyDir.Value) + 180))
            except ValueError:
                raise UserWarning, "Runway Direction is invalide!"
            altitude = self.parametersPanel.pnlOCAH.method_3(
                Altitude(point3d.get_Z()))
            metres = altitude.Metres
            if (metres < 10):
                raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE
            try:
                res, point3dCollection = self.method_37(
                    point3d, num, metres, metres / math.tan(
                        Unit.ConvertDegToRad(
                            float(self.parametersPanel.txtDescAngle.Value.
                                  Degrees) - 1.12)))
            except ValueError:
                raise UserWarning, "DescAngle is invalide!"
            if (not res):
                return
            self.surfaceArea = PrimaryObstacleArea(
                PolylineArea(point3dCollection))
            layer = AcadHelper.createVectorLayer("Visual Segment Surface")
            if (self.parametersPanel.cmbConstructionType.SelectedIndex !=
                    ConstructionType.Construct2D):
                face = [
                    point3dCollection.get_Item(0),
                    point3dCollection.get_Item(1),
                    point3dCollection.get_Item(2),
                    point3dCollection.get_Item(3),
                    point3dCollection.get_Item(0)
                ]
                AcadHelper.setGeometryAndAttributesInLayer(layer, face)
                # layer = QgisHelper.createPolylineLayer("Visual Segment Surface 3D", [(face, [])], [])
            else:
                face = point3dCollection
                face.append(point3dCollection[0])
                AcadHelper.setGeometryAndAttributesInLayer(layer, face)
                # layer = QgisHelper.createPolylineLayer("Visual Segment Surface 2D", [(face, [])], [])

            QgisHelper.appendToCanvas(define._canvas, [layer],
                                      SurfaceTypes.VisualSegmentSurface)
            QgisHelper.zoomToLayers([layer])
            self.resultLayerList = [layer]
            self.ui.btnEvaluate.setEnabled(True)

        except UserWarning as e:
            QMessageBox.warning(self, "Error", e.message)
コード例 #7
0
 def imethod_1(self, layers):
     resultLayer = AcadHelper.createVectorLayer(
         "Pins Visual Segment Departure")
     AcadHelper.setGeometryAndAttributesInLayer(
         resultLayer, self.paOIS, True,
         {"Surface": PinsSurfaceType.PinsSurfaceType_OIS})
     # pointList = self.paOIS.method_14_closed()
     # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure",
     #                                               [(pointList, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])],
     #                                               [QgsField("surface", QVariant.String)])
     layers.append(resultLayer)
コード例 #8
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        # self.parametersPanel.txtRadius.setText("")

        point3dCollection = None;
        point3dCollection1 = None;
        polylineArea = None;
        polylineArea1 = None;
        polylineArea2 = None;

        point3dArrayResult = []

        mapUnits = define._canvas.mapUnits()
        constructionLayer = None


        result, point3dCollection, point3dCollection1, polylineArea, polylineArea1, polylineArea2 = self.method_34()
        if result:
            point3dCollection2 = [];
            if (point3dCollection != None and len(point3dCollection) > 0):
                point3dCollection2.append(point3dCollection[0]);
            for point3d in point3dCollection1:
                point3dCollection2.append(point3d);
            if (point3dCollection != None and len(point3dCollection) > 0):
                point3dCollection2.append(point3dCollection[3]);
            # point3dCollection2.pop(3)
            # point3dCollection2.pop(3)
            # point3dArrayResult.append(polylineArea1.method_14_closed())
            # point3dArrayResult.append(polylineArea2.method_14_closed())
            point3dArrayResult.append(PolylineArea(point3dCollection2))

            self.area123 = point3dCollection2
            self.circleArea = polylineArea

            nominalPointTest1 = point3dCollection2[2]
            nominalPointTest2 = point3dCollection2[3]
            self.nominalPoint = MathHelper.distanceBearingPoint(nominalPointTest1, MathHelper.getBearing(nominalPointTest1, nominalPointTest2), MathHelper.calcDistance(nominalPointTest1, nominalPointTest2) / 2)
            # if polylineArea.isCircle:
            #     self.parametersPanel.txtRadius.setText(str(polylineArea.Radius()))
            point3dArrayResult.append(polylineArea)

        if not len(point3dArrayResult) > 0 :
            return
        constructionLayer = AcadHelper.createVectorLayer(self.surfaceType, QGis.Line)
        for point3dArray in point3dArrayResult:
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, point3dArray, True)
        nominalTrackLayer = self.nominal2Layer()
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer, nominalTrackLayer], self.surfaceType)
        self.resultLayerList = [constructionLayer, nominalTrackLayer]
        QgisHelper.zoomToLayers(self.resultLayerList)
        self.ui.btnEvaluate.setEnabled(True)
コード例 #9
0
    def DrawCanvas(self):
        qgsLayerTreeView = define._mLayerTreeView
        groupName = self.surfaceType
        layerTreeModel = qgsLayerTreeView.layerTreeModel()
        layerTreeGroup = layerTreeModel.rootGroup()
        rowCount = layerTreeModel.rowCount()
        groupExisting = False
        if rowCount > 0:
            for i in range(rowCount):
                qgsLayerTreeNode = layerTreeModel.index2node(
                    layerTreeModel.index(i, 0))
                if qgsLayerTreeNode.nodeType() == 0:
                    qgsLayerTreeNode._class_ = QgsLayerTreeGroup
                    if isinstance(qgsLayerTreeNode, QgsLayerTreeGroup
                                  ) and qgsLayerTreeNode.name() == groupName:
                        groupExisting = True

        if groupExisting:
            if len(self.resultLayerList) > 0:
                QgisHelper.removeFromCanvas(define._canvas,
                                            self.resultLayerList)
                self.resultLayerList = []
            else:
                QtGui.QMessageBox.warning(
                    self, "Warning", "Please remove \"" + self.surfaceType +
                    "\" layer group from LayerTreeView.")
                return

        constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)
        if self.comboBox.currentIndex(
        ) == ProtectionAreaType.Primary or self.comboBox.currentIndex(
        ) == ProtectionAreaType.Secondary:
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       self.area.PreviewArea,
                                                       True)

        elif self.comboBox.currentIndex(
        ) == ProtectionAreaType.PrimaryAndSecondary:
            AcadHelper.setGeometryAndAttributesInLayer(
                constructionLayer, self.area.primaryArea.PreviewArea, True)
            AcadHelper.setGeometryAndAttributesInLayer(
                constructionLayer, self.area.secondaryArea1.PreviewArea, True)
            AcadHelper.setGeometryAndAttributesInLayer(
                constructionLayer, self.area.secondaryArea2.PreviewArea, True)
        else:

            for obstacleArea in self.area:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, obstacleArea.PreviewArea, True)
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                  self.surfaceType)
        self.resultLayerList = [constructionLayer]
コード例 #10
0
    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]
コード例 #11
0
    def imethod_2(self, layers):
        resultLayer = AcadHelper.createVectorLayer(
            "Pins Visual Segment Departure")

        if (self.paOIS.Count == 4):

            face = [
                self.paOIS[0].Position, self.paOIS[1].Position,
                self.paOIS[2].Position, self.paOIS[3].Position,
                self.paOIS[0].Position
            ]
            # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure",
            #                                              [(face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)])],
            #                                              [QgsField("surface", QVariant.String)])
            AcadHelper.setGeometryAndAttributesInLayer(
                resultLayer, face, False,
                {"Surface": PinsSurfaceType.PinsSurfaceType_OIS})

            layers.append(resultLayer)
            return

        linesList = []
        face = [
            self.paOIS[0].Position, self.paOIS[1].Position,
            self.paOIS[4].Position, self.paOIS[5].Position,
            self.paOIS[0].Position
        ]
        AcadHelper.setGeometryAndAttributesInLayer(
            resultLayer, face, False,
            {"Surface": PinsSurfaceType.PinsSurfaceType_OIS})

        linesList.append(
            (face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)]))
        face = [
            self.paOIS[1].Position, self.paOIS[2].Position,
            self.paOIS[3].Position, self.paOIS[4].Position,
            self.paOIS[1].Position
        ]
        AcadHelper.setGeometryAndAttributesInLayer(
            resultLayer, face, False,
            {"Surface": PinsSurfaceType.PinsSurfaceType_OIS})

        linesList.append(
            (face, [("surface", PinsSurfaceType.PinsSurfaceType_OIS)]))
        # resultLayer = QgisHelper.createPolylineLayer("Pins Visual Segment Departure", linesList, [QgsField("surface", QVariant.String)])
        layers.append(resultLayer)
コード例 #12
0
    def btnRemove_Click(self):
        if self.selectedModelIndex != None:
            if QMessageBox.question(self, "Question", "Do you want to remove the selected item?", QMessageBox.Ok | QMessageBox.Cancel) == QMessageBox.Ok:
                n = self.selectedModelIndex.row()

                self.complexObstacleArea.pop(n)
                self.stdItemModel.removeRow(self.selectedModelIndex.row())
                self.itemCount -= 1

                self.constructionLayer = AcadHelper.createVectorLayer("TempComplexObstacleAreaLayer")
                for area in self.complexObstacleArea:
                    AcadHelper.setGeometryAndAttributesInLayer(self.constructionLayer, area.PreviewArea, True)
                QgisHelper.appendToCanvas(define._canvas, [self.constructionLayer], "Temp")
                QgisHelper.ClearRubberBandInCanvas(define._canvas)



            pass
コード例 #13
0
    def showMarkDaSoc(self):
        try:
            flag = FlightPlanBaseDlg.btnConstruct_Click(self)
            # if not flag:
            #     return
            point3dThr = self.parametersPanel.pnlThrPosition.Point3d
            point3dFaf = self.parametersPanel.pnlFapPosition.Point3d
            inboundTrackRad = Unit.ConvertDegToRad(self.parametersPanel.pnlInboundTrack.Value)#MathHelper.getBearing(point3dFaf, point3dThr)
            inboundTrack180Rad = MathHelper.smethod_4(inboundTrackRad + math.pi)
            estimatedAltitdeMeters = self.parametersPanel.pnlEstimatedAltitude.Value.Metres
            thrAltitudeMeters = self.parametersPanel.pnlThrPosition.Altitude().Metres
            heightLossAltitudeMeters = self.parametersPanel.pnlHeightLoss.Value.Metres
            rdhAltitudeMeters = self.parametersPanel.pnlRDH.Value.Metres
            vpa = Unit.ConvertDegToRad(self.getVPA())
            xz = self.parametersPanel.pnlDistXz.Value.Metres
            socThrDistMeters = ((estimatedAltitdeMeters - thrAltitudeMeters - heightLossAltitudeMeters) / math.tan(vpa)) + xz
            daThrDistMeters = (estimatedAltitdeMeters - thrAltitudeMeters - rdhAltitudeMeters) / math.tan(vpa)

            sockBearing = inboundTrackRad
            # if socThrDistMeters < 0:
            #     sockBearing = inboundTrack180Rad
            #     socThrDistMeters = math.fabs(socThrDistMeters)
            # else:
            #     sockBearing = inboundTrackRad
            daBearing = inboundTrack180Rad
            # if daThrDistMeters < 0:
            #     daBearing = inboundTrackRad
            #     daThrDistMeters = math.fabs(daThrDistMeters)
            # else:
            #     daBearing = inboundTrack180Rad
            self.socPoint3d = MathHelper.distanceBearingPoint(point3dThr, sockBearing, -socThrDistMeters).smethod_167(self.calcSocAltitude())
            self.daPoint3d = MathHelper.distanceBearingPoint(point3dThr, daBearing, daThrDistMeters)

            daSocLayer = AcadHelper.createVectorLayer("DA_SOC_" + self.surfaceType, QGis.Point)
            AcadHelper.setGeometryAndAttributesInLayer(daSocLayer, self.socPoint3d, False, {"Caption":"SOC"})
            AcadHelper.setGeometryAndAttributesInLayer(daSocLayer, self.daPoint3d, False, {"Caption":"DA"})

            QgisHelper.appendToCanvas(define._canvas, [daSocLayer], self.surfaceType)

            palSetting = QgsPalLayerSettings()
            palSetting.readFromLayer(daSocLayer)
            palSetting.enabled = True
            palSetting.fieldName = "Caption"
            palSetting.isExpression = True
            palSetting.placement = QgsPalLayerSettings.AroundPoint
            palSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True, True, '8', "")
            palSetting.writeToLayer(daSocLayer)

            QgisHelper.zoomToLayers([daSocLayer])
            self.resultLayerList = [daSocLayer]

            # # show SOC Mark
            # point3d = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - 0, 100)
            # point3d1 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - math.pi / 2, 100)
            # point3d2 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - math.pi, 100)
            # point3d3 = MathHelper.distanceBearingPoint(self.socPoint3d, Unit.ConvertDegToRad(450) - (math.pi * 3) / 2 , 100)
            #
            # if self.socRubber == None:
            #     self.socRubber = QgsRubberBand(define._canvas, QGis.Line)
            #     self.socRubber.setColor(Qt.yellow)
            # else:
            #     self.socRubber.reset(QGis.Line)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline([point3d, point3d2]), None)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline([point3d1, point3d3]), None)
            # circle = MathHelper.constructCircle(self.socPoint3d, 100, 16)
            # self.socRubber.addGeometry(QgsGeometry.fromPolyline(circle), None)
            # self.socRubber.show()
            #
            # self.socAnnotation.setMapPosition(self.socPoint3d)
            # self.socAnnotation.show()
            #
            # # show DA Mark
            # point3d = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - 0, 100)
            # point3d1 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - math.pi / 2, 100)
            # point3d2 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - math.pi, 100)
            # point3d3 = MathHelper.distanceBearingPoint(self.daPoint3d, Unit.ConvertDegToRad(450) - (math.pi * 3) / 2 , 100)
            #
            # if self.daRubber == None:
            #     self.daRubber = QgsRubberBand(define._canvas, QGis.Line)
            #     self.daRubber.setColor(Qt.yellow)
            # else:
            #     self.daRubber.reset(QGis.Line)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline([point3d, point3d2]), None)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline([point3d1, point3d3]), None)
            # circle = MathHelper.constructCircle(self.daPoint3d, 100, 16)
            # self.daRubber.addGeometry(QgsGeometry.fromPolyline(circle), None)
            # self.daRubber.show()
            #
            # self.daAnnotation.setMapPosition(self.daPoint3d)
            # self.daAnnotation.show()

            self.putDistances()
            return daSocLayer
        except:
            pass
コード例 #14
0
    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])
コード例 #15
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        mapUnits = define._canvas.mapUnits()
        constructionLayer = None

        polylines = self.method_36(True)
        pollineAreaLineList, polylineAreaArcList, centerPolylineArea = self.method_36_Construct(
            True)
        if (self.parametersPanel.cmbConstruction.currentText() !=
                ConstructionType.Construct3D):
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Line)
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       centerPolylineArea,
                                                       True)
            for polrlineArea in pollineAreaLineList:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polrlineArea)
            for polrlineArea in polylineAreaArcList:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polrlineArea)

        else:
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Polygon)
            # if define._mapCrs == None:
            #     if mapUnits == QGis.Meters:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", self.surfaceType, "memory")
            #     else:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", self.surfaceType, "memory")
            # else:
            #     constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), self.surfaceType, "memory")
            # constructionLayer.startEditing()
            count = len(polylines)
            num = 0.1 * count
            altitude = Altitude(float(self.parametersPanel.txtAltitude.text()),
                                AltitudeUnits.FT)
            value = Altitude(float(self.parametersPanel.txtMoc.text()),
                             AltitudeUnits.M)
            metres = altitude.Metres - value.Metres
            for i in range(count):
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polylines[len(polylines) - 1 - i], True)


#                 polygon1 = QgsGeometry.fromPolygon([polylines[i].method_14_closed(6)])
#                 polygonNew = polygon1
#                 if (i > 0):
#                     metres1 = altitude.Metres
# #                     value = self.pnlMoc.Value;
#                     metres = metres1 - num * value.Metres
#                     num = num - 0.1
#                 if (i > 0):
#                     polygon0 = QgsGeometry.fromPolygon([polylines[i - 1].method_14_closed(6)])
#                     polygonNew = polygon1.difference(polygon0)
#                 feature = QgsFeature()
#                 feature.setGeometry(polygonNew)
#                 constructionLayer.addFeature(feature)
#             constructionLayer.commitChanges()
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                  SurfaceTypes.HoldingRnp)
        self.resultLayerList = [constructionLayer]
        self.ui.btnEvaluate.setEnabled(True)
コード例 #16
0
    def method_28_BD(self):
        point3d = None
        point3d1 = None
        self.surfaceType = SurfaceTypes.GeoDetermineBD
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        if define._units == QGis.Meters:
            point3d0 = self.parametersPanel.pnlStartPosBD.Point3d
            point3dF0 = self.parametersPanel.pnlFinishPosBD.Point3d

            point3d = QgisHelper.CrsTransformPoint(point3d0.get_X(),
                                                   point3d0.get_Y(),
                                                   define._latLonCrs,
                                                   define._xyCrs)
            point3d1 = QgisHelper.CrsTransformPoint(point3dF0.get_X(),
                                                    point3dF0.get_Y(),
                                                    define._latLonCrs,
                                                    define._xyCrs)
        else:
            point3d = self.parametersPanel.pnlStartPosBD.Point3d
            point3d1 = self.parametersPanel.pnlFinishPosBD.Point3d

        constructionLayer = None
        mapUnits = define._canvas.mapUnits()
        if self.parametersPanel.chbMarkPointsBD.isChecked():
            constructionLayer = AcadHelper.createVectorLayer(
                SurfaceTypes.GeoDetermineBD + "_MarkPoint", QGis.Point)
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       point3d)
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       point3d1)

            # if mapUnits == QGis.Meters:
            #     constructionLayer = QgsVectorLayer("point?crs=%s"%define._xyCrs.authid (), SurfaceTypes.GeoDetermineBD + "_MarkPoint", "memory")
            # else:
            #     constructionLayer = QgsVectorLayer("point?crs=%s"%define._latLonCrs.authid (), SurfaceTypes.GeoDetermineBD + " MarkPoint", "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.GeoDetermineBD).replace(" ", "") + "_MarkPoint" + ".shp", "utf-8", constructionLayer.crs())
            # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(SurfaceTypes.GeoDetermineBD).replace(" ", "") + "_MarkPoint" + ".shp", SurfaceTypes.GeoDetermineBD + " MarkPoint", "ogr")
            #
            # constructionLayer.startEditing()
            #
            #
            # feature = QgsFeature()
            # feature.setGeometry(QgsGeometry.fromPoint(point3d))
            # constructionLayer.addFeature(feature)
            # feature.setGeometry(QgsGeometry.fromPoint(point3d1))
            # constructionLayer.addFeature(feature)
            # constructionLayer.commitChanges()
            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      SurfaceTypes.GeoDetermineBD)
            self.resultLayerList.append(constructionLayer)
        if self.parametersPanel.chbDrawLineBD.isChecked():
            constructionLayer = AcadHelper.createVectorLayer(
                SurfaceTypes.GeoDetermineBD + "_Line", QGis.Line)
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       [point3d, point3d1])
            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      SurfaceTypes.GeoDetermineBD)
            self.resultLayerList.append(constructionLayer)
コード例 #17
0
    def btnConstruct_Click(self):
        qgsLayerTreeView = define._mLayerTreeView
        groupName = self.surfaceType1
        layerTreeModel = qgsLayerTreeView.layerTreeModel()
        layerTreeGroup = layerTreeModel.rootGroup()
        rowCount = layerTreeModel.rowCount()
        groupExisting = False
        if rowCount > 0:
            for i in range(rowCount):
                qgsLayerTreeNode = layerTreeModel.index2node(
                    layerTreeModel.index(i, 0))
                if qgsLayerTreeNode.nodeType() == 0:
                    qgsLayerTreeNode._class_ = QgsLayerTreeGroup
                    if isinstance(qgsLayerTreeNode, QgsLayerTreeGroup
                                  ) and qgsLayerTreeNode.name() == groupName:
                        groupExisting = True

        if groupExisting:
            if len(self.resultLayerList1) > 0:
                QgisHelper.removeFromCanvas(define._canvas,
                                            self.resultLayerList1)
                self.resultLayerList1 = []
            else:
                QMessageBox.warning(
                    self, "Warning", "Please remove \"" + self.surfaceType1 +
                    "\" layer group from LayerTreeView.")
                return

        num = None
        num1 = None
        num2 = None
        num3 = None
        point3d = None
        resultPolylineAreaList = []
        # if (!AcadHelper.Ready)
        # {
        #     return;
        # }
        # if (!self.method_27(true))
        # {
        #     return;
        # }
        # string constructionLayer = base.ConstructionLayer;
        point3d1 = self.parametersPanel.pnlNavAid.Point3d
        value = float(self.parametersPanel.txtTrackRadial.Value)
        metres = Altitude(float(self.parametersPanel.txtAltitude.text()),
                          AltitudeUnits.FT).Metres
        z = metres - point3d1.get_Z()
        if (self.parametersPanel.cmbNavAidType.currentIndex() != 0):
            num = 450 - value + 90
            num1 = 15
            num2 = 25
            num3 = z * 0.839099631
        else:
            num = 450 - value + 90
            num1 = 5
            num2 = 15
            num3 = z * 1.191753593
        num4 = Unit.ConvertDegToRad(num1)
        num5 = Unit.ConvertDegToRad(360 - num1)
        num6 = Unit.ConvertDegToRad(180 - num2)
        num7 = Unit.ConvertDegToRad(180 + num2)
        num8 = 0
        num9 = Unit.ConvertDegToRad(180)
        point3d2 = MathHelper.distanceBearingPoint(point3d1, num4, num3)
        point3d3 = MathHelper.distanceBearingPoint(point3d1, num5, num3)
        point3d = MathHelper.smethod_68(
            point3d2, MathHelper.distanceBearingPoint(point3d1, num8, num3),
            point3d3)
        if (point3d == None):
            QMessageBox.warning(self, "Error",
                                Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT)
            return
        #     throw new Exception(Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT);
        num10 = MathHelper.smethod_55(
            point3d2, point3d3, MathHelper.calcDistance(point3d2, point3d))
        point3d2 = MathHelper.distanceBearingPoint(point3d1, num6, num3)
        point3d3 = MathHelper.distanceBearingPoint(point3d1, num7, num3)
        point3d = MathHelper.smethod_68(
            point3d2, MathHelper.distanceBearingPoint(point3d1, num9, num3),
            point3d3)
        if (point3d == None):
            QMessageBox.warning(self, "Error",
                                Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT)
        #     throw new Exception(Messages.ERR_FAILED_TO_CALCULATE_CENTER_POINT);
        num11 = MathHelper.smethod_55(
            point3d2, point3d3, MathHelper.calcDistance(point3d2, point3d))
        matrix3d = Matrix3d.Rotation(Unit.ConvertDegToRad(num),
                                     Vector3d(0, 0, 1), point3d1)
        point3d2 = MathHelper.distanceBearingPoint(point3d1, num8, num3)
        point3d3 = MathHelper.distanceBearingPoint(point3d1, num9, num3)
        line = PolylineArea([point3d2, point3d3])
        resultPolylineAreaList.append(
            self.TransformBy(line, Unit.ConvertDegToRad(value),
                             self.parametersPanel.pnlNavAid.Point3d)
        )  #.TransformBy(matrix3d))
        point3d2 = MathHelper.distanceBearingPoint(point3d1, num6, num3)
        point3d3 = MathHelper.distanceBearingPoint(point3d1, num4, num3)
        point3d4 = MathHelper.distanceBearingPoint(point3d1, num5, num3)
        point3d5 = MathHelper.distanceBearingPoint(point3d1, num7, num3)
        point3dArray = [point3d2, point3d3, point3d4, point3d5, point3d2]
        polyline = AcadHelper.smethod_126(point3dArray)
        if self.parametersPanel.cmbNavAidType.currentIndex() == 0:
            num10 = 0.0436609429083
            num11 = 0.131652497586
        else:
            num10 = 0.131652497586
            num11 = 0.221694662642
        polyline.SetBulgeAt(1, num10)
        polyline.SetBulgeAt(3, num11)
        # polyline.set_Elevation(point3d1.get_Z());
        resultPolylineAreaList.append(
            self.TransformBy(polyline, Unit.ConvertDegToRad(value),
                             self.parametersPanel.pnlNavAid.Point3d)
        )  #polyline.TransformBy(matrix3d))
        # polyline.TransformBy(matrix3d);
        # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
        # transaction.Commit();
        # AcadHelper.smethod_5();
        mapUnits = define._canvas.mapUnits()
        constructionLayer = AcadHelper.createVectorLayer(
            SurfaceTypes.OverheadTolerance, QGis.Line)
        for polylinrArea0 in resultPolylineAreaList:
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       polylinrArea0)
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                  SurfaceTypes.OverheadTolerance, True)
        self.resultLayerList1 = [constructionLayer]
        QgisHelper.zoomToLayers(self.resultLayerList1)
コード例 #18
0
    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]
コード例 #19
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        self.complexObstacleArea = ComplexObstacleArea()
        num = None;
        num1 = None;
        num2 = None;
        num3 = None;
        line = None;
#         if (!AcadHelper.Ready)
#         {
#             return;
#         }
#         if (!self.method_27(true))
#         {
#             return;
#         }
        constructionLayer = None;
        nominalTrackLayer = None;
        mapUnits = define._canvas.mapUnits()
        
        point3d = self.parametersPanel.pnlNavAid.Point3d;
        metres = Altitude(float(self.parametersPanel.txtStartAltitude.text())).Metres;
        metres1 = Altitude(float(self.parametersPanel.txtPrimaryMOC.text())).Metres;
        percent = float(self.parametersPanel.txtAltitudeChange.text());
        num4 = Unit.ConvertDegToRad(float(self.parametersPanel.txtTrackRadial.Value));
        metres2 = Distance(float(self.parametersPanel.txtDistStart.text()), DistanceUnits.NM).Metres;
        metres3 = Distance(float(self.parametersPanel.txtDistFinish.text()), DistanceUnits.NM).Metres;

        nominalTrackLayer = AcadHelper.createNominalTrackLayer([MathHelper.distanceBearingPoint(point3d, num4, metres2), MathHelper.distanceBearingPoint(point3d, num4, metres3)], None, "memory", "NominalTrack_" + self.surfaceType.replace(" ", "_").replace("-", "_"))

        if (self.parametersPanel.cmbNavAidType.SelectedIndex != 0):
            num = Unit.ConvertDegToRad(6.2);
            num1 = Unit.ConvertDegToRad(6.9);
            num2 = Unit.ConvertDegToRad(10.3);
        else:
            num = Unit.ConvertDegToRad(4.5);
            num1 = Unit.ConvertDegToRad(5.2);
            num2 = Unit.ConvertDegToRad(7.8);
        if (self.parametersPanel.cmbNavAidType.SelectedIndex != 0):
            num3 = 2315 if(self.parametersPanel.cmbToleranceType.currentIndex() != 2 or not self.parametersPanel.chbOverhead.isChecked()) else 4630;
        else:
            num3 = 1900 if(self.parametersPanel.cmbToleranceType.currentIndex() != 2 or not self.parametersPanel.chbOverhead.isChecked()) else 3704;
        num5 = num4 + num;
        num6 = num4 - num;
        num7 = num4 + num1;
        num8 = num4 - num1;
        num9 = num4 + num2;
        num10 = num4 - num2;
        num11 = num4 + Unit.ConvertDegToRad(90);
        num12 = num4 - Unit.ConvertDegToRad(90);
        num13 = metres2 / math.cos(num);
        num14 = metres2 / math.cos(num1);
        num15 = metres2 / math.cos(num2);
        num16 = metres3 / math.cos(num);
        num17 = metres3 / math.cos(num1);
        num18 = metres3 / math.cos(num2);
        point3d1 = MathHelper.distanceBearingPoint(point3d, num4, metres2);
        point3d2 = MathHelper.distanceBearingPoint(point3d, num4, metres3);
        point3d3 = MathHelper.distanceBearingPoint(point3d, num12, num3);
        point3d4 = MathHelper.distanceBearingPoint(point3d, num11, num3);
        point3d5 = MathHelper.distanceBearingPoint(point3d4, num9, num15);
        point3d6 = MathHelper.distanceBearingPoint(point3d3, num10, num15);
        num19 = MathHelper.calcDistance(point3d1, point3d5) / 2;
        point3d7 = MathHelper.distanceBearingPoint(point3d1, num12, num19);
        point3d8 = MathHelper.distanceBearingPoint(point3d1, num11, num19);
        point3d9 = MathHelper.distanceBearingPoint(point3d3, num10, num18);
        point3d10 = MathHelper.distanceBearingPoint(point3d4, num9, num18);
        num20 = MathHelper.calcDistance(point3d2, point3d10) / 2;
        point3d11 = MathHelper.distanceBearingPoint(point3d2, num12, num20);
        point3d12 = MathHelper.distanceBearingPoint(point3d2, num11, num20);
        
        resultPoint3dArrayList = []
        
        
        if (self.parametersPanel.cmbToleranceType.currentIndex() == 0):
            resultPoint3dArrayList.append([point3d1, point3d2])
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num5, num16), MathHelper.distanceBearingPoint(point3d, num5, num13)])
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num5, num13), MathHelper.distanceBearingPoint(point3d, num6, num13)]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num6, num13), MathHelper.distanceBearingPoint(point3d, num6, num16)]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num6, num16), MathHelper.distanceBearingPoint(point3d, num5, num16)]);

            polylineArea0 = PolylineArea([MathHelper.distanceBearingPoint(point3d, num5, num16), MathHelper.distanceBearingPoint(point3d, num5, num13), MathHelper.distanceBearingPoint(point3d, num6, num13), MathHelper.distanceBearingPoint(point3d, num6, num16), MathHelper.distanceBearingPoint(point3d, num6, num16), MathHelper.distanceBearingPoint(point3d, num5, num16)])
            self.complexObstacleArea.Add(PrimaryObstacleArea(polylineArea0))
        elif (self.parametersPanel.cmbToleranceType.currentIndex() == 1):
            resultPoint3dArrayList.append([point3d1, point3d2]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num7, num17), MathHelper.distanceBearingPoint(point3d, num7, num14)]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num7, num14), MathHelper.distanceBearingPoint(point3d, num8, num14)]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num8, num14), MathHelper.distanceBearingPoint(point3d, num8, num17)]);
            resultPoint3dArrayList.append([MathHelper.distanceBearingPoint(point3d, num8, num17), MathHelper.distanceBearingPoint(point3d, num7, num17)]);
            polylineArea0 = PolylineArea([MathHelper.distanceBearingPoint(point3d, num7, num17), MathHelper.distanceBearingPoint(point3d, num7, num14), MathHelper.distanceBearingPoint(point3d, num8, num14), MathHelper.distanceBearingPoint(point3d, num8, num17), MathHelper.distanceBearingPoint(point3d, num8, num17), MathHelper.distanceBearingPoint(point3d, num7, num17)])
            self.complexObstacleArea.Add(PrimaryObstacleArea(polylineArea0))
        elif (self.parametersPanel.cmbToleranceType.currentIndex() == 2):
            if (self.parametersPanel.cmbConstructionType.currentText() != ConstructionType.Construct2D):
                num21 = metres - metres1;
                num22 = percent / 100;
                num23 = num21 + (metres3 - metres2) * num22;
                num24 = metres + (metres3 - metres2) * num22;
                point3d5 = point3d5.smethod_167(metres);
                point3d6 = point3d6.smethod_167(metres);
                point3d9 = point3d9.smethod_167(num24);
                point3d10 = point3d10.smethod_167(num24);
                point3d8 = point3d8.smethod_167(num21);
                point3d12 = point3d12.smethod_167(num23);
                point3d7 = point3d7.smethod_167(num21);
                point3d11 = point3d11.smethod_167(num23);
                point3d1 = point3d1.smethod_167(metres);
                point3d2 = point3d2.smethod_167(num24);
                resultPoint3dArrayList.append([point3d8, point3d5, point3d10, point3d12]);
                resultPoint3dArrayList.append([point3d8, point3d12, point3d11, point3d7]);
                resultPoint3dArrayList.append([point3d7, point3d11, point3d9, point3d6]);

                self.complexObstacleArea.Add(PrimaryObstacleArea(PolylineArea([point3d8, point3d12, point3d11, point3d7, point3d8])))
                self.complexObstacleArea.Add(SecondaryObstacleArea(point3d8, point3d5, point3d10, point3d12))
                self.complexObstacleArea.Add(SecondaryObstacleArea(point3d7, point3d11, point3d9, point3d6))
            else:
                resultPoint3dArrayList.append([point3d1, point3d2]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d6, point3d5]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d5, point3d10]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d10, point3d9]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d9, point3d6]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d7, point3d11]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPoint3dArrayList.append([point3d8, point3d12]);
#                 AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                num21 = metres - metres1;
                num22 = percent / 100;
                num23 = num21 + (metres3 - metres2) * num22;
                num24 = metres + (metres3 - metres2) * num22;
                point3d5 = point3d5.smethod_167(0);
                point3d6 = point3d6.smethod_167(0);
                point3d9 = point3d9.smethod_167(0);
                point3d10 = point3d10.smethod_167(0);
                point3d8 = point3d8.smethod_167(0);
                point3d12 = point3d12.smethod_167(0);
                point3d7 = point3d7.smethod_167(0);
                point3d11 = point3d11.smethod_167(0);
                point3d1 = point3d1.smethod_167(0);
                point3d2 = point3d2.smethod_167(0);
                # resultPoint3dArrayList.append([point3d8, point3d5, point3d10, point3d12]);
                # resultPoint3dArrayList.append([point3d8, point3d12, point3d11, point3d7]);
                # resultPoint3dArrayList.append([point3d7, point3d11, point3d9, point3d6]);

                self.complexObstacleArea.Add(PrimaryObstacleArea(PolylineArea([point3d8, point3d12, point3d11, point3d7, point3d8])))
                self.complexObstacleArea.Add(SecondaryObstacleArea(point3d12, point3d8, point3d10, point3d5, MathHelper.getBearing(point3d8, point3d12)))
                self.complexObstacleArea.Add(SecondaryObstacleArea(point3d11, point3d7, point3d9, point3d6, MathHelper.getBearing(point3d7, point3d11)))
        if self.parametersPanel.cmbConstructionType.currentText() == ConstructionType.Construct2D:
            constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)
            for point3dArray in resultPoint3dArrayList:
                AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, point3dArray)
        else:
            constructionLayer = AcadHelper.createVectorLayer(self.surfaceType, QGis.Polygon)
            # if define._mapCrs == None:
            #     if mapUnits == QGis.Meters:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", self.surfaceType, "memory")
            #     else:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", self.surfaceType, "memory")
            # else:
            #     constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), self.surfaceType, "memory")
            # constructionLayer.startEditing()
            for point3dArray in resultPoint3dArrayList:
                AcadHelper.setGeometryAndAttributesInLayer(constructionLayer, PolylineArea(point3dArray).method_14_closed())
            #     polygon = QgsGeometry.fromPolygon([point3dArray])
            #     feature = QgsFeature()
            #     feature.setGeometry(polygon)
            #     constructionLayer.addFeature(feature)
            # constructionLayer.commitChanges()
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer, nominalTrackLayer], self.surfaceType)
        self.resultLayerList = [constructionLayer, nominalTrackLayer]
        QgisHelper.zoomToLayers(self.resultLayerList)
        self.ui.btnEvaluate.setEnabled(True)
        self.manualEvent(self.parametersPanel.cmbSelectionMode.currentIndex())
コード例 #20
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)

        if not flag:
            return

        if not self.method_27():
            return

        holdingTemplate = HoldingTemplate(
            self.parametersPanel.pnlNavAid.Point3d,
            float(self.parametersPanel.txtTrack.Value),
            self.parametersPanel.txtIas.Value,
            self.parametersPanel.txtAltitude.Value,
            Speed(float(self.parametersPanel.pnlWind.speedBox.text())),
            float(self.parametersPanel.txtIsa.Value),
            float(self.parametersPanel.txtTime.Value),
            self.parametersPanel.cmbOrientation.SelectedItem)
        polylineArea2 = self.method_35()
        polylineAreaTemp = holdingTemplate.vmethod_0(
            polylineArea2, self.parametersPanel.chbIntercept.Checked,
            self.parametersPanel.chbSectors12.Checked)
        polylineArea3 = polylineAreaTemp[0]

        polyline = PolylineArea.smethod_131(holdingTemplate.Nominal)
        resultPolylineAreaList = []

        if (self.parametersPanel.cmbConstruction.SelectedIndex == 0):
            constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)
            resultPolylineAreaList.append(polylineArea3)
            resultPolylineAreaList.append(
                PolylineArea.smethod_136(polylineArea2, True))
            if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1
                    or self.parametersPanel.chbCatH.Checked):
                for entity in HoldingTemplateBase.smethod_2(
                        polylineArea3,
                        Distance(2.5, DistanceUnits.NM) if
                    (self.parametersPanel.cmbUsedFor.SelectedIndex
                     == 1) else Distance(2, DistanceUnits.NM)):
                    resultPolylineAreaList.append(entity)
            else:
                for entity1 in HoldingTemplateBase.smethod_1(
                        polylineArea3, True):
                    resultPolylineAreaList.append(entity1)
            if self.parametersPanel.cmbOrientation.SelectedIndex == 0:
                polyline[0].bulge = -1
                polyline[2].bulge = -1
            else:
                polyline[0].bulge = 1
                polyline[2].bulge = 1

            resultPolylineAreaList.append(polyline)
            resultPolylineList = []

            for polylineArea in resultPolylineAreaList:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polylineArea, True)

            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      self.surfaceType, True)
            QgisHelper.zoomToLayers([constructionLayer])
            self.resultLayerList = [constructionLayer]
        else:
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Polygon)
            geometryList = []
            if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1):
                distance = Distance(2.5, DistanceUnits.NM) if (
                    self.parametersPanel.cmbUsedFor.SelectedIndex
                    == 1) else Distance(2, DistanceUnits.NM)
                polylineArea, polylineArea1 = HoldingTemplateBase.smethod_4(
                    polylineArea3, self.parametersPanel.txtAltitude.Value,
                    self.parametersPanel.txtMoc.Value, distance)
                geometryList = QgisHelper.smethod_146(
                    polylineArea.method_15(True),
                    polylineArea1.method_15(True))
            else:
                geometryList = HoldingTemplateBase.smethod_3(
                    polylineArea3, self.parametersPanel.txtAltitude.Value,
                    self.parametersPanel.txtMoc.Value)

            i = 0
            for entity2 in geometryList:
                i += 1
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer,
                    PolylineArea(geometryList[len(geometryList) -
                                              i].asPolygon()[0]))

            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       polyline, True)

            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      self.surfaceType, True)
            QgisHelper.zoomToLayers([constructionLayer])
            self.resultLayerList = [constructionLayer]
        self.ui.btnEvaluate.setEnabled(True)
        pass
コード例 #21
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        mapUnits = define._canvas.mapUnits()
        constructionLayer = None

        polylines = self.method_36(True)

        if (self.parametersPanel.cmbConstruction.currentText() !=
                ConstructionType.Construct3D):
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Line)
            for polylineArea1 in polylines:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polylineArea1, True)
        else:
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Polygon)
            # if define._mapCrs == None:
            #     if mapUnits == QGis.Meters:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", self.surfaceType, "memory")
            #     else:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", self.surfaceType, "memory")
            # else:
            #     constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), self.surfaceType, "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(self.surfaceType).replace(" ", "") + ".shp", "utf-8", constructionLayer.crs())
            # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(self.surfaceType).replace(" ", "") + ".shp", self.surfaceType, "ogr")
            #
            # constructionLayer.startEditing()
            count = len(polylines)
            num = 0.1 * count
            altitude = Altitude(float(self.parametersPanel.txtAltitude.text()),
                                AltitudeUnits.FT)
            value = Altitude(float(self.parametersPanel.txtMoc.text()),
                             AltitudeUnits.M)
            metres = altitude.Metres - value.Metres
            for i in range(count):
                polygon1 = QgsGeometry.fromPolygon(
                    [polylines[i].method_14_closed()])
                polygonNew = polygon1
                if (i > 0):
                    metres1 = altitude.Metres
                    #                     value = self.pnlMoc.Value;
                    metres = metres1 - num * value.Metres
                    num = num - 0.1
# #                 polylines[i].set_Elevation(metres);
#                 DBObjectCollection dBObjectCollection = new DBObjectCollection();
# #                 dBObjectCollection.Add(polylines[i]);
#                 Autodesk.AutoCAD.DatabaseServices.Region item = Autodesk.AutoCAD.DatabaseServices.Region.CreateFromCurves(dBObjectCollection).get_Item(0) as Autodesk.AutoCAD.DatabaseServices.Region;
#                 item.SetDatabaseDefaults();
                if (i > 0):
                    polygon0 = QgsGeometry.fromPolygon(
                        [polylines[i - 1].method_14_closed()])
                    polygonNew = polygon1.difference(polygon0)
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, PolylineArea(polygonNew.asPolygon()[0]))
            #     feature = QgsFeature()
            #     feature.setGeometry(polygonNew)
            #     constructionLayer.addFeature(feature)
            # constructionLayer.commitChanges()
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                  SurfaceTypes.HoldingRnp)
        self.resultLayerList = [constructionLayer]
        self.ui.btnEvaluate.setEnabled(True)
コード例 #22
0
    def btnConstruct2_Click(self):
        qgsLayerTreeView = define._mLayerTreeView
        groupName = self.surfaceType2
        layerTreeModel = qgsLayerTreeView.layerTreeModel()
        layerTreeGroup = layerTreeModel.rootGroup()
        rowCount = layerTreeModel.rowCount()
        groupExisting = False
        if rowCount > 0:
            for i in range(rowCount):
                qgsLayerTreeNode = layerTreeModel.index2node(
                    layerTreeModel.index(i, 0))
                if qgsLayerTreeNode.nodeType() == 0:
                    qgsLayerTreeNode._class_ = QgsLayerTreeGroup
                    if isinstance(qgsLayerTreeNode, QgsLayerTreeGroup
                                  ) and qgsLayerTreeNode.name() == groupName:
                        groupExisting = True

        if groupExisting:
            if len(self.resultLayerList2) > 0:
                QgisHelper.removeFromCanvas(define._canvas,
                                            self.resultLayerList2)
                self.resultLayerList2 = []
            else:
                QMessageBox.warning(
                    self, "Warning", "Please remove \"" + self.surfaceType2 +
                    "\" layer group from LayerTreeView.")
                return
        num = None
        num1 = None
        line = None
        polyline = None
        point3d = None
        point3d1 = None
        point3d2 = None
        point3d3 = None
        point3d4 = None
        point3d5 = None
        point3d6 = None
        point3d7 = None
        point3d8 = None
        ficorResult = None
        point = []
        value = None
        resultPolylineAreaList = []
        # if (!AcadHelper.Ready)
        # {
        #     return;
        # }
        # if (!self.method_27(true))
        # {
        #     return;
        # }
        # string constructionLayer = base.ConstructionLayer;
        point3d9 = self.parametersPanel.pnlTrackingPosition.Point3d
        point3d10 = self.parametersPanel.pnlIntersectingPosition.Point3d
        value1 = float(self.parametersPanel.txtTrackingRadialTrack.Value)
        value2 = float(self.parametersPanel.txtIntersectingRadialTrack.Value)
        num2 = Unit.ConvertDegToRad(value1)
        num3 = Unit.ConvertDegToRad(value2)
        if (self.parametersPanel.cmbTrackingType.currentIndex() != 0):
            num = Unit.ConvertDegToRad(2.4) if (
                self.parametersPanel.cmbTrackingType.currentIndex() != 1
            ) else Unit.ConvertDegToRad(6.9)
        else:
            num = Unit.ConvertDegToRad(5.2)
        num1 = Unit.ConvertDegToRad(6.2) if (
            self.parametersPanel.cmbIntersectingType.currentIndex() != 0
        ) else Unit.ConvertDegToRad(4.5)
        num4 = num2 + num
        point3d11 = MathHelper.distanceBearingPoint(point3d9, num4, 100)
        num5 = num2 - num
        point3d12 = MathHelper.distanceBearingPoint(point3d9, num5, 100)
        point3d13 = MathHelper.distanceBearingPoint(point3d9, num2, 100)

        point3d = MathHelper.getIntersectionPoint(
            point3d9, point3d13, point3d10,
            MathHelper.distanceBearingPoint(point3d10, num3, 100))
        if (self.parametersPanel.cmbIntersectingType.currentIndex() >= 2):
            metres = Distance(
                float(self.parametersPanel.txtIntersectingDistance.text()),
                DistanceUnits.NM).Metres
            if (self.parametersPanel.chb0dmeAtThr.isChecked()):
                value = Distance(
                    float(self.parametersPanel.txtDmeOffset.text()))
                metres = metres + value.Metres
            num6 = 460 + metres * 0.0125
            num7 = metres + num6
            num8 = metres - num6
            if (MathHelper.smethod_102(point3d9, point3d10)):
                point3d14 = MathHelper.distanceBearingPoint(
                    point3d9, num4, num8)
                point3d15 = MathHelper.distanceBearingPoint(
                    point3d9, num2, num8)
                point3d16 = MathHelper.distanceBearingPoint(
                    point3d9, num5, num8)
                point3d17 = MathHelper.distanceBearingPoint(
                    point3d9, num5, num7)
                point3d18 = MathHelper.distanceBearingPoint(
                    point3d9, num2, num7)
                point3d19 = MathHelper.distanceBearingPoint(
                    point3d9, num4, num7)
                point = [point3d14, point3d16, point3d17, point3d19]
                polyline = AcadHelper.smethod_126(point)
                polyline.SetBulgeAt(
                    0, MathHelper.smethod_60(point3d14, point3d15, point3d16))
                polyline.SetBulgeAt(
                    2, MathHelper.smethod_60(point3d17, point3d18, point3d19))
                polyline.set_Closed(True)
                resultPolylineAreaList.append(polyline)
                # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
                point3d14 = MathHelper.distanceBearingPoint(
                    point3d9, num2, num8)
                point3d15 = MathHelper.distanceBearingPoint(
                    point3d9, num2, num7)
                resultPolylineAreaList.append(
                    PolylineArea([point3d14, point3d15]))
                # line = new Line(point3d14, point3d15);
                #         AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                point3d14 = MathHelper.distanceBearingPoint(
                    point3d9, num4, metres)
                point3d15 = MathHelper.distanceBearingPoint(
                    point3d9, num2, metres)
                point3d16 = MathHelper.distanceBearingPoint(
                    point3d9, num5, metres)
                point = [point3d14, point3d16]
                polyline = AcadHelper.smethod_126(point)
                polyline.SetBulgeAt(
                    0, MathHelper.smethod_60(point3d14, point3d15, point3d16))
                resultPolylineAreaList.append(polyline)
                # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
            else:
                ficorResult1 = self.method_37(point3d10, num2, point3d9,
                                              point3d13, num8, FicorInput.C)
                ficorResult2 = self.method_37(point3d10, num2, point3d9,
                                              point3d13, metres, FicorInput.C)
                ficorResult3 = self.method_37(point3d10, num2, point3d9,
                                              point3d13, num7, FicorInput.C)
                if (ficorResult1.Status != FicorStatus.TWO
                        and ficorResult2.Status != FicorStatus.TWO):
                    if (ficorResult3.Status == FicorStatus.TWO):
                        ficorResult = FicorResult(None, FicorStatus.TWO)
                    else:
                        ficorResult = FicorResult(None, ficorResult2.Status)
                else:
                    ficorResult = FicorResult(None, FicorStatus.TWO)
                if (ficorResult.Status != FicorStatus.NID):
                    ficorInput = FicorInput.F
                    num9 = 1
                    if (ficorResult.Status == FicorStatus.TWO):
                        QMessageBox.warning(
                            self, "Infomation",
                            Messages.TWO_POSSIBLE_FIX_POSITIONS)
                        ficorInput = FicorInput.L
                        num9 = 2
                    num10 = 0
                    while (num10 < num9):
                        ficorResult4 = self.method_37(point3d10, num4,
                                                      point3d9, point3d11,
                                                      num8, ficorInput)
                        ficorResult5 = self.method_37(point3d10, num2,
                                                      point3d9, point3d13,
                                                      num8, ficorInput)
                        ficorResult6 = self.method_37(point3d10, num5,
                                                      point3d9, point3d12,
                                                      num8, ficorInput)
                        ficorResult7 = self.method_37(point3d10, num4,
                                                      point3d9, point3d11,
                                                      metres, ficorInput)
                        ficorResult8 = self.method_37(point3d10, num2,
                                                      point3d9, point3d13,
                                                      metres, ficorInput)
                        ficorResult9 = self.method_37(point3d10, num5,
                                                      point3d9, point3d12,
                                                      metres, ficorInput)
                        ficorResult10 = self.method_37(point3d10, num4,
                                                       point3d9, point3d11,
                                                       num7, ficorInput)
                        ficorResult11 = self.method_37(point3d10, num2,
                                                       point3d9, point3d13,
                                                       num7, ficorInput)
                        ficorResult12 = self.method_37(point3d10, num5,
                                                       point3d9, point3d12,
                                                       num7, ficorInput)
                        if (ficorResult4.Status == FicorStatus.NID
                                or ficorResult5.Status == FicorStatus.NID
                                or ficorResult6.Status == FicorStatus.NID
                                or ficorResult7.Status == FicorStatus.NID
                                or ficorResult9.Status == FicorStatus.NID
                                or ficorResult10.Status == FicorStatus.NID
                                or ficorResult11.Status == FicorStatus.NID
                                or ficorResult12.Status == FicorStatus.NID
                                or ficorResult8.Status == FicorStatus.NID):
                            eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY = Messages.ERR_FAILED_TO_CONSTRUCT_THE_FIX_AUTOMATICALLY
                            value = Distance(
                                float(self.parametersPanel.
                                      txtIntersectingDistance.text()),
                                DistanceUnits.NM)
                            str000 = str(round(value.Metres, 4)) + "m"
                            value = str(round(Distance(num6).Metres, 4)) + "m"
                            QMessageBox.warning(
                                self, "Error",
                                eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY %
                                (str000, value))
                            #                     ErrorMessageBox.smethod_0(self, string.Format(eRRFAILEDTOCONSTRUCTTHEFIXAUTOMATICALLY, str, value.method_0(":m")));
                            return
                        elif (MathHelper.calcDistance(point3d9,
                                                      ficorResult8.Point)
                              < MathHelper.calcDistance(
                                  ficorResult5.Point, ficorResult8.Point)):
                            QMessageBox.warning(
                                self, "Error", Messages.
                                ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE)
                            #                     ErrorMessageBox.smethod_0(self, Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE);
                            return
                        else:
                            point = [
                                ficorResult4.Point, ficorResult6.Point,
                                ficorResult12.Point, ficorResult10.Point
                            ]
                            polyline = AcadHelper.smethod_126(point)
                            polyline.SetBulgeAt(
                                0,
                                MathHelper.smethod_60(ficorResult4.Point,
                                                      ficorResult5.Point,
                                                      ficorResult6.Point))
                            polyline.SetBulgeAt(
                                2,
                                MathHelper.smethod_60(ficorResult12.Point,
                                                      ficorResult11.Point,
                                                      ficorResult10.Point))
                            polyline.set_Closed(True)
                            resultPolylineAreaList.append(polyline)
                            # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
                            resultPolylineAreaList.append(
                                PolylineArea(
                                    [ficorResult5.Point, ficorResult11.Point]))
                            # line = new Line(ficorResult5.Point, ficorResult11.Point);
                            # AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                            point = [ficorResult7.Point, ficorResult9.Point]
                            polyline = AcadHelper.smethod_126(point)
                            polyline.SetBulgeAt(
                                0,
                                MathHelper.smethod_60(ficorResult7.Point,
                                                      ficorResult8.Point,
                                                      ficorResult9.Point))
                            resultPolylineAreaList.append(polyline)
                            # AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
                            if (ficorResult.Status == FicorStatus.TWO):
                                ficorInput = FicorInput.S
                            num10 += 1
                else:
                    QMessageBox.warning(
                        self, "Error", Messages.
                        ERR_RADIAL_TRACK_DME_DISTANCE_DO_NOT_INTERSECT)
                    #             ErrorMessageBox.smethod_0(self, Messages.ERR_RADIAL_TRACK_DME_DISTANCE_DO_NOT_INTERSECT);
                    return
        elif (point3d == None):
            QMessageBox.warning(self, "Error",
                                Messages.ERR_RADIALS_TRACKS_ARE_PARALLEL)
            #     ErrorMessageBox.smethod_0(self, Messages.ERR_RADIALS_TRACKS_ARE_PARALLEL);
            return
        elif (MathHelper.smethod_99(MathHelper.getBearing(point3d9, point3d),
                                    num2, 0.001)):
            point3d20 = MathHelper.distanceBearingPoint(
                point3d10, num3 + num1, 100)
            point3d21 = MathHelper.distanceBearingPoint(
                point3d10, num3 - num1, 100)
            point3d1 = MathHelper.getIntersectionPoint(point3d9, point3d12,
                                                       point3d10, point3d20)
            point3d2 = MathHelper.getIntersectionPoint(point3d9, point3d12,
                                                       point3d10, point3d21)
            point3d3 = MathHelper.getIntersectionPoint(point3d9, point3d11,
                                                       point3d10, point3d21)
            point3d4 = MathHelper.getIntersectionPoint(point3d9, point3d11,
                                                       point3d10, point3d20)
            point3d5 = MathHelper.getIntersectionPoint(point3d9, point3d,
                                                       point3d10, point3d20)
            point3d6 = MathHelper.getIntersectionPoint(point3d9, point3d,
                                                       point3d10, point3d21)
            point3d7 = MathHelper.getIntersectionPoint(point3d9, point3d11,
                                                       point3d10, point3d)
            point3d8 = MathHelper.getIntersectionPoint(point3d9, point3d12,
                                                       point3d10, point3d)
            if (MathHelper.calcDistance(point3d9, point3d) <
                    MathHelper.calcDistance(point3d5, point3d)
                    or MathHelper.calcDistance(point3d10, point3d) <
                    MathHelper.calcDistance(point3d5, point3d)
                    or MathHelper.calcDistance(point3d9, point3d) <
                    MathHelper.calcDistance(point3d8, point3d)
                    or MathHelper.calcDistance(point3d10, point3d) <
                    MathHelper.calcDistance(point3d8, point3d)):
                QMessageBox.warning(
                    self, "Error",
                    Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE)
                #         ErrorMessageBox.smethod_0(self, Messages.ERR_FIX_TOO_CLOSE_USE_OVERHEAD_TOLERANCE);
                return
            else:
                resultPolylineAreaList.append(
                    PolylineArea([point3d5, point3d6]))
                #         line = new Line(point3d5, point3d6);
                #         AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                resultPolylineAreaList.append(
                    PolylineArea([point3d7, point3d8]))
                #         line = new Line(point3d7, point3d8);
                #         AcadHelper.smethod_18(transaction, blockTableRecord, line, constructionLayer);
                point = [point3d1, point3d2, point3d3, point3d4]
                polyline = AcadHelper.smethod_126(point)
                polyline.set_Closed(True)
                resultPolylineAreaList.append(polyline)
        #         AcadHelper.smethod_18(transaction, blockTableRecord, polyline, constructionLayer);
        else:
            QMessageBox.warning(self, "Error",
                                Messages.ERR_RADIALS_TRACKS_DO_NOT_INTERSECT)
            #     ErrorMessageBox.smethod_0(self, Messages.ERR_RADIALS_TRACKS_DO_NOT_INTERSECT);
            return

        mapUnits = define._canvas.mapUnits()
        constructionLayer = AcadHelper.createVectorLayer(
            SurfaceTypes.FixConstruction, QGis.Line)

        for polylinrArea0 in resultPolylineAreaList:
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       polylinrArea0)
        QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                  SurfaceTypes.FixConstruction, True)
        self.resultLayerList2 = [constructionLayer]
        QgisHelper.zoomToLayers(self.resultLayerList2)
コード例 #23
0
    def btnConstruct_Click(self):
        flag = FlightPlanBaseDlg.btnConstruct_Click(self)
        if not flag:
            return
        if not self.method_27():
            return
        holdingTemplate = HoldingTemplate(
            self.parametersPanel.pnlNavAid.Point3d,
            float(self.parametersPanel.txtTrack.Value),
            self.parametersPanel.txtIas.Value,
            self.parametersPanel.txtAltitude.Value,
            Speed(float(self.parametersPanel.pnlWind.speedBox.text())),
            float(self.parametersPanel.txtIsa.Value),
            float(self.parametersPanel.txtTime.Value),
            self.parametersPanel.cmbOrientation.SelectedItem)
        polylineArea2 = self.method_35()
        polylineAreaTemp = holdingTemplate.vmethod_0(
            polylineArea2, self.parametersPanel.chbIntercept.Checked,
            self.parametersPanel.chbSectors12.Checked)
        polylineArea3 = polylineAreaTemp[0]

        polyline = PolylineArea.smethod_131(holdingTemplate.Nominal)
        resultPolylineAreaList = []

        if (self.parametersPanel.cmbConstruction.SelectedIndex == 0):
            constructionLayer = AcadHelper.createVectorLayer(self.surfaceType)
            resultPolylineAreaList.append(polylineArea3)
            resultPolylineAreaList.append(
                PolylineArea.smethod_136(polylineArea2, True))
            if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1
                    or self.parametersPanel.chbCatH.Checked):
                for entity in HoldingTemplateBase.smethod_2(
                        polylineArea3,
                        Distance(2.5, DistanceUnits.NM) if
                    (self.parametersPanel.cmbUsedFor.SelectedIndex
                     == 1) else Distance(2, DistanceUnits.NM)):
                    resultPolylineAreaList.append(entity)
            else:
                for entity1 in HoldingTemplateBase.smethod_1(
                        polylineArea3, True):
                    resultPolylineAreaList.append(entity1)
            if self.parametersPanel.cmbOrientation.SelectedIndex == 0:
                polyline[0].bulge = -1
                polyline[2].bulge = -1
            else:
                polyline[0].bulge = 1
                polyline[2].bulge = 1
            resultPolylineAreaList.append(polyline)
            resultPolylineList = []
            for polylineArea in resultPolylineAreaList:
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer, polylineArea, True)
            #     point3dCollection = []
            #     for polylineAreaPoint in polylineArea:
            #
            #         point3dCollection.append(polylineAreaPoint.Position)
            #     resultPolylineList.append((point3dCollection, []))
            # constructionLayer = QgisHelper.createPolylineLayer(self.surfaceType, resultPolylineList)
            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      self.surfaceType, True)
            QgisHelper.zoomToLayers([constructionLayer])
            self.resultLayerList = [constructionLayer]
        else:
            #             polyline.set_Elevation(self.pnlAltitude.Value.Metres);
            #             polyline.set_Thickness(-self.pnlMoc.Value.Metres);
            constructionLayer = AcadHelper.createVectorLayer(
                self.surfaceType, QGis.Polygon)
            # mapUnits = define._canvas.mapUnits()
            # constructionLayer = None
            # if define._mapCrs == None:
            #     if mapUnits == QGis.Meters:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:32633", self.surfaceType, "memory")
            #     else:
            #         constructionLayer = QgsVectorLayer("polygon?crs=EPSG:4326", self.surfaceType, "memory")
            # else:
            #     constructionLayer = QgsVectorLayer("polygon?crs=%s"%define._mapCrs.authid (), self.surfaceType, "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(self.surfaceType).replace(" ", "") + ".shp", "utf-8", constructionLayer.crs())
            # constructionLayer = QgsVectorLayer(shpPath + "/" + QString(self.surfaceType).replace(" ", "") + ".shp", self.surfaceType, "ogr")
            #
            #
            # constructionLayer.startEditing()
            geometryList = []
            if (self.parametersPanel.cmbUsedFor.SelectedIndex == 1):
                distance = Distance(2.5, DistanceUnits.NM) if (
                    self.parametersPanel.cmbUsedFor.SelectedIndex
                    == 1) else Distance(2, DistanceUnits.NM)
                polylineArea, polylineArea1 = HoldingTemplateBase.smethod_4(
                    polylineArea3, self.parametersPanel.txtAltitude.Value,
                    self.parametersPanel.txtMoc.Value, distance)
                #                 point3dCollection = polylineArea.method_15(False)
                #                 point3dCollection1 = polylineArea1.method_15(False)
                geometryList = QgisHelper.smethod_146(
                    polylineArea.method_15(True),
                    polylineArea1.method_15(True))

            else:
                geometryList = HoldingTemplateBase.smethod_3(
                    polylineArea3, self.parametersPanel.txtAltitude.Value,
                    self.parametersPanel.txtMoc.Value)

            # feature = QgsFeature()
            # feature.setGeometry(QgsGeometry.fromPolygon([polyline.method_14_closed()]))
            # constructionLayer.addFeature(feature)
            i = 0
            for entity2 in geometryList:
                i += 1
                AcadHelper.setGeometryAndAttributesInLayer(
                    constructionLayer,
                    PolylineArea(geometryList[len(geometryList) -
                                              i].asPolygon()[0]))
                # feature = QgsFeature()
                # feature.setGeometry(entity2)
                # constructionLayer.addFeature(feature)
            AcadHelper.setGeometryAndAttributesInLayer(constructionLayer,
                                                       polyline, True)

            # constructionLayer.commitChanges()
            QgisHelper.appendToCanvas(define._canvas, [constructionLayer],
                                      self.surfaceType, True)
            QgisHelper.zoomToLayers([constructionLayer])
            self.resultLayerList = [constructionLayer]
        self.ui.btnEvaluate.setEnabled(True)
        #                     AcadHelper.smethod_18(transaction, blockTableRecord, entity2, constructionLayer);
        pass