Class BowTieSvgExporter
java.lang.Object
neqsim.process.safety.risk.bowtie.BowTieSvgExporter
- All Implemented Interfaces:
Serializable
Exports BowTie models to SVG format for visualization.
This class generates SVG (Scalable Vector Graphics) representations of bow-tie diagrams for use in reports, presentations, and web applications. The SVG output follows standard bow-tie visualization conventions with threats on the left, the hazard in the center, and consequences on the right.
SVG Structure
- Left side: Threats with prevention barriers
- Center: Hazard (top event)
- Right side: Consequences with mitigation barriers
Usage Example
BowTieModel model = new BowTieModel("HAZARD-001", "Vessel Rupture");
// ... configure model ...
BowTieSvgExporter exporter = new BowTieSvgExporter(model);
String svg = exporter.export();
Files.writeString(Path.of("bowtie.svg"), svg);
- Since:
- 3.3.0
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final intprivate static final intprivate intprivate BowTieModelprivate static final longprivate static final intprivate static final intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionBowTieSvgExporter(BowTieModel model) Creates an SVG exporter for the specified bow-tie model.BowTieSvgExporter(BowTieModel model, int width, int height) Creates an SVG exporter with custom dimensions. -
Method Summary
Modifier and TypeMethodDescriptionprivate StringEscapes XML special characters.export()Exports the bow-tie model to SVG format.Exports the bow-tie model to HTML with embedded SVG.private List<BowTieModel.Barrier> getBarriersForConsequence(BowTieModel.Consequence consequence) Gets barriers linked to a specific consequence.private List<BowTieModel.Barrier> Gets barriers linked to a specific threat.private StringGets connector lines.private StringGets consequence elements.private StringGets hazard element.intGets the canvas height.private StringGets legend.private StringGets statistics section.private StringGets CSS styles for the SVG.private StringGets SVG footer.private StringGets SVG header.private StringGets threat elements.private StringgetTitle()Gets the title section.intgetWidth()Gets the canvas width.voidsetHeight(int height) Sets the canvas height.voidsetWidth(int width) Sets the canvas width.private StringTruncates text to specified length.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
CANVAS_WIDTH
private static final int CANVAS_WIDTH- See Also:
-
CANVAS_HEIGHT
private static final int CANVAS_HEIGHT- See Also:
-
THREAT_X
private static final int THREAT_X- See Also:
-
HAZARD_X
private static final int HAZARD_X- See Also:
-
CONSEQUENCE_X
private static final int CONSEQUENCE_X- See Also:
-
BOX_WIDTH
private static final int BOX_WIDTH- See Also:
-
BOX_HEIGHT
private static final int BOX_HEIGHT- See Also:
-
BARRIER_WIDTH
private static final int BARRIER_WIDTH- See Also:
-
BARRIER_HEIGHT
private static final int BARRIER_HEIGHT- See Also:
-
VERTICAL_SPACING
private static final int VERTICAL_SPACING- See Also:
-
COLOR_THREAT
- See Also:
-
COLOR_HAZARD
- See Also:
-
COLOR_CONSEQUENCE
- See Also:
-
COLOR_PREVENTION
- See Also:
-
COLOR_MITIGATION
- See Also:
-
COLOR_LINE
- See Also:
-
COLOR_TEXT
- See Also:
-
model
-
width
private int width -
height
private int height
-
-
Constructor Details
-
BowTieSvgExporter
Creates an SVG exporter for the specified bow-tie model.- Parameters:
model- bow-tie model to export
-
BowTieSvgExporter
Creates an SVG exporter with custom dimensions.- Parameters:
model- bow-tie model to exportwidth- canvas width in pixelsheight- canvas height in pixels
-
-
Method Details
-
export
-
getSvgHeader
-
getStyles
-
getTitle
-
getThreats
-
getBarriersForThreat
Gets barriers linked to a specific threat.- Parameters:
threat- the threat- Returns:
- list of barriers linked to the threat
-
getBarriersForConsequence
Gets barriers linked to a specific consequence.- Parameters:
consequence- the consequence- Returns:
- list of barriers linked to the consequence
-
getHazard
-
getConsequences
-
getConnectors
-
getLegend
-
getStatistics
-
escapeXml
-
truncate
-
exportToHtml
Exports the bow-tie model to HTML with embedded SVG.- Returns:
- HTML string
-
getWidth
public int getWidth()Gets the canvas width.- Returns:
- width in pixels
-
setWidth
public void setWidth(int width) Sets the canvas width.- Parameters:
width- width in pixels
-
getHeight
public int getHeight()Gets the canvas height.- Returns:
- height in pixels
-
setHeight
public void setHeight(int height) Sets the canvas height.- Parameters:
height- height in pixels
-