boolean ring) {
if (node.hasChild(DirectPosition.class)) {
List dps = node.getChildValues(DirectPosition.class);
DirectPosition dp = (DirectPosition) dps.get(0);
CoordinateSequence seq = csf.create(dps.size(), dp.getDimension());
for (int i = 0; i < dps.size(); i++) {
dp = (DirectPosition) dps.get(i);
for (int j = 0; j < dp.getDimension(); j++) {
seq.setOrdinate(i, j, dp.getOrdinate(j));
}
}
return ring ? gf.createLinearRing(seq) : gf.createLineString(seq);
}
if (node.hasChild(Point.class)) {
List points = node.getChildValues(Point.class);
Coordinate[] coordinates = new Coordinate[points.size()];
for (int i = 0; i < points.size(); i++) {
coordinates[i] = ((Point) points.get(0)).getCoordinate();
}
return ring ? gf.createLinearRing(coordinates) : gf.createLineString(coordinates);
}
if (node.hasChild(Coordinate.class)) {
List list = node.getChildValues(Coordinate.class);
Coordinate[] coordinates = (Coordinate[]) list.toArray(new Coordinate[list.size()]);
return ring ? gf.createLinearRing(coordinates) : gf.createLineString(coordinates);
}
if (node.hasChild(DirectPosition[].class)) {
DirectPosition[] dps = (DirectPosition[]) node.getChildValue(DirectPosition[].class);
CoordinateSequence seq = null;
if (dps.length == 0) {
seq = csf.create(0, 0);
} else {
seq = csf.create(dps.length, dps[0].getDimension());
for (int i = 0; i < dps.length; i++) {
DirectPosition dp = (DirectPosition) dps[i];
for (int j = 0; j < dp.getDimension(); j++) {
seq.setOrdinate(i, j, dp.getOrdinate(j));
}
}
}
return ring ? gf.createLinearRing(seq) : gf.createLineString(seq);
}
if (node.hasChild(CoordinateSequence.class)) {
CoordinateSequence seq = (CoordinateSequence) node.getChildValue(CoordinateSequence.class);
return ring ? gf.createLinearRing(seq) : gf.createLineString(seq);
}
return null;