def __init__(self, polylineArea_0, altitude_0, altitude_1, distance_0):
     self.inner = PrimaryObstacleArea(polylineArea_0)
     self.outer = PrimaryObstacleArea(
         HoldingTemplateBase.smethod_5(polylineArea_0, distance_0))
     self.poly = PolylineArea.smethod_131(self.inner.previewArea)
     self.altitude = altitude_0.Metres
     self.moc = altitude_1.Metres
     self.offset = distance_0
Esempio n. 2
0
 def smethod_4(polylineArea_0, altitude_0, altitude_1, distance_0):
     polylineAreaList = HoldingTemplateBase.smethod_0(
         polylineArea_0, distance_0.Metres, 1)
     polyline = PolylineArea.smethod_131(polylineArea_0)
     item = polylineAreaList[0]
     polylineArea_1 = PolylineArea(polyline.method_160(500))
     polylineArea_2 = PolylineArea(item.method_160(500))
     #         polylineArea_1 = polyline
     #         polylineArea_2 = item
     polylineArea_2.method_22(altitude_0.Metres)
     polylineArea_1.method_22(altitude_0.Metres - altitude_1.Metres)
     return (polylineArea_1, polylineArea_2)
    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
Esempio n. 4
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