public void setPosition(double latitude, double longitude, float accuracy) { synchronized (this) { LatLong latLong = new LatLong(latitude, longitude); this.marker.setLatLong(latLong); if (this.circle != null) { this.circle.setLatLong(latLong); this.circle.setRadius(accuracy); } requestRedraw(); } } }
@Test public void drawTest() { for (int tileSize : TILE_SIZES) { Circle circle = new Circle(null, 0, null, null); circle.setDisplayModel(new FixedTileSizeDisplayModel(tileSize)); BoundingBox boundingBox = new BoundingBox(-1, -1, 1, 1); Canvas canvas = GRAPHIC_FACTORY.createCanvas(); canvas.setBitmap(GRAPHIC_FACTORY.createBitmap(tileSize, tileSize)); Point point = new Point(0, 0); circle.draw(boundingBox, (byte) 0, canvas, point); circle.setLatLong(new LatLong(0, 0)); circle.draw(boundingBox, (byte) 0, canvas, point); circle.setRadius(1); circle.draw(boundingBox, (byte) 0, canvas, point); circle.setPaintFill(GRAPHIC_FACTORY.createPaint()); circle.draw(boundingBox, (byte) 0, canvas, point); circle.setPaintStroke(GRAPHIC_FACTORY.createPaint()); circle.draw(boundingBox, (byte) 0, canvas, point); } }
@Test public void setterTest() { LatLong latLong = new LatLong(1, 2); Paint paintFill = GRAPHIC_FACTORY.createPaint(); Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Circle circle = new Circle(null, 0, null, null); Assert.assertNull(circle.getPosition()); Assert.assertEquals(0, circle.getRadius(), 0); Assert.assertNull(circle.getPaintFill()); Assert.assertNull(circle.getPaintStroke()); circle.setLatLong(latLong); Assert.assertEquals(latLong, circle.getPosition()); circle.setRadius(1); Assert.assertEquals(1, circle.getRadius(), 0); circle.setPaintFill(paintFill); Assert.assertEquals(paintFill, circle.getPaintFill()); circle.setPaintStroke(paintStroke); Assert.assertEquals(paintStroke, circle.getPaintStroke()); } }