/** * @param radius the new non-negative radius of this circle in meters. * @throws IllegalArgumentException if the given {@code radius} is negative or {@link Float#NaN}. */ public synchronized void setRadius(float radius) { setRadiusInternal(radius); }
/** * Ctor. * * @param graphicFactory the graphic factory. * @param displayModel the display model of the map view. * @param spacingConfig a map containing the spacing for every zoom level. */ public Grid(GraphicFactory graphicFactory, DisplayModel displayModel, Map<Byte, Double> spacingConfig) { super(); this.displayModel = displayModel; this.spacingConfig = spacingConfig; this.lineBack = createLineBack(graphicFactory, displayModel); this.lineFront = createLineFront(graphicFactory, displayModel); this.textBack = createTextBack(graphicFactory, displayModel); this.textFront = createTextFront(graphicFactory, displayModel); }
public synchronized void addPoints(List<LatLong> points) { this.latLongs.addAll(points); updatePoints(); }
@Test public void constructorTest() { LatLong latLong = new LatLong(0, 0); int radius = 3; Paint paintFill = GRAPHIC_FACTORY.createPaint(); Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Circle circle = new Circle(latLong, radius, paintFill, paintStroke); Assert.assertEquals(latLong, circle.getPosition()); Assert.assertEquals(radius, circle.getRadius(), 0); Assert.assertEquals(paintFill, circle.getPaintFill()); Assert.assertEquals(paintStroke, circle.getPaintStroke()); verifyInvalidRadius(latLong, -1, paintFill, paintStroke); verifyInvalidRadius(latLong, Float.NaN, paintFill, paintStroke); }
@Test public void constructorTest() { LatLong latLong = new LatLong(0, 0); Bitmap bitmap = GRAPHIC_FACTORY.createBitmap(10, 20); Marker marker = new Marker(latLong, bitmap, 1, 2); Assert.assertEquals(latLong, marker.getLatLong()); Assert.assertEquals(bitmap, marker.getBitmap()); Assert.assertEquals(1, marker.getHorizontalOffset()); Assert.assertEquals(2, marker.getVerticalOffset()); }
@Test public void constructorTest() { Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Polyline polyline = new Polyline(paintStroke, GRAPHIC_FACTORY); Assert.assertTrue(polyline.getLatLongs().isEmpty()); Assert.assertEquals(paintStroke, polyline.getPaintStroke()); }
@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()); }
private static Circle createCircle(LatLong latLong, float radius, Paint paintFill, Paint paintStroke) { return new Circle(latLong, radius, paintFill, paintStroke); }
public synchronized void addPoint(LatLong point) { this.latLongs.add(point); updatePoints(); }
/** * @return the non-negative radius of this circle in pixels. */ @Override protected int getRadiusInPixels(double latitude, byte zoomLevel) { return (int) (this.getRadius() * (this.scaleRadius ? this.displayModel.getScaleFactor() : 1)); }
public synchronized boolean contains(Point center, Point point, double latitude, byte zoomLevel) { // Touch min 20x20 px at baseline mdpi (160dpi) double distance = Math.max(20 / 2 * this.displayModel.getScaleFactor(), getRadiusInPixels(latitude, zoomLevel)); return center.distance(point) < distance; }
private static void verifyInvalidRadius(LatLong latLong, float radius, Paint paintFill, Paint paintStroke) { try { createCircle(latLong, radius, paintFill, paintStroke); Assert.fail(); } catch (IllegalArgumentException e) { Assert.assertTrue(true); } }
public synchronized void addPoints(List<LatLong> points) { this.latLongs.addAll(points); updatePoints(); }
public synchronized void clear() { this.latLongs.clear(); updatePoints(); }
/** * @param latLong the initial center point of this circle (may be null). * @param radius the initial non-negative radius of this circle in meters. * @param paintFill the initial {@code Paint} used to fill this circle (may be null). * @param paintStroke the initial {@code Paint} used to stroke this circle (may be null). * @param keepAligned if set to true it will keep the bitmap aligned with the map, * to avoid a moving effect of a bitmap shader. * @throws IllegalArgumentException if the given {@code radius} is negative or {@link Float#NaN}. */ public Circle(LatLong latLong, float radius, Paint paintFill, Paint paintStroke, boolean keepAligned) { super(); this.keepAligned = keepAligned; this.latLong = latLong; setRadiusInternal(radius); this.paintFill = paintFill; this.paintStroke = paintStroke; }
public synchronized boolean contains(Point center, Point point) { // Touch min 20x20 px at baseline mdpi (160dpi) double distance = Math.max(20 / 2 * this.displayModel.getScaleFactor(), getRadius() * (this.scaleRadius ? this.displayModel.getScaleFactor() : 1)); return center.distance(point) < distance; }
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(); }
public synchronized void setPoints(List<LatLong> points) { this.latLongs.clear(); this.latLongs.addAll(points); updatePoints(); }