本文整理了Java中java.awt.geom.AffineTransform.getType()
方法的一些代码示例,展示了AffineTransform.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.getType()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:getType
暂无
代码示例来源:origin: plantuml/plantuml
/**
* Delegates to the enclosed <code>GeneralPath</code>.
*/
public void transform(AffineTransform at) {
if (at.getType() != AffineTransform.TYPE_IDENTITY) {
throw new IllegalArgumentException("ExtendedGeneralPaths can not be transformed");
}
}
代码示例来源:origin: geotools/geotools
/** Gets the flip state using standard {@code AffineTransform} API. */
private static int getFlipFromType(final AffineTransform tr) {
return (tr.getType() & AffineTransform.TYPE_FLIP) != 0 ? -1 : +1;
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Indicates whether we can transform {@code shape} simply by calling its
* {@code shape.setFrame(...)} method rather than by using the heavy artillery
* that is the {@code transform.createTransformedShape(shape)} method.
*/
private static boolean canReshape(final RectangularShape shape,
final AffineTransform transform) {
final int type=transform.getType();
if ((type & AffineTransform.TYPE_GENERAL_TRANSFORM) != 0) return false;
if ((type & AffineTransform.TYPE_MASK_ROTATION) != 0) return false;
if ((type & AffineTransform.TYPE_FLIP) != 0) {
if (shape instanceof Rectangle2D) return true;
if (shape instanceof Ellipse2D) return true;
if (shape instanceof RoundRectangle2D) return true;
return false;
}
return true;
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* Delegates to the enclosed <code>GeneralPath</code>.
*/
public void transform(AffineTransform at) {
if (at.getType() != AffineTransform.TYPE_IDENTITY)
throw new IllegalArgumentException
("ExtendedGeneralPaths can not be transformed");
}
代码示例来源:origin: net.sourceforge.plantuml/plantuml
/**
* Delegates to the enclosed <code>GeneralPath</code>.
*/
public void transform(AffineTransform at) {
if (at.getType() != AffineTransform.TYPE_IDENTITY) {
throw new IllegalArgumentException("ExtendedGeneralPaths can not be transformed");
}
}
代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util
/**
* Delegates to the enclosed <code>GeneralPath</code>.
*/
public void transform(AffineTransform at) {
if (at.getType() != AffineTransform.TYPE_IDENTITY)
throw new IllegalArgumentException
("ExtendedGeneralPaths can not be transformed");
}
代码示例来源:origin: apache/batik
/**
* Delegates to the enclosed <code>GeneralPath</code>.
*/
public void transform(AffineTransform at) {
if (at.getType() != AffineTransform.TYPE_IDENTITY)
throw new IllegalArgumentException
("ExtendedGeneralPaths can not be transformed");
}
代码示例来源:origin: geotools/geotools
final int type = transform.getType();
if (type == TYPE_IDENTITY) {
return shape;
代码示例来源:origin: sc.fiji/TrakEM2_
@Override
protected void transformData(final AffineTransform aff) {
switch (aff.getType()) {
case AffineTransform.TYPE_IDENTITY:
case AffineTransform.TYPE_TRANSLATION:
// Radius doesn't change
return;
default:
// Scale the radius as appropriate
final double[] fp = new double[]{x, y, x + r, y};
aff.transform(fp, 0, fp, 0, 2);
r = (float)Math.sqrt(Math.pow(fp[2] - fp[0], 2) + Math.pow(fp[3] - fp[1], 2));
}
}
}
代码示例来源:origin: apache/sis
/**
* Gets the flip state using standard {@code AffineTransform} API.
*/
private static int getFlipFromType(final AffineTransform tr) {
return (tr.getType() & AffineTransform.TYPE_FLIP) != 0 ? -1 : +1;
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** Subclasses can override this method to provide the exact contour, otherwise it returns the transformed bounding box of the data. */
public Polygon getPerimeter() {
if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
// return the bounding box as a polygon:
final Rectangle r = getBoundingBox();
return new Polygon(new int[]{r.x, r.x+r.width, r.x+r.width, r.x},
new int[]{r.y, r.y, r.y+r.height, r.y+r.height},
4);
}
// else, the rotated/sheared/scaled and translated bounding box:
final double[] po1 = new double[]{0,0, width,0, width,height, 0,height};
final double[] po2 = new double[8];
this.at.transform(po1, 0, po2, 0, 4);
return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
4);
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** Returns the perimeter enlarged in all West, North, East and South directions, in pixels.*/
public Polygon getPerimeter(final int w, final int n, final int e, final int s) {
if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
// return the bounding box as a polygon:
final Rectangle r = getBoundingBox();
return new Polygon(new int[]{r.x -w, r.x+r.width +w+e, r.x+r.width +w+e, r.x -w},
new int[]{r.y -n, r.y -n, r.y+r.height +n+s, r.y+r.height +n+s},
4);
}
// else, the rotated/sheared/scaled and translated bounding box:
final double[] po1 = new double[]{-w,-n, width+w+e,-n, width+w+e,height+n+s, -w,height+n+s};
final double[] po2 = new double[8];
this.at.transform(po1, 0, po2, 0, 4);
return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
4);
}
代码示例来源:origin: sc.fiji/TrakEM2_
@Override
public Polygon getPerimeter() {
if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
// return the bounding box as a polygon:
final Rectangle r = getBoundingBox();
return new Polygon(new int[]{r.x, r.x+r.width, r.x+r.width, r.x},
new int[]{r.y, r.y, r.y+r.height, r.y+r.height},
4);
}
// else, the rotated/sheared/scaled and translated bounding box:
final double[] po1 = new double[]{0,0, width,0, width,-height, 0,-height};
final double[] po2 = new double[8];
this.at.transform(po1, 0, po2, 0, 4);
return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
4);
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** Returns the perimeter enlarged in all West, North, East and South directions, in pixels.*/
@Override
public Polygon getPerimeter(final int w, final int n, final int e, final int s) {
if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
// return the bounding box as a polygon:
final Rectangle r = getBoundingBox();
return new Polygon(new int[]{r.x -w, r.x+r.width +w+e, r.x+r.width +w+e, r.x -w},
new int[]{r.y -n, r.y -n, r.y+r.height +n+s, r.y+r.height +n+s},
4);
}
// else, the rotated/sheared/scaled and translated bounding box:
final double[] po1 = new double[]{-w,-n, width+w+e,-n, width+w+e,-height+n+s, -w,-height+n+s};
final double[] po2 = new double[8];
this.at.transform(po1, 0, po2, 0, 4);
return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
4);
}
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
public static void dumpHintsAndScale(final Graphics2D g2d) {
final RenderingHints rHints = g2d.getRenderingHints();
final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
int count = 0;
for(final Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
final Entry<Object, Object> rEntry = rEntryIter.next();
System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
}
final AffineTransform aTrans = g2d.getTransform();
if( null != aTrans ) {
System.err.println(" type "+aTrans.getType());
System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
System.err.println(" mat "+aTrans);
} else {
System.err.println(" null transform");
}
}
代码示例来源:origin: nroduit/Weasis
/**
* Extract rotation Angle from a given AffineTransform Matrix.<br>
* This function handle cases of mirror image flip about some axis. This changes right handed coordinate system into
* a left handed system. Hence, returned angle has an opposite value.
*
* @param transform
* @return angle in the range of [ -PI ; PI ]
*/
public static double extractAngleRad(AffineTransform transform) {
double angleRad = 0.0;
if (transform != null) {
double sinTheta = transform.getShearY();
double cosTheta = transform.getScaleX();
angleRad = Math.atan2(sinTheta, cosTheta);
if ((transform.getType() & AffineTransform.TYPE_FLIP) != 0) {
angleRad *= -1.0;
}
}
return angleRad;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void transform(AffineTransform tx) {
if (get(TRANSFORM) != null
|| (tx.getType() & (AffineTransform.TYPE_TRANSLATION)) != tx.getType()) {
if (get(TRANSFORM) == null) {
TRANSFORM.setClone(this, tx);
} else {
AffineTransform t = TRANSFORM.getClone(this);
t.preConcatenate(tx);
set(TRANSFORM, t);
}
} else {
super.transform(tx);
}
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void transform(AffineTransform tx) {
if (get(TRANSFORM) != null ||
(tx.getType() & (AffineTransform.TYPE_TRANSLATION)) != tx.getType()) {
if (get(TRANSFORM) == null) {
TRANSFORM.setClone(this, tx);
} else {
AffineTransform t = TRANSFORM.getClone(this);
t.preConcatenate(tx);
set(TRANSFORM, t);
}
} else {
super.transform(tx);
}
}
代码示例来源:origin: robo-code/robocode
private void put(AffineTransform tx) {
if (tx == null) {
put((byte) 0);
} else {
double[] m = new double[6];
tx.getMatrix(m);
put((byte) 1);
put(m);
put(tx.getType());
}
}
代码示例来源:origin: triplea-game/triplea
private static Predicate<AffineTransform> transCriteria(final int xoffset, final int yoffset) {
return trans -> trans.getTranslateX() == xoffset
&& trans.getTranslateY() == yoffset
&& trans.getType() == AffineTransform.TYPE_TRANSLATION;
}
}
内容来源于网络,如有侵权,请联系作者删除!