ilog.views.maps.format.tiger
Class IlvTigerReader

java.lang.Object
  extended by ilog.views.maps.format.tiger.IlvTigerReader
All Implemented Interfaces:
IlvPersistentObject, IlvMapFeatureIterator, IlvMapReusableFeatureIterator, IlvMapRegionOfInterestIterator

public class IlvTigerReader
extends Object
implements IlvMapRegionOfInterestIterator, IlvPersistentObject

Reader of TIGER/Line files. This reader can be used independently, but usually is created through the use of a IlvTigerDataSource.

Since:
JViews 7.5

Constructor Summary
IlvTigerReader(IlvInputStream stream)
          Reconstructs a tiger reader from parameters read on an input stream.
IlvTigerReader(String fileName)
          Creates a new IlvTigerReader object.
IlvTigerReader(URL url)
          Creates a new IlvTigerReader object.
 
Method Summary
 IlvTigerReader deriveReader(IlvTigerFeatureClass fClass, Class restrictTo)
          Creates a derived reader that will only return features with the selected feature class and geometry class
 void dispose()
          Releases the resources allocated by the feature iterator (files, connections, and so on).
 IlvCoordinateSystem getCoordinateSystem()
          Returns the NAD83 coordinate system.
 IlvFeatureRenderer getDefaultFeatureRenderer()
          Returns a renderer that can be used to translate the map features returned by this iterator into graphic objects.
protected  String getFileName()
          Returns the fileName if this reader has been created using a
 Rectangle2D getLatLonBounds()
          Returns the latitude/longitude bounds for the list of geometries contained in the Tiger files.
 IlvCoordinate getLowerRightCorner()
          Returns the lower right corner of the rectangle containing all the map feature of the list, or null if the iterator cannot provide this information.
 IlvMapFeature getNextFeature()
          Returns the next map feature of the iterator or null if the iteration is finished.
 IlvCoordinate getUpperLeftCorner()
          Returns the upper left corner of the rectangle containing all the map features of the list, or null if the iterator cannot provide this information.
protected  URL getURL()
          Returns the URL if this reader has been created using an URL.
 boolean isGeoreferenced()
          Returns true.
 boolean recordMatches(IlvFeatureAttributeProperty properties)
          Checks if the properties passed match the feature class filter.
 void restart()
          Rewinds the iterator for a new use.
 void setFeatureClassFilter(IlvTigerFeatureClass featureClass)
          Gives a filter class used to ignore some of the tiger features.
 void setRegionOfInterest(double minX, double minY, double maxX, double maxY)
          Sets the region of interest to return features for.
 void write(IlvOutputStream stream)
          Writes the attributes of a persistent object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvTigerReader

public IlvTigerReader(String fileName)
Creates a new IlvTigerReader object. TIGER/Line data is organized in "*.RTn" files, where n is a number indicating the file content. All those files must be present and decompressed in the same place as the parameter file.

Parameters:
fileName - Any of the TIGER/Line file names.

IlvTigerReader

public IlvTigerReader(URL url)
               throws IOException
Creates a new IlvTigerReader object.

Parameters:
url - URL towards any of the TIGER/Line files.
Throws:
IOException
Since:
JViews 7.5

IlvTigerReader

public IlvTigerReader(IlvInputStream stream)
Reconstructs a tiger reader from parameters read on an input stream.

Parameters:
stream - stream to read from.
Method Detail

getFileName

protected String getFileName()
Returns the fileName if this reader has been created using a

Returns:
Returns the fileName if this reader has been created using a file name.

getURL

protected URL getURL()
Returns the URL if this reader has been created using an URL.

Returns:
Returns the URL if this reader has been created using an URL.
Since:
JViews 7.5

setFeatureClassFilter

public void setFeatureClassFilter(IlvTigerFeatureClass featureClass)
Gives a filter class used to ignore some of the tiger features. This method also resets the RT1 reader to the beginning of the file.

Parameters:
featureClass - The featureClass to set as filter.

deriveReader

public IlvTigerReader deriveReader(IlvTigerFeatureClass fClass,
                                   Class restrictTo)
Creates a derived reader that will only return features with the selected feature class and geometry class

