diff --git a/src/js/shield.js b/src/js/shield.js index dfcc92602..45aa0b6aa 100644 --- a/src/js/shield.js +++ b/src/js/shield.js @@ -73,6 +73,19 @@ export function isValidRef(ref) { return ref !== null && ref.length !== 0 && ref.length <= 6; } +/** + * Get the number of banner placards associated with this shield + * + * @param {*} shield - Shield definition + * @returns the number of banner placards that need to be drawn + */ +export function getBannerCount(shield) { + if (shield == null || typeof shield.modifiers == "undefined") { + return 0; //Unadorned shield + } + return shield.modifiers.length; +} + /** * Retrieve the shield blank that goes with a particular route. If there are * multiple shields for a route (different widths), it picks the best shield. @@ -128,7 +141,7 @@ function textColor(shieldDef) { * @returns a blank graphics context */ function generateBlankGraphicsContext(shieldDef, routeDef) { - var bannerCount = ShieldDef.getBannerCount(shieldDef); + var bannerCount = getBannerCount(shieldDef); var shieldArtwork = getRasterShieldBlank(shieldDef, routeDef); var compoundBounds = null; @@ -148,7 +161,7 @@ function generateBlankGraphicsContext(shieldDef, routeDef) { } function drawShield(ctx, shieldDef, routeDef) { - var bannerCount = ShieldDef.getBannerCount(shieldDef); + var bannerCount = getBannerCount(shieldDef); var shieldArtwork = getRasterShieldBlank(shieldDef, routeDef); @@ -172,7 +185,7 @@ function drawShield(ctx, shieldDef, routeDef) { } function drawShieldText(ctx, shieldDef, routeDef) { - var bannerCount = ShieldDef.getBannerCount(shieldDef); + var bannerCount = getBannerCount(shieldDef); var shieldBounds = null; var shieldArtwork = getRasterShieldBlank(shieldDef, routeDef); diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index 24310dc5a..744b85d33 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -4222,29 +4222,3 @@ export function loadShields(shieldImages) { return shields; } - -/** - * Determines whether there is a raster shield background for a particular network - * - * @param {*} network - Route network - * @returns true if a raster shield is available - */ -export function hasShieldArtwork(network) { - return ( - shields[network] != null && - typeof shields[network].backgroundImage !== "undefined" - ); -} - -/** - * Get the number of banner placards associated with this shield - * - * @param {*} shield - Shield definition - * @returns the number of banner placards that need to be drawn - */ -export function getBannerCount(shield) { - if (shield == null || typeof shield.modifiers == "undefined") { - return 0; //Unadorned shield - } - return shield.modifiers.length; -}