141 if (gis_type_name.equalsIgnoreCase(
"geometry")
142 || gis_type_name.equalsIgnoreCase(
"geography")) {
143 Object gis_object = rs.getObject(column_number);
144 PGgeometry pGeometry = (PGgeometry) gis_object;
145 if (pGeometry == null)
throw new SQLException(
"unknown type");
149 int semi_colon_indx = pGeometry.getValue().
indexOf(
';');
150 if (-1 != semi_colon_indx && semi_colon_indx < pGeometry.getValue().length()) {
151 return pGeometry.getValue().substring(semi_colon_indx + 1);
153 return pGeometry.getValue();
155 StringBuffer WKT_string =
new StringBuffer();
156 if (gis_type_name.equalsIgnoreCase(
"point")) {
157 PGpoint point = (PGpoint) rs.getObject(column_number);
158 WKT_string.append(extra_types.get(gis_type_name) +
"(" +
wkt_point(point) +
")");
160 }
else if (gis_type_name.equalsIgnoreCase(
"polygon")) {
161 PGpolygon polygon = (PGpolygon) rs.getObject(column_number);
162 WKT_string.append(extra_types.get(gis_type_name) +
"((");
163 for (PGpoint p : polygon.points) {
166 WKT_string.replace(WKT_string.length() - 1, WKT_string.length(),
"))");
167 }
else if (gis_type_name.equalsIgnoreCase(
"lseg")) {
168 PGlseg lseg = (PGlseg) rs.getObject(column_number);
169 WKT_string.append(extra_types.get(gis_type_name) +
"(");
170 for (PGpoint p : lseg.point) {
173 WKT_string.replace(WKT_string.length() - 1, WKT_string.length(),
")");
175 return WKT_string.toString();
String wkt_point(PGpoint point)
size_t indexOf(std::vector< T > &vec, T val)