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
Example #2
0
class HoldingRnavArea:
    #     private PrimaryObstacleArea area;
    #
    #     private double moc;
    def get_area(self):
        return self.area

    Area = property(get_area, None, None, None)

    def get_moc(self):
        return self.moc

    Moc = property(get_moc, None, None, None)

    def __init__(self, polylineArea_0, altitude_0):
        self.area = PrimaryObstacleArea(polylineArea_0)
        self.moc = altitude_0.Metres

    def method_0(self, obstacle_0):
        double_0 = self.moc * obstacle_0.MocMultiplier
        double_1 = None
        if (not self.area.pointInPolygon(obstacle_0.Position,
                                         obstacle_0.Tolerance)):
            return (False, double_0, double_1)
        position = obstacle_0.Position
        double_1 = position.get_Z() + obstacle_0.Trees + double_0
        return (True, double_0, double_1)
    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)
    def makePrimaryAreaOrSecondaryArea(self, geomList, areaType):
        pointArrayInner = geomList[0]
        pointArray1Outer = geomList[1]

        innerStartPoint = pointArrayInner[0]
        innerEndPoint = pointArrayInner[1]
        innerBulge = pointArrayInner[2]
        outerStartPoint = pointArray1Outer[0]
        outerEndPoint = pointArray1Outer[1]
        outerBulge = pointArray1Outer[2]

        line0 = QgsGeometry.fromPolyline([innerStartPoint, outerStartPoint])
        line1 = QgsGeometry.fromPolyline([innerEndPoint, outerEndPoint])

        # for i in range(1, len(pointArray0)):

        if line0.intersects(line1):
            tempPoint = Point3D(outerStartPoint.get_X(), outerStartPoint.get_Y())
            outerStartPoint = Point3D(outerEndPoint.get_X(), outerEndPoint.get_Y())
            outerEndPoint = Point3D(tempPoint.get_X(), tempPoint.get_Y())
            outerBulge = -outerBulge
        if areaType == ProtectionAreaType.Primary:
            polylineArea = PolylineArea()
            polylineArea.Add(PolylineAreaPoint(innerStartPoint, innerBulge))
            polylineArea.Add(PolylineAreaPoint(innerEndPoint))
            polylineArea.Add(PolylineAreaPoint(outerEndPoint, -outerBulge))
            polylineArea.Add(PolylineAreaPoint(outerStartPoint))
            return PrimaryObstacleArea(polylineArea)
        elif areaType == ProtectionAreaType.Secondary:
            if innerBulge == 0 and outerBulge == 0:
                return SecondaryObstacleArea(innerStartPoint, innerEndPoint, outerStartPoint, outerEndPoint, MathHelper.getBearing(innerStartPoint, innerEndPoint))
            elif innerBulge != 0 and outerBulge != 0:
                if round(innerBulge, 1) != round(outerBulge, 1):
                    return None
                innerCenterPoint = MathHelper.smethod_71(innerStartPoint, innerEndPoint, innerBulge)
                outerCenterPoint = MathHelper.smethod_71(outerStartPoint, outerEndPoint, outerBulge)

                innerRadius = MathHelper.calcDistance(innerCenterPoint, innerStartPoint);
                outerRadius = MathHelper.calcDistance(outerCenterPoint, outerStartPoint);

                bearing = (MathHelper.getBearing(innerCenterPoint, innerStartPoint) + MathHelper.getBearing(innerCenterPoint, innerEndPoint)) / 2
                innerMiddlePoint = MathHelper.distanceBearingPoint(innerCenterPoint, bearing, innerRadius)
                if round(MathHelper.smethod_60(innerStartPoint, innerMiddlePoint, innerEndPoint), 4) != round(outerBulge, 4):
                    bearing += 3.14159265358979
                    innerMiddlePoint = MathHelper.distanceBearingPoint(innerCenterPoint, bearing, innerRadius)

                bearing = (MathHelper.getBearing(outerCenterPoint, outerStartPoint) + MathHelper.getBearing(outerCenterPoint, outerEndPoint)) / 2
                outerMiddlePoint = MathHelper.distanceBearingPoint(outerCenterPoint, bearing, outerRadius)
                if round(MathHelper.smethod_60(outerStartPoint, outerMiddlePoint, outerEndPoint), 4) != round(outerBulge, 4):
                    bearing += 3.14159265358979
                    outerMiddlePoint = MathHelper.distanceBearingPoint(outerCenterPoint, bearing, outerRadius)
                return SecondaryObstacleArea(innerStartPoint, innerMiddlePoint, innerEndPoint, outerStartPoint, None, outerMiddlePoint, outerEndPoint, innerBulge, innerBulge)
            return None
 def __init__(self, point3d_0, double_0, altitude_0, double_1, double_2,
              bool_0, point3dCollection_0, point3dCollection_1,
              polylineArea_0, polylineArea_1, manualPoly):
     ObstacleTable.__init__(self, None)
     self.manualPolygon = manualPoly
     self.surfaceType = SurfaceTypes.DepartureOmnidirectional
     self.track = double_0
     self.ptDER = point3d_0
     self.ptDER2 = MathHelper.distanceBearingPoint(
         point3d_0, double_0 - 1.5707963267949, 100)
     self.moc = double_1
     self.minMoc = 80 if (bool_0) else 90
     self.pdg = double_2
     self.ta = altitude_0.Metres
     point3dCollection = []
     if (point3dCollection_0 != None and len(point3dCollection_0) > 0):
         point3dCollection.append(point3dCollection_0[0])
     for point3d in point3dCollection_1:
         point3dCollection.append(point3d)
     if (point3dCollection_0 != None and len(point3dCollection_0) > 0):
         point3dCollection.append(point3dCollection_0[3])
     self.area = PolylineArea.smethod_133(point3dCollection, True)
     self.area12 = PrimaryObstacleArea(PolylineArea(point3dCollection_1))
     self.area3a = PrimaryObstacleArea(polylineArea_0)
     self.area3b = PrimaryObstacleArea(polylineArea_1)
class HoldingRnpArea:
    def __init__(self, polylineArea_0, altitude_0):
        self.area = PrimaryObstacleArea(polylineArea_0)
        self.moc = altitude_0.Metres
        self.altitude = altitude_0

    def method_0(self, obstacle_0):
        double_0 = self.moc * obstacle_0.MocMultiplier
        if (not self.area.pointInPolygon(obstacle_0.Position,
                                         obstacle_0.Tolerance)):
            return (False, None, None)
        position = obstacle_0.Position
        double_1 = position.get_Z() + obstacle_0.Trees + double_0
        return (True, double_0, double_1)
    def canvasPressEvent( self, e ):
        define._messageLabel.setText("")
        self.menuString = ""
        pointBackground = e.pos()
