Package adams.data.conversion.mapobject
Class AbstractMapObjectGenerator<T extends org.openstreetmap.gui.jmapviewer.interfaces.MapObject>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.conversion.mapobject.AbstractMapObjectGenerator<T>
-
- Type Parameters:
T
- the type ofMapObject
to generate
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractMapMarkerGenerator
,AbstractMapPolygonGenerator
,AbstractMapRectangleGenerator
public abstract class AbstractMapObjectGenerator<T extends org.openstreetmap.gui.jmapviewer.interfaces.MapObject> extends adams.core.option.AbstractOptionHandler implements adams.core.QuickInfoSupporter
Ancestor for generators ofMapObject
s.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.data.spreadsheet.SpreadSheetColumnRange
m_AdditionalAttributes
the additional attributes to store in the mapobject.protected int[]
m_AdditionalAttributesIndices
the actual indices of the additional attributes to store in the mapobject.protected String
m_Layer
the name of the layer.protected adams.data.spreadsheet.SpreadSheetColumnIndex
m_Timestamp
the index of the column with the timestamp information (optional).protected int
m_TimestampIndex
the actual index of the timestamp column.
-
Constructor Summary
Constructors Constructor Description AbstractMapObjectGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
additionalAttributesTipText()
Returns the tip text for this property.protected void
addMetaData(adams.data.spreadsheet.Row row, MetaDataSupporter mapobject)
Transfers the meta-data from the row to the map-object.protected void
addTimestamp(adams.data.spreadsheet.Row row, TimestampSupporter mapobject)
Transfers the timestamp from the row to the map-object.protected void
check(adams.data.spreadsheet.SpreadSheet sheet)
Checks the spreadsheet and throws an exception if it fails.void
defineOptions()
Adds options to the internal list of options.protected abstract T[]
doGenerate(adams.data.spreadsheet.SpreadSheet sheet)
Performs the actual generation of the objects.T[]
generate(adams.data.spreadsheet.SpreadSheet sheet)
Generates map objects from the given spreadsheet.abstract Class
generates()
Returns the type of data the generator creates.adams.data.spreadsheet.SpreadSheetColumnRange
getAdditionalAttributes()
Returns the range of columns of additional attributes to add to the map object.protected String
getDefaultLayer()
Returns the default name for the feature type.String
getLayer()
Returns the name of the layer.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.adams.data.spreadsheet.SpreadSheetColumnIndex
getTimestamp()
Returns the column containing the timestamp for the mapobject.protected void
init(adams.data.spreadsheet.SpreadSheet sheet)
Initializes the internal state with the given spreadsheet.protected void
initialize()
Initializes the members.String
layerTipText()
Returns the tip text for this property.protected void
postProcess(adams.data.spreadsheet.Row row, org.openstreetmap.gui.jmapviewer.interfaces.MapObject mapobject)
Post-processes the mapobject.void
setAdditionalAttributes(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns of additional attributes to add to the map object.void
setLayer(String value)
Sets the name of the layer.void
setTimestamp(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column containing the timestamp for the mapobject.AbstractMapObjectGenerator
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractMapObjectGenerator
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.String
timestampTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Layer
protected String m_Layer
the name of the layer.
-
m_Timestamp
protected adams.data.spreadsheet.SpreadSheetColumnIndex m_Timestamp
the index of the column with the timestamp information (optional).
-
m_TimestampIndex
protected int m_TimestampIndex
the actual index of the timestamp column.
-
m_AdditionalAttributes
protected adams.data.spreadsheet.SpreadSheetColumnRange m_AdditionalAttributes
the additional attributes to store in the mapobject.
-
m_AdditionalAttributesIndices
protected int[] m_AdditionalAttributesIndices
the actual indices of the additional attributes to store in the mapobject.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classadams.core.option.AbstractOptionHandler
-
getDefaultLayer
protected String getDefaultLayer()
Returns the default name for the feature type.- Returns:
- the name of the feature type to generate
-
setLayer
public void setLayer(String value)
Sets the name of the layer.- Parameters:
value
- the name
-
getLayer
public String getLayer()
Returns the name of the layer.- Returns:
- the name
-
layerTipText
public String layerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTimestamp
public void setTimestamp(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column containing the timestamp for the mapobject.- Parameters:
value
- the column
-
getTimestamp
public adams.data.spreadsheet.SpreadSheetColumnIndex getTimestamp()
Returns the column containing the timestamp for the mapobject.- Returns:
- the column
-
timestampTipText
public String timestampTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAdditionalAttributes
public void setAdditionalAttributes(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns of additional attributes to add to the map object.- Parameters:
value
- the additional columns
-
getAdditionalAttributes
public adams.data.spreadsheet.SpreadSheetColumnRange getAdditionalAttributes()
Returns the range of columns of additional attributes to add to the map object.- Returns:
- the additional columns
-
additionalAttributesTipText
public String additionalAttributesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
generates
public abstract Class generates()
Returns the type of data the generator creates.- Returns:
- the data type
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
check
protected void check(adams.data.spreadsheet.SpreadSheet sheet)
Checks the spreadsheet and throws an exception if it fails.
Default implementation only ensures that data is present.- Parameters:
sheet
- the spreadsheet to check
-
init
protected void init(adams.data.spreadsheet.SpreadSheet sheet)
Initializes the internal state with the given spreadsheet.- Parameters:
sheet
- the spreadsheet to initialize with
-
addTimestamp
protected void addTimestamp(adams.data.spreadsheet.Row row, TimestampSupporter mapobject)
Transfers the timestamp from the row to the map-object.- Parameters:
row
- the row to get the timestamp frommapobject
- the object to update
-
addMetaData
protected void addMetaData(adams.data.spreadsheet.Row row, MetaDataSupporter mapobject)
Transfers the meta-data from the row to the map-object.- Parameters:
row
- the row to get the meta-data frommapobject
- the object to update
-
postProcess
protected void postProcess(adams.data.spreadsheet.Row row, org.openstreetmap.gui.jmapviewer.interfaces.MapObject mapobject)
Post-processes the mapobject.- Parameters:
row
- the row to get the data frommapobject
- the object to post-process
-
doGenerate
protected abstract T[] doGenerate(adams.data.spreadsheet.SpreadSheet sheet)
Performs the actual generation of the objects.- Parameters:
sheet
- the spreadsheet to use- Returns:
- the generated objects
-
generate
public T[] generate(adams.data.spreadsheet.SpreadSheet sheet)
Generates map objects from the given spreadsheet.- Parameters:
sheet
- the spreadsheet to process- Returns:
- the generated map objects
-
shallowCopy
public AbstractMapObjectGenerator shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Returns:
- the shallow copy
-
shallowCopy
public AbstractMapObjectGenerator shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
-