GeometryClipper { Geometry clipGeometry( final Geometry geom ) { return clipGeometry( geom, clippingArea ); } GeometryClipper( final Envelope viewPort, final int width ); static boolean isGenerationExpensive( PolygonStyling styling ); static boolean isGenerationExpensive( LineStyling styling );  }
@Test public void clipGeometryDistinctToViewport() throws ParseException { final String wkt = "POLYGON ((2 0,3 0,3 3,0 3,0 2,2 2,2 0))"; final Geometry geometryDistinct = new WKTReader( null ).read( wkt ); final Geometry clippedGeometry = clipper.clipGeometry( geometryDistinct ); assertTrue( clippedGeometry == null ); }
@Test public void clipGeometryPartiallyIntersectingViewport() throws ParseException { final String wkt = "POLYGON ((0 0,3 0,3 3,0 3,0 2,2 2,0 0))"; final Geometry geometryDistinct = new WKTReader( null ).read( wkt ); final Geometry clippedGeometry = clipper.clipGeometry( geometryDistinct ); assertTrue( clippedGeometry != null ); assertTrue( !geometryDistinct.equals( clippedGeometry ) ); }
@Test public void clipGeometryContainedInViewport() throws ParseException { final String wkt = "POLYGON ((0.0 0.0,0.3 0.0,0.3 0.3,0.0 0.3,0.0 0.2,0.2 0.2,0.0 0.0))"; final Geometry geometryDistinct = new WKTReader( null ).read( wkt ); final Geometry clippedGeometry = clipper.clipGeometry( geometryDistinct ); assertTrue( clippedGeometry != null ); assertTrue( geometryDistinct.equals( clippedGeometry ) ); }