Skip to content

Commit 73a0730

Browse files
committed
[Branches/1.0]
- Fix for transforming Envelope (now using all 4 corners instead of just 2 git-tfs-id: [https://tfs.codeplex.com/tfs/TFS01]$/SharpMap/Branches/1.0;C105002
1 parent c4a4f1e commit 73a0730

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

SharpMap/CoordinateSystems/Transformations/GeometryTransform.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,12 @@ public static Envelope TransformBox(Envelope box, IMathTransform transform)
3737
{
3838
if (box == null)
3939
return null;
40-
var corners = new Coordinate[4];
41-
var ll = box.Min().ToDoubleArray();
42-
var ur = box.Max().ToDoubleArray();
43-
var llTrans = transform.Transform(ll);
44-
var urTrans = transform.Transform(ur);
45-
corners[0] = new Coordinate(llTrans[0], llTrans[1]); //lower left
46-
corners[2] = new Coordinate(llTrans[0], urTrans[1]); //upper left
47-
corners[1] = new Coordinate(urTrans[0], urTrans[1]); //upper right
48-
corners[3] = new Coordinate(urTrans[0], llTrans[1]); //lower right
40+
41+
var corners = new [] {
42+
transform.Transform(new Coordinate(box.MinX, box.MinY)),
43+
transform.Transform(new Coordinate(box.MinX, box.MaxY)),
44+
transform.Transform(new Coordinate(box.MaxX, box.MinY)),
45+
transform.Transform(new Coordinate(box.MaxX, box.MaxY)) };
4946

5047
var result = new Envelope(corners[0]);
5148
for (var i = 1; i < 4; i++)

0 commit comments

Comments
 (0)