protected BaseGuidedDecisionTreeShape getParentNode(final BaseGuidedDecisionTreeShape uiChild, final double cx, final double cy) { BaseGuidedDecisionTreeShape uiProspectiveParent = null; double finalDistance = Double.MAX_VALUE; for (WiresBaseShape ws : getShapesInCanvas()) { if (ws.isVisible()) { if (ws instanceof BaseGuidedDecisionTreeShape) { final BaseGuidedDecisionTreeShape uiNode = (BaseGuidedDecisionTreeShape) ws; if (uiNode.acceptChildNode(uiChild) && !uiNode.hasCollapsedChildren()) { double deltaX = cx - uiNode.getX(); double deltaY = cy - uiNode.getY(); double distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); if (finalDistance > distance) { finalDistance = distance; uiProspectiveParent = uiNode; } } } } } //If we're too far away from a parent we might as well not have a parent if (finalDistance > MAX_PROXIMITY) { uiProspectiveParent = null; } return uiProspectiveParent; }
protected WiresBaseTreeNode getParentNode(final WiresBaseTreeNode dragShape, final double cx, final double cy) { WiresBaseTreeNode prospectiveParent = null; double finalDistance = Double.MAX_VALUE; for (WiresBaseShape ws : getShapesInCanvas()) { if (ws.isVisible()) { if (ws instanceof WiresBaseTreeNode) { final WiresBaseTreeNode node = (WiresBaseTreeNode) ws; if (node.acceptChildNode(dragShape) && !node.hasCollapsedChildren()) { double deltaX = cx - node.getX(); double deltaY = cy - node.getY(); double distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); if (finalDistance > distance) { finalDistance = distance; prospectiveParent = node; } } } } } //If we're too far away from a parent we might as well not have a parent if (finalDistance > MAX_PROXIMITY) { prospectiveParent = null; } return prospectiveParent; }
protected BaseGuidedDecisionTreeShape getParentNode(final BaseGuidedDecisionTreeShape uiChild, final double cx, final double cy) { BaseGuidedDecisionTreeShape uiProspectiveParent = null; double finalDistance = Double.MAX_VALUE; for (WiresBaseShape ws : getShapesInCanvas()) { if (ws.isVisible()) { if (ws instanceof BaseGuidedDecisionTreeShape) { final BaseGuidedDecisionTreeShape uiNode = (BaseGuidedDecisionTreeShape) ws; if (uiNode.acceptChildNode(uiChild) && !uiNode.hasCollapsedChildren()) { double deltaX = cx - uiNode.getX(); double deltaY = cy - uiNode.getY(); double distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); if (finalDistance > distance) { finalDistance = distance; uiProspectiveParent = uiNode; } } } } } //If we're too far away from a parent we might as well not have a parent if (finalDistance > MAX_PROXIMITY) { uiProspectiveParent = null; } return uiProspectiveParent; }
protected WiresBaseTreeNode getParentNode(final WiresBaseTreeNode dragShape, final double cx, final double cy) { WiresBaseTreeNode prospectiveParent = null; double finalDistance = Double.MAX_VALUE; for (WiresBaseShape ws : getShapesInCanvas()) { if (ws.isVisible()) { if (ws instanceof WiresBaseTreeNode) { final WiresBaseTreeNode node = (WiresBaseTreeNode) ws; if (node.acceptChildNode(dragShape) && !node.hasCollapsedChildren()) { double deltaX = cx - node.getX(); double deltaY = cy - node.getY(); double distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); if (finalDistance > distance) { finalDistance = distance; prospectiveParent = node; } } } } } //If we're too far away from a parent we might as well not have a parent if (finalDistance > MAX_PROXIMITY) { prospectiveParent = null; } return prospectiveParent; }