gmap component supports the drawing of rectangles, circles, polylines, and polygons on the map canvas.
All drawings can be implemented as an instance of
DefaultMapModel, as stated here:
private MapModel rectangleModel = new DefaultMapModel(); private MapModel circleModel = new DefaultMapModel(); private MapModel polylineModel = new DefaultMapModel(); private MapModel polygonModel = new DefaultMapModel();
All models contain instances of
LatLng, where they define the points for the drawings. The rectangle model can be defined with two points, upper-left and lower-right, which are wrapped in an instance of
LatLngBounds. This is shown in the following code: