Search in sources :

Example 1 with RecordDefinitionBuilder

use of com.revolsys.record.schema.RecordDefinitionBuilder in project com.revolsys.open by revolsys.

the class RecordStoreLayerTest method beforeTest.

@Before
public void beforeTest() {
    FileUtil.deleteDirectory(testDirectory, false);
    final File testFile = new File(testDirectory, "test.gdb");
    this.recordStore = FileGdbRecordStoreFactory.newRecordStore(testFile);
    this.recordStore.initialize();
    this.recordDefinition = // 
    new RecordDefinitionBuilder(TEST).addField("NAME", DataTypes.STRING, // 
    50).addField("COUNT", // 
    DataTypes.INT).addField("GEOMETRY", // 
    DataTypes.POINT).setGeometryFactory(// 
    GEOMETRY_FACTORY).getRecordDefinition();
    this.recordStore.getRecordDefinition(this.recordDefinition);
    this.layer = new RecordStoreLayer(this.recordStore, TEST, true);
    this.layer.initialize();
    this.layer.setEditable(true);
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) RecordStoreLayer(com.revolsys.swing.map.layer.record.RecordStoreLayer) File(java.io.File) Before(org.junit.Before)

Example 2 with RecordDefinitionBuilder

use of com.revolsys.record.schema.RecordDefinitionBuilder in project com.revolsys.open by revolsys.

the class GeometryReader method newRecordDefinition.

default RecordDefinition newRecordDefinition(final String name) {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final RecordDefinition recordDefinition = // 
    new RecordDefinitionBuilder(name).addField("GEOMETRY", // 
    DataTypes.GEOMETRY).setGeometryFactory(// 
    geometryFactory).getRecordDefinition();
    return recordDefinition;
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 3 with RecordDefinitionBuilder

use of com.revolsys.record.schema.RecordDefinitionBuilder in project com.revolsys.open by revolsys.

the class PointReader method newRecordDefinition.

default RecordDefinition newRecordDefinition(final String name) {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final RecordDefinition recordDefinition = // 
    new RecordDefinitionBuilder(name).addField("POINT", // 
    DataTypes.POINT).setGeometryFactory(// 
    geometryFactory).getRecordDefinition();
    return recordDefinition;
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 4 with RecordDefinitionBuilder

use of com.revolsys.record.schema.RecordDefinitionBuilder in project com.revolsys.open by revolsys.

the class LabelCountMap method writeCounts.

public void writeCounts(final Object target, final String labelTitle) {
    final RecordDefinitionBuilder recordDefinitionBuilder = new RecordDefinitionBuilder("Counts");
    recordDefinitionBuilder.addField(labelTitle, DataTypes.STRING, 50);
    recordDefinitionBuilder.addField("Count", DataTypes.LONG, 10);
    final RecordDefinition recordDefinition = recordDefinitionBuilder.getRecordDefinition();
    try (RecordWriter recordWriter = RecordWriter.newRecordWriter(recordDefinition, target)) {
        for (final String label : getLabels()) {
            final Long count = getCount(label);
            recordWriter.write(label, count);
        }
    }
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) RecordWriter(com.revolsys.record.io.RecordWriter) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 5 with RecordDefinitionBuilder

use of com.revolsys.record.schema.RecordDefinitionBuilder in project com.revolsys.open by revolsys.

the class AbstractScaledIntegerPointCloudGeometryReader method newRecordDefinition.

public RecordDefinition newRecordDefinition(final String name) {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final RecordDefinition recordDefinition = // 
    new RecordDefinitionBuilder(name).addField("POINT", // 
    DataTypes.POINT).setGeometryFactory(// 
    geometryFactory).getRecordDefinition();
    return recordDefinition;
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

RecordDefinitionBuilder (com.revolsys.record.schema.RecordDefinitionBuilder)6 RecordDefinition (com.revolsys.record.schema.RecordDefinition)5 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)3 RecordWriter (com.revolsys.record.io.RecordWriter)2 RecordStoreLayer (com.revolsys.swing.map.layer.record.RecordStoreLayer)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 Before (org.junit.Before)1