use of org.knime.base.node.viz.plotter.dendrogram.DendrogramNode in project knime-core by knime.
the class HierarchicalClusterNodeView method modelChanged.
/**
* {@inheritDoc}
*/
@Override
public void modelChanged() {
if (getNodeModel() == null || ((DataProvider) getNodeModel()).getDataArray(0) == null || ((DataProvider) getNodeModel()).getDataArray(0).size() == 0) {
return;
}
NodeModel model = getNodeModel();
m_dendroPlotter.reset();
m_distancePlotter.reset();
m_dendroPlotter.setHiLiteHandler(model.getInHiLiteHandler(0));
m_dendroPlotter.setAntialiasing(false);
m_dendroPlotter.setDataProvider((DataProvider) model);
m_distancePlotter.setDataProvider((DataProvider) model);
m_distancePlotter.setHiLiteHandler(model.getInHiLiteHandler(0));
DendrogramNode rootNode = getNodeModel().getRootNode();
DataArray distanceTable = ((DataProvider) getNodeModel()).getDataArray(0);
m_dendroPlotter.setRootNode(rootNode);
m_distancePlotter.createXCoordinate(((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(0).getDomain().getLowerBound()).getDoubleValue(), ((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(0).getDomain().getUpperBound()).getDoubleValue());
m_distancePlotter.createYCoordinate(((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(1).getDomain().getLowerBound()).getDoubleValue(), ((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(1).getDomain().getUpperBound()).getDoubleValue());
((BasicDrawingPane) m_distancePlotter.getDrawingPane()).clearPlot();
m_distancePlotter.addLine(distanceTable, 0, 1, Color.BLACK, new BasicStroke(m_thickness));
// m_distancePlotter.getXAxis().getCoordinate().setPolicy(
// DescendingNumericTickPolicyStrategy.getInstance());
m_distancePlotter.updatePaintModel();
m_dendroPlotter.updatePaintModel();
}
use of org.knime.base.node.viz.plotter.dendrogram.DendrogramNode in project knime-core by knime.
the class ClusterNode method getDataRows.
/**
* Puts all data rows of a node in a vector if the node is a leaf. Otherwise
* the method is invoked with the nodes child nodes. This is a recursive
* tree traversing method.
*
* @param clusterNode the node to get the data rows from.
* @param rowVector the vector to store the found data rows in.
*/
private void getDataRows(final DendrogramNode clusterNode, final List<DataRow> rowVector) {
// rekursives auslesen aller data rows
DendrogramNode subNode1 = clusterNode.getFirstSubnode();
DendrogramNode subNode2 = clusterNode.getSecondSubnode();
if (subNode1.isLeaf()) {
rowVector.add(subNode1.getLeafDataPoint());
} else {
getDataRows(subNode1, rowVector);
}
if (subNode2.isLeaf()) {
rowVector.add(subNode2.getLeafDataPoint());
} else {
getDataRows(subNode2, rowVector);
}
}
Aggregations