public Double getTxtWidth() { if (_txtWidth == null && _masterShape != null && _masterShape._txtWidth != null) { return _masterShape._txtWidth; } if (_txtWidth == null) { return getWidth(); } return _txtWidth; }
public Double getTxtPinX() { if (_txtPinX == null && _masterShape != null && _masterShape._txtPinX != null) { return _masterShape._txtPinX; } if (_txtPinX == null) { return getWidth() * 0.5; } return _txtPinX; }
public Double getWidth() { if (_width == null && _masterShape != null) { return _masterShape.getWidth(); } if (_width == null) { throw XDGFException.error("Width not specified!", this); } return _width; }
/** * @return rectangle in local coordinates */ public Rectangle2D.Double getBounds() { return new Rectangle2D.Double(0, 0, getWidth(), getHeight()); }
/** * Returns a transform that can translate shape-local coordinates to the * coordinates of its parent shape */ protected AffineTransform getParentTransform() { // TODO: There's probably a better way to do this AffineTransform tr = new AffineTransform(); Double locX = getLocPinX(); Double locY = getLocPinY(); Boolean flipX = getFlipX(); Boolean flipY = getFlipY(); Double angle = getAngle(); tr.translate(-locX, -locY); tr.translate(getPinX(), getPinY()); // rotate about the origin if (angle != null && Math.abs(angle) > 0.001) { tr.rotate(angle, locX, locY); } // flip if necessary if (flipX != null && flipX) { tr.scale(-1, 1); tr.translate(-getWidth(), 0); } if (flipY != null && flipY) { tr.scale(1, -1); tr.translate(0, -getHeight()); } return tr; }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.moveTo(getX() * parent.getWidth(), getY() * parent.getHeight()); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.lineTo(getX() * parent.getWidth(), getY() * parent.getHeight()); } }
xScale = parent.getWidth(); if (yType == 0) yScale = parent.getHeight();
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; double w = parent.getWidth(); double h = parent.getHeight(); path.quadTo(getA() * w, getB() * h, getX() * w, getY() * h); } }
/** * @return returns bounds as a path in local coordinates, which is * userful if you need to transform to global coordinates * * Warning: Don't use this for 1d objects, and will fail for * infinite line objects */ public Path2D.Double getBoundsAsPath() { Double w = getWidth(); Double h = getHeight(); Path2D.Double bounds = new Path2D.Double(); bounds.moveTo(0, 0); bounds.lineTo(w, 0); bounds.lineTo(w, h); bounds.lineTo(0, h); bounds.lineTo(0, 0); return bounds; }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; double w = parent.getWidth(); double h = parent.getHeight(); path.curveTo(getA() * w, getB() * h, getC() * w, getD() * h, getX() * w, getY() * h); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; double w = parent.getWidth(); double h = parent.getHeight(); // intentionally shadowing variables here double x = getX() * w; double y = getY() * h; double a = getA() * w; double b = getB() * h; double c = getC(); double d = getD(); EllipticalArcTo.createEllipticalArc(x, y, a, b, c, d, path); } }
public Double getTxtPinX() { if (_txtPinX == null && _masterShape != null && _masterShape._txtPinX != null) { return _masterShape._txtPinX; } if (_txtPinX == null) { return getWidth() * 0.5; } return _txtPinX; }
public Double getTxtWidth() { if (_txtWidth == null && _masterShape != null && _masterShape._txtWidth != null) { return _masterShape._txtWidth; } if (_txtWidth == null) { return getWidth(); } return _txtWidth; }
/** * @return rectangle in local coordinates */ public Rectangle2D.Double getBounds() { return new Rectangle2D.Double(0, 0, getWidth(), getHeight()); }
public Double getWidth() { if (_width == null && _masterShape != null) { return _masterShape.getWidth(); } if (_width == null) { throw XDGFException.error("Width not specified!", this); } return _width; }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.moveTo(getX() * parent.getWidth(), getY() * parent.getHeight()); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.lineTo(getX() * parent.getWidth(), getY() * parent.getHeight()); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; double w = parent.getWidth(); double h = parent.getHeight(); path.quadTo(getA() * w, getB() * h, getX() * w, getY() * h); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; double w = parent.getWidth(); double h = parent.getHeight(); path.curveTo(getA() * w, getB() * h, getC() * w, getD() * h, getX() * w, getY() * h); } }