Esempio n. 1
0
        private void GetIntersectTypeAndOtherParameter()
        {
            switch (PositionType)
            {
            case PolygonCompareMultiPolygonPositionType.Parallel: this.IntersectType = PolygonCompareMultiPolygonIntersectType.NonIntersect; return;

            case PolygonCompareMultiPolygonPositionType.NonPlarnar: throw new Exception("Code for this case hasn't finished yet!");

            case PolygonCompareMultiPolygonPositionType.Planar:
                Polygon        surPL            = multiPolygon.SurfacePolygon;
                List <Polygon> openPLs          = multiPolygon.OpeningPolygons;
                PolygonComparePolygonResult res = new PolygonComparePolygonResult(polygon, surPL);
                switch (res.IntersectType)
                {
                case PolygonComparePolygonIntersectType.NonIntersect: this.IntersectType = PolygonCompareMultiPolygonIntersectType.NonIntersect; return;

                case PolygonComparePolygonIntersectType.Boundary: this.IntersectType = PolygonCompareMultiPolygonIntersectType.Boundary; ListLine = res.ListLine; return;

                case PolygonComparePolygonIntersectType.Point: IntersectType = PolygonCompareMultiPolygonIntersectType.Point; ListPoint = res.ListPoint; return;

                case PolygonComparePolygonIntersectType.AreaOverlap:
                    ListPolygon       = new List <Polygon>();
                    this.MultiPolygon = null;
                    foreach (Polygon pl in res.ListPolygon)
                    {
                        Polygon temp = pl;
                        foreach (Polygon openPl in multiPolygon.OpeningPolygons)
                        {
                            PolygonComparePolygonResult ppRes = new PolygonComparePolygonResult(temp, openPl);
                            if (ppRes.IntersectType == PolygonComparePolygonIntersectType.AreaOverlap)
                            {
                                object polyorMultiPolygonCut = null;
                                ppRes.GetOuterPolygon(temp, out polyorMultiPolygonCut);
                                if (polyorMultiPolygonCut == null)
                                {
                                    goto Here;
                                }
                                if (polyorMultiPolygonCut is MultiPolygon)
                                {
                                    this.MultiPolygon = polyorMultiPolygonCut as MultiPolygon;
                                    return;
                                }
                                temp = polyorMultiPolygonCut as Polygon;
                            }
                        }
                        ListPolygon.Add(temp);
                        Here : continue;
                    }
                    break;
                }
                break;
            }
        }
Esempio n. 2
0
 public PolygonCompareMultiPolygonResult(Polygon pl, MultiPolygon mpl)
 {
     this.polygon = pl; this.multiPolygon = mpl; GetPositionType(); GetIntersectTypeAndOtherParameter();
 }