#         self.Point = QgisHelper.snapPoint(e.pos(), self.mSnapper, define._canvas)
        self.Point, self.pointID, self.layer= self.snapPoint(e.pos())
        self.selectedLayerFromSnapPoint = None


        if ( self.mRubberBand == None ):
            self.resultPolylineArea = PolylineArea()
            self.mRubberBand0.reset( QGis.Polygon )
#             define._canvas.clearCache ()
            self.mRubberBand = QgsRubberBand( self.mCanvas, QGis.Polygon )
            self.mRubberBand0 = QgsRubberBand( self.mCanvas, QGis.Polygon )
            self.mRubberBand.setFillColor( self.mFillColor )
            self.mRubberBand.setBorderColor( self.mBorderColour )
            self.mRubberBand0.setFillColor( QColor(255, 255, 255, 100) )
            self.mRubberBand0.setBorderColor( QColor(0, 0, 0) )
        if ( e.button() == Qt.LeftButton ):
            if self.Point == None:
                self.mRubberBand.addPoint( self.toMapCoordinates( e.pos() ) )
                self.resultPolylineArea.Add(PolylineAreaPoint(self.toMapCoordinates( e.pos() )))
                if self.isPrimaryPolylineStarted:
                    self.primaryPolyline.Add(PolylineAreaPoint(self.toMapCoordinates( e.pos() )))
            else:
                self.mRubberBand.addPoint( self.Point )
                self.resultPolylineArea.Add(PolylineAreaPoint(self.Point))
                if self.isPrimaryPolylineStarted:
                    self.primaryPolyline.Add(PolylineAreaPoint(self.toMapCoordinates( e.pos() )))
        else:
            menu = None
            if self.areaType == ProtectionAreaType.Secondary and len(self.resultPolylineArea) == 0:
                menu = self.createContextMenu(self.areaType, True)
                menu.exec_( define._canvas.mapToGlobal(e.pos() ))
                return

            if ( self.mRubberBand.numberOfVertices() > 2 ):
                self.polygonGeom = self.mRubberBand.asGeometry()
            else:
                return
#                 QgsMapToolSelectUtils.setSelectFeatures( self.mCanvas, polygonGeom, e )
            menu = self.createContextMenu(self.areaType)
            menu.exec_( define._canvas.mapToGlobal(e.pos() ))

            if self.menuString == "Cancel" or self.menuString == "Arc":
                return
            elif self.menuString == "Undo":
                if ( self.mRubberBand.numberOfVertices() > 0 ):

                    self.mRubberBand = None
                    QgisHelper.ClearRubberBandInCanvas(define._canvas)
                    self.mRubberBand = QgsRubberBand( self.mCanvas, QGis.Polygon )
                    self.mRubberBand.setFillColor( self.mFillColor )
                    self.mRubberBand.setBorderColor( self.mBorderColour )
                    self.resultPolylineArea[self.resultPolylineArea.Count - 2].bulge = 0.0
                    self.resultPolylineArea.pop(self.resultPolylineArea.Count - 1)
                    if self.isPrimaryPolylineStarted and len(self.primaryPolyline) > 0:
                        self.primaryPolyline.pop(self.primaryPolyline.Count - 1)
                    for pt in self.resultPolylineArea.method_14():
                        self.mRubberBand.addPoint(pt)
                return
            elif self.menuString == "Enter":
                # if self.areaType == ProtectionAreaType.Secondary:
                #     if self.resultPolylineArea.Count != 4:
                #         define._messageLabel.setText("The count of point of Secondary Area must be 4.")
                #         return
                self.mRubberBand.reset( QGis.Polygon )
                self.mRubberBand0.reset( QGis.Polygon )
#             define._canvas.clearCache ()

                self.mRubberBand0 = QgsRubberBand( self.mCanvas, QGis.Polygon )

                self.mRubberBand0.setFillColor( QColor(255, 255, 255, 100) )
                self.mRubberBand0.setBorderColor( QColor(0, 0, 0) )
                for pt in self.resultPolylineArea.method_14():
                    self.mRubberBand0.addPoint(pt)
                # self.mRubberBand0.addGeometry(self.polygonGeom, None)
                n = self.mRubberBand0.numberOfVertices()
                self.mRubberBand0.show()
                self.mRubberBand = None
                area = None
                if self.areaType == ProtectionAreaType.Primary:
                    area = PrimaryObstacleArea(self.resultPolylineArea)
                elif self.areaType == ProtectionAreaType.Secondary:
                    if len(self.resultPolylineArea) == 4:
                        area = SecondaryObstacleArea(self.resultPolylineArea[0].Position, self.resultPolylineArea[1].Position, self.resultPolylineArea[3].Position, self.resultPolylineArea[2].Position, MathHelper.getBearing(self.resultPolylineArea[0].Position, self.resultPolylineArea[1].Position))

                    else:
                        if self.primaryPolyline.Count < 2:
                            define._messageLabel.setText("The PrimaryLine in Secondary Area must exist.")
                            return
                        if self.isPrimaryPolylineStarted:
                            define._messageLabel.setText("You must finish  the input of  PrimaryLine.")
                            return
                        area = SecondaryObstacleAreaWithManyPoints(self.resultPolylineArea, self.primaryPolyline)
                self.emit(SIGNAL("outputResult"), area, self.mRubberBand0)
            n = 0
Example #8
0
 def __init__(self, polylineArea_0, altitude_0):
     self.area = PrimaryObstacleArea(polylineArea_0)
     self.moc = altitude_0.Metres
