Add --tosvg switch to render seating as SVG, plus test images and docs
Sitzplatzverteilung.alsSVG() (libs/Strukturdaten.py) draws tables as white circles and people as colored circles inside their table's circle, colored by group membership. Table radius is derived from the number of seats so all person-circles fit without touching; the table-to-table grid spacing is derived from the largest table radius so tables never overlap regardless of their Koordinaten values. libs/platz.py gains a --tosvg switch that writes <indir>/Sitzplatzverteilung.svg alongside the existing text/CSV output. The three unittest scenarios now each write their rendering to doc/images/, and doc/docu_tests.md explains the three configurations and what each test actually verifies (including why the "split groups land on true neighbor tables" property only holds for a specifically chosen seed in the circle scenario, not in general). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,8 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'libs'))
|
||||
|
||||
from Strukturdaten import Gruppe, Gruppen, Person, Sitzplatzverteilung, Strafliste, Tisch, Tische
|
||||
|
||||
IMAGES_DIR = os.path.join(os.path.dirname(__file__), '..', 'doc', 'images')
|
||||
|
||||
|
||||
def erzeuge_personen(anzahl, start_id=1):
|
||||
return [Person(i, 'Vorname%d' % i, 'Nachname%d' % i) for i in range(start_id, start_id + anzahl)]
|
||||
@@ -48,6 +50,7 @@ class TestDreiTischeKettePaare(unittest.TestCase):
|
||||
def test_alle_paare_komplett_an_einem_tisch(self):
|
||||
SV = Sitzplatzverteilung( Tische=self.Tische, Gruppen=self.Gruppen,
|
||||
Strafen=self.Strafen, VIPListe={}, VIPs=Gruppe(0) )
|
||||
SV.alsSVG( os.path.join(IMAGES_DIR, 'drei_tische_kette_paare.svg') )
|
||||
|
||||
for G in (self.G1, self.G2, self.G3):
|
||||
self.assertEqual( SV.GruppenTeilungGet(G), 0,
|
||||
@@ -87,6 +90,7 @@ class TestVierTischeLinieViergruppen(unittest.TestCase):
|
||||
def test_viergruppen_bleiben_auf_zusammenhaengendem_tischpaar(self):
|
||||
SV = Sitzplatzverteilung( Tische=self.Tische, Gruppen=self.Gruppen,
|
||||
Strafen=self.Strafen, VIPListe={}, VIPs=Gruppe(0) )
|
||||
SV.alsSVG( os.path.join(IMAGES_DIR, 'vier_tische_linie_viergruppen.svg') )
|
||||
|
||||
# jede Gruppe wird genau einmal geteilt (2 Tische a 2 Plaetze)
|
||||
self.assertEqual( SV.GruppenTeilungGet(self.G1), 1 )
|
||||
@@ -138,6 +142,7 @@ class TestSechsTischeKreisDreiergruppen(unittest.TestCase):
|
||||
def test_dreiergruppen_je_einmal_auf_nachbartische_geteilt(self):
|
||||
SV = Sitzplatzverteilung( Tische=self.Tische, Gruppen=self.Gruppen,
|
||||
Strafen=self.Strafen, VIPListe={}, VIPs=Gruppe(0) )
|
||||
SV.alsSVG( os.path.join(IMAGES_DIR, 'sechs_tische_kreis_dreiergruppen.svg') )
|
||||
|
||||
# 4 Dreiergruppen = 12 Personen auf 6x2 = 12 Plaetzen -> alle Tische voll.
|
||||
# (SV.Tische ist eine Kopie der urspruenglichen Tische, siehe
|
||||
|
||||
Reference in New Issue
Block a user