public void testPartlyVisibleFeature()
{
LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
Geometry lineFeature = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "500 500,500 1500" ) );
Point expectedIntersectionPoint = this.geometryFactory.createPoint( new Coordinate( 500, 1000 ) );
Options options = new Options();
JustOffTheMapIntersectionGenerator testObj = new JustOffTheMapIntersectionGenerator();
testObj.setShape( mapBounds );
testObj.setDefaultOffTheMapDistance( 10.0 );
// Ignore is on by default, which is used because no options are specified.
testObj.setDefaultIgnoreVisibleFeatures( true );
testObj.setOptions( null );
assertNull( testObj.generateIntersections( lineFeature ) );
// Ignore is off by default, which is used because no options are specified.
testObj.setDefaultIgnoreVisibleFeatures( false );
testObj.setOptions( null );
assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
// Ignore is on by default, which is used because no specific option is specified.
testObj.setDefaultIgnoreVisibleFeatures( true );
testObj.setOptions( options );
options.setIgnoreVisibleFeatures( null );
assertNull( testObj.generateIntersections( lineFeature ) );
// Ignore is off by default, which is used because no specific option is specified.
testObj.setDefaultIgnoreVisibleFeatures( false );
testObj.setOptions( options );
options.setIgnoreVisibleFeatures( null );
assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
// Ignore is turned on in the options.
testObj.setDefaultIgnoreVisibleFeatures( false );
testObj.setOptions( options );
options.setIgnoreVisibleFeatures( true );
assertNull( testObj.generateIntersections( lineFeature ) );
// Ignore is turned off in the options.
testObj.setDefaultIgnoreVisibleFeatures( true );
testObj.setOptions( options );
options.setIgnoreVisibleFeatures( false );
assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
}