java.awt.geom.AffineTransform.isIdentity()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中java.awt.geom.AffineTransform.isIdentity()方法的一些代码示例,展示了AffineTransform.isIdentity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.isIdentity()方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:isIdentity

AffineTransform.isIdentity介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi

  1. public static Rectangle2D getAnchor(Graphics2D graphics, Rectangle2D anchor) {
  2. if(graphics == null) {
  3. return anchor;
  4. }
  5. AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
  6. if(tx != null && !tx.isIdentity() && tx.createTransformedShape(anchor) != null) {
  7. anchor = tx.createTransformedShape(anchor).getBounds2D();
  8. }
  9. return anchor;
  10. }

代码示例来源:origin: org.apache.poi/poi

  1. if (tx.isIdentity()) {
  2. return normalizedShape;

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Creates a transform for the specified matrix as a Java2D object. This method is provided for
  3. * interoperability with <A
  4. * HREF="http://java.sun.com/products/java-media/2D/index.jsp">Java2D</A>.
  5. *
  6. * @param matrix The affine transform as a matrix.
  7. * @return The transform for the given matrix.
  8. */
  9. public static LinearTransform create(final AffineTransform matrix) {
  10. if (matrix.isIdentity()) {
  11. return IdentityTransform.create(2);
  12. }
  13. return new AffineTransform2D(matrix);
  14. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Returns an iterator object that iterates along the <code>Shape</code> boundary and provides
  3. * access to the geometry of the <code>Shape</code> outline.
  4. */
  5. public PathIterator getPathIterator(AffineTransform at) {
  6. if (!isIdentity()) {
  7. if (at == null || at.isIdentity()) {
  8. return shape.getPathIterator(this);
  9. }
  10. at = new AffineTransform(at);
  11. at.concatenate(this);
  12. }
  13. return shape.getPathIterator(at);
  14. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Returns an iterator object that iterates along the <code>Shape</code> boundary and provides
  3. * access to a flattened view of the <code>Shape</code> outline geometry.
  4. */
  5. public PathIterator getPathIterator(AffineTransform at, final double flatness) {
  6. if (!isIdentity()) {
  7. if (at == null || at.isIdentity()) {
  8. return shape.getPathIterator(this, flatness);
  9. }
  10. at = new AffineTransform(at);
  11. at.concatenate(this);
  12. }
  13. return shape.getPathIterator(at, flatness);
  14. }

代码示例来源:origin: geotools/geotools

  1. /** Returns a {@link ROI} object based on the input {@link RenderedImage} representing ROI */
  2. public static ROI scaleROI(RenderedImage roiRaster, Rectangle bounds) {
  3. if (roiRaster == null) {
  4. return null;
  5. }
  6. int x = bounds.x;
  7. int y = bounds.y;
  8. int w = bounds.width;
  9. int h = bounds.height;
  10. // Scale factors for input data
  11. final double scaleX = w / (1.0 * roiRaster.getWidth());
  12. final double scaleY = h / (1.0 * roiRaster.getHeight());
  13. AffineTransform tr = AffineTransform.getScaleInstance(scaleX, scaleY);
  14. // Translation Factors
  15. final int transX = x;
  16. final int transY = y;
  17. tr.concatenate(AffineTransform.getTranslateInstance(transX, transY));
  18. // Log the Scale/Translate operation
  19. if (!tr.isIdentity()) {
  20. LOGGER.fine("Scaling ROI");
  21. }
  22. // Input Mask is scaled to the image size, rescaled to Bytes and then used as ROI
  23. return new ImageWorker(roiRaster).affine(tr, null, null).binarize(1).getImageAsROI();
  24. }

代码示例来源:origin: geotools/geotools

  1. if (tr.isIdentity()) {
  2. return true;

代码示例来源:origin: geotools/geotools

  1. if (result != null && transform != null && !transform.isIdentity()) {
  2. result = new TransformedShape(result, transform);

代码示例来源:origin: geotools/geotools

  1. } else if ((at == null) || at.isIdentity()) {
  2. combined = affineTransform;
  3. } else {

代码示例来源:origin: geotools/geotools

  1. /**
  2. * @param ls
  3. * @param at
  4. */
  5. public void init(LineString ls, AffineTransform at) {
  6. if ((at == null) || (at.isIdentity())) {
  7. this.at = null;
  8. } else {
  9. this.at = at;
  10. }
  11. CoordinateSequence coordinates = ls.getCoordinateSequence();
  12. if (coordinates instanceof LiteCoordinateSequence) {
  13. // array already there for us
  14. allCoords = ((LiteCoordinateSequence) coordinates).getXYArray();
  15. actualCoords = coordinates.size();
  16. } else {
  17. // build the array
  18. actualCoords = coordinates.size();
  19. allCoords = new double[actualCoords * 2];
  20. for (int t = 0; t < actualCoords; t++) {
  21. allCoords[t * 2] = coordinates.getOrdinate(t, 0);
  22. allCoords[t * 2 + 1] = coordinates.getOrdinate(t, 1);
  23. }
  24. }
  25. done = false;
  26. currentCoord = 0;
  27. }

代码示例来源:origin: org.apache.sis.core/sis-referencing

  1. /**
  2. * Returns {@code true} if the backing affine transform is the identity transform.
  3. */
  4. @Override
  5. public boolean isIdentity() {
  6. return transform.isIdentity();
  7. }

代码示例来源:origin: haraldk/TwelveMonkeys

  1. if (Px.isIdentity() && (width != defaultWidth || height != defaultHeight)) {

代码示例来源:origin: apache/pdfbox

  1. if (!at.isIdentity())

代码示例来源:origin: apache/pdfbox

  1. if ((cropBox.getLowerLeftX() < 0 || cropBox.getLowerLeftY() < 0) && transform.isIdentity())

代码示例来源:origin: apache/pdfbox

  1. if (!at.isIdentity())

代码示例来源:origin: nodebox/nodebox

  1. public void transform(Grob g, Transform t, boolean override) {
  2. if (override) {
  3. currentTransform = new Transform();
  4. }
  5. if (!transform.getAffineTransform().isIdentity()) {
  6. Transform revertedTransform = transform.clone();
  7. revertedTransform.invert();
  8. g.transform(revertedTransform);
  9. }
  10. currentTransform.append(t);
  11. Rect bounds = g.getBounds();
  12. double dx = bounds.getX() + bounds.getWidth() / 2;
  13. double dy = bounds.getY() + bounds.getHeight() / 2;
  14. transform = currentTransform.clone();
  15. if (context.transform() == Transform.Mode.CENTER) {
  16. Transform n = new Transform();
  17. n.translate(dx, dy);
  18. transform.prepend(n);
  19. n = new Transform();
  20. n.translate(-dx, -dy);
  21. transform.append(n);
  22. }
  23. g.transform(transform);
  24. }
  25. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. /** Expects world coords; with precision depending on magnification. */
  2. public Node<T> findClosestNodeW(final Collection<Node<T>> nodes, final float wx, final float wy, final double magnification) {
  3. float lx = wx,
  4. ly = wy;
  5. if (!this.at.isIdentity()) {
  6. final Point2D.Double po = inverseTransformPoint(wx, wy);
  7. lx = (float)po.x;
  8. ly = (float)po.y;
  9. }
  10. return findClosestNode(nodes, lx, ly, magnification);
  11. }

代码示例来源:origin: apache/fop

  1. /** {@inheritDoc} */
  2. protected void concatenateTransformationMatrix(AffineTransform at) {
  3. if (!at.isIdentity()) {
  4. concatenateTransformationMatrixMpt(ptToMpt(at), false);
  5. }
  6. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. /** 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.*/
  2. final public Rectangle transformRectangle(final Rectangle r) {
  3. if (this.at.isIdentity()) return (Rectangle)r.clone();
  4. return new Area(r).createTransformedArea(this.at).getBounds();
  5. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. @Override
  2. public Collection<Displayable> findLinkTargets(final AffineTransform aff) {
  3. if (null == aw) return super.findLinkTargets(aff);
  4. Area a = aw.getArea();
  5. if (!aff.isIdentity()) {
  6. a = a.createTransformedArea(aff);
  7. }
  8. return this.la.getDisplayables(Patch.class, a, true);
  9. }

相关文章