当前位置: 首页>>代码示例>>Java>>正文


Java Basemap.createTopographic方法代码示例

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


在下文中一共展示了Basemap.createTopographic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // inflate MapView from layout
  mMapView = findViewById(R.id.mapView);
  // create a map with the BasemapType topographic
  mMap = new ArcGISMap(Basemap.createTopographic());
  // set the map to be displayed in this view
  mMapView.setMap(mMap);

  // set an initial viewpoint
  Point point = new Point(-11662054, 4818336, SpatialReference.create(3857));
  Viewpoint viewpoint = new Viewpoint(point, 200000);
  mMap.setInitialViewpoint(viewpoint);

  requestWritePermission();

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

示例2: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Map Initial Extent Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a ArcGISMap with the basemap
    final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // create an initial extent envelope
    Point leftPoint = new Point(-12211308.778729, 4645116.003309, SpatialReferences.getWebMercator());
    Point rightPoint = new Point(-12208257.879667, 4650542.535773, SpatialReferences.getWebMercator());
    Envelope initialExtent = new Envelope(leftPoint, rightPoint);

    // create a viewpoint from envelope
    Viewpoint viewPoint = new Viewpoint(initialExtent);

    // set initial ArcGISMap extent
    map.setInitialViewpoint(viewPoint);

    // create a view and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // add the map view to stack pane
    stackPane.getChildren().add(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:41,代码来源:MapInitialExtentSample.java

示例3: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的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 topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
    //set an initial viewpoint
    map.setInitialViewpoint( new Viewpoint(new Envelope(-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7
            , 4016869.78617381, SpatialReferences.getWebMercator() )));


    // create feature layer with its service feature table
    // create the service feature table
    ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));

    //explicitly set the mode to on interaction no cache (every interaction (pan, query etc) new features will be requested
    serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE);

    // create the feature layer using the service feature table
    FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);

    // add the layer to the map
    map.getOperationalLayers().add(featureLayer);

    // set the map to be displayed in the mapview
    mMapView.setMap(map);

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

示例4: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的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 topographic basemap
    final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
    // set the map to be displayed in the mapview
    mMapView.setMap(map);

    // create feature layer with its service feature table
    // create the service feature table
    mServiceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));
    // create the feature layer using the service feature table
    mFeaturelayer = new FeatureLayer(mServiceFeatureTable);
    mFeaturelayer.setOpacity(0.8f);
    //override the renderer
    SimpleLineSymbol lineSymbol= new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1);
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
    mFeaturelayer.setRenderer(new SimpleRenderer(fillSymbol));

    // add the layer to the map
    map.getOperationalLayers().add(mFeaturelayer);

    // zoom to a view point of the USA
    mMapView.setViewpointCenterAsync(new Point(-11000000, 5000000, SpatialReferences.getWebMercator()), 100000000);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:31,代码来源:MainActivity.java

示例5: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // set up the bottom toolbar
    createBottomToolbar();

    // inflate MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);

    // create a map with the topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
    //set an initial viewpoint
    map.setInitialViewpoint(new Viewpoint(new Envelope(-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381, SpatialReferences.getWebMercator())));


    // create feature layer with its service feature table
    ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));
    mFeatureLayer = new FeatureLayer(serviceFeatureTable);

    // add the layer to the map
    map.getOperationalLayers().add(mFeatureLayer);

    // set the map to be displayed in the mapview
    mMapView.setMap(map);

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

示例6: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // create a simple date formatter to parse strings to date
  mSimpleDateFormatter = new SimpleDateFormat(getString(R.string.date_format), Locale.US);

  // inflate MapView from layout
  mMapView = findViewById(R.id.mapView);

  // create a map with the BasemapType topographic
  ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

  //center for initial viewpoint
  Point center = new Point(-13671170, 5693633, SpatialReference.create(3857));

  //set initial viewpoint
  map.setInitialViewpoint(new Viewpoint(center, 57779));

  // set the map to the map view
  mMapView.setMap(map);

  // initialize geoprocessing task with the url of the service
  mGeoprocessingTask = new GeoprocessingTask(getString(R.string.hotspot_911_calls));
  mGeoprocessingTask.loadAsync();

  FloatingActionButton calendarFAB = findViewById(R.id.calendarButton);

  calendarFAB.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      showDateRangeDialog();
    }
  });

  calendarFAB.performClick();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:38,代码来源:MainActivity.java

