internal static com.epl.geometry.Geometry PolylineMinusArea_(com.epl.geometry.Geometry geometry, com.epl.geometry.Geometry area, int area_type, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker)
        {
            // construct the complement of the Polygon (or Envelope)
            com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
            geometry.QueryEnvelope(envelope);
            com.epl.geometry.Envelope2D env_2D = new com.epl.geometry.Envelope2D();
            area.QueryEnvelope2D(env_2D);
            envelope.Merge(env_2D);
            double dw = 0.1 * envelope.GetWidth();
            double dh = 0.1 * envelope.GetHeight();

            envelope.Inflate(dw, dh);
            com.epl.geometry.Polygon complement = new com.epl.geometry.Polygon();
            complement.AddEnvelope(envelope, false);
            com.epl.geometry.MultiPathImpl complementImpl = (com.epl.geometry.MultiPathImpl)(complement._getImpl());
            if (area_type == com.epl.geometry.Geometry.GeometryType.Polygon)
            {
                com.epl.geometry.MultiPathImpl polygonImpl = (com.epl.geometry.MultiPathImpl)(area._getImpl());
                complementImpl.Add(polygonImpl, true);
            }
            else
            {
                complementImpl.AddEnvelope((com.epl.geometry.Envelope)(area), true);
            }
            com.epl.geometry.OperatorFactoryLocal projEnv = com.epl.geometry.OperatorFactoryLocal.GetInstance();
            com.epl.geometry.OperatorIntersection operatorIntersection = (com.epl.geometry.OperatorIntersection)projEnv.GetOperator(com.epl.geometry.Operator.Type.Intersection);
            com.epl.geometry.Geometry             difference           = operatorIntersection.Execute(geometry, complement, sr, progress_tracker);
            return(difference);
        }
Esempio n. 2
0
 public static void TestClipIssue258243()
 {
     com.epl.geometry.Polygon poly1 = new com.epl.geometry.Polygon();
     poly1.StartPath(21.476191371901479, 41.267022001907215);
     poly1.LineTo(59.669186665158051, 36.62700518555863);
     poly1.LineTo(20.498578117352313, 30.363180148246094);
     poly1.LineTo(18.342565836615044, 46.303295352085627);
     poly1.LineTo(17.869569458621626, 23.886816966894159);
     poly1.LineTo(19.835465558090434, 20);
     poly1.LineTo(18.83911285048551, 43.515995498114791);
     poly1.LineTo(20.864485260298004, 20.235921201027757);
     poly1.LineTo(18.976127544787012, 20);
     poly1.LineTo(34.290201277718218, 61.801369014954794);
     poly1.LineTo(20.734727419368866, 20);
     poly1.LineTo(18.545865698148113, 20);
     poly1.LineTo(19.730260558565515, 20);
     poly1.LineTo(19.924806216827005, 23.780315893949187);
     poly1.LineTo(21.675168105421452, 36.699924873001258);
     poly1.LineTo(22.500527828912158, 43.703424859922983);
     poly1.LineTo(42.009527116514818, 36.995486982256089);
     poly1.LineTo(24.469729873835782, 58.365871758247039);
     poly1.LineTo(24.573736036545878, 36.268390409195824);
     poly1.LineTo(22.726502169802746, 20);
     poly1.LineTo(23.925834885228145, 20);
     poly1.LineTo(25.495346880936729, 20);
     poly1.LineTo(23.320941499288317, 20);
     poly1.LineTo(24.05655665646276, 28.659578774758632);
     poly1.LineTo(23.205940789341135, 38.491506888710504);
     poly1.LineTo(21.472847203385509, 53.057228182018044);
     poly1.LineTo(25.04257681654104, 20);
     poly1.LineTo(25.880572351149542, 25.16102863979474);
     poly1.LineTo(26.756283333879658, 20);
     poly1.LineTo(21.476191371901479, 41.267022001907215);
     com.epl.geometry.Envelope2D env = new com.epl.geometry.Envelope2D();
     env.SetCoords(24.269517325186033, 19.999998900000001, 57.305574253225409, 61.801370114954793);
     try
     {
         com.epl.geometry.Geometry output_geom = com.epl.geometry.OperatorClip.Local().Execute(poly1, env, com.epl.geometry.SpatialReference.Create(4326), null);
         com.epl.geometry.Envelope envPoly     = new com.epl.geometry.Envelope();
         poly1.QueryEnvelope(envPoly);
         com.epl.geometry.Envelope e = new com.epl.geometry.Envelope(env);
         e.Intersect(envPoly);
         com.epl.geometry.Envelope clippedEnv = new com.epl.geometry.Envelope();
         output_geom.QueryEnvelope(clippedEnv);
         NUnit.Framework.Assert.IsTrue(System.Math.Abs(clippedEnv.GetXMin() - e.GetXMin()) < 1e-10 && System.Math.Abs(clippedEnv.GetYMin() - e.GetYMin()) < 1e-10 && System.Math.Abs(clippedEnv.GetXMax() - e.GetXMax()) < 1e-10 && System.Math.Abs(clippedEnv.GetYMax() - e.GetYMax()) < 1e-10);
     }
     catch (System.Exception)
     {
         NUnit.Framework.Assert.IsTrue(false);
     }
 }
Esempio n. 3
0
 public override com.epl.geometry.ogc.OGCGeometry Envelope()
 {
     com.epl.geometry.GeometryCursor gc  = GetEsriGeometryCursor();
     com.epl.geometry.Envelope       env = new com.epl.geometry.Envelope();
     for (com.epl.geometry.Geometry g = gc.Next(); g != null; g = gc.Next())
     {
         com.epl.geometry.Envelope e = new com.epl.geometry.Envelope();
         g.QueryEnvelope(e);
         env.Merge(e);
     }
     com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon();
     polygon.AddEnvelope(env, false);
     return(new com.epl.geometry.ogc.OGCPolygon(polygon, esriSR));
 }