@Override public void setDataDomain(ATableBasedDataDomain dataDomain) { this.dataDomain = dataDomain; // Tree<ClusterNode> tree = // dataDomain.getTable().getDimensionData(dimensionVAType) // .getDimensionTree(); // // Tree<ClusterNode> tree = table.getClusteredTreeGenes(); // if (tree != null) { // ArrayList<EPDDrawingStrategyType> alColorModes = new // ArrayList<EPDDrawingStrategyType>(); // alColorModes.add(EPDDrawingStrategyType.EXPRESSION_COLOR); // alColorModes.add(EPDDrawingStrategyType.RAINBOW_COLOR); // // // initHierarchy(tree, EIDType.CLUSTER_NUMBER, // // new GeneClusterDataEventManager(this), alColorModes); // initHierarchy(tree, // dataDomain.getTable().getDimensionData(dimensionVAType) // .getDimensionTreeRoot(), new ExperimentClusterDataEventManager(this), // alColorModes); // } Tree<ClusterNode> tree = tablePerspective.getRecordPerspective().getTree(); // Tree<ClusterNode> tree = table.getClusteredTreeGenes(); if (tree != null) { ArrayList<EPDDrawingStrategyType> alColorModes = new ArrayList<EPDDrawingStrategyType>(); alColorModes.add(EPDDrawingStrategyType.EXPRESSION_COLOR); alColorModes.add(EPDDrawingStrategyType.RAINBOW_COLOR); // initHierarchy(tree, EIDType.CLUSTER_NUMBER, // new GeneClusterDataEventManager(this), alColorModes); initHierarchy(tree, tree.getRoot(), new GeneClusterDataEventManager(this), alColorModes); } // Tree<ClusterNode> tree = // dataDomain.getTable().getContentData(recordVAType) // .getContentTree(); // if (tree != null) { // // initHierarchy(tree); // } else { // // initTestHierarchy(); // // } // partialDiscTree.setLeafIDType(tree.getLeaveIDType()); // partialDiscTree.setNodeIDType(tree.getNodeIDType()); }
/** * Recursively builds the partial disc tree according to a hierarchy data tree. Note that the root * element of the partial disc tree has to be set separately. * * @param tree Tree of cluster nodes which is used to build the partial disc tree. * @param hierarchyElement Current parent hierarchy element whose children are used for the * creation of the children of partialDisc. Initially this variable should be the root element * of the hierarchy element tree. * @param partialDisc Current parent partial disc whose children will be created. Initially this * variable should be the root element of the partial disc tree. */ private <E extends AHierarchyElement<E>> void buildTree( Tree<E> tree, E hierarchyElement, PartialDisc partialDisc) { ArrayList<E> alChildNodes = tree.getChildren(hierarchyElement); ArrayList<PartialDisc> alChildDiscs = new ArrayList<PartialDisc>(); if (alChildNodes != null) { for (E heChild : alChildNodes) { PartialDisc pdCurrentChildDisc = new PartialDisc( partialDiscTree, heChild, drawingStrategyManager.getDefaultDrawingStrategy()); try { alChildDiscs.add(pdCurrentChildDisc); partialDiscTree.addChild(partialDisc, pdCurrentChildDisc); hashPartialDiscs.put(heChild.getID(), pdCurrentChildDisc); // selectionManager.initialAdd(heChild.getID()); buildTree(tree, heChild, pdCurrentChildDisc); } catch (Exception e) { e.printStackTrace(); } } } }
/** * Initializes a new hierarchy of partial discs according to a tree of cluster nodes and other * parameters. * * @param <E> Concrete Type of IHierarchyData * @param tree Tree of hierarchy data objects which is used to build the partial disc tree. * @param idType IDType of the hierarchy data objects. * @param dataEventManager Concrete DataEventManager that is responsible for handling and * triggering data specific events. * @param alColorModes List of drawing strategies that shall be used as color modes. */ public <E extends AHierarchyElement<E>> void initHierarchy( Tree<E> tree, E heRoot, ADataEventManager dataEventManager, ArrayList<EPDDrawingStrategyType> alColorModes) { hashPartialDiscs.clear(); selectionManager = new SelectionManager(tree.getNodeIDType()); partialDiscTree = new Tree<PartialDisc>(); navigationHistory.reset(); drawingController.setDrawingState(EDrawingStateType.DRAWING_STATE_FULL_HIERARCHY); LabelManager.get().clearLabels(); drawingStrategyManager.init(pickingManager, uniqueID, alColorModes); PartialDisc pdRoot = new PartialDisc( partialDiscTree, heRoot, drawingStrategyManager.getDefaultDrawingStrategy()); partialDiscTree.setRootNode(pdRoot); partialDiscTree.setLeafIDType(tree.getLeaveIDType()); partialDiscTree.setNodeIDType(tree.getNodeIDType()); hashPartialDiscs.put(heRoot.getID(), pdRoot); // selectionManager.initialAdd(heRoot.getID()); buildTree(tree, heRoot, pdRoot); pdRoot.calculateLargestChildren(); iMaxDisplayedHierarchyDepth = DISP_HIER_DEPTH_DEFAULT; this.dataEventManager = dataEventManager; this.dataEventManager.registerEventListeners(); pdCurrentRootElement = pdRoot; pdCurrentSelectedElement = pdRoot; pdRealRootElement = pdRoot; navigationHistory.addNewHistoryEntry( drawingController.getCurrentDrawingState(), pdCurrentRootElement, pdCurrentSelectedElement, iMaxDisplayedHierarchyDepth); selectionManager.addToType(SelectionType.SELECTION, pdCurrentRootElement.getElementID()); controlBox = new Rectangle(0, 0, 0.3f, 0.2f); upwardNavigationSlider = new OneWaySlider( new Vec2f(controlBox.getMinX() + 0.1f, controlBox.getMinY() + 0.1f), 0.2f, 1f, pdRealRootElement.getHierarchyLevel(), 1, 0, pdRealRootElement.getDepth() - 1); upwardNavigationSlider.setMinSize(80); }
IDType getNodeIDType() { return partialDiscTree.getNodeIDType(); }