示例7: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // get MapView from layout
  MapView mMapView = (MapView) findViewById(R.id.mapView);

  // create a map with the BasemapType topographic
  final ArcGISMap mMap = new ArcGISMap(Basemap.createTopographic());

  // set the map to be displayed in this view
  mMapView.setMap(mMap);

  // create color and symbols for drawing graphics
  SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, Color.BLUE, 14);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, Color.BLUE, null);
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3);

  // add a graphic of point, multipoint, polyline and polygon.
  GraphicsOverlay overlay = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(overlay);
  overlay.getGraphics().add(new Graphic(createPolygon(), fillSymbol));
  overlay.getGraphics().add(new Graphic(createPolyline(), lineSymbol));
  overlay.getGraphics().add(new Graphic(createMultipoint(), markerSymbol));
  overlay.getGraphics().add(new Graphic(createPoint(), markerSymbol));

  // use the envelope to set the map viewpoint
  mMapView.setViewpointGeometryAsync(createEnvelope(), getResources().getDimension(R.dimen.viewpoint_padding));

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

示例8: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // set up the bottom toolbar
    createBottomToolbar();

    // inflate MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);

    // create a map with the topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // create feature layer with its service feature table
    // create the service feature table
    ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));

    // create the feature layer using the service feature table
    mFeatureLayer = new FeatureLayer(serviceFeatureTable);

    // add the layer to the map
    map.getOperationalLayers().add(mFeatureLayer);

    // set the map to be displayed in the mapview
    mMapView.setMap(map);

    // zoom to a view point of the USA
    mMapView.setViewpointCenterAsync(new Point(-13630845, 4544861, SpatialReferences.getWebMercator()), 600000);

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

示例9: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);
    scene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());

    // set title, size, and add scene to stage
    stage.setTitle("Simple Fill Symbol Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a control panel
    vBoxControl = new VBox(6);
    vBoxControl.setMaxSize(180, 200);
    vBoxControl.getStyleClass().add("panel-region");

    createSymbolFuntionality();

    final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // set initial map view point
    Point initialPoint = new Point(-12000000, 5400000, SpatialReferences.getWebMercator());
    Viewpoint viewpoint = new Viewpoint(initialPoint, 10000000); // point, scale
    map.setInitialViewpoint(viewpoint);

    // create a view for this ArcGISMap and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // creates a square from four points
    PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
    points.add(-1.1579397849033352E7, 5618494.623878779);
    points.add(-1.158486021463032E7, 5020365.591010623);
    points.add(-1.236324731219847E7, 5009440.859816683);
    points.add(-1.2360516129399985E7, 5621225.806677263);
    Polygon square = new Polygon(points);

    // transparent red (0x88FF0000) color symbol
    fillSymbol = new SimpleFillSymbol(Style.SOLID, 0x88FF0000, null);

    // renders graphics to the GeoView
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    mapView.getGraphicsOverlays().add(graphicsOverlay);
    graphicsOverlay.getGraphics().add(new Graphic(square, fillSymbol));

    createLineSymbols();

    // add the map view and control panel to stack pane
    stackPane.getChildren().addAll(mapView, vBoxControl);
    StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
    StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));

  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:63,代码来源:SimpleFillSymbolSample.java

