import { AsynchronousGeoJSONOverlay } from '@shared/map-overlay/asynchronous-geojson-overlay' ; /**
 * Finite Fault overlay for leaflet map
 */ const FiniteFaultMapOverlay = AsynchronousGeoJSONOverlay . extend ( { id : 'finite-fault-overlay' , title : 'Finite Fault' , url : '' , param product initialize : function ( product ) : void { AsynchronousGeoJSONOverlay . prototype . initialize . call ( this ) ; this . url = this . getUrl ( product ) ; } , param product getUrl : function ( product ) : string { try { return product . contents [ 'FFM.geojson' ] . url ; } catch ( e ) { return null ; } } , param feature param layer onEachFeature : function ( feature , layer ) : void { if ( feature . properties && layer ) { layer . setStyle ( { color : '#666' , fillColor : feature . properties . fill , fillOpacity : 0.5 , weight : 0.4 } ) ; layer . bindPopup ( this . formatPopup ( feature ) ) ; } } , param feature returns formatPopup : function ( feature ) : any { return this . generatePopupContent ( feature ) ; } , param feature returns generatePopupContent : function ( feature ) : any { let moment , slip , rise , trup , rake , color ; if ( feature . properties ) { const props = feature . properties ; const unknown = 'Data Unavailable' ; moment = props [ 'sf_moment' ] ? props [ 'sf_moment' ] . toExponential ( ) + ' N-m' : unknown ; slip = props . slip ? props . slip : unknown ; rise = props . rise ? props . rise : unknown ; trup = props . trup ? props . trup : unknown ; rake = props . rake ? props . rake : unknown ; color = props . fill ? props . fill : '#FFFFFF' ; const ffMapPopup = `
        <finite-fault-map-popup
          color="${ color }"
          moment="${ moment }"
          rake="${ rake }"
          rise="${ rise }"
          slip="${ slip }"
          trup="${ trup }"
        ></finite-fault-map-popup>
      ` ; return ffMapPopup ; } return `<h2>Data Unavailable</h2>` ; } } ) ; export { FiniteFaultMapOverlay } ;