org.openstreetmap.osmosis.core.filter.v0_6
Class DatasetBoundingBoxFilter

java.lang.Object
  extended by org.openstreetmap.osmosis.core.filter.v0_6.DatasetBoundingBoxFilter
All Implemented Interfaces:
Releasable, Task, DatasetSink, DatasetSinkSource, Source

public class DatasetBoundingBoxFilter
extends java.lang.Object
implements DatasetSinkSource

Provides a filter utilising a dataset to extract all entities that lie within a specific geographical box identified by latitude and longitude coordinates.

Author:
Brett Henderson

Constructor Summary
DatasetBoundingBoxFilter(double left, double right, double top, double bottom, boolean completeWays)
          Creates a new instance with the specified geographical coordinates.
 
Method Summary
 void process(Dataset dataset)
          Process the dataset.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 void setSink(Sink sink)
          Sets the osm sink to send data to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatasetBoundingBoxFilter

public DatasetBoundingBoxFilter(double left,
                                double right,
                                double top,
                                double bottom,
                                boolean completeWays)
Creates a new instance with the specified geographical coordinates. When filtering, nodes right on the left and bottom edges of the box will be included, nodes on the top and right edges will be excluded.

Parameters:
left - The longitude marking the left edge of the bounding box.
right - The longitude marking the right edge of the bounding box.
top - The latitude marking the top edge of the bounding box.
bottom - The latitude marking the bottom edge of the bounding box.
completeWays - Include all nodes for ways which have some portion inside the filtered area.
Method Detail

setSink

public void setSink(Sink sink)
Sets the osm sink to send data to.

Specified by:
setSink in interface Source
Parameters:
sink - The sink for receiving all produced data.

process

public void process(Dataset dataset)
Process the dataset. This must only be called once. This will perform all finalisation tasks such as database commits as necessary to complete the task.

Specified by:
process in interface DatasetSink
Parameters:
dataset - The dataset to be processed.

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable