-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #145 Add warning for drone cameras not in database
- Loading branch information
1 parent
470570b
commit 80309de
Showing
1 changed file
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,8 @@ public class MainActivity extends AthenaActivity { | |
|
||
public static int dangerousAutelAwarenessCount; | ||
|
||
public static int dangerousMissingCameraIntrinsicsCount; | ||
|
||
public static EGMOffsetProvider offsetAdapter = new EGM96OffsetAdapter(); // calculates diff between WGS84 reference ellipsoid and EGM96 geoid | ||
|
||
public static final double FEET_PER_METER = 3937.0d/1200.0d; // Exact constant for US Survey Foot per Meter | ||
|
@@ -179,6 +181,7 @@ protected void onCreate(Bundle savedInstanceState) { | |
clearText(); | ||
|
||
dangerousAutelAwarenessCount = athenaApp.getInt("dangerousAutelAwarenessCount"); | ||
dangerousMissingCameraIntrinsicsCount = athenaApp.getInt("dangerousMissingCameraIntrinsicsCount"); | ||
|
||
CharSequence textRestore = athenaApp.getCharSequence("textview"); | ||
if (textRestore != null) { | ||
|
@@ -276,6 +279,7 @@ protected void onSaveInstanceState(Bundle saveInstanceState) { | |
@Override | ||
protected void saveStateToSingleton() { | ||
athenaApp.putInt("dangerousAutelAwarenessCount", dangerousAutelAwarenessCount); | ||
athenaApp.putInt("dangerousMissingCameraIntrinsicsCount", dangerousMissingCameraIntrinsicsCount); | ||
if (textView != null) { | ||
athenaApp.putCharSequence("textview", textView.getText()); | ||
} | ||
|
@@ -860,6 +864,9 @@ public void calculateImage(View view, boolean shouldISendCoT) | |
} | ||
textViewTargetCoord.setText(Html.fromHtml(targetCoordString, 0, null, null)); | ||
isTargetCoordDisplayed = true; | ||
if (!MetadataExtractor.isDroneModelRecognized(exif)) { | ||
displayMissingCameraIntrinsicsAlert(); | ||
} | ||
// close file | ||
is.close(); | ||
// | ||
|
@@ -922,7 +929,7 @@ private void printDEMBounds() { | |
} | ||
|
||
public void displayAutelAlert() { | ||
if (dangerousAutelAwarenessCount < 1) { | ||
if (dangerousAutelAwarenessCount < 1) { // suppress warning if already encountered by user in this session | ||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); | ||
builder.setMessage(R.string.autel_accuracy_warning_msg); | ||
builder.setPositiveButton(R.string.i_understand_this_risk, (DialogInterface.OnClickListener) (dialog, which) -> { | ||
|
@@ -933,6 +940,18 @@ public void displayAutelAlert() { | |
} | ||
} | ||
|
||
public void displayMissingCameraIntrinsicsAlert() { | ||
if (dangerousMissingCameraIntrinsicsCount < 1) { // suppress warning if already encountered by user in this session | ||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); | ||
builder.setMessage("⚠\uFE0F DANGER: Camera internal properties were not found in database. Calculation accuracy will be degraded. Email [email protected] ⚠\uFE0F"); | ||
builder.setPositiveButton(R.string.i_understand_this_risk, (DialogInterface.OnClickListener) (dialog, which) -> { | ||
dangerousMissingCameraIntrinsicsCount += 1; | ||
}); | ||
AlertDialog alertDialog = builder.create(); | ||
alertDialog.show(); | ||
} | ||
} | ||
|
||
public void copyTargetCoordText(View view) { | ||
if (isTargetCoordDisplayed) { | ||
String text = textViewTargetCoord.getText().toString(); | ||
|