private static void CheckContains(IPreparedGeometry pg, IGeometry g2)
        {
            var pgResult = pg.Contains(g2);
            var expected = pg.Geometry.Contains(g2);

            if (pgResult != expected)
                throw new InvalidOperationException("PreparedGeometry.contains result does not match expected");

            //		System.out.println("Results match!");
        }
Exemple #2
0
        private static void CheckContains(IPreparedGeometry pg, IGeometry g2)
        {
            bool pgResult = pg.Contains(g2);
            bool expected = pg.Geometry.Contains(g2);

            if (pgResult != expected)
            {
                throw new InvalidOperationException("PreparedGeometry.contains result does not match expected");
            }

            // System.out.println("Results match!");
        }
        private bool CheckIfMatch(IPreparedGeometry polygon, Geometry current_polygon, Mode mode)
        {
            if (mode == Mode.Intersect)
            {
                return(polygon.Intersects(current_polygon));
            }

            if (mode == Mode.Contains)
            {
                return(polygon.Contains(current_polygon));
            }

            throw new InvalidEnumArgumentException("unkown mode");
        }
            private static bool CheckContains(IGeometry target, IGeometry test)
            {
                bool expectedResult = target.Contains(test);

                PreparedGeometryFactory pgFact   = new PreparedGeometryFactory();
                IPreparedGeometry       prepGeom = pgFact.Create(target);

                bool prepResult = prepGeom.Contains(test);

                if (prepResult != expectedResult)
                {
                    return(false);
                }
                return(true);
            }
 internal static IGeometry PolygonizeForClip(IGeometry geometry, IPreparedGeometry clip)
 {
     var lines = LineStringExtracter.GetLines(geometry);
     var clippedLines = new List<IGeometry>();
     foreach (ILineString line in lines)
     {
         if (clip.Contains(line))
             clippedLines.Add(line);
     }
     var polygonizer = new Polygonizer();
     polygonizer.Add(clippedLines);
     var polys = polygonizer.GetPolygons();
     var polyArray = GeometryFactory.ToGeometryArray(polys);
     return geometry.Factory.CreateGeometryCollection(polyArray);
 }
        internal static IGeometry PolygonizeForClip(IGeometry geometry, IPreparedGeometry clip)
        {
            var lines        = LineStringExtracter.GetLines(geometry);
            var clippedLines = new List <IGeometry>();

            foreach (ILineString line in lines)
            {
                if (clip.Contains(line))
                {
                    clippedLines.Add(line);
                }
            }
            var polygonizer = new Polygonizer();

            polygonizer.Add(clippedLines);
            var polys     = polygonizer.GetPolygons();
            var polyArray = GeometryFactory.ToGeometryArray(polys);

            return(geometry.Factory.CreateGeometryCollection(polyArray));
        }