import { SatObject } from '../../api/keepTrackTypes' ; import { SpaceObjectType } from '../../api/SpaceObjectType' ; import { ColorInformation , colorSchemeManager , Pickable } from '../colorSchemeManager' ; export const velocityRules = ( sat ) : ColorInformation => { if ( sat . static && sat . type === SpaceObjectType . STAR ) { if ( sat . vmag >= 4.7 && colorSchemeManager . objectTypeFlags . starLow ) { return { color : colorSchemeManager . colorTheme . starLow , pickable : Pickable . Yes , } ; } else if ( sat . vmag >= 3.5 && sat . vmag < 4.7 && colorSchemeManager . objectTypeFlags . starMed ) { return { color : colorSchemeManager . colorTheme . starMed , pickable : Pickable . Yes , } ; } else if ( sat . vmag < 3.5 && colorSchemeManager . objectTypeFlags . starHi ) { return { color : colorSchemeManager . colorTheme . starHi , pickable : Pickable . Yes , } ; } else { return { color : colorSchemeManager . colorTheme . deselected , pickable : Pickable . No , } ; } } switch ( sat . type ) { case SpaceObjectType . INTERGOVERNMENTAL_ORGANIZATION : case SpaceObjectType . SUBORBITAL_PAYLOAD_OPERATOR : case SpaceObjectType . PAYLOAD_OWNER : case SpaceObjectType . METEOROLOGICAL_ROCKET_LAUNCH_AGENCY_OR_MANUFACTURER : case SpaceObjectType . PAYLOAD_MANUFACTURER : case SpaceObjectType . LAUNCH_AGENCY : case SpaceObjectType . LAUNCH_SITE : case SpaceObjectType . LAUNCH_POSITION : return { color : colorSchemeManager . colorTheme . facility , pickable : Pickable . Yes , } ; default : } if ( sat . static ) { return { color : colorSchemeManager . colorTheme . sensor , pickable : Pickable . Yes , } ; } if ( sat . inView === 1 ) { if ( colorSchemeManager . objectTypeFlags . inViewAlt === false ) { return { color : colorSchemeManager . colorTheme . deselected , pickable : Pickable . No , } ; } else { return { color : colorSchemeManager . colorTheme . inViewAlt , pickable : Pickable . Yes , } ; } } if ( sat . velocity . total > 5.5 && colorSchemeManager . objectTypeFlags . velocityFast === false ) { return { color : colorSchemeManager . colorTheme . deselected , pickable : Pickable . No , } ; } if ( sat . velocity . total >= 2.5 && sat . velocity . total <= 5.5 && colorSchemeManager . objectTypeFlags . velocityMed === false ) { return { color : colorSchemeManager . colorTheme . deselected , pickable : Pickable . No , } ; } if ( sat . velocity . total < 2.5 && colorSchemeManager . objectTypeFlags . velocitySlow === false ) { return { color : colorSchemeManager . colorTheme . deselected , pickable : Pickable . No , } ; } return { color : [ 1.0 - Math . min ( sat . velocity . total / 15 , 1.0 ) , Math . min ( sat . velocity . total / 15 , 1.0 ) , 0.0 , 1.0 ] , pickable : Pickable . Yes , } ; } ;