public synchronized void addPoint(LatLong point) { this.latLongs.add(point); updatePoints(); }
@Test public void setterTest() { LatLong latLong = new LatLong(0, 0); Paint paintFill = GRAPHIC_FACTORY.createPaint(); Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Polygon polygon = new Polygon(null, null, GRAPHIC_FACTORY); Assert.assertTrue(polygon.getLatLongs().isEmpty()); Assert.assertNull(polygon.getPaintFill()); Assert.assertNull(polygon.getPaintStroke()); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(latLong); polygon.setPoints(latLongs); Assert.assertEquals(Arrays.asList(latLong), polygon.getLatLongs()); polygon.setPaintFill(paintFill); polygon.setPaintStroke(paintStroke); Assert.assertEquals(paintFill, polygon.getPaintFill()); Assert.assertEquals(paintStroke, polygon.getPaintStroke()); } }
@Test public void drawTest() { for (int tileSize : TILE_SIZES) { Polygon polygon = new Polygon(null, null, GRAPHIC_FACTORY); polygon.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); polygon.draw(boundingBox, (byte) 0, canvas, point); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(new LatLong(0, 0)); latLongs.add(new LatLong(1, 1)); polygon.setPoints(latLongs); polygon.draw(boundingBox, (byte) 0, canvas, point); polygon.setPaintFill(GRAPHIC_FACTORY.createPaint()); polygon.setPaintStroke(GRAPHIC_FACTORY.createPaint()); polygon.draw(boundingBox, (byte) 0, canvas, point); } }
@Test public void constructorTest() { Paint paintFill = GRAPHIC_FACTORY.createPaint(); Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Polygon polygon = new Polygon(paintFill, paintStroke, GRAPHIC_FACTORY); Assert.assertTrue(polygon.getLatLongs().isEmpty()); Assert.assertEquals(paintFill, polygon.getPaintFill()); Assert.assertEquals(paintStroke, polygon.getPaintStroke()); }
latLongs3.add(latLong4); latLongs3.add(latLong5); polygon.setPoints(latLongs3); AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), 2, Style.STROKE); Polygon polygonWithShaderNonAligned = new Polygon(paintFill2, paintStroke2, AndroidGraphicFactory.INSTANCE); List<LatLong> latLongs4 = new ArrayList<>(); latLongs4.add(latLong12); latLongs4.add(latLong10); polygonWithShaderNonAligned.setPoints(latLongs4); AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), 2, Style.STROKE); Polygon polygonWithShaderAligned = new Polygon(paintFill3, paintStroke3, AndroidGraphicFactory.INSTANCE, true); List<LatLong> latLongs5 = new ArrayList<>(); latLongs5.add(latLong15); latLongs5.add(latLong13); polygonWithShaderAligned.setPoints(latLongs5);
public synchronized void addPoints(List<LatLong> points) { this.latLongs.addAll(points); updatePoints(); }
public synchronized void clear() { this.latLongs.clear(); updatePoints(); }
public synchronized void setPoints(List<LatLong> points) { this.latLongs.clear(); this.latLongs.addAll(points); updatePoints(); }
public synchronized void addPoints(List<LatLong> points) { this.latLongs.addAll(points); updatePoints(); }
public synchronized void clear() { this.latLongs.clear(); updatePoints(); }
public synchronized void addPoint(LatLong point) { this.latLongs.add(point); updatePoints(); }
public synchronized void setPoints(List<LatLong> points) { this.latLongs.clear(); this.latLongs.addAll(points); updatePoints(); }