示例10: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Picture Marker Symbol Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a ArcGISMap with the topograph basemap
    final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // create view for this map
    mapView = new MapView();

    // create graphics overlay and add it to the mapview
    graphicsOverlay = new GraphicsOverlay();

    mapView.getGraphicsOverlays().add(graphicsOverlay);

    // create points for displaying graphics
    Point leftPoint = new Point(-228835, 6550763, SpatialReferences.getWebMercator()); // Disk
    Point rightPoint = new Point(-223560, 6552021, SpatialReferences.getWebMercator()); // URL
    Point middlePoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());

    // create orange picture marker symbol from disk
    if (saveResourceToExternalStorage()) {
      // create orange picture marker symbol
      PictureMarkerSymbol orangeSymbol = new PictureMarkerSymbol(orangeSymbolPath.getAbsolutePath());
      // place orange picture marker symbol on ArcGISMap
      placePictureMarkerSymbol(orangeSymbol, leftPoint);
    }

    // create blue picture marker symbol from local
    Image newImage = new Image("/symbols/blue_symbol.png");
    PictureMarkerSymbol blueSymbol = new PictureMarkerSymbol(newImage);
    // place blue picture marker symbol on ArcGISMap
    placePictureMarkerSymbol(blueSymbol, middlePoint);

    // create campsite picture marker symbol from URL
    PictureMarkerSymbol campsiteSymbol = new PictureMarkerSymbol(CAMPSITE_SYMBOL);

    // place campsite picture marker symbol on ArcGISMap
    map.addDoneLoadingListener(() -> {
      if (map.getLoadStatus() == LoadStatus.LOADED) {
        Platform.runLater(() -> placePictureMarkerSymbol(campsiteSymbol, rightPoint));
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Map Failed to Load!");
        alert.show();
      }
    });

    // set ArcGISMap to be displayed in mapview
    mapView.setMap(map);

    // set viewpoint on mapview with padding
    Envelope envelope = new Envelope(leftPoint, rightPoint);
    mapView.setViewpointGeometryAsync(envelope, 100.0);

    // add the map view and control panel to stack pane
    stackPane.getChildren().add(mapView);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:72,代码来源:PictureMarkerSymbolSample.java

示例11: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  StackPane stackPane = new StackPane();
  Scene fxScene = new Scene(stackPane);
  // for adding styling to any controls that are added 
  fxScene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());

  // set title, size, and add scene to stage
  stage.setTitle("Feature Layer Extrusion Sample");
  stage.setWidth(800);
  stage.setHeight(700);
  stage.setScene(fxScene);
  stage.show();

  // so scene can be visible within application
  ArcGISScene scene = new ArcGISScene(Basemap.createTopographic());
  sceneView = new SceneView();
  sceneView.setArcGISScene(scene);
  stackPane.getChildren().add(sceneView);

  // get us census data as a service feature table
  ServiceFeatureTable statesServiceFeatureTable = new ServiceFeatureTable("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3");

  // creates feature layer from table and add to scene
  final FeatureLayer statesFeatureLayer = new FeatureLayer(statesServiceFeatureTable);
  // feature layer must be rendered dynamically for extrusion to work
  statesFeatureLayer.setRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
  scene.getOperationalLayers().add(statesFeatureLayer);

  // symbols are used to display features (US states) from table
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF000000, 1.0f);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFF0000FF, lineSymbol);
  final SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
  //  need to set an extrusion type, BASE HEIGHT extrudes each point from feature individually
  renderer.getSceneProperties().setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
  statesFeatureLayer.setRenderer(renderer);

  // set camera to focus on state features
  Point lookAtPoint = new Point(-10974490, 4814376, 0, SpatialReferences.getWebMercator());
  OrbitLocationCameraController orbitCamera = new OrbitLocationCameraController(lookAtPoint, 10000000);
  sceneView.setCameraController(orbitCamera);

  // create a control panel
  VBox vBoxControl = new VBox();
  vBoxControl.setMaxSize(200, 40);
  vBoxControl.getStyleClass().add("panel-region");
  stackPane.getChildren().add(vBoxControl);
  StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
  StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));

  // controls for extruding by total population or by population density
  Button extrusionButton = new Button("Population Density");
  extrusionButton.setOnAction(v -> {
    if (showTotalPopulation) {
      // some feature's population is really big of need to sink it down
      renderer.getSceneProperties().setExtrusionExpression("[POP2007]/ 10");
      extrusionButton.setText("Population Density");
      showTotalPopulation = false;
    } else {
      // density of population is a small value to need to increase it
      renderer.getSceneProperties().setExtrusionExpression("[POP07_SQMI] * 5000");
      extrusionButton.setText("Total Population");
      showTotalPopulation = true;
    }
  });
  extrusionButton.setMaxWidth(Double.MAX_VALUE);
  extrusionButton.fire();
  vBoxControl.getChildren().add(extrusionButton);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:71,代码来源:FeatureLayerExtrusionSample.java

