本文整理汇总了Java中com.esri.arcgisruntime.mapping.view.MapView类的典型用法代码示例。如果您正苦于以下问题:Java MapView类的具体用法?Java MapView怎么用?Java MapView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapView类属于com.esri.arcgisruntime.mapping.view包,在下文中一共展示了MapView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapViewLayout);
// create new Tiled Layer from service url
ArcGISTiledLayer tiledLayerBaseMap = new ArcGISTiledLayer(getResources().getString(R.string.world_topo_service));
// set tiled layer as basemap
Basemap basemap = new Basemap(tiledLayerBaseMap);
// create a map with the basemap
ArcGISMap map = new ArcGISMap(basemap);
// set the map to be displayed in this view
mMapView.setMap(map);
}
示例2: checkClickOnMapThumbnailShowsMap
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
/**
* Test that clicking on the recycler view
* shows a map.
* @throws Exception
*/
@Test
public void checkClickOnMapThumbnailShowsMap() throws Exception{
solo.waitForActivity(MapbookActivity.class, 2000);
solo.waitForFragmentById(R.id.mapbookViewFragment);
final RecyclerView mapRecyclerView = (RecyclerView) solo.getView(R.id.recyclerView) ;
Assert.assertNotNull(mapRecyclerView);
// Click on first item in recycler view
solo.clickOnView(mapRecyclerView);
// This should trigger the map activity to be shown
solo.waitForActivity(MapActivity.class, 2000);
solo.waitForFragmentById(R.id.mapLinearLayout);
final MapView mapView = (MapView) solo.getView(R.id.mapView);
mapView.getMap().addDoneLoadingListener(new Runnable() {
@Override public void run() {
solo.sleep(1000);
solo.takeScreenshot("MAP_ACTIVITY");
}
});
}
示例3: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the BasemapType topographic
ArcGISMap map = new ArcGISMap(Basemap.Type.OCEANS, 56.075844, -2.681572, 11);
// set the map to be displayed in this view
mMapView.setMap(map);
// add graphics overlay to MapView.
GraphicsOverlay graphicsOverlay = addGraphicsOverlay(mMapView);
//add some buoy positions to the graphics overlay
addBuoyPoints(graphicsOverlay);
//add boat trip polyline to graphics overlay
addBoatTrip(graphicsOverlay);
//add nesting ground polygon to graphics overlay
addNestingGround(graphicsOverlay);
//add text symbols and points to graphics overlay
addText(graphicsOverlay);
}
示例4: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// Check permissions to see if failure may be due to lack of permissions.
boolean permissionCheck = ContextCompat.checkSelfPermission(MainActivity.this, permission[0]) ==
PackageManager.PERMISSION_GRANTED;
if (!permissionCheck) {
// If permissions are not already granted, request permission from the user.
ActivityCompat.requestPermissions(MainActivity.this, permission, requestCode);
} else { // if permission was already granted, set up offline map and geocoding, reverse geocoding and LocatorTask
setUpOfflineMapGeocoding();
setSearchView();
}
mMapView.setOnTouchListener(new MapTouchListener(getApplicationContext(), mMapView));
}
示例5: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the Basemap Type topographic
ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 48.354406, -99.998267, 2);
// create a MapImageLayer with dynamically generated map images
mMapImageLayer = new ArcGISMapImageLayer(getResources().getString(R.string.world_cities_service));
mMapImageLayer.setOpacity(0.5f);
// add world cities layers as map operational layer
map.getOperationalLayers().add(mMapImageLayer);
// set the map to be displayed in this view
mMapView.setMap(map);
// get the layers from the map image layer
mLayers = mMapImageLayer.getSublayers();
}
示例6: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a MapImageLayer with dynamically generated map images
ArcGISMapImageLayer mapImageLayer = new ArcGISMapImageLayer(getResources().getString(R.string.world_elevation_service));
// create an empty map instance
ArcGISMap map = new ArcGISMap();
// add map image layer as operational layer
map.getOperationalLayers().add(mapImageLayer);
// set the map to be displayed in this view
mMapView.setMap(map);
}
示例7: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// retrieve the MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// define permission to request
String[] reqPermission = new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE };
int requestCode = 2;
// For API level 23+ request permission at runtime
if (ContextCompat.checkSelfPermission(MainActivity.this,
reqPermission[0]) == PackageManager.PERMISSION_GRANTED) {
loadRaster();
} else {
// request permission
ActivityCompat.requestPermissions(MainActivity.this, reqPermission, requestCode);
}
}
示例8: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//set default values for stretch parameters
mMin = 0;
mMax = 255;
mPercentClipMin = 0;
mPercentClipMax = 99;
mStdDevFactor = 1;
mStretchType = StretchType.MIN_MAX;
// retrieve the MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
mFragmentManager = getSupportFragmentManager();
// define permission to request
String[] reqPermission = new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE };
int requestCode = 2;
// For API level 23+ request permission at runtime
if (ContextCompat.checkSelfPermission(MainActivity.this,
reqPermission[0]) == PackageManager.PERMISSION_GRANTED) {
initialize();
} else {
// request permission
ActivityCompat.requestPermissions(MainActivity.this, reqPermission, requestCode);
}
}
示例9: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView mapView = (MapView)findViewById(R.id.mapView);
// create ArcGISMap with topographic basemap
ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas());
mapView.setMap(map);
// create graphics overlays to show the inputs and results of the spatial operation
mapView.getGraphicsOverlays().add(inputGeometryOverlay);
mapView.getGraphicsOverlays().add(resultGeometryOverlay);
// create input polygons and add graphics to display these polygons in an overlay
createPolygons();
// center the map view on the input geometries
Geometry viewpointGeom = GeometryEngine.union(inputPolygon1, inputPolygon2).getExtent();
mapView.setViewpointGeometryAsync(viewpointGeom, 20);
}
示例10: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// retrieve the MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// define permission to request
String[] reqPermission = new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE };
int requestCode = 2;
// For API level 23+ request permission at runtime
if(ContextCompat.checkSelfPermission(MainActivity.this,
reqPermission[0]) == PackageManager.PERMISSION_GRANTED){
loadRaster();
} else {
// request permission
ActivityCompat.requestPermissions(MainActivity.this, reqPermission, requestCode);
}
}
示例11: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create new Tiled Layer from service url
ArcGISTiledLayer mTopoBasemap = new ArcGISTiledLayer(getResources().getString(R.string.world_topo_service));
// set tiled layer as basemap
Basemap mBasemap = new Basemap(mTopoBasemap);
// create a map with the basemap
ArcGISMap mMap = new ArcGISMap(mBasemap);
// create an initial extent envelope
Envelope mInitExtent = new Envelope(-12211308.778729, 4645116.003309, -12208257.879667, 4650542.535773, SpatialReference.create(102100));
// create a viewpoint from envelope
Viewpoint vp = new Viewpoint(mInitExtent);
// set initial map extent
mMap.setInitialViewpoint(vp);
// set the map to be displayed in this view
mMapView.setMap(mMap);
}
示例12: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with World_Bonne projection
ArcGISMap mMap = new ArcGISMap(SpatialReference.create(54024));
//Adding a map image layer which can reproject itself to the map's spatial reference
ArcGISMapImageLayer mapImageLayer = new ArcGISMapImageLayer(getResources().getString(R.string.world_cities_service));
// set the map image layer as basemap
Basemap basemap = new Basemap(mapImageLayer);
// add the basemap to the map
mMap.setBasemap(basemap);
// set the map to be displayed in this view
mMapView.setMap(mMap);
}
示例13: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the Basemap Type topographic
ArcGISMap mMap = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 10);
// set the map to be displayed in this view
mMapView.setMap(mMap);
// enable magnifier
mMapView.setMagnifierEnabled(true);
// allow magnifier to pan near the edge of the map bounds
mMapView.setCanMagnifierPanMap(true);
}
示例14: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the BasemapType topographic
ArcGISMap mMap = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 3.184710, -4.734690, 2);
// set the map to be displayed in this view
mMapView.setMap(mMap);
// set up gesture for interacting with the MapView
MapViewTouchListener mMapViewTouchListener = new MapViewTouchListener(this, mMapView);
mMapView.setOnTouchListener(mMapViewTouchListener);
addGraphicsOverlay();
}
示例15: onCreate
import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get sdcard resource name
extStorDir = Environment.getExternalStorageDirectory();
// get the directory
extSDCardDirName = this.getResources().getString(R.string.config_data_sdcard_offline_dir);
// get mobile map package filename
filename = this.getResources().getString(R.string.config_mmpk_name);
// create the full path to the mobile map package file
mmpkFilePath = createMobileMapPackageFilePath();
// retrieve the MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// For API level 23+ request permission at runtime
if(ContextCompat.checkSelfPermission(MainActivity.this, reqPermission[0]) == PackageManager.PERMISSION_GRANTED){
loadMobileMapPackage(mmpkFilePath);
}else{
// request permission
ActivityCompat.requestPermissions(MainActivity.this, reqPermission, requestCode);
}
}