Initial version -- added millennium read funcionality
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public interface DataPolygon<T> extends Geometry {
|
||||
List<List<LatLng>> getInnerBoundaryCoordinates();
|
||||
|
||||
List<LatLng> getOuterBoundaryCoordinates();
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Observable;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class Feature extends Observable {
|
||||
private Geometry mGeometry;
|
||||
protected String mId;
|
||||
private final Map<String, String> mProperties;
|
||||
|
||||
public Feature(Geometry geometry, String str, Map<String, String> map) {
|
||||
this.mGeometry = geometry;
|
||||
this.mId = str;
|
||||
if (map == null) {
|
||||
this.mProperties = new HashMap();
|
||||
} else {
|
||||
this.mProperties = map;
|
||||
}
|
||||
}
|
||||
|
||||
public Iterable<String> getPropertyKeys() {
|
||||
return this.mProperties.keySet();
|
||||
}
|
||||
|
||||
public Iterable getProperties() {
|
||||
return this.mProperties.entrySet();
|
||||
}
|
||||
|
||||
public String getProperty(String str) {
|
||||
return this.mProperties.get(str);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
public boolean hasProperty(String str) {
|
||||
return this.mProperties.containsKey(str);
|
||||
}
|
||||
|
||||
public Geometry getGeometry() {
|
||||
return this.mGeometry;
|
||||
}
|
||||
|
||||
public boolean hasProperties() {
|
||||
return this.mProperties.size() > 0;
|
||||
}
|
||||
|
||||
public boolean hasGeometry() {
|
||||
return this.mGeometry != null;
|
||||
}
|
||||
|
||||
protected String setProperty(String str, String str2) {
|
||||
return this.mProperties.put(str, str2);
|
||||
}
|
||||
|
||||
protected String removeProperty(String str) {
|
||||
return this.mProperties.remove(str);
|
||||
}
|
||||
|
||||
protected void setGeometry(Geometry geometry) {
|
||||
this.mGeometry = geometry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public interface Geometry<T> {
|
||||
T getGeometryObject();
|
||||
|
||||
String getGeometryType();
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.maps.android.data.geojson.GeoJsonLineStringStyle;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPointStyle;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPolygonStyle;
|
||||
import com.google.maps.android.data.geojson.GeoJsonRenderer;
|
||||
import com.google.maps.android.data.kml.KmlContainer;
|
||||
import com.google.maps.android.data.kml.KmlGroundOverlay;
|
||||
import com.google.maps.android.data.kml.KmlRenderer;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public abstract class Layer {
|
||||
private Renderer mRenderer;
|
||||
|
||||
public interface OnFeatureClickListener {
|
||||
void onFeatureClick(Feature feature);
|
||||
}
|
||||
|
||||
public abstract void addLayerToMap();
|
||||
|
||||
protected void addKMLToMap() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof KmlRenderer) {
|
||||
((KmlRenderer) renderer).addLayerToMap();
|
||||
return;
|
||||
}
|
||||
throw new UnsupportedOperationException("Stored renderer is not a KmlRenderer");
|
||||
}
|
||||
|
||||
protected void addGeoJsonToMap() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof GeoJsonRenderer) {
|
||||
((GeoJsonRenderer) renderer).addLayerToMap();
|
||||
return;
|
||||
}
|
||||
throw new UnsupportedOperationException("Stored renderer is not a GeoJsonRenderer");
|
||||
}
|
||||
|
||||
public void removeLayerFromMap() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof GeoJsonRenderer) {
|
||||
((GeoJsonRenderer) renderer).removeLayerFromMap();
|
||||
} else if (renderer instanceof KmlRenderer) {
|
||||
((KmlRenderer) renderer).removeLayerFromMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnFeatureClickListener(OnFeatureClickListener onFeatureClickListener) {
|
||||
this.mRenderer.setOnFeatureClickListener(onFeatureClickListener);
|
||||
}
|
||||
|
||||
protected void storeRenderer(Renderer renderer) {
|
||||
this.mRenderer = renderer;
|
||||
}
|
||||
|
||||
public Iterable<? extends Feature> getFeatures() {
|
||||
return this.mRenderer.getFeatures();
|
||||
}
|
||||
|
||||
public Feature getFeature(Object obj) {
|
||||
return this.mRenderer.getFeature(obj);
|
||||
}
|
||||
|
||||
public Feature getContainerFeature(Object obj) {
|
||||
return this.mRenderer.getContainerFeature(obj);
|
||||
}
|
||||
|
||||
protected boolean hasFeatures() {
|
||||
return this.mRenderer.hasFeatures();
|
||||
}
|
||||
|
||||
protected boolean hasContainers() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof KmlRenderer) {
|
||||
return ((KmlRenderer) renderer).hasNestedContainers();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Iterable<KmlContainer> getContainers() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof KmlRenderer) {
|
||||
return ((KmlRenderer) renderer).getNestedContainers();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Iterable<KmlGroundOverlay> getGroundOverlays() {
|
||||
Renderer renderer = this.mRenderer;
|
||||
if (renderer instanceof KmlRenderer) {
|
||||
return ((KmlRenderer) renderer).getGroundOverlays();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GoogleMap getMap() {
|
||||
return this.mRenderer.getMap();
|
||||
}
|
||||
|
||||
public void setMap(GoogleMap googleMap) {
|
||||
this.mRenderer.setMap(googleMap);
|
||||
}
|
||||
|
||||
public boolean isLayerOnMap() {
|
||||
return this.mRenderer.isLayerOnMap();
|
||||
}
|
||||
|
||||
protected void addFeature(Feature feature) {
|
||||
this.mRenderer.addFeature(feature);
|
||||
}
|
||||
|
||||
protected void removeFeature(Feature feature) {
|
||||
this.mRenderer.removeFeature(feature);
|
||||
}
|
||||
|
||||
public GeoJsonPointStyle getDefaultPointStyle() {
|
||||
return this.mRenderer.getDefaultPointStyle();
|
||||
}
|
||||
|
||||
public GeoJsonLineStringStyle getDefaultLineStringStyle() {
|
||||
return this.mRenderer.getDefaultLineStringStyle();
|
||||
}
|
||||
|
||||
public GeoJsonPolygonStyle getDefaultPolygonStyle() {
|
||||
return this.mRenderer.getDefaultPolygonStyle();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class LineString implements Geometry<List<LatLng>> {
|
||||
private static final String GEOMETRY_TYPE = "LineString";
|
||||
private final List<LatLng> mCoordinates;
|
||||
|
||||
public LineString(List<LatLng> list) {
|
||||
if (list == null) {
|
||||
throw new IllegalArgumentException("Coordinates cannot be null");
|
||||
}
|
||||
this.mCoordinates = list;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public String getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public List<LatLng> getGeometryObject() {
|
||||
return this.mCoordinates;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "LineString{\n coordinates=" + this.mCoordinates + "\n}\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class MultiGeometry implements Geometry {
|
||||
private String geometryType = "MultiGeometry";
|
||||
private List<Geometry> mGeometries;
|
||||
|
||||
public MultiGeometry(List<? extends Geometry> list) {
|
||||
if (list == null) {
|
||||
throw new IllegalArgumentException("Geometries cannot be null");
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<? extends Geometry> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(it.next());
|
||||
}
|
||||
this.mGeometries = arrayList;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public String getGeometryType() {
|
||||
return this.geometryType;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public List<Geometry> getGeometryObject() {
|
||||
return this.mGeometries;
|
||||
}
|
||||
|
||||
public void setGeometryType(String str) {
|
||||
this.geometryType = str;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str;
|
||||
if (!this.geometryType.equals("MultiPoint")) {
|
||||
str = "Geometries=";
|
||||
} else {
|
||||
str = "LineStrings=";
|
||||
}
|
||||
if (this.geometryType.equals("MultiLineString")) {
|
||||
str = "points=";
|
||||
}
|
||||
if (this.geometryType.equals("MultiPolygon")) {
|
||||
str = "Polygons=";
|
||||
}
|
||||
StringBuilder sbAppend = new StringBuilder(getGeometryType()).append("{");
|
||||
sbAppend.append("\n ".concat(str)).append(getGeometryObject());
|
||||
sbAppend.append("\n}\n");
|
||||
return sbAppend.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class Point implements Geometry {
|
||||
private static final String GEOMETRY_TYPE = "Point";
|
||||
private final LatLng mCoordinates;
|
||||
|
||||
public Point(LatLng latLng) {
|
||||
if (latLng == null) {
|
||||
throw new IllegalArgumentException("Coordinates cannot be null");
|
||||
}
|
||||
this.mCoordinates = latLng;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public String getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public LatLng getGeometryObject() {
|
||||
return this.mCoordinates;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Point{\n coordinates=" + this.mCoordinates + "\n}\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,805 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptor;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.GroundOverlay;
|
||||
import com.google.android.gms.maps.model.GroundOverlayOptions;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.Polygon;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.android.gms.maps.model.Polyline;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.android.R;
|
||||
import com.google.maps.android.collections.GroundOverlayManager;
|
||||
import com.google.maps.android.collections.MarkerManager;
|
||||
import com.google.maps.android.collections.PolygonManager;
|
||||
import com.google.maps.android.collections.PolylineManager;
|
||||
import com.google.maps.android.data.Layer;
|
||||
import com.google.maps.android.data.geojson.BiMultiMap;
|
||||
import com.google.maps.android.data.geojson.GeoJsonFeature;
|
||||
import com.google.maps.android.data.geojson.GeoJsonGeometryCollection;
|
||||
import com.google.maps.android.data.geojson.GeoJsonLineString;
|
||||
import com.google.maps.android.data.geojson.GeoJsonLineStringStyle;
|
||||
import com.google.maps.android.data.geojson.GeoJsonMultiLineString;
|
||||
import com.google.maps.android.data.geojson.GeoJsonMultiPoint;
|
||||
import com.google.maps.android.data.geojson.GeoJsonMultiPolygon;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPoint;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPointStyle;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPolygon;
|
||||
import com.google.maps.android.data.geojson.GeoJsonPolygonStyle;
|
||||
import com.google.maps.android.data.kml.KmlContainer;
|
||||
import com.google.maps.android.data.kml.KmlGroundOverlay;
|
||||
import com.google.maps.android.data.kml.KmlMultiGeometry;
|
||||
import com.google.maps.android.data.kml.KmlPlacemark;
|
||||
import com.google.maps.android.data.kml.KmlPoint;
|
||||
import com.google.maps.android.data.kml.KmlPolygon;
|
||||
import com.google.maps.android.data.kml.KmlStyle;
|
||||
import com.google.maps.android.data.kml.KmlUtil;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class Renderer {
|
||||
private static final Object FEATURE_NOT_ON_MAP = null;
|
||||
private static final int MARKER_ICON_SIZE = 32;
|
||||
private static final DecimalFormat sScaleFormat = new DecimalFormat("#.####");
|
||||
private final BiMultiMap<Feature> mContainerFeatures;
|
||||
private ArrayList<KmlContainer> mContainers;
|
||||
private Context mContext;
|
||||
private final GeoJsonLineStringStyle mDefaultLineStringStyle;
|
||||
private final GeoJsonPointStyle mDefaultPointStyle;
|
||||
private final GeoJsonPolygonStyle mDefaultPolygonStyle;
|
||||
private final BiMultiMap<Feature> mFeatures;
|
||||
private HashMap<KmlGroundOverlay, GroundOverlay> mGroundOverlayMap;
|
||||
private final GroundOverlayManager.Collection mGroundOverlays;
|
||||
private ImagesCache mImagesCache;
|
||||
private boolean mLayerOnMap;
|
||||
private GoogleMap mMap;
|
||||
private final Set<String> mMarkerIconUrls;
|
||||
private final MarkerManager.Collection mMarkers;
|
||||
private int mNumActiveDownloads;
|
||||
private final PolygonManager.Collection mPolygons;
|
||||
private final PolylineManager.Collection mPolylines;
|
||||
private HashMap<String, String> mStyleMaps;
|
||||
private HashMap<String, KmlStyle> mStyles;
|
||||
private HashMap<String, KmlStyle> mStylesRenderer;
|
||||
|
||||
public static final class ImagesCache {
|
||||
final Map<String, Map<String, BitmapDescriptor>> markerImagesCache = new HashMap();
|
||||
final Map<String, BitmapDescriptor> groundOverlayImagesCache = new HashMap();
|
||||
final Map<String, Bitmap> bitmapCache = new HashMap();
|
||||
}
|
||||
|
||||
public Renderer(GoogleMap googleMap, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager, ImagesCache imagesCache) {
|
||||
this(googleMap, new HashSet(), null, null, null, new BiMultiMap(), markerManager, polygonManager, polylineManager, groundOverlayManager);
|
||||
this.mContext = context;
|
||||
this.mStylesRenderer = new HashMap<>();
|
||||
this.mImagesCache = imagesCache == null ? new ImagesCache() : imagesCache;
|
||||
}
|
||||
|
||||
public Renderer(GoogleMap googleMap, HashMap<? extends Feature, Object> map, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) {
|
||||
this(googleMap, null, new GeoJsonPointStyle(), new GeoJsonLineStringStyle(), new GeoJsonPolygonStyle(), null, markerManager, polygonManager, polylineManager, groundOverlayManager);
|
||||
this.mFeatures.putAll(map);
|
||||
this.mImagesCache = null;
|
||||
}
|
||||
|
||||
private Renderer(GoogleMap googleMap, Set<String> set, GeoJsonPointStyle geoJsonPointStyle, GeoJsonLineStringStyle geoJsonLineStringStyle, GeoJsonPolygonStyle geoJsonPolygonStyle, BiMultiMap<Feature> biMultiMap, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) {
|
||||
this.mFeatures = new BiMultiMap<>();
|
||||
this.mNumActiveDownloads = 0;
|
||||
this.mMap = googleMap;
|
||||
this.mLayerOnMap = false;
|
||||
this.mMarkerIconUrls = set;
|
||||
this.mDefaultPointStyle = geoJsonPointStyle;
|
||||
this.mDefaultLineStringStyle = geoJsonLineStringStyle;
|
||||
this.mDefaultPolygonStyle = geoJsonPolygonStyle;
|
||||
this.mContainerFeatures = biMultiMap;
|
||||
if (googleMap != null) {
|
||||
this.mMarkers = (markerManager == null ? new MarkerManager(googleMap) : markerManager).newCollection();
|
||||
this.mPolygons = (polygonManager == null ? new PolygonManager(googleMap) : polygonManager).newCollection();
|
||||
this.mPolylines = (polylineManager == null ? new PolylineManager(googleMap) : polylineManager).newCollection();
|
||||
this.mGroundOverlays = (groundOverlayManager == null ? new GroundOverlayManager(googleMap) : groundOverlayManager).newCollection();
|
||||
return;
|
||||
}
|
||||
this.mMarkers = null;
|
||||
this.mPolygons = null;
|
||||
this.mPolylines = null;
|
||||
this.mGroundOverlays = null;
|
||||
}
|
||||
|
||||
public boolean isLayerOnMap() {
|
||||
return this.mLayerOnMap;
|
||||
}
|
||||
|
||||
protected void setLayerVisibility(boolean z) {
|
||||
this.mLayerOnMap = z;
|
||||
}
|
||||
|
||||
public GoogleMap getMap() {
|
||||
return this.mMap;
|
||||
}
|
||||
|
||||
public void setMap(GoogleMap googleMap) {
|
||||
this.mMap = googleMap;
|
||||
}
|
||||
|
||||
protected void putContainerFeature(Object obj, Feature feature) {
|
||||
this.mContainerFeatures.put(feature, obj);
|
||||
}
|
||||
|
||||
public Set<Feature> getFeatures() {
|
||||
return this.mFeatures.keySet();
|
||||
}
|
||||
|
||||
Feature getFeature(Object obj) {
|
||||
return this.mFeatures.getKey(obj);
|
||||
}
|
||||
|
||||
Feature getContainerFeature(Object obj) {
|
||||
BiMultiMap<Feature> biMultiMap = this.mContainerFeatures;
|
||||
if (biMultiMap != null) {
|
||||
return biMultiMap.getKey(obj);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<Object> getValues() {
|
||||
return this.mFeatures.values();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
public HashMap<? extends Feature, Object> getAllFeatures() {
|
||||
return this.mFeatures;
|
||||
}
|
||||
|
||||
protected Set<String> getMarkerIconUrls() {
|
||||
return this.mMarkerIconUrls;
|
||||
}
|
||||
|
||||
protected HashMap<String, KmlStyle> getStylesRenderer() {
|
||||
return this.mStylesRenderer;
|
||||
}
|
||||
|
||||
protected HashMap<String, String> getStyleMaps() {
|
||||
return this.mStyleMaps;
|
||||
}
|
||||
|
||||
protected BitmapDescriptor getCachedMarkerImage(String str, double d) {
|
||||
Bitmap bitmap;
|
||||
String str2 = sScaleFormat.format(d);
|
||||
Map<String, BitmapDescriptor> map = this.mImagesCache.markerImagesCache.get(str);
|
||||
BitmapDescriptor bitmapDescriptor = map != null ? map.get(str2) : null;
|
||||
if (bitmapDescriptor != null || (bitmap = this.mImagesCache.bitmapCache.get(str)) == null) {
|
||||
return bitmapDescriptor;
|
||||
}
|
||||
BitmapDescriptor bitmapDescriptorScaleIcon = scaleIcon(bitmap, d);
|
||||
putMarkerImagesCache(str, str2, bitmapDescriptorScaleIcon);
|
||||
return bitmapDescriptorScaleIcon;
|
||||
}
|
||||
|
||||
private BitmapDescriptor scaleIcon(Bitmap bitmap, double d) {
|
||||
int i;
|
||||
int i2 = (int) (((double) (this.mContext.getResources().getDisplayMetrics().density * 32.0f)) * d);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
if (width < height) {
|
||||
i = (int) ((height * i2) / width);
|
||||
} else if (width > height) {
|
||||
int i3 = (int) ((width * i2) / height);
|
||||
i = i2;
|
||||
i2 = i3;
|
||||
} else {
|
||||
i = i2;
|
||||
}
|
||||
return BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(bitmap, i2, i, false));
|
||||
}
|
||||
|
||||
protected BitmapDescriptor getCachedGroundOverlayImage(String str) {
|
||||
Bitmap bitmap;
|
||||
BitmapDescriptor bitmapDescriptor = this.mImagesCache.groundOverlayImagesCache.get(str);
|
||||
if (bitmapDescriptor != null || (bitmap = this.mImagesCache.bitmapCache.get(str)) == null) {
|
||||
return bitmapDescriptor;
|
||||
}
|
||||
BitmapDescriptor bitmapDescriptorFromBitmap = BitmapDescriptorFactory.fromBitmap(bitmap);
|
||||
this.mImagesCache.groundOverlayImagesCache.put(str, bitmapDescriptorFromBitmap);
|
||||
return bitmapDescriptorFromBitmap;
|
||||
}
|
||||
|
||||
public HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlayMap() {
|
||||
return this.mGroundOverlayMap;
|
||||
}
|
||||
|
||||
protected ArrayList<KmlContainer> getContainerList() {
|
||||
return this.mContainers;
|
||||
}
|
||||
|
||||
protected KmlStyle getPlacemarkStyle(String str) {
|
||||
return this.mStylesRenderer.get(str) != null ? this.mStylesRenderer.get(str) : this.mStylesRenderer.get(null);
|
||||
}
|
||||
|
||||
GeoJsonPointStyle getDefaultPointStyle() {
|
||||
return this.mDefaultPointStyle;
|
||||
}
|
||||
|
||||
GeoJsonLineStringStyle getDefaultLineStringStyle() {
|
||||
return this.mDefaultLineStringStyle;
|
||||
}
|
||||
|
||||
GeoJsonPolygonStyle getDefaultPolygonStyle() {
|
||||
return this.mDefaultPolygonStyle;
|
||||
}
|
||||
|
||||
protected void putFeatures(Feature feature, Object obj) {
|
||||
this.mFeatures.put(feature, obj);
|
||||
}
|
||||
|
||||
protected void putStyles() {
|
||||
this.mStylesRenderer.putAll(this.mStyles);
|
||||
}
|
||||
|
||||
protected void putStyles(HashMap<String, KmlStyle> map) {
|
||||
this.mStylesRenderer.putAll(map);
|
||||
}
|
||||
|
||||
private void putMarkerImagesCache(String str, String str2, BitmapDescriptor bitmapDescriptor) {
|
||||
Map<String, BitmapDescriptor> map = this.mImagesCache.markerImagesCache.get(str);
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
this.mImagesCache.markerImagesCache.put(str, map);
|
||||
}
|
||||
map.put(str2, bitmapDescriptor);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
public void cacheBitmap(String str, Bitmap bitmap) {
|
||||
this.mImagesCache.bitmapCache.put(str, bitmap);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
public void downloadStarted() {
|
||||
this.mNumActiveDownloads++;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
public void downloadFinished() {
|
||||
this.mNumActiveDownloads--;
|
||||
checkClearBitmapCache();
|
||||
}
|
||||
|
||||
protected void checkClearBitmapCache() {
|
||||
ImagesCache imagesCache;
|
||||
if (this.mNumActiveDownloads != 0 || (imagesCache = this.mImagesCache) == null || imagesCache.bitmapCache.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.mImagesCache.bitmapCache.clear();
|
||||
}
|
||||
|
||||
protected boolean hasFeatures() {
|
||||
return this.mFeatures.size() > 0;
|
||||
}
|
||||
|
||||
protected void removeFeatures(HashMap<? extends Feature, Object> map) {
|
||||
removeFeatures(map.values());
|
||||
}
|
||||
|
||||
private void removeFeatures(Collection collection) {
|
||||
for (Object obj : collection) {
|
||||
if (obj instanceof Collection) {
|
||||
removeFeatures((Collection) obj);
|
||||
} else if (obj instanceof Marker) {
|
||||
this.mMarkers.remove((Marker) obj);
|
||||
} else if (obj instanceof Polyline) {
|
||||
this.mPolylines.remove((Polyline) obj);
|
||||
} else if (obj instanceof Polygon) {
|
||||
this.mPolygons.remove((Polygon) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> map) {
|
||||
for (GroundOverlay groundOverlay : map.values()) {
|
||||
if (groundOverlay != null) {
|
||||
this.mGroundOverlays.remove(groundOverlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeFeature(Feature feature) {
|
||||
if (this.mFeatures.containsKey(feature)) {
|
||||
removeFromMap(this.mFeatures.remove(feature));
|
||||
}
|
||||
}
|
||||
|
||||
private void setFeatureDefaultStyles(GeoJsonFeature geoJsonFeature) {
|
||||
if (geoJsonFeature.getPointStyle() == null) {
|
||||
geoJsonFeature.setPointStyle(this.mDefaultPointStyle);
|
||||
}
|
||||
if (geoJsonFeature.getLineStringStyle() == null) {
|
||||
geoJsonFeature.setLineStringStyle(this.mDefaultLineStringStyle);
|
||||
}
|
||||
if (geoJsonFeature.getPolygonStyle() == null) {
|
||||
geoJsonFeature.setPolygonStyle(this.mDefaultPolygonStyle);
|
||||
}
|
||||
}
|
||||
|
||||
protected void clearStylesRenderer() {
|
||||
this.mStylesRenderer.clear();
|
||||
}
|
||||
|
||||
protected void storeData(HashMap<String, KmlStyle> map, HashMap<String, String> map2, HashMap<KmlPlacemark, Object> map3, ArrayList<KmlContainer> arrayList, HashMap<KmlGroundOverlay, GroundOverlay> map4) {
|
||||
this.mStyles = map;
|
||||
this.mStyleMaps = map2;
|
||||
this.mFeatures.putAll(map3);
|
||||
this.mContainers = arrayList;
|
||||
this.mGroundOverlayMap = map4;
|
||||
}
|
||||
|
||||
protected void addFeature(Feature feature) {
|
||||
Object objAddGeoJsonFeatureToMap = FEATURE_NOT_ON_MAP;
|
||||
if (feature instanceof GeoJsonFeature) {
|
||||
setFeatureDefaultStyles((GeoJsonFeature) feature);
|
||||
}
|
||||
if (this.mLayerOnMap) {
|
||||
if (this.mFeatures.containsKey(feature)) {
|
||||
removeFromMap(this.mFeatures.get(feature));
|
||||
}
|
||||
if (feature.hasGeometry()) {
|
||||
if (feature instanceof KmlPlacemark) {
|
||||
KmlPlacemark kmlPlacemark = (KmlPlacemark) feature;
|
||||
objAddGeoJsonFeatureToMap = addKmlPlacemarkToMap(kmlPlacemark, feature.getGeometry(), getPlacemarkStyle(feature.getId()), kmlPlacemark.getInlineStyle(), getPlacemarkVisibility(feature));
|
||||
} else {
|
||||
objAddGeoJsonFeatureToMap = addGeoJsonFeatureToMap(feature, feature.getGeometry());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mFeatures.put(feature, objAddGeoJsonFeatureToMap);
|
||||
}
|
||||
|
||||
protected void removeFromMap(Object obj) {
|
||||
if (obj instanceof Marker) {
|
||||
this.mMarkers.remove((Marker) obj);
|
||||
return;
|
||||
}
|
||||
if (obj instanceof Polyline) {
|
||||
this.mPolylines.remove((Polyline) obj);
|
||||
return;
|
||||
}
|
||||
if (obj instanceof Polygon) {
|
||||
this.mPolygons.remove((Polygon) obj);
|
||||
return;
|
||||
}
|
||||
if (obj instanceof GroundOverlay) {
|
||||
this.mGroundOverlays.remove((GroundOverlay) obj);
|
||||
} else if (obj instanceof ArrayList) {
|
||||
Iterator it = ((ArrayList) obj).iterator();
|
||||
while (it.hasNext()) {
|
||||
removeFromMap(it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
|
||||
protected Object addGeoJsonFeatureToMap(Feature feature, Geometry geometry) {
|
||||
String geometryType = geometry.getGeometryType();
|
||||
geometryType.hashCode();
|
||||
byte b = -1;
|
||||
switch (geometryType.hashCode()) {
|
||||
case -2116761119:
|
||||
if (geometryType.equals("MultiPolygon")) {
|
||||
b = 0;
|
||||
}
|
||||
break;
|
||||
case -1065891849:
|
||||
if (geometryType.equals("MultiPoint")) {
|
||||
b = 1;
|
||||
}
|
||||
break;
|
||||
case -627102946:
|
||||
if (geometryType.equals("MultiLineString")) {
|
||||
b = 2;
|
||||
}
|
||||
break;
|
||||
case 77292912:
|
||||
if (geometryType.equals("Point")) {
|
||||
b = 3;
|
||||
}
|
||||
break;
|
||||
case 1267133722:
|
||||
if (geometryType.equals(KmlPolygon.GEOMETRY_TYPE)) {
|
||||
b = 4;
|
||||
}
|
||||
break;
|
||||
case 1806700869:
|
||||
if (geometryType.equals("LineString")) {
|
||||
b = 5;
|
||||
}
|
||||
break;
|
||||
case 1950410960:
|
||||
if (geometryType.equals("GeometryCollection")) {
|
||||
b = 6;
|
||||
}
|
||||
break;
|
||||
}
|
||||
MarkerOptions markerOptions = null;
|
||||
PolylineOptions polylineOptions = null;
|
||||
PolygonOptions polygonOptions = null;
|
||||
switch (b) {
|
||||
case 0:
|
||||
return addMultiPolygonToMap(((GeoJsonFeature) feature).getPolygonStyle(), (GeoJsonMultiPolygon) geometry);
|
||||
case 1:
|
||||
return addMultiPointToMap(((GeoJsonFeature) feature).getPointStyle(), (GeoJsonMultiPoint) geometry);
|
||||
case 2:
|
||||
return addMultiLineStringToMap(((GeoJsonFeature) feature).getLineStringStyle(), (GeoJsonMultiLineString) geometry);
|
||||
case 3:
|
||||
if (feature instanceof GeoJsonFeature) {
|
||||
markerOptions = ((GeoJsonFeature) feature).getMarkerOptions();
|
||||
} else if (feature instanceof KmlPlacemark) {
|
||||
markerOptions = ((KmlPlacemark) feature).getMarkerOptions();
|
||||
}
|
||||
return addPointToMap(markerOptions, (GeoJsonPoint) geometry);
|
||||
case 4:
|
||||
if (feature instanceof GeoJsonFeature) {
|
||||
polygonOptions = ((GeoJsonFeature) feature).getPolygonOptions();
|
||||
} else if (feature instanceof KmlPlacemark) {
|
||||
polygonOptions = ((KmlPlacemark) feature).getPolygonOptions();
|
||||
}
|
||||
return addPolygonToMap(polygonOptions, (DataPolygon) geometry);
|
||||
case 5:
|
||||
if (feature instanceof GeoJsonFeature) {
|
||||
polylineOptions = ((GeoJsonFeature) feature).getPolylineOptions();
|
||||
} else if (feature instanceof KmlPlacemark) {
|
||||
polylineOptions = ((KmlPlacemark) feature).getPolylineOptions();
|
||||
}
|
||||
return addLineStringToMap(polylineOptions, (GeoJsonLineString) geometry);
|
||||
case 6:
|
||||
return addGeometryCollectionToMap((GeoJsonFeature) feature, ((GeoJsonGeometryCollection) geometry).getGeometries());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Object addKmlPlacemarkToMap(KmlPlacemark kmlPlacemark, Geometry geometry, KmlStyle kmlStyle, KmlStyle kmlStyle2, boolean z) {
|
||||
boolean zHasProperty;
|
||||
float f;
|
||||
String geometryType = geometry.getGeometryType();
|
||||
zHasProperty = kmlPlacemark.hasProperty("drawOrder");
|
||||
f = 0.0f;
|
||||
if (zHasProperty) {
|
||||
try {
|
||||
f = Float.parseFloat(kmlPlacemark.getProperty("drawOrder"));
|
||||
} catch (NumberFormatException unused) {
|
||||
zHasProperty = false;
|
||||
}
|
||||
}
|
||||
geometryType.hashCode();
|
||||
switch (geometryType) {
|
||||
case "Point":
|
||||
MarkerOptions markerOptions = kmlStyle.getMarkerOptions();
|
||||
if (kmlStyle2 != null) {
|
||||
setInlinePointStyle(markerOptions, kmlStyle2, kmlStyle);
|
||||
} else if (kmlStyle.getIconUrl() != null) {
|
||||
addMarkerIcons(kmlStyle.getIconUrl(), kmlStyle.getIconScale(), markerOptions);
|
||||
}
|
||||
Marker markerAddPointToMap = addPointToMap(markerOptions, (KmlPoint) geometry);
|
||||
markerAddPointToMap.setVisible(z);
|
||||
setMarkerInfoWindow(kmlStyle, markerAddPointToMap, kmlPlacemark);
|
||||
if (zHasProperty) {
|
||||
markerAddPointToMap.setZIndex(f);
|
||||
}
|
||||
return markerAddPointToMap;
|
||||
case "MultiGeometry":
|
||||
return addMultiGeometryToMap(kmlPlacemark, (KmlMultiGeometry) geometry, kmlStyle, kmlStyle2, z);
|
||||
case "Polygon":
|
||||
PolygonOptions polygonOptions = kmlStyle.getPolygonOptions();
|
||||
if (kmlStyle2 != null) {
|
||||
setInlinePolygonStyle(polygonOptions, kmlStyle2);
|
||||
} else if (kmlStyle.isPolyRandomColorMode()) {
|
||||
polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor()));
|
||||
}
|
||||
Polygon polygonAddPolygonToMap = addPolygonToMap(polygonOptions, (DataPolygon) geometry);
|
||||
polygonAddPolygonToMap.setVisible(z);
|
||||
if (zHasProperty) {
|
||||
polygonAddPolygonToMap.setZIndex(f);
|
||||
}
|
||||
return polygonAddPolygonToMap;
|
||||
case "LineString":
|
||||
PolylineOptions polylineOptions = kmlStyle.getPolylineOptions();
|
||||
if (kmlStyle2 != null) {
|
||||
setInlineLineStringStyle(polylineOptions, kmlStyle2);
|
||||
} else if (kmlStyle.isLineRandomColorMode()) {
|
||||
polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions.getColor()));
|
||||
}
|
||||
Polyline polylineAddLineStringToMap = addLineStringToMap(polylineOptions, (LineString) geometry);
|
||||
polylineAddLineStringToMap.setVisible(z);
|
||||
if (zHasProperty) {
|
||||
polylineAddLineStringToMap.setZIndex(f);
|
||||
}
|
||||
return polylineAddLineStringToMap;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Marker addPointToMap(MarkerOptions markerOptions, Point point) {
|
||||
markerOptions.position(point.getGeometryObject());
|
||||
return this.mMarkers.addMarker(markerOptions);
|
||||
}
|
||||
|
||||
private void setInlinePointStyle(MarkerOptions markerOptions, KmlStyle kmlStyle, KmlStyle kmlStyle2) {
|
||||
double iconScale;
|
||||
MarkerOptions markerOptions2 = kmlStyle.getMarkerOptions();
|
||||
if (kmlStyle.isStyleSet("heading")) {
|
||||
markerOptions.rotation(markerOptions2.getRotation());
|
||||
}
|
||||
if (kmlStyle.isStyleSet("hotSpot")) {
|
||||
markerOptions.anchor(markerOptions2.getAnchorU(), markerOptions2.getAnchorV());
|
||||
}
|
||||
if (kmlStyle.isStyleSet("markerColor")) {
|
||||
markerOptions.icon(markerOptions2.getIcon());
|
||||
}
|
||||
if (kmlStyle.isStyleSet("iconScale")) {
|
||||
iconScale = kmlStyle.getIconScale();
|
||||
} else {
|
||||
iconScale = kmlStyle2.isStyleSet("iconScale") ? kmlStyle2.getIconScale() : 1.0d;
|
||||
}
|
||||
if (kmlStyle.isStyleSet("iconUrl")) {
|
||||
addMarkerIcons(kmlStyle.getIconUrl(), iconScale, markerOptions);
|
||||
} else if (kmlStyle2.getIconUrl() != null) {
|
||||
addMarkerIcons(kmlStyle2.getIconUrl(), iconScale, markerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
private Polyline addLineStringToMap(PolylineOptions polylineOptions, LineString lineString) {
|
||||
polylineOptions.addAll(lineString.getGeometryObject());
|
||||
Polyline polylineAddPolyline = this.mPolylines.addPolyline(polylineOptions);
|
||||
polylineAddPolyline.setClickable(polylineOptions.isClickable());
|
||||
return polylineAddPolyline;
|
||||
}
|
||||
|
||||
private void setInlineLineStringStyle(PolylineOptions polylineOptions, KmlStyle kmlStyle) {
|
||||
PolylineOptions polylineOptions2 = kmlStyle.getPolylineOptions();
|
||||
if (kmlStyle.isStyleSet("outlineColor")) {
|
||||
polylineOptions.color(polylineOptions2.getColor());
|
||||
}
|
||||
if (kmlStyle.isStyleSet("width")) {
|
||||
polylineOptions.width(polylineOptions2.getWidth());
|
||||
}
|
||||
if (kmlStyle.isLineRandomColorMode()) {
|
||||
polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions2.getColor()));
|
||||
}
|
||||
}
|
||||
|
||||
private Polygon addPolygonToMap(PolygonOptions polygonOptions, DataPolygon dataPolygon) {
|
||||
polygonOptions.addAll(dataPolygon.getOuterBoundaryCoordinates());
|
||||
Iterator<List<LatLng>> it = dataPolygon.getInnerBoundaryCoordinates().iterator();
|
||||
while (it.hasNext()) {
|
||||
polygonOptions.addHole(it.next());
|
||||
}
|
||||
Polygon polygonAddPolygon = this.mPolygons.addPolygon(polygonOptions);
|
||||
polygonAddPolygon.setClickable(polygonOptions.isClickable());
|
||||
return polygonAddPolygon;
|
||||
}
|
||||
|
||||
private void setInlinePolygonStyle(PolygonOptions polygonOptions, KmlStyle kmlStyle) {
|
||||
PolygonOptions polygonOptions2 = kmlStyle.getPolygonOptions();
|
||||
if (kmlStyle.hasFill() && kmlStyle.isStyleSet("fillColor")) {
|
||||
polygonOptions.fillColor(polygonOptions2.getFillColor());
|
||||
}
|
||||
if (kmlStyle.hasOutline()) {
|
||||
if (kmlStyle.isStyleSet("outlineColor")) {
|
||||
polygonOptions.strokeColor(polygonOptions2.getStrokeColor());
|
||||
}
|
||||
if (kmlStyle.isStyleSet("width")) {
|
||||
polygonOptions.strokeWidth(polygonOptions2.getStrokeWidth());
|
||||
}
|
||||
}
|
||||
if (kmlStyle.isPolyRandomColorMode()) {
|
||||
polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions2.getFillColor()));
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<Object> addGeometryCollectionToMap(GeoJsonFeature geoJsonFeature, List<Geometry> list) {
|
||||
ArrayList<Object> arrayList = new ArrayList<>();
|
||||
Iterator<Geometry> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(addGeoJsonFeatureToMap(geoJsonFeature, it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
protected static boolean getPlacemarkVisibility(Feature feature) {
|
||||
return (feature.hasProperty("visibility") && Integer.parseInt(feature.getProperty("visibility")) == 0) ? false : true;
|
||||
}
|
||||
|
||||
public void assignStyleMap(HashMap<String, String> map, HashMap<String, KmlStyle> map2) {
|
||||
for (String str : map.keySet()) {
|
||||
String str2 = map.get(str);
|
||||
if (map2.containsKey(str2)) {
|
||||
map2.put(str, map2.get(str2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<Object> addMultiGeometryToMap(KmlPlacemark kmlPlacemark, KmlMultiGeometry kmlMultiGeometry, KmlStyle kmlStyle, KmlStyle kmlStyle2, boolean z) {
|
||||
ArrayList<Object> arrayList = new ArrayList<>();
|
||||
Iterator<Geometry> it = kmlMultiGeometry.getGeometryObject().iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(addKmlPlacemarkToMap(kmlPlacemark, it.next(), kmlStyle, kmlStyle2, z));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private ArrayList<Marker> addMultiPointToMap(GeoJsonPointStyle geoJsonPointStyle, GeoJsonMultiPoint geoJsonMultiPoint) {
|
||||
ArrayList<Marker> arrayList = new ArrayList<>();
|
||||
Iterator<GeoJsonPoint> it = geoJsonMultiPoint.getPoints().iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(addPointToMap(geoJsonPointStyle.toMarkerOptions(), it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private ArrayList<Polyline> addMultiLineStringToMap(GeoJsonLineStringStyle geoJsonLineStringStyle, GeoJsonMultiLineString geoJsonMultiLineString) {
|
||||
ArrayList<Polyline> arrayList = new ArrayList<>();
|
||||
Iterator<GeoJsonLineString> it = geoJsonMultiLineString.getLineStrings().iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(addLineStringToMap(geoJsonLineStringStyle.toPolylineOptions(), it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private ArrayList<Polygon> addMultiPolygonToMap(GeoJsonPolygonStyle geoJsonPolygonStyle, GeoJsonMultiPolygon geoJsonMultiPolygon) {
|
||||
ArrayList<Polygon> arrayList = new ArrayList<>();
|
||||
Iterator<GeoJsonPolygon> it = geoJsonMultiPolygon.getPolygons().iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(addPolygonToMap(geoJsonPolygonStyle.toPolygonOptions(), it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private void addMarkerIcons(String str, double d, MarkerOptions markerOptions) {
|
||||
BitmapDescriptor cachedMarkerImage = getCachedMarkerImage(str, d);
|
||||
if (cachedMarkerImage != null) {
|
||||
markerOptions.icon(cachedMarkerImage);
|
||||
} else {
|
||||
this.mMarkerIconUrls.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
protected GroundOverlay attachGroundOverlay(GroundOverlayOptions groundOverlayOptions) {
|
||||
return this.mGroundOverlays.addGroundOverlay(groundOverlayOptions);
|
||||
}
|
||||
|
||||
private void setMarkerInfoWindow(KmlStyle kmlStyle, Marker marker, KmlPlacemark kmlPlacemark) {
|
||||
boolean zHasProperty = kmlPlacemark.hasProperty("name");
|
||||
boolean zHasProperty2 = kmlPlacemark.hasProperty("description");
|
||||
boolean zHasBalloonStyle = kmlStyle.hasBalloonStyle();
|
||||
boolean zContainsKey = kmlStyle.getBalloonOptions().containsKey("text");
|
||||
if (zHasBalloonStyle && zContainsKey) {
|
||||
marker.setTitle(KmlUtil.substituteProperties(kmlStyle.getBalloonOptions().get("text"), kmlPlacemark));
|
||||
createInfoWindow();
|
||||
return;
|
||||
}
|
||||
if (zHasBalloonStyle && zHasProperty) {
|
||||
marker.setTitle(kmlPlacemark.getProperty("name"));
|
||||
createInfoWindow();
|
||||
return;
|
||||
}
|
||||
if (zHasProperty && zHasProperty2) {
|
||||
marker.setTitle(kmlPlacemark.getProperty("name"));
|
||||
marker.setSnippet(kmlPlacemark.getProperty("description"));
|
||||
createInfoWindow();
|
||||
} else if (zHasProperty2) {
|
||||
marker.setTitle(kmlPlacemark.getProperty("description"));
|
||||
createInfoWindow();
|
||||
} else if (zHasProperty) {
|
||||
marker.setTitle(kmlPlacemark.getProperty("name"));
|
||||
createInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void createInfoWindow() {
|
||||
this.mMarkers.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { // from class: com.google.maps.android.data.Renderer.1
|
||||
@Override // com.google.android.gms.maps.GoogleMap.InfoWindowAdapter
|
||||
public View getInfoWindow(Marker marker) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.maps.GoogleMap.InfoWindowAdapter
|
||||
public View getInfoContents(Marker marker) {
|
||||
View viewInflate = LayoutInflater.from(Renderer.this.mContext).inflate(R.layout.amu_info_window, (ViewGroup) null);
|
||||
TextView textView = (TextView) viewInflate.findViewById(R.id.window);
|
||||
if (marker.getSnippet() != null) {
|
||||
textView.setText(Html.fromHtml(marker.getTitle() + "<br>" + marker.getSnippet()));
|
||||
} else {
|
||||
textView.setText(Html.fromHtml(marker.getTitle()));
|
||||
}
|
||||
return viewInflate;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void setOnFeatureClickListener(final Layer.OnFeatureClickListener onFeatureClickListener) {
|
||||
this.mPolygons.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() { // from class: com.google.maps.android.data.Renderer$$ExternalSyntheticLambda0
|
||||
@Override // com.google.android.gms.maps.GoogleMap.OnPolygonClickListener
|
||||
public final void onPolygonClick(Polygon polygon) {
|
||||
this.f$0.m7872x2cc520ac(onFeatureClickListener, polygon);
|
||||
}
|
||||
});
|
||||
this.mMarkers.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { // from class: com.google.maps.android.data.Renderer$$ExternalSyntheticLambda1
|
||||
@Override // com.google.android.gms.maps.GoogleMap.OnMarkerClickListener
|
||||
public final boolean onMarkerClick(Marker marker) {
|
||||
return this.f$0.m7873xf5c617ed(onFeatureClickListener, marker);
|
||||
}
|
||||
});
|
||||
this.mPolylines.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() { // from class: com.google.maps.android.data.Renderer$$ExternalSyntheticLambda2
|
||||
@Override // com.google.android.gms.maps.GoogleMap.OnPolylineClickListener
|
||||
public final void onPolylineClick(Polyline polyline) {
|
||||
this.f$0.m7874xbec70f2e(onFeatureClickListener, polyline);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$setOnFeatureClickListener$0$com-google-maps-android-data-Renderer, reason: not valid java name */
|
||||
/* synthetic */ void m7872x2cc520ac(Layer.OnFeatureClickListener onFeatureClickListener, Polygon polygon) {
|
||||
if (getFeature(polygon) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getFeature(polygon));
|
||||
} else if (getContainerFeature(polygon) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getContainerFeature(polygon));
|
||||
} else {
|
||||
onFeatureClickListener.onFeatureClick(getFeature(multiObjectHandler(polygon)));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$setOnFeatureClickListener$1$com-google-maps-android-data-Renderer, reason: not valid java name */
|
||||
/* synthetic */ boolean m7873xf5c617ed(Layer.OnFeatureClickListener onFeatureClickListener, Marker marker) {
|
||||
if (getFeature(marker) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getFeature(marker));
|
||||
return false;
|
||||
}
|
||||
if (getContainerFeature(marker) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getContainerFeature(marker));
|
||||
return false;
|
||||
}
|
||||
onFeatureClickListener.onFeatureClick(getFeature(multiObjectHandler(marker)));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$setOnFeatureClickListener$2$com-google-maps-android-data-Renderer, reason: not valid java name */
|
||||
/* synthetic */ void m7874xbec70f2e(Layer.OnFeatureClickListener onFeatureClickListener, Polyline polyline) {
|
||||
if (getFeature(polyline) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getFeature(polyline));
|
||||
} else if (getContainerFeature(polyline) != null) {
|
||||
onFeatureClickListener.onFeatureClick(getContainerFeature(polyline));
|
||||
} else {
|
||||
onFeatureClickListener.onFeatureClick(getFeature(multiObjectHandler(polyline)));
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<?> multiObjectHandler(Object obj) {
|
||||
for (Object obj2 : getValues()) {
|
||||
if (obj2.getClass().getSimpleName().equals("ArrayList")) {
|
||||
ArrayList<?> arrayList = (ArrayList) obj2;
|
||||
if (arrayList.contains(obj)) {
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.google.maps.android.data;
|
||||
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import java.util.Observable;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public abstract class Style extends Observable {
|
||||
protected MarkerOptions mMarkerOptions = new MarkerOptions();
|
||||
protected PolygonOptions mPolygonOptions;
|
||||
protected PolylineOptions mPolylineOptions;
|
||||
|
||||
public Style() {
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
this.mPolylineOptions = polylineOptions;
|
||||
polylineOptions.clickable(true);
|
||||
PolygonOptions polygonOptions = new PolygonOptions();
|
||||
this.mPolygonOptions = polygonOptions;
|
||||
polygonOptions.clickable(true);
|
||||
}
|
||||
|
||||
public float getRotation() {
|
||||
return this.mMarkerOptions.getRotation();
|
||||
}
|
||||
|
||||
public void setMarkerRotation(float f) {
|
||||
this.mMarkerOptions.rotation(f);
|
||||
}
|
||||
|
||||
public void setMarkerHotSpot(float f, float f2, String str, String str2) {
|
||||
if (!str.equals("fraction")) {
|
||||
f = 0.5f;
|
||||
}
|
||||
if (!str2.equals("fraction")) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
this.mMarkerOptions.anchor(f, f2);
|
||||
}
|
||||
|
||||
public void setLineStringWidth(float f) {
|
||||
this.mPolylineOptions.width(f);
|
||||
}
|
||||
|
||||
public void setPolygonStrokeWidth(float f) {
|
||||
this.mPolygonOptions.strokeWidth(f);
|
||||
}
|
||||
|
||||
public void setPolygonFillColor(int i) {
|
||||
this.mPolygonOptions.fillColor(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class BiMultiMap<K> extends HashMap<K, Object> {
|
||||
private final Map<Object, K> mValuesToKeys = new HashMap();
|
||||
|
||||
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
||||
public void putAll(Map<? extends K, ?> map) {
|
||||
for (Map.Entry<? extends K, ?> entry : map.entrySet()) {
|
||||
put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
||||
public Object put(K k, Object obj) {
|
||||
if (obj instanceof Collection) {
|
||||
return put((Object) k, (Collection) obj);
|
||||
}
|
||||
this.mValuesToKeys.put(obj, k);
|
||||
return super.put(k, obj);
|
||||
}
|
||||
|
||||
public Object put(K k, Collection collection) {
|
||||
Iterator it = collection.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.mValuesToKeys.put(it.next(), k);
|
||||
}
|
||||
return super.put((Object) k, collection);
|
||||
}
|
||||
|
||||
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
||||
public Object remove(Object obj) {
|
||||
Object objRemove = super.remove(obj);
|
||||
if (objRemove instanceof Collection) {
|
||||
Iterator it = ((Collection) objRemove).iterator();
|
||||
while (it.hasNext()) {
|
||||
this.mValuesToKeys.remove(it.next());
|
||||
}
|
||||
} else {
|
||||
this.mValuesToKeys.remove(objRemove);
|
||||
}
|
||||
return objRemove;
|
||||
}
|
||||
|
||||
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.mValuesToKeys.clear();
|
||||
}
|
||||
|
||||
@Override // java.util.HashMap, java.util.AbstractMap
|
||||
public BiMultiMap<K> clone() {
|
||||
BiMultiMap<K> biMultiMap = new BiMultiMap<>();
|
||||
biMultiMap.putAll((Map) super.clone());
|
||||
return biMultiMap;
|
||||
}
|
||||
|
||||
public K getKey(Object obj) {
|
||||
return this.mValuesToKeys.get(obj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.android.data.Feature;
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonFeature extends Feature implements Observer {
|
||||
private final LatLngBounds mBoundingBox;
|
||||
private GeoJsonLineStringStyle mLineStringStyle;
|
||||
private GeoJsonPointStyle mPointStyle;
|
||||
private GeoJsonPolygonStyle mPolygonStyle;
|
||||
|
||||
public GeoJsonFeature(Geometry geometry, String str, HashMap<String, String> map, LatLngBounds latLngBounds) {
|
||||
super(geometry, str, map);
|
||||
this.mId = str;
|
||||
this.mBoundingBox = latLngBounds;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Feature
|
||||
public String setProperty(String str, String str2) {
|
||||
return super.setProperty(str, str2);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Feature
|
||||
public String removeProperty(String str) {
|
||||
return super.removeProperty(str);
|
||||
}
|
||||
|
||||
public GeoJsonPointStyle getPointStyle() {
|
||||
return this.mPointStyle;
|
||||
}
|
||||
|
||||
public void setPointStyle(GeoJsonPointStyle geoJsonPointStyle) {
|
||||
if (geoJsonPointStyle == null) {
|
||||
throw new IllegalArgumentException("Point style cannot be null");
|
||||
}
|
||||
GeoJsonPointStyle geoJsonPointStyle2 = this.mPointStyle;
|
||||
if (geoJsonPointStyle2 != null) {
|
||||
geoJsonPointStyle2.deleteObserver(this);
|
||||
}
|
||||
this.mPointStyle = geoJsonPointStyle;
|
||||
geoJsonPointStyle.addObserver(this);
|
||||
checkRedrawFeature(this.mPointStyle);
|
||||
}
|
||||
|
||||
public GeoJsonLineStringStyle getLineStringStyle() {
|
||||
return this.mLineStringStyle;
|
||||
}
|
||||
|
||||
public void setLineStringStyle(GeoJsonLineStringStyle geoJsonLineStringStyle) {
|
||||
if (geoJsonLineStringStyle == null) {
|
||||
throw new IllegalArgumentException("Line string style cannot be null");
|
||||
}
|
||||
GeoJsonLineStringStyle geoJsonLineStringStyle2 = this.mLineStringStyle;
|
||||
if (geoJsonLineStringStyle2 != null) {
|
||||
geoJsonLineStringStyle2.deleteObserver(this);
|
||||
}
|
||||
this.mLineStringStyle = geoJsonLineStringStyle;
|
||||
geoJsonLineStringStyle.addObserver(this);
|
||||
checkRedrawFeature(this.mLineStringStyle);
|
||||
}
|
||||
|
||||
public GeoJsonPolygonStyle getPolygonStyle() {
|
||||
return this.mPolygonStyle;
|
||||
}
|
||||
|
||||
public void setPolygonStyle(GeoJsonPolygonStyle geoJsonPolygonStyle) {
|
||||
if (geoJsonPolygonStyle == null) {
|
||||
throw new IllegalArgumentException("Polygon style cannot be null");
|
||||
}
|
||||
GeoJsonPolygonStyle geoJsonPolygonStyle2 = this.mPolygonStyle;
|
||||
if (geoJsonPolygonStyle2 != null) {
|
||||
geoJsonPolygonStyle2.deleteObserver(this);
|
||||
}
|
||||
this.mPolygonStyle = geoJsonPolygonStyle;
|
||||
geoJsonPolygonStyle.addObserver(this);
|
||||
checkRedrawFeature(this.mPolygonStyle);
|
||||
}
|
||||
|
||||
public PolygonOptions getPolygonOptions() {
|
||||
return this.mPolygonStyle.toPolygonOptions();
|
||||
}
|
||||
|
||||
public MarkerOptions getMarkerOptions() {
|
||||
return this.mPointStyle.toMarkerOptions();
|
||||
}
|
||||
|
||||
public PolylineOptions getPolylineOptions() {
|
||||
return this.mLineStringStyle.toPolylineOptions();
|
||||
}
|
||||
|
||||
private void checkRedrawFeature(GeoJsonStyle geoJsonStyle) {
|
||||
if (hasGeometry() && Arrays.asList(geoJsonStyle.getGeometryType()).contains(getGeometry().getGeometryType())) {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Feature
|
||||
public void setGeometry(Geometry geometry) {
|
||||
super.setGeometry(geometry);
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public LatLngBounds getBoundingBox() {
|
||||
return this.mBoundingBox;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Feature{\n bounding box=");
|
||||
sb.append(this.mBoundingBox);
|
||||
sb.append(",\n geometry=").append(getGeometry());
|
||||
sb.append(",\n point style=").append(this.mPointStyle);
|
||||
sb.append(",\n line string style=").append(this.mLineStringStyle);
|
||||
sb.append(",\n polygon style=").append(this.mPolygonStyle);
|
||||
sb.append(",\n id=").append(this.mId);
|
||||
sb.append(",\n properties=").append(getProperties());
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // java.util.Observer
|
||||
public void update(Observable observable, Object obj) {
|
||||
if (observable instanceof GeoJsonStyle) {
|
||||
checkRedrawFeature((GeoJsonStyle) observable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonGeometryCollection extends MultiGeometry {
|
||||
public GeoJsonGeometryCollection(List<Geometry> list) {
|
||||
super(list);
|
||||
setGeometryType("GeometryCollection");
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public List<Geometry> getGeometries() {
|
||||
return getGeometryObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.maps.android.collections.GroundOverlayManager;
|
||||
import com.google.maps.android.collections.MarkerManager;
|
||||
import com.google.maps.android.collections.PolygonManager;
|
||||
import com.google.maps.android.collections.PolylineManager;
|
||||
import com.google.maps.android.data.Feature;
|
||||
import com.google.maps.android.data.Layer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonLayer extends Layer {
|
||||
private LatLngBounds mBoundingBox;
|
||||
|
||||
public interface GeoJsonOnFeatureClickListener extends Layer.OnFeatureClickListener {
|
||||
}
|
||||
|
||||
public GeoJsonLayer(GoogleMap googleMap, JSONObject jSONObject, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) {
|
||||
if (jSONObject == null) {
|
||||
throw new IllegalArgumentException("GeoJSON file cannot be null");
|
||||
}
|
||||
this.mBoundingBox = null;
|
||||
GeoJsonParser geoJsonParser = new GeoJsonParser(jSONObject);
|
||||
this.mBoundingBox = geoJsonParser.getBoundingBox();
|
||||
HashMap map = new HashMap();
|
||||
Iterator<GeoJsonFeature> it = geoJsonParser.getFeatures().iterator();
|
||||
while (it.hasNext()) {
|
||||
map.put(it.next(), null);
|
||||
}
|
||||
storeRenderer(new GeoJsonRenderer(googleMap, map, markerManager, polygonManager, polylineManager, groundOverlayManager));
|
||||
}
|
||||
|
||||
public GeoJsonLayer(GoogleMap googleMap, int i, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) throws JSONException, IOException {
|
||||
this(googleMap, createJsonFileObject(context.getResources().openRawResource(i)), markerManager, polygonManager, polylineManager, groundOverlayManager);
|
||||
}
|
||||
|
||||
public GeoJsonLayer(GoogleMap googleMap, JSONObject jSONObject) {
|
||||
this(googleMap, jSONObject, null, null, null, null);
|
||||
}
|
||||
|
||||
public GeoJsonLayer(GoogleMap googleMap, int i, Context context) throws JSONException, IOException {
|
||||
this(googleMap, createJsonFileObject(context.getResources().openRawResource(i)), null, null, null, null);
|
||||
}
|
||||
|
||||
private static JSONObject createJsonFileObject(InputStream inputStream) throws JSONException, IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
while (true) {
|
||||
String line = bufferedReader.readLine();
|
||||
if (line != null) {
|
||||
sb.append(line);
|
||||
} else {
|
||||
bufferedReader.close();
|
||||
return new JSONObject(sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public void addLayerToMap() {
|
||||
super.addGeoJsonToMap();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public Iterable<GeoJsonFeature> getFeatures() {
|
||||
return super.getFeatures();
|
||||
}
|
||||
|
||||
public void addFeature(GeoJsonFeature geoJsonFeature) {
|
||||
if (geoJsonFeature == null) {
|
||||
throw new IllegalArgumentException("Feature cannot be null");
|
||||
}
|
||||
super.addFeature((Feature) geoJsonFeature);
|
||||
}
|
||||
|
||||
public void removeFeature(GeoJsonFeature geoJsonFeature) {
|
||||
if (geoJsonFeature == null) {
|
||||
throw new IllegalArgumentException("Feature cannot be null");
|
||||
}
|
||||
super.removeFeature((Feature) geoJsonFeature);
|
||||
}
|
||||
|
||||
public LatLngBounds getBoundingBox() {
|
||||
return this.mBoundingBox;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Collection{\n Bounding box=" + this.mBoundingBox + "\n}\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.LineString;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonLineString extends LineString {
|
||||
private final List<Double> mAltitudes;
|
||||
|
||||
public GeoJsonLineString(List<LatLng> list) {
|
||||
this(list, null);
|
||||
}
|
||||
|
||||
public GeoJsonLineString(List<LatLng> list, List<Double> list2) {
|
||||
super(list);
|
||||
this.mAltitudes = list2;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public List<LatLng> getCoordinates() {
|
||||
return getGeometryObject();
|
||||
}
|
||||
|
||||
public List<Double> getAltitudes() {
|
||||
return this.mAltitudes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.PatternItem;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.android.data.Style;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonLineStringStyle extends Style implements GeoJsonStyle {
|
||||
private static final String[] GEOMETRY_TYPE = {"LineString", "MultiLineString", "GeometryCollection"};
|
||||
|
||||
public GeoJsonLineStringStyle() {
|
||||
this.mPolylineOptions = new PolylineOptions();
|
||||
this.mPolylineOptions.clickable(true);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public String[] getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.mPolylineOptions.getColor();
|
||||
}
|
||||
|
||||
public void setColor(int i) {
|
||||
this.mPolylineOptions.color(i);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isClickable() {
|
||||
return this.mPolylineOptions.isClickable();
|
||||
}
|
||||
|
||||
public void setClickable(boolean z) {
|
||||
this.mPolylineOptions.clickable(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isGeodesic() {
|
||||
return this.mPolylineOptions.isGeodesic();
|
||||
}
|
||||
|
||||
public void setGeodesic(boolean z) {
|
||||
this.mPolylineOptions.geodesic(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return this.mPolylineOptions.getWidth();
|
||||
}
|
||||
|
||||
public void setWidth(float f) {
|
||||
setLineStringWidth(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return this.mPolylineOptions.getZIndex();
|
||||
}
|
||||
|
||||
public void setZIndex(float f) {
|
||||
this.mPolylineOptions.zIndex(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public boolean isVisible() {
|
||||
return this.mPolylineOptions.isVisible();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public void setVisible(boolean z) {
|
||||
this.mPolylineOptions.visible(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
private void styleChanged() {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public PolylineOptions toPolylineOptions() {
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.color(this.mPolylineOptions.getColor());
|
||||
polylineOptions.clickable(this.mPolylineOptions.isClickable());
|
||||
polylineOptions.geodesic(this.mPolylineOptions.isGeodesic());
|
||||
polylineOptions.visible(this.mPolylineOptions.isVisible());
|
||||
polylineOptions.width(this.mPolylineOptions.getWidth());
|
||||
polylineOptions.zIndex(this.mPolylineOptions.getZIndex());
|
||||
polylineOptions.pattern(getPattern());
|
||||
return polylineOptions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("LineStringStyle{\n geometry type=");
|
||||
sb.append(Arrays.toString(GEOMETRY_TYPE));
|
||||
sb.append(",\n color=").append(getColor());
|
||||
sb.append(",\n clickable=").append(isClickable());
|
||||
sb.append(",\n geodesic=").append(isGeodesic());
|
||||
sb.append(",\n visible=").append(isVisible());
|
||||
sb.append(",\n width=").append(getWidth());
|
||||
sb.append(",\n z index=").append(getZIndex());
|
||||
sb.append(",\n pattern=").append(getPattern());
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public List<PatternItem> getPattern() {
|
||||
return this.mPolylineOptions.getPattern();
|
||||
}
|
||||
|
||||
public void setPattern(List<PatternItem> list) {
|
||||
this.mPolylineOptions.pattern(list);
|
||||
styleChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonMultiLineString extends MultiGeometry {
|
||||
public GeoJsonMultiLineString(List<GeoJsonLineString> list) {
|
||||
super(list);
|
||||
setGeometryType("MultiLineString");
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public List<GeoJsonLineString> getLineStrings() {
|
||||
List geometryObject = getGeometryObject();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator it = geometryObject.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add((GeoJsonLineString) ((Geometry) it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonMultiPoint extends MultiGeometry {
|
||||
public GeoJsonMultiPoint(List<GeoJsonPoint> list) {
|
||||
super(list);
|
||||
setGeometryType("MultiPoint");
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public List<GeoJsonPoint> getPoints() {
|
||||
List geometryObject = getGeometryObject();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator it = geometryObject.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add((GeoJsonPoint) ((Geometry) it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonMultiPolygon extends MultiGeometry {
|
||||
public GeoJsonMultiPolygon(List<GeoJsonPolygon> list) {
|
||||
super(list);
|
||||
setGeometryType("MultiPolygon");
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public List<GeoJsonPolygon> getPolygons() {
|
||||
List geometryObject = getGeometryObject();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator it = geometryObject.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add((GeoJsonPolygon) ((Geometry) it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonParser {
|
||||
private static final String BOUNDING_BOX = "bbox";
|
||||
private static final String FEATURE = "Feature";
|
||||
private static final String FEATURE_COLLECTION = "FeatureCollection";
|
||||
private static final String FEATURE_COLLECTION_ARRAY = "features";
|
||||
private static final String FEATURE_GEOMETRY = "geometry";
|
||||
private static final String FEATURE_ID = "id";
|
||||
private static final String GEOMETRY_COLLECTION = "GeometryCollection";
|
||||
private static final String GEOMETRY_COLLECTION_ARRAY = "geometries";
|
||||
private static final String GEOMETRY_COORDINATES_ARRAY = "coordinates";
|
||||
private static final String LINESTRING = "LineString";
|
||||
private static final String LOG_TAG = "GeoJsonParser";
|
||||
private static final String MULTILINESTRING = "MultiLineString";
|
||||
private static final String MULTIPOINT = "MultiPoint";
|
||||
private static final String MULTIPOLYGON = "MultiPolygon";
|
||||
private static final String POINT = "Point";
|
||||
private static final String POLYGON = "Polygon";
|
||||
private static final String PROPERTIES = "properties";
|
||||
private final JSONObject mGeoJsonFile;
|
||||
private final ArrayList<GeoJsonFeature> mGeoJsonFeatures = new ArrayList<>();
|
||||
private LatLngBounds mBoundingBox = null;
|
||||
|
||||
private static class LatLngAlt {
|
||||
public final Double altitude;
|
||||
public final LatLng latLng;
|
||||
|
||||
LatLngAlt(LatLng latLng, Double d) {
|
||||
this.latLng = latLng;
|
||||
this.altitude = d;
|
||||
}
|
||||
}
|
||||
|
||||
public GeoJsonParser(JSONObject jSONObject) {
|
||||
this.mGeoJsonFile = jSONObject;
|
||||
parseGeoJson();
|
||||
}
|
||||
|
||||
private static boolean isGeometry(String str) {
|
||||
return str.matches("Point|MultiPoint|LineString|MultiLineString|Polygon|MultiPolygon|GeometryCollection");
|
||||
}
|
||||
|
||||
private static GeoJsonFeature parseFeature(JSONObject jSONObject) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
try {
|
||||
String string = jSONObject.has(FEATURE_ID) ? jSONObject.getString(FEATURE_ID) : null;
|
||||
LatLngBounds boundingBox = jSONObject.has(BOUNDING_BOX) ? parseBoundingBox(jSONObject.getJSONArray(BOUNDING_BOX)) : null;
|
||||
Geometry geometry = (!jSONObject.has(FEATURE_GEOMETRY) || jSONObject.isNull(FEATURE_GEOMETRY)) ? null : parseGeometry(jSONObject.getJSONObject(FEATURE_GEOMETRY));
|
||||
if (jSONObject.has(PROPERTIES) && !jSONObject.isNull(PROPERTIES)) {
|
||||
map = parseProperties(jSONObject.getJSONObject(PROPERTIES));
|
||||
}
|
||||
return new GeoJsonFeature(geometry, string, map, boundingBox);
|
||||
} catch (JSONException unused) {
|
||||
Log.w(LOG_TAG, "Feature could not be successfully parsed " + jSONObject.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static LatLngBounds parseBoundingBox(JSONArray jSONArray) throws JSONException {
|
||||
return new LatLngBounds(new LatLng(jSONArray.getDouble(1), jSONArray.getDouble(0)), new LatLng(jSONArray.getDouble(3), jSONArray.getDouble(2)));
|
||||
}
|
||||
|
||||
public static Geometry parseGeometry(JSONObject jSONObject) {
|
||||
String string;
|
||||
JSONArray jSONArray;
|
||||
try {
|
||||
string = jSONObject.getString("type");
|
||||
} catch (JSONException unused) {
|
||||
}
|
||||
if (string.equals(GEOMETRY_COLLECTION)) {
|
||||
jSONArray = jSONObject.getJSONArray(GEOMETRY_COLLECTION_ARRAY);
|
||||
} else {
|
||||
if (isGeometry(string)) {
|
||||
jSONArray = jSONObject.getJSONArray(GEOMETRY_COORDINATES_ARRAY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createGeometry(string, jSONArray);
|
||||
}
|
||||
|
||||
private static GeoJsonFeature parseGeometryToFeature(JSONObject jSONObject) {
|
||||
Geometry geometry = parseGeometry(jSONObject);
|
||||
if (geometry != null) {
|
||||
return new GeoJsonFeature(geometry, null, new HashMap(), null);
|
||||
}
|
||||
Log.w(LOG_TAG, "Geometry could not be parsed");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HashMap<String, String> parseProperties(JSONObject jSONObject) throws JSONException {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
Iterator<String> itKeys = jSONObject.keys();
|
||||
while (itKeys.hasNext()) {
|
||||
String next = itKeys.next();
|
||||
map.put(next, jSONObject.isNull(next) ? null : jSONObject.getString(next));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Geometry createGeometry(String str, JSONArray jSONArray) throws JSONException {
|
||||
str.hashCode();
|
||||
switch (str) {
|
||||
case "MultiPolygon":
|
||||
return createMultiPolygon(jSONArray);
|
||||
case "MultiPoint":
|
||||
return createMultiPoint(jSONArray);
|
||||
case "MultiLineString":
|
||||
return createMultiLineString(jSONArray);
|
||||
case "Point":
|
||||
return createPoint(jSONArray);
|
||||
case "Polygon":
|
||||
return createPolygon(jSONArray);
|
||||
case "LineString":
|
||||
return createLineString(jSONArray);
|
||||
case "GeometryCollection":
|
||||
return createGeometryCollection(jSONArray);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static GeoJsonPoint createPoint(JSONArray jSONArray) throws JSONException {
|
||||
LatLngAlt coordinate = parseCoordinate(jSONArray);
|
||||
return new GeoJsonPoint(coordinate.latLng, coordinate.altitude);
|
||||
}
|
||||
|
||||
private static GeoJsonMultiPoint createMultiPoint(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
arrayList.add(createPoint(jSONArray.getJSONArray(i)));
|
||||
}
|
||||
return new GeoJsonMultiPoint(arrayList);
|
||||
}
|
||||
|
||||
private static GeoJsonLineString createLineString(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList<LatLngAlt> coordinatesArray = parseCoordinatesArray(jSONArray);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
for (LatLngAlt latLngAlt : coordinatesArray) {
|
||||
arrayList.add(latLngAlt.latLng);
|
||||
if (latLngAlt.altitude != null) {
|
||||
arrayList2.add(latLngAlt.altitude);
|
||||
}
|
||||
}
|
||||
return new GeoJsonLineString(arrayList, arrayList2);
|
||||
}
|
||||
|
||||
private static GeoJsonMultiLineString createMultiLineString(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
arrayList.add(createLineString(jSONArray.getJSONArray(i)));
|
||||
}
|
||||
return new GeoJsonMultiLineString(arrayList);
|
||||
}
|
||||
|
||||
private static GeoJsonPolygon createPolygon(JSONArray jSONArray) throws JSONException {
|
||||
return new GeoJsonPolygon(parseCoordinatesArrays(jSONArray));
|
||||
}
|
||||
|
||||
private static GeoJsonMultiPolygon createMultiPolygon(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
arrayList.add(createPolygon(jSONArray.getJSONArray(i)));
|
||||
}
|
||||
return new GeoJsonMultiPolygon(arrayList);
|
||||
}
|
||||
|
||||
private static GeoJsonGeometryCollection createGeometryCollection(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
Geometry geometry = parseGeometry(jSONArray.getJSONObject(i));
|
||||
if (geometry != null) {
|
||||
arrayList.add(geometry);
|
||||
}
|
||||
}
|
||||
return new GeoJsonGeometryCollection(arrayList);
|
||||
}
|
||||
|
||||
private static LatLngAlt parseCoordinate(JSONArray jSONArray) throws JSONException {
|
||||
return new LatLngAlt(new LatLng(jSONArray.getDouble(1), jSONArray.getDouble(0)), jSONArray.length() < 3 ? null : Double.valueOf(jSONArray.getDouble(2)));
|
||||
}
|
||||
|
||||
private static ArrayList<LatLngAlt> parseCoordinatesArray(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList<LatLngAlt> arrayList = new ArrayList<>();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
arrayList.add(parseCoordinate(jSONArray.getJSONArray(i)));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static ArrayList<ArrayList<LatLng>> parseCoordinatesArrays(JSONArray jSONArray) throws JSONException {
|
||||
ArrayList<ArrayList<LatLng>> arrayList = new ArrayList<>();
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
ArrayList<LatLngAlt> coordinatesArray = parseCoordinatesArray(jSONArray.getJSONArray(i));
|
||||
ArrayList<LatLng> arrayList2 = new ArrayList<>();
|
||||
Iterator<LatLngAlt> it = coordinatesArray.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList2.add(it.next().latLng);
|
||||
}
|
||||
arrayList.add(arrayList2);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private void parseGeoJson() {
|
||||
try {
|
||||
String string = this.mGeoJsonFile.getString("type");
|
||||
if (string.equals(FEATURE)) {
|
||||
GeoJsonFeature feature = parseFeature(this.mGeoJsonFile);
|
||||
if (feature != null) {
|
||||
this.mGeoJsonFeatures.add(feature);
|
||||
}
|
||||
} else if (string.equals(FEATURE_COLLECTION)) {
|
||||
this.mGeoJsonFeatures.addAll(parseFeatureCollection(this.mGeoJsonFile));
|
||||
} else if (isGeometry(string)) {
|
||||
GeoJsonFeature geometryToFeature = parseGeometryToFeature(this.mGeoJsonFile);
|
||||
if (geometryToFeature != null) {
|
||||
this.mGeoJsonFeatures.add(geometryToFeature);
|
||||
}
|
||||
} else {
|
||||
Log.w(LOG_TAG, "GeoJSON file could not be parsed.");
|
||||
}
|
||||
} catch (JSONException unused) {
|
||||
Log.w(LOG_TAG, "GeoJSON file could not be parsed.");
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<GeoJsonFeature> parseFeatureCollection(JSONObject jSONObject) {
|
||||
ArrayList<GeoJsonFeature> arrayList = new ArrayList<>();
|
||||
try {
|
||||
JSONArray jSONArray = jSONObject.getJSONArray(FEATURE_COLLECTION_ARRAY);
|
||||
if (jSONObject.has(BOUNDING_BOX)) {
|
||||
this.mBoundingBox = parseBoundingBox(jSONObject.getJSONArray(BOUNDING_BOX));
|
||||
}
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
try {
|
||||
JSONObject jSONObject2 = jSONArray.getJSONObject(i);
|
||||
if (jSONObject2.getString("type").equals(FEATURE)) {
|
||||
GeoJsonFeature feature = parseFeature(jSONObject2);
|
||||
if (feature == null) {
|
||||
Log.w(LOG_TAG, "Index of Feature in Feature Collection that could not be created: " + i);
|
||||
} else {
|
||||
arrayList.add(feature);
|
||||
}
|
||||
}
|
||||
} catch (JSONException unused) {
|
||||
Log.w(LOG_TAG, "Index of Feature in Feature Collection that could not be created: " + i);
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
} catch (JSONException unused2) {
|
||||
Log.w(LOG_TAG, "Feature Collection could not be created.");
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<GeoJsonFeature> getFeatures() {
|
||||
return this.mGeoJsonFeatures;
|
||||
}
|
||||
|
||||
public LatLngBounds getBoundingBox() {
|
||||
return this.mBoundingBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.Point;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonPoint extends Point {
|
||||
private final Double mAltitude;
|
||||
|
||||
public GeoJsonPoint(LatLng latLng) {
|
||||
this(latLng, null);
|
||||
}
|
||||
|
||||
public GeoJsonPoint(LatLng latLng, Double d) {
|
||||
super(latLng);
|
||||
this.mAltitude = d;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return getGeometryType();
|
||||
}
|
||||
|
||||
public LatLng getCoordinates() {
|
||||
return getGeometryObject();
|
||||
}
|
||||
|
||||
public Double getAltitude() {
|
||||
return this.mAltitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.BitmapDescriptor;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.maps.android.data.Style;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonPointStyle extends Style implements GeoJsonStyle {
|
||||
private static final String[] GEOMETRY_TYPE = {"Point", "MultiPoint", "GeometryCollection"};
|
||||
|
||||
public GeoJsonPointStyle() {
|
||||
this.mMarkerOptions = new MarkerOptions();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public String[] getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return this.mMarkerOptions.getAlpha();
|
||||
}
|
||||
|
||||
public void setAlpha(float f) {
|
||||
this.mMarkerOptions.alpha(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getAnchorU() {
|
||||
return this.mMarkerOptions.getAnchorU();
|
||||
}
|
||||
|
||||
public float getAnchorV() {
|
||||
return this.mMarkerOptions.getAnchorV();
|
||||
}
|
||||
|
||||
public void setAnchor(float f, float f2) {
|
||||
setMarkerHotSpot(f, f2, "fraction", "fraction");
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isDraggable() {
|
||||
return this.mMarkerOptions.isDraggable();
|
||||
}
|
||||
|
||||
public void setDraggable(boolean z) {
|
||||
this.mMarkerOptions.draggable(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
return this.mMarkerOptions.isFlat();
|
||||
}
|
||||
|
||||
public void setFlat(boolean z) {
|
||||
this.mMarkerOptions.flat(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public BitmapDescriptor getIcon() {
|
||||
return this.mMarkerOptions.getIcon();
|
||||
}
|
||||
|
||||
public void setIcon(BitmapDescriptor bitmapDescriptor) {
|
||||
this.mMarkerOptions.icon(bitmapDescriptor);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getInfoWindowAnchorU() {
|
||||
return this.mMarkerOptions.getInfoWindowAnchorU();
|
||||
}
|
||||
|
||||
public float getInfoWindowAnchorV() {
|
||||
return this.mMarkerOptions.getInfoWindowAnchorV();
|
||||
}
|
||||
|
||||
public void setInfoWindowAnchor(float f, float f2) {
|
||||
this.mMarkerOptions.infoWindowAnchor(f, f2);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Style
|
||||
public float getRotation() {
|
||||
return this.mMarkerOptions.getRotation();
|
||||
}
|
||||
|
||||
public void setRotation(float f) {
|
||||
setMarkerRotation(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public String getSnippet() {
|
||||
return this.mMarkerOptions.getSnippet();
|
||||
}
|
||||
|
||||
public void setSnippet(String str) {
|
||||
this.mMarkerOptions.snippet(str);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.mMarkerOptions.getTitle();
|
||||
}
|
||||
|
||||
public void setTitle(String str) {
|
||||
this.mMarkerOptions.title(str);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public boolean isVisible() {
|
||||
return this.mMarkerOptions.isVisible();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public void setVisible(boolean z) {
|
||||
this.mMarkerOptions.visible(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
private void styleChanged() {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public MarkerOptions toMarkerOptions() {
|
||||
MarkerOptions markerOptions = new MarkerOptions();
|
||||
markerOptions.alpha(this.mMarkerOptions.getAlpha());
|
||||
markerOptions.anchor(this.mMarkerOptions.getAnchorU(), this.mMarkerOptions.getAnchorV());
|
||||
markerOptions.draggable(this.mMarkerOptions.isDraggable());
|
||||
markerOptions.flat(this.mMarkerOptions.isFlat());
|
||||
markerOptions.icon(this.mMarkerOptions.getIcon());
|
||||
markerOptions.infoWindowAnchor(this.mMarkerOptions.getInfoWindowAnchorU(), this.mMarkerOptions.getInfoWindowAnchorV());
|
||||
markerOptions.rotation(this.mMarkerOptions.getRotation());
|
||||
markerOptions.snippet(this.mMarkerOptions.getSnippet());
|
||||
markerOptions.title(this.mMarkerOptions.getTitle());
|
||||
markerOptions.visible(this.mMarkerOptions.isVisible());
|
||||
markerOptions.zIndex(this.mMarkerOptions.getZIndex());
|
||||
return markerOptions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("PointStyle{\n geometry type=");
|
||||
sb.append(Arrays.toString(GEOMETRY_TYPE));
|
||||
sb.append(",\n alpha=").append(getAlpha());
|
||||
sb.append(",\n anchor U=").append(getAnchorU());
|
||||
sb.append(",\n anchor V=").append(getAnchorV());
|
||||
sb.append(",\n draggable=").append(isDraggable());
|
||||
sb.append(",\n flat=").append(isFlat());
|
||||
sb.append(",\n info window anchor U=").append(getInfoWindowAnchorU());
|
||||
sb.append(",\n info window anchor V=").append(getInfoWindowAnchorV());
|
||||
sb.append(",\n rotation=").append(getRotation());
|
||||
sb.append(",\n snippet=").append(getSnippet());
|
||||
sb.append(",\n title=").append(getTitle());
|
||||
sb.append(",\n visible=").append(isVisible());
|
||||
sb.append(",\n z index=").append(getZIndex());
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return this.mMarkerOptions.getZIndex();
|
||||
}
|
||||
|
||||
public void setZIndex(float f) {
|
||||
this.mMarkerOptions.zIndex(f);
|
||||
styleChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.DataPolygon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonPolygon implements DataPolygon {
|
||||
private static final String GEOMETRY_TYPE = "Polygon";
|
||||
private static final int POLYGON_INNER_COORDINATE_INDEX = 1;
|
||||
private static final int POLYGON_OUTER_COORDINATE_INDEX = 0;
|
||||
private final List<? extends List<LatLng>> mCoordinates;
|
||||
|
||||
public GeoJsonPolygon(List<? extends List<LatLng>> list) {
|
||||
if (list == null) {
|
||||
throw new IllegalArgumentException("Coordinates cannot be null");
|
||||
}
|
||||
this.mCoordinates = list;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return "Polygon";
|
||||
}
|
||||
|
||||
public List<? extends List<LatLng>> getCoordinates() {
|
||||
return this.mCoordinates;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public List<? extends List<LatLng>> getGeometryObject() {
|
||||
return getCoordinates();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public String getGeometryType() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.DataPolygon
|
||||
public ArrayList<LatLng> getOuterBoundaryCoordinates() {
|
||||
return (ArrayList) getCoordinates().get(0);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.DataPolygon
|
||||
public ArrayList<ArrayList<LatLng>> getInnerBoundaryCoordinates() {
|
||||
ArrayList<ArrayList<LatLng>> arrayList = new ArrayList<>();
|
||||
for (int i = 1; i < getCoordinates().size(); i++) {
|
||||
arrayList.add((ArrayList) getCoordinates().get(i));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Polygon{\n coordinates=" + this.mCoordinates + "\n}\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.model.PatternItem;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.maps.android.data.Style;
|
||||
import com.google.maps.android.data.kml.KmlPolygon;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonPolygonStyle extends Style implements GeoJsonStyle {
|
||||
private static final String[] GEOMETRY_TYPE = {KmlPolygon.GEOMETRY_TYPE, "MultiPolygon", "GeometryCollection"};
|
||||
|
||||
public GeoJsonPolygonStyle() {
|
||||
this.mPolygonOptions = new PolygonOptions();
|
||||
this.mPolygonOptions.clickable(true);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public String[] getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
public int getFillColor() {
|
||||
return this.mPolygonOptions.getFillColor();
|
||||
}
|
||||
|
||||
public void setFillColor(int i) {
|
||||
setPolygonFillColor(i);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isGeodesic() {
|
||||
return this.mPolygonOptions.isGeodesic();
|
||||
}
|
||||
|
||||
public void setGeodesic(boolean z) {
|
||||
this.mPolygonOptions.geodesic(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public int getStrokeColor() {
|
||||
return this.mPolygonOptions.getStrokeColor();
|
||||
}
|
||||
|
||||
public void setStrokeColor(int i) {
|
||||
this.mPolygonOptions.strokeColor(i);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public int getStrokeJointType() {
|
||||
return this.mPolygonOptions.getStrokeJointType();
|
||||
}
|
||||
|
||||
public void setStrokeJointType(int i) {
|
||||
this.mPolygonOptions.strokeJointType(i);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public List<PatternItem> getStrokePattern() {
|
||||
return this.mPolygonOptions.getStrokePattern();
|
||||
}
|
||||
|
||||
public void setStrokePattern(List<PatternItem> list) {
|
||||
this.mPolygonOptions.strokePattern(list);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getStrokeWidth() {
|
||||
return this.mPolygonOptions.getStrokeWidth();
|
||||
}
|
||||
|
||||
public void setStrokeWidth(float f) {
|
||||
setPolygonStrokeWidth(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return this.mPolygonOptions.getZIndex();
|
||||
}
|
||||
|
||||
public void setZIndex(float f) {
|
||||
this.mPolygonOptions.zIndex(f);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public boolean isVisible() {
|
||||
return this.mPolygonOptions.isVisible();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.geojson.GeoJsonStyle
|
||||
public void setVisible(boolean z) {
|
||||
this.mPolygonOptions.visible(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
private void styleChanged() {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public PolygonOptions toPolygonOptions() {
|
||||
PolygonOptions polygonOptions = new PolygonOptions();
|
||||
polygonOptions.fillColor(this.mPolygonOptions.getFillColor());
|
||||
polygonOptions.geodesic(this.mPolygonOptions.isGeodesic());
|
||||
polygonOptions.strokeColor(this.mPolygonOptions.getStrokeColor());
|
||||
polygonOptions.strokeJointType(this.mPolygonOptions.getStrokeJointType());
|
||||
polygonOptions.strokePattern(this.mPolygonOptions.getStrokePattern());
|
||||
polygonOptions.strokeWidth(this.mPolygonOptions.getStrokeWidth());
|
||||
polygonOptions.visible(this.mPolygonOptions.isVisible());
|
||||
polygonOptions.zIndex(this.mPolygonOptions.getZIndex());
|
||||
polygonOptions.clickable(this.mPolygonOptions.isClickable());
|
||||
return polygonOptions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("PolygonStyle{\n geometry type=");
|
||||
sb.append(Arrays.toString(GEOMETRY_TYPE));
|
||||
sb.append(",\n fill color=").append(getFillColor());
|
||||
sb.append(",\n geodesic=").append(isGeodesic());
|
||||
sb.append(",\n stroke color=").append(getStrokeColor());
|
||||
sb.append(",\n stroke joint type=").append(getStrokeJointType());
|
||||
sb.append(",\n stroke pattern=").append(getStrokePattern());
|
||||
sb.append(",\n stroke width=").append(getStrokeWidth());
|
||||
sb.append(",\n visible=").append(isVisible());
|
||||
sb.append(",\n z index=").append(getZIndex());
|
||||
sb.append(",\n clickable=").append(isClickable());
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void setClickable(boolean z) {
|
||||
this.mPolygonOptions.clickable(z);
|
||||
styleChanged();
|
||||
}
|
||||
|
||||
public boolean isClickable() {
|
||||
return this.mPolygonOptions.isClickable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.maps.android.collections.GroundOverlayManager;
|
||||
import com.google.maps.android.collections.MarkerManager;
|
||||
import com.google.maps.android.collections.PolygonManager;
|
||||
import com.google.maps.android.collections.PolylineManager;
|
||||
import com.google.maps.android.data.Feature;
|
||||
import com.google.maps.android.data.Renderer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GeoJsonRenderer extends Renderer implements Observer {
|
||||
private static final Object FEATURE_NOT_ON_MAP = null;
|
||||
|
||||
GeoJsonRenderer(GoogleMap googleMap, HashMap<GeoJsonFeature, Object> map, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) {
|
||||
super(googleMap, map, markerManager, polygonManager, polylineManager, groundOverlayManager);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Renderer
|
||||
public void setMap(GoogleMap googleMap) {
|
||||
super.setMap(googleMap);
|
||||
Iterator<Feature> it = super.getFeatures().iterator();
|
||||
while (it.hasNext()) {
|
||||
redrawFeatureToMap((GeoJsonFeature) it.next(), googleMap);
|
||||
}
|
||||
}
|
||||
|
||||
public void addLayerToMap() {
|
||||
if (isLayerOnMap()) {
|
||||
return;
|
||||
}
|
||||
setLayerVisibility(true);
|
||||
Iterator<Feature> it = super.getFeatures().iterator();
|
||||
while (it.hasNext()) {
|
||||
addFeature((GeoJsonFeature) it.next());
|
||||
}
|
||||
}
|
||||
|
||||
public void addFeature(GeoJsonFeature geoJsonFeature) {
|
||||
super.addFeature((Feature) geoJsonFeature);
|
||||
if (isLayerOnMap()) {
|
||||
geoJsonFeature.addObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeLayerFromMap() {
|
||||
if (isLayerOnMap()) {
|
||||
for (Feature feature : super.getFeatures()) {
|
||||
removeFromMap(super.getAllFeatures().get(feature));
|
||||
feature.deleteObserver(this);
|
||||
}
|
||||
setLayerVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFeature(GeoJsonFeature geoJsonFeature) {
|
||||
super.removeFeature((Feature) geoJsonFeature);
|
||||
if (super.getFeatures().contains(geoJsonFeature)) {
|
||||
geoJsonFeature.deleteObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void redrawFeatureToMap(GeoJsonFeature geoJsonFeature) {
|
||||
redrawFeatureToMap(geoJsonFeature, getMap());
|
||||
}
|
||||
|
||||
private void redrawFeatureToMap(GeoJsonFeature geoJsonFeature, GoogleMap googleMap) {
|
||||
removeFromMap(getAllFeatures().get(geoJsonFeature));
|
||||
putFeatures(geoJsonFeature, FEATURE_NOT_ON_MAP);
|
||||
if (googleMap == null || !geoJsonFeature.hasGeometry()) {
|
||||
return;
|
||||
}
|
||||
putFeatures(geoJsonFeature, addGeoJsonFeatureToMap(geoJsonFeature, geoJsonFeature.getGeometry()));
|
||||
}
|
||||
|
||||
@Override // java.util.Observer
|
||||
public void update(Observable observable, Object obj) {
|
||||
if (observable instanceof GeoJsonFeature) {
|
||||
GeoJsonFeature geoJsonFeature = (GeoJsonFeature) observable;
|
||||
Object obj2 = getAllFeatures().get(geoJsonFeature);
|
||||
Object obj3 = FEATURE_NOT_ON_MAP;
|
||||
boolean z = obj2 != obj3;
|
||||
if (z && geoJsonFeature.hasGeometry()) {
|
||||
redrawFeatureToMap(geoJsonFeature);
|
||||
return;
|
||||
}
|
||||
if (z && !geoJsonFeature.hasGeometry()) {
|
||||
removeFromMap(getAllFeatures().get(geoJsonFeature));
|
||||
putFeatures(geoJsonFeature, obj3);
|
||||
} else {
|
||||
if (z || !geoJsonFeature.hasGeometry()) {
|
||||
return;
|
||||
}
|
||||
addFeature(geoJsonFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.google.maps.android.data.geojson;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
interface GeoJsonStyle {
|
||||
String[] getGeometryType();
|
||||
|
||||
boolean isVisible();
|
||||
|
||||
void setVisible(boolean z);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlBoolean {
|
||||
public static boolean parseBoolean(String str) {
|
||||
return "1".equals(str) || "true".equals(str);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.GroundOverlay;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlContainer {
|
||||
private String mContainerId;
|
||||
private final ArrayList<KmlContainer> mContainers;
|
||||
private final HashMap<KmlGroundOverlay, GroundOverlay> mGroundOverlays;
|
||||
private final HashMap<KmlPlacemark, Object> mPlacemarks;
|
||||
private final HashMap<String, String> mProperties;
|
||||
private final HashMap<String, String> mStyleMap;
|
||||
private HashMap<String, KmlStyle> mStyles;
|
||||
|
||||
KmlContainer(HashMap<String, String> map, HashMap<String, KmlStyle> map2, HashMap<KmlPlacemark, Object> map3, HashMap<String, String> map4, ArrayList<KmlContainer> arrayList, HashMap<KmlGroundOverlay, GroundOverlay> map5, String str) {
|
||||
this.mProperties = map;
|
||||
this.mPlacemarks = map3;
|
||||
this.mStyles = map2;
|
||||
this.mStyleMap = map4;
|
||||
this.mContainers = arrayList;
|
||||
this.mGroundOverlays = map5;
|
||||
this.mContainerId = str;
|
||||
}
|
||||
|
||||
HashMap<String, KmlStyle> getStyles() {
|
||||
return this.mStyles;
|
||||
}
|
||||
|
||||
void setPlacemark(KmlPlacemark kmlPlacemark, Object obj) {
|
||||
this.mPlacemarks.put(kmlPlacemark, obj);
|
||||
}
|
||||
|
||||
HashMap<String, String> getStyleMap() {
|
||||
return this.mStyleMap;
|
||||
}
|
||||
|
||||
HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlayHashMap() {
|
||||
return this.mGroundOverlays;
|
||||
}
|
||||
|
||||
public String getContainerId() {
|
||||
return this.mContainerId;
|
||||
}
|
||||
|
||||
public KmlStyle getStyle(String str) {
|
||||
return this.mStyles.get(str);
|
||||
}
|
||||
|
||||
public String getStyleIdFromMap(String str) {
|
||||
return this.mStyleMap.get(str);
|
||||
}
|
||||
|
||||
HashMap<KmlPlacemark, Object> getPlacemarksHashMap() {
|
||||
return this.mPlacemarks;
|
||||
}
|
||||
|
||||
public String getProperty(String str) {
|
||||
return this.mProperties.get(str);
|
||||
}
|
||||
|
||||
public boolean hasProperties() {
|
||||
return this.mProperties.size() > 0;
|
||||
}
|
||||
|
||||
public boolean hasProperty(String str) {
|
||||
return this.mProperties.containsKey(str);
|
||||
}
|
||||
|
||||
public boolean hasContainers() {
|
||||
return this.mContainers.size() > 0;
|
||||
}
|
||||
|
||||
public Iterable<KmlContainer> getContainers() {
|
||||
return this.mContainers;
|
||||
}
|
||||
|
||||
public Iterable<String> getProperties() {
|
||||
return this.mProperties.keySet();
|
||||
}
|
||||
|
||||
public Iterable<KmlPlacemark> getPlacemarks() {
|
||||
return this.mPlacemarks.keySet();
|
||||
}
|
||||
|
||||
public boolean hasPlacemarks() {
|
||||
return this.mPlacemarks.size() > 0;
|
||||
}
|
||||
|
||||
public Iterable<KmlGroundOverlay> getGroundOverlays() {
|
||||
return this.mGroundOverlays.keySet();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Container{\n properties=");
|
||||
sb.append(this.mProperties);
|
||||
sb.append(",\n placemarks=").append(this.mPlacemarks);
|
||||
sb.append(",\n containers=").append(this.mContainers);
|
||||
sb.append(",\n ground overlays=").append(this.mGroundOverlays);
|
||||
sb.append(",\n style maps=").append(this.mStyleMap);
|
||||
sb.append(",\n styles=").append(this.mStyles);
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
class KmlContainerParser {
|
||||
private static final String CONTAINER_REGEX = "Folder|Document";
|
||||
private static final String EXTENDED_DATA = "ExtendedData";
|
||||
private static final String GROUND_OVERLAY = "GroundOverlay";
|
||||
private static final String PLACEMARK = "Placemark";
|
||||
private static final String PROPERTY_REGEX = "name|description|visibility|open|address|phoneNumber";
|
||||
private static final String STYLE = "Style";
|
||||
private static final String STYLE_MAP = "StyleMap";
|
||||
private static final String UNSUPPORTED_REGEX = "altitude|altitudeModeGroup|altitudeMode|begin|bottomFov|cookie|displayName|displayMode|end|expires|extrude|flyToView|gridOrigin|httpQuery|leftFov|linkDescription|linkName|linkSnippet|listItemType|maxSnippetLines|maxSessionLength|message|minAltitude|minFadeExtent|minLodPixels|minRefreshPeriod|maxAltitude|maxFadeExtent|maxLodPixels|maxHeight|maxWidth|near|overlayXY|range|refreshMode|refreshInterval|refreshVisibility|rightFov|roll|rotationXY|screenXY|shape|sourceHref|state|targetHref|tessellate|tileSize|topFov|viewBoundScale|viewFormat|viewRefreshMode|viewRefreshTime|when";
|
||||
|
||||
KmlContainerParser() {
|
||||
}
|
||||
|
||||
static KmlContainer createContainer(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
return assignPropertiesToContainer(xmlPullParser);
|
||||
}
|
||||
|
||||
private static KmlContainer assignPropertiesToContainer(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
String name = xmlPullParser.getName();
|
||||
HashMap map = new HashMap();
|
||||
HashMap map2 = new HashMap();
|
||||
HashMap map3 = new HashMap();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
HashMap map4 = new HashMap();
|
||||
HashMap map5 = new HashMap();
|
||||
String attributeValue = xmlPullParser.getAttributeValue(null, "id") != null ? xmlPullParser.getAttributeValue(null, "id") : null;
|
||||
xmlPullParser.next();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals(name)) {
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().matches(UNSUPPORTED_REGEX)) {
|
||||
KmlParser.skip(xmlPullParser);
|
||||
} else if (xmlPullParser.getName().matches(CONTAINER_REGEX)) {
|
||||
arrayList.add(assignPropertiesToContainer(xmlPullParser));
|
||||
} else if (xmlPullParser.getName().matches(PROPERTY_REGEX)) {
|
||||
map.put(xmlPullParser.getName(), xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(STYLE_MAP)) {
|
||||
setContainerStyleMap(xmlPullParser, map4);
|
||||
} else if (xmlPullParser.getName().equals(STYLE)) {
|
||||
setContainerStyle(xmlPullParser, map2);
|
||||
} else if (xmlPullParser.getName().equals(PLACEMARK)) {
|
||||
setContainerPlacemark(xmlPullParser, map3);
|
||||
} else if (xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
setExtendedDataProperties(xmlPullParser, map);
|
||||
} else if (xmlPullParser.getName().equals(GROUND_OVERLAY)) {
|
||||
map5.put(KmlFeatureParser.createGroundOverlay(xmlPullParser), null);
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlContainer(map, map2, map3, map4, arrayList, map5, attributeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setContainerStyleMap(XmlPullParser xmlPullParser, HashMap<String, String> map) throws XmlPullParserException, IOException {
|
||||
map.putAll(KmlStyleParser.createStyleMap(xmlPullParser));
|
||||
}
|
||||
|
||||
private static void setExtendedDataProperties(XmlPullParser xmlPullParser, HashMap<String, String> map) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
String attributeValue = null;
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("Data")) {
|
||||
attributeValue = xmlPullParser.getAttributeValue(null, "name");
|
||||
} else if (xmlPullParser.getName().equals("value") && attributeValue != null) {
|
||||
map.put(attributeValue, xmlPullParser.nextText());
|
||||
attributeValue = null;
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setContainerStyle(XmlPullParser xmlPullParser, HashMap<String, KmlStyle> map) throws XmlPullParserException, IOException {
|
||||
if (xmlPullParser.getAttributeValue(null, "id") != null) {
|
||||
KmlStyle kmlStyleCreateStyle = KmlStyleParser.createStyle(xmlPullParser);
|
||||
map.put(kmlStyleCreateStyle.getStyleId(), kmlStyleCreateStyle);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setContainerPlacemark(XmlPullParser xmlPullParser, HashMap<KmlPlacemark, Object> map) throws XmlPullParserException, IOException {
|
||||
map.put(KmlFeatureParser.createPlacemark(xmlPullParser), null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
class KmlFeatureParser {
|
||||
private static final int ALTITUDE_INDEX = 2;
|
||||
private static final String BOUNDARY_REGEX = "outerBoundaryIs|innerBoundaryIs";
|
||||
private static final String COMPASS_REGEX = "north|south|east|west";
|
||||
private static final String EXTENDED_DATA = "ExtendedData";
|
||||
private static final String GEOMETRY_REGEX = "Point|LineString|Polygon|MultiGeometry|Track|MultiTrack";
|
||||
private static final int LATITUDE_INDEX = 1;
|
||||
private static final String LAT_LNG_ALT_SEPARATOR = ",";
|
||||
private static final int LONGITUDE_INDEX = 0;
|
||||
private static final String PROPERTY_REGEX = "name|description|drawOrder|visibility|open|address|phoneNumber";
|
||||
private static final String STYLE_TAG = "Style";
|
||||
private static final String STYLE_URL_TAG = "styleUrl";
|
||||
|
||||
KmlFeatureParser() {
|
||||
}
|
||||
|
||||
private static class LatLngAlt {
|
||||
public final Double altitude;
|
||||
public final LatLng latLng;
|
||||
|
||||
LatLngAlt(LatLng latLng, Double d) {
|
||||
this.latLng = latLng;
|
||||
this.altitude = d;
|
||||
}
|
||||
}
|
||||
|
||||
static KmlPlacemark createPlacemark(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
HashMap map = new HashMap();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
Geometry geometryCreateGeometry = null;
|
||||
String strNextText = null;
|
||||
KmlStyle kmlStyleCreateStyle = null;
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals("Placemark")) {
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals(STYLE_URL_TAG)) {
|
||||
strNextText = xmlPullParser.nextText();
|
||||
} else if (xmlPullParser.getName().matches(GEOMETRY_REGEX)) {
|
||||
geometryCreateGeometry = createGeometry(xmlPullParser, xmlPullParser.getName());
|
||||
} else if (xmlPullParser.getName().matches(PROPERTY_REGEX)) {
|
||||
map.put(xmlPullParser.getName(), xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
map.putAll(setExtendedDataProperties(xmlPullParser));
|
||||
} else if (xmlPullParser.getName().equals(STYLE_TAG)) {
|
||||
kmlStyleCreateStyle = KmlStyleParser.createStyle(xmlPullParser);
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlPlacemark(geometryCreateGeometry, strNextText, kmlStyleCreateStyle, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static KmlGroundOverlay createGroundOverlay(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
HashMap map = new HashMap();
|
||||
HashMap map2 = new HashMap();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
String imageUrl = null;
|
||||
float rotation = 0.0f;
|
||||
int i = 1;
|
||||
float f = 0.0f;
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals("GroundOverlay")) {
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("Icon")) {
|
||||
imageUrl = getImageUrl(xmlPullParser);
|
||||
} else if (xmlPullParser.getName().equals("drawOrder")) {
|
||||
f = Float.parseFloat(xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals("visibility")) {
|
||||
i = Integer.parseInt(xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
map.putAll(setExtendedDataProperties(xmlPullParser));
|
||||
} else if (xmlPullParser.getName().equals("rotation")) {
|
||||
rotation = getRotation(xmlPullParser);
|
||||
} else if (xmlPullParser.getName().matches(PROPERTY_REGEX) || xmlPullParser.getName().equals("color")) {
|
||||
map.put(xmlPullParser.getName(), xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().matches(COMPASS_REGEX)) {
|
||||
map2.put(xmlPullParser.getName(), Double.valueOf(Double.parseDouble(xmlPullParser.nextText())));
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlGroundOverlay(imageUrl, createLatLngBounds((Double) map2.get("north"), (Double) map2.get("south"), (Double) map2.get("east"), (Double) map2.get("west")), f, i, map, rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static float getRotation(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
return -Float.parseFloat(xmlPullParser.nextText());
|
||||
}
|
||||
|
||||
private static String getImageUrl(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("Icon")) {
|
||||
return null;
|
||||
}
|
||||
if (eventType == 2 && xmlPullParser.getName().equals("href")) {
|
||||
return xmlPullParser.nextText();
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static Geometry createGeometry(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals(str)) {
|
||||
return null;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("Point")) {
|
||||
return createPoint(xmlPullParser);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("LineString")) {
|
||||
return createLineString(xmlPullParser);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("Track")) {
|
||||
return createTrack(xmlPullParser);
|
||||
}
|
||||
if (xmlPullParser.getName().equals(KmlPolygon.GEOMETRY_TYPE)) {
|
||||
return createPolygon(xmlPullParser);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("MultiGeometry")) {
|
||||
return createMultiGeometry(xmlPullParser);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("MultiTrack")) {
|
||||
return createMultiTrack(xmlPullParser);
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static HashMap<String, String> setExtendedDataProperties(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
String attributeValue = null;
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
return map;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("Data")) {
|
||||
attributeValue = xmlPullParser.getAttributeValue(null, "name");
|
||||
} else if (xmlPullParser.getName().equals("value") && attributeValue != null) {
|
||||
map.put(attributeValue, xmlPullParser.nextText());
|
||||
attributeValue = null;
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlPoint createPoint(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
LatLngAlt latLngAltConvertToLatLngAlt = null;
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals("Point")) {
|
||||
if (eventType == 2 && xmlPullParser.getName().equals("coordinates")) {
|
||||
latLngAltConvertToLatLngAlt = convertToLatLngAlt(xmlPullParser.nextText());
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlPoint(latLngAltConvertToLatLngAlt.latLng, latLngAltConvertToLatLngAlt.altitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlLineString createLineString(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals("LineString")) {
|
||||
if (eventType == 2 && xmlPullParser.getName().equals("coordinates")) {
|
||||
for (LatLngAlt latLngAlt : convertToLatLngAltArray(xmlPullParser.nextText())) {
|
||||
arrayList.add(latLngAlt.latLng);
|
||||
if (latLngAlt.altitude != null) {
|
||||
arrayList2.add(latLngAlt.altitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlLineString(arrayList, arrayList2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlTrack createTrack(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault());
|
||||
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
ArrayList arrayList3 = new ArrayList();
|
||||
HashMap map = new HashMap();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals("Track")) {
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("coord")) {
|
||||
LatLngAlt latLngAltConvertToLatLngAlt = convertToLatLngAlt(xmlPullParser.nextText(), " ");
|
||||
arrayList.add(latLngAltConvertToLatLngAlt.latLng);
|
||||
if (latLngAltConvertToLatLngAlt.altitude != null) {
|
||||
arrayList2.add(latLngAltConvertToLatLngAlt.altitude);
|
||||
}
|
||||
} else if (xmlPullParser.getName().equals("when")) {
|
||||
try {
|
||||
arrayList3.add(Long.valueOf(simpleDateFormat.parse(xmlPullParser.nextText()).getTime()));
|
||||
} catch (ParseException e) {
|
||||
throw new XmlPullParserException("Invalid date", xmlPullParser, e);
|
||||
}
|
||||
} else if (xmlPullParser.getName().equals(EXTENDED_DATA)) {
|
||||
map.putAll(setExtendedDataProperties(xmlPullParser));
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlTrack(arrayList, arrayList2, arrayList3, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlPolygon createPolygon(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
ArrayList<LatLng> arrayList = new ArrayList<>();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
boolean zEquals = false;
|
||||
while (true) {
|
||||
if (eventType != 3 || !xmlPullParser.getName().equals(KmlPolygon.GEOMETRY_TYPE)) {
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().matches(BOUNDARY_REGEX)) {
|
||||
zEquals = xmlPullParser.getName().equals("outerBoundaryIs");
|
||||
} else if (xmlPullParser.getName().equals("coordinates")) {
|
||||
if (zEquals) {
|
||||
arrayList = convertToLatLngArray(xmlPullParser.nextText());
|
||||
} else {
|
||||
arrayList2.add(convertToLatLngArray(xmlPullParser.nextText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlPolygon(arrayList, arrayList2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlMultiGeometry createMultiGeometry(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
int next = xmlPullParser.next();
|
||||
while (true) {
|
||||
if (next != 3 || !xmlPullParser.getName().equals("MultiGeometry")) {
|
||||
if (next == 2 && xmlPullParser.getName().matches(GEOMETRY_REGEX)) {
|
||||
arrayList.add(createGeometry(xmlPullParser, xmlPullParser.getName()));
|
||||
}
|
||||
next = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlMultiGeometry(arrayList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlMultiTrack createMultiTrack(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
int next = xmlPullParser.next();
|
||||
while (true) {
|
||||
if (next != 3 || !xmlPullParser.getName().equals("MultiTrack")) {
|
||||
if (next == 2 && xmlPullParser.getName().matches("Track")) {
|
||||
arrayList.add(createTrack(xmlPullParser));
|
||||
}
|
||||
next = xmlPullParser.next();
|
||||
} else {
|
||||
return new KmlMultiTrack(arrayList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList<LatLng> convertToLatLngArray(String str) {
|
||||
ArrayList<LatLngAlt> arrayListConvertToLatLngAltArray = convertToLatLngAltArray(str);
|
||||
ArrayList<LatLng> arrayList = new ArrayList<>();
|
||||
Iterator<LatLngAlt> it = arrayListConvertToLatLngAltArray.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(it.next().latLng);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static ArrayList<LatLngAlt> convertToLatLngAltArray(String str) {
|
||||
ArrayList<LatLngAlt> arrayList = new ArrayList<>();
|
||||
for (String str2 : str.trim().split("(\\s+)")) {
|
||||
arrayList.add(convertToLatLngAlt(str2));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static LatLngAlt convertToLatLngAlt(String str) {
|
||||
return convertToLatLngAlt(str, LAT_LNG_ALT_SEPARATOR);
|
||||
}
|
||||
|
||||
private static LatLngAlt convertToLatLngAlt(String str, String str2) {
|
||||
String[] strArrSplit = str.split(str2);
|
||||
return new LatLngAlt(new LatLng(Double.parseDouble(strArrSplit[1]), Double.parseDouble(strArrSplit[0])), strArrSplit.length > 2 ? Double.valueOf(Double.parseDouble(strArrSplit[2])) : null);
|
||||
}
|
||||
|
||||
private static LatLngBounds createLatLngBounds(Double d, Double d2, Double d3, Double d4) {
|
||||
return new LatLngBounds(new LatLng(d2.doubleValue(), d4.doubleValue()), new LatLng(d.doubleValue(), d3.doubleValue()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.GroundOverlayOptions;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlGroundOverlay {
|
||||
private final GroundOverlayOptions mGroundOverlayOptions;
|
||||
private String mImageUrl;
|
||||
private LatLngBounds mLatLngBox;
|
||||
private final Map<String, String> mProperties;
|
||||
|
||||
KmlGroundOverlay(String str, LatLngBounds latLngBounds, float f, int i, HashMap<String, String> map, float f2) {
|
||||
GroundOverlayOptions groundOverlayOptions = new GroundOverlayOptions();
|
||||
this.mGroundOverlayOptions = groundOverlayOptions;
|
||||
this.mImageUrl = str;
|
||||
this.mProperties = map;
|
||||
if (latLngBounds == null) {
|
||||
throw new IllegalArgumentException("No LatLonBox given");
|
||||
}
|
||||
this.mLatLngBox = latLngBounds;
|
||||
groundOverlayOptions.positionFromBounds(latLngBounds);
|
||||
groundOverlayOptions.bearing(f2);
|
||||
groundOverlayOptions.zIndex(f);
|
||||
groundOverlayOptions.visible(i != 0);
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return this.mImageUrl;
|
||||
}
|
||||
|
||||
public LatLngBounds getLatLngBox() {
|
||||
return this.mLatLngBox;
|
||||
}
|
||||
|
||||
public Iterable<String> getProperties() {
|
||||
return this.mProperties.keySet();
|
||||
}
|
||||
|
||||
public String getProperty(String str) {
|
||||
return this.mProperties.get(str);
|
||||
}
|
||||
|
||||
public boolean hasProperty(String str) {
|
||||
return this.mProperties.get(str) != null;
|
||||
}
|
||||
|
||||
GroundOverlayOptions getGroundOverlayOptions() {
|
||||
return this.mGroundOverlayOptions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("GroundOverlay{\n properties=");
|
||||
sb.append(this.mProperties);
|
||||
sb.append(",\n image url=").append(this.mImageUrl);
|
||||
sb.append(",\n LatLngBox=").append(this.mLatLngBox);
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.maps.android.collections.GroundOverlayManager;
|
||||
import com.google.maps.android.collections.MarkerManager;
|
||||
import com.google.maps.android.collections.PolygonManager;
|
||||
import com.google.maps.android.collections.PolylineManager;
|
||||
import com.google.maps.android.data.Layer;
|
||||
import com.google.maps.android.data.Renderer;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlLayer extends Layer {
|
||||
public KmlLayer(GoogleMap googleMap, int i, Context context) throws XmlPullParserException, IOException {
|
||||
this(googleMap, context.getResources().openRawResource(i), context, new MarkerManager(googleMap), new PolygonManager(googleMap), new PolylineManager(googleMap), new GroundOverlayManager(googleMap), (Renderer.ImagesCache) null);
|
||||
}
|
||||
|
||||
public KmlLayer(GoogleMap googleMap, InputStream inputStream, Context context) throws XmlPullParserException, IOException {
|
||||
this(googleMap, inputStream, context, new MarkerManager(googleMap), new PolygonManager(googleMap), new PolylineManager(googleMap), new GroundOverlayManager(googleMap), (Renderer.ImagesCache) null);
|
||||
}
|
||||
|
||||
public KmlLayer(GoogleMap googleMap, int i, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager, Renderer.ImagesCache imagesCache) throws XmlPullParserException, IOException {
|
||||
this(googleMap, context.getResources().openRawResource(i), context, markerManager, polygonManager, polylineManager, groundOverlayManager, imagesCache);
|
||||
}
|
||||
|
||||
public KmlLayer(GoogleMap googleMap, InputStream inputStream, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager, Renderer.ImagesCache imagesCache) throws Throwable {
|
||||
if (inputStream == null) {
|
||||
throw new IllegalArgumentException("KML InputStream cannot be null");
|
||||
}
|
||||
KmlRenderer kmlRenderer = new KmlRenderer(googleMap, context, markerManager, polygonManager, polylineManager, groundOverlayManager, imagesCache);
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
|
||||
bufferedInputStream.mark(1024);
|
||||
ZipInputStream zipInputStream = new ZipInputStream(bufferedInputStream);
|
||||
try {
|
||||
ZipEntry nextEntry = zipInputStream.getNextEntry();
|
||||
if (nextEntry != null) {
|
||||
HashMap<String, Bitmap> map = new HashMap<>();
|
||||
KmlParser kml = null;
|
||||
while (nextEntry != null) {
|
||||
if (kml == null && nextEntry.getName().toLowerCase().endsWith(".kml")) {
|
||||
kml = parseKml(zipInputStream);
|
||||
} else {
|
||||
Bitmap bitmapDecodeStream = BitmapFactory.decodeStream(zipInputStream);
|
||||
if (bitmapDecodeStream != null) {
|
||||
map.put(nextEntry.getName(), bitmapDecodeStream);
|
||||
} else {
|
||||
Log.w("KmlLayer", "Unsupported KMZ contents file type: " + nextEntry.getName());
|
||||
}
|
||||
}
|
||||
nextEntry = zipInputStream.getNextEntry();
|
||||
}
|
||||
if (kml == null) {
|
||||
throw new IllegalArgumentException("KML not found in InputStream");
|
||||
}
|
||||
kmlRenderer.storeKmzData(kml.getStyles(), kml.getStyleMaps(), kml.getPlacemarks(), kml.getContainers(), kml.getGroundOverlays(), map);
|
||||
} else {
|
||||
bufferedInputStream.reset();
|
||||
KmlParser kml2 = parseKml(bufferedInputStream);
|
||||
kmlRenderer.storeKmlData(kml2.getStyles(), kml2.getStyleMaps(), kml2.getPlacemarks(), kml2.getContainers(), kml2.getGroundOverlays());
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
}
|
||||
try {
|
||||
storeRenderer(kmlRenderer);
|
||||
inputStream.close();
|
||||
bufferedInputStream.close();
|
||||
zipInputStream.close();
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
inputStream.close();
|
||||
bufferedInputStream.close();
|
||||
zipInputStream.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
private static KmlParser parseKml(InputStream inputStream) throws XmlPullParserException, IOException {
|
||||
KmlParser kmlParser = new KmlParser(createXmlParser(inputStream));
|
||||
kmlParser.parseKml();
|
||||
return kmlParser;
|
||||
}
|
||||
|
||||
private static XmlPullParser createXmlParser(InputStream inputStream) throws XmlPullParserException {
|
||||
XmlPullParserFactory xmlPullParserFactoryNewInstance = XmlPullParserFactory.newInstance();
|
||||
xmlPullParserFactoryNewInstance.setNamespaceAware(true);
|
||||
XmlPullParser xmlPullParserNewPullParser = xmlPullParserFactoryNewInstance.newPullParser();
|
||||
xmlPullParserNewPullParser.setInput(inputStream, null);
|
||||
return xmlPullParserNewPullParser;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public void addLayerToMap() {
|
||||
super.addKMLToMap();
|
||||
}
|
||||
|
||||
public boolean hasPlacemarks() {
|
||||
return hasFeatures();
|
||||
}
|
||||
|
||||
public Iterable<KmlPlacemark> getPlacemarks() {
|
||||
return getFeatures();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public boolean hasContainers() {
|
||||
return super.hasContainers();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public Iterable<KmlContainer> getContainers() {
|
||||
return super.getContainers();
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Layer
|
||||
public Iterable<KmlGroundOverlay> getGroundOverlays() {
|
||||
return super.getGroundOverlays();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.LineString;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlLineString extends LineString {
|
||||
private final ArrayList<Double> mAltitudes;
|
||||
|
||||
public KmlLineString(ArrayList<LatLng> arrayList) {
|
||||
this(arrayList, null);
|
||||
}
|
||||
|
||||
public KmlLineString(ArrayList<LatLng> arrayList, ArrayList<Double> arrayList2) {
|
||||
super(arrayList);
|
||||
this.mAltitudes = arrayList2;
|
||||
}
|
||||
|
||||
public ArrayList<Double> getAltitudes() {
|
||||
return this.mAltitudes;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.LineString, com.google.maps.android.data.Geometry
|
||||
public List<LatLng> getGeometryObject() {
|
||||
return new ArrayList(super.getGeometryObject());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlMultiGeometry extends MultiGeometry {
|
||||
public KmlMultiGeometry(ArrayList<Geometry> arrayList) {
|
||||
super(arrayList);
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.MultiGeometry, com.google.maps.android.data.Geometry
|
||||
public ArrayList<Geometry> getGeometryObject() {
|
||||
return new ArrayList<>(super.getGeometryObject());
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.MultiGeometry
|
||||
public String toString() {
|
||||
StringBuilder sbAppend = new StringBuilder(getGeometryType()).append("{\n geometries=");
|
||||
sbAppend.append(getGeometryObject());
|
||||
sbAppend.append("\n}\n");
|
||||
return sbAppend.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlMultiTrack extends KmlMultiGeometry {
|
||||
public KmlMultiTrack(ArrayList<KmlTrack> arrayList) {
|
||||
super(createGeometries(arrayList));
|
||||
}
|
||||
|
||||
private static ArrayList<Geometry> createGeometries(ArrayList<KmlTrack> arrayList) {
|
||||
ArrayList<Geometry> arrayList2 = new ArrayList<>();
|
||||
if (arrayList == null) {
|
||||
throw new IllegalArgumentException("Tracks cannot be null");
|
||||
}
|
||||
Iterator<KmlTrack> it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList2.add(it.next());
|
||||
}
|
||||
return arrayList2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.GroundOverlay;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
class KmlParser {
|
||||
private static final String CONTAINER_REGEX = "Folder|Document";
|
||||
private static final String GROUND_OVERLAY = "GroundOverlay";
|
||||
private static final String PLACEMARK = "Placemark";
|
||||
private static final String STYLE = "Style";
|
||||
private static final String STYLE_MAP = "StyleMap";
|
||||
private static final String UNSUPPORTED_REGEX = "altitude|altitudeModeGroup|altitudeMode|begin|bottomFov|cookie|displayName|displayMode|end|expires|extrude|flyToView|gridOrigin|httpQuery|leftFov|linkDescription|linkName|linkSnippet|listItemType|maxSnippetLines|maxSessionLength|message|minAltitude|minFadeExtent|minLodPixels|minRefreshPeriod|maxAltitude|maxFadeExtent|maxLodPixels|maxHeight|maxWidth|near|NetworkLink|NetworkLinkControl|overlayXY|range|refreshMode|refreshInterval|refreshVisibility|rightFov|roll|rotationXY|screenXY|shape|sourceHref|state|targetHref|tessellate|tileSize|topFov|viewBoundScale|viewFormat|viewRefreshMode|viewRefreshTime|when";
|
||||
private final XmlPullParser mParser;
|
||||
private final HashMap<KmlPlacemark, Object> mPlacemarks = new HashMap<>();
|
||||
private final ArrayList<KmlContainer> mContainers = new ArrayList<>();
|
||||
private final HashMap<String, KmlStyle> mStyles = new HashMap<>();
|
||||
private final HashMap<String, String> mStyleMaps = new HashMap<>();
|
||||
private final HashMap<KmlGroundOverlay, GroundOverlay> mGroundOverlays = new HashMap<>();
|
||||
|
||||
KmlParser(XmlPullParser xmlPullParser) {
|
||||
this.mParser = xmlPullParser;
|
||||
}
|
||||
|
||||
void parseKml() throws XmlPullParserException, IOException {
|
||||
int eventType = this.mParser.getEventType();
|
||||
while (eventType != 1) {
|
||||
if (eventType == 2) {
|
||||
if (this.mParser.getName().matches(UNSUPPORTED_REGEX)) {
|
||||
skip(this.mParser);
|
||||
}
|
||||
if (this.mParser.getName().matches(CONTAINER_REGEX)) {
|
||||
this.mContainers.add(KmlContainerParser.createContainer(this.mParser));
|
||||
}
|
||||
if (this.mParser.getName().equals(STYLE)) {
|
||||
KmlStyle kmlStyleCreateStyle = KmlStyleParser.createStyle(this.mParser);
|
||||
this.mStyles.put(kmlStyleCreateStyle.getStyleId(), kmlStyleCreateStyle);
|
||||
}
|
||||
if (this.mParser.getName().equals(STYLE_MAP)) {
|
||||
this.mStyleMaps.putAll(KmlStyleParser.createStyleMap(this.mParser));
|
||||
}
|
||||
if (this.mParser.getName().equals(PLACEMARK)) {
|
||||
this.mPlacemarks.put(KmlFeatureParser.createPlacemark(this.mParser), null);
|
||||
}
|
||||
if (this.mParser.getName().equals(GROUND_OVERLAY)) {
|
||||
this.mGroundOverlays.put(KmlFeatureParser.createGroundOverlay(this.mParser), null);
|
||||
}
|
||||
}
|
||||
eventType = this.mParser.next();
|
||||
}
|
||||
this.mStyles.put(null, new KmlStyle());
|
||||
}
|
||||
|
||||
HashMap<String, KmlStyle> getStyles() {
|
||||
return this.mStyles;
|
||||
}
|
||||
|
||||
HashMap<KmlPlacemark, Object> getPlacemarks() {
|
||||
return this.mPlacemarks;
|
||||
}
|
||||
|
||||
HashMap<String, String> getStyleMaps() {
|
||||
return this.mStyleMaps;
|
||||
}
|
||||
|
||||
ArrayList<KmlContainer> getContainers() {
|
||||
return this.mContainers;
|
||||
}
|
||||
|
||||
HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlays() {
|
||||
return this.mGroundOverlays;
|
||||
}
|
||||
|
||||
static void skip(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
if (xmlPullParser.getEventType() != 2) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
int i = 1;
|
||||
while (i != 0) {
|
||||
int next = xmlPullParser.next();
|
||||
if (next == 2) {
|
||||
i++;
|
||||
} else if (next == 3) {
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.android.data.Feature;
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import java.util.Map;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlPlacemark extends Feature {
|
||||
private final KmlStyle mInlineStyle;
|
||||
private final String mStyle;
|
||||
|
||||
public KmlPlacemark(Geometry geometry, String str, KmlStyle kmlStyle, Map<String, String> map) {
|
||||
super(geometry, str, map);
|
||||
this.mStyle = str;
|
||||
this.mInlineStyle = kmlStyle;
|
||||
}
|
||||
|
||||
public String getStyleId() {
|
||||
return super.getId();
|
||||
}
|
||||
|
||||
public KmlStyle getInlineStyle() {
|
||||
return this.mInlineStyle;
|
||||
}
|
||||
|
||||
public PolygonOptions getPolygonOptions() {
|
||||
KmlStyle kmlStyle = this.mInlineStyle;
|
||||
if (kmlStyle == null) {
|
||||
return null;
|
||||
}
|
||||
return kmlStyle.getPolygonOptions();
|
||||
}
|
||||
|
||||
public MarkerOptions getMarkerOptions() {
|
||||
KmlStyle kmlStyle = this.mInlineStyle;
|
||||
if (kmlStyle == null) {
|
||||
return null;
|
||||
}
|
||||
return kmlStyle.getMarkerOptions();
|
||||
}
|
||||
|
||||
public PolylineOptions getPolylineOptions() {
|
||||
KmlStyle kmlStyle = this.mInlineStyle;
|
||||
if (kmlStyle == null) {
|
||||
return null;
|
||||
}
|
||||
return kmlStyle.getPolylineOptions();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Placemark{\n style id=");
|
||||
sb.append(this.mStyle);
|
||||
sb.append(",\n inline style=").append(this.mInlineStyle);
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.Point;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlPoint extends Point {
|
||||
private final Double mAltitude;
|
||||
|
||||
public KmlPoint(LatLng latLng) {
|
||||
this(latLng, null);
|
||||
}
|
||||
|
||||
public KmlPoint(LatLng latLng, Double d) {
|
||||
super(latLng);
|
||||
this.mAltitude = d;
|
||||
}
|
||||
|
||||
public Double getAltitude() {
|
||||
return this.mAltitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.maps.android.data.DataPolygon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlPolygon implements DataPolygon<ArrayList<ArrayList<LatLng>>> {
|
||||
public static final String GEOMETRY_TYPE = "Polygon";
|
||||
private final List<List<LatLng>> mInnerBoundaryCoordinates;
|
||||
private final List<LatLng> mOuterBoundaryCoordinates;
|
||||
|
||||
public KmlPolygon(List<LatLng> list, List<List<LatLng>> list2) {
|
||||
if (list == null) {
|
||||
throw new IllegalArgumentException("Outer boundary coordinates cannot be null");
|
||||
}
|
||||
this.mOuterBoundaryCoordinates = list;
|
||||
this.mInnerBoundaryCoordinates = list2;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public String getGeometryType() {
|
||||
return GEOMETRY_TYPE;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Geometry
|
||||
public List<List<LatLng>> getGeometryObject() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(this.mOuterBoundaryCoordinates);
|
||||
List<List<LatLng>> list = this.mInnerBoundaryCoordinates;
|
||||
if (list != null) {
|
||||
arrayList.addAll(list);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.DataPolygon
|
||||
public List<LatLng> getOuterBoundaryCoordinates() {
|
||||
return this.mOuterBoundaryCoordinates;
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.DataPolygon
|
||||
public List<List<LatLng>> getInnerBoundaryCoordinates() {
|
||||
return this.mInnerBoundaryCoordinates;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Polygon{\n outer coordinates=");
|
||||
sb.append(this.mOuterBoundaryCoordinates);
|
||||
sb.append(",\n inner coordinates=").append(this.mInnerBoundaryCoordinates);
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptor;
|
||||
import com.google.android.gms.maps.model.GroundOverlay;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.maps.android.collections.GroundOverlayManager;
|
||||
import com.google.maps.android.collections.MarkerManager;
|
||||
import com.google.maps.android.collections.PolygonManager;
|
||||
import com.google.maps.android.collections.PolylineManager;
|
||||
import com.google.maps.android.data.Feature;
|
||||
import com.google.maps.android.data.Geometry;
|
||||
import com.google.maps.android.data.MultiGeometry;
|
||||
import com.google.maps.android.data.Renderer;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlRenderer extends Renderer {
|
||||
private static final String LOG_TAG = "KmlRenderer";
|
||||
private ArrayList<KmlContainer> mContainers;
|
||||
private boolean mGroundOverlayImagesDownloaded;
|
||||
private final Set<String> mGroundOverlayUrls;
|
||||
private boolean mMarkerIconsDownloaded;
|
||||
|
||||
KmlRenderer(GoogleMap googleMap, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager, Renderer.ImagesCache imagesCache) {
|
||||
super(googleMap, context, markerManager, polygonManager, polylineManager, groundOverlayManager, imagesCache);
|
||||
this.mGroundOverlayUrls = new HashSet();
|
||||
this.mMarkerIconsDownloaded = false;
|
||||
this.mGroundOverlayImagesDownloaded = false;
|
||||
}
|
||||
|
||||
private void removePlacemarks(HashMap<? extends Feature, Object> map) {
|
||||
removeFeatures(map);
|
||||
}
|
||||
|
||||
static boolean getContainerVisibility(KmlContainer kmlContainer, boolean z) {
|
||||
return z && (!kmlContainer.hasProperty("visibility") || Integer.parseInt(kmlContainer.getProperty("visibility")) != 0);
|
||||
}
|
||||
|
||||
private void removeContainers(Iterable<KmlContainer> iterable) {
|
||||
for (KmlContainer kmlContainer : iterable) {
|
||||
removePlacemarks(kmlContainer.getPlacemarksHashMap());
|
||||
removeGroundOverlays(kmlContainer.getGroundOverlayHashMap());
|
||||
removeContainers(kmlContainer.getContainers());
|
||||
}
|
||||
}
|
||||
|
||||
public void addLayerToMap() {
|
||||
setLayerVisibility(true);
|
||||
this.mContainers = getContainerList();
|
||||
putStyles();
|
||||
assignStyleMap(getStyleMaps(), getStylesRenderer());
|
||||
addGroundOverlays(getGroundOverlayMap(), this.mContainers);
|
||||
addContainerGroupToMap(this.mContainers, true);
|
||||
addPlacemarksToMap(getAllFeatures());
|
||||
if (!this.mGroundOverlayImagesDownloaded) {
|
||||
downloadGroundOverlays();
|
||||
}
|
||||
if (!this.mMarkerIconsDownloaded) {
|
||||
downloadMarkerIcons();
|
||||
}
|
||||
checkClearBitmapCache();
|
||||
}
|
||||
|
||||
void storeKmlData(HashMap<String, KmlStyle> map, HashMap<String, String> map2, HashMap<KmlPlacemark, Object> map3, ArrayList<KmlContainer> arrayList, HashMap<KmlGroundOverlay, GroundOverlay> map4) {
|
||||
storeData(map, map2, map3, arrayList, map4);
|
||||
}
|
||||
|
||||
void storeKmzData(HashMap<String, KmlStyle> map, HashMap<String, String> map2, HashMap<KmlPlacemark, Object> map3, ArrayList<KmlContainer> arrayList, HashMap<KmlGroundOverlay, GroundOverlay> map4, HashMap<String, Bitmap> map5) {
|
||||
storeData(map, map2, map3, arrayList, map4);
|
||||
for (Map.Entry<String, Bitmap> entry : map5.entrySet()) {
|
||||
cacheBitmap(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.maps.android.data.Renderer
|
||||
public void setMap(GoogleMap googleMap) {
|
||||
removeLayerFromMap();
|
||||
super.setMap(googleMap);
|
||||
addLayerToMap();
|
||||
}
|
||||
|
||||
boolean hasKmlPlacemarks() {
|
||||
return hasFeatures();
|
||||
}
|
||||
|
||||
Iterable<? extends Feature> getKmlPlacemarks() {
|
||||
return getFeatures();
|
||||
}
|
||||
|
||||
public boolean hasNestedContainers() {
|
||||
return this.mContainers.size() > 0;
|
||||
}
|
||||
|
||||
public Iterable<KmlContainer> getNestedContainers() {
|
||||
return this.mContainers;
|
||||
}
|
||||
|
||||
public Iterable<KmlGroundOverlay> getGroundOverlays() {
|
||||
return getGroundOverlayMap().keySet();
|
||||
}
|
||||
|
||||
public void removeLayerFromMap() {
|
||||
removePlacemarks(getAllFeatures());
|
||||
removeGroundOverlays(getGroundOverlayMap());
|
||||
if (hasNestedContainers()) {
|
||||
removeContainers(getNestedContainers());
|
||||
}
|
||||
setLayerVisibility(false);
|
||||
clearStylesRenderer();
|
||||
}
|
||||
|
||||
private void addPlacemarksToMap(HashMap<? extends Feature, Object> map) {
|
||||
Iterator<? extends Feature> it = map.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
addFeature(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
private void addContainerGroupToMap(Iterable<KmlContainer> iterable, boolean z) {
|
||||
for (KmlContainer kmlContainer : iterable) {
|
||||
boolean containerVisibility = getContainerVisibility(kmlContainer, z);
|
||||
if (kmlContainer.getStyles() != null) {
|
||||
putStyles(kmlContainer.getStyles());
|
||||
}
|
||||
if (kmlContainer.getStyleMap() != null) {
|
||||
super.assignStyleMap(kmlContainer.getStyleMap(), getStylesRenderer());
|
||||
}
|
||||
addContainerObjectToMap(kmlContainer, containerVisibility);
|
||||
if (kmlContainer.hasContainers()) {
|
||||
addContainerGroupToMap(kmlContainer.getContainers(), containerVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addContainerObjectToMap(KmlContainer kmlContainer, boolean z) {
|
||||
for (KmlPlacemark kmlPlacemark : kmlContainer.getPlacemarks()) {
|
||||
boolean z2 = z && getPlacemarkVisibility(kmlPlacemark);
|
||||
if (kmlPlacemark.getGeometry() != null) {
|
||||
String id = kmlPlacemark.getId();
|
||||
Geometry geometry = kmlPlacemark.getGeometry();
|
||||
KmlStyle placemarkStyle = getPlacemarkStyle(id);
|
||||
KmlPlacemark kmlPlacemark2 = kmlPlacemark;
|
||||
Object objAddKmlPlacemarkToMap = addKmlPlacemarkToMap(kmlPlacemark2, geometry, placemarkStyle, kmlPlacemark2.getInlineStyle(), z2);
|
||||
kmlContainer.setPlacemark(kmlPlacemark2, objAddKmlPlacemarkToMap);
|
||||
putContainerFeature(objAddKmlPlacemarkToMap, kmlPlacemark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void downloadMarkerIcons() {
|
||||
this.mMarkerIconsDownloaded = true;
|
||||
Iterator<String> it = getMarkerIconUrls().iterator();
|
||||
while (it.hasNext()) {
|
||||
new MarkerIconImageDownload(it.next()).execute(new String[0]);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void addIconToMarkers(String str, HashMap<KmlPlacemark, Object> map) {
|
||||
for (KmlPlacemark kmlPlacemark : map.keySet()) {
|
||||
addIconToGeometry(str, getStylesRenderer().get(kmlPlacemark.getId()), kmlPlacemark.getInlineStyle(), kmlPlacemark.getGeometry(), map.get(kmlPlacemark));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIconToGeometry(String str, KmlStyle kmlStyle, KmlStyle kmlStyle2, Geometry geometry, Object obj) {
|
||||
if (geometry == null) {
|
||||
return;
|
||||
}
|
||||
if ("Point".equals(geometry.getGeometryType())) {
|
||||
addIconToMarker(str, kmlStyle, kmlStyle2, (Marker) obj);
|
||||
} else if ("MultiGeometry".equals(geometry.getGeometryType())) {
|
||||
addIconToMultiGeometry(str, kmlStyle, kmlStyle2, (MultiGeometry) geometry, (List) obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void addIconToMultiGeometry(String str, KmlStyle kmlStyle, KmlStyle kmlStyle2, MultiGeometry multiGeometry, List<Object> list) {
|
||||
Iterator<Geometry> it = multiGeometry.getGeometryObject().iterator();
|
||||
Iterator<Object> it2 = list.iterator();
|
||||
while (it.hasNext() && it2.hasNext()) {
|
||||
addIconToGeometry(str, kmlStyle, kmlStyle2, it.next(), it2.next());
|
||||
}
|
||||
}
|
||||
|
||||
private void addIconToMarker(String str, KmlStyle kmlStyle, KmlStyle kmlStyle2, Marker marker) {
|
||||
boolean z = kmlStyle2 != null && str.equals(kmlStyle2.getIconUrl());
|
||||
boolean z2 = kmlStyle != null && str.equals(kmlStyle.getIconUrl());
|
||||
if (z) {
|
||||
scaleBitmap(kmlStyle2, marker);
|
||||
} else if (z2) {
|
||||
scaleBitmap(kmlStyle, marker);
|
||||
}
|
||||
}
|
||||
|
||||
private void scaleBitmap(KmlStyle kmlStyle, Marker marker) {
|
||||
marker.setIcon(getCachedMarkerImage(kmlStyle.getIconUrl(), kmlStyle.getIconScale()));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void addContainerGroupIconsToMarkers(String str, Iterable<KmlContainer> iterable) {
|
||||
for (KmlContainer kmlContainer : iterable) {
|
||||
addIconToMarkers(str, kmlContainer.getPlacemarksHashMap());
|
||||
if (kmlContainer.hasContainers()) {
|
||||
addContainerGroupIconsToMarkers(str, kmlContainer.getContainers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> map, Iterable<KmlContainer> iterable) {
|
||||
addGroundOverlays(map);
|
||||
for (KmlContainer kmlContainer : iterable) {
|
||||
addGroundOverlays(kmlContainer.getGroundOverlayHashMap(), kmlContainer.getContainers());
|
||||
}
|
||||
}
|
||||
|
||||
private void addGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> map) {
|
||||
for (KmlGroundOverlay kmlGroundOverlay : map.keySet()) {
|
||||
String imageUrl = kmlGroundOverlay.getImageUrl();
|
||||
if (imageUrl != null && kmlGroundOverlay.getLatLngBox() != null) {
|
||||
if (getCachedGroundOverlayImage(imageUrl) != null) {
|
||||
addGroundOverlayToMap(imageUrl, map, true);
|
||||
} else {
|
||||
this.mGroundOverlayUrls.add(imageUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void downloadGroundOverlays() {
|
||||
this.mGroundOverlayImagesDownloaded = true;
|
||||
Iterator<String> it = this.mGroundOverlayUrls.iterator();
|
||||
while (it.hasNext()) {
|
||||
new GroundOverlayImageDownload(it.next()).execute(new String[0]);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void addGroundOverlayToMap(String str, HashMap<KmlGroundOverlay, GroundOverlay> map, boolean z) {
|
||||
BitmapDescriptor cachedGroundOverlayImage = getCachedGroundOverlayImage(str);
|
||||
for (KmlGroundOverlay kmlGroundOverlay : map.keySet()) {
|
||||
if (kmlGroundOverlay.getImageUrl().equals(str)) {
|
||||
GroundOverlay groundOverlayAttachGroundOverlay = attachGroundOverlay(kmlGroundOverlay.getGroundOverlayOptions().image(cachedGroundOverlayImage));
|
||||
if (!z) {
|
||||
groundOverlayAttachGroundOverlay.setVisible(false);
|
||||
}
|
||||
map.put(kmlGroundOverlay, groundOverlayAttachGroundOverlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void addGroundOverlayInContainerGroups(String str, Iterable<KmlContainer> iterable, boolean z) {
|
||||
for (KmlContainer kmlContainer : iterable) {
|
||||
boolean containerVisibility = getContainerVisibility(kmlContainer, z);
|
||||
addGroundOverlayToMap(str, kmlContainer.getGroundOverlayHashMap(), containerVisibility);
|
||||
if (kmlContainer.hasContainers()) {
|
||||
addGroundOverlayInContainerGroups(str, kmlContainer.getContainers(), containerVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MarkerIconImageDownload extends AsyncTask<String, Void, Bitmap> {
|
||||
private final String mIconUrl;
|
||||
|
||||
public MarkerIconImageDownload(String str) {
|
||||
this.mIconUrl = str;
|
||||
KmlRenderer.this.downloadStarted();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
public Bitmap doInBackground(String... strArr) {
|
||||
try {
|
||||
return KmlRenderer.this.getBitmapFromUrl(this.mIconUrl);
|
||||
} catch (MalformedURLException unused) {
|
||||
return BitmapFactory.decodeFile(this.mIconUrl);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
public void onPostExecute(Bitmap bitmap) {
|
||||
if (bitmap != null) {
|
||||
KmlRenderer.this.cacheBitmap(this.mIconUrl, bitmap);
|
||||
if (KmlRenderer.this.isLayerOnMap()) {
|
||||
KmlRenderer kmlRenderer = KmlRenderer.this;
|
||||
kmlRenderer.addIconToMarkers(this.mIconUrl, kmlRenderer.getAllFeatures());
|
||||
KmlRenderer kmlRenderer2 = KmlRenderer.this;
|
||||
kmlRenderer2.addContainerGroupIconsToMarkers(this.mIconUrl, kmlRenderer2.mContainers);
|
||||
}
|
||||
} else {
|
||||
Log.e(KmlRenderer.LOG_TAG, "Image at this URL could not be found " + this.mIconUrl);
|
||||
}
|
||||
KmlRenderer.this.downloadFinished();
|
||||
}
|
||||
}
|
||||
|
||||
private class GroundOverlayImageDownload extends AsyncTask<String, Void, Bitmap> {
|
||||
private final String mGroundOverlayUrl;
|
||||
|
||||
public GroundOverlayImageDownload(String str) {
|
||||
this.mGroundOverlayUrl = str;
|
||||
KmlRenderer.this.downloadStarted();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
public Bitmap doInBackground(String... strArr) {
|
||||
try {
|
||||
return KmlRenderer.this.getBitmapFromUrl(this.mGroundOverlayUrl);
|
||||
} catch (MalformedURLException unused) {
|
||||
return BitmapFactory.decodeFile(this.mGroundOverlayUrl);
|
||||
} catch (IOException e) {
|
||||
Log.e(KmlRenderer.LOG_TAG, "Image [" + this.mGroundOverlayUrl + "] download issue", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.os.AsyncTask
|
||||
public void onPostExecute(Bitmap bitmap) {
|
||||
if (bitmap != null) {
|
||||
KmlRenderer.this.cacheBitmap(this.mGroundOverlayUrl, bitmap);
|
||||
if (KmlRenderer.this.isLayerOnMap()) {
|
||||
KmlRenderer kmlRenderer = KmlRenderer.this;
|
||||
kmlRenderer.addGroundOverlayToMap(this.mGroundOverlayUrl, kmlRenderer.getGroundOverlayMap(), true);
|
||||
KmlRenderer kmlRenderer2 = KmlRenderer.this;
|
||||
kmlRenderer2.addGroundOverlayInContainerGroups(this.mGroundOverlayUrl, kmlRenderer2.mContainers, true);
|
||||
}
|
||||
} else {
|
||||
Log.e(KmlRenderer.LOG_TAG, "Image at this URL could not be found " + this.mGroundOverlayUrl);
|
||||
}
|
||||
KmlRenderer.this.downloadFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public Bitmap getBitmapFromUrl(String str) throws IOException {
|
||||
return BitmapFactory.decodeStream(openConnectionCheckRedirects(new URL(str).openConnection()));
|
||||
}
|
||||
|
||||
private InputStream openConnectionCheckRedirects(URLConnection uRLConnection) throws IOException {
|
||||
InputStream inputStream;
|
||||
boolean z;
|
||||
HttpURLConnection httpURLConnection;
|
||||
int responseCode;
|
||||
int i = 0;
|
||||
do {
|
||||
boolean z2 = uRLConnection instanceof HttpURLConnection;
|
||||
if (z2) {
|
||||
((HttpURLConnection) uRLConnection).setInstanceFollowRedirects(false);
|
||||
}
|
||||
inputStream = uRLConnection.getInputStream();
|
||||
if (!z2 || (responseCode = (httpURLConnection = (HttpURLConnection) uRLConnection).getResponseCode()) < 300 || responseCode > 307 || responseCode == 306 || responseCode == 304) {
|
||||
z = false;
|
||||
} else {
|
||||
URL url = httpURLConnection.getURL();
|
||||
String headerField = httpURLConnection.getHeaderField("Location");
|
||||
URL url2 = headerField != null ? new URL(url, headerField) : null;
|
||||
httpURLConnection.disconnect();
|
||||
if (url2 == null || ((!url2.getProtocol().equals("http") && !url2.getProtocol().equals("https")) || i >= 5)) {
|
||||
throw new SecurityException("illegal URL redirect");
|
||||
}
|
||||
uRLConnection = url2.openConnection();
|
||||
i++;
|
||||
z = true;
|
||||
}
|
||||
} while (z);
|
||||
return inputStream;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import android.graphics.Color;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolygonOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.android.data.Style;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlStyle extends Style {
|
||||
private static final int HSV_VALUES = 3;
|
||||
private static final int HUE_VALUE = 0;
|
||||
private static final int INITIAL_SCALE = 1;
|
||||
private String mIconUrl;
|
||||
private boolean mFill = true;
|
||||
private boolean mOutline = true;
|
||||
private String mStyleId = null;
|
||||
private final HashMap<String, String> mBalloonOptions = new HashMap<>();
|
||||
private final HashSet<String> mStylesSet = new HashSet<>();
|
||||
private double mScale = 1.0d;
|
||||
float mMarkerColor = 0.0f;
|
||||
private boolean mIconRandomColorMode = false;
|
||||
private boolean mLineRandomColorMode = false;
|
||||
private boolean mPolyRandomColorMode = false;
|
||||
|
||||
KmlStyle() {
|
||||
}
|
||||
|
||||
void setInfoWindowText(String str) {
|
||||
this.mBalloonOptions.put("text", str);
|
||||
}
|
||||
|
||||
String getStyleId() {
|
||||
return this.mStyleId;
|
||||
}
|
||||
|
||||
void setStyleId(String str) {
|
||||
this.mStyleId = str;
|
||||
}
|
||||
|
||||
public boolean isStyleSet(String str) {
|
||||
return this.mStylesSet.contains(str);
|
||||
}
|
||||
|
||||
public boolean hasFill() {
|
||||
return this.mFill;
|
||||
}
|
||||
|
||||
public void setFill(boolean z) {
|
||||
this.mFill = z;
|
||||
}
|
||||
|
||||
public double getIconScale() {
|
||||
return this.mScale;
|
||||
}
|
||||
|
||||
void setIconScale(double d) {
|
||||
this.mScale = d;
|
||||
this.mStylesSet.add("iconScale");
|
||||
}
|
||||
|
||||
public boolean hasOutline() {
|
||||
return this.mOutline;
|
||||
}
|
||||
|
||||
public boolean hasBalloonStyle() {
|
||||
return this.mBalloonOptions.size() > 0;
|
||||
}
|
||||
|
||||
void setOutline(boolean z) {
|
||||
this.mOutline = z;
|
||||
this.mStylesSet.add("outline");
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return this.mIconUrl;
|
||||
}
|
||||
|
||||
void setIconUrl(String str) {
|
||||
this.mIconUrl = str;
|
||||
this.mStylesSet.add("iconUrl");
|
||||
}
|
||||
|
||||
void setFillColor(String str) {
|
||||
setPolygonFillColor(Color.parseColor("#" + convertColor(str)));
|
||||
this.mStylesSet.add("fillColor");
|
||||
}
|
||||
|
||||
void setMarkerColor(String str) {
|
||||
this.mMarkerColor = getHueValue(Color.parseColor("#" + convertColor(str)));
|
||||
this.mMarkerOptions.icon(BitmapDescriptorFactory.defaultMarker(this.mMarkerColor));
|
||||
this.mStylesSet.add("markerColor");
|
||||
}
|
||||
|
||||
private static float getHueValue(int i) {
|
||||
float[] fArr = new float[3];
|
||||
Color.colorToHSV(i, fArr);
|
||||
return fArr[0];
|
||||
}
|
||||
|
||||
private static String convertColor(String str) {
|
||||
String strTrim = str.trim();
|
||||
if (strTrim.length() > 6) {
|
||||
return strTrim.substring(0, 2) + strTrim.substring(6, 8) + strTrim.substring(4, 6) + strTrim.substring(2, 4);
|
||||
}
|
||||
return strTrim.substring(4, 6) + strTrim.substring(2, 4) + strTrim.substring(0, 2);
|
||||
}
|
||||
|
||||
void setHeading(float f) {
|
||||
setMarkerRotation(f);
|
||||
this.mStylesSet.add("heading");
|
||||
}
|
||||
|
||||
void setHotSpot(float f, float f2, String str, String str2) {
|
||||
setMarkerHotSpot(f, f2, str, str2);
|
||||
this.mStylesSet.add("hotSpot");
|
||||
}
|
||||
|
||||
void setIconColorMode(String str) {
|
||||
this.mIconRandomColorMode = str.equals("random");
|
||||
this.mStylesSet.add("iconColorMode");
|
||||
}
|
||||
|
||||
boolean isIconRandomColorMode() {
|
||||
return this.mIconRandomColorMode;
|
||||
}
|
||||
|
||||
void setLineColorMode(String str) {
|
||||
this.mLineRandomColorMode = str.equals("random");
|
||||
this.mStylesSet.add("lineColorMode");
|
||||
}
|
||||
|
||||
public boolean isLineRandomColorMode() {
|
||||
return this.mLineRandomColorMode;
|
||||
}
|
||||
|
||||
void setPolyColorMode(String str) {
|
||||
this.mPolyRandomColorMode = str.equals("random");
|
||||
this.mStylesSet.add("polyColorMode");
|
||||
}
|
||||
|
||||
public boolean isPolyRandomColorMode() {
|
||||
return this.mPolyRandomColorMode;
|
||||
}
|
||||
|
||||
void setOutlineColor(String str) {
|
||||
this.mPolylineOptions.color(Color.parseColor("#" + convertColor(str)));
|
||||
this.mPolygonOptions.strokeColor(Color.parseColor("#" + convertColor(str)));
|
||||
this.mStylesSet.add("outlineColor");
|
||||
}
|
||||
|
||||
void setWidth(Float f) {
|
||||
setLineStringWidth(f.floatValue());
|
||||
setPolygonStrokeWidth(f.floatValue());
|
||||
this.mStylesSet.add("width");
|
||||
}
|
||||
|
||||
public HashMap<String, String> getBalloonOptions() {
|
||||
return this.mBalloonOptions;
|
||||
}
|
||||
|
||||
private static MarkerOptions createMarkerOptions(MarkerOptions markerOptions, boolean z, float f) {
|
||||
MarkerOptions markerOptions2 = new MarkerOptions();
|
||||
markerOptions2.rotation(markerOptions.getRotation());
|
||||
markerOptions2.anchor(markerOptions.getAnchorU(), markerOptions.getAnchorV());
|
||||
if (z) {
|
||||
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(getHueValue(computeRandomColor((int) f))));
|
||||
}
|
||||
markerOptions2.icon(markerOptions.getIcon());
|
||||
return markerOptions2;
|
||||
}
|
||||
|
||||
private static PolylineOptions createPolylineOptions(PolylineOptions polylineOptions) {
|
||||
PolylineOptions polylineOptions2 = new PolylineOptions();
|
||||
polylineOptions2.color(polylineOptions.getColor());
|
||||
polylineOptions2.width(polylineOptions.getWidth());
|
||||
polylineOptions2.clickable(polylineOptions.isClickable());
|
||||
return polylineOptions2;
|
||||
}
|
||||
|
||||
private static PolygonOptions createPolygonOptions(PolygonOptions polygonOptions, boolean z, boolean z2) {
|
||||
float strokeWidth;
|
||||
PolygonOptions polygonOptions2 = new PolygonOptions();
|
||||
if (z) {
|
||||
polygonOptions2.fillColor(polygonOptions.getFillColor());
|
||||
}
|
||||
if (z2) {
|
||||
polygonOptions2.strokeColor(polygonOptions.getStrokeColor());
|
||||
strokeWidth = polygonOptions.getStrokeWidth();
|
||||
} else {
|
||||
strokeWidth = 0.0f;
|
||||
}
|
||||
polygonOptions2.strokeWidth(strokeWidth);
|
||||
polygonOptions2.clickable(polygonOptions.isClickable());
|
||||
return polygonOptions2;
|
||||
}
|
||||
|
||||
public MarkerOptions getMarkerOptions() {
|
||||
return createMarkerOptions(this.mMarkerOptions, isIconRandomColorMode(), this.mMarkerColor);
|
||||
}
|
||||
|
||||
public PolylineOptions getPolylineOptions() {
|
||||
return createPolylineOptions(this.mPolylineOptions);
|
||||
}
|
||||
|
||||
public PolygonOptions getPolygonOptions() {
|
||||
return createPolygonOptions(this.mPolygonOptions, this.mFill, this.mOutline);
|
||||
}
|
||||
|
||||
public static int computeRandomColor(int i) {
|
||||
Random random = new Random();
|
||||
int iRed = Color.red(i);
|
||||
int iGreen = Color.green(i);
|
||||
int iBlue = Color.blue(i);
|
||||
if (iRed != 0) {
|
||||
iRed = random.nextInt(iRed);
|
||||
}
|
||||
if (iBlue != 0) {
|
||||
iBlue = random.nextInt(iBlue);
|
||||
}
|
||||
if (iGreen != 0) {
|
||||
iGreen = random.nextInt(iGreen);
|
||||
}
|
||||
return Color.rgb(iRed, iGreen, iBlue);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Style{\n balloon options=");
|
||||
sb.append(this.mBalloonOptions);
|
||||
sb.append(",\n fill=").append(this.mFill);
|
||||
sb.append(",\n outline=").append(this.mOutline);
|
||||
sb.append(",\n icon url=").append(this.mIconUrl);
|
||||
sb.append(",\n scale=").append(this.mScale);
|
||||
sb.append(",\n style id=").append(this.mStyleId);
|
||||
sb.append("\n}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
class KmlStyleParser {
|
||||
private static final String COLOR_STYLE_COLOR = "color";
|
||||
private static final String COLOR_STYLE_MODE = "colorMode";
|
||||
private static final String ICON_STYLE_HEADING = "heading";
|
||||
private static final String ICON_STYLE_HOTSPOT = "hotSpot";
|
||||
private static final String ICON_STYLE_SCALE = "scale";
|
||||
private static final String ICON_STYLE_URL = "Icon";
|
||||
private static final String LINE_STYLE_WIDTH = "width";
|
||||
private static final String POLY_STYLE_FILL = "fill";
|
||||
private static final String POLY_STYLE_OUTLINE = "outline";
|
||||
private static final String STYLE_MAP_KEY = "key";
|
||||
private static final String STYLE_MAP_NORMAL_STYLE = "normal";
|
||||
private static final String STYLE_TAG = "styleUrl";
|
||||
|
||||
KmlStyleParser() {
|
||||
}
|
||||
|
||||
static KmlStyle createStyle(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
KmlStyle kmlStyle = new KmlStyle();
|
||||
setStyleId(xmlPullParser.getAttributeValue(null, "id"), kmlStyle);
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("Style")) {
|
||||
return kmlStyle;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals("IconStyle")) {
|
||||
createIconStyle(xmlPullParser, kmlStyle);
|
||||
} else if (xmlPullParser.getName().equals("LineStyle")) {
|
||||
createLineStyle(xmlPullParser, kmlStyle);
|
||||
} else if (xmlPullParser.getName().equals("PolyStyle")) {
|
||||
createPolyStyle(xmlPullParser, kmlStyle);
|
||||
} else if (xmlPullParser.getName().equals("BalloonStyle")) {
|
||||
createBalloonStyle(xmlPullParser, kmlStyle);
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setStyleId(String str, KmlStyle kmlStyle) {
|
||||
if (str != null) {
|
||||
kmlStyle.setStyleId("#" + str);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createIconStyle(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("IconStyle")) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals(ICON_STYLE_HEADING)) {
|
||||
kmlStyle.setHeading(Float.parseFloat(xmlPullParser.nextText()));
|
||||
} else if (xmlPullParser.getName().equals(ICON_STYLE_URL)) {
|
||||
setIconUrl(xmlPullParser, kmlStyle);
|
||||
} else if (xmlPullParser.getName().equals(ICON_STYLE_HOTSPOT)) {
|
||||
setIconHotSpot(xmlPullParser, kmlStyle);
|
||||
} else if (xmlPullParser.getName().equals(ICON_STYLE_SCALE)) {
|
||||
kmlStyle.setIconScale(Double.parseDouble(xmlPullParser.nextText()));
|
||||
} else if (xmlPullParser.getName().equals(COLOR_STYLE_COLOR)) {
|
||||
kmlStyle.setMarkerColor(xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(COLOR_STYLE_MODE)) {
|
||||
kmlStyle.setIconColorMode(xmlPullParser.nextText());
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
static HashMap<String, String> createStyleMap(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
String str = "#" + xmlPullParser.getAttributeValue(null, "id");
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
boolean z = false;
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("StyleMap")) {
|
||||
return map;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals(STYLE_MAP_KEY) && xmlPullParser.nextText().equals(STYLE_MAP_NORMAL_STYLE)) {
|
||||
z = true;
|
||||
} else if (xmlPullParser.getName().equals(STYLE_TAG) && z) {
|
||||
map.put(str, xmlPullParser.nextText());
|
||||
z = false;
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void createBalloonStyle(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("BalloonStyle")) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2 && xmlPullParser.getName().equals("text")) {
|
||||
kmlStyle.setInfoWindowText(xmlPullParser.nextText());
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIconUrl(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals(ICON_STYLE_URL)) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2 && xmlPullParser.getName().equals("href")) {
|
||||
kmlStyle.setIconUrl(xmlPullParser.nextText());
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIconHotSpot(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException {
|
||||
if (xmlPullParser.isEmptyElementTag()) {
|
||||
return;
|
||||
}
|
||||
kmlStyle.setHotSpot(Float.parseFloat(xmlPullParser.getAttributeValue(null, "x")), Float.parseFloat(xmlPullParser.getAttributeValue(null, "y")), xmlPullParser.getAttributeValue(null, "xunits"), xmlPullParser.getAttributeValue(null, "yunits"));
|
||||
}
|
||||
|
||||
private static void createLineStyle(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("LineStyle")) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals(COLOR_STYLE_COLOR)) {
|
||||
kmlStyle.setOutlineColor(xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(LINE_STYLE_WIDTH)) {
|
||||
kmlStyle.setWidth(Float.valueOf(xmlPullParser.nextText()));
|
||||
} else if (xmlPullParser.getName().equals(COLOR_STYLE_MODE)) {
|
||||
kmlStyle.setLineColorMode(xmlPullParser.nextText());
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
|
||||
private static void createPolyStyle(XmlPullParser xmlPullParser, KmlStyle kmlStyle) throws XmlPullParserException, IOException {
|
||||
int eventType = xmlPullParser.getEventType();
|
||||
while (true) {
|
||||
if (eventType == 3 && xmlPullParser.getName().equals("PolyStyle")) {
|
||||
return;
|
||||
}
|
||||
if (eventType == 2) {
|
||||
if (xmlPullParser.getName().equals(COLOR_STYLE_COLOR)) {
|
||||
kmlStyle.setFillColor(xmlPullParser.nextText());
|
||||
} else if (xmlPullParser.getName().equals(POLY_STYLE_OUTLINE)) {
|
||||
kmlStyle.setOutline(KmlBoolean.parseBoolean(xmlPullParser.nextText()));
|
||||
} else if (xmlPullParser.getName().equals(POLY_STYLE_FILL)) {
|
||||
kmlStyle.setFill(KmlBoolean.parseBoolean(xmlPullParser.nextText()));
|
||||
} else if (xmlPullParser.getName().equals(COLOR_STYLE_MODE)) {
|
||||
kmlStyle.setPolyColorMode(xmlPullParser.nextText());
|
||||
}
|
||||
}
|
||||
eventType = xmlPullParser.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlTrack extends KmlLineString {
|
||||
private final HashMap<String, String> mProperties;
|
||||
private final ArrayList<Long> mTimestamps;
|
||||
|
||||
public KmlTrack(ArrayList<LatLng> arrayList, ArrayList<Double> arrayList2, ArrayList<Long> arrayList3, HashMap<String, String> map) {
|
||||
super(arrayList, arrayList2);
|
||||
this.mTimestamps = arrayList3;
|
||||
this.mProperties = map;
|
||||
}
|
||||
|
||||
public ArrayList<Long> getTimestamps() {
|
||||
return this.mTimestamps;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getProperties() {
|
||||
return this.mProperties;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.google.maps.android.data.kml;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class KmlUtil {
|
||||
public static String substituteProperties(String str, KmlPlacemark kmlPlacemark) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
Matcher matcher = Pattern.compile("\\$\\[(.+?)]").matcher(str);
|
||||
while (matcher.find()) {
|
||||
String property = kmlPlacemark.getProperty(matcher.group(1));
|
||||
if (property != null) {
|
||||
matcher.appendReplacement(stringBuffer, property);
|
||||
}
|
||||
}
|
||||
matcher.appendTail(stringBuffer);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user