Java Code Examples for mil.nga.geopackage.schema.columns.DataColumnsDao#create()

The following examples show how to use mil.nga.geopackage.schema.columns.DataColumnsDao#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtils.java    From geopackage-android-map with MIT License 5 votes vote down vote up
/**
 * 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 = geoPackage.getDataColumnsDao();
    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;
}
 
Example 2
Source File: TestUtils.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * 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 = geoPackage.getDataColumnsDao();
    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;
}
 
Example 3
Source File: TestUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Create the feature table with data columns entry
 * 
 * @param geoPackage
 * @param contents
 * @param geometryColumn
 * @param geometryType
 * @return feature table
 * @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 = geoPackage.getDataColumnsDao();
	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;
}