class DepartureOmnidirectionalObstacles(ObstacleTable):
    def __init__(self, point3d_0, double_0, altitude_0, double_1, double_2,
                 bool_0, point3dCollection_0, point3dCollection_1,
                 polylineArea_0, polylineArea_1, manualPoly):
        ObstacleTable.__init__(self, None)
        self.manualPolygon = manualPoly
        self.surfaceType = SurfaceTypes.DepartureOmnidirectional
        self.track = double_0
        self.ptDER = point3d_0
        self.ptDER2 = MathHelper.distanceBearingPoint(
            point3d_0, double_0 - 1.5707963267949, 100)
        self.moc = double_1
        self.minMoc = 80 if (bool_0) else 90
        self.pdg = double_2
        self.ta = altitude_0.Metres
        point3dCollection = []
        if (point3dCollection_0 != None and len(point3dCollection_0) > 0):
            point3dCollection.append(point3dCollection_0[0])
        for point3d in point3dCollection_1:
            point3dCollection.append(point3d)
        if (point3dCollection_0 != None and len(point3dCollection_0) > 0):
            point3dCollection.append(point3dCollection_0[3])
        self.area = PolylineArea.smethod_133(point3dCollection, True)
        self.area12 = PrimaryObstacleArea(PolylineArea(point3dCollection_1))
        self.area3a = PrimaryObstacleArea(polylineArea_0)
        self.area3b = PrimaryObstacleArea(polylineArea_1)

    def setHiddenColumns(self, tableView):
        #         tableView.hideColumn(self.IndexObstArea)
        #         tableView.hideColumn(self.IndexDistInSecM)
        return ObstacleTable.setHiddenColumns(self, tableView)

    def setHeaderLabels(self):
        ObstacleTable.setHeaderLabels(self)
        fixedColumnCount = len(self.fixedColumnLabels)
        self.IndexDrM = fixedColumnCount
        self.IndexDoM = fixedColumnCount + 1
        self.IndexMocReqM = fixedColumnCount + 2
        self.IndexMocReqFt = fixedColumnCount + 3
        self.IndexAcAltM = fixedColumnCount + 4
        self.IndexAcAltFt = fixedColumnCount + 5
        self.IndexAltReqM = fixedColumnCount + 6
        self.IndexAltReqFt = fixedColumnCount + 7
        self.IndexPDG = fixedColumnCount + 8
        self.IndexCritical = fixedColumnCount + 9
        self.IndexCloseIn = fixedColumnCount + 10

        self.fixedColumnLabels.extend([
            ObstacleTableColumnType.DrM, ObstacleTableColumnType.DoM,
            ObstacleTableColumnType.MocReqM, ObstacleTableColumnType.MocReqFt,
            ObstacleTableColumnType.AcAltM, ObstacleTableColumnType.AcAltFt,
            ObstacleTableColumnType.AltReqM, ObstacleTableColumnType.AltReqFt,
            ObstacleTableColumnType.PDG, ObstacleTableColumnType.Critical,
            ObstacleTableColumnType.CloseIn
        ])
        self.source.setHorizontalHeaderLabels(self.fixedColumnLabels)

    def addObstacleToModel(self, obstacle, checkResult):
        ObstacleTable.addObstacleToModel(self, obstacle, checkResult)
        row = self.source.rowCount() - 1

        item = QStandardItem(str(checkResult[0]))
        item.setData(checkResult[0])
        self.source.setItem(row, self.IndexDrM, item)

        item = QStandardItem(str(checkResult[1]))
        item.setData(checkResult[1])
        self.source.setItem(row, self.IndexDoM, item)

        item = QStandardItem(str(checkResult[2]))
        item.setData(checkResult[2])
        self.source.setItem(row, self.IndexMocReqM, item)

        item = QStandardItem(str(Unit.ConvertMeterToFeet(checkResult[2])))
        item.setData(Unit.ConvertMeterToFeet(checkResult[2]))
        self.source.setItem(row, self.IndexMocReqFt, item)

        item = QStandardItem(str(checkResult[3]))
        item.setData(checkResult[3])
        self.source.setItem(row, self.IndexAcAltM, item)

        item = QStandardItem(str(Unit.ConvertMeterToFeet(checkResult[3])))
        item.setData(Unit.ConvertMeterToFeet(checkResult[3]))
        self.source.setItem(row, self.IndexAcAltFt, item)

        item = QStandardItem(str(checkResult[4]))
        item.setData(checkResult[4])
        self.source.setItem(row, self.IndexAltReqM, item)

        item = QStandardItem(str(Unit.ConvertMeterToFeet(checkResult[4])))
        item.setData(Unit.ConvertMeterToFeet(checkResult[4]))
        self.source.setItem(row, self.IndexAltReqFt, item)

        item = QStandardItem(str(checkResult[5]))
        item.setData(checkResult[5])
        self.source.setItem(row, self.IndexPDG, item)

        item = QStandardItem(str(checkResult[6]))
        item.setData(checkResult[6])
        self.source.setItem(row, self.IndexCritical, item)

        item = QStandardItem(str(checkResult[7]))
        item.setData(checkResult[7])
        self.source.setItem(row, self.IndexCloseIn, item)

    def checkObstacle(self, obstacle_0):
        if self.manualPolygon != None:
            if not self.manualPolygon.contains(obstacle_0.Position):
                return
        mocMultiplier = None
        z = None
        num = None
        z1 = None
        point3d = None
        point3d1 = None
        num1 = None
        num2 = None
        if (not self.area12.pointInPolygon(obstacle_0.Position,
                                           obstacle_0.Tolerance)):
            if (not self.area3a.pointInPolygon(obstacle_0.Position,
                                               obstacle_0.Tolerance)
                    and not self.area3b.pointInPolygon(obstacle_0.Position,
                                                       obstacle_0.Tolerance)):
                return
            closestPointTo = self.area.getPointWithShortestDist(
                obstacle_0.Position)
            point = QgsGeometry.fromPolyline(
                self.area.method_14()).closestVertex(obstacle_0.Position)
            point3d1 = MathHelper.getIntersectionPoint(
                closestPointTo,
                MathHelper.distanceBearingPoint(closestPointTo, self.track,
                                                100), self.ptDER, self.ptDER2)
            num1 = MathHelper.calcDistance(
                closestPointTo, point3d1) if (MathHelper.smethod_119(
                    closestPointTo, self.ptDER, self.ptDER2)) else 1E-08
            if num1 == 0:
                num1 = 1E-08
            num2 = max([
                1E-08,
                MathHelper.calcDistance(obstacle_0.Position, closestPointTo) -
                obstacle_0.Tolerance
            ])
            mocMultiplier = max([
                self.moc / 100 * (num1 + num2) * obstacle_0.MocMultiplier,
                self.minMoc
            ])
            z = self.ta + self.pdg / 100 * num2
            position = obstacle_0.Position
            num = position.get_Z() + obstacle_0.Trees + mocMultiplier
            z1 = 100 * ((num - self.ta) / num2)

        else:
            point3d2 = MathHelper.distanceBearingPoint(
                obstacle_0.Position, self.track + 3.14159265358979,
                obstacle_0.Tolerance)
            point3d3 = MathHelper.distanceBearingPoint(point3d2, self.track,
                                                       100)
            point3d = MathHelper.getIntersectionPoint(self.ptDER, self.ptDER2,
                                                      point3d2, point3d3)
            num1 = 1E-08 if (
                not MathHelper.smethod_119(point3d2, self.ptDER, self.ptDER2)
            ) else MathHelper.calcDistance(point3d, point3d2)
            if num1 == 0:
                num1 = 1E-08
            mocMultiplier = self.moc / 100 * num1 * obstacle_0.MocMultiplier
            z = self.ptDER.get_Z() + 5 + self.pdg / 100 * num1
            position1 = obstacle_0.Position
            num = position1.get_Z() + obstacle_0.Trees + mocMultiplier
            z1 = 100 * ((num - (self.ptDER.get_Z() + 5)) / num1)
        if num1 < 0.00001:
            num1 = None
        criticalObstacleType = CriticalObstacleType.No
        if (z1 > self.pdg):
            criticalObstacleType = CriticalObstacleType.Yes
        closeInObstacleType = CloseInObstacleType.No
        if (num <= self.ptDER.get_Z() + 60):
            closeInObstacleType = CloseInObstacleType.Yes
        checkResult = [
            num1, num2, mocMultiplier, z, num, z1, criticalObstacleType,
            closeInObstacleType
        ]
        self.addObstacleToModel(obstacle_0, checkResult)
    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())
    def __init__(self, pinSVisualSegmentDep_0):
        IPinSVisualSegmentDep.__init__(self)
        self.RADIUS = 750
        self.OCS = 0
        self.OIS = 1
        self.poaOIS = PrimaryObstacleArea()
        self.poaOCS = PrimaryObstacleArea()
        self.paOIS = PolylineArea()
        self.paOCS = PolylineArea()
        self.selectionArea = []
        self.ptsOCSL = []
        self.ptsOCSR = []
        self.ptHRP = Point3D()
        self.ptIDF = Point3D()
        self.track = 0.0
        self.tang = 0.0
        self.elevOIS = 0.0
        self.cancelled = False

        self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D()
        self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D()
        self.track = MathHelper.smethod_4(
            Unit.ConvertDegToRad(
                float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value)))
        num = MathHelper.getBearing(self.ptIDF, self.ptHRP)
        MathHelper.getBearing(self.ptHRP, self.ptIDF)
        altitude = pinSVisualSegmentDep_0.pnlMCAH.method_3(
            Altitude(self.ptHRP.get_Z()))
        metres = altitude.Metres
        if (metres < 90):
            raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE
        altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_2(
            Altitude(self.ptHRP.get_Z()))
        metres1 = altitude1.Metres
        self.tang = 0.125
        num1 = 741
        num2 = 1482
        if (metres > 183):
            num3 = math.trunc((metres - 183) / 30)
            if ((metres - 183) % 30 > 0):
                num3 = num3 + 1
            num2 = num2 + num3 * 185
        num4 = 50
        if (metres > 183 and metres <= 304):
            num5 = math.trunc((metres - 183) / 30)
            if ((metres - 183) % 30 > 0):
                num5 = num5 + 1
            num4 = num4 - num5 * 5
            if (num4 < 30):
                num4 = 30
        elif (metres > 304):
            num4 = 30
        num6 = Unit.ConvertDegToRad(num4)
        num7 = MathHelper.calcDistance(self.ptIDF, self.ptHRP)
        if (num7 < 1000):
            eRRINSUFFICIENTSEGMENTLENGTHIDFHRP = Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH_IDF_HRP
            distance = Distance(num2)
            raise UserWarning, eRRINSUFFICIENTSEGMENTLENGTHIDFHRP % distance.Metres
        turnDirectionList = []
        num8 = MathHelper.smethod_77(num, self.track, AngleUnits.Radians,
                                     turnDirectionList)
        turnDirection = turnDirectionList[0]
        if (num8 + num6 >= 3.14159265358979):
            eRRPINSCCHGLARGEUSEDIRECT = Messages.ERR_PINS_CCHG_LARGE_USE_DIRECT
            num9 = Unit.smethod_1(3.14159265358979 - num6)
            raise UserWarning, eRRPINSCCHGLARGEUSEDIRECT % num9
        self.paOIS = PolylineArea()
        self.paOIS.method_1(self.ptIDF)
        if (turnDirection == TurnDirection.Nothing
                or MathHelper.smethod_99(num8, 0, 0.1)):
            point3d = MathHelper.distanceBearingPoint(self.ptHRP, num - num6,
                                                      num2)
            point3d1 = MathHelper.distanceBearingPoint(self.ptHRP, num + num6,
                                                       num2)
            if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked()):
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, num, num2)
            elif (pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.isChecked()
                  ):
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, num, num2)
            self.paOIS.method_3(
                point3d,
                MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1,
                                      self.ptHRP))
            self.paOIS.method_1(point3d1)
        else:
            if num2 > num7:
                point3d2 = None
                point3d3 = None
            else:
                point3d2 = MathHelper.distanceBearingPoint(
                    self.ptHRP,
                    num - math.fabs(math.asin(num2 / num7)) - 1.5707963267949,
                    num2)
                point3d3 = MathHelper.distanceBearingPoint(
                    self.ptHRP,
                    num + math.fabs(math.asin(num2 / num7)) + 1.5707963267949,
                    num2)
            if (num8 < num6 and not pinSVisualSegmentDep_0.ui.
                    chbLeftTurnProhibited.isChecked()
                    and not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.
                    isChecked()):
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track - num6, num2)
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track + num6, num2)
                if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)):
                    point3d = point3d2
                if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)):
                    point3d1 = point3d3
                self.paOIS.method_3(
                    point3d,
                    MathHelper.smethod_57(TurnDirection.Right, point3d,
                                          point3d1, self.ptHRP))
                self.paOIS.method_1(point3d1)
                self.paOIS.method_1(self.ptIDF)
            elif (turnDirection != TurnDirection.Left):
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track + num6, num2)
                if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)):
                    point3d1 = point3d3
                if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked(
                )):
                    point3d = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track, num2)
                    self.paOIS.method_1(self.ptHRP)
                    if not MathHelper.smethod_119(point3d3, self.ptHRP,
                                                  point3d):
                        self.paOIS.method_1(point3d)
                    else:
                        self.paOIS.method_3(
                            point3d,
                            MathHelper.smethod_57(TurnDirection.Right, point3d,
                                                  point3d1, self.ptHRP))
                        self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptIDF)
                else:
                    num10 = Unit.ConvertDegToRad(30)
                    point3d = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track - num6, num2
                    ) if num8 - num6 <= num10 else MathHelper.distanceBearingPoint(
                        self.ptHRP, num + num10, num2)
                    if (MathHelper.smethod_119(point3d, self.ptIDF,
                                               self.ptHRP)):
                        self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_3(
                        point3d,
                        MathHelper.smethod_57(TurnDirection.Right, point3d,
                                              point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptIDF)
            else:
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track - num6, num2)
                if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)):
                    point3d = point3d2
                if (not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.
                        isChecked()):
                    num11 = Unit.ConvertDegToRad(30)
                    point3d1 = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track + num6, num2
                    ) if num8 - num6 <= num11 else MathHelper.distanceBearingPoint(
                        self.ptHRP, num - num11, num2)
                    self.paOIS.method_3(
                        point3d,
                        MathHelper.smethod_57(TurnDirection.Right, point3d,
                                              point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    if (MathHelper.smethod_115(point3d1, self.ptIDF,
                                               self.ptHRP)):
                        self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_1(self.ptIDF)
                else:
                    point3d1 = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track, num2)
                    if (MathHelper.smethod_115(point3d2, self.ptHRP,
                                               point3d1)):
                        self.paOIS.method_3(
                            point3d,
                            MathHelper.smethod_57(TurnDirection.Right, point3d,
                                                  point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_1(self.ptIDF)


#         polyline = AcadHelper.smethod_131(self.paOIS);
#         polyline.set_Closed(true);
#         polyline = polyline.smethod_159(num1, OffsetGapType.Fillet, TurnDirection.Right);
        self.paOIS.offsetCurve(num1)
        self.poaOIS = PrimaryObstacleArea(self.paOIS)
        self.elevOIS = self.ptHRP.get_Z() + max([metres / 2 - 46, 46])
        metres2 = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres)
        metres3 = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres)
        num = MathHelper.smethod_4(
            Unit.ConvertDegToRad(
                float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value)))
        self.paOCS = PolylineArea()
        self.ptsOCSL = []
        self.ptsOCSR = []
        point3d4 = MathHelper.distanceBearingPoint(
            MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2),
            num - 1.5707963267949, metres2 / 2)
        point3d5 = MathHelper.distanceBearingPoint(
            MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2),
            num + 1.5707963267949, metres2 / 2)
        num12 = math.atan(
            0.1
        ) if pinSVisualSegmentDep_0.ui.cmbDepartureType.SelectedIndex == 0 else math.atan(
            0.15)
        num13 = 152 / self.tang
        num14 = (120 - metres2 / 2) / math.tan(num12)
        self.ptsOCSL = []
        self.ptsOCSL.append(point3d4)
        self.ptsOCSL.append(
            MathHelper.distanceBearingPoint(
                point3d4, num - num12,
                num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() +
                                                     num14 * self.tang))
        self.ptsOCSL.append(
            MathHelper.distanceBearingPoint(
                self.ptsOCSL[1], num,
                num13 - num14).smethod_167(self.ptHRP.get_Z() + 152))
        self.ptsOCSR = []
        self.ptsOCSR.append(point3d5)
        self.ptsOCSR.append(
            MathHelper.distanceBearingPoint(
                point3d5, num + num12,
                num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() +
                                                     num14 * self.tang))
        self.ptsOCSR.append(
            MathHelper.distanceBearingPoint(
                self.ptsOCSR[1], num,
                num13 - num14).smethod_167(self.ptHRP.get_Z() + 152))
        self.paOCS = PolylineArea()
        for point in self.ptsOCSL:
            self.paOCS.method_1(point)
        for j in range(len(self.ptsOCSR) - 1, -1, -1):
            self.paOCS.method_1(self.ptsOCSR[j])
        self.paOCS.method_10()
        self.poaOCS = PrimaryObstacleArea(self.paOCS)
        self.selectionArea = (PrimaryObstacleArea(self.paOIS)).SelectionArea