Parameters:
fClass - feature class to filter features with.
restrictTo - subclass of IlvMapGeometry to prevent mixing different types of features on the same layer.
Returns:
a new reader, based on the geometries of this reader.

recordMatches

public boolean recordMatches(IlvFeatureAttributeProperty properties)
Checks if the properties passed match the feature class filter.

Parameters:
properties - Properties to search for the "CFCC" field.
Returns:
true If the properties match the feature class filter.

getNextFeature

public IlvMapFeature getNextFeature()
                             throws IOException
Returns the next map feature of the iterator or null if the iteration is finished. The returned map feature must be considered as volatile and can be modified by the reader during the next call to its getNextFeature function.

Specified by:
getNextFeature in interface IlvMapFeatureIterator
Throws:
IOException
See Also:
IlvMapFeatureIterator.getNextFeature(), recordMatches(IlvFeatureAttributeProperty)

isGeoreferenced

public boolean isGeoreferenced()
Returns true.

Specified by:
isGeoreferenced in interface IlvMapFeatureIterator
See Also:
IlvMapFeatureIterator.isGeoreferenced()

getCoordinateSystem

public IlvCoordinateSystem getCoordinateSystem()
Returns the NAD83 coordinate system.

Specified by:
getCoordinateSystem in interface IlvMapFeatureIterator
Returns:
The coordinate system, or null if the coordinate system is unknown.
See Also:
IlvMapFeatureIterator.getCoordinateSystem()

getUpperLeftCorner

public IlvCoordinate getUpperLeftCorner()
Returns the upper left corner of the rectangle containing all the map features of the list, or null if the iterator cannot provide this information.

Specified by:
getUpperLeftCorner in interface IlvMapFeatureIterator
See Also:
IlvMapFeatureIterator.getUpperLeftCorner()

getLowerRightCorner

public IlvCoordinate getLowerRightCorner()
Returns the lower right corner of the rectangle containing all the map feature of the list, or null if the iterator cannot provide this information.

Specified by:
getLowerRightCorner in interface IlvMapFeatureIterator
See Also:
IlvMapFeatureIterator.getLowerRightCorner()

getDefaultFeatureRenderer

public IlvFeatureRenderer getDefaultFeatureRenderer()
Returns a renderer that can be used to translate the map features returned by this iterator into graphic objects. Feature iterators that store some rendering information in the attributes of the map features, such as color, text font, line thickness and so on, can return a specific renderer which is able to take these attributes into account during the rendering process.

Specified by:
getDefaultFeatureRenderer in interface IlvMapFeatureIterator
See Also:
IlvMapFeatureIterator.getDefaultFeatureRenderer()

dispose

public void dispose()
Releases the resources allocated by the feature iterator (files, connections, and so on).

Specified by:
dispose in interface IlvMapFeatureIterator
See Also:
IlvMapFeatureIterator.dispose()

restart

public void restart()
Rewinds the iterator for a new use.

Specified by:
restart in interface IlvMapReusableFeatureIterator
See Also:
IlvMapReusableFeatureIterator.restart()

setRegionOfInterest

public void setRegionOfInterest(double minX,
                                double minY,
                                double maxX,
                                double maxY)
Sets the region of interest to return features for. After this method is called, the IlvMapFeatureIterator.getNextFeature() method should not return any feature which geometry is outside this area.

Specified by:
setRegionOfInterest in interface IlvMapRegionOfInterestIterator
Parameters:
minX - longitude min in radians.
minY - latitude min in radians.
maxX - longitude max in radians.
maxY - latitude max in radians.
See Also:
IlvMapRegionOfInterestIterator.setRegionOfInterest(double, double, double, double)

getLatLonBounds

public Rectangle2D getLatLonBounds()
Returns the latitude/longitude bounds for the list of geometries contained in the Tiger files.

Specified by:
getLatLonBounds in interface IlvMapRegionOfInterestIterator
Returns:
a rectangle enclosing all selected tiger/line features.

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the attributes of a persistent object.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - the output stream
Throws:
IOException - thrown when an exception occurs during the write operation for this object.
See Also:
IlvPersistentObject.write(ilog.views.io.IlvOutputStream)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.