Class PrintEntity

All Implemented Interfaces:
Printable, IdConstants
Direct Known Subclasses:
PrintAero, PrintBattleArmor, PrintHandheldWeapon, PrintInfantry, PrintMek, PrintProtoMek, PrintTank

public abstract class PrintEntity extends PrintRecordSheet
Base class for printing Entity record sheets
  • Constructor Details

    • PrintEntity

      protected PrintEntity(int startPage, RecordSheetOptions options)
      Creates an SVG object for the record sheet
      Parameters:
      startPage - The print job page number for this sheet
      options - Overrides the global options for which elements are printed
  • Method Details

    • getEntity

      public abstract megamek.common.units.Entity getEntity()
    • getBookmarkNames

      public List<String> getBookmarkNames()
      Description copied from class: PrintRecordSheet
      Used to build an outline of a PDF document
      Specified by:
      getBookmarkNames in class PrintRecordSheet
      Returns:
      Names of outline entries
    • showPilotInfo

      protected boolean showPilotInfo()
      When printing from a MUL the pilot data is filled in unless the option has been disabled. This allows a series of blank record sheets to be generated without including the generated pilot data. If the crew name is "unnamed" then we are printing directly from MML or file/cache and the pilot data should not be filled in.
      Returns:
      Whether the pilot data should be filled in.
    • showC3

      protected boolean showC3()
      When printing from a MUL the C3 data is used in the BV calculation unless the option has been disabled.
      Returns:
      Whether the C3 data should be filled in.
    • showDamage

      protected boolean showDamage()
      Show Damage on the record sheet.
      Returns:
      Whether the C3 data should be filled in.
    • showHeatProfile

      protected boolean showHeatProfile()
      Returns:
      Whether the total weapon heat and dissipation should be shown on the record sheet
    • heatProfileText

      protected String heatProfileText()
      Returns:
      A String showing the total weapon heat and dissipation.
    • formatFeatures

      public String formatFeatures()
      Space for misc equipment such as cargo space and SV chassis mods.
      Returns:
      A list of misc equipment, or an empty String if none
    • formatMiscNotes

      public String formatMiscNotes()
      Space for various miscellaneous notes about the unit, such as restrictions.
      Returns:
      A list of misc notes, or an empty String if none
    • showQuirks

      public boolean showQuirks()
      Returns:
      Whether the quirks block should be shown on the record sheet
    • formatQuirks

      public String formatQuirks()
      Builds the string to display for the quirks block. Returns an empty string if quirks are disabled (or if the unit has no quirks).
      Returns:
      The text to display for the unit's quirks.
    • formatTacticalFuel

      public String formatTacticalFuel()
      Fuel block used by aerospace unit. Fuel for other units, such as non-aerospace support vehicles, is for strategic fuel use and not relevant for the record sheet.
      Returns:
      A string containing the amount of fuel and cost per thrust point for aerospace units, otherwise an empty string.
    • processImage

      protected void processImage(int pageNum, PageFormat pageFormat)
      Description copied from class: PrintRecordSheet
      Renders the sheet to the Graphics object.
      Overrides:
      processImage in class PrintRecordSheet
      Parameters:
      pageNum - Indicates which page of multipage sheets to print. The first page is 0.
    • setHeatScaleMarkerStyle

      protected void setHeatScaleMarkerStyle(Document doc)
      Sets the style for the heat scale markers (asterisk or arrow)
      Parameters:
      doc - The SVG document to process
    • writeTextFields

      protected void writeTextFields()
    • hideUnusedCrewElements

      protected void hideUnusedCrewElements()
    • drawArmor

      protected void drawArmor()
    • drawArmorStructurePips

      protected void drawArmorStructurePips()
      Add armor and structure pips for each location.
    • applyCoreComponentsCriticalDamage

      protected void applyCoreComponentsCriticalDamage()
      Applies the critical damage to the core components of the unit and crew. This should be overridden by subclasses that have core components.
      Overrides:
      applyCoreComponentsCriticalDamage in class PrintRecordSheet
    • getHitsCoreComponent

      protected int getHitsCoreComponent(int index)
      Returns the number of hits on the core component of the unit.
    • firstArmorLocation

      protected int firstArmorLocation()
      Identifies the index of the first location that can be armored. For vehicles this should be 1 to skip the body.
      Returns:
      The lowest location index that can be armored.
    • drawStructure

      protected void drawStructure()
    • writeEquipment

      protected void writeEquipment(org.w3c.dom.svg.SVGRectElement svgRect)
      Fills in the weapons and inventory section of the record sheet.
      Parameters:
      svgRect - The bounds of the text region
    • drawFluffImage

      protected void drawFluffImage()
    • getFluffImage

      @Nullable protected Image getFluffImage()
    • formatMovement

      protected String formatMovement(double mp)
      Applies the current scale to a movement point value and adds the units' indicator. If the units are hexes, the value is rounded up.
      Parameters:
      mp - The movement points
      Returns:
      The formatted movement string
    • formatMovement

      protected String formatMovement(double baseMP, double fullMP)
      Applies the current scale to a pair of movement point values, puts the second in brackets, and adds the units' indicator. This is used for cases when equipment may give a temporary boost to MP, such as MASC. If the units are hexes, the value is rounded up.
      Parameters:
      baseMP - The base movement points
      fullMP - The full movement points
      Returns:
      The formatted movement string
    • formatWalk

      protected String formatWalk()
    • formatRun

      protected String formatRun()
    • formatJump

      protected String formatJump()
    • formatTechBase

      protected String formatTechBase()
    • formatRulesLevel

      protected String formatRulesLevel()
    • formatCost

      protected String formatCost()
    • useAlternateArmorGrouping

      protected final boolean useAlternateArmorGrouping()
    • supportsAlternateArmorGrouping

      protected abstract boolean supportsAlternateArmorGrouping()
    • getElementById

      protected Element getElementById(String id)
    • getArmorDamage

      protected int getArmorDamage(int loc, boolean rear)
    • getStructureDamage

      protected int getStructureDamage(int loc)