Code formatting

This commit is contained in:
ClemensFischer 2022-12-09 21:08:24 +01:00
parent 17745dc6fb
commit 6363923fa0
2 changed files with 17 additions and 8 deletions

View file

@ -28,14 +28,19 @@ namespace MapControl
var metadata = (BitmapMetadata)bitmap.Metadata; var metadata = (BitmapMetadata)bitmap.Metadata;
if (metadata.GetQuery(QueryString(ModelPixelScaleTag)) is double[] pixelScale && pixelScale.Length == 3 && if (metadata.GetQuery(QueryString(ModelPixelScaleTag)) is double[] pixelScale &&
metadata.GetQuery(QueryString(ModelTiePointTag)) is double[] tiePoint && tiePoint.Length >= 6) pixelScale.Length == 3 &&
metadata.GetQuery(QueryString(ModelTiePointTag)) is double[] tiePoint &&
tiePoint.Length >= 6)
{ {
transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]); transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]);
} }
else if (metadata.GetQuery(QueryString(ModelTransformationTag)) is double[] tform && tform.Length == 16) else if (metadata.GetQuery(QueryString(ModelTransformationTag)) is double[] transformValues &&
transformValues.Length == 16)
{ {
transform = new Matrix(tform[0], tform[1], tform[4], tform[5], tform[3], tform[7]); transform = new Matrix(transformValues[0], transformValues[1],
transformValues[4], transformValues[5],
transformValues[3], transformValues[7]);
} }
else else
{ {
@ -47,7 +52,8 @@ namespace MapControl
projection = GetProjection(sourcePath, geoKeyDirectory); projection = GetProjection(sourcePath, geoKeyDirectory);
} }
if (metadata.GetQuery(QueryString(NoDataTag)) is string noData && int.TryParse(noData, out int noDataValue)) if (metadata.GetQuery(QueryString(NoDataTag)) is string noData &&
int.TryParse(noData, out int noDataValue))
{ {
bitmap = ConvertTransparentPixel(bitmap, noDataValue); bitmap = ConvertTransparentPixel(bitmap, noDataValue);
} }

View file

@ -48,14 +48,17 @@ namespace MapControl
}); });
if (metadata.TryGetValue(pixelScaleQuery, out BitmapTypedValue pixelScaleValue) && if (metadata.TryGetValue(pixelScaleQuery, out BitmapTypedValue pixelScaleValue) &&
pixelScaleValue.Value is double[] pixelScale && pixelScale.Length == 3 && pixelScaleValue.Value is double[] pixelScale &&
pixelScale.Length == 3 &&
metadata.TryGetValue(tiePointQuery, out BitmapTypedValue tiePointValue) && metadata.TryGetValue(tiePointQuery, out BitmapTypedValue tiePointValue) &&
tiePointValue.Value is double[] tiePoint && tiePoint.Length >= 6) tiePointValue.Value is double[] tiePoint &&
tiePoint.Length >= 6)
{ {
transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]); transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]);
} }
else if (metadata.TryGetValue(transformationQuery, out BitmapTypedValue transformValue) && else if (metadata.TryGetValue(transformationQuery, out BitmapTypedValue transformValue) &&
transformValue.Value is double[] transformValues && transformValues.Length == 16) transformValue.Value is double[] transformValues &&
transformValues.Length == 16)
{ {
transform = new Matrix(transformValues[0], transformValues[1], transform = new Matrix(transformValues[0], transformValues[1],
transformValues[4], transformValues[5], transformValues[4], transformValues[5],