use of com.revolsys.spring.resource.PathResource in project com.revolsys.open by revolsys.
the class BufferTest method performanceTest.
public static void performanceTest() throws Throwable {
// JTS takes 3.4 seconds
final PathResource resource = new PathResource("/Users/paustin/Development/ALL/com.revolsys.open/com.revolsys.open.core/src/test/resources/com/revolsys/jts/test/data/world.wkt");
List<Geometry> geometries = new ArrayList<>();
try (Reader<Geometry> reader = GeometryReader.newGeometryReader(resource)) {
geometries = reader.toList();
}
for (final Geometry geometry : geometries) {
geometry.buffer(5);
}
final long time = System.currentTimeMillis();
for (final Geometry geometry : geometries) {
geometry.buffer(5);
}
System.out.println(System.currentTimeMillis() - time);
}
use of com.revolsys.spring.resource.PathResource in project com.revolsys.open by revolsys.
the class AbstractDirectoryReader method open.
@Override
@PostConstruct
public void open() {
for (final File file : getFiles()) {
final PathResource resource = new PathResource(file);
final Reader<T> reader = newReader(resource);
reader.open();
if (reader != null) {
this.readers.put(file, reader);
}
}
this.readerIterator = this.readers.entrySet().iterator();
hasNext();
}
use of com.revolsys.spring.resource.PathResource in project com.revolsys.open by revolsys.
the class ShapefileZip method newRecordWriter.
@Override
public RecordWriter newRecordWriter(final String baseName, final RecordDefinition recordDefinition, final OutputStream outputStream, final Charset charset) {
File directory;
try {
directory = FileUtil.newTempDirectory(baseName, "zipDir");
} catch (final Throwable e) {
throw new RuntimeException("Unable to create temporary directory", e);
}
final Resource tempResource = new PathResource(new File(directory, baseName + ".shp"));
final RecordWriter shapeWriter = new ShapefileRecordWriter(recordDefinition, tempResource);
return new ZipRecordWriter(directory, shapeWriter, outputStream);
}
use of com.revolsys.spring.resource.PathResource in project com.revolsys.open by revolsys.
the class TriangulationVisualization method tinVisualLas.
public static void tinVisualLas() {
final PathResource sourceFile = new PathResource("/data/dem/elevation/las/bc_093g057c_xl2m_2015_dem_ground.las");
final TriangulatedIrregularNetwork tin;
try (final LasPointCloud pointCloud = PointCloud.newPointCloud(sourceFile)) {
tin = pointCloud.newTriangulatedIrregularNetwork();
}
if (writeFile) {
tin.writeTriangulatedIrregularNetwork(new PathResource("/data/elevation/tin/093/g/093g057.tin"));
}
displayTin(tin);
}
use of com.revolsys.spring.resource.PathResource in project com.revolsys.open by revolsys.
the class LayerGroup method loadLayer.
protected Layer loadLayer(final File file) {
final Resource oldResource = Resource.setBaseResource(new PathResource(file.getParentFile()));
try {
final Map<String, Object> properties = Json.toMap(file);
final Layer layer = MapObjectFactory.toObject(properties);
if (layer != null) {
addLayer(layer);
}
return layer;
} catch (final Throwable t) {
Logs.error(this, "Cannot load layer from " + file, t);
return null;
} finally {
Resource.setBaseResource(oldResource);
}
}
Aggregations