List of usage examples for java.awt.geom GeneralPath getBounds
public final Rectangle getBounds()
From source file:com.projity.pm.graphic.pert.PertLayout.java
public void updateBounds() { dependencyGraph.updatePertLevels();//from w ww . j av a2s.c o m GraphicConfiguration config = GraphicConfiguration.getInstance(); Point2D origin = new Point2D.Double(config.getPertXOffset(), config.getPertYOffset()); Rectangle2D ref = new Rectangle2D.Double(config.getPertXOffset(), config.getPertYOffset(), config.getPertCellWidth(), config.getPertCellHeight()); int row = 0; int col = -1; setEmpty(); for (Iterator i = cache.getIterator(); i.hasNext();) { GraphicNode current = (GraphicNode) i.next(); int currentCol = cache.getPertLevel(current) - 1; if (currentCol <= col) row++; col = currentCol; TexturedShape texturedShape = findShape(current); if (texturedShape == null) continue; double centerX = origin.getX() + ref.getMaxX() * col + ref.getWidth() / 2; double centerY = origin.getY() + ref.getMaxY() * row + ref.getHeight() / 2; //System.out.println(centerX+"/"+centerY); GeneralPath shape = texturedShape.toGeneralPath(ref.getWidth(), ref.getHeight(), centerX - ref.getWidth() / 2, centerY, null); current.setPertShape(shape, centerX, centerY); Rectangle cellBounds = network.scale(shape.getBounds()); if (isEmpty()) bounds.setBounds(cellBounds); else Rectangle.union(bounds, cellBounds, bounds); } fireLayoutChanged(); }
From source file:com.projity.pm.graphic.xbs.XbsLayout.java
private void setShape(GraphicNode node, Rectangle2D ref, double centerX, double centerY) { TexturedShape texturedShape = findShape(node); if (texturedShape == null) return;/*from w w w. j a v a2 s .co m*/ GeneralPath shape = texturedShape.toGeneralPath(ref.getWidth(), ref.getHeight(), centerX - ref.getWidth() / 2, centerY, null); node.setXbsShape(shape, centerX, centerY); Rectangle.union(bounds, network.scale(shape.getBounds()), bounds); }
From source file:com.projity.pm.graphic.network.NetworkRenderer.java
protected Rectangle getBounds(GraphicNode node) { GeneralPath shape = getShape(node); if (shape == null) return null; else/*from ww w . j a v a 2 s .co m*/ return shape.getBounds(); }
From source file:com.projity.pm.graphic.network.NetworkRenderer.java
protected Rectangle getNonScaledBounds(GraphicNode node) { GeneralPath shape = getNonScaledShape(node); if (shape == null) return null; else//from w w w. j a v a 2s. c o m return shape.getBounds(); }
From source file:com.formkiq.core.service.generator.pdfbox.PdfEditorServiceImpl.java
/** * Get the Page Line Paths./*from w w w . j a va 2 s . c o m*/ * @param page {@link PDPage} * @return {@link List} of {@link PDRectangle} */ private List<PDRectangle> getPageLinePaths(final PDPage page) { List<PDRectangle> rects = new ArrayList<>(); try { PdfLinePaths linePaths = new PdfLinePaths(page); linePaths.processPage(); List<GeneralPath> lines = linePaths.getLinePaths(); for (GeneralPath gp : lines) { Rectangle r = gp.getBounds(); rects.add(new PDRectangle(r.x, r.y, r.width, r.height)); } } catch (IOException e) { LOG.log(Level.WARNING, "Unable to find Page Line Paths", e); rects = Collections.emptyList(); } return rects; }