Package geomss.geom.reader
Class AbstractGeomReader
- java.lang.Object
-
- geomss.geom.reader.AbstractGeomReader
-
- All Implemented Interfaces:
GeomReader
,java.lang.Comparable
- Direct Known Subclasses:
BDSGeomReader
,CARDGeomReader
,GGPGeomReader
,GTCGeomReader
,IGESGeomReader
,LaWGSGeomReader
,POIGeomReader
,STLGeomReader
,TecplotGeomReader
,TRIGeomReader
,VECCGeomReader
,XGSSGeomReader
public abstract class AbstractGeomReader extends java.lang.Object implements GeomReader
A partial implementation of theGeomReader
interface. Some methods have default implementations that sub-classes should override as needed.Modified by: Joseph A. Huwaldt
- Version:
- November 28, 2015
- Author:
- Joseph A. Huwaldt, Date: August 26, 2010
-
-
Field Summary
-
Fields inherited from interface geomss.geom.reader.GeomReader
MAYBE, NO, YES
-
-
Constructor Summary
Constructors Constructor Description AbstractGeomReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
canReadData(java.io.File inputFile)
Method that determines if this reader can read geometry from the specified input file.boolean
canWriteData()
Returnstrue
if this class can write at least some data in the format supported by this class.int
compareTo(java.lang.Object o)
Compares this object with the specified object for order based on thetoString().compareTo(o.toString())
method.java.util.List<java.lang.String>
getWarnings()
Return a list of any warning messages that the reader/writer may have issued.GeometryList
read(java.io.File inputFile)
Reads in a geometry file from the supplied input file and returns aGeometryList
object that contains the geometry from the file.void
setFileUnits(javax.measure.unit.Unit<javax.measure.quantity.Length> units)
Sets the units used for the geometry as stored in a non-unit aware geometry file being read in.void
write(java.io.File outputFile, GeometryList geometry)
Writes out a geometry file for the geometry contained in the suppliedGeometryList
object.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface geomss.geom.reader.GeomReader
getExtension, isUnitAware
-
-
-
-
Constructor Detail
-
AbstractGeomReader
public AbstractGeomReader()
-
-
Method Detail
-
compareTo
public int compareTo(java.lang.Object o)
Compares this object with the specified object for order based on thetoString().compareTo(o.toString())
method. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.- Specified by:
compareTo
in interfacejava.lang.Comparable
-
canReadData
public int canReadData(java.io.File inputFile) throws java.io.IOException
Method that determines if this reader can read geometry from the specified input file. This implementation always returns NO.- Specified by:
canReadData
in interfaceGeomReader
- Parameters:
inputFile
- The input file containing the geometry to be read in.- Returns:
- GeomReader.YES if this class can definitely read the file, GeomReader.MAYBE if the file could possibly be read and GeomReader.NO if the file can definitely not be read by this class.
- Throws:
java.io.IOException
- Could be thrown by sub-classes and indicates that the file can not be read by this reader.
-
canWriteData
public boolean canWriteData()
Returnstrue
if this class can write at least some data in the format supported by this class. Returnsfalse
if it can not.This default implementation always returns false.
- Specified by:
canWriteData
in interfaceGeomReader
- Returns:
- true if this class can write at least some data in the format supported by this class.
-
read
public GeometryList read(java.io.File inputFile) throws java.io.IOException
Reads in a geometry file from the supplied input file and returns aGeometryList
object that contains the geometry from the file.WARNING! This method must be implemented by sub-classes and this implementation will throw an exception if you try and use it.
- Specified by:
read
in interfaceGeomReader
- Parameters:
inputFile
- The input file containing the geometry to be read in.- Returns:
- A
GeometryList
object containing the geometry read in from the file. - Throws:
java.io.IOException
- If there is a problem reading the specified file.- See Also:
setFileUnits(javax.measure.unit.Unit)
-
getWarnings
public java.util.List<java.lang.String> getWarnings()
Return a list of any warning messages that the reader/writer may have issued.- Specified by:
getWarnings
in interfaceGeomReader
- Returns:
- A list of any warning messages that the reader/writer may have issued.
-
write
public void write(java.io.File outputFile, GeometryList geometry) throws java.io.IOException
Writes out a geometry file for the geometry contained in the suppliedGeometryList
object.WARNING! This method must be implemented by sub-classes and this implementation will throw an exception if you try and use it.
- Specified by:
write
in interfaceGeomReader
- Parameters:
outputFile
- The output File to which the geometry is to be written.geometry
- TheGeometryList
object containing the geometry to be written out.- Throws:
java.io.IOException
- If there is a problem writing to the specified file.
-
setFileUnits
public void setFileUnits(javax.measure.unit.Unit<javax.measure.quantity.Length> units)
Sets the units used for the geometry as stored in a non-unit aware geometry file being read in. The geometry is returned in these units for file types which are not unit aware. If the file format specifies units, the input from this method will be ignored. If this method is not called before reading a non-unit aware geometry file, then the units of the returned geometry will be the system default units. When writing out geometry, this is ignored.- Specified by:
setFileUnits
in interfaceGeomReader
- Parameters:
units
- The units used for the geometry in the file being read in. If null is passed, the units will default to the default system units.- See Also:
GeomReader.isUnitAware()
-
-