Package elki.result
Class KMLOutputHandler
- java.lang.Object
-
- elki.result.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KMLOutputHandler.Par
Parameterization class
-
Field Summary
Fields Modifier and Type Field Description private boolean
autoopen
Automatically open at the endprivate boolean
compat
Compatibility mode.(package private) java.nio.file.Path
filename
Output file nameprivate static Logging
LOG
Logger class to use.private static int
NUMSTYLES
Number of styles to use (lower reduces rendering complexity a bit)(package private) OutlierScaling
scaling
Scaling function
-
Constructor Summary
Constructors Constructor Description KMLOutputHandler(java.nio.file.Path filename, OutlierScaling scaling, boolean compat, boolean autoopen)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private DoubleObjPair<Polygon>
buildHullsRecursively(Cluster<Model> clu, Hierarchy<Cluster<Model>> hier, java.util.Map<java.lang.Object,DoubleObjPair<Polygon>> hulls, Relation<? extends NumberVector> coords)
Recursively step through the clusters to build the hulls.static java.awt.Color
getColorForValue(double val)
Get color from a simple heatmap.private java.lang.StringBuilder
makeDescription(Cluster<?> c)
Make an HTML description.private java.lang.StringBuilder
makeDescription(java.util.Collection<Relation<?>> relations, DBIDRef id)
Make an HTML description.void
processNewResult(java.lang.Object newResult)
Process a result.private void
writeClusteringResult(javax.xml.stream.XMLStreamWriter xmlw, Clustering<Model> clustering, Database database)
private void
writeNewlineOnDebug(javax.xml.stream.XMLStreamWriter out)
Print a newline when debugging.private void
writeOutlierResult(javax.xml.stream.XMLStreamWriter xmlw, OutlierResult outlierResult, Database database)
-
-
-
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
-
scaling
OutlierScaling scaling
Scaling function
-
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 filenamescaling
- Scaling functioncompat
- Compatibility modeautoopen
- Automatically open
-
-
Method Detail
-
processNewResult
public void processNewResult(java.lang.Object newResult)
Description copied from interface:ResultProcessor
Process a result.- Specified by:
processNewResult
in interfaceResultProcessor
- 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
-
buildHullsRecursively
private DoubleObjPair<Polygon> buildHullsRecursively(Cluster<Model> clu, Hierarchy<Cluster<Model>> hier, java.util.Map<java.lang.Object,DoubleObjPair<Polygon>> hulls, Relation<? extends NumberVector> coords)
Recursively step through the clusters to build the hulls.- Parameters:
clu
- Current clusterhier
- Clustering hierarchyhulls
- Hull map
-
makeDescription
private java.lang.StringBuilder makeDescription(java.util.Collection<Relation<?>> relations, DBIDRef id)
Make an HTML description.- Parameters:
relations
- Relationsid
- 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
-
-