class PinSVisualSegmentDepManouvering(IPinSVisualSegmentDep):
    def __init__(self, pinSVisualSegmentDep_0):
        IPinSVisualSegmentDep.__init__(self)
        self.RADIUS = 750
        self.OCS = 0
        self.OIS = 1
        self.poaOIS = PrimaryObstacleArea()
        self.poaOCS = PrimaryObstacleArea()
        self.paOIS = PolylineArea()
        self.paOCS = PolylineArea()
        self.selectionArea = []
        self.ptsOCSL = []
        self.ptsOCSR = []
        self.ptHRP = Point3D()
        self.ptIDF = Point3D()
        self.track = 0.0
        self.tang = 0.0
        self.elevOIS = 0.0
        self.cancelled = False

        self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D()
        self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D()
        self.track = MathHelper.smethod_4(
            Unit.ConvertDegToRad(
                float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value)))
        num = MathHelper.getBearing(self.ptIDF, self.ptHRP)
        MathHelper.getBearing(self.ptHRP, self.ptIDF)
        altitude = pinSVisualSegmentDep_0.pnlMCAH.method_3(
            Altitude(self.ptHRP.get_Z()))
        metres = altitude.Metres
        if (metres < 90):
            raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE
        altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_2(
            Altitude(self.ptHRP.get_Z()))
        metres1 = altitude1.Metres
        self.tang = 0.125
        num1 = 741
        num2 = 1482
        if (metres > 183):
            num3 = math.trunc((metres - 183) / 30)
            if ((metres - 183) % 30 > 0):
                num3 = num3 + 1
            num2 = num2 + num3 * 185
        num4 = 50
        if (metres > 183 and metres <= 304):
            num5 = math.trunc((metres - 183) / 30)
            if ((metres - 183) % 30 > 0):
                num5 = num5 + 1
            num4 = num4 - num5 * 5
            if (num4 < 30):
                num4 = 30
        elif (metres > 304):
            num4 = 30
        num6 = Unit.ConvertDegToRad(num4)
        num7 = MathHelper.calcDistance(self.ptIDF, self.ptHRP)
        if (num7 < 1000):
            eRRINSUFFICIENTSEGMENTLENGTHIDFHRP = Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH_IDF_HRP
            distance = Distance(num2)
            raise UserWarning, eRRINSUFFICIENTSEGMENTLENGTHIDFHRP % distance.Metres
        turnDirectionList = []
        num8 = MathHelper.smethod_77(num, self.track, AngleUnits.Radians,
                                     turnDirectionList)
        turnDirection = turnDirectionList[0]
        if (num8 + num6 >= 3.14159265358979):
            eRRPINSCCHGLARGEUSEDIRECT = Messages.ERR_PINS_CCHG_LARGE_USE_DIRECT
            num9 = Unit.smethod_1(3.14159265358979 - num6)
            raise UserWarning, eRRPINSCCHGLARGEUSEDIRECT % num9
        self.paOIS = PolylineArea()
        self.paOIS.method_1(self.ptIDF)
        if (turnDirection == TurnDirection.Nothing
                or MathHelper.smethod_99(num8, 0, 0.1)):
            point3d = MathHelper.distanceBearingPoint(self.ptHRP, num - num6,
                                                      num2)
            point3d1 = MathHelper.distanceBearingPoint(self.ptHRP, num + num6,
                                                       num2)
            if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked()):
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, num, num2)
            elif (pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.isChecked()
                  ):
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, num, num2)
            self.paOIS.method_3(
                point3d,
                MathHelper.smethod_57(TurnDirection.Right, point3d, point3d1,
                                      self.ptHRP))
            self.paOIS.method_1(point3d1)
        else:
            if num2 > num7:
                point3d2 = None
                point3d3 = None
            else:
                point3d2 = MathHelper.distanceBearingPoint(
                    self.ptHRP,
                    num - math.fabs(math.asin(num2 / num7)) - 1.5707963267949,
                    num2)
                point3d3 = MathHelper.distanceBearingPoint(
                    self.ptHRP,
                    num + math.fabs(math.asin(num2 / num7)) + 1.5707963267949,
                    num2)
            if (num8 < num6 and not pinSVisualSegmentDep_0.ui.
                    chbLeftTurnProhibited.isChecked()
                    and not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.
                    isChecked()):
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track - num6, num2)
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track + num6, num2)
                if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)):
                    point3d = point3d2
                if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)):
                    point3d1 = point3d3
                self.paOIS.method_3(
                    point3d,
                    MathHelper.smethod_57(TurnDirection.Right, point3d,
                                          point3d1, self.ptHRP))
                self.paOIS.method_1(point3d1)
                self.paOIS.method_1(self.ptIDF)
            elif (turnDirection != TurnDirection.Left):
                point3d1 = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track + num6, num2)
                if (MathHelper.smethod_115(point3d3, self.ptHRP, point3d1)):
                    point3d1 = point3d3
                if (pinSVisualSegmentDep_0.ui.chbLeftTurnProhibited.isChecked(
                )):
                    point3d = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track, num2)
                    self.paOIS.method_1(self.ptHRP)
                    if not MathHelper.smethod_119(point3d3, self.ptHRP,
                                                  point3d):
                        self.paOIS.method_1(point3d)
                    else:
                        self.paOIS.method_3(
                            point3d,
                            MathHelper.smethod_57(TurnDirection.Right, point3d,
                                                  point3d1, self.ptHRP))
                        self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptIDF)
                else:
                    num10 = Unit.ConvertDegToRad(30)
                    point3d = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track - num6, num2
                    ) if num8 - num6 <= num10 else MathHelper.distanceBearingPoint(
                        self.ptHRP, num + num10, num2)
                    if (MathHelper.smethod_119(point3d, self.ptIDF,
                                               self.ptHRP)):
                        self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_3(
                        point3d,
                        MathHelper.smethod_57(TurnDirection.Right, point3d,
                                              point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptIDF)
            else:
                point3d = MathHelper.distanceBearingPoint(
                    self.ptHRP, self.track - num6, num2)
                if (MathHelper.smethod_119(point3d2, self.ptHRP, point3d)):
                    point3d = point3d2
                if (not pinSVisualSegmentDep_0.ui.chbRightTurnProhibited.
                        isChecked()):
                    num11 = Unit.ConvertDegToRad(30)
                    point3d1 = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track + num6, num2
                    ) if num8 - num6 <= num11 else MathHelper.distanceBearingPoint(
                        self.ptHRP, num - num11, num2)
                    self.paOIS.method_3(
                        point3d,
                        MathHelper.smethod_57(TurnDirection.Right, point3d,
                                              point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    if (MathHelper.smethod_115(point3d1, self.ptIDF,
                                               self.ptHRP)):
                        self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_1(self.ptIDF)
                else:
                    point3d1 = MathHelper.distanceBearingPoint(
                        self.ptHRP, self.track, num2)
                    if (MathHelper.smethod_115(point3d2, self.ptHRP,
                                               point3d1)):
                        self.paOIS.method_3(
                            point3d,
                            MathHelper.smethod_57(TurnDirection.Right, point3d,
                                                  point3d1, self.ptHRP))
                    self.paOIS.method_1(point3d1)
                    self.paOIS.method_1(self.ptHRP)
                    self.paOIS.method_1(self.ptIDF)


#         polyline = AcadHelper.smethod_131(self.paOIS);
#         polyline.set_Closed(true);
#         polyline = polyline.smethod_159(num1, OffsetGapType.Fillet, TurnDirection.Right);
        self.paOIS.offsetCurve(num1)
        self.poaOIS = PrimaryObstacleArea(self.paOIS)
        self.elevOIS = self.ptHRP.get_Z() + max([metres / 2 - 46, 46])
        metres2 = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres)
        metres3 = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres)
        num = MathHelper.smethod_4(
            Unit.ConvertDegToRad(
                float(pinSVisualSegmentDep_0.ui.txtTakeOffSurfaceTrack.Value)))
        self.paOCS = PolylineArea()
        self.ptsOCSL = []
        self.ptsOCSR = []
        point3d4 = MathHelper.distanceBearingPoint(
            MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2),
            num - 1.5707963267949, metres2 / 2)
        point3d5 = MathHelper.distanceBearingPoint(
            MathHelper.distanceBearingPoint(self.ptHRP, num, metres3 / 2),
            num + 1.5707963267949, metres2 / 2)
        num12 = math.atan(
            0.1
        ) if pinSVisualSegmentDep_0.ui.cmbDepartureType.SelectedIndex == 0 else math.atan(
            0.15)
        num13 = 152 / self.tang
        num14 = (120 - metres2 / 2) / math.tan(num12)
        self.ptsOCSL = []
        self.ptsOCSL.append(point3d4)
        self.ptsOCSL.append(
            MathHelper.distanceBearingPoint(
                point3d4, num - num12,
                num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() +
                                                     num14 * self.tang))
        self.ptsOCSL.append(
            MathHelper.distanceBearingPoint(
                self.ptsOCSL[1], num,
                num13 - num14).smethod_167(self.ptHRP.get_Z() + 152))
        self.ptsOCSR = []
        self.ptsOCSR.append(point3d5)
        self.ptsOCSR.append(
            MathHelper.distanceBearingPoint(
                point3d5, num + num12,
                num14 * math.cos(num12)).smethod_167(self.ptHRP.get_Z() +
                                                     num14 * self.tang))
        self.ptsOCSR.append(
            MathHelper.distanceBearingPoint(
                self.ptsOCSR[1], num,
                num13 - num14).smethod_167(self.ptHRP.get_Z() + 152))
        self.paOCS = PolylineArea()
        for point in self.ptsOCSL:
            self.paOCS.method_1(point)
        for j in range(len(self.ptsOCSR) - 1, -1, -1):
            self.paOCS.method_1(self.ptsOCSR[j])
        self.paOCS.method_10()
        self.poaOCS = PrimaryObstacleArea(self.paOCS)
        self.selectionArea = (PrimaryObstacleArea(self.paOIS)).SelectionArea

    def get_Cancelled(self):
        return self.cancelled

    Cancelled = property(get_Cancelled, None, None, None)

    def get_SelectionArea(self):
        return self.selectionArea

    SelectionArea = property(get_SelectionArea, None, None, None)

    def imethod_0(self, obstacle_0):
        criticalObstacleType = CriticalObstacleType.No
        if (self.poaOIS.pointInPolygon(obstacle_0.Position,
                                       obstacle_0.Tolerance)):
            z = self.elevOIS
            num = 1
            if (self.poaOCS.pointInPolygon(obstacle_0.Position,
                                           obstacle_0.Tolerance)):
                point3d1 = MathHelper.distanceBearingPoint(
                    obstacle_0.Position, self.track, 100)
                point3d = MathHelper.getIntersectionPoint(
                    obstacle_0.Position, point3d1, self.ptsOCSL[0],
                    self.ptsOCSR[0])
                num1 = max(
                    MathHelper.calcDistance(point3d, obstacle_0.Position) -
                    obstacle_0.Tolerance, 0)
                z = num1 * self.tang + self.ptHRP.get_Z()
                num = 0
            position = obstacle_0.Position
            z1 = position.get_Z() + obstacle_0.Trees - z
            if (z1 > 0):
                criticalObstacleType = CriticalObstacleType.Yes
            return [
                z, z1, criticalObstacleType,
                PinsSurfaceType.PinsSurfaceType_OCS
                if num == 0 else PinsSurfaceType.PinsSurfaceType_LevelOIS
            ]

    def imethod_1(self, layers):
        linesList = []
        pointList = self.paOIS.method_14_closed()
        linesList.append((pointList, [
            ("surface", PinsSurfaceType.PinsSurfaceType_LevelOIS)
        ]))
        polyline = self.paOCS.method_14_closed()
        linesList.append(
            (polyline, [("surface", PinsSurfaceType.PinsSurfaceType_OCS)]))
        resultLayer = QgisHelper.createPolylineLayer(
            "Pins Visual Segment Departure Manouvering 2D", linesList,
            [QgsField("surface", QVariant.String)])
        layers.append(resultLayer)

    def imethod_2(self, layers):
        polyline = self.paOIS.method_14_closed()
        #         polyline.set_Elevation(self.elevOIS);
        linesList = []
        for i in range(1, len(self.ptsOCSL)):
            face = [
                self.ptsOCSL[i - 1], self.ptsOCSL[i], self.ptsOCSR[i],
                self.ptsOCSR[i - 1]
            ]
            linesList.append(
                (face, [("surface", PinsSurfaceType.PinsSurfaceType_OCS)]))

        linesList.append((polyline, [
            ("surface", PinsSurfaceType.PinsSurfaceType_LevelOIS)
        ]))
        resultLayer = QgisHelper.createPolylineLayer(
            "Pins Visual Segment Departure Manouvering 3D", linesList,
            [QgsField("surface", QVariant.String)])
        layers.append(resultLayer)
 def __init__(self, pinSVisualSegmentDep_0):
     IPinSVisualSegmentDep.__init__(self)
     self.poaOIS = PrimaryObstacleArea()
     self.paOIS = PolylineArea()
     self.tanOIS = 0.0
     self.trackOIS = 0.0
     self.maxSurfAlt = 0.0
     self.ptHRP = Point3D()
     self.ptIDF = Point3D()
     self.ptL1 = Point3D()
     self.ptR1 = Point3D()
     turnDirection = []
     metres = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres)
     num = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres)
     self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D()
     self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D()
     num1 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) - metres / 2
     if (num1 < 1482):
         raise UserWarning, Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH
     value = float(pinSVisualSegmentDep_0.ui.txtTrackFrom.Value)
     num2 = Unit.smethod_1(MathHelper.getBearing(self.ptHRP, self.ptIDF))
     num3 = MathHelper.smethod_77(num2, value, AngleUnits.Degrees,
                                  turnDirection)
     if (num3 == 0):
         str1 = "13.9km(7.5nm)"
         if (num1 > 13900):
             raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str1
     elif (num3 <= 10):
         str3 = "11.9km(6.4nm)"
         if (num1 > 11900):
             raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str3
     elif (num3 > 20):
         if (num3 > 30):
             raise UserWarning, Messages.ERR_COURSE_CHANGES_GREATER_THAN_30_NOT_ALLOWED
         str5 = "6.5km(3.5nm)"
         if (num1 > 6500):
             raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str5
     else:
         str7 = "9.3km(5nm)"
         if (num1 > 9300):
             raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str7
     altitude = pinSVisualSegmentDep_0.pnlMCAH.method_2(
         Altitude(self.ptHRP.get_Z()))
     metres1 = altitude.Metres
     altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_3(
         Altitude(self.ptHRP.get_Z()))
     metres2 = altitude1.Metres
     metres3 = pinSVisualSegmentDep_0.ui.txtMOC.Value.Metres
     if (metres2 - metres3 <= 0):
         raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE
     angleGradientSlope = pinSVisualSegmentDep_0.ui.txtVSDG.Value
     percent = metres2 / (angleGradientSlope.Percent / 100)
     self.tanOIS = (metres2 - metres3) / percent
     if (percent > num1):
         raise UserWarning, Messages.ERR_IDF_TOO_CLOSE_OR_MIN_ALT_TOO_HIGH
     num2 = Unit.ConvertDegToRad(num2)
     value = Unit.ConvertDegToRad(value)
     self.trackOIS = num2
     num4 = Unit.ConvertDegToRad(15)
     point3d = MathHelper.distanceBearingPoint(self.ptHRP, num2, metres / 2)
     self.ptL1 = MathHelper.distanceBearingPoint(
         point3d, num2 - 1.5707963267949,
         45).smethod_167(self.ptHRP.get_Z())
     self.ptR1 = MathHelper.distanceBearingPoint(
         point3d, num2 + 1.5707963267949,
         45).smethod_167(self.ptHRP.get_Z())
     point3d1 = MathHelper.distanceBearingPoint(
         self.ptL1, num2 - num4,
         percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                               percent * self.tanOIS)
     point3d2 = MathHelper.distanceBearingPoint(
         self.ptR1, num2 + num4,
         percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                               percent * self.tanOIS)
     point3d3 = MathHelper.distanceBearingPoint(
         point3d1, num2 - num4, (num1 - percent) /
         math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                     percent * self.tanOIS)
     point3d4 = MathHelper.distanceBearingPoint(
         point3d2, num2 + num4, (num1 - percent) /
         math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                     percent * self.tanOIS)
     self.maxSurfAlt = self.ptHRP.get_Z() + percent * self.tanOIS
     self.paOIS = PolylineArea()
     polylineArea = self.paOIS
     point3dArray = [
         self.ptL1, point3d1, point3d3, point3d4, point3d2, self.ptR1
     ]
     polylineArea.method_7(point3dArray)
     self.paOIS.method_16()
     self.poaOIS = PrimaryObstacleArea(self.paOIS)
