Java Code Examples for mil.nga.geopackage.extension.style.FeatureTableStyles#createStyleRelationship()

The following examples show how to use mil.nga.geopackage.extension.style.FeatureTableStyles#createStyleRelationship() . 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: GeoPackageExample.java    From geopackage-android with MIT License 5 votes vote down vote up
private static void createFeatureStylesGeometry2(GeoPackage geoPackage,
                                                 List<StyleRow> styles, List<IconRow> icons) throws IOException {

    FeatureDao featureDao = geoPackage.getFeatureDao("geometry2");
    FeatureTableStyles geometry2Styles = new FeatureTableStyles(geoPackage,
            featureDao.getTable());

    geometry2Styles.setTableStyle(GeometryType.POINT, styles.get(0));
    geometry2Styles.setTableStyle(GeometryType.LINESTRING, styles.get(1));
    geometry2Styles.setTableStyle(GeometryType.POLYGON, styles.get(0));
    geometry2Styles.setTableStyle(GeometryType.GEOMETRY, styles.get(2));

    geometry2Styles.createStyleRelationship();
    geometry2Styles.createIconRelationship();

    FeatureCursor features = featureDao.queryForAll();
    while (features.moveToNext()) {
        FeatureRow featureRow = features.getRow();
        switch (featureRow.getGeometryType()) {
            case POINT:
                geometry2Styles.setIcon(featureRow, icons.get(0));
                break;
            case LINESTRING:
                geometry2Styles.setStyle(featureRow, styles.get(0));
                break;
            case POLYGON:
                geometry2Styles.setStyle(featureRow, styles.get(1));
                break;
            default:
        }
    }
    features.close();

}
 
Example 2
Source File: GeoPackageExample.java    From geopackage-java with MIT License 5 votes vote down vote up
private static void createFeatureStylesGeometry2(GeoPackage geoPackage,
		List<StyleRow> styles, List<IconRow> icons) throws IOException {

	FeatureDao featureDao = geoPackage.getFeatureDao("geometry2");
	FeatureTableStyles geometry2Styles = new FeatureTableStyles(geoPackage,
			featureDao.getTable());

	geometry2Styles.setTableStyle(GeometryType.POINT, styles.get(0));
	geometry2Styles.setTableStyle(GeometryType.LINESTRING, styles.get(1));
	geometry2Styles.setTableStyle(GeometryType.POLYGON, styles.get(0));
	geometry2Styles.setTableStyle(GeometryType.GEOMETRY, styles.get(2));

	geometry2Styles.createStyleRelationship();
	geometry2Styles.createIconRelationship();

	FeatureResultSet features = featureDao.queryForAll();
	while (features.moveToNext()) {
		FeatureRow featureRow = features.getRow();
		switch (featureRow.getGeometryType()) {
		case POINT:
			geometry2Styles.setIcon(featureRow, icons.get(0));
			break;
		case LINESTRING:
			geometry2Styles.setStyle(featureRow, styles.get(0));
			break;
		case POLYGON:
			geometry2Styles.setStyle(featureRow, styles.get(1));
			break;
		default:
		}
	}
	features.close();

}
 
Example 3
Source File: GeoPackageExample.java    From geopackage-android with MIT License 4 votes vote down vote up
private static void createFeatureStylesGeometry1(GeoPackage geoPackage,
                                                 List<StyleRow> styles, List<IconRow> icons) throws IOException {

    FeatureDao featureDao = geoPackage.getFeatureDao("geometry1");
    FeatureTableStyles geometry1Styles = new FeatureTableStyles(geoPackage,
            featureDao.getTable());

    geometry1Styles.setTableStyleDefault(styles.get(0));
    geometry1Styles.setTableStyle(GeometryType.POLYGON, styles.get(1));
    geometry1Styles.setTableStyle(GeometryType.POINT, styles.get(2));

    geometry1Styles.createStyleRelationship();
    geometry1Styles.createIconRelationship();

    int pointCount = 0;
    int lineCount = 0;
    int polygonCount = 0;

    FeatureCursor features = featureDao.queryForAll();
    while (features.moveToNext()) {
        FeatureRow featureRow = features.getRow();
        switch (featureRow.getGeometryType()) {
            case POINT:
                pointCount++;
                switch (pointCount) {
                    case 1:
                        geometry1Styles.setIcon(featureRow, icons.get(0));
                        break;
                    case 2:
                        geometry1Styles.setIcon(featureRow, icons.get(1));
                        break;
                    case 3:
                        geometry1Styles.setIcon(featureRow, icons.get(2));
                        break;
                }
                break;
            case LINESTRING:
                lineCount++;
                switch (lineCount) {
                    case 2:
                        geometry1Styles.setStyle(featureRow, styles.get(1));
                        break;
                    case 3:
                        geometry1Styles.setStyle(featureRow, styles.get(2));
                        break;
                }
                break;
            case POLYGON:
                polygonCount++;
                switch (polygonCount) {
                    case 2:
                        geometry1Styles.setStyle(featureRow, styles.get(3));
                        break;
                    case 3:
                        geometry1Styles.setStyle(featureRow, styles.get(2));
                        break;
                }
                break;
            default:
        }
    }
    features.close();

}
 
Example 4
Source File: GeoPackageExample.java    From geopackage-java with MIT License 4 votes vote down vote up
private static void createFeatureStylesGeometry1(GeoPackage geoPackage,
		List<StyleRow> styles, List<IconRow> icons) throws IOException {

	FeatureDao featureDao = geoPackage.getFeatureDao("geometry1");
	FeatureTableStyles geometry1Styles = new FeatureTableStyles(geoPackage,
			featureDao.getTable());

	geometry1Styles.setTableStyleDefault(styles.get(0));
	geometry1Styles.setTableStyle(GeometryType.POLYGON, styles.get(1));
	geometry1Styles.setTableStyle(GeometryType.POINT, styles.get(2));

	geometry1Styles.createStyleRelationship();
	geometry1Styles.createIconRelationship();

	int pointCount = 0;
	int lineCount = 0;
	int polygonCount = 0;

	FeatureResultSet features = featureDao.queryForAll();
	while (features.moveToNext()) {
		FeatureRow featureRow = features.getRow();
		switch (featureRow.getGeometryType()) {
		case POINT:
			pointCount++;
			switch (pointCount) {
			case 1:
				geometry1Styles.setIcon(featureRow, icons.get(0));
				break;
			case 2:
				geometry1Styles.setIcon(featureRow, icons.get(1));
				break;
			case 3:
				geometry1Styles.setIcon(featureRow, icons.get(2));
				break;
			}
			break;
		case LINESTRING:
			lineCount++;
			switch (lineCount) {
			case 2:
				geometry1Styles.setStyle(featureRow, styles.get(1));
				break;
			case 3:
				geometry1Styles.setStyle(featureRow, styles.get(2));
				break;
			}
			break;
		case POLYGON:
			polygonCount++;
			switch (polygonCount) {
			case 2:
				geometry1Styles.setStyle(featureRow, styles.get(3));
				break;
			case 3:
				geometry1Styles.setStyle(featureRow, styles.get(2));
				break;
			}
			break;
		default:
		}
	}
	features.close();

}