本文整理汇总了Java中com.esri.arcgisruntime.mapping.ArcGISMap.setInitialViewpoint方法的典型用法代码示例。如果您正苦于以下问题:Java ArcGISMap.setInitialViewpoint方法的具体用法?Java ArcGISMap.setInitialViewpoint怎么用?Java ArcGISMap.setInitialViewpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.arcgisruntime.mapping.ArcGISMap
的用法示例。
在下文中一共展示了ArcGISMap.setInitialViewpoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
}
示例2: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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();
}
示例3: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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();
}
}
示例4: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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 light grey canvas basemap
ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas());
//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 cache (which is also the default mode for service feature tables)
serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_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);
}
示例5: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
}
示例6: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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.createImagery());
// create an initial viewpoint with a point and scale
Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
Viewpoint vp = new Viewpoint(point, 7500);
// set initial map extent
map.setInitialViewpoint(vp);
// set the map to be displayed in the mapview
mMapView.setMap(map);
// create a new graphics overlay and add it to the mapview
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
mMapView.getGraphicsOverlays().add(graphicsOverlay);
//[DocRef: Name=Point graphic with symbol, Category=Fundamentals, Topic=Symbols and Renderers]
//create a simple marker symbol
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 12); //size 12, style of circle
//add a new graphic with a new point geometry
Point graphicPoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
Graphic graphic = new Graphic(graphicPoint, symbol);
graphicsOverlay.getGraphics().add(graphic);
//[DocRef: END]
}
示例7: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
}
示例8: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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 terrain with labels basemap
ArcGISMap map = new ArcGISMap(Basemap.createTerrainWithLabels());
//set an initial viewpointf
map.setInitialViewpoint(new Viewpoint(new Point(-13176752, 4090404, SpatialReferences.getWebMercator()), 500000));
// 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
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);
}
示例9: onCreate
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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();
}
示例10: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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 Line Symbol Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
// create a control panel
VBox vBoxControl = new VBox(6);
vBoxControl.setMaxSize(180, 200);
vBoxControl.getStyleClass().add("panel-region");
createSymbolFuntionality(vBoxControl);
final ArcGISMap map = new ArcGISMap(Basemap.createImagery());
// set initial map view point
Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
Viewpoint viewpoint = new Viewpoint(point, 7200); // point, scale
map.setInitialViewpoint(viewpoint);
// create a view for this ArcGISMap and set ArcGISMap to it
mapView = new MapView();
mapView.setMap(map);
// creates a line from two points
PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
points.add(-226913, 6550477);
points.add(-226643, 6550477);
Polyline line = new Polyline(points);
// creates a solid red (0xFFFF0000) simple line symbol
lineSymbol = new SimpleLineSymbol(Style.SOLID, 0xFFFF0000, 3);
// add line with symbol to graphics overlay and add overlay to map view
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
mapView.getGraphicsOverlays().add(graphicsOverlay);
graphicsOverlay.getGraphics().add(new Graphic(line, lineSymbol));
// 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();
}
}
示例11: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
// size the stage, add a title, and set scene to stage
stage.setTitle("Simple Marker Symbol Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
// create ArcGISMap with imagery basemap
final ArcGISMap map = new ArcGISMap(Basemap.createImagery());
// create spatial reference for WGS 1948
final SpatialReference webMercator = SpatialReferences.getWebMercator();
// create a initial viewpoint with a center point and scale
Point point = new Point(-226773, 6550477, webMercator);
Viewpoint viewpoint = new Viewpoint(point, 7500);
// set initial view point to the ArcGISMap
map.setInitialViewpoint(viewpoint);
// create a view and set ArcGISMap to it
mapView = new MapView();
mapView.setMap(map);
// create new graphics overlay and add it to the mapview
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
mapView.getGraphicsOverlays().add(graphicsOverlay);
// create a red (0xFFFF0000) simple marker symbol
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 12);
// create a new graphic with a our point and symbol
Graphic graphic = new Graphic(point, symbol);
graphicsOverlay.getGraphics().add(graphic);
// add the map view and control box to stack pane
stackPane.getChildren().add(mapView);
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
示例12: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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();
}
}
示例13: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
// size the stage, add a title, and set scene to stage
stage.setTitle("Feature Layer Feature Service Sample");
stage.setHeight(700);
stage.setWidth(800);
stage.setScene(scene);
stage.show();
// create a view for this ArcGISMap
mapView = new MapView();
// create a ArcGISMap with the terrain with labels basemap
ArcGISMap map = new ArcGISMap(Basemap.createTerrainWithLabels());
// set an initial viewpoint
map.setInitialViewpoint(new Viewpoint(new Point(-13176752, 4090404, SpatialReferences.getWebMercator()), 500000));
// create feature layer with its service feature table
// create the service feature table
ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(GEOLOGY_FEATURE_SERVICE);
// create the feature layer using the service feature table
FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
// add the layer to the ArcGISMap
map.getOperationalLayers().add(featureLayer);
// set the ArcGISMap to be displayed in the view
mapView.setMap(map);
// add the map view to stack pane
stackPane.getChildren().add(mapView);
} catch (Exception e) {
// on any error, display stack trace
e.printStackTrace();
}
}
示例14: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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();
}
}
示例15: start
import com.esri.arcgisruntime.mapping.ArcGISMap; //导入方法依赖的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);
// size the stage, add a title, and set scene to stage
stage.setTitle("Service Feature Table Cache Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
// create a view for this ArcGISMap
mapView = new MapView();
// create a ArcGISMap with the light Gray Canvas basemap
ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas());
// set an initial viewpoint
map.setInitialViewpoint(new Viewpoint(new Envelope(-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7,
4016869.78617381, 0, 0, SpatialReferences.getWebMercator())));
// create feature layer with its service feature table
// create the service feature table
ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(FEATURE_SERVICE_URL);
// explicitly set the mode to on interaction cache (which is also
// the default mode for service feature tables)
serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE);
// create the feature layer using the service feature table
FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
// add the layer to the ArcGISMap
map.getOperationalLayers().add(featureLayer);
// set ArcGISMap to be displayed in ArcGISMap view
mapView.setMap(map);
// add the map view to stack pane
stackPane.getChildren().addAll(mapView);
} catch (Exception e) {
// on any error, display stack trace
e.printStackTrace();
}
}