Java Code Examples for mil.nga.geopackage.core.contents.Contents#getTableName()

The following examples show how to use mil.nga.geopackage.core.contents.Contents#getTableName() . 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: GeoPackageImpl.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AttributesDao getAttributesDao(Contents contents) {

	if (contents == null) {
		throw new GeoPackageException("Non null "
				+ Contents.class.getSimpleName() + " is required to create "
				+ AttributesDao.class.getSimpleName());
	}
	if (contents.getDataType() != ContentsDataType.ATTRIBUTES) {
		throw new GeoPackageException(Contents.class.getSimpleName()
				+ " is required to be of type "
				+ ContentsDataType.ATTRIBUTES + ". Actual: "
				+ contents.getDataTypeString());
	}

	// Read the existing table and create the dao
	AttributesTableReader tableReader = new AttributesTableReader(
			contents.getTableName());
	final AttributesTable attributesTable = tableReader.readTable(database);
	attributesTable.setContents(contents);
	AttributesDao dao = new AttributesDao(getName(), database,
			attributesTable);

	return dao;
}
 
Example 2
Source File: GeoPackageImpl.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public AttributesDao getAttributesDao(Contents contents) {

    if (contents == null) {
        throw new GeoPackageException("Non null "
                + Contents.class.getSimpleName()
                + " is required to create "
                + AttributesDao.class.getSimpleName());
    }
    if (contents.getDataType() != ContentsDataType.ATTRIBUTES) {
        throw new GeoPackageException(Contents.class.getSimpleName()
                + " is required to be of type "
                + ContentsDataType.ATTRIBUTES + ". Actual: "
                + contents.getDataTypeString());
    }

    // Read the existing table and create the dao
    AttributesTableReader tableReader = new AttributesTableReader(
            contents.getTableName());
    final AttributesTable attributesTable = tableReader.readTable(database);
    attributesTable.setContents(contents);
    AttributesDao dao = new AttributesDao(getName(), database,
            attributesTable);

    // Register the table name (with and without quotes) to wrap cursors with the attributes cursor
    registerCursorWrapper(attributesTable.getTableName(),
            new GeoPackageCursorWrapper() {

                @Override
                public Cursor wrapCursor(Cursor cursor) {
                    return new AttributesCursor(attributesTable, cursor);
                }
            });

    return dao;
}
 
Example 3
Source File: GriddedTile.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * Set the contents
 * 
 * @param contents
 *            contents
 */
public void setContents(Contents contents) {
	this.contents = contents;
	if (contents != null) {
		tableName = contents.getTableName();
	} else {
		tableName = null;
	}
}
 
Example 4
Source File: FeatureTableStyles.java    From geopackage-android with MIT License 2 votes vote down vote up
/**
 * Constructor
 *
 * @param geoPackage GeoPackage
 * @param contents   feature contents
 */
public FeatureTableStyles(GeoPackage geoPackage, Contents contents) {
    this(geoPackage, contents.getTableName());
}
 
Example 5
Source File: FeatureTableStyles.java    From geopackage-java with MIT License 2 votes vote down vote up
/**
 * Constructor
 * 
 * @param geoPackage
 *            GeoPackage
 * @param contents
 *            feature contents
 */
public FeatureTableStyles(GeoPackage geoPackage, Contents contents) {
	this(geoPackage, contents.getTableName());
}