• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MapView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.esri.arcgisruntime.mapping.view.MapView的典型用法代码示例。如果您正苦于以下问题:Java MapView类的具体用法?Java MapView怎么用?Java MapView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MapView类属于com.esri.arcgisruntime.mapping.view包,在下文中一共展示了MapView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:17,代码来源:MainActivity.java


示例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");

    }
  });
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:29,代码来源:MapbookTest.java


示例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);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:23,代码来源:MainActivity.java


示例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));
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:22,代码来源:MainActivity.java


示例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();

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:21,代码来源:MainActivity.java


示例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);

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:18,代码来源:MainActivity.java


示例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);
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:19,代码来源:MainActivity.java


示例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);
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:27,代码来源:MainActivity.java


示例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);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:23,代码来源:MainActivity.java


示例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);
    }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:21,代码来源:MainActivity.java


示例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);

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:26,代码来源:MainActivity.java


示例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);

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:20,代码来源:MainActivity.java


示例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);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:17,代码来源:MainActivity.java


示例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();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:20,代码来源:MainActivity.java


示例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);
    }

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:27,代码来源:MainActivity.java


示例16: checkSearchForAddress

import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
@Test
public void checkSearchForAddress() throws Exception{

  navigateToMap();

  final SearchView search = (SearchView) solo.getView(R.id.action_search);
  solo.clickOnView(search);

  // Type an address into search view
  final EditText editText = solo.getEditText(0);
  solo.typeText(editText, "123 Spring Ave");

  solo.sleep(4000);
  solo.pressSoftKeyboardSearchButton();
  solo.sleep(4000);

  // Map view should have a pin in the graphics layer
  final MapView mapView = (MapView) solo.getView(R.id.mapView);
  final Graphic graphic = mapView.getGraphicsOverlays().get(0).getGraphics().get(0);
  Assert.assertNotNull(graphic);
  Assert.assertTrue(mapView.getGraphicsOverlays().get(0).getGraphics().size()==1);


  solo.sleep(3000);

  // Simulate the same location being tapped
  final Geometry point = graphic.getGeometry();
  final android.graphics.Point derivedScreenLocation = deriveScreenPointForLocation(point);
  solo.clickOnScreen(derivedScreenLocation.x, derivedScreenLocation.y);

  solo.sleep(3000);
  Assert.assertTrue(solo.waitForView(R.id.calloutLinearLayout));
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:34,代码来源:MapbookTest.java


示例17: deriveScreenPointForLocation

import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
private android.graphics.Point deriveScreenPointForLocation(final Geometry location){
  final MapView mapView = (MapView) solo.getView(R.id.mapView) ;
  final DisplayMetrics metrics = new DisplayMetrics();
  mActivityRule.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);;
  final float screenHeight = metrics.heightPixels;
  final float mapViewHeight = mapView.getHeight();
  final float buffer = screenHeight - mapViewHeight;
  final Point projectedPoint = (Point) GeometryEngine.project(location, SpatialReference.create(3857));

  final android.graphics.Point derivedPoint =  mapView.locationToScreen(projectedPoint);

  return new android.graphics.Point(derivedPoint.x,derivedPoint.y+Math.round(buffer));

}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:15,代码来源:MapbookTest.java


示例18: setUpMap

import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
/**
 * Set up the ArcGISMap
 * @param map - ArcGISMap
 */
@Override
public void setUpMap(final ArcGISMap map){
  mMapView = (MapView) mRoot.findViewById(R.id.map);
  mMapView.setAttributionTextVisible(false);
  mMap  = map;
  mMapView.setMap(mMap);

  // Start listening to touch interactions on the map
  final View.OnTouchListener mapTouchListener = new MapTouchListener(getActivity().getApplicationContext(), mMapView);
  mMapView.setOnTouchListener(mapTouchListener);

  // Once map has loaded enable touch listener
  mMapView.addDrawStatusChangedListener(new DrawStatusChangedListener() {
    @Override public void drawStatusChanged(final DrawStatusChangedEvent drawStatusChangedEvent) {
      if (drawStatusChangedEvent.getDrawStatus() == DrawStatus.COMPLETED) {
        // Stop listening to any more draw status changes
        mMapView.removeDrawStatusChangedListener(this);
        // Notify presenter
        mPresenter.mapLoaded();
      }
    }
  });

  // When map's layout is changed, re-center map on selected point
  mMapView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
    @Override public void onLayoutChange(final View v, final int left, final int top, final int right, final int bottom, final int oldLeft, final int oldTop,
        final int oldRight, final int oldBottom) {
      setViewpoint();
    }
  });

}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:37,代码来源:MapFragment.java


示例19: testLoadMap

import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
/**
 * Test that a progress dialog closes
 * and screen appears with toolbar title
 * and a map view.
 */
public void testLoadMap(){
  // Progress dialog should show and
  // disappear after map loads
  assertTrue(solo.waitForDialogToClose());

  // Search for page title
  String toolbarTitle = ((AppCompatActivity) getActivity()).getSupportActionBar().getTitle().toString();
  String title = getActivity().getString(R.string.toolbar_title);
  assertTrue(toolbarTitle.equalsIgnoreCase(title));

  // Map view present?
  MapView mapView = (MapView) solo.getView(R.id.map) ;
  assertNotNull(mapView);
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:20,代码来源:EMUAppTest.java


示例20: deriveScreenPointForLocation

import com.esri.arcgisruntime.mapping.view.MapView; //导入依赖的package包/类
private android.graphics.Point deriveScreenPointForLocation(Point location){
  MapView mapView = (MapView) solo.getView(R.id.map) ;
  DisplayMetrics metrics = new DisplayMetrics();
  getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);;
  float screenHeight = metrics.heightPixels;
  float mapViewHeight = mapView.getHeight();
  float buffer = screenHeight - mapViewHeight;
  Point projectedPoint = (Point) GeometryEngine.project(location, SpatialReference.create(3857));

  android.graphics.Point derivedPoint =  mapView.locationToScreen(projectedPoint);

  return new android.graphics.Point(derivedPoint.x,derivedPoint.y+Math.round(buffer));

}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:15,代码来源:EMUAppTest.java



注:本文中的com.esri.arcgisruntime.mapping.view.MapView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultPointRenderer2D类代码示例发布时间:2022-05-22
下一篇:
Java IIDEHelpContextIds类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap