info: improved geotiff display
This commit is contained in:
parent
85957348b2
commit
48f748bc3e
6 changed files with 3461 additions and 2 deletions
|
@ -769,6 +769,8 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
|
|||
}
|
||||
Pair(it, value)
|
||||
})
|
||||
val geoKeyDirectory = dir.getIntArray(ExifGeoTiffTags.TAG_GEO_KEY_DIRECTORY)
|
||||
fields.putAll((dir as ExifIFD0Directory).extractGeoKeys(geoKeyDirectory))
|
||||
}
|
||||
}
|
||||
result.success(fields)
|
||||
|
|
|
@ -140,7 +140,7 @@ object MetadataExtractorHelper {
|
|||
}
|
||||
} else if (sourceValue.javaClass.isArray) {
|
||||
val sourceArray = sourceValue as DoubleArray
|
||||
if (valueOffset + valueCount < sourceArray.size) {
|
||||
if (valueOffset + valueCount <= sourceArray.size) {
|
||||
fields[keyId] = sourceArray.copyOfRange(valueOffset, valueOffset + valueCount)
|
||||
} else {
|
||||
Log.w(LOG_TAG, "GeoTIFF key $keyId with offset $valueOffset and count $valueCount extends beyond length of source value (${sourceArray.size})")
|
||||
|
|
19
lib/ref/geotiff.dart
Normal file
19
lib/ref/geotiff.dart
Normal file
|
@ -0,0 +1,19 @@
|
|||
class GeoTiffExifTags {
|
||||
static const int modelPixelScale = 0x830e;
|
||||
static const int modelTiePoints = 0x8482;
|
||||
static const int modelTransformation = 0x85d8;
|
||||
static const int geoKeyDirectory = 0x87af;
|
||||
static const int geoDoubleParams = 0x87b0;
|
||||
static const int geoAsciiParams = 0x87b1;
|
||||
}
|
||||
|
||||
class GeoTiffKeys {
|
||||
static const int modelType = 0x0400;
|
||||
static const int rasterType = 0x0401;
|
||||
static const int geographicType = 0x0800;
|
||||
static const int geogAngularUnits = 0x0806;
|
||||
static const int projCSType = 0x0c00;
|
||||
static const int projection = 0x0c02;
|
||||
static const int projCoordinateTransform = 0x0c03;
|
||||
static const int projLinearUnits = 0x0c04;
|
||||
}
|
3429
lib/widgets/viewer/info/metadata/geotiff.dart
Normal file
3429
lib/widgets/viewer/info/metadata/geotiff.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,7 @@ import 'dart:collection';
|
|||
|
||||
import 'package:aves/model/entry.dart';
|
||||
import 'package:aves/ref/brand_colors.dart';
|
||||
import 'package:aves/ref/geotiff.dart';
|
||||
import 'package:aves/services/metadata/svg_metadata_service.dart';
|
||||
import 'package:aves/theme/colors.dart';
|
||||
import 'package:aves/utils/constants.dart';
|
||||
|
@ -9,6 +10,7 @@ import 'package:aves/widgets/common/extensions/build_context.dart';
|
|||
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
||||
import 'package:aves/widgets/viewer/embedded/notifications.dart';
|
||||
import 'package:aves/widgets/viewer/info/common.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/geotiff.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/metadata_section.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/metadata_thumbnail.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_tile.dart';
|
||||
|
@ -36,7 +38,7 @@ class MetadataDirTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tags = dir.tags;
|
||||
var tags = dir.tags;
|
||||
if (tags.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
final dirName = dir.name;
|
||||
|
@ -57,6 +59,12 @@ class MetadataDirTile extends StatelessWidget {
|
|||
case MetadataDirectory.coverDirectory:
|
||||
linkHandlers = getVideoCoverLinkHandlers(tags);
|
||||
break;
|
||||
case MetadataDirectory.geoTiffDirectory:
|
||||
tags = SplayTreeMap.from(tags.map((name, value) {
|
||||
final tag = GeoTiffDirectory.tagForName(name);
|
||||
return MapEntry(name, GeoTiffDirectory.formatValue(tag, value));
|
||||
}));
|
||||
break;
|
||||
}
|
||||
|
||||
final colors = context.watch<AvesColorsData>();
|
||||
|
|
|
@ -279,6 +279,7 @@ class MetadataDirectory {
|
|||
static const xmpDirectory = 'XMP'; // from metadata-extractor
|
||||
static const mediaDirectory = 'Media'; // custom
|
||||
static const coverDirectory = 'Cover'; // custom
|
||||
static const geoTiffDirectory = 'GeoTIFF'; // custom
|
||||
|
||||
const MetadataDirectory(
|
||||
this.name,
|
||||
|
|
Loading…
Reference in a new issue