use of com.revolsys.geometry.model.impl.LineStringDouble in project com.revolsys.open by revolsys.
the class ScaledNoder method rescale.
private NodedSegmentString rescale(final NodedSegmentString segment) {
final LineString points = segment.getLineString();
final int axisCount = points.getAxisCount();
final int vertexCount = points.getVertexCount();
final double[] coordinates = new double[vertexCount * axisCount];
for (int i = 0; i < vertexCount; i++) {
final double x = points.getX(i) / this.scaleFactor + this.offsetX;
final double y = points.getY(i) / this.scaleFactor + this.offsetY;
CoordinatesListUtil.setCoordinates(coordinates, axisCount, i, x, y);
for (int axisIndex = 2; axisIndex < axisCount; axisIndex++) {
final double value = points.getCoordinate(i, axisIndex);
coordinates[i * axisCount + axisIndex] = value;
}
}
final LineStringDouble newPoints = new LineStringDouble(axisCount, coordinates);
final Object data = segment.getData();
return new NodedSegmentString(newPoints, data);
}
use of com.revolsys.geometry.model.impl.LineStringDouble in project com.revolsys.open by revolsys.
the class SegmentNodeList method newSplitEdge.
/**
* Construct a new new "split edge" with the section of points between
* (and including) the two intersections.
* The label for the new edge is the same as the label for the parent edge.
*/
SegmentString newSplitEdge(final SegmentNode ei0, final SegmentNode ei1) {
// Debug.println("\ncreateSplitEdge"); Debug.print(ei0); Debug.print(ei1);
int npts = ei1.getSegmentIndex() - ei0.getSegmentIndex() + 2;
// if the last intersection point is not equal to the its segment start pt,
// add it to the points list as well.
// (This check is needed because the distance metric is not totally
// reliable!)
// The check for point equality is 2D only - Z values are ignored
final boolean useIntPt1 = ei1.isInterior() || !this.edge.equalsVertex(ei1.getSegmentIndex(), ei1.getX(), ei1.getY());
if (!useIntPt1) {
npts--;
}
final int axisCount = this.edge.getLineString().getAxisCount();
final double[] coordinates = new double[npts * axisCount];
int ipt = 0;
CoordinatesListUtil.setCoordinates(coordinates, axisCount, ipt++, ei0);
for (int i = ei0.getSegmentIndex() + 1; i <= ei1.getSegmentIndex(); i++) {
CoordinatesListUtil.setCoordinates(coordinates, axisCount, ipt++, this.edge, i);
}
if (useIntPt1) {
CoordinatesListUtil.setCoordinates(coordinates, axisCount, ipt++, ei1);
}
final LineStringDouble points = new LineStringDouble(axisCount, coordinates);
return new NodedSegmentString(points, this.edge.getData());
}
use of com.revolsys.geometry.model.impl.LineStringDouble in project com.revolsys.open by revolsys.
the class ShapefileGeometryHandler method readMultipoint.
public Punctual readMultipoint(final GeometryFactory geometryFactory, final ByteBuffer buffer, final int recordLength) {
buffer.getDouble();
buffer.getDouble();
buffer.getDouble();
buffer.getDouble();
final int vertexCount = buffer.getInt();
final double[] coordinates = readXYCoordinates(buffer, vertexCount, 2);
return geometryFactory.punctual(new LineStringDouble(2, coordinates));
}
use of com.revolsys.geometry.model.impl.LineStringDouble in project com.revolsys.open by revolsys.
the class ShapefileGeometryUtil method readMultipointZ.
public Punctual readMultipointZ(final GeometryFactory geometryFactory, final EndianInput in, final int recordLength) throws IOException {
in.skipBytes(4 * MathUtil.BYTES_IN_DOUBLE);
final int vertexCount = in.readLEInt();
final double[] coordinates = readXYCoordinates(in, vertexCount, 3);
in.skipBytes(2 * MathUtil.BYTES_IN_DOUBLE);
readCoordinates(in, vertexCount, 3, coordinates, 2);
return geometryFactory.punctual(new LineStringDouble(3, coordinates));
}
use of com.revolsys.geometry.model.impl.LineStringDouble in project com.revolsys.open by revolsys.
the class ShapefileGeometryUtil method readMultipoint.
public Punctual readMultipoint(final GeometryFactory geometryFactory, final EndianInput in, final int recordLength) throws IOException {
in.skipBytes(4 * MathUtil.BYTES_IN_DOUBLE);
final int vertexCount = in.readLEInt();
final double[] coordinates = readXYCoordinates(in, vertexCount, 2);
return geometryFactory.punctual(new LineStringDouble(2, coordinates));
}
Aggregations