org.openstreetmap.osmosis.core.filter.common
Class PolygonFileReader

java.lang.Object
  extended by org.openstreetmap.osmosis.core.filter.common.PolygonFileReader

public class PolygonFileReader
extends java.lang.Object

Reads the contents of a polygon file into an Area instance.

The file format is defined at http://www.maproom.psu.edu/dcw/. An example is provided here. The first line contains the name of the file, the second line contains the name of an individual polygon and if it is prefixed with ! it means it is a negative polygon to be subtracted from the resultant extraction polygon.

australia_v
1
0.1446763E+03 -0.3825659E+02
0.1446693E+03 -0.3826255E+02
0.1446627E+03 -0.3825661E+02
0.1446763E+03 -0.3824465E+02
0.1446813E+03 -0.3824343E+02
0.1446824E+03 -0.3824484E+02
0.1446826E+03 -0.3825356E+02
0.1446876E+03 -0.3825210E+02
0.1446919E+03 -0.3824719E+02
0.1447006E+03 -0.3824723E+02
0.1447042E+03 -0.3825078E+02
0.1446758E+03 -0.3826229E+02
0.1446693E+03 -0.3826255E+02
END
!2
0.1422483E+03 -0.3839481E+02
0.1422436E+03 -0.3839315E+02
0.1422496E+03 -0.3839070E+02
0.1422543E+03 -0.3839025E+02
0.1422574E+03 -0.3839155E+02
0.1422467E+03 -0.3840065E+02
0.1422433E+03 -0.3840048E+02
0.1422420E+03 -0.3839857E+02
0.1422436E+03 -0.3839315E+02
END
END

Author:
Brett Henderson

Constructor Summary
PolygonFileReader(java.io.File polygonFile)
          Creates a new instance.
PolygonFileReader(java.io.InputStream polygonFile, java.lang.String name)
          Creates a new instance.
 
Method Summary
 java.lang.String getPolygonName()
          This method must only be called after loadPolygon().
 java.awt.geom.Area loadPolygon()
          Builds an Area configured with the polygon information defined in the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonFileReader

public PolygonFileReader(java.io.InputStream polygonFile,
                         java.lang.String name)
Creates a new instance.

Parameters:
polygonFile - The file to read polygon units from.
name - to report in debug output

PolygonFileReader

public PolygonFileReader(java.io.File polygonFile)
Creates a new instance.

Parameters:
polygonFile - The file to read polygon units from.
Method Detail

loadPolygon

public java.awt.geom.Area loadPolygon()
Builds an Area configured with the polygon information defined in the file.

Returns:
A fully configured area.

getPolygonName

public java.lang.String getPolygonName()
This method must only be called after loadPolygon().

Returns:
The name of the polygon as stated in the file-header.