Package elki.result

Class KMLOutputHandler

  • All Implemented Interfaces:
    ResultHandler, ResultProcessor

    @Reference(authors="Erich Achtert, Ahmed Hettab, Hans-Peter Kriegel, Erich Schubert, Arthur Zimek",
               title="Spatial Outlier Detection: Data, Algorithms, Visualizations",
               booktitle="Proc. 12th Int. Symp. Spatial and Temporal Databases (SSTD 2011)",
               url="https://doi.org/10.1007/978-3-642-22922-0_41",
               bibkey="DBLP:conf/ssd/AchtertHKSZ11")
    public class KMLOutputHandler
    extends java.lang.Object
    implements ResultHandler
    Class to handle KML output.

    Reference:

    Erich Achtert, Ahmed Hettab, Hans-Peter Kriegel, Erich Schubert, Arthur Zimek
    Spatial Outlier Detection: Data, Algorithms, Visualizations
    Proc. 12th Int. Symp. Spatial and Temporal Databases (SSTD 2011)

    Note: This class - currently - is an ugly hack. This code needs to be modularized to make it more reusable, to support multiple results and different result types.

    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • LOG

        private static final Logging LOG
        Logger class to use.
      • NUMSTYLES

        private static final int NUMSTYLES
        Number of styles to use (lower reduces rendering complexity a bit)
        See Also:
        Constant Field Values
      • filename

        java.nio.file.Path filename
        Output file name
      • compat

        private boolean compat
        Compatibility mode.
      • autoopen

        private boolean autoopen
        Automatically open at the end
    • Constructor Detail

      • KMLOutputHandler

        public KMLOutputHandler​(java.nio.file.Path filename,
                                OutlierScaling scaling,
                                boolean compat,
                                boolean autoopen)
        Constructor.
        Parameters:
        filename - Output filename
        scaling - Scaling function
        compat - Compatibility mode
        autoopen - Automatically open
    • Method Detail

      • processNewResult

        public void processNewResult​(java.lang.Object newResult)
        Description copied from interface: ResultProcessor
        Process a result.
        Specified by:
        processNewResult in interface ResultProcessor
        Parameters:
        newResult - Newly added result subtree.
      • writeOutlierResult

        private void writeOutlierResult​(javax.xml.stream.XMLStreamWriter xmlw,
                                        OutlierResult outlierResult,
                                        Database database)
                                 throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • writeClusteringResult

        private void writeClusteringResult​(javax.xml.stream.XMLStreamWriter xmlw,
                                           Clustering<Model> clustering,
                                           Database database)
                                    throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • makeDescription

        private java.lang.StringBuilder makeDescription​(java.util.Collection<Relation<?>> relations,
                                                        DBIDRef id)
        Make an HTML description.
        Parameters:
        relations - Relations
        id - Object ID
        Returns:
        Buffer
      • makeDescription

        private java.lang.StringBuilder makeDescription​(Cluster<?> c)
        Make an HTML description.
        Parameters:
        c - Cluster
        Returns:
        Buffer
      • writeNewlineOnDebug

        private void writeNewlineOnDebug​(javax.xml.stream.XMLStreamWriter out)
                                  throws javax.xml.stream.XMLStreamException
        Print a newline when debugging.
        Parameters:
        out - Output XML stream
        Throws:
        javax.xml.stream.XMLStreamException
      • getColorForValue

        public static final java.awt.Color getColorForValue​(double val)
        Get color from a simple heatmap.
        Parameters:
        val - Score value
        Returns:
        Color in heatmap