Java Code Examples for mil.nga.geopackage.core.contents.ContentsDataType#GRIDDED_COVERAGE

The following examples show how to use mil.nga.geopackage.core.contents.ContentsDataType#GRIDDED_COVERAGE . 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: TileMatrix.java    From geopackage-core-java with MIT License 6 votes vote down vote up
public void setContents(Contents contents) {
	this.contents = contents;
	if (contents != null) {
		// Verify the Contents have a tiles data type (Spec Requirement 42)
		ContentsDataType dataType = contents.getDataType();
		if (dataType == null
				|| (dataType != ContentsDataType.TILES && dataType != ContentsDataType.GRIDDED_COVERAGE)) {
			throw new GeoPackageException("The "
					+ Contents.class.getSimpleName() + " of a "
					+ TileMatrix.class.getSimpleName()
					+ " must have a data type of "
					+ ContentsDataType.TILES.getName() + " or "
					+ ContentsDataType.GRIDDED_COVERAGE.getName());
		}
		tableName = contents.getId();
	} else {
		tableName = null;
	}
}
 
Example 2
Source File: TileMatrixSet.java    From geopackage-core-java with MIT License 6 votes vote down vote up
public void setContents(Contents contents) {
	this.contents = contents;
	if (contents != null) {
		// Verify the Contents have a tiles data type (Spec Requirement 33)
		ContentsDataType dataType = contents.getDataType();
		if (dataType == null
				|| (dataType != ContentsDataType.TILES && dataType != ContentsDataType.GRIDDED_COVERAGE)) {
			throw new GeoPackageException("The "
					+ Contents.class.getSimpleName() + " of a "
					+ TileMatrixSet.class.getSimpleName()
					+ " must have a data type of "
					+ ContentsDataType.TILES.getName() + " or "
					+ ContentsDataType.GRIDDED_COVERAGE.getName());
		}
		tableName = contents.getId();
	} else {
		tableName = null;
	}
}
 
Example 3
Source File: TileTable.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void validateContents(Contents contents) {
	// Verify the Contents have a tiles data type
	ContentsDataType dataType = contents.getDataType();
	if (dataType == null || (dataType != ContentsDataType.TILES
			&& dataType != ContentsDataType.GRIDDED_COVERAGE)) {
		throw new GeoPackageException(
				"The " + Contents.class.getSimpleName() + " of a "
						+ TileTable.class.getSimpleName()
						+ " must have a data type of "
						+ ContentsDataType.TILES.getName() + " or "
						+ ContentsDataType.GRIDDED_COVERAGE.getName());
	}
}
 
Example 4
Source File: TileUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Validate a tile row
 *
 * @param dao
 * @param columns
 * @param tileRow
 * @param testBitmap
 */
private static void validateTileRow(TileDao dao, String[] columns,
                                    TileRow tileRow, boolean testBitmap) {
    TestCase.assertEquals(columns.length, tileRow.columnCount());

    for (int i = 0; i < tileRow.columnCount(); i++) {
        TileColumn column = tileRow.getTable().getColumns().get(i);
        TestCase.assertEquals(i, column.getIndex());
        TestCase.assertEquals(columns[i], tileRow.getColumnName(i));
        TestCase.assertEquals(i, tileRow.getColumnIndex(columns[i]));
        int rowType = tileRow.getRowColumnType(i);
        Object value = tileRow.getValue(i);

        switch (rowType) {

            case Cursor.FIELD_TYPE_INTEGER:
                TestUtils.validateIntegerValue(value, column.getDataType());
                break;

            case Cursor.FIELD_TYPE_FLOAT:
                TestUtils.validateFloatValue(value, column.getDataType());
                break;

            case Cursor.FIELD_TYPE_STRING:
                TestCase.assertTrue(value instanceof String);
                break;

            case Cursor.FIELD_TYPE_BLOB:
                TestCase.assertTrue(value instanceof byte[]);
                break;

            case Cursor.FIELD_TYPE_NULL:
                TestCase.assertNull(value);
                break;

        }
    }

    TestCase.assertTrue(tileRow.getId() >= 0);
    TestCase.assertTrue(tileRow.getZoomLevel() >= 0);
    TestCase.assertTrue(tileRow.getTileColumn() >= 0);
    TestCase.assertTrue(tileRow.getTileRow() >= 0);
    byte[] tileData = tileRow.getTileData();
    TestCase.assertNotNull(tileData);
    TestCase.assertTrue(tileData.length > 0);

    TileMatrix tileMatrix = dao.getTileMatrix(tileRow.getZoomLevel());
    TestCase.assertNotNull(tileMatrix);

    if (testBitmap) {
        Bitmap bitmap = tileRow.getTileDataBitmap();
        if (dao.getTileMatrixSet().getContents().getDataType() != ContentsDataType.GRIDDED_COVERAGE) {
            TestCase.assertNotNull(bitmap);
            TestCase.assertEquals(tileMatrix.getTileWidth(), bitmap.getWidth());
            TestCase.assertEquals(tileMatrix.getTileHeight(),
                    bitmap.getHeight());
        }
    }
}