code: public static void toKMLGeometry(Geometry geometry, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) throws SQLException {
          if (geometry instanceof Point) {
              toKMLPoint((Point) geometry, extrude, altitudeModeEnum, sb);
          } else if (geometry instanceof LineString) {
              toKMLLineString((LineString) geometry, extrude, altitudeModeEnum, sb);
          } else if (geometry instanceof Polygon) {
              toKMLPolygon((Polygon) geometry, extrude, altitudeModeEnum, sb);
          } else if (geometry instanceof GeometryCollection) {
              toKMLMultiGeometry((GeometryCollection) geometry, extrude, altitudeModeEnum, sb);
          } else {
              throw new SQLException("This geometry type is not supported : " + geometry.toString());
          }
      }
docs: Convert JTS geometry to a kml geometry representation.
  
  @param geometry
  @param extrude
  @param altitudeModeEnum
  @param sb