@Override public float getTextHeight() { return edge.getTextProperties().getHeight(); }
public void add(Node node) { float x = node.x(); float y = node.y(); TextProperties t = node.getTextProperties(); float w = t.getWidth(); float h = t.getHeight(); float radius = node.size(); // Get the rectangle occupied by the node (size + label) float nxmin = Math.min(x - w / 2, x - radius); float nxmax = Math.max(x + w / 2, x + radius); float nymin = Math.min(y - h / 2, y - radius); float nymax = Math.max(y + h / 2, y + radius); // Get the rectangle as boxes int minXbox = (int) Math.floor((COLUMNS - 1) * (nxmin - xmin) / (xmax - xmin)); int maxXbox = (int) Math.floor((COLUMNS - 1) * (nxmax - xmin) / (xmax - xmin)); int minYbox = (int) Math.floor((ROWS - 1) * (((ymax - ymin) - (nymax - ymin)) / (ymax - ymin))); int maxYbox = (int) Math.floor((ROWS - 1) * (((ymax - ymin) - (nymin - ymin)) / (ymax - ymin))); for (int col = minXbox; col <= maxXbox && col < COLUMNS && col >= 0; col++) { for (int row = minYbox; row <= maxYbox && row < ROWS && row >= 0; row++) { quads[row * COLUMNS + col].add(node); } } //Get the node center int centerX = (int) Math.floor((COLUMNS - 1) * (x - xmin) / (xmax - xmin)); int centerY = (int) Math.floor((ROWS - 1) * (((ymax - ymin) - (y - ymin)) / (ymax - ymin))); LabelAdjustLayoutData layoutData = node.getLayoutData(); layoutData.labelAdjustQuadNode = quads[centerY * COLUMNS + centerX].index; }
TextProperties t = n.getTextProperties(); float w = t.getWidth(); float h = t.getHeight(); float radius = n.size() / 2f;
@Override public void drawTextNode(NodeModel objectModel) { Node node = objectModel.getNode(); TextProperties textData = (TextProperties) node.getTextProperties(); if (textData != null) { String txt = textData.getText(); float width, height, posX, posY; if (txt == null || txt.isEmpty()) { return; } float sizeFactor = drawable.getGlobalScale() * textData.getSize() * model.sizeMode.getSizeFactor3d(model.nodeSizeFactor, objectModel); if (nodeRefresh || (objectModel.getTextWidth() == 0f && objectModel.getTextHeight() == 0f)) { Rectangle2D r = renderer.getBounds(txt); width = (float) (sizeFactor * r.getWidth()); height = (float) (sizeFactor * r.getHeight()); posX = node.x() + (float) width / -2f; posY = node.y() + (float) height / -2f; textData.setDimensions(width, height); } else { width = textData.getWidth(); height = textData.getHeight(); posX = node.x() + (float) width / -2f; posY = node.y() + (float) height / -2f; } model.colorMode.textNodeColor(this, objectModel); renderer.draw3D(txt, posX, posY, (float) node.z(), sizeFactor); } }
} else { width = textData.getWidth(); height = textData.getHeight();