use of com.esri.android.map.ags.ArcGISTiledMapServiceLayer in project android-gps-test-tool by Esri.
the class GPSTesterActivityController method layerExists.
/**
* Returns whether or not a MapType layer has been added or not via <code>addLayer()</code>
* @param maptype
* @return Boolean confirms the layer exists
*/
public Boolean layerExists(MapType maptype) {
Boolean exists = false;
String layerName = null;
Layer[] layerArr = _map.getLayers();
for (Layer layer : layerArr) {
if (layer instanceof ArcGISTiledMapServiceLayer) {
ArcGISTiledMapServiceLayer tempMap = (ArcGISTiledMapServiceLayer) layer;
ArcGISLayerInfo[] info = tempMap.getLayers();
if (info != null) {
layerName = info[0].getName().toLowerCase();
if (layerName.contains("world imagery") && maptype == MapType.SATELLITE) {
exists = true;
break;
}
if (layerName.contains("topographic info") && maptype == MapType.TOPO) {
exists = true;
break;
}
if (layerName.contains("world street map") && maptype == MapType.STREETS) {
exists = true;
break;
}
}
}
}
return exists;
}
use of com.esri.android.map.ags.ArcGISTiledMapServiceLayer in project android-gps-test-tool by Esri.
the class GPSTesterActivityController method setUI.
private void setUI() {
final Display display = _activity.getWindowManager().getDefaultDisplay();
//WARNING: this method was deprecated at API level 13
final int width = display.getWidth();
//WARNING: this method was deprecated at API level 13
final int height = (int) (display.getHeight() * .3333);
_baseMap = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer");
_graphicsLayer = new GraphicsLayer();
String bestAvailableText = "";
String cachedLocationNetworkProviderText = "";
String cachedLocationGPSProviderText = "";
String gpsLocationText = "";
String networkLocationText = "";
final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height);
final MapView temp = (MapView) _activity.findViewById(R.id.map);
temp.setLayoutParams(layoutParams);
//Keep screen awake
_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//Load the map
// if(_map.layerExists(MapType.TOPO)){
// _map.clearAllGraphics();
// }
// else{
_map.addLayer(_baseMap);
_map.addLayer(_graphicsLayer);
// }
bestAvailableText = "<b><font color='yellow'>Best Accuracy = N/A</b></font>" + "<br><b>Lat/Lon:</b> N/A" + "<br><b>Accuracy:</b> N/A";
setBestAvailableImageView(BestAvailableType.NULL);
cachedLocationNetworkProviderText = "<b><font color='yellow'>Cached Network Provider</b></font>" + "<br><b>Lat/Lon:</b> N/A" + "<br><b>Accuracy:</b> N/A";
cachedLocationGPSProviderText = "<b><font color='yellow'>Cached GPS Provider</b></font>" + "<br><b>Lat/Lon:</b> N/A" + "<br><b>Accuracy:</b> N/A";
gpsLocationText = "<b><font color='yellow'>GPS Provider</b></font>" + "<br><b>Lat/Lon:</b> N/A" + "<br><b>Accuracy:</b> N/A";
networkLocationText = "<b><font color='yellow'>Network Provider</b></font>" + "<br><b>Lat/Lon:</b> N/A" + "<br><b>Accuracy:</b> N/A";
_bestAvailableInfoTextView.setText(Html.fromHtml(bestAvailableText));
_cachedLocationNetworkProvider.setText(Html.fromHtml(cachedLocationNetworkProviderText));
_cachedLocationGPSProvider.setText(Html.fromHtml(cachedLocationGPSProviderText));
_gpsLocationTextView.setText(Html.fromHtml(gpsLocationText));
_networkLocationTextView.setText(Html.fromHtml(networkLocationText));
_allLocationProvidersTextView.setText(Html.fromHtml("<b><font color='yellow'>List of available providers</b></font><br><br><br>"));
_bestLocationProviderTextView.setText(Html.fromHtml("<b><font color='yellow'>List of best providers</b></font><br><br><br>"));
}
Aggregations