/** @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem) */ @Override public void setBounds(VisualItem item) { if (!m_manageBounds) { return; } Shape shape = getShape(item); if (shape == null) { item.setBounds(item.getX(), item.getY(), 0, 0); } else if (shape == m_line) { GraphicsLib.setBounds(item, shape, getStroke(item)); } else { m_box.add(m_line.getX1(), m_line.getY1()); m_box.add(m_line.getX2(), m_line.getY2()); item.setBounds(m_box.getMinX(), m_box.getMinY(), m_box.getWidth(), m_box.getHeight()); } }
/** @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem) */ @Override public void setBounds(VisualItem item) { if (!m_manageBounds) { return; } Shape shape = getShape(item); if (shape == null) { item.setBounds(item.getX(), item.getY(), 0, 0); return; } // GraphicsLib.setBounds(item, shape, getStroke(item)); // if (m_curArrow != null) { // Rectangle2D bbox = (Rectangle2D) item.get(VisualItem.BOUNDS); // Rectangle2D.union(bbox, m_curArrow.getBounds2D(), bbox); // } GraphicsLib.getBounds(m_tmpBounds, shape, getStroke(item)); if (m_curArrow != null) { Rectangle2D.union(m_tmpBounds, m_curArrow.getBounds2D(), m_tmpBounds); } item.setBounds( m_tmpBounds.getX(), m_tmpBounds.getY(), m_tmpBounds.getWidth(), m_tmpBounds.getHeight()); }
@Override public void itemDragged(VisualItem item, MouseEvent e) { if (!SwingUtilities.isRightMouseButton(e)) { return; } if (item.getGroup().equals(m_group)) { dragged = true; // Display d = (Display) e.getComponent(); Display d = controller.getDocumentGrid(); d.getAbsoluteCoordinate(e.getPoint(), temp); double dx = temp.getX() - down.getX(); double dy = temp.getY() - down.getY(); double x = item.getX(); double y = item.getY(); double w = item.getDouble(WIDTH); double h = item.getDouble(HEIGHT); item.setStartX(x); item.setStartY(y); item.setX(x + dx); item.setY(y + dy); item.setEndX(x + dx); item.setEndY(y + dy); item.setBounds(x + dx, y + dy, w, h); if (repaint) { item.getVisualization().repaint(); } down.setLocation(temp); if (action != null) { d.getVisualization().run(action); } } }