public PolygonDelegate() { this.polygon = new GoogleMapPolygon(); }
@Override public String getFillColor() { return polygon.getFillColor(); }
@Override public double getFillOpacity() { return polygon.getFillOpacity(); }
@Override public List<GeoPoint> getCoordinates() { return DelegateHelper.toGeoPoints(polygon.getCoordinates()); }
/** * Adds a polygon overlay to the map. * * @param polygon The GoogleMapPolygon to add. */ public void addPolygonOverlay(GoogleMapPolygon polygon) { getState().polygons.put(polygon.getId(), polygon); }
@Override public int getStrokeWeight() { return polygon.getStrokeWeight(); }
@Override public String getStrokeColor() { return polygon.getStrokeColor(); }
@Override public double getStrokeOpacity() { return polygon.getStrokeOpacity(); }
@Override public int getzIndex() { return polygon.getzIndex(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PolygonDelegate other = (PolygonDelegate) obj; return polygon.equals(other.getPolygon()); } }
public void removePolygonVertex(GoogleMapPolygon polygon, LatLon vertex) { if (polygon == null || vertex == null) return; if (polygon.getCoordinates().size() <= MIN_VERTEX_COUNT) return; getRpcProxy(PolygonRemoveVertexRpc.class).removeVertex(polygon, vertex); }
/** * Removes a polygon overlay from the map. * * @param polygon The GoogleMapPolygon to remove. */ public void removePolygonOverlay(GoogleMapPolygon polygon) { getState().polygons.remove(polygon.getId()); }
@Override public void polygonEdited(long polygonId, PolygonEditListener.ActionType actionType, int idx, LatLon latLon) { if (actionType == null || latLon == null) { return; } GoogleMapPolygon polygon = getPolygon(polygonId); if (polygon == null) { return; } switch (actionType) { case INSERT: polygon.getCoordinates().add(idx, latLon); break; case REMOVE: polygon.getCoordinates().remove(idx); break; case SET: LatLon existing = polygon.getCoordinates().get(idx); existing.setLat(latLon.getLat()); existing.setLon(latLon.getLon()); latLon = existing; break; } for (PolygonEditListener listener : polygonEditListeners) { listener.polygonEdited(polygon, actionType, idx, latLon); } } };
@Override public void polygonComplete(GoogleMapPolygon polygon) { if (polygon == null) { return; } getState().polygons.put(polygon.getId(), polygon); for (PolygonCompleteListener listener : polygonCompleteListeners) { listener.polygonComplete(polygon); } } };
@Override public Polygon createPolygon(List<GeoPoint> coordinates, String fillColor, double fillOpacity, String strokeColor, double strokeOpacity, int strokeWeight) { return new PolygonDelegate(new GoogleMapPolygon(DelegateHelper.toLatLon(coordinates), fillColor, fillOpacity, strokeColor, strokeOpacity, strokeWeight)); }
@Override public Polygon createPolygon(List<GeoPoint> coordinates) { return new PolygonDelegate(new GoogleMapPolygon(DelegateHelper.toLatLon(coordinates))); }