public CanvasRasterer(GraphicFactory graphicFactory) { this.canvas = graphicFactory.createCanvas(); this.path = graphicFactory.createPath(); this.symbolMatrix = graphicFactory.createMatrix(); }
private void mergePaddingOnBitmap(HillshadingBitmap fresh, HgtFileInfo neighbor, HillshadingBitmap.Border border) { int padding = fresh.getPadding(); if (padding < 1) return; if (neighbor != null) { Future<HillshadingBitmap> neighborUnmergedFuture = neighbor.getUnmergedAsMergePartner(); if (neighborUnmergedFuture != null) { try { HillshadingBitmap other = neighborUnmergedFuture.get(); Canvas copyCanvas = graphicsFactory.createCanvas(); mergeSameSized(fresh, other, border, padding, copyCanvas); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } } } }
public LayerManager(MapView mapView, IMapViewPosition mapViewPosition, GraphicFactory graphicFactory) { super(); this.mapView = mapView; this.mapViewPosition = mapViewPosition; this.drawingCanvas = graphicFactory.createCanvas(); this.layers = new Layers(this, mapView.getModel().displayModel); this.waitForWork = true; }
public MapScaleBar(IMapViewPosition mapViewPosition, MapViewDimension mapViewDimension, DisplayModel displayModel, GraphicFactory graphicFactory, int width, int height) { this.mapViewPosition = mapViewPosition; this.mapViewDimension = mapViewDimension; this.displayModel = displayModel; this.graphicFactory = graphicFactory; this.mapScaleBitmap = graphicFactory.createBitmap(width, height); this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION; this.mapScaleCanvas = graphicFactory.createCanvas(); this.mapScaleCanvas.setBitmap(this.mapScaleBitmap); this.distanceUnitAdapter = MetricUnitAdapter.INSTANCE; this.visible = true; this.redrawNeeded = true; }
@Test public void drawTest() { for (int tileSize : TILE_SIZES) { Polyline polyline = new Polyline(null, GRAPHIC_FACTORY); polyline.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); polyline.draw(boundingBox, (byte) 0, canvas, point); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(new LatLong(0, 0)); latLongs.add(new LatLong(1, 1)); polyline.setPoints(latLongs); polyline.draw(boundingBox, (byte) 0, canvas, point); polyline.setPaintStroke(GRAPHIC_FACTORY.createPaint()); polyline.draw(boundingBox, (byte) 0, canvas, point); } }
@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); } }
private void mergePaddingOnBitmap(HillshadingBitmap fresh, HgtFileInfo neighbor, HillshadingBitmap.Border border) { int padding = fresh.getPadding(); if (padding < 1) return; if (neighbor != null) { Future<HillshadingBitmap> neighborUnmergedFuture = neighbor.getUnmergedAsMergePartner(); if (neighborUnmergedFuture != null) { try { HillshadingBitmap other = neighborUnmergedFuture.get(); Canvas copyCanvas = graphicsFactory.createCanvas(); mergeSameSized(fresh, other, border, padding, copyCanvas); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } } } }
public LayerManager(MapView mapView, IMapViewPosition mapViewPosition, GraphicFactory graphicFactory) { super(); this.mapView = mapView; this.mapViewPosition = mapViewPosition; this.drawingCanvas = graphicFactory.createCanvas(); this.layers = new Layers(this, mapView.getModel().displayModel); this.waitForWork = true; }
public CanvasRasterer(GraphicFactory graphicFactory) { this.canvas = graphicFactory.createCanvas(); this.path = graphicFactory.createPath(); this.symbolMatrix = graphicFactory.createMatrix(); }
public MapScaleBar(IMapViewPosition mapViewPosition, MapViewDimension mapViewDimension, DisplayModel displayModel, GraphicFactory graphicFactory, int width, int height) { this.mapViewPosition = mapViewPosition; this.mapViewDimension = mapViewDimension; this.displayModel = displayModel; this.graphicFactory = graphicFactory; this.mapScaleBitmap = graphicFactory.createBitmap(width, height); this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION; this.mapScaleCanvas = graphicFactory.createCanvas(); this.mapScaleCanvas.setBitmap(this.mapScaleBitmap); this.distanceUnitAdapter = MetricUnitAdapter.INSTANCE; this.visible = true; this.redrawNeeded = true; }
@Test public void drawTest() { for (int tileSize : TILE_SIZES) { Marker marker = new Marker(null, null, 0, 0); marker.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); marker.draw(boundingBox, (byte) 0, canvas, point); marker.setLatLong(new LatLong(0, 0)); marker.draw(boundingBox, (byte) 0, canvas, point); marker.setBitmap(GRAPHIC_FACTORY.createBitmap(10, 20)); marker.draw(boundingBox, (byte) 0, canvas, point); } }
@Test public void getTopLeftPointTest() { for (int tileSize : TILE_SIZES) { MapPosition mapPosition = new MapPosition(new LatLong(0, 0), (byte) 0); Canvas canvas = GRAPHIC_FACTORY.createCanvas(); canvas.setBitmap(GRAPHIC_FACTORY.createBitmap(tileSize, tileSize)); Point expectedPoint = new Point(0, 0); Assert.assertEquals(expectedPoint, MapPositionUtil.getTopLeftPoint(mapPosition, canvas.getDimension(), tileSize)); mapPosition = new MapPosition(new LatLong(0, 90), (byte) 1); expectedPoint = new Point(tileSize, (float) tileSize / 2); Assert.assertEquals(expectedPoint, MapPositionUtil.getTopLeftPoint(mapPosition, canvas.getDimension(), tileSize)); } } }
@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 getBoundingBoxTest() { for (int tileSize : TILE_SIZES) { MapPosition mapPosition = new MapPosition(new LatLong(0, 0), (byte) 0); Canvas canvas = GRAPHIC_FACTORY.createCanvas(); canvas.setBitmap(GRAPHIC_FACTORY.createBitmap(tileSize, tileSize)); double latitudeMin = MercatorProjection.LATITUDE_MIN; double latitudeMax = MercatorProjection.LATITUDE_MAX; BoundingBox expectedBoundingBox = new BoundingBox(latitudeMin, -180, latitudeMax, 180); Assert.assertEquals(expectedBoundingBox, MapPositionUtil.getBoundingBox(mapPosition, canvas.getDimension(), tileSize)); mapPosition = new MapPosition(new LatLong(0, 90), (byte) 0); expectedBoundingBox = new BoundingBox(latitudeMin, -90, latitudeMax, 180); Assert.assertEquals(expectedBoundingBox, MapPositionUtil.getBoundingBox(mapPosition, canvas.getDimension(), tileSize)); mapPosition = new MapPosition(new LatLong(90, -180), (byte) 0); expectedBoundingBox = new BoundingBox(0, -180, latitudeMax, 0); Assert.assertEquals(expectedBoundingBox, MapPositionUtil.getBoundingBox(mapPosition, canvas.getDimension(), tileSize)); } }