当前位置: 首页>>代码示例>>Java>>正文


Java FeatureRow.getGeometryColumnIndex方法代码示例

本文整理汇总了Java中mil.nga.geopackage.features.user.FeatureRow.getGeometryColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureRow.getGeometryColumnIndex方法的具体用法?Java FeatureRow.getGeometryColumnIndex怎么用?Java FeatureRow.getGeometryColumnIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mil.nga.geopackage.features.user.FeatureRow的用法示例。


在下文中一共展示了FeatureRow.getGeometryColumnIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTableDataAndClose

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:74,代码来源:FeatureInfoBuilder.java

示例2: validateFeatureRow

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Validate a feature row
 * 
 * @param columns
 * @param featureRow
 */
private static void validateFeatureRow(String[] columns,
		FeatureRow featureRow) {
	TestCase.assertEquals(columns.length, featureRow.columnCount());

	for (int i = 0; i < featureRow.columnCount(); i++) {
		FeatureColumn column = featureRow.getTable().getColumns().get(i);
		GeoPackageDataType dataType = column.getDataType();
		TestCase.assertEquals(i, column.getIndex());
		TestCase.assertEquals(columns[i], featureRow.getColumnName(i));
		TestCase.assertEquals(i, featureRow.getColumnIndex(columns[i]));
		int rowType = featureRow.getRowColumnType(i);
		Object value = featureRow.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:
			if(dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME){
				TestCase.assertTrue(value instanceof Date);
				Date date = (Date) value;
				DateConverter converter = DateConverter.converter(dataType);
				String dateString = converter.stringValue(date);
				TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime());
			}else{
				TestCase.assertTrue(value instanceof String);
			}
			break;

		case Cursor.FIELD_TYPE_BLOB:
			if (featureRow.getGeometryColumnIndex() == i) {
				TestCase.assertTrue(value instanceof GeoPackageGeometryData);
			} else {
				TestCase.assertTrue(value instanceof byte[]);
			}
			break;

		case Cursor.FIELD_TYPE_NULL:
			TestCase.assertNull(value);
			break;

		}
	}
	
	TestCase.assertTrue(featureRow.getId() >= 0);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:59,代码来源:FeatureUtils.java

示例3: validateFeatureRow

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Validate a feature row
 * 
 * @param columns
 * @param featureRow
 */
private static void validateFeatureRow(String[] columns,
		FeatureRow featureRow) {
	TestCase.assertEquals(columns.length, featureRow.columnCount());

	for (int i = 0; i < featureRow.columnCount(); i++) {
		FeatureColumn column = featureRow.getTable().getColumns().get(i);
		GeoPackageDataType dataType = column.getDataType();
		TestCase.assertEquals(i, column.getIndex());
		TestCase.assertEquals(columns[i], featureRow.getColumnName(i));
		TestCase.assertEquals(i, featureRow.getColumnIndex(columns[i]));
		int rowType = featureRow.getRowColumnType(i);
		Object value = featureRow.getValue(i);

		switch (rowType) {

		case UserCoreResultUtils.FIELD_TYPE_INTEGER:
			TestUtils.validateIntegerValue(value, column.getDataType());
			break;

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

		case UserCoreResultUtils.FIELD_TYPE_STRING:
			if(dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME){
				TestCase.assertTrue(value instanceof Date);
				Date date = (Date) value;
				DateConverter converter = DateConverter.converter(dataType);
				String dateString = converter.stringValue(date);
				TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime());
			}else{
				TestCase.assertTrue(value instanceof String);
			}
			break;

		case UserCoreResultUtils.FIELD_TYPE_BLOB:
			if (featureRow.getGeometryColumnIndex() == i) {
				TestCase.assertTrue(value instanceof GeoPackageGeometryData);
			} else {
				TestCase.assertTrue(value instanceof byte[]);
			}
			break;

		case UserCoreResultUtils.FIELD_TYPE_NULL:
			TestCase.assertNull(value);
			break;

		}
	}

	TestCase.assertTrue(featureRow.getId() >= 0);
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:59,代码来源:FeatureUtils.java

示例4: mapClickMessage

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Build a map click location message from the clicked marker
 *
 * @param marker clicked marker
 * @return click message
 */
public String mapClickMessage(Marker marker) {
    String message = null;
    if (selectedReport == null) {
        MarkerFeature markerFeature = markerIds.get(marker.getId());
        if (markerFeature != null) {
            final GeoPackage geoPackage = manager.open(markerFeature.database);
            try {
                final FeatureDao featureDao = geoPackage
                        .getFeatureDao(markerFeature.tableName);

                final FeatureRow featureRow = featureDao.queryForIdRow(markerFeature.featureId);

                if (featureRow != null) {
                    GeoPackageGeometryData geomData = featureRow.getGeometry();
                    if (geomData != null && !geomData.isEmpty()) {
                        Geometry geometry = geomData.getGeometry();
                        if (geometry != null) {
                            StringBuilder messageBuilder = new StringBuilder();
                            messageBuilder.append(markerFeature.database).append(" - ").append(markerFeature.tableName).append("\n");
                            int geometryColumn = featureRow.getGeometryColumnIndex();
                            for (int i = 0; i < featureRow.columnCount(); i++) {
                                if (i != geometryColumn) {
                                    Object value = featureRow.getValue(i);
                                    if (value != null) {
                                        messageBuilder.append("\n").append(featureRow.getColumnName(i)).append(": ").append(value);
                                    }
                                }
                            }

                            if (messageBuilder.length() > 0) {
                                messageBuilder.append("\n\n");
                            }
                            messageBuilder.append(GeometryPrinter.getGeometryString(geometry));
                            message = messageBuilder.toString();
                        }
                    }
                }
            } finally {
                geoPackage.close();
            }
        }
    }
    return message;
}
 
开发者ID:ngageoint,项目名称:disconnected-content-explorer-android,代码行数:51,代码来源:GeoPackageMapOverlays.java


注:本文中的mil.nga.geopackage.features.user.FeatureRow.getGeometryColumnIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。