本文整理汇总了Java中com.vividsolutions.jts.geom.util.AffineTransformation.translationInstance方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransformation.translationInstance方法的具体用法?Java AffineTransformation.translationInstance怎么用?Java AffineTransformation.translationInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.util.AffineTransformation
的用法示例。
在下文中一共展示了AffineTransformation.translationInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorldToRectangle
import com.vividsolutions.jts.geom.util.AffineTransformation; //导入方法依赖的package包/类
public static AffineTransformation getWorldToRectangle( Envelope worldEnvelope, Rectangle pixelRectangle ) {
int cols = (int) pixelRectangle.getWidth();
int rows = (int) pixelRectangle.getHeight();
double worldWidth = worldEnvelope.getWidth();
double worldHeight = worldEnvelope.getHeight();
double x = -worldEnvelope.getMinX();
double y = -worldEnvelope.getMinY();
AffineTransformation translate = AffineTransformation.translationInstance(x, y);
double xScale = cols / worldWidth;
double yScale = rows / worldHeight;
AffineTransformation scale = AffineTransformation.scaleInstance(xScale, yScale);
int m00 = 1;
int m10 = 0;
int m01 = 0;
int m11 = -1;
int m02 = 0;
int m12 = rows;
AffineTransformation mirror_y = new AffineTransformation(m00, m01, m02, m10, m11, m12);
AffineTransformation world2pixel = new AffineTransformation(translate);
world2pixel.compose(scale);
world2pixel.compose(mirror_y);
return world2pixel;
}
示例2: translate
import com.vividsolutions.jts.geom.util.AffineTransformation; //导入方法依赖的package包/类
public static Geometry translate(Geometry g, double x, double y)
{
AffineTransformation trans = AffineTransformation.translationInstance(x, y);
Geometry newG = (Geometry) g.clone();
newG.apply(trans);
return newG;
}
示例3: rotate
import com.vividsolutions.jts.geom.util.AffineTransformation; //导入方法依赖的package包/类
/**
* Rotates the geometry around the point (x,y)
* @param g
* @param angle
* @param x
* @param y
* @return
*/
public static Geometry rotate(Geometry g, double angle, double x, double y)
{
AffineTransformation trans = AffineTransformation.translationInstance(-x, -y);
trans.rotate(angle);
trans.translate(x, y);
Geometry newG = (Geometry) g.clone();
newG.apply(trans);
return newG;
}