示例12: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Service Feature Table No Cache Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // create starting viewpoint for ArcGISMap
    SpatialReference spatialReference = SpatialReferences.getWebMercator();
    Point leftPoint = new Point(-1.30758164047166E7, 4014771.46954516, spatialReference);
    Point rightPoint = new Point(-1.30730056797177E7, 4016869.78617381, spatialReference);
    Envelope envelope = new Envelope(leftPoint, rightPoint);
    Viewpoint viewpoint = new Viewpoint(envelope);

    // set starting viewpoint for ArcGISMap
    map.setInitialViewpoint(viewpoint);

    // create service feature table from URL
    featureTable = new ServiceFeatureTable(SERVICE_FEATURE_URL);

    // set cache mode for table to no caching
    featureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE);
    FeatureLayer featureLayer = new FeatureLayer(featureTable);

    // add feature layer to ArcGISMap
    map.getOperationalLayers().add(featureLayer);

    // create a view for this ArcGISMap and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // add the map view to stack pane
    stackPane.getChildren().addAll(mapView);

  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:50,代码来源:ServiceFeatureTableNoCacheSample.java

示例13: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
  mapView = new MapView();
  StackPane appWindow = new StackPane(mapView);
  Scene scene = new Scene(appWindow);

  // set title, size, and add scene to stage
  stage.setTitle("Dictionary Renderer Graphics Overlay Sample");
  stage.setWidth(800);
  stage.setHeight(700);
  stage.setScene(scene);
  stage.show();

  ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
  mapView.setMap(map);

  graphicsOverlay = new GraphicsOverlay();
  // graphics no longer show after zooming passed this scale
  graphicsOverlay.setMinScale(1000000);
  mapView.getGraphicsOverlays().add(graphicsOverlay);

  // create symbol dictionary from specification
  DictionarySymbolStyle symbolDictionary = new DictionarySymbolStyle("mil2525d");

  // tells graphics overlay how to render graphics with symbol dictionary attributes set
  DictionaryRenderer renderer = new DictionaryRenderer(symbolDictionary);
  graphicsOverlay.setRenderer(renderer);

  // parse graphic attributes from a XML file
  List<Map<String, Object>> messages = parseMessages();

  // create graphics with attributes and add to graphics overlay
  messages.stream()
      .map(DictionaryRendererGraphicsOverlaySample::createGraphic)
      .collect(Collectors.toCollection(() -> graphicsOverlay.getGraphics()));

  // once view has loaded
  mapView.addSpatialReferenceChangedListener(e -> {
    // set initial viewpoint
    mapView.setViewpointGeometryAsync(graphicsOverlay.getExtent());
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:43,代码来源:DictionaryRendererGraphicsOverlaySample.java

示例14: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的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 imagery basemap
  ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

  // set the map to be displayed in the mapview
  mMapView.setMap(map);

  // create an initial viewpoint using an envelope (of two points, bottom left and top right)
  Envelope envelope = new Envelope(new Point(-228835, 6550763, SpatialReferences.getWebMercator()),
      new Point(-223560, 6552021, SpatialReferences.getWebMercator()));
  //set viewpoint on mapview
  mMapView.setViewpointGeometryAsync(envelope, 100.0);

  // create a new graphics overlay and add it to the mapview
  mGraphicsOverlay = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(mGraphicsOverlay);

  //[DocRef: Name=Picture Marker Symbol URL, Category=Fundamentals, Topic=Symbols and Renderers]
  //Create a picture marker symbol from a URL resource
  //When using a URL, you need to call load to fetch the remote resource
  final PictureMarkerSymbol campsiteSymbol = new PictureMarkerSymbol(
      "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0/images/e82f744ebb069bb35b234b3fea46deae");
  //Optionally set the size, if not set the image will be auto sized based on its size in pixels,
  //its appearance would then differ across devices with different resolutions.
  campsiteSymbol.setHeight(18);
  campsiteSymbol.setWidth(18);
  campsiteSymbol.loadAsync();
  //[DocRef: END]
  campsiteSymbol.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      //Once the symbol has loaded, add a new graphic to the graphic overlay
      Point campsitePoint = new Point(-223560, 6552021, SpatialReferences.getWebMercator());
      Graphic campsiteGraphic = new Graphic(campsitePoint, campsiteSymbol);
      mGraphicsOverlay.getGraphics().add(campsiteGraphic);
    }
  });

  //[DocRef: Name=Picture Marker Symbol Drawable-android, Category=Fundamentals, Topic=Symbols and Renderers]
  //Create a picture marker symbol from an app resource
  BitmapDrawable pinStarBlueDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin_star_blue);
  final PictureMarkerSymbol pinStarBlueSymbol = new PictureMarkerSymbol(pinStarBlueDrawable);
  //Optionally set the size, if not set the image will be auto sized based on its size in pixels,
  //its appearance would then differ across devices with different resolutions.
  pinStarBlueSymbol.setHeight(40);
  pinStarBlueSymbol.setWidth(40);
  //Optionally set the offset, to align the base of the symbol aligns with the point geometry
  pinStarBlueSymbol.setOffsetY(
      11); //The image used for the symbol has a transparent buffer around it, so the offset is not simply height/2
  pinStarBlueSymbol.loadAsync();
  //[DocRef: END]
  pinStarBlueSymbol.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      //add a new graphic with the same location as the initial viewpoint
      Point pinStarBluePoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
      Graphic pinStarBlueGraphic = new Graphic(pinStarBluePoint, pinStarBlueSymbol);
      mGraphicsOverlay.getGraphics().add(pinStarBlueGraphic);
    }
  });

  //see createPictureMarkerSymbolFromFile() method for implementation
  //first run checks for external storage and permissions,
  checkSaveResourceToExternalStorage();

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

