code: @Override
  	protected void addCoordinateToGeometry(Coordinate newCoordinate) {
  		boolean geometryHasCoordinates = geometry.getCoordinates() != null;
  
  		// determine length and coordinates
  		int length = geometryHasCoordinates ? geometry.getCoordinates().length : 0;
  		Coordinate[] oldCoords = geometryHasCoordinates ? geometry.getCoordinates() : null;
  		Coordinate[] newCoords = new Coordinate[length + 1];
  		if (geometryHasCoordinates) {
  			System.arraycopy(oldCoords, 0, newCoords, 0, length);
  		}
  
  		// put new coordinate in right position
  		if (newCoords.length < 2) {
  			newCoords[length] = newCoordinate;
  		} else {
  			newCoords[length] = newCoords[length - 1];
  			newCoords[length - 1] = newCoordinate;
  		}
  
  		// create new geometry
  		LinearRing linearRing = factory.createLinearRing(newCoords);
  		geometry = factory.createPolygon(linearRing, null);
  
  		// update drawing
  		updateTempLineAfterClick();
  	}
docs: -------------------------------------------------------------------------