Package megameklab.printing
Class PrintEntity
java.lang.Object
megameklab.printing.PrintRecordSheet
megameklab.printing.PrintEntity
- All Implemented Interfaces:
Printable,IdConstants
- Direct Known Subclasses:
PrintAero,PrintBattleArmor,PrintHandheldWeapon,PrintInfantry,PrintMek,PrintProtoMek,PrintTank
Base class for printing Entity record sheets
-
Field Summary
Fields inherited from class megameklab.printing.PrintRecordSheet
DEFAULT_PIP_SIZE, DEFAULT_PIP_STROKE, DEFAULT_TYPEFACE, FILL_BLACK, FILL_GREY, FILL_RED, FILL_SHADOW, FILL_WHITE, FONT_SIZE_LARGE, FONT_SIZE_MEDIUM, FONT_SIZE_SMALL, FONT_SIZE_VERY_SMALL, options, svgNS, TABLE_RATIOFields inherited from interface megameklab.printing.IdConstants
AFT_HEAT, AFT_SIDES_HEAT, AMMO_PIPS, ARMOR_DIAGRAM, ARMOR_DIVISOR, ARMOR_KIT, ARMOR_PIPS, ARMOR_TYPE, ASF_BLANK_GUNNERY_SKILL, ASF_BLANK_PILOTING_SKILL, ASF_GUNNERY_SKILL, ASF_PILOTING_SKILL, AVIONICS_HIT, BLANK_CREW_NAME, BLANK_GUNNERY_SKILL, BLANK_PILOTING_SKILL, BLANKS_CREW, BOMB_BOXES, BROADSIDES_HEAT, BV, CANON_ARMOR_PIPS, CANON_STRUCTURE_PIPS, CHECK_AP, CHECK_LEG, CHECK_MECHANIZED, CHECK_SWARM, CIC_HIT, COMMANDER_HIT, COPILOT_HIT, COPYRIGHT, COST, CREW_DAMAGE, CREW_HIT, CREW_NAME, CRITS, DAMAGE, DC_PIPS, DEFAULT_FLUFF_IMAGE, DEST_MODS, DOCKING_COLLAR_HIT, DOUBLE_HS_COUNT, DRIVER_HIT, ENGINE_HIT, ENGINE_TYPE, ERA_ICON, EXTERNAL_STORES, EXTERNAL_STORES_KEY, FCS_HIT, FIELD_GUN_AMMO, FIELD_GUN_COLUMNS, FIELD_GUN_CREW, FIELD_GUN_DMG, FIELD_GUN_DMG_2, FIELD_GUN_LONG, FIELD_GUN_MED, FIELD_GUN_MIN_RANGE, FIELD_GUN_QTY, FIELD_GUN_SHORT, FIELD_GUN_TYPE, FLIGHT_STABILIZER_HIT, FLUFF_DUAL_PILOT, FLUFF_IMAGE, FLUFF_NAME, FLUFF_SINGLE_PILOT, FLUFF_TRIPLE_PILOT, FOOTER, FORE_SIDES_HEAT, FRAME, FUEL_TANK_HIT, GUNNERY_SKILL, GUNNERY_SKILL_TEXT, GYRO_HIT, HEAT_SINK_PIPS, HEAVY_DUTY_GYRO_PIP, HS_COUNT, HS_TYPE, INVENTORY, IS_PIPS, IS_PIPS_HD, IS_PIPS_HD_SH, KF_BOOM_HIT, KF_PIPS, LANDING_GEAR_HIT, LBL_BATTLEARMOR, LBL_JUMP, LBL_ROLE, LBL_VEE_MODE, LIFE_BOATS, LIFE_SUPPORT_HIT, MAG_CLAMP_NOTE, MAIN_GUN_ARMOR, MAIN_GUN_SHADOW, MAIN_GUN_TEXT, MINUS_1_MP, MINUS_2_MP, MINUS_3_MP, MINUS_4_MP, MINUS_5_MP, MINUS_6_MP, MINUS_7_MP, MINUS_8_MP, MINUS_9_MP, MML_COLOR_ELEMENTS, MML_FIELD_WIDTH, MML_GAP, MML_MULTISECTION, MODE_1, MODE_2, MODE_2_LABEL, MOTIVE_SYSTEM_HIT, MOVEMENT_TYPE, MP_1, MP_2, MP_2_LABEL, MP_AIR_MEK_CRUISE, MP_AIR_MEK_FLANK, MP_AIR_MEK_RUN, MP_AIR_MEK_WALK, MP_CRUISE, MP_FLANK, MP_GROUND, MP_JUMP, MP_MAX_THRUST, MP_RUN, MP_SAFE_THRUST, MP_WALK, N_BATTLEARMOR, N_CREW, N_MARINES, N_OTHER, N_PASSENGERS, NO_SOLDIER, NOSE_HEAT, NOTES, PARTIAL_WING_BONUS, PATCHWORK, PILOT_HIT, PILOT_NAME, PILOTING_SKILL, PILOTING_SKILL_TEXT, PIPS, PROTOMEK_INDEX, RANGE, RANGE_IN_HEXES, RANGE_MOD, ROLE, ROW_SHADING, RS_TEMPLATE, RULES_LEVEL, SAIL_PIPS, SENSOR_HIT, SHIELD, SHIELD_DA, SHIELD_DC, SI_PIPS, SNEAK_CAMO_MODS, SNEAK_IR_MODS, SOLDIER, SPAS, SQUAD, STABILIZER_HIT_FRONT, STABILIZER_HIT_LEFT, STABILIZER_HIT_REAR, STABILIZER_HIT_RIGHT, STABILIZER_HIT_TURRET, STABILIZER_HIT_TURRET_FRONT, STABILIZER_HIT_TURRET_REAR, STRUCTURE_PIPS, STRUCTURE_TYPE, SUIT, TECH_BASE, TEXT_ARMOR, TEXT_DOCKING_COLLARS, TEXT_IS, TEXT_KF_DRIVE, TEXT_SAIL, TEXT_SI, THRUSTER_LEFT_HIT, THRUSTER_RIGHT_HIT, TITLE, TONNAGE, TORSO_WEAPON, TRACKS, TRANSPORT_WT, TURRET_LOCKED, TURRET_LOCKED_FRONT, TURRET_LOCKED_REAR, TYPE, TYPE2, UNIT_SCALE, UNIT_TYPE, UW_LABEL, UW_RANGE_MOD, WARRIOR_DATA_DUAL, WARRIOR_DATA_SINGLE, WARRIOR_DATA_TRIPLE, WHEELSFields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPrintEntity(int startPage, RecordSheetOptions options) Creates an SVG object for the record sheet -
Method Summary
Modifier and TypeMethodDescriptionprotected voidApplies the critical damage to the core components of the unit and crew.protected voidprotected voidAdd armor and structure pips for each location.protected voidprotected voidprotected intIdentifies the index of the first location that can be armored.protected StringSpace for misc equipment such as cargo space and SV chassis mods.protected StringSpace for various miscellaneous notes about the unit, such as restrictions.protected StringformatMovement(double mp) Applies the current scale to a movement point value and adds the units' indicator.protected StringformatMovement(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.Builds the string to display for the quirks block.protected Stringprotected StringFuel block used by aerospace unit.protected Stringprotected Stringprotected intgetArmorDamage(int loc, boolean rear) Used to build an outline of a PDF documentprotected ElementgetElementById(String id) abstract megamek.common.units.Entityprotected Imageprotected intgetHitsCoreComponent(int index) Returns the number of hits on the core component of the unit.protected intgetStructureDamage(int loc) protected Stringprotected voidprotected voidprocessImage(int pageNum, PageFormat pageFormat) Renders the sheet to the Graphics object.protected voidSets the style for the heat scale markers (asterisk or arrow)protected booleanshowC3()When printing from a MUL the C3 data is used in the BV calculation unless the option has been disabled.protected booleanShow Damage on the record sheet.protected booleanprotected booleanWhen printing from a MUL the pilot data is filled in unless the option has been disabled.booleanprotected abstract booleanprotected final booleanprotected voidwriteEquipment(org.w3c.dom.svg.SVGRectElement svgRect) Fills in the weapons and inventory section of the record sheet.protected voidMethods inherited from class megameklab.printing.PrintRecordSheet
addLineThrough, addLineThrough, addMultilineTextElement, addMultilineTextElement, addMultilineTextElement, addReferenceCharts, addTextElement, addTextElement, addTextElement, addTextElementToFit, addTextElementToFit, addTextElementToFit, build, createDocument, createDocument, createPip, createPip, createPip, createRoundedRectangle, embedImage, embedImage, exportPDF, fillCoreComponentCriticalDamage, fillCoreComponentCriticalDamage, getBoldFont, getBoldItalicFont, getBoldItalicTextLength, getBoldTextLength, getDamageFillColor, getFirstPage, getFontHeight, getFontHeight, getItalicFont, getItalicTextLength, getNormalFont, getNormalTextLength, getPageCount, getRecordSheetTitle, getRectBBox, getRightSideReferenceTables, getSVGDocument, getSVGFileName, getTextLength, getTextLength, getTextLength, getTypeface, hideElement, hideElement, hideElement, hideElement, includeReferenceCharts, loadTemplate, loadTemplate, placeReferenceCharts, print, removeElement, setCallback, setSVGDocument, setTextField, setTextField, setTextField
-
Constructor Details
-
PrintEntity
Creates an SVG object for the record sheet- Parameters:
startPage- The print job page number for this sheetoptions- Overrides the global options for which elements are printed
-
-
Method Details
-
getEntity
public abstract megamek.common.units.Entity getEntity() -
getBookmarkNames
Description copied from class:PrintRecordSheetUsed to build an outline of a PDF document- Specified by:
getBookmarkNamesin classPrintRecordSheet- 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
- Returns:
- A String showing the total weapon heat and dissipation.
-
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
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
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
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
Description copied from class:PrintRecordSheetRenders the sheet to the Graphics object.- Overrides:
processImagein classPrintRecordSheet- Parameters:
pageNum- Indicates which page of multipage sheets to print. The first page is 0.
-
setHeatScaleMarkerStyle
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:
applyCoreComponentsCriticalDamagein classPrintRecordSheet
-
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
-
formatMovement
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
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 pointsfullMP- The full movement points- Returns:
- The formatted movement string
-
formatWalk
-
formatRun
-
formatJump
-
formatTechBase
-
formatRulesLevel
-
formatCost
-
useAlternateArmorGrouping
protected final boolean useAlternateArmorGrouping() -
supportsAlternateArmorGrouping
protected abstract boolean supportsAlternateArmorGrouping() -
getElementById
-
getArmorDamage
protected int getArmorDamage(int loc, boolean rear) -
getStructureDamage
protected int getStructureDamage(int loc)
-