use of com.revolsys.record.io.RecordReader in project com.revolsys.open by revolsys.
the class EsriCoordinateSystemsTest method doFileTest.
private void doFileTest(final String type) {
try (RecordReader reader = RecordReader.newRecordReader("../com.revolsys.open.coordinatesystems/src/main/data/esri/esri" + type + "Cs.tsv")) {
for (final Record record : reader) {
final int id = record.getInteger("ID");
final String wkt = record.getString("WKT");
final GeometryFactory geometryFactory = GeometryFactory.floating2d(wkt);
final int coordinateSystemId = geometryFactory.getCoordinateSystemId();
Assert.assertEquals(id, coordinateSystemId);
Assert.assertEquals(2, geometryFactory.getAxisCount());
final String actualWkt = geometryFactory.toWktCs();
if (Property.isEmpty(actualWkt)) {
GeometryFactory.floating2d(wkt);
geometryFactory.toWktCs();
}
Assert.assertEquals(wkt, actualWkt);
}
}
}
use of com.revolsys.record.io.RecordReader in project com.revolsys.open by revolsys.
the class EsriCoordinateSystemsTest method verticalCoordinateSystems.
@Test
public void verticalCoordinateSystems() {
try (RecordReader reader = RecordReader.newRecordReader("../com.revolsys.open.coordinatesystems/src/main/data/esri/esriVerticalCs.tsv")) {
for (final Record record : reader) {
final int id = record.getInteger("ID");
final String wkt = record.getString("WKT");
if (wkt.contains("VDATUM")) {
final CoordinateSystem coordinateSystem = CoordinateSystem.getCoordinateSystem(wkt);
final int coordinateSystemId = coordinateSystem.getCoordinateSystemId();
Assert.assertEquals(id, coordinateSystemId);
final String actualWkt = coordinateSystem.toEsriWktCs();
if (Property.isEmpty(actualWkt)) {
CoordinateSystem.getCoordinateSystem(wkt);
coordinateSystem.toEsriWktCs();
}
Assert.assertEquals(wkt, actualWkt);
}
}
}
}
use of com.revolsys.record.io.RecordReader in project com.revolsys.open by revolsys.
the class PathTreeNode method actionExportRecords.
private void actionExportRecords() {
final Path path = getPath();
boolean hasGeometryField;
try (RecordReader reader = RecordReader.newRecordReader(path)) {
if (reader == null) {
return;
} else {
final RecordDefinition recordDefinition = reader.getRecordDefinition();
if (recordDefinition == null) {
return;
} else {
hasGeometryField = recordDefinition.hasGeometryField();
}
}
}
final String title = Paths.getBaseName(path);
AbstractRecordLayer.exportRecords(title, hasGeometryField, targetFile -> RecordIo.copyRecords(path, targetFile));
}
Aggregations