/** * Gets the color of the GeoJsonLineString as a 32-bit ARGB color * * @return color of the GeoJsonLineString */ public int getColor() { return mPolylineOptions.getColor(); }
/** * Creates a new PolylineOption from given properties of an existing PolylineOption * @param originalPolylineOption An existing PolylineOption instance * @return A new PolylineOption */ private static PolylineOptions createPolylineOptions (PolylineOptions originalPolylineOption) { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.color(originalPolylineOption.getColor()); polylineOptions.width(originalPolylineOption.getWidth()); return polylineOptions; }
/** * Sets the inline linestring style by copying over the styles that have been set * * @param polylineOptions polygon options object to add inline styles to * @param inlineStyle inline styles to apply */ private void setInlineLineStringStyle(PolylineOptions polylineOptions, KmlStyle inlineStyle) { PolylineOptions inlinePolylineOptions = inlineStyle.getPolylineOptions(); if (inlineStyle.isStyleSet("outlineColor")) { polylineOptions.color(inlinePolylineOptions.getColor()); } if (inlineStyle.isStyleSet("width")) { polylineOptions.width(inlinePolylineOptions.getWidth()); } if (inlineStyle.isLineRandomColorMode()) { polylineOptions.color(KmlStyle.computeRandomColor(inlinePolylineOptions.getColor())); } }
public void testColor() throws Exception { lineStringStyle.setColor(Color.YELLOW); assertEquals(Color.YELLOW, lineStringStyle.getColor()); assertEquals(Color.YELLOW, lineStringStyle.toPolylineOptions().getColor()); lineStringStyle.setColor(0x76543210); assertEquals(0x76543210, lineStringStyle.getColor()); assertEquals(0x76543210, lineStringStyle.toPolylineOptions().getColor()); lineStringStyle.setColor(Color.parseColor("#000000")); assertEquals(Color.parseColor("#000000"), lineStringStyle.getColor()); assertEquals(Color.parseColor("#000000"), lineStringStyle.toPolylineOptions().getColor()); }
public void testInlineStyle() throws Exception { XmlPullParser parser = createParser(com.google.maps.android.test.R.raw.amu_inline_style); KmlParser mParser = new KmlParser(parser); mParser.parseKml(); assertNotNull(mParser.getPlacemarks()); assertEquals(mParser.getPlacemarks().size(), 1); for (KmlPlacemark placemark : mParser.getPlacemarks().keySet()) { KmlStyle inlineStyle = placemark.getInlineStyle(); assertNotNull(inlineStyle); assertEquals(inlineStyle.getPolylineOptions().getColor(), Color.parseColor("#000000")); assertEquals(inlineStyle.getPolygonOptions().getFillColor(), Color.parseColor("#ffffff")); assertEquals(inlineStyle.getPolylineOptions().getColor(), inlineStyle.getPolygonOptions().getStrokeColor()); assertEquals(placemark.getGeometry().getGeometryType(), "MultiGeometry"); } }
/** * Gets a new PolylineOptions object containing styles for the GeoJsonLineString * * @return new PolylineOptions object */ public PolylineOptions toPolylineOptions() { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.color(mPolylineOptions.getColor()); polylineOptions.clickable(mPolylineOptions.isClickable()); polylineOptions.geodesic(mPolylineOptions.isGeodesic()); polylineOptions.visible(mPolylineOptions.isVisible()); polylineOptions.width(mPolylineOptions.getWidth()); polylineOptions.zIndex(mPolylineOptions.getZIndex()); polylineOptions.pattern(getPattern()); return polylineOptions; }
public void testLineColor() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getPolygonOptions()); assertNotNull(kmlStyle.getPolylineOptions()); assertEquals(Color.BLACK, kmlStyle.getPolylineOptions().getColor()); assertEquals(Color.BLACK, kmlStyle.getPolygonOptions().getStrokeColor()); kmlStyle.setOutlineColor("FFFFFF"); assertEquals(Color.WHITE, kmlStyle.getPolylineOptions().getColor()); assertEquals(Color.WHITE, kmlStyle.getPolygonOptions().getStrokeColor()); }
public void testDefaultGetPolylineOptions() throws Exception { assertEquals(Color.BLACK, lineStringStyle.toPolylineOptions().getColor()); assertFalse(lineStringStyle.toPolylineOptions().isGeodesic()); assertTrue(lineStringStyle.toPolylineOptions().isVisible()); assertEquals(10.0f, lineStringStyle.toPolylineOptions().getWidth()); assertEquals(0.0f, lineStringStyle.toPolylineOptions().getZIndex()); } }
setInlineLineStringStyle(polylineOptions, inlineStyle); } else if (style.isLineRandomColorMode()) { polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions.getColor()));
/** * Gets the color of the GeoJsonLineString as a 32-bit ARGB color * * @return color of the GeoJsonLineString */ public int getColor() { return mPolylineOptions.getColor(); }
public int getColor() { return real.getColor(); }
public int getColor() { return real.getColor(); }
/** * Creates a new PolylineOption from given properties of an existing PolylineOption * @param originalPolylineOption An existing PolylineOption instance * @return A new PolylineOption */ private static PolylineOptions createPolylineOptions (PolylineOptions originalPolylineOption) { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.color(originalPolylineOption.getColor()); polylineOptions.width(originalPolylineOption.getWidth()); return polylineOptions; }
/** * Sets the inline linestring style by copying over the styles that have been set * * @param polylineOptions polygon options object to add inline styles to * @param inlineStyle inline styles to apply */ private void setInlineLineStringStyle(PolylineOptions polylineOptions, KmlStyle inlineStyle) { PolylineOptions inlinePolylineOptions = inlineStyle.getPolylineOptions(); if (inlineStyle.isStyleSet("outlineColor")) { polylineOptions.color(inlinePolylineOptions.getColor()); } if (inlineStyle.isStyleSet("width")) { polylineOptions.width(inlinePolylineOptions.getWidth()); } if (inlineStyle.isLineRandomColorMode()) { polylineOptions.color(KmlStyle.computeRandomColor(inlinePolylineOptions.getColor())); } }
/** * Adds a KML LineString to the map as a Polyline by combining the styling and coordinates * * @param lineString contains coordinates for the Polyline * @param style contains relevant styling properties for the Polyline * @return Polyline object */ private Polyline addLineStringToMap(KmlLineString lineString, KmlStyle style, KmlStyle inlineStyle) { PolylineOptions polylineOptions = style.getPolylineOptions(); polylineOptions.addAll(lineString.getGeometryObject()); if (inlineStyle != null) { setInlineLineStringStyle(polylineOptions, inlineStyle); } else if (style.isLineRandomColorMode()) { polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions.getColor())); } return mMap.addPolyline(polylineOptions); }
/** * Gets a new PolylineOptions object containing styles for the GeoJsonLineString * * @return new PolylineOptions object */ public PolylineOptions toPolylineOptions() { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.color(mPolylineOptions.getColor()); polylineOptions.clickable(mPolylineOptions.isClickable()); polylineOptions.geodesic(mPolylineOptions.isGeodesic()); polylineOptions.visible(mPolylineOptions.isVisible()); polylineOptions.width(mPolylineOptions.getWidth()); polylineOptions.zIndex(mPolylineOptions.getZIndex()); return polylineOptions; }
@Test public void testMap() throws Exception { // Given PolylineOptionsMapper mapper = new PolylineOptionsMapper(); PolylineOptions input = new PolylineOptions() .color(0xff0000) .width(10f) .add(new LatLng(10, 10)); // When com.google.android.gms.maps.model.PolylineOptions output = mapper.map(input); // Then assertEquals( input.getColor(), output.getColor() ); assertEquals( input.getWidth(), output.getWidth(), 0 ); assertEquals( 1, output.getPoints().size() ); TestUtil.assertEquals( input.getPoints().get(0), output.getPoints().get(0) ); }