use of com.revolsys.spring.resource.Resource in project com.revolsys.open by revolsys.
the class MapWriterFactory method newMapWriter.
default MapWriter newMapWriter(final Object source) {
final Resource resource = Resource.getResource(source);
final Writer writer = resource.newWriter();
return newMapWriter(writer);
}
use of com.revolsys.spring.resource.Resource in project com.revolsys.open by revolsys.
the class ShapefileRecordWriter method init.
@Override
protected void init() throws IOException {
super.init();
final RecordDefinitionImpl recordDefinition = (RecordDefinitionImpl) getRecordDefinition();
if (recordDefinition != null) {
this.geometryFieldName = recordDefinition.getGeometryFieldName();
if (this.geometryFieldName != null) {
this.out = new ResourceEndianOutput(this.resource);
writeHeader(this.out);
if (!hasField(this.geometryFieldName)) {
addFieldDefinition(this.geometryFieldName, XBaseFieldDefinition.OBJECT_TYPE, 0, 0);
}
final Resource indexResource = this.resource.newResourceChangeExtension("shx");
if (indexResource != null) {
this.indexOut = new ResourceEndianOutput(indexResource);
writeHeader(this.indexOut);
}
this.geometryFactory = getProperty(IoConstants.GEOMETRY_FACTORY);
final Object geometryType = getProperty(IoConstants.GEOMETRY_TYPE);
if (geometryType != null) {
this.geometryDataType = DataTypes.getDataType(geometryType.toString());
}
}
}
}
use of com.revolsys.spring.resource.Resource in project com.revolsys.open by revolsys.
the class Tsv method plainWriter.
public static TsvWriter plainWriter(final Object source) {
if (source == null) {
throw new NullPointerException("source must not be null");
} else {
final Resource resource = Resource.getResource(source);
final Writer writer = resource.newWriter();
return plainWriter(writer);
}
}
use of com.revolsys.spring.resource.Resource in project com.revolsys.open by revolsys.
the class TiledGriddedElevationModelLayer method newGriddedElevationModel.
public GriddedElevationModel newGriddedElevationModel(final int tileSize, final int tileX, final int tileY) {
final String fileName = Strings.toString("_", this.filePrefix, getCoordinateSystemId(), tileSize, tileX, tileY) + "." + this.fileExtension;
final Resource path = //
this.baseResource.createRelative(//
this.fileExtension).createRelative(//
getCoordinateSystemId()).createRelative(//
tileSize).createRelative(//
tileX).createRelative(fileName);
return GriddedElevationModel.newGriddedElevationModel(path);
}
use of com.revolsys.spring.resource.Resource in project com.revolsys.open by revolsys.
the class TriangulatedIrregularNetworkLayer method revertDo.
protected void revertDo() {
if (this.resource != null) {
TriangulatedIrregularNetwork tin = null;
try {
this.tin = null;
final Resource resource = Resource.getResource(this.url);
if (resource.exists()) {
tin = TriangulatedIrregularNetwork.newTriangulatedIrregularNetwork(resource);
if (tin == null) {
Logs.error(TriangulatedIrregularNetworkLayer.class, "Cannot load TIN: " + this.url);
}
} else {
Logs.error(TriangulatedIrregularNetworkLayer.class, "TIN does not exist: " + this.url);
}
} catch (final Throwable e) {
Logs.error(TriangulatedIrregularNetworkLayer.class, "Unable to load TIN: " + this.url, e);
} finally {
setTin(tin);
}
firePropertyChange("hasChanges", true, false);
}
}
Aggregations