Needs a revisit to flatten the nested lines
This commit is contained in:
1 parent
1d637b6fcf
commit
50138a87b2
4 files changed
+24
-1
No files matched your search
@@ -46,6 +46,7 @@ _STYLES: dict[str, dict] = {
|
||||
"RF": {"top": "#AD1457", "bot": "#880E4F", "w": 64, "h": 44},
|
||||
"Undulator": {"top": "#558B2F", "bot": "#33691E", "w": 88, "h": 36},
|
||||
"Diagnostics": {"top": "#4527A0", "bot": "#311B92", "w": 64, "h": 44},
|
||||
"Vacuum": {"top": "#00838F", "bot": "#006064", "w": 64, "h": 36},
|
||||
"Target": {"top": "#B71C1C", "bot": "#7B0000", "w": 36, "h": 36},
|
||||
"Alignment": {"top": "#1565C0", "bot": "#0D3B8C", "w": 36, "h": 36},
|
||||
"Branch": {"top": "#F9A825", "bot": "#C17900", "w": 40, "h": 40},
|
||||
@@ -479,6 +480,22 @@ class BranchNode(BeamlineNode):
|
||||
p.drawLine(QPointF(cx + 2, cy), QPointF(cx + 9, cy + 7))
|
||||
|
||||
|
||||
class VacuumNode(BeamlineNode):
|
||||
"""Vacuum element — teal rect with a pump/vessel symbol."""
|
||||
def __init__(self, pos): super().__init__("Vacuum", pos)
|
||||
def _draw_body(self, p):
|
||||
p.setBrush(QBrush(self._gradient()))
|
||||
p.setPen(QPen(QColor("#00838F"), 1.5))
|
||||
p.drawRoundedRect(QRectF(0, 0, self.W, self.H), 5, 5)
|
||||
# simple pump symbol: circle with a vertical line
|
||||
cx, cy = self.W / 2, self.H / 2
|
||||
r = min(cx, cy) - 6
|
||||
p.setBrush(Qt.NoBrush)
|
||||
p.setPen(QPen(QColor("#80DEEA"), 1.5))
|
||||
p.drawEllipse(QPointF(cx, cy), r, r)
|
||||
p.drawLine(QPointF(cx, cy - r - 4), QPointF(cx, cy + r + 4))
|
||||
|
||||
|
||||
# ── Factory ───────────────────────────────────────────────────────────────────
|
||||
|
||||
_NODE_MAP: dict[str, type] = {
|
||||
@@ -490,6 +507,7 @@ _NODE_MAP: dict[str, type] = {
|
||||
"RF": RFNode,
|
||||
"Undulator": UndulatorNode,
|
||||
"Diagnostics": DiagnosticsNode,
|
||||
"Vacuum": VacuumNode,
|
||||
"Reference": ReferenceNode,
|
||||
"Target": TargetNode,
|
||||
"Alignment": AlignmentNode,
|
||||
|
||||
@@ -16,7 +16,8 @@ from .nodes import _STYLES
|
||||
|
||||
ELEMENT_GROUPS: list[tuple[str, list[str]]] = [
|
||||
("Elements", ["Dipole", "Quadrupole", "Sextupole",
|
||||
"Solenoid", "Corrector", "RF", "Undulator", "Diagnostics"]),
|
||||
"Solenoid", "Corrector", "RF", "Undulator", "Diagnostics",
|
||||
"Vacuum"]),
|
||||
("Markers", ["Reference", "Start", "End", "Target", "Alignment", "Branch"]),
|
||||
("Containers", ["Line", "Variable Line"]),
|
||||
]
|
||||
|
||||
@@ -200,6 +200,8 @@ class Vacuum(SimpleContainer):
|
||||
SimpleContainer.__init__(self, prop)
|
||||
if not ('Group' in prop): # prop.has_key('Group')):
|
||||
self.__dict__.update({'Group': 'Vacuum'})
|
||||
if not ('Group' in prop): # prop.has_key('Group')):
|
||||
self.__dict__.update({'Tag': 'VLAP'})
|
||||
self.__dict__.update({'angle': 0})
|
||||
|
||||
def writeElement(self, app):
|
||||
|
||||
Reference in new issue
Block a user