Java Code Examples for java.awt.geom.Dimension2D#setSize()
The following examples show how to use
java.awt.geom.Dimension2D#setSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Table.java From ramus with GNU General Public License v3.0 | 5 votes |
public void applyComlumnsSize(QBounds tableBound, Diagram diagram) { double width = getMinWidth(); double w = width / columns.length; double x = tableBound.getLocation().getX(); for (TableColumn tableColumn : columns) { QBounds bounds = (QBounds) diagram.getBounds(tableColumn); Dimension2D size = bounds.getSize(); size.setSize(w, size.getHeight()); bounds.setLocation(new Point2D.Double(x, getColumnYLocation( tableBound, size))); tableColumn.setWidth(w); x += w; } }
Example 2
Source File: Table.java From ramus with GNU General Public License v3.0 | 5 votes |
public void applyComlumnsSize(QBounds tableBound, QBounds[] bounds) { double width = getMinWidth(); double w = width / columns.length; double x = tableBound.getLocation().getX(); for (int i = 0; i < columns.length; i++) { TableColumn tableColumn = columns[i]; Dimension2D size = bounds[i].getSize(); size.setSize(w, size.getHeight()); bounds[i].setLocation(new Point2D.Double(x, getColumnYLocation( tableBound, size))); tableColumn.setWidth(w); x += w; } }
Example 3
Source File: DimensionObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates an object based on the description. * * @return The object. */ public Object createObject() { final Dimension2D dim = new Dimension(); final float width = getFloatParameter("width"); final float height = getFloatParameter("height"); dim.setSize(width, height); return dim; }
Example 4
Source File: Dimension2DObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates an object based on the description. * * @return The object. */ public Object createObject() { final Dimension2D dim = new FloatDimension(); final float width = getFloatParameter("width"); final float height = getFloatParameter("height"); dim.setSize(width, height); return dim; }
Example 5
Source File: AbstractCollapsableElement.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
@Override @Nonnull public Dimension2D calcBlockSize(@Nonnull final MindMapPanelConfig cfg, @Nullable final Dimension2D size, final boolean childrenOnly) { final Dimension2D result = size == null ? new Dimension() : size; final double scaledVInset = cfg.getScale() * cfg.getOtherLevelVerticalInset(); final double scaledHInset = cfg.getScale() * cfg.getOtherLevelHorizontalInset(); double width = childrenOnly ? 0.0d : this.bounds.getWidth(); double height = childrenOnly ? 0.0d : this.bounds.getHeight(); if (this.hasChildren()) { if (!this.isCollapsed()) { width += childrenOnly ? 0.0d : scaledHInset; final double baseWidth = childrenOnly ? 0.0d : width; double childrenHeight = 0.0d; boolean notFirstChiild = false; for (final Topic t : this.model.getChildren()) { if (notFirstChiild) { childrenHeight += scaledVInset; } else { notFirstChiild = true; } ((AbstractElement) assertNotNull(t.getPayload())).calcBlockSize(cfg, result, false); width = Math.max(baseWidth + result.getWidth(), width); childrenHeight += result.getHeight(); } height = Math.max(height, childrenHeight); } else if (!childrenOnly) { width += cfg.getCollapsatorSize() * cfg.getScale(); } } result.setSize(width, height); return result; }
Example 6
Source File: MindMapPanel.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
@Nullable public static Dimension2D calculateSizeOfMapInPixels(@Nonnull final MindMap model, @Nullable final Graphics2D graphicsContext, @Nonnull final MindMapPanelConfig cfg, final boolean expandAll, @Nonnull final RenderQuality quality) { final MindMap workMap = new MindMap(model); workMap.resetPayload(); Graphics2D g = graphicsContext; if (g == null) { BufferedImage img = new BufferedImage(32, 32, cfg.isDrawBackground() ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB); g = img.createGraphics(); } final MMGraphics gfx = new MMGraphics2DWrapper(g); quality.prepare(g); Dimension2D blockSize = null; try { if (calculateElementSizes(gfx, workMap, cfg)) { if (expandAll) { final AbstractElement root = assertNotNull((AbstractElement) assertNotNull(workMap.getRoot()).getPayload()); root.collapseOrExpandAllChildren(false); calculateElementSizes(gfx, workMap, cfg); } blockSize = assertNotNull(layoutModelElements(workMap, cfg)); final double paperMargin = cfg.getPaperMargins() * cfg.getScale(); blockSize.setSize(blockSize.getWidth() + paperMargin * 2, blockSize.getHeight() + paperMargin * 2); } } finally { gfx.dispose(); } return blockSize; }
Example 7
Source File: DimensionObjectDescription.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates an object based on the description. * * @return The object. */ public Object createObject() { final Dimension2D dim = new Dimension(); final float width = getFloatParameter( "width" ); final float height = getFloatParameter( "height" ); dim.setSize( width, height ); return dim; }
Example 8
Source File: Dimension2DObjectDescription.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates an object based on the description. * * @return The object. */ public Object createObject() { final Dimension2D dim = new FloatDimension(); final float width = getFloatParameter( "width" ); final float height = getFloatParameter( "height" ); dim.setSize( width, height ); return dim; }
Example 9
Source File: ElementRoot.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
@Override @Nonnull public Dimension2D calcBlockSize(@Nonnull final MindMapPanelConfig cfg, @Nonnull final Dimension2D size, final boolean childrenOnly) { final double insetV = cfg.getScale() * cfg.getFirstLevelVerticalInset(); final double insetH = cfg.getScale() * cfg.getFirstLevelHorizontalInset(); final Dimension2D result = size; double leftWidth = 0.0d; double leftHeight = 0.0d; double rightWidth = 0.0d; double rightHeight = 0.0d; boolean nonfirstOnLeft = false; boolean nonfirstOnRight = false; for (final Topic t : this.model.getChildren()) { final ElementLevelFirst w = assertNotNull((ElementLevelFirst) t.getPayload()); w.calcBlockSize(cfg, result, false); if (w.isLeftDirection()) { leftWidth = Math.max(leftWidth, result.getWidth()); leftHeight += result.getHeight(); if (nonfirstOnLeft) { leftHeight += insetV; } else { nonfirstOnLeft = true; } } else { rightWidth = Math.max(rightWidth, result.getWidth()); rightHeight += result.getHeight(); if (nonfirstOnRight) { rightHeight += insetV; } else { nonfirstOnRight = true; } } } if (!childrenOnly) { leftWidth += nonfirstOnLeft ? insetH : 0.0d; rightWidth += nonfirstOnRight ? insetH : 0.0d; } this.leftBlockSize.setSize(leftWidth, leftHeight); this.rightBlockSize.setSize(rightWidth, rightHeight); if (childrenOnly) { result.setSize(leftWidth + rightWidth, Math.max(leftHeight, rightHeight)); } else { result.setSize(leftWidth + rightWidth + this.bounds.getWidth(), Math.max(this.bounds.getHeight(), Math.max(leftHeight, rightHeight))); } return result; }
Example 10
Source File: SinglePointServer.java From mil-sym-java with Apache License 2.0 | 4 votes |
/** * @param SymbolInfo * - same string you'd send to singlePointServer.handle() * example: * “SFGPUCDMH-*****?LineColor=0x000000&FillColor=0xFFFFFF * &size=35” * @param center * - pixel location that represents where the image should be * centered. * @param bounds * - Minimum Bounding Rectangle of the core symbol * @author Spinelli */ public void getSinglePointDimensions(String SymbolInfo, Point2D center, Rectangle2D bounds, Dimension2D iconExtent) { initRenderer(); try { // prepare implement IPointConversion or use our basic point Map<String,String> params = JavaRendererUtilities.createParameterMapFromURL(SymbolInfo); // check if plugin renderer was requested String renderer = params.get(MilStdAttributes.Renderer); if(renderer==null || renderer.equals("")) { renderer=SinglePoint2525Renderer.RENDERER_ID; } if(plugins.hasRenderer(renderer)==false) { //if renderer id doesn't exist or is no good, set to default plugin. renderer=SinglePoint2525Renderer.RENDERER_ID; } String pluginSymbolID = null; ISinglePointInfo spi = null; if (renderer != null && plugins != null && plugins.hasRenderer(renderer)) { int questionIndex = SymbolInfo.indexOf('?'); if (questionIndex == -1) pluginSymbolID = SymbolInfo; else pluginSymbolID = SymbolInfo.substring(0, questionIndex); // try to render with plugin // System.out.println(symbol.getSymbolID()); // System.out.println("plugin " + renderer + ": " + // pluginSymbolID); spi = plugins.render(renderer, pluginSymbolID, params); } ImageInfo iInfo; if (spi != null && spi.getImage() != null) { // if plugin render success, //create image info with result iInfo = new ImageInfo(spi.getImage(), 0, 0, (int) spi.getSymbolCenterPoint().getX(), (int) spi .getSymbolCenterPoint().getY(), spi.getSymbolBounds()); center.setLocation(iInfo.getSymbolCenterPoint()); bounds.setFrame(iInfo.getSymbolBounds()); if (iconExtent != null) iconExtent.setSize(iInfo.getImage().getWidth(), iInfo.getImage().getHeight()); } } catch (Exception exc) { System.out.println(exc.getMessage()); } }