点击谷歌地图时,我想绘制正方形。 如何在代码中编写它? 如下所示,我的代码是绘制圆圈,但我想绘制正方形 请帮帮我......
public class Map extends Activity implements OnMapClickListener{
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Circle myCircle;
@Override
protected void onCreate(Bundle savedInstanceState) {
//TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
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.setBuildingsEnabled(true);
}
@Override
public void onMapClick(LatLng point) {
int b=3;
CircleOptions circleOptions = new CircleOptions()
.center(point) //set center
.radius(500) //set radius in meters
.fillColor(Color.TRANSPARENT) //default
.strokeColor(Color.BLUE)
.strokeWidth(5);
for(int c=0; c < b ; c++){
myCircle = myMap.addCircle(circleOptions);
}
}
}