本文整理汇总了Java中com.esri.arcgisruntime.tasks.geocode.LocatorTask类的典型用法代码示例。如果您正苦于以下问题:Java LocatorTask类的具体用法?Java LocatorTask怎么用?Java LocatorTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocatorTask类属于com.esri.arcgisruntime.tasks.geocode包,在下文中一共展示了LocatorTask类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpOfflineMapGeocoding
import com.esri.arcgisruntime.tasks.geocode.LocatorTask; //导入依赖的package包/类
private void setUpOfflineMapGeocoding() {
// create a basemap from a local tile package
TileCache tileCache = new TileCache(extern + getResources().getString(R.string.sandiego_tpk));
tiledLayer = new ArcGISTiledLayer(tileCache);
Basemap basemap = new Basemap(tiledLayer);
// create ArcGISMap with imagery basemap
mMap = new ArcGISMap(basemap);
mMapView.setMap(mMap);
mMap.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
Point p = new Point(-117.162040, 32.718260, SpatialReference.create(4326));
Viewpoint vp = new Viewpoint(p, 10000);
mMapView.setViewpointAsync(vp, 3);
}
});
// add a graphics overlay
graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.setSelectionColor(Color.CYAN);
mMapView.getGraphicsOverlays().add(graphicsOverlay);
mGeocodeParameters = new GeocodeParameters();
mGeocodeParameters.getResultAttributeNames().add("*");
mGeocodeParameters.setMaxResults(1);
//[DocRef: Name=Picture Marker Symbol Drawable-android, Category=Fundamentals, Topic=Symbols and Renderers]
//Create a picture marker symbol from an app resource
BitmapDrawable startDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin);
mPinSourceSymbol = new PictureMarkerSymbol(startDrawable);
mPinSourceSymbol.setHeight(90);
mPinSourceSymbol.setWidth(20);
mPinSourceSymbol.loadAsync();
mPinSourceSymbol.setLeaderOffsetY(45);
mPinSourceSymbol.setOffsetY(-48);
mReverseGeocodeParameters = new ReverseGeocodeParameters();
mReverseGeocodeParameters.getResultAttributeNames().add("*");
mReverseGeocodeParameters.setOutputSpatialReference(mMap.getSpatialReference());
mReverseGeocodeParameters.setMaxResults(1);
mLocatorTask = new LocatorTask(extern + getResources().getString(R.string.sandiego_loc));
mCalloutContent = new TextView(getApplicationContext());
mCalloutContent.setTextColor(Color.BLACK);
mCalloutContent.setTextIsSelectable(true);
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:53,代码来源:MainActivity.java
示例2: onCreate
import com.esri.arcgisruntime.tasks.geocode.LocatorTask; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// inflate address search view
mAddressSearchView = (SearchView) findViewById(R.id.addressSearchView);
mAddressSearchView.setIconified(false);
mAddressSearchView.setFocusable(false);
mAddressSearchView.setQueryHint(getResources().getString(R.string.address_search_hint));
// define pin drawable
BitmapDrawable pinDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin);
try {
mPinSourceSymbol = PictureMarkerSymbol.createAsync(pinDrawable).get();
} catch (InterruptedException | ExecutionException e) {
Log.e(TAG, "Picture Marker Symbol error: " + e.getMessage());
Toast.makeText(getApplicationContext(), "Failed to load pin drawable.", Toast.LENGTH_LONG).show();
}
// set pin to half of native size
mPinSourceSymbol.setWidth(19f);
mPinSourceSymbol.setHeight(72f);
// create a LocatorTask from an online service
mLocatorTask = new LocatorTask("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the BasemapType topographic
final ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());
// set the map to be displayed in this view
mMapView.setMap(map);
// set the map viewpoint to start over North America
mMapView.setViewpoint(new Viewpoint(40, -100, 100000000));
// add listener to handle screen taps
mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView) {
@Override
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
identifyGraphic(motionEvent);
return true;
}
});
// define the graphics overlay
mGraphicsOverlay = new GraphicsOverlay();
setupAddressSearchView();
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:50,代码来源:MainActivity.java
示例3: initialize
import com.esri.arcgisruntime.tasks.geocode.LocatorTask; //导入依赖的package包/类
public void initialize() {
// create a scene
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
sceneView.setArcGISScene(scene);
// add base surface for elevation data
String surfaceURL = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(surfaceURL));
scene.setBaseSurface(surface);
// add a camera
Camera camera = new Camera(33.98, -117.177526, 5000, 0, 70, 0.0);
sceneView.setViewpointCamera(camera);
// get features from an online feature layer
String pointsURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/0";
pointsFeatureTable = new ServiceFeatureTable(pointsURL);
FeatureLayer pointsFeatureLayer = new FeatureLayer(pointsFeatureTable);
scene.getOperationalLayers().add(pointsFeatureLayer);
String polysURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/2";
polysFeatureTable = new ServiceFeatureTable(polysURL);
FeatureLayer polysFeatureLayer = new FeatureLayer(polysFeatureTable);
scene.getOperationalLayers().add(polysFeatureLayer);
// add graphics overlays
groundGraphicsOverlay = new GraphicsOverlay();
groundGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);
sceneView.getGraphicsOverlays().add(groundGraphicsOverlay);
buildingGraphicsOverlay = new GraphicsOverlay();
SimpleRenderer renderer = new SimpleRenderer();
Renderer.SceneProperties renderProperties = renderer.getSceneProperties();
renderProperties.setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
renderProperties.setExtrusionExpression("height");
buildingGraphicsOverlay.setRenderer(renderer);
buildingGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
sceneView.getGraphicsOverlays().add(buildingGraphicsOverlay);
airGraphicsOverlay = new GraphicsOverlay();
airGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(airGraphicsOverlay);
// create an online geolocator task
String locatorURL = "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";
locatorTask = new LocatorTask(locatorURL);
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:51,代码来源:MonitorController.java
示例4: setMapView
import com.esri.arcgisruntime.tasks.geocode.LocatorTask; //导入依赖的package包/类
/**
* Takes a MapView that has already been instantiated to show a WebMap,
* completes its setup by setting various listeners and attributes, and sets
* it as the activity's content view.
*
* @param mapView
*/
private void setMapView(final MapView mapView) {
mMapView = mapView;
mMapView.setWrapAroundMode(WrapAroundMode.ENABLE_WHEN_SUPPORTED);
// Creating an inflater
mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// Setting up the layout params for the searchview and searchresult
// layout
mlayoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.LEFT | Gravity.TOP);
int LEFT_MARGIN_SEARCH = 15;
int RIGHT_MARGIN_SEARCH = 15;
int BOTTOM_MARGIN_SEARCH = 0;
mlayoutParams.setMargins(LEFT_MARGIN_SEARCH, TOP_MARGIN_SEARCH, RIGHT_MARGIN_SEARCH, BOTTOM_MARGIN_SEARCH);
// Displaying the searchbox layout
showSearchBoxLayout();
// Show current location
mLocationDisplay = mapView.getLocationDisplay();
mLocationDisplay.setAutoPanMode(LocationDisplay.AutoPanMode.RECENTER);
mLocationDisplay.startAsync();
mLocationDisplay.setInitialZoomScale(50000);
// Handle any location changes
mLocationDisplay.addLocationChangedListener(new LocationListener());
// Setup use of magnifier on a long press on the map
mMapView.setMagnifierEnabled(true);
mLongPressEvent = null;
// Setup OnTouchListener to detect and act on long-press
mMapView.setOnTouchListener(new MapTouchListener(getActivity().getApplicationContext(), mMapView));
mLocator = new LocatorTask(getString(R.string.geocode_url));
}
开发者ID:Esri,项目名称:maps-app-android,代码行数:49,代码来源:MapFragment.java
注:本文中的com.esri.arcgisruntime.tasks.geocode.LocatorTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论