mil.nga.geopackage.tiles.user.TileColumn Java Examples

The following examples show how to use mil.nga.geopackage.tiles.user.TileColumn. 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: 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());
        }
    }
}
 
Example #2
Source File: TileUtils.java    From geopackage-java with MIT License 4 votes vote down vote up
/**
 * Validate a tile row
 * 
 * @param dao
 * @param columns
 * @param tileRow
 */
private static void validateTileRow(TileDao dao, String[] columns,
		TileRow tileRow) {
	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 ResultUtils.FIELD_TYPE_INTEGER:
			TestUtils.validateIntegerValue(value, column.getDataType());
			break;

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

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

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

		case ResultUtils.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);

}
 
Example #3
Source File: TestUtils.java    From geopackage-android-map with MIT License 3 votes vote down vote up
/**
 * Build an example tile table
 *
 * @param tableName
 * @return
 */
public static TileTable buildTileTable(String tableName) {

    List<TileColumn> columns = TileTable.createRequiredColumns();

    TileTable table = new TileTable(tableName, columns);

    return table;
}
 
Example #4
Source File: TestUtils.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Build an example tile table
 *
 * @param tableName
 * @return
 */
public static TileTable buildTileTable(String tableName) {

    List<TileColumn> columns = TileTable.createRequiredColumns();

    TileTable table = new TileTable(tableName, columns);

    return table;
}
 
Example #5
Source File: TestUtils.java    From geopackage-java with MIT License 3 votes vote down vote up
/**
 * Build an example tile table
 * 
 * @param tableName
 * @return tile table
 */
public static TileTable buildTileTable(String tableName) {

	List<TileColumn> columns = TileTable.createRequiredColumns();

	TileTable table = new TileTable(tableName, columns);

	return table;
}