ArcGIS For Android 之客户端添加要素(130412)

         ArcGIS Android 中提供了一个客户端的要素图层GraphicsLayer 。今天就把,那些添加不同要素的范例或者Api进行归纳一下。(技术声明:由于本人技术有限,有疏漏和错误的地方请留言纠正!)

         

       1 .  首先做一个给地图图层增加一个点:

              代码范例是在设置地图单击监听中进行实现:

   

                final GraphicsLayer graphicsLayer = new GraphicsLayer();
		mMapView.addLayer(graphicsLayer);
		mMapView.setOnSingleTapListener(new OnSingleTapListener() {
			public void onSingleTap(float x, float y) {
				// TODO Auto-generated method stub
				//实现点击地图,添加一个红色的点
				Graphic graphic = new Graphic(mMapView.toMapPoint(x, y),
						new SimpleMarkerSymbol(Color.RED, 15, STYLE.CIRCLE));
				graphicsLayer.addGraphic(graphic);
				Log.v(TAG, "add simpleMarker");

			}
		});
    

  实现的效果图:

ArcGIS For Android 之客户端添加要素(130412)_第1张图片

2.然后用PictureMakerSymbol给图增加图片:

    代码范例是在设置地图单击监听中进行实现:

final GraphicsLayer graphicsLayer = new GraphicsLayer();
		mMapView.addLayer(graphicsLayer);
		mMapView.setOnSingleTapListener(new OnSingleTapListener() {
			public void onSingleTap(float x, float y) {
				// TODO Auto-generated method stub

				Resources res = getResources();
				Drawable drawable = res.getDrawable(R.drawable.jtjq_01);
				Graphic graphic = new Graphic(mMapView.toMapPoint(x, y),
						new PictureMarkerSymbol(drawable));
				graphicsLayer.addGraphic(graphic);
				Log.v(TAG, "add simpleMarker");

			}
		});


 


 

你可能感兴趣的:(android,arcgis,添加客户端要素,地图加图片)