Class MatsimWriter<T>

    • Field Detail

      • TRANSIT_SCHEDULE_DOCTYPE

        public static final String TRANSIT_SCHEDULE_DOCTYPE
        the doc type of MATSIM public transport schedule.
        See Also:
        Constant Field Values
      • NETWORK_DOCTYPE

        public static final String NETWORK_DOCTYPE
        the doc type of MATSIM public transport schedule.
        See Also:
        Constant Field Values
      • DEFAULT_FILE_NAME_EXTENSION

        public static final String DEFAULT_FILE_NAME_EXTENSION
        default extension for xml files generated
        See Also:
        Constant Field Values
    • Constructor Detail

      • MatsimWriter

        protected MatsimWriter​(IdMapperType idMapperType)
        Constructor
        Parameters:
        idMapperType - to use
    • Method Detail

      • validateNetwork

        protected boolean validateNetwork​(LayeredNetwork<?,​?> referenceNetwork)
                                   throws PlanItException
        Validate the network instance available, throw or log when issues are found
        Parameters:
        referenceNetwork - to use for persisting
        Returns:
        true when valid, false otherwise
        Throws:
        PlanItException - thrown if invalid
      • extractDestinationCrsCompatibleCoordinate

        protected org.locationtech.jts.geom.Coordinate extractDestinationCrsCompatibleCoordinate​(org.locationtech.jts.geom.Point location)
        Using the destination crs and its transformer extract the coordinate from the position in the desired crs
        Parameters:
        location - to extract destination crs compatible coordinate for
        Returns:
        coordinate created
      • increaseIndentation

        protected int increaseIndentation()
        Increase indentation level
        Returns:
        updated indentation level
      • decreaseIndentation

        protected int decreaseIndentation()
        Decrease indentation level
        Returns:
        updated indentation level
      • writeStartElement

        protected void writeStartElement​(XMLStreamWriter xmlWriter,
                                         String xmlElementName,
                                         boolean increaseIndentation)
                                  throws XMLStreamException
        write a start element and add newline afterwards
        Parameters:
        xmlWriter - to use
        xmlElementName - element to start tag, e.g. <xmlElementName>
        increaseIndentation - when true, increase indentation after this element has been written
        Throws:
        XMLStreamException - thrown if error
      • writeStartElementNewLine

        protected void writeStartElementNewLine​(XMLStreamWriter xmlWriter,
                                                String xmlElementName,
                                                boolean increaseIndentation)
                                         throws XMLStreamException
        write a start element and add newline afterwards
        Parameters:
        xmlWriter - to use
        xmlElementName - element to start tag, e.g. <xmlElementName>
        increaseIndentation - when true, increase indentation after this element has been written
        Throws:
        XMLStreamException - thrown if error
      • writeEndElementNewLine

        protected void writeEndElementNewLine​(XMLStreamWriter xmlWriter,
                                              boolean decreaseIndentation)
                                       throws XMLStreamException
        write an end element and add newline afterwards
        Parameters:
        xmlWriter - to use
        decreaseIndentation - when true decrease indentation level before this element has been written
        Throws:
        XMLStreamException - thrown if error
      • getSettings

        public abstract PlanitMatsimWriterSettings getSettings()
        any settings to configure the writer can be configured by collecting these settings
        Returns:
        the settings to configure the writer