class PinSVisualSegmentDepDirect(IPinSVisualSegmentDep):
    def __init__(self, pinSVisualSegmentDep_0):
        IPinSVisualSegmentDep.__init__(self)
        self.poaOIS = PrimaryObstacleArea()
        self.paOIS = PolylineArea()
        self.tanOIS = 0.0
        self.trackOIS = 0.0
        self.maxSurfAlt = 0.0
        self.ptHRP = Point3D()
        self.ptIDF = Point3D()
        self.ptL1 = Point3D()
        self.ptR1 = Point3D()
        turnDirection = []
        metres = float(pinSVisualSegmentDep_0.ui.txtHSAL.Value.Metres)
        num = float(pinSVisualSegmentDep_0.ui.txtHSAW.Value.Metres)
        self.ptHRP = pinSVisualSegmentDep_0.pnlHRP.getPoint3D()
        self.ptIDF = pinSVisualSegmentDep_0.pnlIDF.getPoint3D()
        num1 = MathHelper.calcDistance(self.ptIDF, self.ptHRP) - metres / 2
        if (num1 < 1482):
            raise UserWarning, Messages.ERR_INSUFFICIENT_SEGMENT_LENGTH
        value = float(pinSVisualSegmentDep_0.ui.txtTrackFrom.Value)
        num2 = Unit.smethod_1(MathHelper.getBearing(self.ptHRP, self.ptIDF))
        num3 = MathHelper.smethod_77(num2, value, AngleUnits.Degrees,
                                     turnDirection)
        if (num3 == 0):
            str1 = "13.9km(7.5nm)"
            if (num1 > 13900):
                raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str1
        elif (num3 <= 10):
            str3 = "11.9km(6.4nm)"
            if (num1 > 11900):
                raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str3
        elif (num3 > 20):
            if (num3 > 30):
                raise UserWarning, Messages.ERR_COURSE_CHANGES_GREATER_THAN_30_NOT_ALLOWED
            str5 = "6.5km(3.5nm)"
            if (num1 > 6500):
                raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str5
        else:
            str7 = "9.3km(5nm)"
            if (num1 > 9300):
                raise UserWarning, Messages.ERR_MAX_SEGMENT_LENGTH_X % str7
        altitude = pinSVisualSegmentDep_0.pnlMCAH.method_2(
            Altitude(self.ptHRP.get_Z()))
        metres1 = altitude.Metres
        altitude1 = pinSVisualSegmentDep_0.pnlMCAH.method_3(
            Altitude(self.ptHRP.get_Z()))
        metres2 = altitude1.Metres
        metres3 = pinSVisualSegmentDep_0.ui.txtMOC.Value.Metres
        if (metres2 - metres3 <= 0):
            raise UserWarning, Messages.ERR_INSUFFICIENT_MINIMUM_ALTITUDE
        angleGradientSlope = pinSVisualSegmentDep_0.ui.txtVSDG.Value
        percent = metres2 / (angleGradientSlope.Percent / 100)
        self.tanOIS = (metres2 - metres3) / percent
        if (percent > num1):
            raise UserWarning, Messages.ERR_IDF_TOO_CLOSE_OR_MIN_ALT_TOO_HIGH
        num2 = Unit.ConvertDegToRad(num2)
        value = Unit.ConvertDegToRad(value)
        self.trackOIS = num2
        num4 = Unit.ConvertDegToRad(15)
        point3d = MathHelper.distanceBearingPoint(self.ptHRP, num2, metres / 2)
        self.ptL1 = MathHelper.distanceBearingPoint(
            point3d, num2 - 1.5707963267949,
            45).smethod_167(self.ptHRP.get_Z())
        self.ptR1 = MathHelper.distanceBearingPoint(
            point3d, num2 + 1.5707963267949,
            45).smethod_167(self.ptHRP.get_Z())
        point3d1 = MathHelper.distanceBearingPoint(
            self.ptL1, num2 - num4,
            percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                                  percent * self.tanOIS)
        point3d2 = MathHelper.distanceBearingPoint(
            self.ptR1, num2 + num4,
            percent / math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                                  percent * self.tanOIS)
        point3d3 = MathHelper.distanceBearingPoint(
            point3d1, num2 - num4, (num1 - percent) /
            math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                        percent * self.tanOIS)
        point3d4 = MathHelper.distanceBearingPoint(
            point3d2, num2 + num4, (num1 - percent) /
            math.cos(num4)).smethod_167(self.ptHRP.get_Z() +
                                        percent * self.tanOIS)
        self.maxSurfAlt = self.ptHRP.get_Z() + percent * self.tanOIS
        self.paOIS = PolylineArea()
        polylineArea = self.paOIS
        point3dArray = [
            self.ptL1, point3d1, point3d3, point3d4, point3d2, self.ptR1
        ]
        polylineArea.method_7(point3dArray)
        self.paOIS.method_16()
        self.poaOIS = PrimaryObstacleArea(self.paOIS)

    def get_SelectionArea(self):
        return self.poaOIS.SelectionArea

    SelectionArea = property(get_SelectionArea, None, None, None)

    def imethod_0(self, obstacle_0):
        criticalObstacleType = CriticalObstacleType.No
        if (self.poaOIS.pointInPolygon(obstacle_0.Position,
                                       obstacle_0.Tolerance)):
            point3d1 = MathHelper.distanceBearingPoint(obstacle_0.Position,
                                                       self.trackOIS, 100)
            point3d = MathHelper.getIntersectionPoint(obstacle_0.Position,
                                                      point3d1, self.ptL1,
                                                      self.ptR1)
            num = max([
                MathHelper.calcDistance(point3d, obstacle_0.Position) -
                obstacle_0.Tolerance, 0
            ])
            num1 = min(
                [self.ptHRP.get_Z() + num * self.tanOIS, self.maxSurfAlt])
            position = obstacle_0.Position
            z = position.get_Z() + obstacle_0.Trees - num1
            if (z > 0):
                criticalObstacleType = CriticalObstacleType.Yes
            return [
                num1, z, criticalObstacleType,
                PinsSurfaceType.PinsSurfaceType_OIS
            ]

    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)

    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)