本文整理了Java中java.awt.geom.AffineTransform.setToIdentity()
方法的一些代码示例,展示了AffineTransform.setToIdentity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.setToIdentity()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:setToIdentity
暂无
代码示例来源:origin: stackoverflow.com
// create an AffineTransform
// and a triangle centered on (0,0) and pointing downward
// somewhere outside Swing's paint loop
AffineTransform tx = new AffineTransform();
Line2D.Double line = new Line2D.Double(0,0,100,100);
Polygon arrowHead = new Polygon();
arrowHead.addPoint( 0,5);
arrowHead.addPoint( -5, -5);
arrowHead.addPoint( 5,-5);
// [...]
private void drawArrowHead(Graphics2D g2d) {
tx.setToIdentity();
double angle = Math.atan2(line.y2-line.y1, line.x2-line.x1);
tx.translate(line.x2, line.y2);
tx.rotate((angle-Math.PI/2d));
Graphics2D g = (Graphics2D) g2d.create();
g.setTransform(tx);
g.fill(arrowHead);
g.dispose();
}
代码示例来源:origin: Activiti/Activiti
public void drawDefaultSequenceFlowIndicator(Line2D.Double line) {
double length = DEFAULT_INDICATOR_WIDTH;
double halfOfLength = length / 2;
double f = 8;
Line2D.Double defaultIndicator = new Line2D.Double(-halfOfLength,
0,
halfOfLength,
0);
double angle = Math.atan2(line.y2 - line.y1,
line.x2 - line.x1);
double dx = f * Math.cos(angle);
double dy = f * Math.sin(angle);
double x1 = line.x1 + dx;
double y1 = line.y1 + dy;
AffineTransform transformation = new AffineTransform();
transformation.setToIdentity();
transformation.translate(x1,
y1);
transformation.rotate((angle - 3 * Math.PI / 4));
AffineTransform originalTransformation = g.getTransform();
g.setTransform(transformation);
g.draw(defaultIndicator);
g.setTransform(originalTransformation);
}
代码示例来源:origin: Activiti/Activiti
transformation.setToIdentity();
double angle = Math.atan2(line.y2 - line.y1,
line.x2 - line.x1);
代码示例来源:origin: Activiti/Activiti
transformation.setToIdentity();
transformation.rotate(270 * Math.PI / 180);
代码示例来源:origin: Activiti/Activiti
public void drawConditionalSequenceFlowIndicator(Line2D.Double line) {
int horizontal = (int) (CONDITIONAL_INDICATOR_WIDTH * 0.7);
int halfOfHorizontal = horizontal / 2;
int halfOfVertical = CONDITIONAL_INDICATOR_WIDTH / 2;
Polygon conditionalIndicator = new Polygon();
conditionalIndicator.addPoint(0,
0);
conditionalIndicator.addPoint(-halfOfHorizontal,
halfOfVertical);
conditionalIndicator.addPoint(0,
CONDITIONAL_INDICATOR_WIDTH);
conditionalIndicator.addPoint(halfOfHorizontal,
halfOfVertical);
AffineTransform transformation = new AffineTransform();
transformation.setToIdentity();
double angle = Math.atan2(line.y2 - line.y1,
line.x2 - line.x1);
transformation.translate(line.x1,
line.y1);
transformation.rotate((angle - Math.PI / 2d));
AffineTransform originalTransformation = g.getTransform();
g.setTransform(transformation);
g.draw(conditionalIndicator);
Paint originalPaint = g.getPaint();
g.setPaint(CONDITIONAL_INDICATOR_COLOR);
g.fill(conditionalIndicator);
g.setPaint(originalPaint);
g.setTransform(originalTransformation);
}
代码示例来源:origin: mapsforge/mapsforge
@Override
public void reset() {
this.affineTransform.setToIdentity();
}
代码示例来源:origin: geotools/geotools
/** Checks for {@linkplain #checkPermission permission} before setting this transform. */
@Override
public void setToIdentity() {
checkPermission();
super.setToIdentity();
}
代码示例来源:origin: mapsforge/mapsforge
transform.setToIdentity();
代码示例来源:origin: dermotte/LIRE
@Override
public boolean fit(PointMatch[] min_matches) {
PointMatch m1 = min_matches[0];
float[] m1_p1 = m1.getP1().getL();
float[] m1_p2 = m1.getP2().getL();
float tx = m1_p1[0] - m1_p2[0];
float ty = m1_p1[1] - m1_p2[1];
affine.setToIdentity();
affine.translate(tx, ty);
return true;
}
代码示例来源:origin: dermotte/LIRE
@Override
public boolean fit(PointMatch[] min_matches) {
PointMatch m1 = min_matches[0];
float[] m1_p1 = m1.getP1().getL();
float[] m1_p2 = m1.getP2().getL();
float tx = m1_p1[0] - m1_p2[0];
float ty = m1_p1[1] - m1_p2[1];
affine.setToIdentity();
affine.translate(tx, ty);
return true;
}
代码示例来源:origin: dermotte/LIRE
public void minimize(Collection<PointMatch> matches) {
// center of mass:
float xo1 = 0, yo1 = 0;
float xo2 = 0, yo2 = 0;
int length = matches.size();
for (PointMatch m : matches) {
float[] m_p1 = m.getP1().getL();
float[] m_p2 = m.getP2().getW();
xo1 += m_p1[0];
yo1 += m_p1[1];
xo2 += m_p2[0];
yo2 += m_p2[1];
}
xo1 /= length;
yo1 /= length;
xo2 /= length;
yo2 /= length;
float dx = xo1 - xo2; // reversed, because the second will be moved relative to the first
float dy = yo1 - yo2;
affine.setToIdentity();
affine.translate(-dx, -dy);
}
代码示例来源:origin: dermotte/LIRE
public void minimize(Collection<PointMatch> matches) {
// center of mass:
float xo1 = 0, yo1 = 0;
float xo2 = 0, yo2 = 0;
int length = matches.size();
for (PointMatch m : matches) {
float[] m_p1 = m.getP1().getL();
float[] m_p2 = m.getP2().getW();
xo1 += m_p1[0];
yo1 += m_p1[1];
xo2 += m_p2[0];
yo2 += m_p2[1];
}
xo1 /= length;
yo1 /= length;
xo2 /= length;
yo2 /= length;
float dx = xo1 - xo2; // reversed, because the second will be moved relative to the first
float dy = yo1 - yo2;
affine.setToIdentity();
affine.translate(-dx, -dy);
}
代码示例来源:origin: stackoverflow.com
g2d.drawPolygon(p1);
g2d.drawPolygon(p2);
at.setToIdentity();
at.translate(w / 2, h / 2);
at.scale(scale, scale);
代码示例来源:origin: dermotte/LIRE
affine.setToIdentity();
affine.rotate(-angle, xo2, yo2);
affine.translate(-dx, -dy);
代码示例来源:origin: dermotte/LIRE
affine.setToIdentity();
affine.rotate(-angle, xo2, yo2);
affine.translate(-dx, -dy);
代码示例来源:origin: geotools/geotools
while (Math.abs(currOffset) <= labelOffset * 2 && !painted) {
tx.setToIdentity();
Rectangle2D labelEnvelope;
double maxAngleChange = 0;
代码示例来源:origin: org.icepdf.os/icepdf-core
private static AffineTransform createRotation(Point2D point,
Point2D startOfLine,
Point2D endOfLine) {
AffineTransform tx = new AffineTransform();
Line2D.Double line = new Line2D.Double(startOfLine, endOfLine);
tx.setToIdentity();
double angle = Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
tx.translate(point.getX(), point.getY());
tx.rotate(angle - (Math.PI / 2));
return tx;
}
代码示例来源:origin: geotools/geotools
while (Math.abs(currOffset) <= (labelOffset * 2) && !painted) {
tx.setToIdentity();
double maxAngleChange = 0;
boolean curved = false;
代码示例来源:origin: net.sf.jung/jung-visualization
public void setToIdentity() {
inverse = null;
transform.setToIdentity();
fireStateChanged();
}
}
代码示例来源:origin: jrtom/jung
/**
* setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the
* previous and new values for scale and offset
*
* @param scalex the amount to scale in the x direction
* @param scaley the amount to scale in the y direction
* @param from the point to transform
*/
public void setScale(double scalex, double scaley, Point2D from) {
transform.setToIdentity();
scale(scalex, scaley, from);
}
内容来源于网络,如有侵权,请联系作者删除!