use of mil.nga.geopackage.tiles.overlay.FeatureTableData in project geopackage-android-map by ngageoint.
the class FeatureInfoBuilder method buildTableDataAndClose.
/**
* Build a feature results information message
*
* @param results feature index results
* @param tolerance distance tolerance
* @param clickLocation map click location
* @param projection desired geometry projection
* @return feature table data or null if not results
*/
public FeatureTableData buildTableDataAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) {
FeatureTableData tableData = null;
// Fine filter results so that the click location is within the tolerance of each feature row result
FeatureIndexResults filteredResults = fineFilterResults(results, tolerance, clickLocation);
long featureCount = filteredResults.count();
if (featureCount > 0) {
int maxFeatureInfo = 0;
if (geometryType == GeometryType.POINT) {
maxFeatureInfo = maxPointDetailedInfo;
} else {
maxFeatureInfo = maxFeatureDetailedInfo;
}
if (featureCount <= maxFeatureInfo) {
DataColumnsDao dataColumnsDao = getDataColumnsDao();
List<FeatureRowData> rows = new ArrayList<>();
for (FeatureRow featureRow : filteredResults) {
Map<String, Object> values = new HashMap<>();
String geometryColumnName = null;
int geometryColumn = featureRow.getGeometryColumnIndex();
for (int i = 0; i < featureRow.columnCount(); i++) {
Object value = featureRow.getValue(i);
String columnName = featureRow.getColumnName(i);
columnName = getColumnName(dataColumnsDao, featureRow, columnName);
if (i == geometryColumn) {
geometryColumnName = columnName;
if (projection != null && value != null) {
GeoPackageGeometryData geomData = (GeoPackageGeometryData) value;
projectGeometry(geomData, projection);
}
}
if (value != null) {
values.put(columnName, value);
}
}
FeatureRowData featureRowData = new FeatureRowData(values, geometryColumnName);
rows.add(featureRowData);
}
tableData = new FeatureTableData(featureDao.getTableName(), featureCount, rows);
} else {
tableData = new FeatureTableData(featureDao.getTableName(), featureCount);
}
}
results.close();
return tableData;
}
use of mil.nga.geopackage.tiles.overlay.FeatureTableData in project geopackage-android-map by ngageoint.
the class FeatureOverlayQuery method buildMapClickTableData.
/**
* Perform a query based upon the map click location and build feature table data
*
* @param latLng location
* @param view view
* @param map Google Map
* @param projection desired geometry projection
* @return table data on what was clicked, or null
* @since 1.2.7
*/
public FeatureTableData buildMapClickTableData(LatLng latLng, View view, GoogleMap map, Projection projection) {
// Get the zoom level
double zoom = MapUtils.getCurrentZoom(map);
// Build a bounding box to represent the click location
BoundingBox boundingBox = MapUtils.buildClickBoundingBox(latLng, view, map, screenClickPercentage);
// Get the map click distance tolerance
double tolerance = MapUtils.getToleranceDistance(latLng, view, map, screenClickPercentage);
FeatureTableData tableData = buildMapClickTableData(latLng, zoom, boundingBox, tolerance, projection);
return tableData;
}
use of mil.nga.geopackage.tiles.overlay.FeatureTableData in project geopackage-android-map by ngageoint.
the class FeatureOverlayQuery method buildMapClickTableDataWithMapBounds.
/**
* Perform a query based upon the map click location and build feature table data
*
* @param latLng location
* @param zoom current zoom level
* @param mapBounds map view bounds
* @param tolerance distance tolerance
* @param projection desired geometry projection
* @return table data on what was clicked, or null
* @since 2.0.0
*/
public FeatureTableData buildMapClickTableDataWithMapBounds(LatLng latLng, double zoom, BoundingBox mapBounds, double tolerance, Projection projection) {
// Build a bounding box to represent the click location
BoundingBox boundingBox = buildClickBoundingBox(latLng, mapBounds);
FeatureTableData tableData = buildMapClickTableData(latLng, zoom, boundingBox, tolerance, projection);
return tableData;
}
Aggregations