Java Code Examples for mil.nga.geopackage.features.user.FeatureRow#getGeometryType()
The following examples show how to use
mil.nga.geopackage.features.user.FeatureRow#getGeometryType() .
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: FeatureStylesUtils.java From geopackage-android with MIT License | 5 votes |
private static void validateRowStyles( FeatureTableStyles featureTableStyles, FeatureRow featureRow, StyleRow tableStyleDefault, Map<GeometryType, StyleRow> geometryTypeTableStyles, Map<Long, Map<GeometryType, StyleRow>> featureResultsStyles) { GeometryType geometryType = featureRow.getGeometryType(); validateRowStyles(featureTableStyles, featureRow, null, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); if (geometryType != null) { List<GeometryType> geometryTypes = GeometryUtils .parentHierarchy(geometryType); for (GeometryType parentGeometryType : geometryTypes) { validateRowStyles(featureTableStyles, featureRow, parentGeometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); } List<GeometryType> childTypes = getAllChildTypes(geometryType); for (GeometryType childGeometryType : childTypes) { validateRowStyles(featureTableStyles, featureRow, childGeometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); } } }
Example 2
Source File: FeatureStylesUtils.java From geopackage-android with MIT License | 5 votes |
private static void validateRowStyles( FeatureTableStyles featureTableStyles, FeatureRow featureRow, GeometryType geometryType, StyleRow tableStyleDefault, Map<GeometryType, StyleRow> geometryTypeTableStyles, Map<Long, Map<GeometryType, StyleRow>> featureResultsStyles) { StyleRow styleRow = null; if (geometryType == null) { styleRow = featureTableStyles.getStyle(featureRow); geometryType = featureRow.getGeometryType(); } else { styleRow = featureTableStyles.getStyle(featureRow, geometryType); } StyleRow expectedStyleRow = getExpectedRowStyle(featureRow, geometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); if (expectedStyleRow != null) { TestCase.assertEquals(expectedStyleRow.getId(), styleRow.getId()); TestCase.assertNotNull(styleRow.getTable()); TestCase.assertTrue(styleRow.getId() >= 0); styleRow.getName(); styleRow.getDescription(); styleRow.getColor(); styleRow.getHexColor(); styleRow.getOpacity(); styleRow.getWidth(); styleRow.getFillColor(); styleRow.getFillHexColor(); styleRow.getFillOpacity(); } else { TestCase.assertNull(styleRow); } }
Example 3
Source File: FeatureStylesUtils.java From geopackage-android with MIT License | 5 votes |
private static void validateRowIcons(FeatureTableStyles featureTableStyles, FeatureRow featureRow, IconRow tableIconDefault, Map<GeometryType, IconRow> geometryTypeTableIcons, Map<Long, Map<GeometryType, IconRow>> featureResultsIcons) { GeometryType geometryType = featureRow.getGeometryType(); validateRowIcons(featureTableStyles, featureRow, null, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); if (geometryType != null) { List<GeometryType> geometryTypes = GeometryUtils .parentHierarchy(geometryType); for (GeometryType parentGeometryType : geometryTypes) { validateRowIcons(featureTableStyles, featureRow, parentGeometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); } List<GeometryType> childTypes = getAllChildTypes(geometryType); for (GeometryType childGeometryType : childTypes) { validateRowIcons(featureTableStyles, featureRow, childGeometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); } } }
Example 4
Source File: FeatureStylesUtils.java From geopackage-android with MIT License | 5 votes |
private static void validateRowIcons(FeatureTableStyles featureTableStyles, FeatureRow featureRow, GeometryType geometryType, IconRow tableIconDefault, Map<GeometryType, IconRow> geometryTypeTableIcons, Map<Long, Map<GeometryType, IconRow>> featureResultsIcons) { IconRow iconRow = null; if (geometryType == null) { iconRow = featureTableStyles.getIcon(featureRow); geometryType = featureRow.getGeometryType(); } else { iconRow = featureTableStyles.getIcon(featureRow, geometryType); } IconRow expectedIconRow = getExpectedRowIcon(featureRow, geometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); if (expectedIconRow != null) { TestCase.assertEquals(expectedIconRow.getId(), iconRow.getId()); TestCase.assertNotNull(iconRow.getTable()); TestCase.assertTrue(iconRow.getId() >= 0); iconRow.getName(); iconRow.getDescription(); iconRow.getWidth(); iconRow.getHeight(); iconRow.getAnchorU(); iconRow.getAnchorV(); } else { TestCase.assertNull(iconRow); } }
Example 5
Source File: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
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 6
Source File: FeatureStylesUtils.java From geopackage-java with MIT License | 5 votes |
private static void validateRowStyles(FeatureTableStyles featureTableStyles, FeatureRow featureRow, StyleRow tableStyleDefault, Map<GeometryType, StyleRow> geometryTypeTableStyles, Map<Long, Map<GeometryType, StyleRow>> featureResultsStyles) { GeometryType geometryType = featureRow.getGeometryType(); validateRowStyles(featureTableStyles, featureRow, null, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); if (geometryType != null) { List<GeometryType> geometryTypes = GeometryUtils .parentHierarchy(geometryType); for (GeometryType parentGeometryType : geometryTypes) { validateRowStyles(featureTableStyles, featureRow, parentGeometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); } List<GeometryType> childTypes = getAllChildTypes(geometryType); for (GeometryType childGeometryType : childTypes) { validateRowStyles(featureTableStyles, featureRow, childGeometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); } } }
Example 7
Source File: FeatureStylesUtils.java From geopackage-java with MIT License | 5 votes |
private static void validateRowStyles(FeatureTableStyles featureTableStyles, FeatureRow featureRow, GeometryType geometryType, StyleRow tableStyleDefault, Map<GeometryType, StyleRow> geometryTypeTableStyles, Map<Long, Map<GeometryType, StyleRow>> featureResultsStyles) { StyleRow styleRow = null; if (geometryType == null) { styleRow = featureTableStyles.getStyle(featureRow); geometryType = featureRow.getGeometryType(); } else { styleRow = featureTableStyles.getStyle(featureRow, geometryType); } StyleRow expectedStyleRow = getExpectedRowStyle(featureRow, geometryType, tableStyleDefault, geometryTypeTableStyles, featureResultsStyles); if (expectedStyleRow != null) { TestCase.assertEquals(expectedStyleRow.getId(), styleRow.getId()); TestCase.assertNotNull(styleRow.getTable()); TestCase.assertTrue(styleRow.getId() >= 0); styleRow.getName(); styleRow.getDescription(); styleRow.getColor(); styleRow.getHexColor(); styleRow.getOpacity(); styleRow.getWidth(); styleRow.getFillColor(); styleRow.getFillHexColor(); styleRow.getFillOpacity(); } else { TestCase.assertNull(styleRow); } }
Example 8
Source File: FeatureStylesUtils.java From geopackage-java with MIT License | 5 votes |
private static void validateRowIcons(FeatureTableStyles featureTableStyles, FeatureRow featureRow, IconRow tableIconDefault, Map<GeometryType, IconRow> geometryTypeTableIcons, Map<Long, Map<GeometryType, IconRow>> featureResultsIcons) { GeometryType geometryType = featureRow.getGeometryType(); validateRowIcons(featureTableStyles, featureRow, null, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); if (geometryType != null) { List<GeometryType> geometryTypes = GeometryUtils .parentHierarchy(geometryType); for (GeometryType parentGeometryType : geometryTypes) { validateRowIcons(featureTableStyles, featureRow, parentGeometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); } List<GeometryType> childTypes = getAllChildTypes(geometryType); for (GeometryType childGeometryType : childTypes) { validateRowIcons(featureTableStyles, featureRow, childGeometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); } } }
Example 9
Source File: FeatureStylesUtils.java From geopackage-java with MIT License | 5 votes |
private static void validateRowIcons(FeatureTableStyles featureTableStyles, FeatureRow featureRow, GeometryType geometryType, IconRow tableIconDefault, Map<GeometryType, IconRow> geometryTypeTableIcons, Map<Long, Map<GeometryType, IconRow>> featureResultsIcons) { IconRow iconRow = null; if (geometryType == null) { iconRow = featureTableStyles.getIcon(featureRow); geometryType = featureRow.getGeometryType(); } else { iconRow = featureTableStyles.getIcon(featureRow, geometryType); } IconRow expectedIconRow = getExpectedRowIcon(featureRow, geometryType, tableIconDefault, geometryTypeTableIcons, featureResultsIcons); if (expectedIconRow != null) { TestCase.assertEquals(expectedIconRow.getId(), iconRow.getId()); TestCase.assertNotNull(iconRow.getTable()); TestCase.assertTrue(iconRow.getId() >= 0); iconRow.getName(); iconRow.getDescription(); iconRow.getWidth(); iconRow.getHeight(); iconRow.getAnchorU(); iconRow.getAnchorV(); } else { TestCase.assertNull(iconRow); } }
Example 10
Source File: GeoPackageExample.java From geopackage-java with MIT License | 5 votes |
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 11
Source File: GeoPackageExample.java From geopackage-android with MIT License | 4 votes |
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 12
Source File: GeoPackageExample.java From geopackage-java with MIT License | 4 votes |
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(); }