这是我的代码,允许用户在地图上绘制圆圈以标记某个区域,然后保存它但我想获得圆形线的点,就像在我的图片中一样,因为我想保存这些点但我不知道采用圆点的方法是什么。
public class Map extends Activity implements OnMapClickListener{
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Circle myCircle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
TabHost th = (TabHost) findViewById (R.id.tabhost);
th.setup();
TabSpec ts = th.newTabSpec("tag1");
ts.setContent(R.id.tab2);
ts.setIndicator("Draw Boundary");
th.addTab(ts);
ts = th.newTabSpec("tag2");
ts.setContent(R.id.tab1);
ts.setIndicator("Map");
th.addTab(ts);
ts = th.newTabSpec("tag3");
ts.setContent(R.id.tab3);
ts.setIndicator("Sign out");
th.addTab(ts);
FragmentManager myFragmentManager = getFragmentManager();
MapFragment myMapFragment = (MapFragment)myFragmentManager.findFragmentById(R.id.map);
myMap = myMapFragment.getMap();
myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
myMap.setOnMapClickListener(this);
myMap.setMyLocationEnabled(true);
myMap.getCameraPosition();
}
@Override
public void onMapClick(LatLng point) {
CircleOptions circleOptions = new CircleOptions()
.center(point) //set center
.radius(500) //set radius in meters
.fillColor(Color.TRANSPARENT) //default
.strokeColor(Color.BLUE)
.strokeWidth(5);
myCircle = myMap.addCircle(circleOptions);
}
}
答案 0 :(得分:0)
我认为单程是
private ArrayList<CircleOptions> points = new ArrayList<CircleOptions>
@Override
public void onMapClick(LatLng point) {
CircleOptions circleOptions = new CircleOptions()
.center(point) //set center
.radius(500) //set radius in meters
.fillColor(Color.TRANSPARENT) //default
.strokeColor(Color.BLUE)
.strokeWidth(5);
myCircle = myMap.addCircle(circleOptions);
points.add(circleOptions);
}