Class DexpiLayoutEngine
Equipment is arranged left-to-right following process flow topology using a topological sort of the process graph. Each column holds one or more equipment items at a fixed X spacing. Multi- outlet equipment (separators) fan out vertically to separate rows.
Positions and labels are written as DEXPI-compliant <Position>, <Scale>, and
<Label> XML elements on each Equipment and PipingComponent element.
- Version:
- 1.0
- Author:
- NeqSim
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classHolds computed position data for a single equipment item.(package private) static final classHolds stream data for a single column in the stream data table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleHalf-width of flow direction arrow heads.private static final doubleLength of flow direction arrow heads.private static final doubleFont height for equipment bar label text.private static final doubleVertical offset from equipment center to top of bar label.private static final doubleRow height within equipment bar label table.private static final doubleWidth of equipment bar label box.private static final doubleLine weight for battery limit boundary (bold dashed).private static final doublePadding around equipment for battery limit boundary (mm).private static final doubleMargin between outer edge and inner border.private static final doubleDefault scale factor for equipment shapes.private static final StringFont name for labels.(package private) static final doubleRadius of instrument bubble for connection point calculations.(package private) static final doubleVertical offset from process line to instrument bubble center.(package private) static final doubleHorizontal spacing between instrument bubbles on the same equipment.private static final doubleFont height for legend text.private static final doubleRow height in the legend box (mm).private static final doubleWidth of the symbol legend box (mm).private static final StringPresentation colour B for process piping lines (olive).private static final StringPresentation colour G for process piping lines (olive).private static final StringPresentation colour R for process piping lines (olive).private static final doubleMinimum drawing sheet height (A3 landscape in mm).private static final doubleMinimum drawing sheet width (A3 landscape in mm).private static final doubleLine weight for process piping lines.private static final doubleRow height in revision history table (mm).private static final doubleLine weight for measuring/signal lines.private static final doubleWidth of each stream column in the stream table.private static final doubleFont height for stream table text.private static final doubleWidth of the row-label column in the stream table.private static final doubleHeight of the stream data table header row.private static final doubleTop of the stream table (Y coordinate).private static final doubleFont height for tag name labels.private static final doubleVertical offset of tag name label above equipment center.private static final doubleTitle block height at the bottom-right.private static final doubleTitle block width.private static final doubleFont height for title block text.private static final doubleFont height for the main drawing title.private static final doubleRow height inside title block.private static final doubleHorizontal spacing between equipment columns (mm in drawing space).private static final doubleStarting X coordinate.private static final doubleBase Y coordinate for the main process line.private static final doubleVertical spacing for branch lines below the main process line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidappendBarPolyLine(Document document, Element parent, double x1, double y1, double x2, double y2) Appends a PolyLine element used as a border in an equipment bar label.private static voidappendBarText(Document document, Element parent, String text, double x, double y, String justification) Appends a Text element used in an equipment bar label row.(package private) static voidappendBatteryLimitBoundary(Document document, Element parent, Map<String, DexpiLayoutEngine.EquipmentPosition> positions, String areaLabel) Appends a dashed battery-limit boundary rectangle around all equipment.private static voidappendBorderRect(Document document, Element parent, double x1, double y1, double x2, double y2, double lineWeight) Appends a rectangle as a closed PolyLine.private static voidappendBorderText(Document document, Element parent, String text, double x, double y) Appends a border zone label (column number or row letter).private static voidappendBorderTick(Document document, Element parent, double x1, double y1, double x2, double y2) Appends a short tick mark line in the border margin.private static voidappendColumnRowMarkers(Document document, Element border, double sheetWidth, double sheetHeight) Appends column/row zone markers along the border edges (A-F vertical, 1-8 horizontal).(package private) static voidappendConnectionLine(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a process piping line (CenterLine) connecting two nozzle positions.(package private) static voidappendContinuationArrow(Document document, Element parent, double x, double y, String direction, String targetSheet) Appends a continuation arrow marking at the edge of a drawing page.private static voidappendCoordinate(Document document, Element parent, double x, double y) Appends a single Coordinate element to a CenterLine.(package private) static voidappendDrawing(Document document, Element parent, String drawingName, String drawingNumber, String revision, String date, double sheetWidth, double sheetHeight) Appends a complete DEXPI<Drawing>element with border, column/row markers, and a professional title block.private static voidappendDrawingBorderLines(Document document, Element border, double sheetWidth, double sheetHeight) Appends the outer and inner border rectangles.(package private) static voidappendEquipmentBarLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId, double pressure, double temperature, double flowRate) Appends an EquipmentBarLabel below an equipment element showing operating data.(package private) static voidappendEquipmentBarLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId, double pressure, double temperature, double flowRate, List<String[]> extraRows) Appends an equipment bar label with operating data and optional extra rows.(package private) static voidappendFailPositionMarker(Document document, Element parent, String failPosition, double x, double y) Appends a valve fail-position marker text (FC, FO, FL) near a valve position.(package private) static voidappendFlowArrow(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a solid triangular flow-direction arrow at the midpoint of a connection line.(package private) static voidappendGaugeGlass(Document document, Element parent, double x, double yTop, double yBottom) Appends a gauge glass (level gauge) symbol on a vessel.(package private) static voidappendHeatTraceMark(Document document, Element parent, String traceType, double fromX, double fromY, double toX, double toY) Appends a heat trace indication on a pipe segment.(package private) static voidappendInsulationMark(Document document, Element parent, String insulationCode, double fromX, double fromY, double toX, double toY) Appends insulation marking on a process line between two points.private static voidappendLegendText(Document document, Element parent, String text, double x, double y, String justification, String fontSize) Appends text for the symbol legend box.(package private) static voidappendLineIdLabel(Document document, Element parent, String lineSize, String fluidCode, String lineNumber, String pipingClass, double fromX, double fromY, double toX, double toY) Appends a formatted line identification label per ISO 10628 / NORSOK Z-003.(package private) static voidappendMeasuringLine(Document document, Element parent, double tapX, double tapY, double bubbleX, double bubbleY) Appends a measuring line (CenterLine) connecting an equipment nozzle to an instrument bubble.(package private) static voidappendNozzlePosition(Document document, Element nozzleElement, double x, double y) Appends a Position and Scale to a Nozzle element for graphical rendering.(package private) static voidappendOrientationMarker(Document document, Element parent, String orientation, double x, double y) Appends an orientation marker (H or V) next to equipment, per ISO 10628 convention.(package private) static voidappendPosition(Document document, Element element, DexpiLayoutEngine.EquipmentPosition pos) Appends a DEXPI Position element to an equipment element.(package private) static voidappendPstMarker(Document document, Element parent, double x, double y) Appends a PST (Partial Stroke Test) annotation marker near a safety valve.private static voidappendRevisionCell(Document document, Element parent, double x1, double y1, double x2, double y2, String text) Appends a cell for the revision history table.(package private) static voidappendRevisionHistory(Document document, Element drawing, List<String[]> revisions, double sheetWidth) Appends a revision history table above the title block.(package private) static voidappendSamplePoint(Document document, Element parent, String tag, double x, double y) Appends a sample point symbol on a process line.(package private) static voidappendScale(Document document, Element element, DexpiLayoutEngine.EquipmentPosition pos) Appends a DEXPI Scale element to an equipment element.(package private) static voidappendSignalLine(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a signal conveying line (dashed, blue) between two instrument bubbles.(package private) static voidappendSilMarker(Document document, Element parent, int silLevel, double x, double y) Appends a SIL level marker below an instrument bubble.(package private) static voidappendSolenoidMarker(Document document, Element parent, double valveX, double valveY, double controllerX, double controllerY) Appends a solenoid actuator diamond symbol near a valve position.(package private) static voidappendStreamLabel(Document document, Element parent, String streamNumber, double fromX, double fromY, double toX, double toY) Appends a stream number label at the midpoint of a connection line.(package private) static voidappendStreamTable(Document document, Element parent, List<DexpiLayoutEngine.StreamTableEntry> streamData) Appends a process conditions table (stream table) at the bottom of the drawing.(package private) static voidappendStyledConnectionLine(Document document, Element parent, double fromX, double fromY, double toX, double toY, int lineType, String colorR, String colorG, String colorB) Appends a connection line with a specific line type for utility services.(package private) static voidappendSymbolLegend(Document document, Element parent, List<String[]> entries) Appends a symbol legend box listing line types, valve symbols, and abbreviations.private static voidappendTableText(Document document, Element parent, String text, double x, double y, String justification) Appends a text element for the stream table.(package private) static voidappendTagNameLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId) Appends an EquipmentTagNameLabel to an equipment element.private static voidappendTitleBlock(Document document, Element drawing, String drawingName, String drawingNumber, String revision, String date, double sheetWidth) Appends the title block label in the bottom-right corner of the drawing.private static voidappendTitleCell(Document document, Element parent, double x1, double y1, double x2, double y2, String text) Appends a cell in the title block with a border and text.private static voidappendTitleText(Document document, Element parent, String text, double x, double y, double fontSize, String justification) Appends a text element for the title block.(package private) static voidappendUtilityConnectionPoint(Document document, Element parent, String utilityCode, double x, double y, double targetX, double targetY) Appends a utility supply connection point with label and dashed connection line.(package private) static voidappendWeightAnnotation(Document document, Element parent, double dryWeightKg, double operatingWeightKg, double x, double y) Appends an equipment weight and center-of-gravity annotation marker.(package private) static double[]computeInstrumentPosition(DexpiLayoutEngine.EquipmentPosition equipmentPos, int instrumentIndex, int totalInstruments) Computes the layout position for an instrument bubble attached to a specific equipment.(package private) static Map<String, DexpiLayoutEngine.EquipmentPosition> computeLayout(ProcessSystem processSystem) Computes layout positions for all equipment in a process system.(package private) static int[]computePageGrid(double totalWidth, double totalHeight, double maxPageWidth, double maxPageHeight) Computes the number of drawing pages needed for a large flowsheet.(package private) static double[]computeSheetSize(Map<String, DexpiLayoutEngine.EquipmentPosition> positions) Computes the required drawing sheet dimensions to enclose all equipment, instruments, and labels with adequate margin.private static StringformatValue(double value) Formats a numeric value for display in equipment bar labels.(package private) static List<StreamInterface> Resolves all inlet streams for a process equipment unit.
-
Field Details
-
X_SPACING
private static final double X_SPACINGHorizontal spacing between equipment columns (mm in drawing space).- See Also:
-
Y_BRANCH_OFFSET
private static final double Y_BRANCH_OFFSETVertical spacing for branch lines below the main process line.- See Also:
-
X_START
private static final double X_STARTStarting X coordinate.- See Also:
-
Y_BASE
private static final double Y_BASEBase Y coordinate for the main process line.- See Also:
-
DEFAULT_SCALE
private static final double DEFAULT_SCALEDefault scale factor for equipment shapes.- See Also:
-
FONT_NAME
-
TAG_FONT_HEIGHT
private static final double TAG_FONT_HEIGHTFont height for tag name labels.- See Also:
-
TAG_LABEL_OFFSET_Y
private static final double TAG_LABEL_OFFSET_YVertical offset of tag name label above equipment center.- See Also:
-
BAR_FONT_HEIGHT
private static final double BAR_FONT_HEIGHTFont height for equipment bar label text.- See Also:
-
BAR_WIDTH
private static final double BAR_WIDTHWidth of equipment bar label box.- See Also:
-
BAR_ROW_HEIGHT
private static final double BAR_ROW_HEIGHTRow height within equipment bar label table.- See Also:
-
BAR_OFFSET_Y
private static final double BAR_OFFSET_YVertical offset from equipment center to top of bar label.- See Also:
-
INSTRUMENT_OFFSET_Y
static final double INSTRUMENT_OFFSET_YVertical offset from process line to instrument bubble center.- See Also:
-
INSTRUMENT_X_SPACING
static final double INSTRUMENT_X_SPACINGHorizontal spacing between instrument bubbles on the same equipment.- See Also:
-
INSTRUMENT_BUBBLE_RADIUS
static final double INSTRUMENT_BUBBLE_RADIUSRadius of instrument bubble for connection point calculations.- See Also:
-
SIGNAL_LINE_WEIGHT
private static final double SIGNAL_LINE_WEIGHTLine weight for measuring/signal lines.- See Also:
-
PROCESS_LINE_WEIGHT
private static final double PROCESS_LINE_WEIGHTLine weight for process piping lines.- See Also:
-
LINE_COLOR_R
Presentation colour R for process piping lines (olive).- See Also:
-
LINE_COLOR_G
Presentation colour G for process piping lines (olive).- See Also:
-
LINE_COLOR_B
Presentation colour B for process piping lines (olive).- See Also:
-
MIN_SHEET_WIDTH
private static final double MIN_SHEET_WIDTHMinimum drawing sheet width (A3 landscape in mm).- See Also:
-
MIN_SHEET_HEIGHT
private static final double MIN_SHEET_HEIGHTMinimum drawing sheet height (A3 landscape in mm).- See Also:
-
BORDER_MARGIN
private static final double BORDER_MARGINMargin between outer edge and inner border.- See Also:
-
TITLE_BLOCK_HEIGHT
private static final double TITLE_BLOCK_HEIGHTTitle block height at the bottom-right.- See Also:
-
TITLE_BLOCK_WIDTH
private static final double TITLE_BLOCK_WIDTHTitle block width.- See Also:
-
TITLE_ROW_HEIGHT
private static final double TITLE_ROW_HEIGHTRow height inside title block.- See Also:
-
TITLE_FONT_HEIGHT
private static final double TITLE_FONT_HEIGHTFont height for title block text.- See Also:
-
TITLE_MAIN_FONT_HEIGHT
private static final double TITLE_MAIN_FONT_HEIGHTFont height for the main drawing title.- See Also:
-
ARROW_LENGTH
private static final double ARROW_LENGTHLength of flow direction arrow heads.- See Also:
-
ARROW_HALF_WIDTH
private static final double ARROW_HALF_WIDTHHalf-width of flow direction arrow heads.- See Also:
-
TABLE_ROW_HEIGHT
private static final double TABLE_ROW_HEIGHTHeight of the stream data table header row.- See Also:
-
TABLE_COL_WIDTH
private static final double TABLE_COL_WIDTHWidth of each stream column in the stream table.- See Also:
-
TABLE_LABEL_WIDTH
private static final double TABLE_LABEL_WIDTHWidth of the row-label column in the stream table.- See Also:
-
TABLE_FONT_HEIGHT
private static final double TABLE_FONT_HEIGHTFont height for stream table text.- See Also:
-
TABLE_TOP_Y
private static final double TABLE_TOP_YTop of the stream table (Y coordinate).- See Also:
-
BATTERY_LIMIT_PADDING
private static final double BATTERY_LIMIT_PADDINGPadding around equipment for battery limit boundary (mm).- See Also:
-
BATTERY_LIMIT_LINE_WEIGHT
private static final double BATTERY_LIMIT_LINE_WEIGHTLine weight for battery limit boundary (bold dashed).- See Also:
-
LEGEND_WIDTH
private static final double LEGEND_WIDTHWidth of the symbol legend box (mm).- See Also:
-
LEGEND_ROW_HEIGHT
private static final double LEGEND_ROW_HEIGHTRow height in the legend box (mm).- See Also:
-
LEGEND_FONT_HEIGHT
private static final double LEGEND_FONT_HEIGHTFont height for legend text.- See Also:
-
REVISION_ROW_HEIGHT
private static final double REVISION_ROW_HEIGHTRow height in revision history table (mm).- See Also:
-
-
Constructor Details
-
DexpiLayoutEngine
private DexpiLayoutEngine()
-
-
Method Details
-
computeLayout
Computes layout positions for all equipment in a process system.Returns a map from equipment name to its
DexpiLayoutEngine.EquipmentPosition. The positions are computed using a topological ordering of the process graph, placing equipment left-to-right. Multi- outlet equipment branches are fanned out vertically.- Parameters:
processSystem- the process system to lay out- Returns:
- map of equipment name to computed position
-
appendPosition
static void appendPosition(Document document, Element element, DexpiLayoutEngine.EquipmentPosition pos) Appends a DEXPI Position element to an equipment element.- Parameters:
document- the XML documentelement- the equipment elementpos- the computed position
-
appendScale
static void appendScale(Document document, Element element, DexpiLayoutEngine.EquipmentPosition pos) Appends a DEXPI Scale element to an equipment element.- Parameters:
document- the XML documentelement- the equipment elementpos- the computed position containing scale factors
-
appendTagNameLabel
static void appendTagNameLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId) Appends an EquipmentTagNameLabel to an equipment element.- Parameters:
document- the XML documentelement- the equipment elementtagName- the equipment tag name to displaypos- the equipment positionlabelId- the unique label IDequipmentId- the equipment element ID (for TextStringFormatSpecification)
-
appendConnectionLine
static void appendConnectionLine(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a process piping line (CenterLine) connecting two nozzle positions.Uses orthogonal routing (horizontal-vertical-horizontal segments) when source and target are at different Y coordinates. Horizontal connections use a single straight segment. Line style matches the DEXPI standard process piping presentation (olive colour, 0.5 weight).
- Parameters:
document- the XML documentparent- the parent element (PipingNetworkSegment)fromX- source X coordinatefromY- source Y coordinatetoX- destination X coordinatetoY- destination Y coordinate
-
appendCoordinate
-
appendEquipmentBarLabel
static void appendEquipmentBarLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId, double pressure, double temperature, double flowRate) Appends an EquipmentBarLabel below an equipment element showing operating data.Renders a table with border lines and rows for equipment identity, operating pressure, operating temperature, and flow rate. This follows the DEXPI standard pattern for equipment data labels on P&IDs.
- Parameters:
document- the XML documentelement- the equipment elementtagName- the equipment tag namepos- the equipment positionlabelId- the unique label IDequipmentId- the equipment element IDpressure- operating pressure in bara (NaN to omit)temperature- operating temperature in C (NaN to omit)flowRate- operating flow rate in MSm3/day (NaN to omit)
-
appendEquipmentBarLabel
static void appendEquipmentBarLabel(Document document, Element element, String tagName, DexpiLayoutEngine.EquipmentPosition pos, String labelId, String equipmentId, double pressure, double temperature, double flowRate, List<String[]> extraRows) Appends an equipment bar label with operating data and optional extra rows.- Parameters:
document- the XML documentelement- the equipment elementtagName- the equipment tag namepos- the equipment positionlabelId- the unique label IDequipmentId- the equipment element IDpressure- operating pressure in bara (NaN to omit)temperature- operating temperature in C (NaN to omit)flowRate- operating flow rate in MSm3/day (NaN to omit)extraRows- additional label-value pairs to display (may be null)
-
appendNozzlePosition
-
appendBarPolyLine
private static void appendBarPolyLine(Document document, Element parent, double x1, double y1, double x2, double y2) Appends a PolyLine element used as a border in an equipment bar label.- Parameters:
document- the XML documentparent- the label elementx1- start Xy1- start Yx2- end Xy2- end Y
-
appendBarText
private static void appendBarText(Document document, Element parent, String text, double x, double y, String justification) Appends a Text element used in an equipment bar label row.- Parameters:
document- the XML documentparent- the label elementtext- the text stringx- the text X positiony- the text Y positionjustification- the text justification (e.g. "LeftBottom", "CenterBottom")
-
resolveInletStreams
Resolves all inlet streams for a process equipment unit. Handles both TwoPortEquipment (single inlet viagetInletStream()) and multi-port equipment like Separator and Mixer (viagetInletStreams()).- Parameters:
unit- the process equipment- Returns:
- list of inlet streams (never null, may be empty)
-
formatValue
Formats a numeric value for display in equipment bar labels.- Parameters:
value- the value to format- Returns:
- formatted string
-
computeInstrumentPosition
static double[] computeInstrumentPosition(DexpiLayoutEngine.EquipmentPosition equipmentPos, int instrumentIndex, int totalInstruments) Computes the layout position for an instrument bubble attached to a specific equipment.Instruments are placed above (higher Y) the equipment, offset by
INSTRUMENT_OFFSET_Y. Multiple instruments on the same equipment are spaced horizontally.- Parameters:
equipmentPos- the parent equipment positioninstrumentIndex- 0-based index of this instrument on the equipmenttotalInstruments- total number of instruments on this equipment- Returns:
- the instrument position {x, y}
-
appendMeasuringLine
static void appendMeasuringLine(Document document, Element parent, double tapX, double tapY, double bubbleX, double bubbleY) Appends a measuring line (CenterLine) connecting an equipment nozzle to an instrument bubble.The line runs vertically from a point on the process line up to the bottom of the instrument bubble. Uses green signal-line colour per DEXPI convention.
- Parameters:
document- the XML documentparent- the InformationFlow element to append totapX- X coordinate on the process line (tap point)tapY- Y coordinate on the process linebubbleX- X coordinate of the instrument bubble centerbubbleY- Y coordinate of the instrument bubble center
-
appendSignalLine
static void appendSignalLine(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a signal conveying line (dashed, blue) between two instrument bubbles.- Parameters:
document- the XML documentparent- the InformationFlow elementfromX- source bubble center XfromY- source bubble center YtoX- target bubble center XtoY- target bubble center Y
-
computeSheetSize
Computes the required drawing sheet dimensions to enclose all equipment, instruments, and labels with adequate margin. The result is at least A3 landscape (420 x 297 mm).- Parameters:
positions- the computed equipment layout positions- Returns:
- a two-element array {width, height} in mm
-
computePageGrid
static int[] computePageGrid(double totalWidth, double totalHeight, double maxPageWidth, double maxPageHeight) Computes the number of drawing pages needed for a large flowsheet.When the total equipment extent exceeds an A1 landscape sheet (841 x 594 mm), the flowsheet is split into multiple pages. Each page has its own Drawing element with border, title block, and continuation markings.
- Parameters:
totalWidth- the total layout width in mmtotalHeight- the total layout height in mmmaxPageWidth- maximum page width (default 841 mm for A1)maxPageHeight- maximum page height (default 594 mm for A1)- Returns:
- the number of pages as [columns, rows]
-
appendContinuationArrow
static void appendContinuationArrow(Document document, Element parent, double x, double y, String direction, String targetSheet) Appends a continuation arrow marking at the edge of a drawing page.Per ISO 10628 and NORSOK Z-003, when a P&ID spans multiple sheets, continuation arrows indicate where the process continues on adjacent sheets. The arrow is labeled with the destination sheet number.
- Parameters:
document- the XML documentparent- the Drawing elementx- the arrow X positiony- the arrow Y positiondirection- "RIGHT", "LEFT", "UP", or "DOWN"targetSheet- the destination sheet identifier (e.g. "Sheet 2")
-
appendDrawing
static void appendDrawing(Document document, Element parent, String drawingName, String drawingNumber, String revision, String date, double sheetWidth, double sheetHeight) Appends a complete DEXPI<Drawing>element with border, column/row markers, and a professional title block. The sheet dimensions are auto-computed to fit all content.- Parameters:
document- the XML documentparent- the PlantModel root elementdrawingName- the drawing title (e.g. process name)drawingNumber- the drawing number (e.g. "PID-001")revision- the revision string (e.g. "A")date- the drawing date stringsheetWidth- the computed sheet width in mmsheetHeight- the computed sheet height in mm
-
appendDrawingBorderLines
private static void appendDrawingBorderLines(Document document, Element border, double sheetWidth, double sheetHeight) Appends the outer and inner border rectangles.- Parameters:
document- the XML documentborder- the DrawingBorder elementsheetWidth- the sheet width in mmsheetHeight- the sheet height in mm
-
appendBorderRect
private static void appendBorderRect(Document document, Element parent, double x1, double y1, double x2, double y2, double lineWeight) Appends a rectangle as a closed PolyLine.- Parameters:
document- the XML documentparent- the parent elementx1- left Xy1- bottom Yx2- right Xy2- top YlineWeight- the line weight
-
appendColumnRowMarkers
private static void appendColumnRowMarkers(Document document, Element border, double sheetWidth, double sheetHeight) Appends column/row zone markers along the border edges (A-F vertical, 1-8 horizontal).- Parameters:
document- the XML documentborder- the DrawingBorder elementsheetWidth- the sheet width in mmsheetHeight- the sheet height in mm
-
appendBorderText
-
appendBorderTick
-
appendTitleBlock
private static void appendTitleBlock(Document document, Element drawing, String drawingName, String drawingNumber, String revision, String date, double sheetWidth) Appends the title block label in the bottom-right corner of the drawing.- Parameters:
document- the XML documentdrawing- the Drawing elementdrawingName- the drawing titledrawingNumber- the drawing numberrevision- the revisiondate- the date stringsheetWidth- the width of the drawing sheet in layout units
-
appendTitleCell
private static void appendTitleCell(Document document, Element parent, double x1, double y1, double x2, double y2, String text) Appends a cell in the title block with a border and text.- Parameters:
document- the XML documentparent- the label elementx1- left Xy1- bottom Yx2- right Xy2- top Ytext- the cell text
-
appendTitleText
private static void appendTitleText(Document document, Element parent, String text, double x, double y, double fontSize, String justification) Appends a text element for the title block.- Parameters:
document- the XML documentparent- the parent elementtext- the text stringx- X positiony- Y positionfontSize- font heightjustification- text justification
-
appendFlowArrow
static void appendFlowArrow(Document document, Element parent, double fromX, double fromY, double toX, double toY) Appends a solid triangular flow-direction arrow at the midpoint of a connection line.The arrow points from source to destination. For horizontal lines, the arrow points right. For orthogonal routed lines, the arrow is placed on the first horizontal segment. The arrow is rendered as a filled PolyLine triangle in the process line colour.
- Parameters:
document- the XML documentparent- the PipingNetworkSegment elementfromX- source X coordinatefromY- source Y coordinatetoX- destination X coordinatetoY- destination Y coordinate
-
appendStreamLabel
static void appendStreamLabel(Document document, Element parent, String streamNumber, double fromX, double fromY, double toX, double toY) Appends a stream number label at the midpoint of a connection line.- Parameters:
document- the XML documentparent- the PipingNetworkSegment elementstreamNumber- the stream/line number text to displayfromX- source X coordinatefromY- source Y coordinatetoX- destination X coordinatetoY- destination Y coordinate
-
appendStreamTable
static void appendStreamTable(Document document, Element parent, List<DexpiLayoutEngine.StreamTableEntry> streamData) Appends a process conditions table (stream table) at the bottom of the drawing.The table shows key process data (temperature, pressure, flow, phase) for each major stream in the process. This follows the standard P&ID convention of including a stream data table.
- Parameters:
document- the XML documentparent- the Drawing or PlantModel elementstreamData- ordered list of stream data entries
-
appendTableText
private static void appendTableText(Document document, Element parent, String text, double x, double y, String justification) Appends a text element for the stream table.- Parameters:
document- the XML documentparent- the label elementtext- the text stringx- X positiony- Y positionjustification- text justification
-
appendBatteryLimitBoundary
static void appendBatteryLimitBoundary(Document document, Element parent, Map<String, DexpiLayoutEngine.EquipmentPosition> positions, String areaLabel) Appends a dashed battery-limit boundary rectangle around all equipment.Per NORSOK Z-003 and ISO 10628, battery limits are shown as bold dash-dot lines enclosing the process unit boundary. The boundary is computed from the extremes of all equipment positions with padding.
- Parameters:
document- the XML documentparent- the Drawing or PlantModel elementpositions- all equipment positionsareaLabel- the battery limit label (e.g. "AREA 100 - GAS PROCESSING")
-
appendFailPositionMarker
static void appendFailPositionMarker(Document document, Element parent, String failPosition, double x, double y) Appends a valve fail-position marker text (FC, FO, FL) near a valve position.Per NORSOK Z-003, valve fail positions are marked adjacent to the valve symbol: FC = fail closed, FO = fail open, FL = fail last position.
- Parameters:
document- the XML documentparent- the PipingComponent (valve) elementfailPosition- the fail position code (FC, FO, or FL)x- the valve X coordinatey- the valve Y coordinate
-
appendPstMarker
Appends a PST (Partial Stroke Test) annotation marker near a safety valve.Per IEC 61508 and IEC 61511, valves with partial stroke test capability are annotated with a "PST" label and a distinctive marker to indicate online diagnostic capability.
- Parameters:
document- the XML documentparent- the parent elementx- the valve center Xy- the valve center Y
-
appendHeatTraceMark
static void appendHeatTraceMark(Document document, Element parent, String traceType, double fromX, double fromY, double toX, double toY) Appends a heat trace indication on a pipe segment.Per ISO 10628 and NORSOK Z-003, heat traced lines are indicated with a zigzag marking along the pipe and an "HT" or specific heat trace type code.
- Parameters:
document- the XML documentparent- the parent elementtraceType- the heat trace type code (e.g. "ET" for electric, "ST" for steam)fromX- source XfromY- source YtoX- destination XtoY- destination Y
-
appendWeightAnnotation
static void appendWeightAnnotation(Document document, Element parent, double dryWeightKg, double operatingWeightKg, double x, double y) Appends an equipment weight and center-of-gravity annotation marker.Shows the equipment dry weight and operating weight in a small annotation box below the equipment symbol. Used for mechanical design and layout planning.
- Parameters:
document- the XML documentparent- the parent elementdryWeightKg- the equipment dry weight in kg (0 to omit)operatingWeightKg- the operating weight in kg (0 to omit)x- the equipment center Xy- the equipment symbol bottom Y
-
appendSamplePoint
Appends a sample point symbol on a process line.Per ISO 10628, sample points are indicated with a small circle (or filled dot) with an "SP" label on the process line where grab or online samples can be taken.
- Parameters:
document- the XML documentparent- the parent elementtag- the sample point tag (e.g. "SP-001")x- the sample point Xy- the sample point Y
-
appendGaugeGlass
static void appendGaugeGlass(Document document, Element parent, double x, double yTop, double yBottom) Appends a gauge glass (level gauge) symbol on a vessel.Per ISO 10628, sight/gauge glasses on vessels are represented as a narrow rectangle alongside the vessel with connection stubs at top and bottom.
- Parameters:
document- the XML documentparent- the parent elementx- the gauge glass X position (vessel wall edge)yTop- the top connection YyBottom- the bottom connection Y
-
appendInsulationMark
static void appendInsulationMark(Document document, Element parent, String insulationCode, double fromX, double fromY, double toX, double toY) Appends insulation marking on a process line between two points.Per ISO 10628 and NORSOK Z-003, insulation is indicated by a short perpendicular tick mark on the process line with a code letter: H = hot insulation, C = cold insulation, P = personnel protection, A = acoustic.
- Parameters:
document- the XML documentparent- the PipingNetworkSegment elementinsulationCode- the insulation code (H, C, P, A)fromX- source XfromY- source YtoX- destination XtoY- destination Y
-
appendOrientationMarker
static void appendOrientationMarker(Document document, Element parent, String orientation, double x, double y) Appends an orientation marker (H or V) next to equipment, per ISO 10628 convention.- Parameters:
document- the XML documentparent- the equipment elementorientation- the orientation string ("H" or "V")x- equipment center Xy- equipment center Y
-
appendSilMarker
Appends a SIL level marker below an instrument bubble.Per NORSOK Z-003 and IEC 61511, safety instrumented functions are marked with their SIL level (SIL 1, SIL 2, SIL 3) below the instrument bubble. The text is shown in a distinctive style.
- Parameters:
document- the XML documentparent- the ProcessInstrumentationFunction elementsilLevel- the SIL level (1, 2, or 3)x- the instrument bubble center Xy- the instrument bubble center Y
-
appendSolenoidMarker
static void appendSolenoidMarker(Document document, Element parent, double valveX, double valveY, double controllerX, double controllerY) Appends a solenoid actuator diamond symbol near a valve position.Per ISA 5.1, solenoid-actuated valves (ESD, blowdown, HIPPS) are indicated with a small diamond symbol on the valve actuator stem, connected to the controller by a signal line.
- Parameters:
document- the XML documentparent- the parent element to append drawing primitives tovalveX- the valve center XvalveY- the valve center YcontrollerX- the controller bubble center XcontrollerY- the controller bubble center Y
-
appendStyledConnectionLine
static void appendStyledConnectionLine(Document document, Element parent, double fromX, double fromY, double toX, double toY, int lineType, String colorR, String colorG, String colorB) Appends a connection line with a specific line type for utility services.Per ISO 10628 and NORSOK Z-003, different piping services use distinct line styles: solid for process, dashed for steam/utility, dotted for drain, dash-dot for instrument air, etc.
- Parameters:
document- the XML documentparent- the PipingNetworkSegment elementfromX- source XfromY- source YtoX- destination XtoY- destination YlineType- ISO/DEXPI line type (0=solid, 1=dashed, 2=dotted, 3=dash-dot)colorR- red component (0-1)colorG- green component (0-1)colorB- blue component (0-1)
-
appendUtilityConnectionPoint
static void appendUtilityConnectionPoint(Document document, Element parent, String utilityCode, double x, double y, double targetX, double targetY) Appends a utility supply connection point with label and dashed connection line.Per ISO 10628, utility connections (instrument air, steam, cooling water, nitrogen) are shown as labeled connection stubs with dashed lines and a utility code identifier.
- Parameters:
document- the XML documentparent- the parent elementutilityCode- short code for the utility (e.g. "IA", "STM", "CW", "N2")x- connection X coordinatey- connection Y coordinatetargetX- equipment or valve X coordinate the utility connects totargetY- equipment or valve Y coordinate the utility connects to
-
appendLineIdLabel
static void appendLineIdLabel(Document document, Element parent, String lineSize, String fluidCode, String lineNumber, String pipingClass, double fromX, double fromY, double toX, double toY) Appends a formatted line identification label per ISO 10628 / NORSOK Z-003.The standard line ID format is: SIZE"-FLUID_CODE-LINE_NUMBER-PIPING_CLASS. For example: 6"-HC-001-A1B. The label is placed above the pipe midpoint.
- Parameters:
document- the XML documentparent- the PipingNetworkSegment elementlineSize- pipe nominal size (e.g. "6\"")fluidCode- fluid code (e.g. "HC")lineNumber- line number (e.g. "001")pipingClass- piping class code (e.g. "A1B", "150#")fromX- source XfromY- source YtoX- destination XtoY- destination Y
-
appendRevisionHistory
static void appendRevisionHistory(Document document, Element drawing, List<String[]> revisions, double sheetWidth) Appends a revision history table above the title block.Per NORSOK Z-003, the P&ID title block includes a revision history showing rev number, date, description, drawn by, and checked by for each revision.
- Parameters:
document- the XML documentdrawing- the Drawing elementrevisions- list of revision entries [rev, date, description, drawnBy, checkedBy]sheetWidth- the drawing sheet width
-
appendRevisionCell
private static void appendRevisionCell(Document document, Element parent, double x1, double y1, double x2, double y2, String text) Appends a cell for the revision history table.- Parameters:
document- the XML documentparent- the label elementx1- left Xy1- bottom Yx2- right Xy2- top Ytext- the cell text
-
appendSymbolLegend
Appends a symbol legend box listing line types, valve symbols, and abbreviations.Per ISO 10628, P&IDs include a legend explaining line type conventions and abbreviations. The legend is placed bottom-left to avoid overlap with the stream table and title block.
- Parameters:
document- the XML documentparent- the Drawing or PlantModel elemententries- list of legend entries [lineType, description]
-
appendLegendText
private static void appendLegendText(Document document, Element parent, String text, double x, double y, String justification, String fontSize) Appends text for the symbol legend box.- Parameters:
document- the XML documentparent- the label elementtext- the text stringx- X positiony- Y positionjustification- text justificationfontSize- font height as string
-