Skip to content

Commit 870db27

Browse files
committed
Add TestBuilder scaleXY function
1 parent 8504800 commit 870db27

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

modules/app/src/main/java/org/locationtech/jtstest/function/AffineTransformationFunctions.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ public static Geometry scale(Geometry g,
111111
return trans.transform(g);
112112
}
113113

114+
public static Geometry scaleXY(Geometry g,
115+
@Metadata(title="X Scale factor")
116+
double scaleX,
117+
@Metadata(title="X Scale factor")
118+
double scaleY
119+
)
120+
{
121+
Coordinate centre = envelopeCentre(g);
122+
AffineTransformation trans = AffineTransformation.scaleInstance(scaleX, scaleY, centre.x, centre.y);
123+
return trans.transform(g);
124+
}
125+
114126
public static Geometry reflectInX(Geometry g)
115127
{
116128
Coordinate centre = envelopeCentre(g);

0 commit comments

Comments
 (0)