/** * Gets the fill color of the GeoJsonPolygon as a 32-bit ARGB color * * @return fill color of the GeoJsonPolygon */ public int getFillColor() { return mPolygonOptions.getFillColor(); }
@Override public <T> void addPolygon(AirMapPolygon<T> polygon) { try { JSONArray array = new JSONArray(); for (LatLng point : polygon.getPolygonOptions().getPoints()) { JSONObject json = new JSONObject(); json.put("lat", point.latitude); json.put("lng", point.longitude); array.put(json); } webView.loadUrl(String.format(Locale.US, "javascript:addPolygon(" + array.toString() + ", %1$d, %2$d, %3$d, %4$d);", polygon.getId(), (int) polygon.getPolygonOptions().getStrokeWidth(), polygon.getPolygonOptions().getStrokeColor(), polygon.getPolygonOptions().getFillColor())); } catch (JSONException e) { Log.e(TAG, "error constructing polyline JSON", e); } }
public void testColorFormatting() throws Exception { KmlStyle kmlStyle = new KmlStyle(); // AABBGGRR -> AARRGGBB. kmlStyle.setFillColor("ff579D00"); assertEquals(Color.parseColor("#009D57"), kmlStyle.getPolygonOptions().getFillColor()); // Alpha w/ missing 0. kmlStyle.setFillColor(" D579D00"); assertEquals(Color.parseColor("#0D009D57"), kmlStyle.getPolygonOptions().getFillColor()); }
/** *Creates a new PolygonOption from given properties of an existing PolygonOption * @param originalPolygonOption An existing PolygonOption instance * @param isFill Whether the fill for a polygon is set * @param isOutline Whether the outline for a polygon is set * @return A new PolygonOption */ private static PolygonOptions createPolygonOptions (PolygonOptions originalPolygonOption, boolean isFill, boolean isOutline) { PolygonOptions polygonOptions = new PolygonOptions(); if (isFill) { polygonOptions.fillColor(originalPolygonOption.getFillColor()); } if (isOutline) { polygonOptions.strokeColor(originalPolygonOption.getStrokeColor()); polygonOptions.strokeWidth(originalPolygonOption.getStrokeWidth()); } return polygonOptions; }
public void testFillColor() throws Exception { polygonStyle.setFillColor(Color.BLACK); assertEquals(Color.BLACK, polygonStyle.getFillColor()); assertEquals(Color.BLACK, polygonStyle.toPolygonOptions().getFillColor()); polygonStyle.setFillColor(0xFFFFFF00); assertEquals(0xFFFFFF00, polygonStyle.getFillColor()); assertEquals(0xFFFFFF00, polygonStyle.toPolygonOptions().getFillColor()); polygonStyle.setFillColor(Color.parseColor("#FFFFFF")); assertEquals(Color.parseColor("#FFFFFF"), polygonStyle.getFillColor()); assertEquals(Color.parseColor("#FFFFFF"), polygonStyle.toPolygonOptions().getFillColor()); }
/** * Sets the inline polygon style by copying over the styles that have been set * * @param polygonOptions polygon options object to add inline styles to * @param inlineStyle inline styles to apply */ private void setInlinePolygonStyle(PolygonOptions polygonOptions, KmlStyle inlineStyle) { PolygonOptions inlinePolygonOptions = inlineStyle.getPolygonOptions(); if (inlineStyle.hasFill() && inlineStyle.isStyleSet("fillColor")) { polygonOptions.fillColor(inlinePolygonOptions.getFillColor()); } if (inlineStyle.hasOutline()) { if (inlineStyle.isStyleSet("outlineColor")) { polygonOptions.strokeColor(inlinePolygonOptions.getStrokeColor()); } if (inlineStyle.isStyleSet("width")) { polygonOptions.strokeWidth(inlinePolygonOptions.getStrokeWidth()); } } if (inlineStyle.isPolyRandomColorMode()) { polygonOptions.fillColor(KmlStyle.computeRandomColor(inlinePolygonOptions.getFillColor())); } }
public void testFillColor() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getPolygonOptions()); kmlStyle.setFillColor("000000"); int fillColor = Color.parseColor("#000000"); assertEquals(fillColor, kmlStyle.getPolygonOptions().getFillColor()); }
/** * Gets a new PolygonOptions object containing styles for the GeoJsonPolygon * * @return new PolygonOptions object */ public PolygonOptions toPolygonOptions() { PolygonOptions polygonOptions = new PolygonOptions(); polygonOptions.fillColor(mPolygonOptions.getFillColor()); polygonOptions.geodesic(mPolygonOptions.isGeodesic()); polygonOptions.strokeColor(mPolygonOptions.getStrokeColor()); polygonOptions.strokeWidth(mPolygonOptions.getStrokeWidth()); polygonOptions.visible(mPolygonOptions.isVisible()); polygonOptions.zIndex(mPolygonOptions.getZIndex()); polygonOptions.clickable(mPolygonOptions.isClickable()); return polygonOptions; }
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"); } }
public void testDefaultGetPolygonOptions() throws Exception { assertEquals(Color.TRANSPARENT, polygonStyle.toPolygonOptions().getFillColor()); assertFalse(polygonStyle.toPolygonOptions().isGeodesic()); assertEquals(Color.BLACK, polygonStyle.toPolygonOptions().getStrokeColor()); assertEquals(10.0f, polygonStyle.toPolygonOptions().getStrokeWidth()); assertTrue(polygonStyle.isVisible()); assertEquals(0.0f, polygonStyle.toPolygonOptions().getZIndex()); } }
setInlinePolygonStyle(polygonOptions, inlineStyle); } else if (style.isPolyRandomColorMode()) { polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
/** * Gets the fill color of the GeoJsonPolygon as a 32-bit ARGB color * * @return fill color of the GeoJsonPolygon */ public int getFillColor() { return mPolygonOptions.getFillColor(); }
public int getFillColor() { return real.getFillColor(); }
/** *Creates a new PolygonOption from given properties of an existing PolygonOption * @param originalPolygonOption An existing PolygonOption instance * @param isFill Whether the fill for a polygon is set * @param isOutline Whether the outline for a polygon is set * @return A new PolygonOption */ private static PolygonOptions createPolygonOptions (PolygonOptions originalPolygonOption, boolean isFill, boolean isOutline) { PolygonOptions polygonOptions = new PolygonOptions(); if (isFill) { polygonOptions.fillColor(originalPolygonOption.getFillColor()); } if (isOutline) { polygonOptions.strokeColor(originalPolygonOption.getStrokeColor()); polygonOptions.strokeWidth(originalPolygonOption.getStrokeWidth()); } return polygonOptions; }
/** * Sets the inline polygon style by copying over the styles that have been set * * @param polygonOptions polygon options object to add inline styles to * @param inlineStyle inline styles to apply */ private void setInlinePolygonStyle(PolygonOptions polygonOptions, KmlStyle inlineStyle) { PolygonOptions inlinePolygonOptions = inlineStyle.getPolygonOptions(); if (inlineStyle.hasFill() && inlineStyle.isStyleSet("fillColor")) { polygonOptions.fillColor(inlinePolygonOptions.getFillColor()); } if (inlineStyle.hasOutline()) { if (inlineStyle.isStyleSet("outlineColor")) { polygonOptions.strokeColor(inlinePolygonOptions.getStrokeColor()); } if (inlineStyle.isStyleSet("width")) { polygonOptions.strokeWidth(inlinePolygonOptions.getStrokeWidth()); } } if (inlineStyle.isPolyRandomColorMode()) { polygonOptions.fillColor(KmlStyle.computeRandomColor(inlinePolygonOptions.getFillColor())); } }
/** * Adds a KML Polygon to the map as a Polygon by combining the styling and coordinates * * @param polygon contains coordinates for the Polygon * @param style contains relevant styling properties for the Polygon * @return Polygon object */ private Polygon addPolygonToMap(KmlPolygon polygon, KmlStyle style, KmlStyle inlineStyle) { PolygonOptions polygonOptions = style.getPolygonOptions(); polygonOptions.addAll(polygon.getOuterBoundaryCoordinates()); for (ArrayList<LatLng> innerBoundary : polygon.getInnerBoundaryCoordinates()) { polygonOptions.addHole(innerBoundary); } if (inlineStyle != null) { setInlinePolygonStyle(polygonOptions, inlineStyle); } else if (style.isPolyRandomColorMode()) { polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor())); } return mMap.addPolygon(polygonOptions); }
/** * Gets a new PolygonOptions object containing styles for the GeoJsonPolygon * * @return new PolygonOptions object */ public PolygonOptions toPolygonOptions() { PolygonOptions polygonOptions = new PolygonOptions(); polygonOptions.fillColor(mPolygonOptions.getFillColor()); polygonOptions.geodesic(mPolygonOptions.isGeodesic()); polygonOptions.strokeColor(mPolygonOptions.getStrokeColor()); polygonOptions.strokeWidth(mPolygonOptions.getStrokeWidth()); polygonOptions.visible(mPolygonOptions.isVisible()); polygonOptions.zIndex(mPolygonOptions.getZIndex()); return polygonOptions; }
output.getFillColor() );