public synchronized void addPoints(List<LatLong> points) { this.latLongs.addAll(points); updatePoints(); }
@Test public void setterTest() { LatLong latLong = new LatLong(0, 0); Paint paintStroke = GRAPHIC_FACTORY.createPaint(); Polyline polyline = new Polyline(null, GRAPHIC_FACTORY); Assert.assertTrue(polyline.getLatLongs().isEmpty()); Assert.assertNull(polyline.getPaintStroke()); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(latLong); polyline.setPoints(latLongs); Assert.assertEquals(Arrays.asList(latLong), polyline.getLatLongs()); polyline.setPaintStroke(paintStroke); Assert.assertEquals(paintStroke, polyline.getPaintStroke()); } }
@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); } }
@Override protected void addOverlayLayers(Layers layers) { Polyline polyline = new Polyline(Utils.createPaint( AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), 8, Style.STROKE), AndroidGraphicFactory.INSTANCE); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(latLong2); latLongs.add(latLong3); polyline.setPoints(latLongs); layers.add(polyline); }
@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()); }
/** * Callback function for loadGpxObjects() */ @Override public final void onGpxLoaded(final List<LatLong> points) { Log.d(TAG, "Loading " + points.size() + " gpx objects"); clearGpxLayer(); if (mMapView == null) { return; } mGpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.GREEN), STROKE_GPX_WIDTH, Style.STROKE), AndroidGraphicFactory.INSTANCE); for (final LatLong point : points) { mGpxObjects.getLatLongs().add(point); } synchronized (this) { mMapView.getLayerManager().getLayers().add(mGpxObjects); } mRefreshGpxPending = false; }
@Override public final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); // get shared preferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mCatalogObjects = new ArrayList<>(); mSessionObjects = new ArrayList<>(); mGpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), STROKE_GPX_WIDTH, Style.STROKE), AndroidGraphicFactory.INSTANCE); }
@Override protected void setCenter() { super.setCenter(); BoundingBox bbox = DualOverviewMapViewer.this.mapView.getBoundingBox(); Paint paintStroke = Utils.createPaint( AndroidGraphicFactory.INSTANCE.createColor(Color.RED), 2, Style.STROKE); Polyline polygon = new Polyline(paintStroke, AndroidGraphicFactory.INSTANCE); List<LatLong> latLongs = new ArrayList<>(); latLongs.add(new LatLong(bbox.minLatitude, bbox.minLongitude)); latLongs.add(new LatLong(bbox.minLatitude, bbox.maxLongitude)); latLongs.add(new LatLong(bbox.maxLatitude, bbox.maxLongitude)); latLongs.add(new LatLong(bbox.maxLatitude, bbox.minLongitude)); latLongs.add(new LatLong(bbox.minLatitude, bbox.minLongitude)); polygon.setPoints(latLongs); if (this.lastLine != null) { DualOverviewMapViewer.this.mapView2.getLayerManager().getLayers() .remove(this.lastLine); } DualOverviewMapViewer.this.mapView2.getLayerManager() .getLayers().add(polygon); this.lastLine = polygon; }
protected void addOverlayLayers(Layers layers) { Polyline polyline = new Polyline(Utils.createPaint( AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), (int) (8 * mapView.getModel().displayModel.getScaleFactor()), latLongs.add(latLong2); latLongs.add(latLong3); polyline.setPoints(latLongs); shaderPaint.setBitmapShader(AndroidGraphicFactory.convertToBitmap(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? getDrawable(R.drawable.marker_green) : getResources().getDrawable(R.drawable.marker_green))); Polyline polylineWithShader = new Polyline(shaderPaint, AndroidGraphicFactory.INSTANCE, true) { @Override public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) { latLongs2.add(latLong8); latLongs2.add(latLong9); polylineWithShader.setPoints(latLongs2);
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 addPoint(LatLong point) { this.latLongs.add(point); updatePoints(); }
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(); }