22import { placeMarker , map } from "./utils/map" ;
33import { getColorPga , getColorPgv } from "./utils/transform" ;
44import { playSound } from "./utils/speaker" ;
5+ import { settings } from "./utils/settings" ;
56import type { Feature , FeatureCollection , Point , GeoJsonProperties } from "geojson" ;
67import type { StnPacket } from "./ws" ;
78
@@ -13,6 +14,10 @@ import newInt4 from "../assets/sounds/int/NewInt4.wav";
1314import newInt5 from "../assets/sounds/int/NewInt5.wav" ;
1415import newInt6 from "../assets/sounds/int/NewInt6.wav" ;
1516
17+ const usePga = settings ?. stnColor === "pga" ;
18+ const stnColor = ( pga : number , pgv : number ) : string =>
19+ usePga ? getColorPga ( pga ) : getColorPgv ( pgv ) ;
20+
1621const loadedStns = new Set < string > ( ) ;
1722
1823const stnsGeojson : FeatureCollection < Point , GeoJsonProperties > = {
@@ -39,7 +44,7 @@ export const stn = (stns: StnPacket) => {
3944 id : stn . code ,
4045 net : stn . author ,
4146 name : stn . name ,
42- color : getColorPgv ( stn . pgv ) ,
47+ color : stnColor ( stn . pga , stn . pgv ) ,
4348 opacity : 1
4449 }
4550 } ;
@@ -52,7 +57,7 @@ export const stn = (stns: StnPacket) => {
5257 ) ;
5358
5459 if ( stnFeature && stnFeature . properties ) {
55- stnFeature . properties . color = getColorPgv ( stn . pgv ) ;
60+ stnFeature . properties . color = stnColor ( stn . pga , stn . pgv ) ;
5661 }
5762 }
5863 }
0 commit comments