Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] [FIX] EEW S波到達予想円の色を警報・予報で切り替え #727

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 49 additions & 19 deletions app/lib/feature/home/features/map/viewmodel/main_map_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ class _EewPsWaveService {
[
// 0...360
for (final bearing
in List<int>.generate(181, (index) => index * 2))
in List<int>.generate(91, (index) => index * 4))
() {
final latLng = const latlong2.Distance().offset(
latlong2.LatLng(
Expand All @@ -962,15 +962,7 @@ class _EewPsWaveService {
],
},
'properties': {
'distance': result.$1.sDistance,
'hypocenter': {
'type': 'Point',
'coordinates': [
result.$2.lon,
result.$2.lat,
],
'isWarning': result.$3,
},
'is_warning': result.$3,
'type': type.name,
},
},
Expand Down Expand Up @@ -1034,23 +1026,41 @@ class _EewSWaveLineService {
await dispose();
await controller.addLineLayer(
_EewPsWaveService.sourceId,
layerId,
layerId(isWarning: true),
LineLayerProperties(
lineColor: Colors.redAccent.toHexStringRGB(),
lineWidth: 2,
lineCap: 'round',
),
filter: [
'==',
'type',
_WaveType.sWave.name,
'all',
['==', 'type', _WaveType.sWave.name],
['==', 'is_warning', true],
],
);

await controller.addLineLayer(
_EewPsWaveService.sourceId,
layerId(isWarning: false),
LineLayerProperties(
lineColor: Colors.orangeAccent.toHexStringRGB(),
lineWidth: 2,
lineCap: 'round',
),
filter: [
'all',
['==', 'type', _WaveType.sWave.name],
['==', 'is_warning', false],
],
);
}

Future<void> dispose() => controller.removeLayer(layerId);
Future<void> dispose() => (
controller.removeLayer(layerId(isWarning: true)),
controller.removeLayer(layerId(isWarning: false)),
).wait;

static String get layerId => 's-wave-line';
static String layerId({required bool isWarning}) => 's-wave-line-$isWarning';
}
/*
class _EewPWaveFillService {
Expand Down Expand Up @@ -1094,7 +1104,7 @@ class _EewSWaveFillService {
await dispose();
await controller.addFillLayer(
_EewPsWaveService.sourceId,
layerId,
layerId(isWarning: true),
FillLayerProperties(
fillColor: Colors.red.toHexStringRGB(),
fillOpacity: 0.2,
Expand All @@ -1106,11 +1116,31 @@ class _EewSWaveFillService {
],
belowLayerId: BaseLayer.countriesFill.name,
);
await controller.addFillLayer(
_EewPsWaveService.sourceId,
layerId(isWarning: false),
FillLayerProperties(
fillColor: Colors.orangeAccent.toHexStringRGB(),
fillOpacity: 0.2,
),
filter: [
'==',
'type',
_WaveType.sWave.name,
],
belowLayerId: BaseLayer.countriesFill.name,
);
}

Future<void> dispose() => controller.removeLayer(layerId);
Future<void> dispose() => (
controller.removeLayer(layerId(isWarning: true)),
controller.removeLayer(layerId(isWarning: false)),
).wait;

static String get layerId => 's-wave-fill';
static String layerId({
required bool isWarning,
}) =>
's-wave-fill-$isWarning';
}

@freezed
Expand Down
Loading