Skip to content

Commit

Permalink
S波・P波どちらかの到達予想円がない場合に、例外が漏れる問題を解消 (#533)
Browse files Browse the repository at this point in the history
* fix:

* fix
  • Loading branch information
YumNumm authored Jan 20, 2024
1 parent 729e219 commit 39a705e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
12 changes: 6 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -559,7 +559,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
Expand Down Expand Up @@ -601,7 +601,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
Expand Down Expand Up @@ -642,7 +642,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
Expand Down Expand Up @@ -788,7 +788,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -820,7 +820,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1107;
CURRENT_PROJECT_VERSION = 1108;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CPL7H8SHVM;
ENABLE_BITCODE = NO;
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1107</string>
<string>1108</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>FLTEnableImpeller</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,7 @@ class _EewPsWaveService {
.difference(
originTime,
)
.inMicroseconds /
1000 /
.inMilliseconds /
1000,
);
results.add(
Expand Down Expand Up @@ -695,8 +694,8 @@ class _EewPsWaveService {
result.$2.lon,
),
((type == _WaveType.sWave
? result.$1.sDistance!
: result.$1.pDistance!) *
? result.$1.sDistance ?? 0
: result.$1.pDistance ?? 0) *
1000)
.toInt(),
bearing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,31 @@ extension TravelTimeDepthMapCalc on TravelTimeDepthMap {
/// [duration]: 地震発生からの経過時間(sec)
TravelTimeResult getTravelTime(int depth, double duration) {
final lists = getOrNull(depth);
if (depth > 700 || duration > 2000) {
return TravelTimeResult(null, null);
}
if (lists == null) {
return TravelTimeResult(null, null);
}
final p1 = lists.firstWhereOrNull((e) => e.p <= duration);
final p2 = lists.lastWhereOrNull((e) => e.p >= duration);
if (p1 == null || p2 == null) {
return TravelTimeResult(null, null);
}
final p = (duration - p1.p) / (p2.p - p1.p) * (p2.distance - p1.distance) +
p1.distance;
final s1 = lists.firstWhereOrNull((e) => e.s <= duration);
final s2 = lists.lastWhereOrNull((e) => e.s >= duration);
if (s1 == null || s2 == null) {
return TravelTimeResult(null, p);
}
final s = (duration - s1.s) / (s2.s - s1.s) * (s2.distance - s1.distance) +
s1.distance;
final p = () {
final p1 = lists.firstWhereOrNull((e) => e.p <= duration);
final p2 = lists.lastWhereOrNull((e) => e.p >= duration);
if (p1 == null || p2 == null) {
return null;
}
final p =
(duration - p1.p) / (p2.p - p1.p) * (p2.distance - p1.distance) +
p1.distance;
return p;
}();
final s = () {
final s1 = lists.firstWhereOrNull((e) => e.s <= duration);
final s2 = lists.lastWhereOrNull((e) => e.s >= duration);
if (s1 == null || s2 == null) {
return null;
}
final s =
(duration - s1.s) / (s2.s - s1.s) * (s2.distance - s1.distance) +
s1.distance;
return s;
}();
return TravelTimeResult(s, p);
}
}
Expand Down

0 comments on commit 39a705e

Please sign in to comment.