Java Code Examples for java.awt.geom.Rectangle2D#setFrame()
The following examples show how to use
java.awt.geom.Rectangle2D#setFrame() .
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: AbstractAWTReactionLayout.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 6 votes |
/** * * @param molSet * @param molSetBoundsTree * @param dx * @param dy */ public void shiftMoleculeSet(IAtomContainerSet molSet, BoundsTree molSetBoundsTree, double dx, double dy) { // System.out.println(molSetBoundsTree); int counter = 0; for (IAtomContainer molecule : molSet.atomContainers()) { String molLabel = molSet.getID() + "_" + molecule.getID() + ":" + counter; // System.out.println("shifting " + molLabel + " from " + BoundsPrinter.toString(GeometryTools.getRectangle2D(molecule))); Rectangle2D bounds = molSetBoundsTree.get(molLabel); bounds.setFrame(bounds.getMinX() + dx, bounds.getMinY() + dy, bounds.getWidth(), bounds.getHeight()); translate2D(molecule, dx, dy); // System.out.println("shifting " + molecule.getID() + " to " + BoundsPrinter.toString(GeometryTools.getRectangle2D(molecule))); counter++; } }
Example 2
Source File: AbstractBlockTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Confirm that cloning works. */ @Test public void testCloning() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); Rectangle2D bounds1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); b1.setBounds(bounds1); EmptyBlock b2 = null; try { b2 = (EmptyBlock) b1.clone(); } catch (CloneNotSupportedException e) { fail(e.toString()); } assertTrue(b1 != b2); assertTrue(b1.getClass() == b2.getClass()); assertTrue(b1.equals(b2)); bounds1.setFrame(2.0, 4.0, 6.0, 8.0); assertFalse(b1.equals(b2)); b2.setBounds(new Rectangle2D.Double(2.0, 4.0, 6.0, 8.0)); assertTrue(b1.equals(b2)); }
Example 3
Source File: AbstractBlockTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that cloning works. */ public void testCloning() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); Rectangle2D bounds1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); b1.setBounds(bounds1); EmptyBlock b2 = null; try { b2 = (EmptyBlock) b1.clone(); } catch (CloneNotSupportedException e) { fail(e.toString()); } assertTrue(b1 != b2); assertTrue(b1.getClass() == b2.getClass()); assertTrue(b1.equals(b2)); bounds1.setFrame(2.0, 4.0, 6.0, 8.0); assertFalse(b1.equals(b2)); b2.setBounds(new Rectangle2D.Double(2.0, 4.0, 6.0, 8.0)); assertTrue(b1.equals(b2)); }
Example 4
Source File: ImageInstruction.java From pumpernickel with MIT License | 6 votes |
public ImageInstruction(boolean isFirstFrame, AffineTransform transform, Shape clipping) { this.isFirstFrame = isFirstFrame; if (transform != null) this.transform = new AffineTransform(transform); if (clipping != null) { if (clipping instanceof Rectangle) { this.clipping = new Rectangle((Rectangle) clipping); } else if (clipping instanceof Rectangle2D) { Rectangle2D r = new Rectangle2D.Float(); r.setFrame((Rectangle2D) clipping); this.clipping = r; } else { this.clipping = new GeneralPath(clipping); } } }
Example 5
Source File: GeometryEditPanel.java From jts with GNU Lesser General Public License v2.1 | 6 votes |
private void drawHighlightedVertices(Graphics2D g, List coords, Color clr) { Rectangle2D rect = new Rectangle2D.Double(); for (int i = 0; i < coords.size(); i++) { Coordinate pt = (Coordinate) coords.get(i); Point2D p = viewport.toView(pt); rect.setFrame( p.getX() - VERTEX_SIZE_OVER_2, p.getY() - VERTEX_SIZE_OVER_2, VERTEX_SIZE, VERTEX_SIZE); g.setColor(clr); g.fill(rect); Rectangle2D rectInner = new Rectangle2D.Double( p.getX() - INNER_SIZE_OVER_2, p.getY() - INNER_SIZE_OVER_2, INNER_SIZE, INNER_SIZE); g.setColor(AppConstants.VERTEX_HIGHLIGHT_CLR); g.fill(rectInner); } }
Example 6
Source File: StringOperation.java From pumpernickel with MIT License | 5 votes |
@Override public Shape getUnclippedOutline() { Graphics2DContext ctx = getContext(); FontRenderContext frc = ctx.getFontRenderContext(); Rectangle2D r = ctx.getFont().getStringBounds(getString(), frc); r.setFrame(r.getX() + getX(), r.getY() + getY(), r.getWidth(), r.getHeight()); return ctx.getTransform().createTransformedShape(r); }
Example 7
Source File: AbstractDirectReactionLayout.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
/** * * @param molSet * @param molSetBoundsTree * @param dx * @param dy */ public void shiftMoleculeSet(IAtomContainerSet molSet, BoundsTree molSetBoundsTree, double dx, double dy) { int counter = 0; String rootLabel = molSet.getID(); for (IAtomContainer molecule : molSet.atomContainers()) { String label = rootLabel + "_" + molecule.getID() + ":" + counter; Rectangle2D bounds = molSetBoundsTree.get(label); bounds.setFrame(bounds.getCenterX() + dx, bounds.getCenterY() + dy, bounds.getWidth(), bounds.getHeight()); translate2D(molecule, dx, dy); counter++; } }
Example 8
Source File: WorldMapPane.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public void zoomToProduct(Product product) { if (product == null || product.getSceneGeoCoding() == null) { return; } final GeneralPath[] generalPaths = getGeoBoundaryPaths(product); Rectangle2D modelArea = new Rectangle2D.Double(); final Viewport viewport = getLayerCanvas().getViewport(); for (GeneralPath generalPath : generalPaths) { final Rectangle2D rectangle2D = generalPath.getBounds2D(); if (modelArea.isEmpty()) { if (!viewport.isModelYAxisDown()) { modelArea.setFrame(rectangle2D.getX(), rectangle2D.getMaxY(), rectangle2D.getWidth(), rectangle2D.getHeight()); } modelArea = rectangle2D; } else { modelArea.add(rectangle2D); } } Rectangle2D modelBounds = modelArea.getBounds2D(); modelBounds.setFrame(modelBounds.getX() - 2, modelBounds.getY() - 2, modelBounds.getWidth() + 4, modelBounds.getHeight() + 4); modelBounds = cropToMaxModelBounds(modelBounds); viewport.zoom(modelBounds); fireScrolled(); }
Example 9
Source File: NestWorldMapPane.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public void zoomToProduct(Product product) { final NestWorldMapPaneDataModel.Boundary[] selGeoBoundaries = dataModel.getSelectedGeoBoundaries(); final GeneralPath[] generalPaths; if (product != null && product.getSceneGeoCoding() != null) { generalPaths = getGeoBoundaryPaths(product); } else if (selGeoBoundaries.length > 0) { generalPaths = assemblePathList(selGeoBoundaries[0].geoBoundary);//selGeoBoundaries[0].boundaryPaths; } else { return; } Rectangle2D modelArea = new Rectangle2D.Double(); final Viewport viewport = layerCanvas.getViewport(); for (GeneralPath generalPath : generalPaths) { final Rectangle2D rectangle2D = generalPath.getBounds2D(); if (modelArea.isEmpty()) { if (!viewport.isModelYAxisDown()) { modelArea.setFrame(rectangle2D.getX(), rectangle2D.getMaxY(), rectangle2D.getWidth(), rectangle2D.getHeight()); } modelArea = rectangle2D; } else { modelArea.add(rectangle2D); } } Rectangle2D modelBounds = modelArea.getBounds2D(); modelBounds.setFrame(modelBounds.getX() - 2, modelBounds.getY() - 2, modelBounds.getWidth() + 4, modelBounds.getHeight() + 4); modelBounds = cropToMaxModelBounds(modelBounds); viewport.zoom(modelBounds); }
Example 10
Source File: RelationTool.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
protected void paintPort(Graphics g) { if (port != null) { boolean o = (GraphConstants.getOffset(port.getAllAttributes()) != null); Rectangle2D r = (o) ? port.getBounds() : port.getParentView().getBounds(); r = graph.toScreen((Rectangle2D) r.clone()); r.setFrame(r.getX() - 3, r.getY() - 3, r.getWidth() + 6, r.getHeight() + 6); graph.getUI().paintCell(g, port, r, true); } }
Example 11
Source File: RegionSelectableWorldMapPane.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
@Override public void zoomToProduct(Product product) { if (product != null) { super.zoomToProduct(product); } Rectangle2D modelBounds = getFirstFigure().getBounds(); modelBounds.setFrame(modelBounds.getX() - 2, modelBounds.getY() - 2, modelBounds.getWidth() + 4, modelBounds.getHeight() + 4); getLayerCanvas().getViewport().zoom(modelBounds); handleZoom(); }
Example 12
Source File: WaferMapPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major, minor; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 13
Source File: WaferMapPlot.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major, minor; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 14
Source File: WaferMapPlot.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major = 0d; double minor = 0d; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 15
Source File: WaferMapPlot.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major = 0d; double minor = 0d; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 16
Source File: MicroscopeTransition2D.java From pumpernickel with MIT License | 4 votes |
@Override public Transition2DInstruction[] getInstructions(float progress, Dimension size) { progress = (progress * progress * progress) * 6f / 7f + progress / 7f; // (.5f*(2*progress-1)*(2*progress-1)*(2*progress-1)+.5f)/2f+progress/2f; // so here at progress = 0 each "tile" is 1 pixel, // and at progress = 1, each tile is "size". float tileWidth = (size.width - 1) * progress + 1; float tileHeight = (size.height - 1) * progress + 1; float startX = size.width / 2; float startY = size.height / 2; while (startX > 0) startX -= tileWidth; while (startY > 0) startY -= tileHeight; List<Rectangle2D> v = new ArrayList<Rectangle2D>(); if (progress > min) { for (float y = startY - tileHeight / 2; y < size.height; y += tileHeight) { for (float x = startX - tileWidth / 2; x < size.width; x += tileWidth) { v.add(new Rectangle2D.Double(x, y, tileWidth, tileHeight)); } } } Rectangle2D[] r = v.toArray(new Rectangle2D[v.size()]); Transition2DInstruction[] instr = new Transition2DInstruction[1 + r.length]; Rectangle2D bigRect = new Rectangle2D.Double(0, 0, tileWidth * size.width, tileHeight * size.height); bigRect.setFrame(size.getWidth() / 2 - bigRect.getWidth() / 2, size.getHeight() / 2 - bigRect.getHeight() / 2, bigRect.getWidth(), bigRect.getHeight()); instr[0] = new ImageInstruction(true, bigRect, size, null); float maxOpacity = (progress - min) / (1 - min); for (int a = 0; a < r.length; a++) { float multiplier = (float) Point2D.distance(size.getWidth() / 2, size.getHeight() / 2, r[a].getCenterX(), r[a].getCenterY()); multiplier = (multiplier / 100 + 1); float opacity = maxOpacity / multiplier; instr[a + 1] = new ImageInstruction(false, opacity, r[a], size, null); } return instr; }
Example 17
Source File: WaferMapPlot.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major = 0d; double minor = 0d; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 18
Source File: WaferMapPlot.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major, minor; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 19
Source File: WaferMapPlot.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Calculates and draws the chip locations on the wafer. * * @param g2 the graphics device. * @param plotArea the plot area. */ protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) { Shape savedClip = g2.getClip(); g2.setClip(getWaferEdge(plotArea)); Rectangle2D chip = new Rectangle2D.Double(); int xchips = 35; int ychips = 20; double space = 1d; if (this.dataset != null) { xchips = this.dataset.getMaxChipX() + 2; ychips = this.dataset.getMaxChipY() + 2; space = this.dataset.getChipSpace(); } double startX = plotArea.getX(); double startY = plotArea.getY(); double chipWidth = 1d; double chipHeight = 1d; if (plotArea.getWidth() != plotArea.getHeight()) { double major, minor; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } //set upperLeft point if (plotArea.getWidth() == minor) { // x is minor startY += (major - minor) / 2; chipWidth = (plotArea.getWidth() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getWidth() - (space * ychips - 1)) / ychips; } else { // y is minor startX += (major - minor) / 2; chipWidth = (plotArea.getHeight() - (space * xchips - 1)) / xchips; chipHeight = (plotArea.getHeight() - (space * ychips - 1)) / ychips; } } for (int x = 1; x <= xchips; x++) { double upperLeftX = (startX - chipWidth) + (chipWidth * x) + (space * (x - 1)); for (int y = 1; y <= ychips; y++) { double upperLeftY = (startY - chipHeight) + (chipHeight * y) + (space * (y - 1)); chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight); g2.setColor(Color.white); if (this.dataset.getChipValue(x - 1, ychips - y - 1) != null) { g2.setPaint( this.renderer.getChipColor( this.dataset.getChipValue(x - 1, ychips - y - 1) ) ); } g2.fill(chip); g2.setColor(Color.lightGray); g2.draw(chip); } } g2.setClip(savedClip); }
Example 20
Source File: WritingShape.java From pumpernickel with MIT License | 3 votes |
/** * Return the bounds of this shape. * <p> * Note these are not the literal bounds; this is the expected frame. * Strokes do not need to fill these bounds, and they can liberally step * outside of these bounds for occasional flourishes. * * @return the bounds of this shape. */ public Rectangle2D getBounds() { Rectangle2D r = properties.get(BOUNDS_KEY); Rectangle2D copy = new Rectangle2D.Float(); copy.setFrame(r); return copy; }