示例#1
0
 protected void testZoomInPoint(int vx, int vy) {
   Point position1 = geoMapPositioned.getMapPosition();
   int zoom = geoMapPositioned.getZoom();
   geoMapBot.zoomIn(vx, vy);
   testMapPositionZoom(
       position1, zoom, geoMapPositioned.getMapPosition(), geoMapPositioned.getZoom(), vx, vy);
 }
示例#2
0
 @Test
 public void testPan() {
   Point position1 = geoMapPositioned.getMapPosition();
   int vx = 0, vy = 0, dx = 10, dy = 20;
   geoMapBot.pan(vx, vy, vx + dx, vy + dy);
   assertEquals(new Point(position1.x - dx, position1.y - dy), geoMapPositioned.getMapPosition());
   geoMapBot.pan(vx + dx, vy + dy, vx, vy);
   assertEquals(position1, geoMapPositioned.getMapPosition());
 }
示例#3
0
 @Test
 public void testZoomOut() {
   Point position = geoMapPositioned.getMapPosition(), size = geoMap.getSize();
   int zoom = geoMapPositioned.getZoom();
   int vx = size.x / 2, vy = size.y / 2;
   geoMapBot.zoomOut(size.x / 2, size.y / 2);
   // check zoom level
   assertEquals(zoom - 1, geoMapPositioned.getZoom());
   // check map position
   testMapPositionZoom(
       geoMapPositioned.getMapPosition(), geoMapPositioned.getZoom(), position, zoom, vx, vy);
 }
示例#4
0
 protected void testZoomInRectangle(int x1, int y1, int x2, int y2) {
   Point position1 = geoMapPositioned.getMapPosition(), size = geoMap.getSize();
   int zoom = geoMapPositioned.getZoom();
   geoMapBot.zoomIn(x1, y1, x2, y2);
   // check zoom level
   assertEquals(zoom + 1, geoMapPositioned.getZoom());
   // check map position
   Point position2 = geoMapPositioned.getMapPosition();
   // the center of the rectangle
   Point center1 = new Point(position1.x + (x1 + x2) / 2, position1.y + (y1 + y2) / 2);
   // the center of the new viewport (divided by the zoom factor)
   Point center2 = new Point((position2.x + size.x / 2) / 2, (position2.y + size.y / 2) / 2);
   assertEquals(center1, center2);
 }
示例#5
0
 @Test
 public void testCenter() {
   Point mapPosition = geoMapPositioned.getMapPosition();
   int dx = 10, dy = 20;
   geoMapBot.center(dx, dy);
   assertEquals(new Point(mapPosition.x + dx, mapPosition.y + dy), geoMap.getCenterPosition());
 }