Class AbstractReportMapObjectGenerator<T extends org.openstreetmap.gui.jmapviewer.interfaces.MapObject>

  • Type Parameters:
    T - the type of MapObject 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:
    AbstractReportMapMarkerGenerator, AbstractReportMapPolygonGenerator, AbstractReportMapRectangleGenerator

    public abstract class AbstractReportMapObjectGenerator<T extends org.openstreetmap.gui.jmapviewer.interfaces.MapObject>
    extends adams.core.option.AbstractOptionHandler
    implements adams.core.QuickInfoSupporter
    Ancestor for generators of MapObjects.
    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.report.Field[] m_AdditionalAttributes
      the additional fields to store in the mapobject.
      protected adams.core.DateFormat m_DateFormat
      for parsing dates.
      protected adams.core.DateFormat m_DateTimeFormat
      for parsing date/times.
      protected String m_Layer
      the name of the layer.
      protected adams.data.report.Field m_Timestamp
      the field with the timestamp information (optional).
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • 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.report.Report report, MetaDataSupporter mapobject)
      Transfers the meta-data from the report to the map-object.
      protected void addTimestamp​(adams.data.report.Report report, TimestampSupporter mapobject)
      Transfers the timestamp from the report to the map-object.
      protected void check​(adams.data.report.Report report)
      Checks the report and throws an exception if it fails.
      void defineOptions()
      Adds options to the internal list of options.
      protected abstract T doGenerate​(adams.data.report.Report report)
      Performs the actual generation of the objects.
      T generate​(adams.data.report.Report report)
      Generates map objects from the given report.
      abstract Class generates()
      Returns the type of data the generator creates.
      adams.data.report.Field[] getAdditionalAttributes()
      Returns the additional fields 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.
      protected double getNumericValue​(adams.data.report.Report report, adams.data.report.Field field)
      Returns the given value from the report.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      adams.data.report.Field getTimestamp()
      Returns the field the timestamp for the mapobject.
      protected void initialize()
      Initializes the members.
      String layerTipText()
      Returns the tip text for this property.
      protected void postProcess​(adams.data.report.Report report, org.openstreetmap.gui.jmapviewer.interfaces.MapObject mapobject)
      Post-processes the mapobject.
      void setAdditionalAttributes​(adams.data.report.Field[] value)
      Sets the additional fields to add to the map object.
      void setLayer​(String value)
      Sets the name of the layer.
      void setTimestamp​(adams.data.report.Field value)
      Sets the field 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
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_Layer

        protected String m_Layer
        the name of the layer.
      • m_Timestamp

        protected adams.data.report.Field m_Timestamp
        the field with the timestamp information (optional).
      • m_AdditionalAttributes

        protected adams.data.report.Field[] m_AdditionalAttributes
        the additional fields to store in the mapobject.
      • m_DateFormat

        protected adams.core.DateFormat m_DateFormat
        for parsing dates.
      • m_DateTimeFormat

        protected adams.core.DateFormat m_DateTimeFormat
        for parsing date/times.
    • Constructor Detail

      • AbstractReportMapObjectGenerator

        public AbstractReportMapObjectGenerator()
    • Method Detail

      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.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.report.Field value)
        Sets the field the timestamp for the mapobject.
        Parameters:
        value - the field
      • getTimestamp

        public adams.data.report.Field getTimestamp()
        Returns the field the timestamp for the mapobject.
        Returns:
        the field
      • 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.report.Field[] value)
        Sets the additional fields to add to the map object.
        Parameters:
        value - the additional fields
      • getAdditionalAttributes

        public adams.data.report.Field[] getAdditionalAttributes()
        Returns the additional fields to add to the map object.
        Returns:
        the additional fields
      • 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 interface adams.core.QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • check

        protected void check​(adams.data.report.Report report)
        Checks the report and throws an exception if it fails.

        Default implementation only ensures that data is present.
        Parameters:
        sheet - the spreadsheet to check
      • getNumericValue

        protected double getNumericValue​(adams.data.report.Report report,
                                         adams.data.report.Field field)
        Returns the given value from the report. Attempts to convert string values if encountered.
        Parameters:
        report - the report to obtain the value from
        field - the field to obtain
        Returns:
        the numeric value, NaN if not available or failed to convert
      • addTimestamp

        protected void addTimestamp​(adams.data.report.Report report,
                                    TimestampSupporter mapobject)
        Transfers the timestamp from the report to the map-object.
        Parameters:
        report - the report to use
        mapobject - the object to update
      • addMetaData

        protected void addMetaData​(adams.data.report.Report report,
                                   MetaDataSupporter mapobject)
        Transfers the meta-data from the report to the map-object.
        Parameters:
        report - the report to use
        mapobject - the object to update
      • postProcess

        protected void postProcess​(adams.data.report.Report report,
                                   org.openstreetmap.gui.jmapviewer.interfaces.MapObject mapobject)
        Post-processes the mapobject.
        Parameters:
        report - the report to use
        mapobject - the object to post-process
      • doGenerate

        protected abstract T doGenerate​(adams.data.report.Report report)
        Performs the actual generation of the objects.
        Parameters:
        report - the report to use
        Returns:
        the generated objects
      • generate

        public T generate​(adams.data.report.Report report)
        Generates map objects from the given report.
        Parameters:
        report - the report to use
        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