public void testGetGeometryObject() throws Exception { p = new Point(new LatLng(0, 50)); assertEquals(new LatLng(0, 50), p.getGeometryObject()); try { p = new Point(null); fail(); } catch (IllegalArgumentException e) { assertEquals("Coordinates cannot be null", e.getMessage()); } }
public void testGetGeometryType() throws Exception { p = new Point(new LatLng(0, 50)); assertEquals("Point", p.getGeometryType()); }
/** * Adds a Point to the map as a Marker * * @param markerOptions contains relevant styling properties for the Marker * @param point contains coordinates for the Marker * @return Marker object created from the given Point */ protected Marker addPointToMap(MarkerOptions markerOptions, Point point) { markerOptions.position(point.getGeometryObject()); return mMap.addMarker(markerOptions); }
public void setUp() throws Exception { super.setUp(); HashMap<Feature, Object> features = new HashMap<>(); LineString lineString = new LineString(new ArrayList<>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 50)))); Feature feature1 = new Feature(lineString, null, null); Point point = new Point(new LatLng(0, 0)); Feature feature2 = new Feature(point, null, null); features.put(feature1, null); features.put(feature2, null); featureSet = features.keySet(); mRenderer = new Renderer(mMap1, features); }
public void testGetGeometryObject() throws Exception { ArrayList<Point> points = new ArrayList<>(); points.add(new Point(new LatLng(0, 0))); points.add(new Point(new LatLng(5, 5))); points.add(new Point(new LatLng(10, 10))); mg = new MultiGeometry(points); assertEquals(points, mg.getGeometryObject()); points = new ArrayList<>(); mg = new MultiGeometry(points); assertEquals(new ArrayList<Point>(), mg.getGeometryObject()); try { mg = new MultiGeometry(null); fail(); } catch (IllegalArgumentException e) { assertEquals("Geometries cannot be null", e.getMessage()); } }
public void testAddFeature() throws Exception { Point p = new Point(new LatLng(30, 50)); Feature feature1 = new Feature(p, null, null); mRenderer.addFeature(feature1); assertTrue(mRenderer.getFeatures().contains(feature1)); }
public void testRemoveFeature() throws Exception { Point p = new Point(new LatLng(40, 50)); Feature feature1 = new Feature(p, null, null); mRenderer.addFeature(feature1); mRenderer.removeFeature(feature1); assertFalse(mRenderer.getFeatures().contains(feature1)); }
public void testGeometry() { feature = new Feature(null, null, null); assertNull(feature.getGeometry()); Point point = new Point(new LatLng(0, 0)); feature.setGeometry(point); assertEquals(point, feature.getGeometry()); feature.setGeometry(null); assertNull(feature.getGeometry()); LineString lineString = new LineString(new ArrayList<>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 50)))); feature = new Feature(lineString, null, null); assertEquals(lineString, feature.getGeometry()); feature.setGeometry(point); assertEquals(point, feature.getGeometry()); feature.setGeometry(null); assertNull(feature.getGeometry()); feature.setGeometry(lineString); assertEquals(lineString, feature.getGeometry()); }