本文整理了Java中java.awt.geom.AffineTransform.isIdentity()
方法的一些代码示例,展示了AffineTransform.isIdentity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.isIdentity()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:isIdentity
暂无
代码示例来源:origin: org.apache.poi/poi
public static Rectangle2D getAnchor(Graphics2D graphics, Rectangle2D anchor) {
if(graphics == null) {
return anchor;
}
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
if(tx != null && !tx.isIdentity() && tx.createTransformedShape(anchor) != null) {
anchor = tx.createTransformedShape(anchor).getBounds2D();
}
return anchor;
}
代码示例来源:origin: org.apache.poi/poi
if (tx.isIdentity()) {
return normalizedShape;
代码示例来源:origin: geotools/geotools
/**
* Creates a transform for the specified matrix as a Java2D object. This method is provided for
* interoperability with <A
* HREF="http://java.sun.com/products/java-media/2D/index.jsp">Java2D</A>.
*
* @param matrix The affine transform as a matrix.
* @return The transform for the given matrix.
*/
public static LinearTransform create(final AffineTransform matrix) {
if (matrix.isIdentity()) {
return IdentityTransform.create(2);
}
return new AffineTransform2D(matrix);
}
代码示例来源:origin: geotools/geotools
/**
* Returns an iterator object that iterates along the <code>Shape</code> boundary and provides
* access to the geometry of the <code>Shape</code> outline.
*/
public PathIterator getPathIterator(AffineTransform at) {
if (!isIdentity()) {
if (at == null || at.isIdentity()) {
return shape.getPathIterator(this);
}
at = new AffineTransform(at);
at.concatenate(this);
}
return shape.getPathIterator(at);
}
代码示例来源:origin: geotools/geotools
/**
* Returns an iterator object that iterates along the <code>Shape</code> boundary and provides
* access to a flattened view of the <code>Shape</code> outline geometry.
*/
public PathIterator getPathIterator(AffineTransform at, final double flatness) {
if (!isIdentity()) {
if (at == null || at.isIdentity()) {
return shape.getPathIterator(this, flatness);
}
at = new AffineTransform(at);
at.concatenate(this);
}
return shape.getPathIterator(at, flatness);
}
代码示例来源:origin: geotools/geotools
/** Returns a {@link ROI} object based on the input {@link RenderedImage} representing ROI */
public static ROI scaleROI(RenderedImage roiRaster, Rectangle bounds) {
if (roiRaster == null) {
return null;
}
int x = bounds.x;
int y = bounds.y;
int w = bounds.width;
int h = bounds.height;
// Scale factors for input data
final double scaleX = w / (1.0 * roiRaster.getWidth());
final double scaleY = h / (1.0 * roiRaster.getHeight());
AffineTransform tr = AffineTransform.getScaleInstance(scaleX, scaleY);
// Translation Factors
final int transX = x;
final int transY = y;
tr.concatenate(AffineTransform.getTranslateInstance(transX, transY));
// Log the Scale/Translate operation
if (!tr.isIdentity()) {
LOGGER.fine("Scaling ROI");
}
// Input Mask is scaled to the image size, rescaled to Bytes and then used as ROI
return new ImageWorker(roiRaster).affine(tr, null, null).binarize(1).getImageAsROI();
}
代码示例来源:origin: geotools/geotools
if (tr.isIdentity()) {
return true;
代码示例来源:origin: geotools/geotools
if (result != null && transform != null && !transform.isIdentity()) {
result = new TransformedShape(result, transform);
代码示例来源:origin: geotools/geotools
} else if ((at == null) || at.isIdentity()) {
combined = affineTransform;
} else {
代码示例来源:origin: geotools/geotools
/**
* @param ls
* @param at
*/
public void init(LineString ls, AffineTransform at) {
if ((at == null) || (at.isIdentity())) {
this.at = null;
} else {
this.at = at;
}
CoordinateSequence coordinates = ls.getCoordinateSequence();
if (coordinates instanceof LiteCoordinateSequence) {
// array already there for us
allCoords = ((LiteCoordinateSequence) coordinates).getXYArray();
actualCoords = coordinates.size();
} else {
// build the array
actualCoords = coordinates.size();
allCoords = new double[actualCoords * 2];
for (int t = 0; t < actualCoords; t++) {
allCoords[t * 2] = coordinates.getOrdinate(t, 0);
allCoords[t * 2 + 1] = coordinates.getOrdinate(t, 1);
}
}
done = false;
currentCoord = 0;
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Returns {@code true} if the backing affine transform is the identity transform.
*/
@Override
public boolean isIdentity() {
return transform.isIdentity();
}
代码示例来源:origin: haraldk/TwelveMonkeys
if (Px.isIdentity() && (width != defaultWidth || height != defaultHeight)) {
代码示例来源:origin: apache/pdfbox
if (!at.isIdentity())
代码示例来源:origin: apache/pdfbox
if ((cropBox.getLowerLeftX() < 0 || cropBox.getLowerLeftY() < 0) && transform.isIdentity())
代码示例来源:origin: apache/pdfbox
if (!at.isIdentity())
代码示例来源:origin: nodebox/nodebox
public void transform(Grob g, Transform t, boolean override) {
if (override) {
currentTransform = new Transform();
}
if (!transform.getAffineTransform().isIdentity()) {
Transform revertedTransform = transform.clone();
revertedTransform.invert();
g.transform(revertedTransform);
}
currentTransform.append(t);
Rect bounds = g.getBounds();
double dx = bounds.getX() + bounds.getWidth() / 2;
double dy = bounds.getY() + bounds.getHeight() / 2;
transform = currentTransform.clone();
if (context.transform() == Transform.Mode.CENTER) {
Transform n = new Transform();
n.translate(dx, dy);
transform.prepend(n);
n = new Transform();
n.translate(-dx, -dy);
transform.append(n);
}
g.transform(transform);
}
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** Expects world coords; with precision depending on magnification. */
public Node<T> findClosestNodeW(final Collection<Node<T>> nodes, final float wx, final float wy, final double magnification) {
float lx = wx,
ly = wy;
if (!this.at.isIdentity()) {
final Point2D.Double po = inverseTransformPoint(wx, wy);
lx = (float)po.x;
ly = (float)po.y;
}
return findClosestNode(nodes, lx, ly, magnification);
}
代码示例来源:origin: apache/fop
/** {@inheritDoc} */
protected void concatenateTransformationMatrix(AffineTransform at) {
if (!at.isIdentity()) {
concatenateTransformationMatrixMpt(ptToMpt(at), false);
}
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** Returns a new Rectangle which encloses completly the given rectangle after transforming it with this Displayable's AffineTransform. The given rectangle's fields are untouched.*/
final public Rectangle transformRectangle(final Rectangle r) {
if (this.at.isIdentity()) return (Rectangle)r.clone();
return new Area(r).createTransformedArea(this.at).getBounds();
}
代码示例来源:origin: sc.fiji/TrakEM2_
@Override
public Collection<Displayable> findLinkTargets(final AffineTransform aff) {
if (null == aw) return super.findLinkTargets(aff);
Area a = aw.getArea();
if (!aff.isIdentity()) {
a = a.createTransformedArea(aff);
}
return this.la.getDisplayables(Patch.class, a, true);
}
内容来源于网络,如有侵权,请联系作者删除!