Changeset 10398 in josm for trunk


Ignore:
Timestamp:
2016-06-16T15:10:50+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #12975 - areas in the mapview are not filled anymore (patch by michael2402) - gsoc-core

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapViewState.java

    r10375 r10398  
    172172     */
    173173    public AffineTransform getAffineTransform() {
    174         return new AffineTransform(1.0 / scale, 0.0, 0.0, -1.0 / scale, topLeft.east() / scale,
     174        return new AffineTransform(1.0 / scale, 0.0, 0.0, -1.0 / scale, -topLeft.east() / scale,
    175175                topLeft.north() / scale);
    176176    }
  • trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java

    r10375 r10398  
    33
    44import static org.junit.Assert.assertEquals;
     5
     6import java.awt.geom.AffineTransform;
     7import java.awt.geom.Point2D;
     8import java.util.Arrays;
    59
    610import org.junit.Before;
     
    100104        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, p);
    101105
    102 
    103106        EastNorth eastnorth = p.getEastNorth();
    104107        LatLon shouldLatLon = Main.getProjection().getWorldBoundsLatLon().getCenter();
     
    117120        assertEquals("north", 3, p2.getEastNorth().north(), 0.01);
    118121    }
     122
     123    /**
     124     * Test {@link MapViewState#getAffineTransform()}
     125     */
     126    @Test
     127    public void testGetAffineTransform() {
     128        for (EastNorth en : Arrays.asList(new EastNorth(100, 100), new EastNorth(0, 0), new EastNorth(300, 200),
     129                new EastNorth(-1, -2.5))) {
     130            MapViewPoint should = state.getPointFor(en);
     131            AffineTransform transform = state.getAffineTransform();
     132            Point2D result = transform.transform(new Point2D.Double(en.getX(), en.getY()), null);
     133
     134            assertEquals("x", should.getInViewX(), result.getX(), 0.01);
     135            assertEquals("y", should.getInViewY(), result.getY(), 0.01);
     136        }
     137    }
    119138}
Note: See TracChangeset for help on using the changeset viewer.