示例15: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的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 topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    //[DocRef: Name=Unique Value Renderer, Topic=Symbols and Renderers, Category=Fundamentals]
    // Create service feature table
    ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));

    // Create the feature layer using the service feature table
    FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);

    // Override the renderer of the feature layer with a new unique value renderer
    UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
    // Set the field to use for the unique values
    uniqueValueRenderer.getFieldNames().add("STATE_ABBR"); //You can add multiple fields to be used for the renderer in the form of a list, in this case we are only adding a single field

    // Create the symbols to be used in the renderer
    SimpleFillSymbol defaultFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.NULL, Color.BLACK, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GRAY, 2));
    SimpleFillSymbol californiaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.RED, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2));
    SimpleFillSymbol arizonaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.GREEN, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GREEN, 2));
    SimpleFillSymbol nevadaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID,Color.BLUE, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 2));

    // Set default symbol
    uniqueValueRenderer.setDefaultSymbol(defaultFillSymbol);
    uniqueValueRenderer.setDefaultLabel("Other");

    // Set value for california
    List<Object> californiaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    californiaValue.add("CA");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("California", "State of California", californiaFillSymbol, californiaValue));

    // Set value for arizona
    List<Object> arizonaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    arizonaValue.add("AZ");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("Arizona", "State of Arizona", arizonaFillSymbol, arizonaValue));

    // Set value for nevada
    List<Object> nevadaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    nevadaValue.add("NV");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("Nevada", "State of Nevada", nevadaFillSymbol, nevadaValue));

    // Set the renderer on the feature layer
    featureLayer.setRenderer(uniqueValueRenderer);
    //[DocRef: END]

    // add the layer to the map
    map.getOperationalLayers().add(featureLayer);

    map.setInitialViewpoint(new Viewpoint(new Envelope(-13893029.0, 3573174.0, -12038972.0, 5309823.0, SpatialReferences.getWebMercator())));

    // set the map to be displayed in the mapview
    mMapView.setMap(map);

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


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