Search in sources :

Example 1 with DataColumns

use of mil.nga.geopackage.extension.schema.columns.DataColumns in project geopackage-android-map by ngageoint.

the class TestUtils method createFeatureTable.

/**
 * Create the feature table with data columns entry
 *
 * @param geoPackage
 * @param contents
 * @param geometryColumn
 * @param geometryType
 * @return
 * @throws SQLException
 */
public static FeatureTable createFeatureTable(GeoPackage geoPackage, Contents contents, String geometryColumn, GeometryType geometryType) throws SQLException {
    FeatureTable table = buildFeatureTable(contents.getTableName(), geometryColumn, geometryType);
    geoPackage.createFeatureTable(table);
    double random = Math.random();
    DataColumnsDao dataColumnsDao = SchemaExtension.getDataColumnsDao(geoPackage);
    DataColumns dataColumns = new DataColumns();
    dataColumns.setContents(contents);
    dataColumns.setColumnName(TEST_INTEGER_COLUMN);
    dataColumns.setName(contents.getTableName());
    dataColumns.setTitle("TEST_TITLE");
    dataColumns.setDescription("TEST_DESCRIPTION");
    dataColumns.setMimeType("TEST_MIME_TYPE");
    if (random < (1.0 / 3.0)) {
        dataColumns.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
    } else if (random < (2.0 / 3.0)) {
        dataColumns.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    } else {
        dataColumns.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
    }
    dataColumnsDao.create(dataColumns);
    return table;
}
Also used : FeatureTable(mil.nga.geopackage.features.user.FeatureTable) DataColumns(mil.nga.geopackage.extension.schema.columns.DataColumns) DataColumnsDao(mil.nga.geopackage.extension.schema.columns.DataColumnsDao)

Aggregations

DataColumns (mil.nga.geopackage.extension.schema.columns.DataColumns)1 DataColumnsDao (mil.nga.geopackage.extension.schema.columns.DataColumnsDao)1 FeatureTable (mil.nga.geopackage.features.user.FeatureTable)1